/* =============================================
   ChinYong.net — Retro Games
   ============================================= */

.games-body {
  background:
    linear-gradient(180deg, rgba(0, 10, 18, 0.96), rgba(0, 10, 18, 1)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0, rgba(255, 255, 255, 0.035) 1px, transparent 1px, transparent 5px);
}

.games-page {
  position: relative;
  z-index: 1;
}

.games-hero-section {
  min-height: 72vh;
  min-height: 72dvh;
  display: flex;
  align-items: center;
  padding-top: calc(clamp(5rem, 10vw, 8rem) + var(--safe-top));
  padding-bottom: 3rem;
  background:
    linear-gradient(135deg, rgba(0, 229, 255, 0.11), transparent 34%),
    radial-gradient(circle at 78% 30%, rgba(255, 82, 146, 0.12), transparent 25%),
    radial-gradient(circle at 18% 76%, rgba(255, 207, 90, 0.12), transparent 24%);
}

.games-hero-inner {
  max-width: 820px;
}

.games-title {
  font-family: var(--font-mono);
  font-size: clamp(2.1rem, 7vw, 4.5rem);
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 1.3rem;
}

.games-intro {
  max-width: 680px;
  color: var(--text-secondary);
  font-size: clamp(1rem, 2.3vw, 1.2rem);
  line-height: 1.75;
  margin-bottom: 2rem;
}

.games-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.arcade-section {
  background: rgba(0, 18, 32, 0.92);
  padding-top: 4rem;
}

.arcade-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.5rem;
  align-items: start;
  max-width: 1180px;
}

.arcade-stage,
.game-library {
  border: 1px solid var(--border);
  background: rgba(0, 10, 18, 0.7);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.arcade-stage {
  border-radius: 12px;
  padding: clamp(1rem, 2vw, 1.4rem);
}

.game-library {
  border-radius: 12px;
  padding: 1.2rem;
  position: sticky;
  top: calc(5rem + var(--safe-top));
  max-height: calc(100vh - 6rem - var(--safe-top));
  overflow-y: auto;
}

.game-library .section-tag {
  color: #ffcf5a;
  margin-bottom: 1rem;
}

.arcade-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.arcade-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-comment);
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

.arcade-topbar h2 {
  font-family: var(--font-mono);
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  line-height: 1.2;
  color: var(--text-primary);
}

.arcade-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.arcade-stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(0, 229, 255, 0.18);
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.06);
}

.arcade-stats strong {
  color: #ffcf5a;
}

.screen-frame {
  width: 100%;
  aspect-ratio: 1;
  max-height: min(68vh, 640px);
  border-radius: 10px;
  border: 1px solid rgba(0, 229, 255, 0.2);
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    #020712;
  background-size: 24px 24px;
  padding: clamp(0.45rem, 1.2vw, 0.75rem);
  box-shadow: inset 0 0 36px rgba(0, 229, 255, 0.08);
  overflow: hidden;
}

#arcade-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  background: #020712;
  touch-action: none;
  image-rendering: auto;
}

.game-status {
  min-height: 34px;
  margin: 1rem 0;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(255, 207, 90, 0.18);
  border-radius: 8px;
  background: rgba(255, 207, 90, 0.06);
  color: #ffcf5a;
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.arcade-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.option-field {
  min-width: 180px;
  display: grid;
  gap: 0.35rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.option-field select,
.toggle-btn {
  min-height: 42px;
  border: 1px solid rgba(0, 229, 255, 0.22);
  border-radius: 8px;
  background: rgba(0, 26, 46, 0.76);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.option-field select {
  padding: 0 2rem 0 0.8rem;
  cursor: pointer;
}

.toggle-btn {
  align-self: end;
  padding: 0 1rem;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}

.toggle-btn:hover,
.toggle-btn[aria-pressed="true"] {
  border-color: rgba(255, 207, 90, 0.5);
  background: rgba(255, 207, 90, 0.1);
  color: #ffcf5a;
}

.toggle-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.arcade-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.arcade-actions .btn {
  max-width: none;
  width: auto;
  min-width: 132px;
}

.touch-controls {
  width: 172px;
  height: 172px;
  display: grid;
  grid-template-columns: repeat(3, 54px);
  grid-template-rows: repeat(3, 54px);
  gap: 5px;
  margin: 0 auto;
}

.control-btn {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(0, 229, 255, 0.28);
  border-radius: 10px;
  background: rgba(0, 229, 255, 0.08);
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
  touch-action: manipulation;
}

.control-btn:hover,
.control-btn:active {
  background: rgba(0, 229, 255, 0.18);
  border-color: rgba(0, 229, 255, 0.55);
  transform: translateY(-1px);
}

.control-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.control-up { grid-column: 2; grid-row: 1; }
.control-left { grid-column: 1; grid-row: 2; }
.control-fire { grid-column: 2; grid-row: 2; }
.control-right { grid-column: 3; grid-row: 2; }
.control-down { grid-column: 2; grid-row: 3; }

.game-choice {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.95rem;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(0, 229, 255, 0.13);
  border-radius: 10px;
  background: rgba(0, 26, 46, 0.58);
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}

.game-choice:hover,
.game-choice.active {
  border-color: rgba(255, 207, 90, 0.42);
  background: rgba(255, 207, 90, 0.08);
  color: var(--text-primary);
  transform: translateX(3px);
}

.game-choice-code {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid rgba(255, 207, 90, 0.25);
  color: #ffcf5a;
  font-family: var(--font-mono);
  font-weight: 700;
}

.game-choice strong,
.game-choice small {
  display: block;
}

.game-choice strong {
  font-family: var(--font-mono);
  font-size: 0.98rem;
  line-height: 1.3;
}

.game-choice small {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.arcade-note {
  margin-top: 1rem;
  padding: 1rem;
  border-left: 2px solid #ffcf5a;
  border-radius: 0 8px 8px 0;
  background: rgba(255, 207, 90, 0.06);
}

.arcade-note .comment {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.65;
}

@media (max-width: 980px) {
  .arcade-layout {
    grid-template-columns: 1fr;
  }

  .game-library {
    position: static;
    order: -1;
  }
}

@media (max-width: 768px) {
  .games-hero-section {
    min-height: auto;
    padding-bottom: 2rem;
  }

  .games-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .arcade-section {
    padding-top: 2.5rem;
  }

  .arcade-topbar {
    flex-direction: column;
  }

  .arcade-stats {
    justify-content: flex-start;
  }

  .arcade-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .option-field {
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .arcade-stage,
  .game-library {
    border-radius: 10px;
  }

  .screen-frame {
    padding: 0.35rem;
  }

  .arcade-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .arcade-actions .btn {
    min-width: 0;
    width: 100%;
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  .arcade-options {
    grid-template-columns: 1fr;
  }

  .toggle-btn {
    align-self: stretch;
  }
}
