/* Games Gallery Page Stylesheet - QupuStudio */

:root {
  --neon-egg: #ff6a00;
  --neon-cyber: #00f0ff;
  --neon-pokid: #ffcc00;
  --neon-mystery: #a300ff;
  --neon-towerbound: #2dd4bf;
  --card-bg: #101522;
  --card-bg-hover: #161e30;
}

body {
  background-color: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

/* Background grid animation */
.games-page-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  padding-top: 130px;
  padding-bottom: 100px;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(11, 116, 255, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(255, 31, 90, 0.04) 0%, transparent 40%);
  overflow: hidden;
}

/* Canvas Physics Layer */
#physics-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none; /* Allows interaction underneath */
}

.games-content-inner {
  position: relative;
  z-index: 2; /* Sits above canvas for readability but allows background visuals */
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

/* Header & Intro */
.games-hero {
  text-align: center;
  margin-bottom: 70px;
}

.games-hero h1 {
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 850;
  line-height: 1.1;
  margin: 16px 0 24px;
  background: linear-gradient(135deg, #fff 30%, #7db8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.games-hero .hero-lead {
  font-size: 18px;
  color: var(--muted);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.8;
}

/* Floating Egg Widget */
.egg-control-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.egg-trigger-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #131a2a url("./games/eggtopia/egg-ex.png") center / 38px no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 16px rgba(255, 106, 0, 0.25);
  display: grid;
  place-items: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: float-widget 3s ease-in-out infinite;
}

.egg-trigger-btn:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 12px 32px rgba(255, 31, 90, 0.6);
}

.egg-trigger-btn:active {
  transform: scale(0.95);
}

.egg-widget-label {
  background: rgba(8, 10, 18, 0.85);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 11px;
  color: #7db8ff;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

@keyframes float-widget {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Cards Grid Layout */
.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
  margin-bottom: 100px;
}

/* Card Structure */
.game-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 520px;
  transform-style: preserve-3d;
  transform: perspective(1000px);
  transition: border-color 0.4s, box-shadow 0.4s, transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.game-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Custom glow borders per game */
.game-card.eggtopia:hover {
  box-shadow: 0 20px 45px rgba(255, 106, 0, 0.15);
  border-color: rgba(255, 106, 0, 0.3);
}

.game-card.cyber:hover {
  box-shadow: 0 20px 45px rgba(0, 240, 255, 0.15);
  border-color: rgba(0, 240, 255, 0.3);
}

.game-card.pokid:hover {
  box-shadow: 0 20px 45px rgba(255, 204, 0, 0.12);
  border-color: rgba(255, 204, 0, 0.3);
}

.game-card.towerbound:hover {
  box-shadow: 0 20px 45px rgba(45, 212, 191, 0.15);
  border-color: rgba(45, 212, 191, 0.3);
}

.game-card.mystery:hover {
  box-shadow: 0 20px 45px rgba(163, 0, 255, 0.12);
  border-color: rgba(163, 0, 255, 0.3);
}

/* Card Visual Header */
.game-card-visual {
  position: relative;
  height: 270px;
  overflow: hidden;
  background: #000;
}

.game-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1), filter 0.6s;
}

.game-card:hover .game-card-img {
  transform: scale(1.05);
}

/* Video Hover Container */
.game-card-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.game-card:hover .game-card-video {
  opacity: 1;
}

