:root {
  --bg-start: #05070d;
  --bg-end: #0a1730;
  --surface: #e7edf6;
  --line: #c9d5e6;
  --text: #0f172a;
  --panel: #1a2338;
  --panel-border: #2b3856;
  --muted: #9fb0d8;
  --accent: #76a1ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: radial-gradient(120% 140% at 85% 8%, #102544 0%, transparent 45%),
    linear-gradient(160deg, var(--bg-start) 0%, var(--bg-end) 100%);
  color: var(--text);
  min-height: 100vh;
}

.page-wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.top-strip {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8, 10, 23, 0.92);
  border-bottom: 1px solid rgba(126, 153, 255, 0.24);
  backdrop-filter: blur(8px);
}

.top-bar {
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 0.35rem 0;
}

.icon-button img {
  width: clamp(168px, 26vw, 280px);
  height: auto;
  display: block;
}

.game-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  padding: 1rem 0 2rem;
}



.game-stage,
.game-info {
  grid-column: 1;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 10px 24px rgba(9, 20, 36, 0.08);
}

.game-viewport {
  width: min(100%, 768px);
  aspect-ratio: 3 / 4;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #0b1324;
}

.game-viewport.prelaunch::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, #2f4f85 0%, #0b1326 62%);
  filter: blur(12px);
  transform: scale(1.08);
  z-index: 0;
}

.game-viewport.prelaunch #board {
  opacity: 0.2;
}

.tetris-shell {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 10px;
  padding: 10px;
  z-index: 1;
}

.board-panel {
  position: relative;
  background: #0c1220;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

#board {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 8px;
  background: #0b1324;
}


.audio-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 6;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(188, 210, 255, 0.62);
  background: rgba(13, 24, 51, 0.82);
  color: #e8f1ff;
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.audio-toggle:hover {
  background: rgba(22, 39, 78, 0.92);
}

.overlay {
  position: absolute;
  inset: 8px;
  border-radius: 8px;
  background: rgba(6, 12, 22, 0.72);
  backdrop-filter: blur(2px);
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 14px;
  z-index: 4;
}

.overlay.hidden {
  display: none;
}

.overlay h1 {
  margin: 0 0 8px;
  color: #e8eefc;
  font-size: clamp(30px, 5vw, 42px);
  letter-spacing: 0.06em;
}

.overlay p {
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: clamp(14px, 2.1vw, 18px);
}

.side-panel {
  display: grid;
  gap: 8px;
  align-content: start;
  color: #e8eefc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

.title {
  margin: 0;
  text-align: center;
  letter-spacing: 0.08em;
  font-size: clamp(20px, 2.4vw, 28px);
}

.side-panel .card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 9px 10px;
  box-shadow: none;
}

.stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.stat span {
  color: var(--muted);
}

.stat strong {
  font-size: 1.35rem;
  transition: transform 120ms ease;
  transform-origin: center right;
}

.stat strong.pop {
  transform: scale(1.06);
}

.next-box {
  display: grid;
  gap: 6px;
}

.next-box span,
.options span {
  color: var(--muted);
}

#next {
  width: 100%;
  max-width: 140px;
  justify-self: center;
  display: block;
  background: #10192c;
  border: 1px solid #314165;
  border-radius: 8px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.toggle input {
  accent-color: var(--accent);
}

.help p {
  margin: 3px 0;
  color: var(--muted);
  font-size: 0.85rem;
}







.game-info h2 {
  margin: 0 0 0.45rem;
}

.game-info p {
  margin: 0.28rem 0;
}

.site-footer {
  border-top: 1px solid rgba(177, 198, 233, 0.28);
  padding: 1rem 0 1.5rem;
  color: #d5e2ff;
}

@media (max-width: 980px) {
  .game-page {
    grid-template-columns: 1fr;
  }
  .game-stage,
  .game-info {
    grid-column: 1;
  }

  .tetris-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .title,
  .help {
    grid-column: 1 / -1;
  }
}



.overlay #startBtn {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(135deg, #4f7bff, #6b5dff);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  font-size: clamp(1.08rem, 1.4vw, 1.3rem);
  padding: 0.72rem 1.28rem;
  cursor: pointer;
}



