/* ═══════════════════════════════════════════ */
/* Ethereal Fragments - Stitch-Enhanced UI    */
/* ═══════════════════════════════════════════ */

:root {
  --bg: #0a0710;
  --tile-dark: #1a1324;
  --primary: #6614b8;
  --primary-glow: rgba(102, 20, 184, 0.5);
  --accent: #00ffcc;
  --accent-glow: rgba(0, 255, 204, 0.4);
  --accent-strong: rgba(0, 255, 204, 0.8);
  --text: #ffffff;
  --text-dim: #8b8b9e;
  --text-muted: #4a4a5e;
  --glass-bg: rgba(26, 17, 34, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  --font-display: 'Cinzel', serif;
  --font-body: 'Space Grotesk', sans-serif;
  --font-logo: 'Cormorant Garamond', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Hide scrollbar but keep scrolling */
::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; -ms-overflow-style: none; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}
::selection { background: var(--accent); color: black; }

/* ═══ AMBIENT BG (Stitch) ═══ */
.particles-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.particles-css {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 3px),
    radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 2px),
    radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 3px);
  background-size: 550px 550px, 350px 350px, 250px 250px;
  background-position: 0 0, 40px 60px, 130px 270px;
  animation: float-particles 60s linear infinite;
  opacity: 0.25;
}
.ethereal-gradient {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(circle at center, rgba(102, 20, 184, 0.15) 0%, transparent 70%);
}
@keyframes float-particles {
  0% { background-position: 0 0, 40px 60px, 130px 270px; }
  100% { background-position: 550px 550px, 390px 410px, 680px 820px; }
}

/* ═══ GLASS (Stitch) ═══ */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  position: relative; overflow: hidden;
}

/* ═══ SCREENS ═══ */
.screen {
  position: fixed; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  opacity: 0; pointer-events: none; transition: opacity 0.6s ease;
}
#screen-how, #screen-levels {
  align-items: flex-start;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
#screen-clear, #screen-daily-result {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  align-items: center;
  padding: 2rem 0;
}
.screen.active { opacity: 1; pointer-events: auto; }

/* ═══ TITLE ═══ */
#screen-title::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(10,7,16,0.4), rgba(10,7,16,0.85) 70%, var(--bg));
  z-index: 0;
}
.title-content { text-align: center; padding: 2rem; width: 100%; max-width: 420px; position: relative; z-index: 1; }
.title-emblem { margin-bottom: 1.5rem; animation: float 6s ease-in-out infinite; }
.emblem-img { width: 120px; height: auto; filter: drop-shadow(0 0 30px var(--accent-glow)); }
.title-main {
  font-family: var(--font-display); font-size: 2.8rem; font-weight: 700;
  letter-spacing: 0.04em; line-height: 1.1; margin-bottom: 0.8rem;
  background: linear-gradient(135deg, #fff, var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; filter: drop-shadow(0 0 20px var(--accent-glow));
}
.title-sub { font-size: 0.9rem; color: var(--text-dim); letter-spacing: 0.15em; margin-bottom: 3rem; font-weight: 300; }
.title-buttons { display: flex; flex-direction: column; gap: 0.8rem; margin-bottom: 3rem; }
.title-footer { opacity: 0.4; }
.logo-text { font-family: var(--font-logo); font-size: 1rem; letter-spacing: 0.15em; }
.logo-text .hl { color: var(--accent); font-weight: 600; }

/* ═══ BUTTONS ═══ */
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; padding: 1rem 2rem; background: var(--accent); color: var(--bg);
  border: none; border-radius: 12px; font-family: var(--font-body);
  font-size: 0.95rem; font-weight: 600; letter-spacing: 0.05em;
  cursor: pointer; transition: all 0.3s; box-shadow: 0 0 20px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 0 40px var(--accent-glow); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(1px) scale(0.98); }

