* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; user-select: none; -webkit-user-select: none; }
body {
  background: #1a2a3a;
  font-family: 'Fredoka', 'Comic Sans MS', 'Trebuchet MS', system-ui, sans-serif;
  color: #2c3e50;
  touch-action: none;
}

/* Splash screen */
#splash-screen {
  position: fixed; inset: 0;
  background: linear-gradient(180deg, #87ceeb 0%, #b8e0d2 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease-out;
}
#splash-screen.fade-out { opacity: 0; pointer-events: none; }
.splash-content { text-align: center; }
.splash-cat {
  font-size: 120px;
  animation: splashBob 1.2s ease-in-out infinite;
}
.splash-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 42px;
  font-weight: 700;
  color: #2c3e50;
  margin: 16px 0;
  text-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.splash-spinner {
  width: 50px; height: 50px;
  border: 5px solid rgba(52,152,219,0.2);
  border-top-color: #3498db;
  border-radius: 50%;
  margin: 24px auto;
  animation: splashSpin 0.8s linear infinite;
}
.splash-loading { color: #555; font-size: 16px; font-weight: 500; }
@keyframes splashBob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-20px) rotate(3deg); } }
@keyframes splashSpin { to { transform: rotate(360deg); } }

/* ===== Accessibility ===== */

/* Keyboard focus indicator */
button:focus-visible,
.toggle:focus-visible,
.level-cell:focus-visible,
.cat-option:focus-visible,
.tier-tab:focus-visible,
input:focus-visible {
  outline: 3px solid #f39c12;
  outline-offset: 3px;
}

/* Font scale */
body.font-large { font-size: 18px; }
body.font-large .hud-item { font-size: 16px; }
body.font-large .panel h1 { font-size: 38px; }
body.font-large .panel h2 { font-size: 28px; }
body.font-large .panel p,
body.font-large .panel button { font-size: 18px; }

/* Reduced motion: kill heavy animations */
body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.05ms !important;
}
@media (prefers-reduced-motion: reduce) {
  body *,
  body *::before,
  body *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.05ms !important;
  }
}

