/* ===================================================
   TETRIS — STB Premium Design System (PC & Mobile)
   =================================================== */

:root {
  /* 폰트 정의 (Apple 시스템 폰트 우선으로 0ms 즉시 렌더링) */
  --font-title: -apple-system, BlinkMacSystemFont, "SF Pro Display", 'Outfit', 'Montserrat', "Segoe UI", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", 'Inter', 'Noto Sans KR', "Segoe UI", sans-serif;

  /* 라운드 & 트랜지션 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-board: 18px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;

  /* Dark Theme (기본값) */
  --bg-app: #090d16;
  --bg-card: rgba(17, 24, 39, 0.72);
  --bg-card-hover: rgba(24, 31, 48, 0.88);
  --border-color: rgba(255, 255, 255, 0.09);
  --border-highlight: rgba(255, 255, 255, 0.18);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #090d16;
  
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --accent: #3ed8b6;
  --accent-glow: rgba(62, 216, 182, 0.35);
  --accent-dim: rgba(62, 216, 182, 0.12);

  --purple: #ad7eff;
  --purple-glow: rgba(173, 126, 255, 0.3);
  
  --gold: #ffd700;
  --gold-glow: rgba(255, 215, 0, 0.3);
  --danger: #ff6f7d;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 12px 28px -6px rgba(0, 0, 0, 0.4), 0 6px 12px -4px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 20px 48px -10px rgba(0, 0, 0, 0.55), 0 10px 20px -8px rgba(0, 0, 0, 0.35);
  --glass-blur: blur(10px);

  --board-bg: linear-gradient(180deg, rgba(5, 11, 24, 0.95) 0%, rgba(8, 16, 34, 0.98) 100%);
  --board-border: rgba(62, 216, 182, 0.28);
}

[data-theme="light"] {
  /* Light Theme */
  --bg-app: #eef2f8;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.96);
  --border-color: rgba(203, 213, 225, 0.85);
  --border-highlight: rgba(99, 102, 241, 0.3);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.2);

  --accent: #0d9488;
  --accent-glow: rgba(13, 148, 136, 0.25);
  --accent-dim: rgba(13, 148, 136, 0.1);

  --purple: #7c3aed;
  --purple-glow: rgba(124, 58, 237, 0.2);

  --gold: #d97706;
  --gold-glow: rgba(217, 119, 6, 0.25);
  --danger: #ef4444;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 24px -5px rgba(79, 70, 229, 0.08), 0 6px 12px -4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 40px -10px rgba(79, 70, 229, 0.12), 0 10px 20px -8px rgba(0, 0, 0, 0.06);
  --glass-blur: blur(8px);

  --board-bg: linear-gradient(180deg, rgba(241, 245, 249, 0.96) 0%, rgba(226, 232, 240, 0.98) 100%);
  --board-border: rgba(79, 70, 229, 0.3);
}

/* ─── 초기화 ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-body);
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

/* ─── 앰비언트 메쉬 배경 (GPU 가속 최적화) ─── */
.bg-gradient-mesh {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  transform: translateZ(0);
}

.bg-gradient-mesh::before,
.bg-gradient-mesh::after {
  content: '';
  position: absolute;
  width: 450px;
  height: 450px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  transform: translateZ(0);
}

.bg-gradient-mesh::before {
  background: var(--primary);
  top: -10%;
  right: -5%;
}

.bg-gradient-mesh::after {
  background: var(--accent);
  bottom: -10%;
  left: -5%;
}