.btn-ghost {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; padding: 0.85rem 2rem;
  background: rgba(255,255,255,0.03); color: var(--text-dim);
  border: 1px solid var(--glass-border); border-radius: 12px;
  font-family: var(--font-body); font-size: 0.85rem; cursor: pointer;
  transition: all 0.3s; backdrop-filter: blur(8px);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ═══ HOW TO PLAY ═══ */
.how-content {
  padding: 2rem; max-width: 420px; text-align: center;
  max-height: 100vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: 4rem;
}
.how-steps { display: flex; flex-direction: column; gap: 1rem; margin: 2rem 0; }
.how-step { padding: 1.2rem; text-align: left; display: flex; gap: 1rem; align-items: flex-start; }
.how-icon {
  font-size: 1.3rem; min-width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(102, 20, 184, 0.2); border-radius: 12px;
}
.how-step h3 { font-family: var(--font-display); font-size: 0.95rem; margin-bottom: 0.2rem; }
.how-step p { font-size: 0.8rem; color: var(--text-dim); line-height: 1.5; }

/* ═══ LEVEL SELECT ═══ */
.levels-content {
  padding: 2rem; max-width: 420px; width: 100%; text-align: center;
  max-height: 100vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.levels-subtitle { color: var(--text-dim); font-size: 0.75rem; margin-bottom: 1.5rem; letter-spacing: 0.2em; text-transform: uppercase; }
.section-title { font-family: var(--font-display); font-size: 1.6rem; margin-bottom: 0.5rem; }

.chapter-card {
  border-radius: 16px; padding: 1.2rem; margin-bottom: 0.8rem;
  cursor: pointer; transition: all 0.3s; text-align: left;
}
.chapter-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.chapter-card.locked { opacity: 0.35; pointer-events: none; }
.chapter-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.chapter-name { font-family: var(--font-display); font-size: 1rem; }
.chapter-progress { font-size: 0.7rem; color: var(--accent); font-weight: 600; }
.chapter-desc { font-size: 0.75rem; color: var(--text-dim); line-height: 1.4; }
.chapter-badge { display:inline-flex; align-items:center; gap:4px; font-size:0.65rem; background:rgba(0,255,204,0.1); border:1px solid rgba(0,255,204,0.2); border-radius:8px; padding:1px 6px; margin-left:4px; color:#00ffcc; }
.badge-sprite { width:16px; height:16px; object-fit:contain; filter:drop-shadow(0 0 4px rgba(0,255,204,0.4)); vertical-align:middle; }

.chapter-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; margin-top: 0.8rem; }
.level-btn {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--glass-border); border-radius: 8px;
  color: var(--text-dim); font-size: 0.75rem; cursor: pointer; transition: all 0.2s;
}
.level-btn:hover { border-color: var(--accent); }
.level-btn.cleared { border-color: var(--accent); color: var(--accent); background: rgba(0,255,204,0.05); }
.level-btn.current { border-color: var(--accent); color: var(--text); box-shadow: 0 0 10px var(--accent-glow); }
.level-btn.locked { opacity: 0.3; pointer-events: none; }

/* ═══ GAME HUD (Stitch-style) ═══ */
.game-hud-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  padding: 0.5rem 0.8rem; padding-top: max(1rem, calc(env(safe-area-inset-top) + 0.3rem));
  display: flex; flex-direction: column; gap: 0.3rem;
  background: linear-gradient(to bottom, rgba(10,7,16,0.9) 0%, rgba(10,7,16,0.5) 70%, transparent 100%);
}

.hud-top-row {
  display: flex; align-items: center; justify-content: space-between; height: 40px;
}

.hud-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 50%;
  color: rgba(255,255,255,0.7); cursor: pointer; transition: all 0.3s;
}
.hud-btn:hover { color: white; background: rgba(255,255,255,0.1); }
.hud-btn .material-symbols-outlined { font-size: 24px; }

.hud-title-area { text-align: center; }
.hud-chapter-label {
  font-size: 0.6rem; color: rgba(0,255,204,0.7); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.2em;
}
.hud-level-name {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  color: white; letter-spacing: 0.02em;
}

.hud-stats-row { display: flex; gap: 0.5rem; }

.hud-stat-card {
  flex: 1; padding: 0.7rem; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.hud-stat-card .stat-label {
  font-size: 0.6rem; color: rgba(148,163,184,0.8);
  text-transform: uppercase; letter-spacing: 0.15em; font-weight: 500;
}
.hud-stat-card .stat-value {
  font-size: 1.4rem; font-weight: 700; color: white;
  display: flex; align-items: baseline; gap: 2px;
}
.hud-stat-card .stat-value .stat-max { font-size: 0.85rem; color: rgba(100,116,139,0.7); font-weight: 600; }
.hud-stat-card .stat-value.accent { color: var(--accent); font-family: monospace; letter-spacing: 0.1em; }

/* Progress bar (Stitch) */
.hud-progress-bar {
  width: 100%; height: 3px; background: rgba(100,116,139,0.3);
  border-radius: 2px; margin-top: 0.4rem; overflow: hidden;
}
.hud-progress-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 0 8px var(--accent-glow);
  transition: width 0.5s ease;
}