/* Visual Overlays */
.game-card-badge {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 3;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.eggtopia .game-card-badge { background: linear-gradient(135deg, #ff8c00, #ff5500); }
.cyber .game-card-badge { background: linear-gradient(135deg, #00d2ff, #0072ff); }
.pokid .game-card-badge { background: linear-gradient(135deg, #fbc2eb, #a6c1ee); color: #111; }
.towerbound .game-card-badge { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.mystery .game-card-badge { background: linear-gradient(135deg, #8a2be2, #4b0082); }

/* Card Content Info */
.game-card-body {
  padding: 30px;
  display: flex;
  flex-direction: column;
  flex: 1;
  transform: translateZ(30px); /* 3D layer pop */
}

.game-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.game-icon-round {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.08);
}

.game-title-container {
  display: grid;
  gap: 2px;
}

.game-card h3 {
  font-size: 24px;
  font-weight: 750;
  margin: 0;
  color: #fff;
}

.game-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.game-meta-row span:not(:last-child)::after {
  content: '·';
  margin-left: 12px;
  color: var(--soft);
}

.game-card-desc {
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
  margin-top: 14px;
  margin-bottom: 24px;
  flex: 1;
}

/* Countdown Component */
.countdown-box {
  background: rgba(0, 240, 255, 0.04);
  border: 1px solid rgba(0, 240, 255, 0.15);
  padding: 12px 18px;
  border-radius: 14px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cyber .countdown-box {
  background: rgba(0, 240, 255, 0.04);
  border-color: rgba(0, 240, 255, 0.15);
}

.towerbound .countdown-box {
  background: rgba(45, 212, 191, 0.06);
  border-color: rgba(45, 212, 191, 0.22);
}

.countdown-label {
  font-size: 12px;
  font-weight: 750;
  color: var(--neon-cyber);
  letter-spacing: 1px;
}

.towerbound .countdown-label {
  color: var(--neon-towerbound);
}

.countdown-timer {
  display: flex;
  gap: 10px;
  font-family: monospace;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.countdown-timer span {
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.08);
}

/* Card Actions */
.game-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.game-launch-date {
  font-size: 13px;
  color: var(--soft);
  flex-shrink: 0;
}

.game-launch-date strong {
  color: var(--muted);
}

.game-card-buttons {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-game-action {
  height: 40px;
  padding: 0 20px;
  font-size: 13px;
  border-radius: 20px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-game-action.primary {
  color: #fff;
  background: linear-gradient(135deg, #ff1f5a, #ff6600);
}

.btn-game-action.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 31, 90, 0.4);
}

.btn-game-action.secondary {
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
}

.btn-game-action.secondary:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
}

.btn-game-action.disabled {
  color: var(--soft);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.01);
  cursor: not-allowed;
}

/* Gameplay (Play) button with inline triangle icon */
.gameplay-btn {
  /* Inherits .btn-game-action.secondary base styles */
  position: relative;
  font-family: inherit;
  cursor: pointer;
  user-select: none;
}

.gameplay-btn .play-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 9px;
  border-color: transparent transparent transparent currentColor;
  display: inline-block;
  flex-shrink: 0;
}

.gameplay-btn:not(.disabled):hover .play-icon {
  filter: drop-shadow(0 0 6px rgba(255, 106, 0, 0.6));
}

.gameplay-btn.disabled {
  color: var(--soft);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.01);
  cursor: not-allowed;
  opacity: 0.6;
}

.gameplay-btn.disabled .play-icon {
  border-color: transparent transparent transparent var(--soft);
}

/* Mystery Game Card specifics */
.game-card.mystery {
  background: linear-gradient(180deg, #101522 0%, #0d0f18 100%);
  border: 1px dashed rgba(163, 0, 255, 0.25);
  justify-content: center;
  align-items: center;
  text-align: center;
}

.mystery-content {
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transform: translateZ(40px);
}

.mystery-icon {
  font-size: 48px;
  filter: drop-shadow(0 0 12px rgba(163, 0, 255, 0.4));
  animation: pulse-mystery 2s infinite alternate;
}

@keyframes pulse-mystery {
  0% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(163,0,255,0.3)); }
  100% { transform: scale(1.1); filter: drop-shadow(0 0 25px rgba(163,0,255,0.7)); }
}

.game-card.mystery h3 {
  color: var(--neon-mystery);
  letter-spacing: 2px;
}

/* About Studio section (文案展示区) */
.studio-about-section {
  margin-top: 120px;
  background: linear-gradient(180deg, #0b0e17 0%, #080a12 100%);
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: 60px 50px;
}

.studio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
}

/* TapTap Card Styles */
.taptap-card {
  margin-top: 32px;
  background: rgba(1, 194, 206, 0.04);
  border: 1px solid rgba(1, 194, 206, 0.16);
  border-radius: 20px;
  padding: 24px 28px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.taptap-card:hover {
  transform: translateY(-2px);
  border-color: rgba(1, 194, 206, 0.4);
  box-shadow: 0 12px 40px rgba(1, 194, 206, 0.15);
}

.taptap-badge {
  font-size: 11px;
  color: #01c2ce;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: inline-block;
}

.taptap-card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 18px;
}

.taptap-btn {
  height: 38px;
  padding: 0 20px;
  border-radius: 19px;
  background: #01c2ce;
  color: #0c0e15 !important;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.taptap-btn:hover {
  background: #00e6f4;
  box-shadow: 0 6px 20px rgba(1, 194, 206, 0.4);
}

.taptap-icon {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.studio-intro-title h2 {
  font-size: 38px;
  line-height: 1.25;
  margin: 16px 0 24px;
  background: linear-gradient(135deg, #fff 0%, #a6c1ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.studio-paragraphs {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.studio-block {
  position: relative;
  padding-left: 24px;
}

.studio-block::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 0;
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, #ff1f5a, #ff6600);
  border-radius: 2px;
}

.studio-block h4 {
  font-size: 17px;
  font-weight: 750;
  margin: 0 0 8px;
  color: #fff;
  letter-spacing: 0.5px;
}

.studio-block p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--muted);
  margin: 0;
}

/* Responsive adjustment */
@media (max-width: 1000px) {
  .games-grid {
    grid-template-columns: 1fr;
  }
  .studio-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .studio-about-section {
    padding: 40px 30px;
  }
}

@media (max-width: 600px) {
  .games-page-container {
    padding-top: 100px;
    padding-bottom: 60px;
  }
  .game-card {
    min-height: 480px;
  }
  .game-card-visual {
    height: 200px;
  }
}

/* ===========================================================
   Gameplay Video Modal
   - 横屏 (landscape) : data-orientation="landscape" -> 16:9
   - 竖屏 (portrait)  : data-orientation="portrait"  -> 9:16
   =========================================================== */

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 6, 12, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.video-modal.is-open {
  display: flex;
  opacity: 1;
}

.video-modal-dialog {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: scale(0.96);
  transition: transform 0.25s ease;
}

.video-modal.is-open .video-modal-dialog {
  transform: scale(1);
}

/* Landscape: 16:9 frame, max ~960px wide */
.video-modal-dialog[data-orientation="landscape"] {
  max-width: min(960px, 92vw);
  aspect-ratio: 16 / 9;
}

/* Portrait (Shorts): 9:16 frame, max ~360px wide */
.video-modal-dialog[data-orientation="portrait"] {
  max-width: min(360px, 86vw);
  aspect-ratio: 9 / 16;
  max-height: 86vh;
}

.video-modal-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-modal-close {
  position: absolute;
  top: -48px;
  right: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 10, 18, 0.7);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 2;
}

.video-modal-close:hover {
  background: rgba(255, 31, 90, 0.85);
  border-color: rgba(255, 31, 90, 0.9);
  transform: rotate(90deg);
}

.video-modal-close:focus-visible {
  outline: 2px solid var(--neon-cyber);
  outline-offset: 2px;
}

body.no-scroll {
  overflow: hidden;
}

.video-modal-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -54px;
  margin: 0;
  padding: 10px 16px;
  background: rgba(8, 10, 18, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}

.video-modal-hint[hidden] {
  display: none;
}

.video-modal-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  color: #fff;
}

@media (max-width: 600px) {
  .video-modal {
    padding: 12px;
  }
  .video-modal-close {
    top: -42px;
    width: 34px;
    height: 34px;
    font-size: 20px;
  }
  .game-card-buttons {
    width: 100%;
    justify-content: flex-end;
  }
  .btn-game-action {
    height: 36px;
    padding: 0 16px;
    font-size: 12px;
  }
}
