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

.hidden {
  display: none !important;
}

:root {
  --bg: #120e1f;
  --bg-glow: #2a1f45;
  --panel: rgba(22, 17, 38, 0.97);
  --panel-border: rgba(255, 209, 102, 0.28);
  --accent: #ff8c42;
  --accent-hot: #ff6b35;
  --accent2: #ffd166;
  --yarn: #ff6b9d;
  --life: #ff6b6b;
  --text: #fff8f0;
  --muted: #a89bc4;
  --pill: rgba(18, 14, 32, 0.88);
  --pill-border: rgba(255, 255, 255, 0.1);
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  --radius: 14px;
  --radius-sm: 8px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: 'Fredoka', system-ui, sans-serif;
  color: var(--text);
  touch-action: none;
}

#app {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 10px;
  background: radial-gradient(ellipse 90% 50% at 50% -10%, var(--bg-glow), transparent 60%);
}

/* --- Shell: HUD + canvas --- */
#game-shell {
  display: flex;
  flex-direction: column;
  width: min(960px, 100%);
  height: min(calc(100vh - 20px), 640px);
  max-height: calc(100vh - 20px);
}

#hud {
  flex-shrink: 0;
  padding: 0 0 6px;
  pointer-events: none;
}

#hud.hidden { display: none; }

.hud-bar {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 6px;
  align-items: stretch;
}

.hud-pill {
  background: var(--pill);
  border: 1px solid var(--pill-border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
}

.score-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
}

.pill-icon { font-size: 1rem; }

.pill-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
}

.lives-pill {
  display: flex;
  align-items: center;
  padding: 5px 10px;
}

.lives-row { display: flex; gap: 3px; }

.life-heart { font-size: 1rem; line-height: 1; }
.life-heart.full { color: var(--life); }
.life-heart.empty { color: rgba(255, 255, 255, 0.2); }

.goals-pill {
  padding: 5px 8px;
  min-width: 0;
}

.goals-row {
  display: flex;
  gap: 8px;
}

.goal-compact {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.goal-icon { font-size: 0.75rem; flex-shrink: 0; }

.goal-track {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  overflow: hidden;
  min-width: 24px;
}

.goal-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  transition: width 0.3s ease;
}

.yarn-fill { background: linear-gradient(90deg, #ff6b9d, #ff8ec4); }
.life-fill { background: linear-gradient(90deg, #ff6b6b, #ff9f9f); }

.goal-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--yarn);
  min-width: 0.6rem;
}

.goal-hints {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
}

.goal-hint {
  font-size: 0.58rem;
  color: var(--muted);
}

.goal-hint.ready { color: var(--accent2); font-weight: 600; }

.night-mood {
  display: block;
  width: 100%;
  margin-bottom: 2px;
  color: #c4b8e8;
  font-size: 0.62rem;
  letter-spacing: 0.02em;
}

/* --- Game frame --- */
#game-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0d0a16;
  box-shadow: 0 0 0 1px rgba(255, 140, 66, 0.2), var(--shadow);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* --- Overlay --- */
#overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

#overlay.is-menu,
#overlay.is-modal {
  pointer-events: auto;
}

.overlay-scrim {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 14, 0.72);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

#overlay.is-menu .overlay-scrim,
#overlay.is-modal .overlay-scrim {
  opacity: 1;
  pointer-events: auto;
}

/* --- Main menu (fits in frame, scrolls if needed) --- */
.menu-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
  pointer-events: auto;
}

.menu-screen.hidden { display: none; }

.menu-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
  padding: 4px 0;
}

.menu-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}

.game-title {
  font-size: clamp(1.6rem, 5vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  background: linear-gradient(135deg, #fff5d6, var(--accent2), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.tagline {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.35;
}

.landscape-hint {
  display: none;
  font-size: 0.72rem;
  color: var(--accent2);
  margin: -8px 0 12px;
  line-height: 1.35;
}

.mobile-portrait .landscape-hint {
  display: block;
}

.account-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
}

.account-bar-in {
  flex-direction: row;
  align-items: center;
}

.account-name {
  font-size: 0.85rem;
  color: var(--muted);
  margin-right: 4px;
}

.account-name strong { color: var(--accent2); }

.account-rank {
  font-size: 0.75rem;
  color: var(--muted);
  margin: -6px 0 10px;
}

.account-rank.hidden { display: none; }

.guest-note {
  font-size: 0.72rem;
  color: var(--muted);
  margin: -4px 0 12px;
  line-height: 1.4;
}

.guest-note a {
  color: var(--accent2);
}

.btn-play {
  width: 100%;
  padding: 14px 20px;
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.menu-details {
  text-align: left;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  padding: 0 10px;
}

.menu-details summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 0;
  list-style: none;
}

.menu-details summary::-webkit-details-marker { display: none; }

.menu-details[open] summary { color: var(--accent2); }

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding-bottom: 8px;
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.72rem;
  color: var(--muted);
}