/* Timer icon decoration */
.stat-timer-icon {
  position: absolute; top: 0.4rem; right: 0.5rem; opacity: 0.15;
}

/* ═══ GAME BOARD (Stitch-style) ═══ */
.game-board-container {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 4.5rem 1rem 3rem; gap: 0.4rem;
}
.game-board-wrapper {
  position: relative; width: fit-content; max-width: 480px;
  background: rgba(0,0,0,0.4); border-radius: 24px; padding: 12px;
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}
.game-board-glow {
  position: absolute; inset: 0; border-radius: 24px;
  background: radial-gradient(circle at center, rgba(102,20,184,0.08) 0%, transparent 70%);
  pointer-events: none; z-index: -1; filter: blur(20px);
}
.game-canvas {
  border-radius: 12px;
  touch-action: none;
  display: block;
  margin: auto;
}

/* ═══ GAME BOTTOM HUD (Stitch-style) ═══ */
.game-hud-bottom {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  padding: 1rem 1.5rem; padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 30%, transparent);
}
.hud-bottom-row {
  display: flex; align-items: center; gap: 0.5rem;
  max-width: 400px; margin: 0 auto;
}

.btn-hint-stitch {
  flex: 1; position: relative; overflow: hidden; border-radius: 12px;
  background: rgba(102,20,184,0.2); border: 1px solid rgba(102,20,184,0.3);
  backdrop-filter: blur(12px); height: 56px;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  cursor: pointer; transition: all 0.3s; box-shadow: 0 0 15px var(--primary-glow);
  color: white; font-family: var(--font-body); font-size: 0.85rem; font-weight: 600;
}
.btn-hint-stitch:hover { background: rgba(102,20,184,0.3); }
.btn-hint-stitch::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(102,20,184,0.1), transparent);
  opacity: 0; transition: opacity 0.3s;
}
.btn-hint-stitch:hover::before { opacity: 1; }
.hint-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(102,20,184,0.4);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.3s;
}
.btn-hint-stitch:hover .hint-icon { transform: scale(1.1); }
.hint-info { display: flex; flex-direction: column; align-items: flex-start; }
.hint-sub { font-size: 0.6rem; color: rgba(173,147,200,0.8); font-weight: 500; }

.btn-hud-sq {
  width: 56px; height: 56px; border-radius: 12px;
  background: rgba(30,30,50,0.4); border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.7); cursor: pointer; transition: all 0.3s;
}
.btn-hud-sq:hover { color: white; background: rgba(40,40,60,0.5); }
.btn-hud-sq:active { transform: scale(0.95); }

/* ═══ VOLUME PANEL ═══ */
.volume-panel {
  position: fixed; top: 60px; right: 12px; z-index: 200;
  background: rgba(15,10,30,0.95); border: 1px solid var(--glass-border);
  border-radius: 14px; padding: 1rem 1.2rem;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  display: none; flex-direction: column; gap: 0.8rem;
  min-width: 200px;
  animation: volumeIn 0.2s ease-out;
}
.volume-panel.show { display: flex; }
@keyframes volumeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.volume-row {
  display: flex; align-items: center; gap: 0.6rem;
}
.volume-label {
  font-size: 0.75rem; color: var(--text-dim); min-width: 48px;
}
.volume-slider {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.15);
  outline: none;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
}
.volume-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; border: none;
  background: var(--accent); cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
}
.volume-value {
  font-size: 0.7rem; color: var(--text-muted); min-width: 24px; text-align: right;
}