/* ─── App Shell ─── */
.app-shell {
  width: min(940px, 100%);
  margin: 0 auto;
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* ─── 헤더 영역 ─── */
.app-header {
  width: 100%;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  padding: 4px 0;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-wrap {
  text-align: center;
}

.logo-title {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: clamp(2rem, 4.5vw, 3rem);
  letter-spacing: 0.2em;
  background: linear-gradient(135deg, #ffffff 15%, #a5b4fc 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px var(--accent-glow));
  display: inline-block;
  padding-left: 0.2em;
  line-height: 1.1;
}

[data-theme="light"] .logo-title {
  background: linear-gradient(135deg, #1e1b4b 20%, #4338ca 60%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px var(--primary-glow));
}

.subtitle {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* 버튼 아이콘 (테마/사운드 토글) */
.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  transform: translateY(-1px);
}

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

.btn-icon.active {
  color: var(--accent);
}

/* 모바일 전용 상단 HUD (기본 숨김) */
.mobile-hud {
  display: none;
}

/* ─── 게임 섹션 (3단 아케이드) ─── */
.game-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.game-layout {
  display: grid;
  grid-template-columns: 160px auto 160px;
  gap: 14px;
  align-items: start;
  justify-content: center;
}

/* ─── 글래스 패널 카드 공통 ─── */
.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  box-shadow: var(--shadow-md);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  text-align: center;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.panel-card:hover {
  border-color: var(--border-highlight);
  background: var(--bg-card-hover);
}

.panel-title {
  font-family: var(--font-title);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* 캔버스 컨테이너 */
.canvas-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .canvas-container {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.06);
}

.card-tip {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ─── 좌측 사이드 패널 ─── */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 키보드 조작 가이드 */
.key-guide-list {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.72rem;
  text-align: left;
}

.key-guide-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
}

.key-guide-list kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: monospace;
  font-weight: 700;
  font-size: 0.7rem;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .key-guide-list kbd {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.15);
}

/* ─── 중앙 테트리스 보드 ─── */
.board-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.board-wrap {
  position: relative;
  padding: 8px;
  border-radius: var(--radius-board);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 0 35px var(--accent-glow), var(--shadow-lg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: all var(--transition-normal);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#tetris {
  display: block;
  width: auto;
  height: auto;
  border-radius: calc(var(--radius-board) - 4px);
  border: 2px solid var(--board-border);
  background: var(--board-bg);
}

/* ─── 보드 오버레이 (START / RESTART 화면) ─── */
.board-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--radius-board) - 4px);
  background: rgba(5, 11, 24, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  overflow: hidden;
  padding: 12px;
}

[data-theme="light"] .board-overlay {
  background: rgba(241, 245, 249, 0.92);
}

.overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 12px;
  gap: 10px;
  animation: overlayPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 100%;
  max-width: 260px;
}

@keyframes overlayPop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.overlay-logo {
  font-size: 1.8rem;
  line-height: 1;
  filter: drop-shadow(0 0 10px var(--accent-glow));
}

.overlay-title {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--text-main);
  line-height: 1.1;
}

.overlay-title.gameover-title {
  color: var(--danger);
  text-shadow: 0 0 14px rgba(255, 111, 125, 0.4);
}

.overlay-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.gameover-score-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  width: 100%;
}

[data-theme="light"] .gameover-score-box {
  background: rgba(0, 0, 0, 0.04);
}

.gameover-score-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.gameover-score-val {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold-glow);
}

.btn-play-action {
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, var(--accent) 0%, #29bca3 100%);
  color: #06131c;
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 18px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.btn-play-action:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.btn-play-action:active {
  transform: scale(0.96);
}

.btn-play-action.btn-restart {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 4px 18px var(--primary-glow);
}

.btn-play-action.btn-restart:hover {
  filter: brightness(1.15);
}

/* ─── 우측 통계 카드 ─── */
.stats-card {
  width: 100%;
  gap: 8px;
}

.stat-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-title);
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.1;
}

.settings-divider {
  width: 100%;
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* 퀵 세팅 버튼 (사운드/고스트/회전방향) */
.quick-settings {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.setting-toggle-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 6px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all var(--transition-fast);
}

[data-theme="light"] .setting-toggle-btn {
  background: rgba(0, 0, 0, 0.03);
}

.setting-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
}

.setting-toggle-btn.active {
  border-color: var(--accent);
  color: var(--text-main);
  background: var(--accent-dim);
}

.setting-toggle-btn.dir-toggle-btn {
  grid-column: span 2;
  flex-direction: row;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  background: rgba(173, 126, 255, 0.08);
  border-color: rgba(173, 126, 255, 0.25);
  color: #c9b1ff;
}