.control-item .keys { display: flex; gap: 3px; flex-wrap: wrap; }

.menu-tip {
  font-size: 0.68rem;
  color: var(--muted);
  padding-bottom: 8px;
}

kbd {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 0.65rem;
  color: var(--text);
}

.high-score {
  font-size: 0.8rem;
  color: var(--muted);
}

.high-score strong {
  color: var(--accent2);
  font-size: 1rem;
}

.hub-link {
  margin-top: 12px;
  font-size: 0.72rem;
}

.hub-link a {
  color: var(--muted);
  text-decoration: none;
}

.hub-link a:hover {
  color: var(--accent2);
  text-decoration: underline;
}

/* --- Modals (auth, leaderboard, game over, pause) --- */
.modal-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
  pointer-events: auto;
  z-index: 20;
}

.modal-screen.hidden { display: none; }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  max-height: calc(100% - 16px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
  text-align: center;
  animation: modal-in 0.25s ease;
}

.modal-card-wide { max-width: 360px; }

.modal-card-pause { max-width: 320px; }

.modal-card-scroll {
  text-align: left;
  max-height: calc(100% - 16px);
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pause-actions .btn-block { margin-top: 0; }

.btn-danger {
  color: #ffb4b4;
  border-color: rgba(255, 120, 120, 0.35);
}

.btn-danger:hover {
  color: #ffd0d0;
  border-color: rgba(255, 140, 140, 0.55);
}

.guide-section {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.guide-section:last-of-type {
  border-bottom: none;
  margin-bottom: 10px;
}

.guide-heading {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent2);
  margin-bottom: 8px;
}

.guide-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.guide-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text);
}

.guide-list-loose li {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.guide-list-loose strong { color: var(--text); }

.guide-label { color: var(--text); }

.guide-value {
  color: var(--accent2);
  font-weight: 600;
  white-space: nowrap;
}

.guide-note {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

.modal-emoji {
  font-size: 2.5rem;
  margin-bottom: 4px;
}

.modal-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 12px;
  padding-right: 28px;
}

.panel-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.death-reason {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 12px;
  line-height: 1.4;
}

.stat-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 209, 102, 0.18);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
}

.stat-box-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 2px;
}

.stat-box-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent2);
}