/* ═══ CLEAR SCREEN ═══ */
.clear-content { text-align: center; padding: 4.5rem 2rem 2rem; max-width: 420px; width: 100%; }
.clear-fragment {
  display: none;
}
.clear-title { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: 0.8rem; }
.clear-lore {
  font-size: 0.85rem; color: var(--text-dim); line-height: 1.6;
  margin-bottom: 2rem; font-style: italic;
}
.clear-stats { display: flex; justify-content: center; gap: 2rem; margin-bottom: 2rem; }
.clear-stat { text-align: center; }
.clear-stat-value { display: block; font-family: 'Orbitron', sans-serif; font-size: 1.8rem; font-weight: 600; color: var(--accent); }
.clear-stat-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.15em; }
.clear-stars { display: flex; gap: 0.5rem; justify-content: center; }
.clear-rank { margin: 1rem auto 1.5rem; text-align: center; animation: rankReveal 0.8s ease-out forwards; }
.rank-badge { width: 200px; height: 200px; object-fit: contain; display: block; margin: 0 auto; filter: drop-shadow(0 0 20px rgba(102,20,184,0.5)); }
@keyframes rankReveal {
  0% { transform: scale(0.3); opacity: 0; filter: blur(10px); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; filter: blur(0); }
}
.clear-buttons { display: flex; flex-direction: column; gap: 0.6rem; }

.daily-share-text {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: 12px; padding: 1rem; margin-bottom: 1.5rem;
  font-family: monospace; font-size: 0.8rem; line-height: 1.4;
  white-space: pre-wrap; text-align: left; color: var(--text-dim);
}

/* ═══ DAILY TIMER ═══ */
.hud-timer-area {
  text-align: center; padding: 0; flex-shrink: 0;
}
.hud-timer-date {
  font-family: 'Orbitron', sans-serif; font-size: 0.65rem; font-weight: 500;
  color: rgba(0,255,204,0.5); margin-bottom: 0.1rem;
  letter-spacing: 0.15em;
}
.hud-timer-label {
  font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.2em; margin-bottom: 0.1rem;
}
.hud-timer {
  font-family: 'Orbitron', sans-serif; font-size: 2rem; font-weight: 700;
  color: var(--accent); letter-spacing: 0.08em;
  text-shadow: 0 0 20px var(--accent-glow), 0 0 40px rgba(0,255,204,0.2);
  transition: color 0.5s, text-shadow 0.5s;
}
.hud-timer.warning {
  color: #ff8844;
  text-shadow: 0 0 20px rgba(255,136,68,0.6), 0 0 40px rgba(255,136,68,0.2);
}
.hud-timer.danger {
  color: #ff4466;
  text-shadow: 0 0 20px rgba(255,68,102,0.6), 0 0 40px rgba(255,68,102,0.2);
  animation: timerPulse 0.8s ease-in-out infinite;
}
@keyframes timerPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.03); }
}
.hud-timer-progress {
  width: 80%; max-width: 280px; height: 3px; margin: 0.4rem auto 0;
  background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden;
}
.hud-timer-bar {
  height: 100%; width: 100%; border-radius: 2px;
  background: var(--accent); transition: width 1s linear, background 0.5s;
}