[data-theme="light"] .setting-toggle-btn.dir-toggle-btn {
  background: rgba(124, 58, 237, 0.08);
  color: #6b21a8;
}

.setting-toggle-btn.dir-toggle-btn:hover {
  border-color: var(--purple);
}

/* ─── High Score 바 ─── */
.highscore-bar {
  width: 100%;
  max-width: 580px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 10px 18px;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.highscore-bar-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trophy-icon {
  font-size: 1.2rem;
}

.highscore-bar-label h2 {
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--gold);
}

.highscore-bar-score {
  text-align: center;
}

.highscore-bar-score p {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold-glow);
  line-height: 1;
}

.highscore-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.7rem;
  text-align: right;
  color: var(--text-muted);
}

.meta-row {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.meta-label {
  font-weight: 700;
  color: var(--text-muted);
}

/* ─── 모바일 컨트롤 (데스크톱 기본 숨김) ─── */
.mobile-controls {
  display: none;
}

/* ─── 푸터 & 카운터 ─── */
.app-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.counter-b-wrapper {
  display: flex;
  justify-content: center;
}

.counter-b {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 4px 14px;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.counter-b-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.counter-b-icon {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.counter-b-item.today .counter-b-icon {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.counter-b-item.total .counter-b-icon {
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
}

.counter-b-item strong {
  font-weight: 700;
  color: var(--text-main);
}

.copyright {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ─── 모달 스타일 ─── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}

.modal-content {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  width: min(340px, 90vw);
  text-align: center;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-trophy {
  font-size: 2.4rem;
}

.modal-content h2 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.05em;
}

.modal-content p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.modal-score-badge {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
}

.modal-content input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 0.9rem;
  text-align: center;
  outline: none;
  transition: border-color var(--transition-fast);
}

[data-theme="light"] .modal-content input {
  background: rgba(255, 255, 255, 0.85);
  color: #0f172a;
}

.modal-content input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.modal-submit-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, #29bca3 100%);
  color: #06131c;
  font-weight: 800;
  font-size: 0.9rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.modal-submit-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.modal-submit-btn:active {
  transform: scale(0.97);
}

/* ===================================================
   📱 모바일 뷰포트 최적화 (Max-Width: 768px)
   =================================================== */
@media (max-width: 768px) {
  html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }

  .app-shell {
    width: 100%;
    height: 100%;
    height: 100dvh;
    padding: 6px 12px env(safe-area-inset-bottom, 8px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    gap: 0;
  }

  /* 헤더 슬림화 */
  .app-header {
    padding: 2px 0;
    grid-template-columns: 36px 1fr 36px;
  }

  .btn-icon {
    width: 32px;
    height: 32px;
  }

  .logo-title {
    font-size: 1.4rem;
    letter-spacing: 0.15em;
  }

  .subtitle {
    display: none;
  }

  /* ─── 모바일 전용 콤팩트 상단 HUD ─── */
  .mobile-hud {
    display: grid;
    grid-template-columns: 66px 1fr 66px;
    gap: 6px;
    margin: 4px 0 6px;
    width: 100%;
  }

  .mobile-hud-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 3px 4px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .mobile-hud-card .hud-label {
    font-family: var(--font-title);
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    line-height: 1;
    margin-bottom: 2px;
  }

  .hud-canvas-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 2px;
  }

  .hud-canvas-wrap canvas {
    display: block;
    width: 48px !important;
    height: 36px !important;
  }

  /* HUD STATS (가로 3열) */
  .hud-stats {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    padding: 2px 6px;
  }

  .hud-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
  }

  .hud-stat-item strong {
    font-family: var(--font-title);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
  }

  .hud-stat-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
  }

  /* ─── 모바일 게임 섹션 ─── */
  .game-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
  }

  .game-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    max-height: 100%;
  }

  /* PC용 사이드 패널 숨김 */
  .side-panel {
    display: none !important;
  }

  .board-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .board-wrap {
    padding: 4px;
    border-radius: var(--radius-md);
    box-shadow: 0 0 20px var(--accent-glow), var(--shadow-md);
    overflow: hidden;
    position: relative;
  }

  #tetris {
    border-radius: calc(var(--radius-md) - 2px);
    max-height: 48vh;
    width: auto;
  }

  .board-overlay {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: calc(var(--radius-md) - 2px);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .overlay-content {
    padding: 4px 8px;
    gap: 6px;
    max-width: 220px;
  }

  .overlay-logo {
    font-size: 1.35rem;
  }

  .overlay-title {
    font-size: 1.1rem;
    margin: 0;
  }

  .overlay-desc {
    font-size: 0.68rem;
    margin: 0;
  }

  .btn-play-action {
    padding: 8px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    gap: 6px;
  }

  .gameover-score-box {
    padding: 4px 8px;
  }

  .gameover-score-val {
    font-size: 1.15rem;
  }

  /* High score 바 모바일 */
  .highscore-bar {
    display: none;
  }

  /* ─── 모바일 컨트롤 패드 (인체공학적 터치 버튼) ─── */
  .mobile-controls {
    display: grid;
    grid-template-columns: 1fr 54px 1fr;
    gap: 8px;
    width: 100%;
    max-width: 420px;
    margin: 4px auto 0;
    align-items: center;
  }

  .control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .control-group.center-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .dpad-row-1, .action-row-1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .control-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-md);
    padding: 12px 4px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    transition: transform 0.08s ease, background 0.08s ease;
  }

  .control-btn:active {
    background: var(--bg-card-hover);
    transform: scale(0.93);
    border-color: var(--accent);
  }

  .control-btn.direction-btn {
    padding: 14px 6px;
    font-size: 1.05rem;
    background: rgba(255, 255, 255, 0.06);
  }

  [data-theme="light"] .control-btn.direction-btn {
    background: rgba(0, 0, 0, 0.05);
  }

  .control-btn.softdrop-btn {
    font-size: 0.68rem;
    padding: 10px 4px;
    gap: 4px;
  }

  .btn-icon-text {
    font-size: 0.7rem;
  }

  .control-btn.rotate-btn {
    background: rgba(173, 126, 255, 0.12);
    border-color: rgba(173, 126, 255, 0.35);
    color: #d8b4fe;
    font-size: 0.72rem;
    gap: 3px;
  }

  [data-theme="light"] .control-btn.rotate-btn {
    color: #6b21a8;
    background: rgba(124, 58, 237, 0.1);
  }

  .control-btn.hold-btn {
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.72rem;
  }

  .control-btn.accent.harddrop-btn {
    background: linear-gradient(135deg, var(--accent) 0%, #29bca3 100%);
    color: #06131c;
    border: none;
    font-size: 0.72rem;
    font-weight: 900;
    box-shadow: 0 4px 12px var(--accent-glow);
  }

  .control-btn.utility-btn {
    border-radius: 50%;
    width: 46px;
    height: 46px;
    font-size: 0.52rem;
    padding: 0;
    flex-direction: column;
    gap: 1px;
    align-self: center;
    justify-self: center;
  }

  .pause-icon {
    font-size: 0.75rem;
  }

  .pause-text {
    font-size: 0.48rem;
    font-weight: 800;
  }

  /* 모바일 회전방향 토글 버튼 */
  .control-btn.utility-btn-dir {
    border-radius: 9999px;
    width: 50px;
    height: 24px;
    font-size: 0.58rem;
    font-weight: 800;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: rgba(173, 126, 255, 0.12);
    border: 1px solid rgba(173, 126, 255, 0.3);
    color: #d8b4fe;
    cursor: pointer;
  }

  [data-theme="light"] .control-btn.utility-btn-dir {
    background: rgba(124, 58, 237, 0.1);
    color: #6b21a8;
  }

  .dir-text {
    font-size: 0.52rem;
  }

  /* ─── 모바일 푸터 ─── */
  .app-footer {
    margin-top: 2px;
    gap: 2px;
  }

  .counter-b {
    padding: 2px 10px;
    gap: 8px;
    font-size: 0.65rem;
  }

  .copyright {
    display: none;
  }
}