/* High contrast palette */
body.high-contrast {
  background: #000;
  color: #fff;
}
body.high-contrast .panel {
  background: #000;
  border-color: #fff;
  color: #fff;
}
body.high-contrast .panel h1,
body.high-contrast .panel h2 { color: #fff; }
body.high-contrast .panel p { color: #f8f9fa; }
body.high-contrast .hud-item {
  background: #000;
  color: #fff;
  border-color: #fff;
}
body.high-contrast .big-btn {
  background: #fff;
  color: #000;
  border: 3px solid #fff;
}
body.high-contrast .big-btn.success { background: #00ff00; color: #000; }
body.high-contrast .big-btn.danger  { background: #ff3030; color: #fff; }
body.high-contrast .level-cell {
  background: #000;
  color: #fff;
  border-color: #fff;
}
body.high-contrast .level-cell.completed { background: #00aa00; color: #fff; }

/* Color-blind helpers — add ± symbol prefixes via CSS */
body.colorblind .float-text::before { content: '►'; margin-right: 4px; opacity: 0.8; }

/* Screen-reader-only: visually hidden, available to AT */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip-to-content link for keyboard users */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: #f39c12;
  color: #000;
  padding: 8px 16px;
  z-index: 10000;
  border-radius: 0 0 8px 0;
  font-weight: bold;
}
.skip-link:focus { top: 0; }

/* Star pop on level complete */
.stars span {
  display: inline-block;
  opacity: 0;
  transform: scale(0);
}
.stars.show span { animation: starPop 0.5s cubic-bezier(0.4, 1.8, 0.6, 1) forwards; }
.stars.show span:nth-child(1) { animation-delay: 0.2s; }
.stars.show span:nth-child(2) { animation-delay: 0.6s; }
.stars.show span:nth-child(3) { animation-delay: 1.0s; }
@keyframes starPop {
  0%   { opacity: 0; transform: scale(0) rotate(-90deg); }
  60%  { opacity: 1; transform: scale(1.3) rotate(10deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

#game-container { position: relative; width: 100vw; height: 100vh; overflow: hidden; }
canvas#game { display: block; width: 100%; height: 100%; background: linear-gradient(180deg, #87ceeb 0%, #b8e0d2 100%); }

/* HUD */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  padding: calc(12px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-right, 0px)) 12px calc(12px + env(safe-area-inset-left, 0px));
  pointer-events: none;
  z-index: 10;
}
.hud-top { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.hud-item {
  background: rgba(255,255,255,0.9);
  border: 2px solid #3498db;
  border-radius: 16px;
  padding: 6px 14px;
  font-weight: bold;
  font-size: 14px;
  color: #2c3e50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  white-space: nowrap;
}
.hud-item.target {
  border: 3px solid #e74c3c;
  background: linear-gradient(135deg, #ffe8e3, #ffd0c5);
  font-size: 22px;
  padding: 10px 22px;
  border-radius: 22px;
  color: #c0392b;
  box-shadow: 0 4px 16px rgba(231,76,60,0.45), inset 0 0 0 2px rgba(255,255,255,0.5);
  animation: targetPulse 2.4s ease-in-out infinite;
  transform-origin: center;
}
.hud-item.target #target {
  font-size: 28px;
  color: #c0392b;
  margin-left: 6px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.7);
}
@keyframes targetPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 16px rgba(231,76,60,0.45), inset 0 0 0 2px rgba(255,255,255,0.5); }
  50%      { transform: scale(1.04); box-shadow: 0 6px 22px rgba(231,76,60,0.65), inset 0 0 0 2px rgba(255,255,255,0.6); }
}
.hud-item.current { border-color: #27ae60; background: #e8f8ee; transition: transform 0.25s ease-out; transform-origin: center; font-size: 16px; padding: 8px 16px; }
.hud-item.current #current { font-size: 20px; font-weight: 800; color: #1e8449; }
.hud-item.current.pop { transform: scale(1.22); background: #b9eec9; }
.hud-item.combo { border-color: #f39c12; background: #fff4e0; transition: transform 0.18s, box-shadow 0.18s; }
.hud-item.combo.combo-hot {
  background: linear-gradient(135deg, #fff4e0, #ffe0b2);
  border-color: #e67e22;
  box-shadow: 0 0 0 3px rgba(243,156,18,0.35), 0 4px 12px rgba(243,156,18,0.5);
  animation: comboShake 0.4s ease-out;
}
.hud-item.combo.combo-fire {
  background: linear-gradient(135deg, #ffd6a5, #ff9966);
  border-color: #e74c3c;
  color: white;
  box-shadow: 0 0 0 4px rgba(231,76,60,0.4), 0 6px 16px rgba(231,76,60,0.6);
  animation: comboShake 0.4s ease-out, comboFire 1.4s ease-in-out infinite;
}
@keyframes comboShake {
  0%   { transform: scale(1) rotate(0); }
  25%  { transform: scale(1.18) rotate(-3deg); }
  50%  { transform: scale(1.22) rotate(3deg); }
  75%  { transform: scale(1.15) rotate(-2deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes comboFire {
  0%, 100% { filter: brightness(1) saturate(1); }
  50%      { filter: brightness(1.15) saturate(1.3); }
}
.hud-item.lives { border-color: #e91e63; background: #ffe8ef; }

#plate {
  position: absolute; bottom: calc(34px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,0.95);
  border: 2px solid #8e44ad;
  border-radius: 999px;
  padding: 8px 20px;
  min-width: 200px;
  max-width: 90vw;
  text-align: center;
  font-weight: bold;
  font-size: 16px;
  color: #2c3e50;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  pointer-events: none;
  z-index: 10;
}
#plate .plate-label { color: #8e44ad; margin-right: 8px; }

#pause-btn, #sound-btn {
  position: absolute; top: 12px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid #3498db;
  background: white;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 11;
  display: flex; align-items: center; justify-content: center;
}
#pause-btn { right: calc(12px + env(safe-area-inset-right, 0px)); top: calc(12px + env(safe-area-inset-top, 0px)); }
#sound-btn { right: calc(64px + env(safe-area-inset-right, 0px)); top: calc(12px + env(safe-area-inset-top, 0px)); }
#hint-btn {
  position: absolute;
  left: calc(12px + env(safe-area-inset-left, 0px));
  top: calc(12px + env(safe-area-inset-top, 0px));
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 3px solid #f1c40f;
  background: linear-gradient(135deg, #fff9e6, #fff3cd);
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(241,196,15,0.5), 0 0 0 4px rgba(241,196,15,0.15);
  z-index: 11;
  display: flex; align-items: center; justify-content: center;
  animation: hintPulse 2s ease-in-out infinite;
}
#hint-btn:hover { transform: scale(1.08); }
@keyframes hintPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(241,196,15,0.5), 0 0 0 4px rgba(241,196,15,0.15); }
  50%      { box-shadow: 0 4px 18px rgba(241,196,15,0.7), 0 0 0 8px rgba(241,196,15,0.25); }
}

.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 30, 50, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  padding: 20px;
}
.overlay.hidden { display: none; }
.hidden { display: none !important; }  /* Generic — for badges/elements outside .overlay */

.panel {
  background: white;
  border-radius: 28px;
  padding: 28px 32px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
  text-align: center;
  border: 4px solid #3498db;
}
.panel h1 { font-size: 32px; color: #2c3e50; margin-bottom: 8px; }
.panel h2 { font-size: 24px; color: #2c3e50; margin-bottom: 12px; }
.panel p { color: #555; margin-bottom: 16px; line-height: 1.5; font-size: 15px; }
.panel .subtitle { font-size: 14px; color: #888; margin-bottom: 20px; }

.big-btn {
  display: block; width: 100%;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
  margin: 8px 0;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
  font-family: inherit;
}
.big-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(52, 152, 219, 0.5); }
.big-btn:active { transform: translateY(0); }
.big-btn.secondary { background: linear-gradient(135deg, #95a5a6, #7f8c8d); box-shadow: 0 4px 12px rgba(127, 140, 141, 0.4); }
.big-btn.success { background: linear-gradient(135deg, #27ae60, #229954); box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4); }
.big-btn.danger { background: linear-gradient(135deg, #e74c3c, #c0392b); box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4); }

.stars { font-size: 48px; margin: 12px 0; letter-spacing: 8px; }

.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 16px 0; }
.level-cell {
  background: #ecf0f1;
  border: 2px solid #bdc3c7;
  border-radius: 12px;
  padding: 10px 4px;
  font-weight: bold;
  cursor: pointer;
  font-size: 14px;
  color: #2c3e50;
  transition: all 0.1s;
}
.level-cell:hover:not(.locked) { transform: scale(1.05); border-color: #3498db; }
.level-cell.locked { background: #bdc3c7; color: #7f8c8d; cursor: not-allowed; opacity: 0.6; }
.level-cell.completed { background: #d5f5e3; border-color: #27ae60; }
.level-cell.current { background: #fff3cd; border-color: #f39c12; }

.tier-bar { display: flex; gap: 4px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
.tier-tab {
  background: #ecf0f1;
  border: 2px solid #bdc3c7;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  color: #555;
}
.tier-tab.active { background: #3498db; border-color: #2980b9; color: white; }

.cat-picker { display: flex; gap: 12px; justify-content: center; margin: 16px 0; flex-wrap: wrap; }
.cat-option {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 3px solid #bdc3c7;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  background: #f8f9fa;
  transition: all 0.15s;
}
.cat-option.selected { border-color: #e74c3c; transform: scale(1.1); box-shadow: 0 4px 12px rgba(231,76,60,0.3); }
.cat-option.locked-cat {
  background: #ecf0f1;
  border-style: dashed;
  cursor: not-allowed;
}
.cat-option.locked-cat:hover { transform: none; }

.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #ecf0f1; gap: 12px; }
.setting-row:last-child { border-bottom: none; }
.setting-row label {
  font-weight: bold;
  color: #2c3e50;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  align-items: flex-start;
  text-align: left;
}
.setting-row label > span,
.setting-row label > div {
  display: block;
  width: 100%;
}
.toggle { width: 50px; height: 28px; background: #bdc3c7; border-radius: 14px; position: relative; cursor: pointer; transition: background 0.2s; }
.toggle::after { content: ''; position: absolute; width: 22px; height: 22px; background: white; border-radius: 50%; top: 3px; left: 3px; transition: left 0.2s; }
.toggle.on { background: #27ae60; }
.toggle.on::after { left: 25px; }

.tutorial-box { background: linear-gradient(135deg, #fff9e6, #fff3cd); border: 2px solid #f39c12; border-radius: 16px; padding: 16px; margin: 16px 0; text-align: left; }
.tutorial-box h3 { color: #d68910; margin-bottom: 8px; font-size: 18px; }
.tutorial-box ul { padding-left: 20px; }
.tutorial-box li { margin: 4px 0; color: #555; font-size: 14px; }
.tutorial-box .professor { font-size: 48px; text-align: center; margin-bottom: 8px; }

.ribbon { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: bold; margin: 4px 2px; color: white; }
.ribbon.t1 { background: #27ae60; }
.ribbon.t2 { background: #f1c40f; color: #555; }
.ribbon.t3 { background: #e67e22; }
.ribbon.t4 { background: #e74c3c; }
.ribbon.t5 { background: #9b59b6; }
.ribbon.t6 { background: #2c3e50; }

#level-intro { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0); z-index: 50; pointer-events: none; opacity: 0; }
#level-intro.show { animation: levelIntro 2s forwards; }
#level-intro .content { background: rgba(255,255,255,0.95); border-radius: 28px; padding: 28px 40px; text-align: center; border: 4px solid #f39c12; box-shadow: 0 16px 40px rgba(0,0,0,0.3); }
#level-intro h1 { font-size: 36px; color: #2c3e50; }
#level-intro p { color: #555; font-size: 18px; margin-top: 8px; }
@keyframes levelIntro { 0% { opacity: 0; transform: scale(0.7); } 20% { opacity: 1; transform: scale(1); } 80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.1); } }

.float-text { position: absolute; font-weight: bold; font-size: 22px; pointer-events: none; z-index: 20; text-shadow: 2px 2px 0 rgba(0,0,0,0.3); animation: floatUp 1s forwards; }
@keyframes floatUp { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-60px); } }
@keyframes wrongPop {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.7); }
  15%  { opacity: 1; transform: translateX(-50%) scale(1.15); }
  25%  { transform: translateX(-50%) scale(1); }
  85%  { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(0.95) translateY(-30px); }
}
@keyframes comboMilestone {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.4) rotate(-12deg); }
  20%  { opacity: 1; transform: translateX(-50%) scale(1.4) rotate(6deg); }
  35%  { transform: translateX(-50%) scale(1) rotate(0); }
  70%  { opacity: 1; transform: translateX(-50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.1) translateY(-40px); }
}

@keyframes splashSpin { to { transform: rotate(360deg); } }

/* ===== Accessibility ===== */
button:focus-visible, .toggle:focus-visible, .level-cell:focus-visible, .cat-option:focus-visible, .tier-tab:focus-visible, input:focus-visible {
  outline: 3px solid #f39c12;
  outline-offset: 3px;
}
body.font-large { font-size: 18px; }
body.font-large .hud-item { font-size: 16px; }
body.font-large .panel h1 { font-size: 38px; }
body.font-large .panel h2 { font-size: 28px; }
body.font-large .panel p, body.font-large .panel button { font-size: 18px; }
body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.05ms !important;
}
@media (prefers-reduced-motion: reduce) {
  body *, body *::before, body *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.05ms !important;
  }
}
body.high-contrast { background: #000; color: #fff; }
body.high-contrast .panel { background: #000; border-color: #fff; color: #fff; }
body.high-contrast .panel h1, body.high-contrast .panel h2 { color: #fff; }
body.high-contrast .panel p { color: #f8f9fa; }
body.high-contrast .hud-item { background: #000; color: #fff; border-color: #fff; }
body.high-contrast .big-btn { background: #fff; color: #000; border: 3px solid #fff; }
body.high-contrast .big-btn.success { background: #00ff00; color: #000; }
body.high-contrast .big-btn.danger { background: #ff3030; color: #fff; }
body.high-contrast .level-cell { background: #000; color: #fff; border-color: #fff; }
body.high-contrast .level-cell.completed { background: #00aa00; color: #fff; }
body.colorblind .float-text::before { content: '►'; margin-right: 4px; opacity: 0.8; }
.skip-link { position: absolute; top: -100px; left: 0; background: #f39c12; color: #000; padding: 8px 16px; z-index: 10000; border-radius: 0 0 8px 0; font-weight: bold; }
.skip-link:focus { top: 0; }

/* Dil seçici slide bar (menüde) */
.lang-slide {
  position: relative;
  display: flex;
  background: #ecf0f1;
  border: 2px solid #bdc3c7;
  border-radius: 999px;
  padding: 4px;
  margin: 0 auto 12px;
  width: fit-content;
  gap: 0;
  overflow: hidden;
}
.lang-pill {
  position: relative;
  z-index: 2;
  background: transparent;
  border: none;
  padding: 8px 22px;
  font-weight: bold;
  font-size: 14px;
  color: #7f8c8d;
  cursor: pointer;
  border-radius: 999px;
  transition: color 0.25s;
  font-family: inherit;
  min-width: 70px;
}
.lang-pill.active {
  color: white;
}
.lang-pill:focus-visible {
  outline: 3px solid #f39c12;
  outline-offset: 2px;
}
.lang-slider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: calc(50% - 4px);
  background: linear-gradient(135deg, #3498db, #2980b9);
  border-radius: 999px;
  transition: left 0.3s cubic-bezier(0.4, 1.5, 0.6, 1);
  left: 4px;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(52,152,219,0.4);
}
.lang-slide.lang-en .lang-slider {
  left: calc(50%);
}

/* Achievement toast */
.achievement-toast { position: absolute; top: 110px; right: -360px; background: white; border: 3px solid #f39c12; border-radius: 16px; padding: 12px 16px; display: flex; align-items: center; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,0.2); transition: right 0.4s cubic-bezier(0.4, 1.6, 0.6, 1); max-width: 340px; }
.achievement-toast.show { right: 12px; }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin: 12px 0; }
.ach-cell { background: #ecf0f1; border: 2px solid #bdc3c7; border-radius: 12px; padding: 8px; text-align: center; font-size: 12px; color: #555; opacity: 0.55; }
.ach-cell.unlocked { background: #fff9e6; border-color: #f39c12; color: #2c3e50; opacity: 1; }
.ach-cell .icon { font-size: 28px; display: block; margin-bottom: 4px; }
.ach-cell .name { font-weight: bold; font-size: 12px; }
.ach-cell .desc { font-size: 10px; color: #888; margin-top: 2px; line-height: 1.3; }

/* Responsive */
@media (max-width: 600px) {
  .hud-item { font-size: 12px; padding: 5px 10px; }
  .hud-item.target { font-size: 18px; padding: 8px 16px; }
  .hud-item.target #target { font-size: 22px; }
  .hud-item.current { font-size: 14px; padding: 6px 12px; }
  .hud-item.current #current { font-size: 16px; }
  .panel { padding: 20px; }
  .panel h1 { font-size: 24px; }
  .panel h2 { font-size: 20px; }
  .level-grid { grid-template-columns: repeat(4, 1fr); }
  #plate { font-size: 14px; min-width: 160px; padding: 6px 14px; }
}

@media (max-width: 380px) {
  .hud-item { font-size: 11px; padding: 4px 8px; border-width: 1px; }
  .hud-item.target { font-size: 16px; padding: 6px 12px; border-width: 2px; }
  .hud-item.target #target { font-size: 19px; }
  .hud-item.current { font-size: 13px; padding: 5px 10px; }
  .hud-item.current #current { font-size: 15px; }
  .hud-top { gap: 4px; }
  #plate { font-size: 12px; min-width: 140px; padding: 5px 10px; }
  #pause-btn, #sound-btn { width: 38px; height: 38px; font-size: 18px; }
  #hint-btn { width: 44px; height: 44px; font-size: 20px; }
  #sound-btn { right: calc(56px + env(safe-area-inset-right, 0px)); }
  .panel { padding: 16px 14px; max-height: 88vh; }
  .big-btn { padding: 11px 14px; font-size: 15px; }
  .level-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (orientation: landscape) and (max-height: 500px) {
  #hud { padding-top: calc(6px + env(safe-area-inset-top, 0px)); }
  #plate { bottom: calc(26px + env(safe-area-inset-bottom, 0px)); }
  .panel { max-height: 92vh; padding: 14px 18px; }
}

/* Typewriter cursor (tier intro) */
.typewriter-cursor {
  display: inline-block;
  width: 2px;
  background: #2c3e50;
  height: 1em;
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 0.7s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