/* ═══ DAILY SELECT ═══ */
.daily-diff-list {
  display: flex; flex-direction: column; gap: 0.75rem;
  width: 100%; max-width: 340px; margin: 0 auto;
}
.btn-daily-diff {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.8rem 1rem; border-radius: 14px;
  background: rgba(20,14,40,0.6); border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer; transition: all 0.3s; text-align: left;
  backdrop-filter: blur(8px);
}
.btn-daily-diff:active { transform: scale(0.97); }
.daily-diff-normal:hover, .daily-diff-normal:active { border-color: rgba(0,255,204,0.3); background: rgba(0,255,204,0.06); }
.daily-diff-hard:hover, .daily-diff-hard:active { border-color: rgba(255,136,68,0.3); background: rgba(255,136,68,0.06); }
.daily-diff-extreme:hover, .daily-diff-extreme:active { border-color: rgba(255,68,102,0.3); background: rgba(255,68,102,0.06); }
.daily-diff-img {
  width: 52px; height: 52px; object-fit: contain; flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(102,20,184,0.4));
}
.daily-diff-info { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.daily-diff-name { font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; }
.daily-diff-desc { font-size: 0.7rem; color: var(--text-dim); letter-spacing: 0.05em; }
.daily-diff-status {
  font-size: 0.7rem; color: var(--text-muted); opacity: 0.6;
  min-width: 40px; text-align: right;
}

/* ═══ DAILY RESULT ═══ */
.daily-result-header {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  margin-bottom: 1rem;
}
.daily-result-diff {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase;
  border: 1px solid; border-radius: 20px; padding: 0.2rem 1rem;
}
.daily-result-date {
  font-size: 0.85rem; color: var(--text-dim);
}
.daily-puzzle-cards {
  display: flex; gap: 0.4rem; justify-content: center; margin: 1rem 0;
  flex-wrap: wrap;
}
.daily-puzzle-card {
  background: rgba(0,255,204,0.08); border: 1px solid rgba(0,255,204,0.2);
  border-radius: 10px; padding: 0.5rem 0.6rem; min-width: 54px;
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
}
.daily-puzzle-card.failed {
  background: rgba(255,68,102,0.08); border-color: rgba(255,68,102,0.3);
}
.daily-q { font-size: 0.65rem; color: var(--text-muted); font-weight: 600; }
.daily-q-time { font-family: 'Orbitron', sans-serif; font-size: 0.8rem; color: var(--accent); font-weight: 600; }
.daily-q-status { font-size: 0.7rem; color: #ff4466; }
.daily-result-stats {
  display: flex; justify-content: center; gap: 1.5rem; margin: 1.2rem 0;
}
.daily-rstat { text-align: center; }
.daily-rstat-val {
  display: block; font-family: 'Orbitron', sans-serif; font-size: 1.3rem; font-weight: 600; color: var(--accent);
}
.daily-rstat-val small { font-size: 0.8rem; opacity: 0.6; }
.daily-rstat-label {
  font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ═══ ANIMATIONS ═══ */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes pulse-clear {
  0%, 100% { box-shadow: 0 0 40px var(--accent-glow); transform: scale(1); }
  50% { box-shadow: 0 0 60px var(--accent-glow), 0 0 100px var(--primary-glow); transform: scale(1.05); }
}

/* ═══ RESPONSIVE ═══ */
@media (min-width: 768px) {
  .title-main { font-size: 3.5rem; }
  .emblem-img { width: 150px; }

  /* ── Level Select: wider layout ── */
  .levels-content { max-width: 720px; padding: 2rem 3rem; }
  .chapter-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .chapter-card { margin-bottom: 0; }
  .chapter-levels { grid-template-columns: repeat(5, 1fr); gap: 0.6rem; }
  .level-btn { font-size: 0.85rem; }
  .section-title {
    font-size: 2.2rem; letter-spacing: 0.08em;
    text-shadow: 0 0 30px var(--accent-glow);
  }
  .levels-subtitle { font-size: 0.85rem; letter-spacing: 0.3em; }

  /* ── How to Play: wider ── */
  .how-content { max-width: 600px; }

  /* ── Game Board: bigger ── */
  .game-board-container { padding: 5rem 2rem 2rem; }
  .game-board-wrapper { max-width: 640px; padding: 16px; border-radius: 28px; }

  /* ── HUD: spread out ── */
  .game-hud-top {
    padding: 0.8rem 2rem; padding-top: 0.8rem;
    max-width: 800px; left: 50%; transform: translateX(-50%);
    background: rgba(10,7,16,0.7); backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    border-radius: 0 0 16px 16px;
  }
  .hud-btn { width: 42px; height: 42px; }
  .hud-btn .material-symbols-outlined { font-size: 26px; }
  .hud-level-name { font-size: 1.1rem; }
  .hud-chapter-label { font-size: 0.7rem; letter-spacing: 0.25em; }

  /* ── Clear / Daily Result: wider ── */
  .clear-content { max-width: 560px; }
  .clear-title { font-size: 1.8rem; }
  .rank-badge { width: 240px; height: 240px; }

  /* ── Daily Select: wider ── */
  .daily-diff-list { max-width: 440px; }

  /* ── Title: wider buttons ── */
  .title-content { max-width: 520px; }
  .title-buttons { max-width: 360px; margin-left: auto; margin-right: auto; }

  /* ── Tutorial / Fail overlay: bigger ── */
  #tutorial-overlay > div,
  #fail-overlay > div { max-width: 420px; padding: 2.5rem; }
}
@supports (padding: env(safe-area-inset-top)) {
  .game-hud-top { padding-top: env(safe-area-inset-top); }
  .game-hud-bottom { padding-bottom: env(safe-area-inset-bottom); }
}