.global-rank-msg {
  font-size: 0.82rem;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.global-rank-msg--ok { color: var(--accent2); }
.global-rank-msg--err { color: #ff9a9a; }
.global-rank-msg--guest { color: var(--muted); font-size: 0.82rem; }
.global-rank-msg--guest a { color: var(--accent2); }
.global-rank-msg.hidden { display: none; }

/* --- Buttons --- */
.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(180deg, #ffb347, var(--accent-hot));
  color: #1a1028;
  box-shadow: 0 3px 0 #a84818;
}

.btn-secondary {
  background: rgba(255, 140, 66, 0.25);
  color: var(--accent2);
  border: 1px solid rgba(255, 140, 66, 0.4);
}

.btn-outline {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn-outline:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.35);
}

.btn-sm {
  font-size: 0.78rem;
  padding: 7px 11px;
}

.btn-block {
  display: block;
  width: 100%;
  margin-top: 6px;
}

.btn-block:first-of-type { margin-top: 0; }

/* --- Auth form --- */
.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.auth-tab {
  flex: 1;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.auth-tab.active {
  background: rgba(255, 140, 66, 0.2);
  border-color: rgba(255, 140, 66, 0.45);
  color: var(--accent2);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.auth-form input {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
}

.auth-form select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
}

.auth-form select:focus,
.auth-form input:focus {
  outline: none;
  border-color: rgba(255, 140, 66, 0.5);
}

.form-error {
  font-size: 0.8rem;
  color: #ff9a9a;
  background: rgba(255, 80, 80, 0.12);
  border: 1px solid rgba(255, 80, 80, 0.3);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  text-align: left;
}

.form-error.hidden { display: none; }

/* --- Leaderboard list --- */
.lb-status {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 10px;
  text-align: left;
}

.leaderboard-list {
  list-style: none;
  text-align: left;
  max-height: min(280px, 45vh);
  overflow-y: auto;
}

.lb-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 8px 8px;
  border-radius: 6px;
  margin-bottom: 3px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.85rem;
}

.lb-row.lb-me {
  background: rgba(255, 140, 66, 0.18);
  border: 1px solid rgba(255, 140, 66, 0.35);
}

.lb-rank { font-weight: 700; color: var(--muted); }
.lb-row.lb-top-1 .lb-rank { color: #ffd166; }
.lb-row.lb-top-2 .lb-rank { color: #c8c8c8; }
.lb-row.lb-top-3 .lb-rank { color: #cd7f32; }

.lb-name-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.lb-flag {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
}

.lb-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.lb-score {
  font-weight: 700;
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
}

.lb-empty {
  text-align: center;
  color: var(--muted);
  padding: 20px 8px;
  font-size: 0.85rem;
}

.modal-card-characters {
  max-width: 400px;
  padding: 1.2rem 1.3rem 1.3rem;
}

/* --- Character select (2 × 3 grid) --- */
.character-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, auto);
  gap: 12px;
  margin-bottom: 16px;
}

.char-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
}

.char-card:hover {
  border-color: rgba(255, 180, 100, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.char-card.selected {
  border-color: var(--accent2);
  background: rgba(255, 140, 66, 0.1);
  box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.4), 0 8px 24px rgba(255, 140, 66, 0.18);
  transform: translateY(-2px);
}

.char-card:active {
  transform: scale(0.98);
}

.char-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 84px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 85%, rgba(255, 190, 100, 0.14) 0%, transparent 70%),
    linear-gradient(180deg, #3a2d62 0%, #181228 100%);
}

.char-preview {
  display: block;
  width: auto;
  height: 72px;
  max-width: 100%;
}

.char-name {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-align: center;
  padding: 10px 8px 11px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.char-card.selected .char-name {
  color: var(--accent2);
}

.char-card:hover .char-name,
.char-card.selected .char-name {
  color: var(--accent2);
}

/* --- Toasts --- */
#toasts {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  pointer-events: none;
  width: 90%;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toast {
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--accent2);
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.toast.fade {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* --- Touch (landscape mobile) --- */
#touch-controls {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

#touch-controls.hidden { display: none; }

.touch-cluster {
  position: absolute;
  pointer-events: auto;
}

.touch-move {
  left: max(10px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
}

.touch-actions {
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.touch-dpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 6px;
  width: min(42vw, 168px);
}

.touch-dpad-gap {
  display: block;
}

.touch-dpad-center {
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.08);
}

.touch-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(18, 14, 32, 0.82);
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
  font-family: inherit;
  backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.touch-btn:active {
  transform: scale(0.94);
}

.touch-jump {
  width: 56px;
  height: 56px;
  background: linear-gradient(180deg, #ffb347, var(--accent-hot));
  color: #1a1028;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.35);
}

.touch-action {
  width: 60px;
  height: 60px;
  font-size: 1.35rem;
}

.touch-yarn {
  background: rgba(255, 107, 157, 0.35);
  border-color: rgba(255, 107, 157, 0.45);
}

.touch-heal {
  background: rgba(255, 107, 107, 0.3);
  border-color: rgba(255, 107, 107, 0.4);
}

/* --- Rotate prompt (portrait on touch devices) --- */
.rotate-prompt {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 4, 14, 0.92);
  backdrop-filter: blur(8px);
}

.rotate-prompt.hidden { display: none; }

.rotate-prompt-card {
  text-align: center;
  max-width: 280px;
}

.rotate-icon {
  display: inline-block;
  font-size: 3rem;
  margin-bottom: 16px;
  animation: rotate-hint 2.4s ease-in-out infinite;
}

@keyframes rotate-hint {
  0%, 100% { transform: rotate(0deg); }
  40% { transform: rotate(-90deg); }
  60% { transform: rotate(-90deg); }
}

.rotate-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.rotate-sub {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  #app { padding: 0; }

  #game-shell {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  #game-frame { border-radius: 0; }

  .hud-bar {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .goals-pill {
    grid-column: 1 / -1;
  }
}

/* Landscape mobile / touch: full-screen play + corner controls */
@media (orientation: landscape) and (max-width: 900px),
(orientation: landscape) and (pointer: coarse) {
  #app {
    padding: 0;
    align-items: stretch;
  }

  #game-shell {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  #game-frame {
    border-radius: 0;
    box-shadow: none;
  }

  .hud-bar {
    grid-template-columns: auto auto 1fr;
    grid-template-rows: auto;
    gap: 4px;
    padding: 0 4px;
  }

  .goals-pill {
    grid-column: auto;
  }

  .goal-hints {
    display: none;
  }

  .hud-pill {
    padding: 4px 8px;
  }

  .pill-value {
    font-size: 0.95rem;
  }

  .touch-btn {
    width: 52px;
    height: 52px;
  }

  .touch-jump {
    width: 52px;
    height: 52px;
  }

  .touch-action {
    width: 54px;
    height: 54px;
    font-size: 1.2rem;
  }

  .touch-dpad {
    width: 156px;
  }
}

@media (min-width: 901px) and (pointer: fine) {
  #touch-controls { display: none !important; }
  #rotate-prompt { display: none !important; }
}
