/* Díra – UI screens (menu, pickers, pause, results) and HUD.
   Visual language matches the portal: white chunky cards, big round buttons,
   purple ink. Everything ≥ 64 px to tap.
   Phase 5a: menu-type screens dim + blur the live 3D scene behind them and put
   ALL their controls into one opaque panel centred on the screen (nothing pinned
   to the top edge or corners). Only the in-game HUD sits at the screen edges. */

/* ================================================================ shared bits */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(16px, var(--sat)) max(16px, var(--sar)) max(16px, var(--sab)) max(16px, var(--sal));
  /* dim + calm the busy 3D scene so the panel reads clearly (still colourful, not gloomy) */
  background: radial-gradient(ellipse at 50% 45%, rgba(110, 84, 230, 0.3), rgba(40, 26, 104, 0.62));
  -webkit-backdrop-filter: blur(7px) saturate(0.85);
  backdrop-filter: blur(7px) saturate(0.85);
  animation: ui-fade 0.25s ease both;
  pointer-events: auto;
  overflow: hidden;
}
/* no backdrop-filter (old browsers): a more opaque veil instead of the blur */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .screen { background: radial-gradient(ellipse at 50% 45%, rgba(104, 78, 214, 0.62), rgba(32, 22, 84, 0.86)); }
}
@keyframes ui-fade { from { opacity: 0; } to { opacity: 1; } }
.screen-results { background: radial-gradient(ellipse at 50% 30%, rgba(255, 214, 90, 0.42), rgba(104, 64, 220, 0.62) 80%); }

/* the one centred panel of every menu-type screen; margin:auto centres it in the
   flex column and still lets it scroll (instead of overflowing off the top) */
.panel {
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  background: linear-gradient(180deg, #ffffff 0%, #f7f3ff 100%);
  border-radius: 44px;
  padding: 26px 34px 28px;
  box-shadow: 0 0 0 6px var(--purple), 0 12px 0 6px #5d3fd6, 0 26px 60px 6px rgba(12, 6, 40, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  animation: hr-bounce-in 0.45s ease both;
}
.panel[data-scroll] { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.row { display: flex; gap: 22px; align-items: center; justify-content: center; flex-wrap: wrap; }

.btn.round.sm { width: 70px; height: 70px; min-width: 70px; min-height: 70px; font-size: 32px; }
.btn.round.big-round { width: 100px; height: 100px; font-size: 48px; }
.panel .btn:not(.primary) { box-shadow: 0 0 0 4px #e3dafd, 0 6px 0 4px #cfc2fb, 0 10px 18px rgba(43, 35, 80, 0.18); }
.panel .btn:not(.primary):active { box-shadow: 0 0 0 4px #e3dafd, 0 2px 0 4px #cfc2fb; }
.tool-row { gap: 18px; }

/* ---- icons (shared/icons.js = Material Design Icons, inline SVG). Each control has its
   own cheerful colour; "off" states (muted, no music) turn grey with the MDI "-off" icon. */
[data-action="home"], [data-action="menu"] { color: var(--orange); }
[data-action="music"] { color: var(--pink); }
[data-action="mute"] { color: var(--blue); }
[data-action="fullscreen"] { color: var(--purple); }
[data-action="back"] { color: var(--purple); }
[data-action="pause"] { color: #5d3fd6; }
.btn.off { color: #8a84a8; }
.btn.round.big-round > .ic { width: 60%; height: 60%; }
.btn.primary > .ic { color: #fff; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.13)); }
.medal.m1 { color: #ffc21a; } .medal.m1 path { stroke: #e08600; }
.medal.m2 { color: #c3cddf; } .medal.m2 path { stroke: #8391ab; }
.medal.m3 { color: #f0a06a; } .medal.m3 path { stroke: #b8622c; }
.medal.soft path { stroke-width: 1.4px; }
.star-num { display: inline-flex; align-items: center; gap: 4px; }
.star-num > .ic { font-size: 1.15em; }

.stars-pill {
  background: #fff6cc; border-radius: 999px; padding: 10px 22px 10px 16px; min-height: 66px;
  font-size: 32px; font-weight: 900; color: var(--ink);
  box-shadow: 0 0 0 4px var(--sun), 0 6px 0 4px #e0a800, 0 10px 18px rgba(43, 35, 80, 0.18);
  display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums;
}
.stars-pill .sp-star { font-size: 44px; display: grid; animation: star-twinkle 3s ease-in-out infinite; }
@keyframes star-twinkle { 0%, 80%, 100% { transform: rotate(0) scale(1); } 88% { transform: rotate(-15deg) scale(1.15); } 94% { transform: rotate(10deg) scale(1.1); } }
.stars-pill.bump { animation: pill-bump 0.35s ease; }
@keyframes pill-bump { 50% { transform: scale(1.18); } }

/* big green ▶ */
.play-btn {
  width: 160px; height: 160px; min-width: 160px; border-radius: 50%; padding: 0;
  font-size: 64px;
  box-shadow: 0 8px 0 #2f9c58, 0 14px 30px rgba(43, 35, 80, 0.3);
  animation: play-pulse 2.2s ease-in-out infinite;
}
.play-btn:active { box-shadow: 0 3px 0 #2f9c58; }
.play-btn > .ic, .foot-play > .ic { width: 66%; height: 66%; margin-left: 5%; }
.again-btn > .ic { width: 62%; height: 62%; margin-left: 0; }
@keyframes play-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 0 #2f9c58, 0 14px 30px rgba(43, 35, 80, 0.3), 0 0 0 0 rgba(76, 211, 123, 0.5); }
  50% { transform: scale(1.05); box-shadow: 0 8px 0 #2f9c58, 0 14px 30px rgba(43, 35, 80, 0.3), 0 0 0 18px rgba(76, 211, 123, 0); }
}
.btn.foot-play {
  width: 112px; height: 112px; min-width: 112px; font-size: 48px;
  box-shadow: 0 7px 0 #2f9c58, 0 12px 26px rgba(43, 35, 80, 0.3);
  animation: play-pulse 2.2s ease-in-out infinite;
}

.ring-img, .menu-ring, .title-ring, .hero-ring, .pick-ring, .unlock-ring, .next-ring, .rk-ring { display: block; pointer-events: none; -webkit-user-drag: none; }
.spin { animation: ring-spin 14s linear infinite; }
@keyframes ring-spin { to { transform: rotate(360deg); } }

.new-badge {
  position: absolute; top: -10px; right: -10px; width: 46px; height: 46px; border-radius: 50%;
  background: var(--sun); color: #fff; display: grid; place-items: center; font-size: 32px;
  box-shadow: 0 3px 0 #e0a800; animation: badge-pop 1.4s ease-in-out infinite;
}
@keyframes badge-pop { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.15) rotate(12deg); } }

.bounce { animation: ui-bounce 0.45s ease; }
@keyframes ui-bounce { 0% { transform: scale(1); } 35% { transform: scale(1.14); } 65% { transform: scale(0.95); } 100% { transform: scale(1); } }
.wiggle { animation: ui-wiggle 0.4s ease; }
@keyframes ui-wiggle { 20% { transform: rotate(-6deg); } 40% { transform: rotate(6deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(3deg); } }
.pulse { animation: play-pulse 1.2s ease-in-out infinite; }

/* ================================================================ main menu */
.menu-panel { gap: clamp(16px, 2.6vh, 26px); padding: 22px clamp(22px, 4vw, 44px) 28px; }
.menu-title {
  margin: 0; display: flex; align-items: center; gap: 16px;
  font-size: clamp(64px, 10vw, 100px); font-weight: 900; letter-spacing: 1px; line-height: 1;
  color: var(--purple); text-shadow: 0 5px 0 #d8ccff;
  animation: hr-bounce-in 0.5s ease both;
}
.title-ring { width: 1.05em; height: 1.05em; filter: drop-shadow(0 4px 0 rgba(43, 35, 80, 0.2)); }
.menu-grid { display: grid; grid-template-columns: auto auto auto; align-items: center; gap: clamp(22px, 4vw, 48px); }
.menu-card {
  appearance: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; position: relative;
  width: 190px; height: 190px; border-radius: 44px; background: #fff;
  display: grid; place-items: center;
  box-shadow: 0 0 0 5px #e3dafd, 0 8px 0 5px #cfc2fb, 0 14px 24px rgba(43, 35, 80, 0.2);
  transition: transform 0.15s ease; animation: hr-bounce-in 0.5s ease both; animation-delay: 0.08s;
  touch-action: manipulation;
}
@media (hover: hover) { .menu-card:hover { transform: translateY(-4px) rotate(-2deg); } }
.menu-card:active { transform: scale(0.95); }
.menu-card:focus-visible { outline: 6px solid var(--sun); outline-offset: 6px; }
.menu-ring { width: 150px; height: 150px; }
.map-card { align-content: center; gap: 4px; animation-delay: 0.16s; }
.map-card-emoji { font-size: 88px; line-height: 1; filter: drop-shadow(0 4px 2px rgba(0, 0, 0, 0.18)); }
.map-card-name { font-size: 24px; font-weight: 900; background: #fff; border-radius: 999px; padding: 4px 16px; box-shadow: 0 3px 0 rgba(43, 35, 80, 0.15); }
.card-tag {
  position: absolute; left: -14px; bottom: -14px; width: 62px; height: 62px; border-radius: 50%;
  background: #fff; display: grid; place-items: center; font-size: 38px;
  box-shadow: 0 0 0 4px #e3dafd, 0 5px 0 4px #cfc2fb;
}
.tag-skins { color: var(--pink); }
.tag-maps { color: #22a861; }

.menu-progress { gap: 18px; }
.next-unlock {
  display: flex; align-items: center; gap: 14px; background: #fff;
  border-radius: 999px; padding: 6px 12px 6px 18px;
  box-shadow: 0 0 0 4px #e3dafd, 0 6px 0 4px #cfc2fb;
  animation: hr-bounce-in 0.5s ease both; animation-delay: 0.25s;
}
.next-unlock.all { font-size: 34px; font-weight: 900; padding: 10px 26px; gap: 10px; }
.next-unlock .crown { font-size: 46px; color: #ffb300; }
.next-gift { display: grid; font-size: 46px; color: var(--pink); animation: hr-float 2s ease-in-out infinite; }
.next-bar { position: relative; width: clamp(150px, 22vw, 240px); height: 40px; border-radius: 999px; background: #e9e2ff; overflow: hidden; box-shadow: inset 0 2px 0 rgba(43, 35, 80, 0.12); }
.next-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, var(--sun), var(--orange)); }
.next-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 22px; font-weight: 900; color: var(--ink); }
.next-text > .ic { font-size: 26px; }
.next-item { position: relative; width: 64px; height: 64px; display: grid; place-items: center; }
.next-item.locked .next-ring, .next-item.locked .next-emoji { filter: grayscale(0.85) opacity(0.6); }
.next-ring { width: 60px; height: 60px; }
.next-emoji { font-size: 44px; }
.next-lock { position: absolute; right: -6px; bottom: -6px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; color: #fff; background: #7b70ad; box-shadow: 0 0 0 2px #fff; }

/* ================================================================ pickers */
.picker-panel {
  width: min(100%, 980px); padding: 18px 18px 20px; gap: 14px;
}
.picker-head { display: flex; align-items: center; justify-content: center; gap: 20px; flex: 0 0 auto; flex-wrap: wrap; }
.picker-title {
  width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; font-size: 58px;
  background: #fff; box-shadow: 0 0 0 4px #e3dafd, 0 6px 0 4px #cfc2fb;
}
.picker-body {
  flex: 1 1 auto; min-height: 0; align-self: stretch; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  display: flex; flex-direction: column; align-items: center;
  padding: 22px 8px 26px; border-radius: 32px; touch-action: pan-y;
  background: #efe9ff; box-shadow: inset 0 3px 0 rgba(43, 35, 80, 0.08);
}
.picker-foot { flex: 0 0 auto; gap: 28px; }
.picker-hero { display: flex; align-items: center; gap: 16px; background: #fff; border-radius: 999px; padding: 6px 28px 6px 8px; box-shadow: 0 0 0 4px #e3dafd, 0 6px 0 4px #cfc2fb; }
.hero-ring { width: 92px; height: 92px; }
.hero-name { font-size: 34px; font-weight: 900; white-space: nowrap; }
.pick-grid { display: grid; gap: 20px; width: 100%; padding: 0 12px; }
.skins-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
.maps-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 26px; }
.pick-card {
  appearance: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; position: relative;
  background: #fff; border-radius: 36px; padding: 14px 8px 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 0 0 3px #ddd3fb, 0 6px 0 3px #c9bbf7, 0 10px 18px rgba(43, 35, 80, 0.12);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  animation: hr-bounce-in 0.4s ease both;
  touch-action: manipulation;
}
@media (hover: hover) { .pick-card:hover { transform: translateY(-3px); } }
.pick-card:focus-visible { outline: 6px solid var(--sun); outline-offset: 5px; }
.pick-card.selected { box-shadow: 0 0 0 7px var(--green), 0 6px 0 7px #2f9c58, 0 12px 22px rgba(43, 35, 80, 0.2); }
.pick-ring { width: 104px; height: 104px; }
.pick-name { font-size: 19px; font-weight: 900; white-space: nowrap; }
.pick-card .check {
  position: absolute; top: -10px; right: -10px; width: 44px; height: 44px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 30px; font-weight: 900; display: none; place-items: center;
  box-shadow: 0 3px 0 #2f9c58;
}
.pick-card.selected .check { display: grid; animation: hr-bounce-in 0.35s ease both; }
.pick-card.locked { background: #e4e0ee; cursor: default; box-shadow: 0 0 0 3px #d6d0e6, 0 6px 0 3px #c4bdd8; }
.pick-card.locked .pick-ring, .pick-card.locked .map-pick-emoji { filter: saturate(0.35) opacity(0.6); }
.pick-card.locked .pick-name { opacity: 0.55; }
.pick-lock {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  pointer-events: none;
}
.pick-lock .lock-icon {
  width: 54px; height: 54px; margin-top: -26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 32px; color: #fff; background: #7b70ad; box-shadow: 0 0 0 3px #fff, 0 4px 6px rgba(43, 35, 80, 0.25);
}
.pick-lock .need { display: inline-flex; align-items: center; gap: 3px; font-size: 21px; font-weight: 900; background: #fff; border-radius: 999px; padding: 2px 12px 2px 6px; box-shadow: 0 3px 0 rgba(43, 35, 80, 0.18); }
.pick-lock .need > .ic { font-size: 26px; }
.skins-grid .pick-card:nth-child(4n+2) { animation-delay: 0.03s; }
.skins-grid .pick-card:nth-child(4n+3) { animation-delay: 0.06s; }
.skins-grid .pick-card:nth-child(4n+4) { animation-delay: 0.09s; }

.map-pick { aspect-ratio: 4 / 3; background: linear-gradient(165deg, var(--sky) 0%, var(--sky) 35%, var(--ground) 36%, var(--ground) 100%); border-radius: 40px; }
.map-pick-emoji { font-size: 92px; line-height: 1; filter: drop-shadow(0 5px 3px rgba(0, 0, 0, 0.2)); }
.map-pick .pick-name { font-size: 28px; background: #fff; border-radius: 999px; padding: 4px 18px; box-shadow: 0 3px 0 rgba(43, 35, 80, 0.15); }
.map-pick.locked { background: linear-gradient(165deg, #dcd8e8, #c9c4da); }
.map-pick.locked .pick-lock .lock-icon { width: 72px; height: 72px; font-size: 44px; margin-top: -40px; }
.map-pick.locked .pick-lock .need { font-size: 26px; }

/* ================================================================ pause */
.pause-panel { padding: 30px 48px 30px; gap: 26px; }
.pause-badge { width: 110px; height: 110px; border-radius: 50%; background: var(--sun); display: grid; place-items: center; box-shadow: 0 6px 0 #e0a800; animation: hr-float 2.4s ease-in-out infinite; }
.pause-badge { color: #5d3fd6; font-size: 76px; }

/* ================================================================ results */
.res-total.bump { animation: pill-bump 0.35s ease; }
.results-panel {
  width: min(100%, 900px);
  display: grid; grid-template-columns: 1.25fr 1fr; grid-template-areas: 'main side' 'buttons buttons';
  gap: 18px 26px; padding: 26px 30px 26px; align-items: center;
}
.res-main { grid-area: main; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.res-side { grid-area: side; align-self: stretch; display: flex; align-items: center; }
.res-buttons { grid-area: buttons; gap: 30px; }
.res-head { display: flex; align-items: center; gap: 14px; }
.res-medal { font-size: 100px; line-height: 1; display: grid; animation: medal-in 0.9s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: 0.2s; filter: drop-shadow(0 5px 0 rgba(43, 35, 80, 0.14)); }
.res-medal.balloon { color: var(--pink); }
@keyframes medal-in { 0% { transform: scale(0) rotate(-200deg); } 100% { transform: scale(1) rotate(0); } }
.res-praise { font-size: clamp(44px, 6vw, 62px); font-weight: 900; color: var(--orange); text-shadow: 0 4px 0 rgba(43, 35, 80, 0.12); animation: hr-bounce-in 0.5s ease both; animation-delay: 0.35s; }
.res-stars { display: flex; gap: 14px; }
.res-star { position: relative; width: 96px; height: 96px; display: grid; place-items: center; }
.res-star .ic { width: 100%; height: 100%; }
.res-star .star-empty { color: #e7e1f7; }
.res-star .star-empty path { stroke: #d3c9f0; }
.res-star .star-full { position: absolute; inset: 0; transform: scale(0); opacity: 0; filter: drop-shadow(0 4px 0 rgba(224, 134, 0, 0.35)); }
.res-star.on .star-full { animation: star-land 0.55s cubic-bezier(.3, 1.7, .5, 1) both; }
.res-star.on::after {
  content: ''; position: absolute; inset: -10px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 210, 63, 0.75), rgba(255, 210, 63, 0) 65%);
  animation: star-glow 0.8s ease-out both;
}
.res-star.dim .star-empty { opacity: 0.75; }
@keyframes star-land { 0% { transform: scale(2.6) rotate(-90deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes star-glow { 0% { transform: scale(0.4); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
.res-bonus { display: flex; gap: 10px; min-height: 0; flex-wrap: wrap; justify-content: center; }
.res-bonus:empty { display: none; }
.bonus-chip {
  display: inline-flex; align-items: center; gap: 6px; background: #fff2b3; border-radius: 999px;
  padding: 6px 16px 6px 12px; font-size: 28px; font-weight: 900; box-shadow: 0 4px 0 #f0c94a;
  animation: hr-bounce-in 0.45s ease both;
}
.bonus-chip .b-icon { display: grid; font-size: 36px; color: #ff8c42; }
.bonus-chip .b-maxSize { color: var(--purple); }
.bonus-chip .b-clean { color: #22a861; }
.bonus-chip .b-objects { color: #c47a3a; }
.bonus-chip .b-plus { display: inline-flex; align-items: center; color: #b07400; }
.bonus-chip .b-plus > .ic { font-size: 34px; }
.res-stats { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.stat { display: grid; grid-template-columns: auto auto; grid-template-areas: 'icon num' 'label label'; align-items: center; column-gap: 8px; background: #fff; border-radius: 26px; padding: 8px 20px 6px; box-shadow: 0 0 0 3px #e3dafd, 0 5px 0 3px #cfc2fb; }
.stat-icon { grid-area: icon; font-size: 40px; display: grid; color: #c47a3a; }
.stat.best .stat-icon { color: #ff9f1a; }
.stat-num { grid-area: num; font-size: 38px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-label { grid-area: label; font-size: 16px; font-weight: 800; color: var(--ink-soft); }
.stat.best { background: #fff2b3; }
.hole-icon { width: 44px; height: 26px; border-radius: 50%; background: radial-gradient(ellipse at 50% 35%, #3a3160, #07060c 70%); box-shadow: 0 0 0 5px var(--sun); margin: 0 4px; }
.res-rank { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.res-rank li { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 800; background: #fff; border-radius: 22px; padding: 6px 16px 6px 10px; box-shadow: 0 0 0 3px #e9e2ff, 0 4px 0 3px #d9cffc; animation: hr-bounce-in 0.4s ease both; }
.res-rank li:nth-child(2) { animation-delay: 0.05s; } .res-rank li:nth-child(3) { animation-delay: 0.1s; } .res-rank li:nth-child(4) { animation-delay: 0.15s; } .res-rank li:nth-child(5) { animation-delay: 0.2s; }
.res-rank li.me { background: #fff2b3; transform: scale(1.04); box-shadow: 0 0 0 4px var(--sun); }
.res-rank .rk { width: 40px; display: grid; place-items: center; font-size: 36px; }
.res-rank .rk:not(:has(.ic)) { font-size: 24px; }
.rk-ring { width: 36px; height: 36px; }
.res-rank .rk-name { flex: 1; text-align: left; }
.res-rank .rk-score { font-variant-numeric: tabular-nums; color: var(--ink-soft); }


/* confetti */
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.confetti i { position: absolute; top: -30px; display: block; animation: confetti-fall linear both; }
@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translate(var(--drift), 110vh) rotate(var(--spin)); opacity: 0; }
}

/* unlock reveal */
.unlock-overlay {
  position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(circle at 50% 45%, rgba(143, 107, 255, 0.92), rgba(43, 35, 80, 0.95) 75%);
  animation: ui-fade 0.3s ease both; overflow: hidden; padding: 20px;
}
.unlock-overlay.closing { animation: ui-fade 0.25s ease reverse both; }
.unlock-rays {
  position: absolute; left: 50%; top: 45%; width: 200vmax; height: 200vmax; margin: -100vmax 0 0 -100vmax;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.09) 0 10deg, rgba(255, 255, 255, 0) 10deg 20deg);
  animation: ring-spin 30s linear infinite; pointer-events: none;
}
.gift { position: absolute; display: grid; font-size: 190px; line-height: 1; color: #ff5d8f; animation: gift-wobble 0.5s ease-in-out infinite; filter: drop-shadow(0 8px 0 #c93a6a) drop-shadow(0 14px 14px rgba(0, 0, 0, 0.3)); }
.gift.open { animation: gift-pop 0.5s ease-in both; }
@keyframes gift-wobble { 0%, 100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.08); } }
@keyframes gift-pop { 0% { transform: scale(1); opacity: 1; } 40% { transform: scale(1.4); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }
.unlock-content { position: relative; display: flex; flex-direction: column; align-items: center; gap: 24px; opacity: 0; transform: scale(0.3); pointer-events: none; max-height: 100%; }
.unlock-content.show { animation: unlock-in 0.7s cubic-bezier(.3, 1.6, .5, 1) both; pointer-events: auto; }
@keyframes unlock-in { 0% { opacity: 0; transform: scale(0.3) rotate(-10deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
.unlock-title { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: clamp(40px, 6vw, 60px); font-weight: 900; color: #fff; text-shadow: 0 5px 0 var(--orange), 0 0 30px rgba(255, 210, 63, 0.7); text-align: center; }
.unlock-title > .ic { color: var(--sun); filter: drop-shadow(0 4px 0 var(--orange)); }
.unlock-items { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; max-width: 900px; }
.unlock-card {
  appearance: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; position: relative;
  width: 210px; min-height: 220px; border-radius: 44px; background: #fff; padding: 16px 12px 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.2), 0 0 40px rgba(255, 210, 63, 0.6);
  animation: hr-float 2.4s ease-in-out infinite;
}
.unlock-card:nth-child(2) { animation-delay: -0.8s; } .unlock-card:nth-child(3) { animation-delay: -1.6s; }
/* many new things at once (fresh profiles): smaller cards so the OK (thumb) button stays on screen */
.unlock-items.many { gap: 18px; }
.unlock-items.many .unlock-card { width: 176px; min-height: 186px; border-radius: 38px; }
.unlock-items.many .unlock-ring { width: 118px; height: 118px; }
.unlock-items.many .unlock-emoji { font-size: 92px; }
.unlock-items.many .unlock-name { font-size: 24px; }
.unlock-card.map { background: linear-gradient(165deg, #c9f0ff, #a6dd7f); }
.unlock-ring { width: 150px; height: 150px; }
.unlock-emoji { font-size: 120px; line-height: 1.1; }
.unlock-name { font-size: 30px; font-weight: 900; background: rgba(255, 255, 255, 0.9); border-radius: 999px; padding: 2px 16px; }
.unlock-card .check { position: absolute; top: -10px; right: -10px; width: 52px; height: 52px; border-radius: 50%; background: var(--green); color: #fff; font-size: 34px; font-weight: 900; display: none; place-items: center; box-shadow: 0 3px 0 #2f9c58; }
.unlock-card.chosen { box-shadow: 0 0 0 8px var(--green), 0 8px 0 8px #2f9c58; }
.unlock-card.chosen .check { display: grid; }
.unlock-content .btn.big { min-width: 160px; font-size: 64px; }

/* ================================================================ HUD */
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud.hidden { display: none; }
.hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  padding: max(14px, var(--sat)) max(16px, var(--sar)) 0 max(16px, var(--sal));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px;
}
.hud-left { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.hud-center { display: flex; justify-content: center; align-items: flex-start; gap: 12px; }
.hud-right { display: flex; gap: 12px; justify-content: flex-end; }
.pill {
  background: #fff; color: var(--ink); border-radius: 999px; padding: 8px 20px;
  font-size: 32px; font-weight: 900; min-height: 64px;
  box-shadow: 0 0 0 4px rgba(43, 35, 80, 0.55), 0 6px 0 4px rgba(43, 35, 80, 0.35), 0 10px 22px rgba(0, 0, 0, 0.3);
  display: inline-flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums;
  transition: background-color 0.6s ease, color 0.6s ease;
}
.hud-time { min-width: 150px; justify-content: center; }
.hud-time-icon { display: grid; font-size: 36px; color: #5d3fd6; }
.hud.late .hud-time-icon { color: #c46a00; }
.hud.late .hud-time { background: #ffe1b5; color: #b85e00; }
.hud.final .hud-time { background: #ffd08a; }
.hud-time.tock { animation: tock 0.5s ease; }
@keyframes tock { 0% { transform: scale(1); } 30% { transform: scale(1.12); } 100% { transform: scale(1); } }
.hud-level { gap: 12px; padding-left: 10px; }
.hud-level.bump { animation: ui-bounce 0.5s ease; }
.hud-level-icon { width: 46px; height: 46px; border-radius: 50%; background: #07060c; flex: 0 0 auto; }
.hud-level-num { min-width: 1.2em; text-align: center; }
.hud-level-bar { width: 140px; height: 22px; border-radius: 999px; background: #e6e1f5; overflow: hidden; box-shadow: inset 0 2px 0 rgba(43, 35, 80, 0.1); }
.hud-level-fill { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--green), #9be15d); border-radius: 999px; transform-origin: left; transform: scaleX(0); transition: transform 0.25s ease; }
/* holes eaten this round (9c): fork & knife badge, appears after the first eaten bot */
.hud-eat { display: none; padding: 8px 18px 8px 12px; gap: 6px; background: #fff2b3; }
.hud-eat.on { display: inline-flex; }
.hud-eat.bump { animation: ui-bounce 0.5s ease; }
.hud-eat-icon { display: grid; font-size: 34px; color: #e07a00; }
.hud-board li.away { opacity: 0.55; }
@media (max-width: 720px) { /* narrow windows: the badge goes under the level pill (keeps ⏸ on screen) */
  .hud-center { flex-direction: column; align-items: center; gap: 10px; }
  .hud-eat { min-height: 46px; font-size: 24px; padding: 4px 14px 4px 10px; }
  .hud-eat-icon { font-size: 26px; }
}
.stat.eat .stat-icon { color: #e07a00; }
.stat.eat { background: #fff2b3; }
.hud-btn { width: 68px; height: 68px; min-width: 68px; min-height: 68px; background: #fff; box-shadow: 0 0 0 4px rgba(43, 35, 80, 0.55), 0 6px 0 4px rgba(43, 35, 80, 0.35), 0 10px 22px rgba(0, 0, 0, 0.3); }
.hud-board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hud-board li {
  display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.96); color: var(--ink);
  border-radius: 999px; padding: 3px 14px 3px 4px; font-size: 19px; font-weight: 900; min-width: 170px;
  box-shadow: 0 0 0 3px rgba(43, 35, 80, 0.45), 0 4px 10px rgba(0, 0, 0, 0.22);
}
.hud-board li.me { background: #fff2b3; box-shadow: 0 0 0 4px var(--sun), 0 0 0 6px rgba(43, 35, 80, 0.45), 0 4px 10px rgba(0, 0, 0, 0.22); }
.hud-board .rank { width: 28px; display: grid; place-items: center; font-size: 17px; }
.hud-board .rank > .ic { font-size: 28px; }
.hud-board .dot { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; }
.hud-board .name { flex: 1; white-space: nowrap; }
.hud-board .score { font-variant-numeric: tabular-nums; color: #463d78; }

.hud-pops { position: absolute; left: 0; right: 0; top: 40%; height: 0; }
.pop {
  position: absolute; transform: translateX(-50%);
  font-size: 34px; font-weight: 900; color: #fff;
  text-shadow: 0 3px 0 var(--purple), 0 0 12px rgba(43, 35, 80, 0.4);
  animation: pop-up 0.9s ease-out forwards;
}
.pop.big { font-size: 46px; text-shadow: 0 4px 0 var(--orange), 0 0 16px rgba(255, 140, 66, 0.5); }
@keyframes pop-up {
  0% { transform: translate(-50%, 0) scale(0.6); opacity: 0; }
  20% { transform: translate(-50%, -14px) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -80px) scale(1); opacity: 0; }
}
.hud-toast {
  position: absolute; left: 50%; top: 22%; transform: translate(-50%, 0);
  display: flex; align-items: center; gap: 0.2em;
  font-size: clamp(44px, 8vw, 72px); font-weight: 900; color: #fff;
  text-shadow: 0 5px 0 var(--orange), 0 0 24px rgba(255, 140, 66, 0.6);
  opacity: 0; pointer-events: none; white-space: nowrap;
}
.hud-toast.show { animation: toast 1.4s ease both; }
.hud-toast > .ic { font-size: 1.1em; color: var(--sun); filter: drop-shadow(0 5px 0 var(--orange)); }
.hud-toast > .ic-star path { stroke: var(--sun); }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, 20px) scale(0.5); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.15); }
  25% { transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -30px); }
}
.joy-ring {
  display: none; position: absolute; left: -70px; top: -70px; width: 140px; height: 140px;
  border-radius: 50%; border: 6px solid rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 3px rgba(43, 35, 80, 0.15);
}
.joy-knob {
  position: absolute; left: 35px; top: 35px; width: 58px; height: 58px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.95); box-shadow: 0 4px 10px rgba(43, 35, 80, 0.3);
}
/* Pointer Lock: virtual cursor around the player's hole (positioned by hud.js) */
.lock-aim { display: none; position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; }
.lock-aim.on { display: block; }
.lock-ring {
  position: absolute; left: calc(-1 * var(--r, 150px)); top: calc(-1 * var(--r, 150px));
  width: calc(2 * var(--r, 150px)); height: calc(2 * var(--r, 150px)); border-radius: 50%;
  border: 3px dashed rgba(255, 255, 255, 0.5); box-shadow: 0 0 0 1px rgba(43, 35, 80, 0.18);
  opacity: 0; transition: opacity 0.3s ease;
}
.lock-aim.edge .lock-ring { opacity: 1; }
.lock-line {
  position: absolute; left: 0; top: -4px; height: 8px; width: 0; border-radius: 4px; transform-origin: 0 50%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.85));
}
.lock-dot {
  position: absolute; left: -17px; top: -17px; width: 34px; height: 34px; border-radius: 50%;
  background: #fff; border: 6px solid var(--purple); box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(0, 0, 0, 0.4);
}
.lock-aim.idle .lock-dot { opacity: 0.8; }
.hud-debug {
  position: absolute; left: 12px; bottom: 12px; margin: 0; padding: 8px 12px;
  background: rgba(0, 0, 0, 0.6); color: #b8ffb8; font: 12px/1.4 ui-monospace, Menlo, monospace; border-radius: 8px;
}

/* ================================================================ responsive */
/* portrait (iPad 768×1024 etc.): results in one column */
@media (max-aspect-ratio: 1/1) {
  .results-panel { grid-template-columns: 1fr; grid-template-areas: 'main' 'side' 'buttons'; max-width: 640px; }
  .res-rank li { font-size: 22px; padding: 4px 14px 4px 8px; }
}
/* short landscape windows (Mac browser windows, iPad landscape with toolbars) */
@media (max-height: 700px) {
  .menu-title { font-size: 72px; }
  .menu-panel { padding-top: 16px; padding-bottom: 20px; }
  .picker-title { width: 76px; height: 76px; font-size: 48px; }
  .hero-ring { width: 72px; height: 72px; }
  .hero-name { font-size: 28px; }
  .btn.foot-play { width: 96px; height: 96px; min-width: 96px; font-size: 40px; }
  .picker-foot .btn.big-round { width: 84px; height: 84px; font-size: 40px; }
  .menu-card { width: 160px; height: 160px; border-radius: 38px; }
  .menu-ring { width: 124px; height: 124px; }
  .map-card-emoji { font-size: 70px; }
  .play-btn { width: 136px; height: 136px; min-width: 136px; font-size: 54px; }
  .res-medal { font-size: 78px; }
  .res-star { width: 76px; height: 76px; }
  .stat-num { font-size: 30px; }
  .res-rank li { font-size: 20px; padding: 3px 12px 3px 8px; }
  .results-panel { gap: 10px 22px; padding: 18px 24px; }
}
/* very short windows: everything a notch smaller, panels scroll if still needed */
@media (max-height: 560px) {
  .menu-title { font-size: 56px; }
  .menu-card { width: 132px; height: 132px; border-radius: 32px; }
  .menu-ring { width: 104px; height: 104px; }
  .map-card-emoji { font-size: 56px; }
  .map-card-name { font-size: 19px; }
  .play-btn { width: 116px; height: 116px; min-width: 116px; font-size: 46px; }
  .btn.round.sm { width: 62px; height: 62px; min-width: 62px; min-height: 62px; font-size: 28px; }
  .stars-pill { min-height: 58px; font-size: 26px; padding: 6px 16px 6px 12px; }
  .next-unlock { padding: 3px 10px 3px 14px; }
  .panel { gap: 12px; }
  .card-tag { width: 50px; height: 50px; font-size: 30px; left: -10px; bottom: -10px; }
}
/* narrow screens (phones, split view) */
@media (max-width: 640px) {
  .menu-grid { grid-template-columns: auto auto; grid-template-areas: 'play play' 'skin map'; }
  .menu-grid .play-btn { grid-area: play; justify-self: center; }
  .menu-grid .skin-card { grid-area: skin; }
  .menu-grid .map-card { grid-area: map; }
  .menu-card { width: 150px; height: 150px; }
  .menu-ring { width: 116px; height: 116px; }
  .map-card-emoji { font-size: 64px; }
  .panel { padding-left: 16px; padding-right: 16px; border-radius: 34px; }
  .picker-foot { gap: 16px; }
  .pill { font-size: 24px; padding: 6px 14px; min-height: 56px; }
  .hud-level-bar { width: 70px; }
  .hud-board li { font-size: 14px; min-width: 120px; }
  .hud-btn { width: 64px; height: 64px; min-width: 64px; min-height: 64px; }
  .stars-pill { font-size: 24px; padding: 8px 14px; }
  .skins-grid { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); }
  .pick-ring { width: 86px; height: 86px; }
  .hero-ring { width: 80px; height: 80px; }
  .hero-name { font-size: 26px; }
}
/* ================================================================ phones (Phase 10b) */
/* Rules: nothing under the notch / Dynamic Island / home indicator (.screen, .hud-top and the unlock
   overlay pad with the safe-area variables --sat/--sar/--sab/--sal from base.css), tap targets ≥ 56 px
   (main buttons 72+), no key button needs scrolling (only the picker grids scroll).
   Phone portrait = max-width 500px, phone landscape = max-height 500px.
   .menu-bottom (progress + tool rows) is display: contents except on landscape phones (one row there). */
.menu-bottom { display: contents; }

@media (max-width: 500px), (max-height: 500px) {
  .panel { border-radius: 30px; box-shadow: 0 0 0 5px var(--purple), 0 9px 0 5px #5d3fd6, 0 20px 44px 4px rgba(12, 6, 40, 0.5); }
  .btn.round.sm { width: 60px; height: 60px; min-width: 60px; min-height: 60px; font-size: 28px; }
  .tool-row { gap: 14px; }
  .card-tag { width: 46px; height: 46px; font-size: 27px; left: -8px; bottom: -8px; }
  .new-badge { width: 38px; height: 38px; font-size: 25px; top: -8px; right: -8px; }
  /* the next-unlock bar already shows the star count → no separate stars pill in the menu */
  .menu-progress .stars-pill { display: none; }
  .next-unlock { padding: 4px 10px 4px 12px; gap: 10px; }
  .next-gift { font-size: 36px; }
  .next-bar { width: 124px; height: 34px; }
  .next-text { font-size: 19px; }
  .next-text > .ic { font-size: 22px; }
  .next-item { width: 50px; height: 50px; }
  .next-ring { width: 48px; height: 48px; }
  .next-emoji { font-size: 36px; }
  .next-unlock.all { font-size: 26px; padding: 6px 18px; }
  .next-unlock .crown { font-size: 36px; }
  /* pickers: no palette / map badge, slim hero, the grid gets the room */
  .picker-panel { height: 100%; }
  .picker-title { display: none; }
  .picker-hero { gap: 10px; padding: 4px 18px 4px 4px; }
  .hero-ring { width: 58px; height: 58px; }
  .hero-name { font-size: 23px; }
  .picker-body { padding: 14px 4px 18px; border-radius: 24px; }
  .pick-grid { gap: 14px; padding: 0 6px; }
  .skins-grid { grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); }
  .pick-card { border-radius: 28px; padding: 10px 4px 8px; }
  .pick-ring { width: 74px; height: 74px; }
  .pick-name { font-size: 15px; }
  .pick-lock .lock-icon { width: 42px; height: 42px; font-size: 25px; margin-top: -22px; }
  .pick-lock .need { font-size: 17px; }
  .pick-lock .need > .ic { font-size: 21px; }
  .pick-card .check { width: 36px; height: 36px; font-size: 24px; top: -8px; right: -8px; }
  .maps-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 16px; }
  .map-pick { border-radius: 28px; }
  .map-pick-emoji { font-size: 56px; }
  .map-pick .pick-name { font-size: 17px; padding: 3px 10px; }
  .map-pick.locked .pick-lock .lock-icon { width: 50px; height: 50px; font-size: 30px; margin-top: -26px; }
  .map-pick.locked .pick-lock .need { font-size: 19px; }
  .picker-foot { gap: 14px; flex-wrap: nowrap; }
  .picker-foot .btn.big-round { width: 72px; height: 72px; min-width: 72px; font-size: 36px; }
  .btn.foot-play { width: 86px; height: 86px; min-width: 86px; font-size: 40px; }
  .stars-pill { min-height: 52px; font-size: 22px; padding: 4px 14px 4px 8px; gap: 4px; }
  .stars-pill .sp-star { font-size: 32px; }
  /* pause */
  .pause-panel { padding: 18px 24px; gap: 16px; }
  .pause-badge { width: 74px; height: 74px; font-size: 50px; }
  .pause-panel .play-btn { width: 120px; height: 120px; min-width: 120px; }
  .pause-panel .btn.big-round { width: 80px; height: 80px; font-size: 38px; }
  /* results */
  .res-medal { font-size: 60px; }
  .res-praise { font-size: 38px; }
  .res-stars { gap: 8px; }
  .res-star { width: 62px; height: 62px; }
  .res-bonus { gap: 6px; }
  .bonus-chip { font-size: 20px; padding: 3px 10px 3px 8px; gap: 3px; }
  .bonus-chip .b-icon { font-size: 26px; }
  .bonus-chip .b-plus > .ic { font-size: 24px; }
  .res-stats { gap: 8px; }
  .stat { padding: 4px 12px 3px; border-radius: 18px; column-gap: 5px; }
  .stat-icon { font-size: 28px; }
  .stat-num { font-size: 24px; }
  .stat-label { font-size: 12px; }
  .hole-icon { width: 32px; height: 19px; box-shadow: 0 0 0 4px var(--sun); }
  .res-rank { gap: 5px; }
  .res-rank li { font-size: 17px; padding: 2px 10px 2px 6px; gap: 6px; border-radius: 16px; }
  .res-rank li.me { transform: none; }
  .res-rank .rk { width: 28px; font-size: 26px; }
  .res-rank .rk:not(:has(.ic)) { font-size: 17px; }
  .rk-ring { width: 26px; height: 26px; }
  .res-buttons .play-btn { width: 104px; height: 104px; min-width: 104px; }
  .res-buttons .btn.big-round { width: 76px; height: 76px; font-size: 36px; }
  /* "Nově odemčeno!" */
  .unlock-overlay { gap: 12px; padding: max(12px, var(--sat)) max(12px, var(--sar)) max(12px, var(--sab)) max(12px, var(--sal)); }
  .unlock-content { gap: 14px; }
  .unlock-title { font-size: 30px; gap: 8px; }
  .gift { font-size: 130px; }
  .unlock-items, .unlock-items.many { gap: 14px; }
  .unlock-card, .unlock-items.many .unlock-card { width: 136px; min-height: 0; border-radius: 30px; padding: 10px 8px; gap: 4px; }
  .unlock-ring, .unlock-items.many .unlock-ring { width: 86px; height: 86px; }
  .unlock-emoji, .unlock-items.many .unlock-emoji { font-size: 66px; }
  .unlock-name, .unlock-items.many .unlock-name { font-size: 18px; padding: 2px 10px; }
  .unlock-card .check { width: 40px; height: 40px; font-size: 26px; }
  .unlock-content .btn.big { min-height: 84px; min-width: 132px; font-size: 52px; }
  /* many new things at once (fresh profile): three small cards per row, the OK button stays on screen */
  .unlock-items.many .unlock-card { width: 100px; border-radius: 26px; padding: 8px 4px; }
  .unlock-items.many .unlock-ring { width: 62px; height: 62px; }
  .unlock-items.many .unlock-emoji { font-size: 48px; }
  .unlock-items.many .unlock-name { font-size: 14px; padding: 2px 6px; }
  /* HUD: compact pills, 3-row leaderboard without names (hud.js), pause ≥ 56 px */
  .hud-top { padding: max(8px, var(--sat)) max(10px, var(--sar)) 0 max(10px, var(--sal)); gap: 8px; }
  .hud-left, .hud-center { gap: 8px; }
  .hud-right { gap: 10px; }
  .hud .pill { font-size: 22px; min-height: 46px; padding: 4px 12px; gap: 6px;
    box-shadow: 0 0 0 3px rgba(43, 35, 80, 0.55), 0 4px 0 3px rgba(43, 35, 80, 0.35), 0 8px 16px rgba(0, 0, 0, 0.25); }
  .hud-time { min-width: 0; }
  .hud-time-icon { font-size: 26px; }
  .hud-level { padding-left: 6px; gap: 7px; }
  .hud-level-icon { width: 30px; height: 30px; }
  .hud-level-bar { width: 60px; height: 15px; }
  .hud .hud-eat { min-height: 40px; font-size: 20px; padding: 3px 12px 3px 8px; }
  .hud-eat-icon { font-size: 24px; }
  .btn.round.hud-btn { width: 58px; height: 58px; min-width: 58px; min-height: 58px;
    box-shadow: 0 0 0 3px rgba(43, 35, 80, 0.55), 0 4px 0 3px rgba(43, 35, 80, 0.35), 0 8px 16px rgba(0, 0, 0, 0.25); }
  .hud-board { gap: 4px; }
  .hud-board li { min-width: 0; font-size: 15px; padding: 2px 10px 2px 2px; gap: 5px; }
  .hud-board .name { display: none; }
  .hud-board .rank { width: 22px; font-size: 14px; }
  .hud-board .rank > .ic { font-size: 22px; }
  .hud-board .dot { width: 22px; height: 22px; }
  .hud-pops { top: 36%; }
  .pop { font-size: 28px; }
  .pop.big { font-size: 36px; }
  .hud-toast { font-size: 48px; }
  .joy-ring { left: -60px; top: -60px; width: 120px; height: 120px; border-width: 5px; }
  .joy-knob { left: 30px; top: 30px; width: 50px; height: 50px; }
}

/* phone portrait */
@media (max-width: 500px) {
  .screen { padding: max(10px, var(--sat)) max(10px, var(--sar)) max(10px, var(--sab)) max(10px, var(--sal)); }
  .panel { padding: 14px 12px 16px; gap: 14px; }
  .menu-panel { gap: 14px; padding: 12px 14px 18px; }
  .menu-title { font-size: 50px; gap: 10px; }
  .menu-grid { gap: 14px 20px; }
  .menu-card { width: 134px; height: 134px; border-radius: 34px; }
  .menu-ring { width: 104px; height: 104px; }
  .map-card-emoji { font-size: 56px; }
  .map-card-name { font-size: 18px; padding: 3px 12px; }
  .play-btn { width: 124px; height: 124px; min-width: 124px; }
  .picker-panel { padding: 12px 10px 14px; gap: 12px; }
  .skins-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px; }
  .skins-grid .pick-ring { width: 64px; height: 64px; }
  .results-panel { gap: 10px; padding: 14px 12px 16px; }
  .res-buttons { gap: 16px; flex-wrap: nowrap; }
  .hud [data-action="mute"] { display: none; } /* sound is in the pause menu; the top bar needs the room */
}
/* short phone portrait (SE in Safari): smaller title, the ranking moves out of the results (the medal tells the place) */
@media (max-width: 500px) and (max-height: 700px) {
  .menu-title { font-size: 42px; }
  .menu-card { width: 124px; height: 124px; }
  .menu-ring { width: 96px; height: 96px; }
  .play-btn { width: 112px; height: 112px; min-width: 112px; }
  .res-side { display: none; }
}

/* phone landscape */
@media (max-height: 500px) {
  .screen { padding: max(8px, var(--sat)) max(12px, var(--sar)) max(8px, var(--sab)) max(12px, var(--sal)); }
  .panel { padding: 12px 22px 14px; gap: 12px; }
  .menu-panel { gap: 10px; padding: 10px 26px 14px; }
  .menu-title { font-size: 42px; gap: 10px; }
  .menu-grid { gap: 30px; }
  .menu-card { width: 118px; height: 118px; border-radius: 30px; }
  .menu-ring { width: 90px; height: 90px; }
  .map-card-emoji { font-size: 48px; }
  .map-card-name { font-size: 16px; padding: 2px 10px; }
  .play-btn { width: 112px; height: 112px; min-width: 112px; }
  .menu-bottom { display: flex; align-items: center; justify-content: center; gap: 18px; }
  .menu-bottom .row { flex-wrap: nowrap; }
  /* pickers: hero + buttons in a column on the left, the grid fills the rest */
  .picker-panel {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto;
    grid-template-areas: 'head body' 'foot body'; gap: 12px 14px; padding: 12px; align-items: center;
  }
  .picker-head { grid-area: head; flex-direction: column; }
  .picker-hero { flex-direction: column; border-radius: 30px; padding: 10px 12px; gap: 4px; max-width: 170px; }
  .hero-ring { width: 64px; height: 64px; }
  .hero-name { font-size: 19px; white-space: normal; line-height: 1.1; }
  .picker-body { grid-area: body; align-self: stretch; min-height: 0; }
  .picker-foot { grid-area: foot; gap: 12px; }
  .picker-foot .stars-pill { display: none; }
  .picker-foot .btn.big-round { width: 66px; height: 66px; min-width: 66px; font-size: 32px; }
  .btn.foot-play { width: 80px; height: 80px; min-width: 80px; font-size: 38px; }
  /* pause: one row – badge · home · play · sound buttons */
  .pause-panel { flex-direction: row; padding: 16px 24px; gap: 20px; }
  .pause-panel .tool-row { flex-direction: column; gap: 12px; }
  /* results: three columns – score · ranking · buttons */
  .results-panel {
    width: min(100%, 860px); grid-template-columns: 1.25fr 1fr auto; grid-template-areas: 'main side buttons';
    gap: 10px 16px; padding: 12px 16px;
  }
  .res-main { gap: 8px; }
  .res-head { gap: 8px; }
  .res-medal { font-size: 52px; }
  .res-praise { font-size: 34px; }
  .res-star { width: 54px; height: 54px; }
  .res-buttons { flex-direction: column; gap: 12px; flex-wrap: nowrap; }
  .res-buttons .play-btn { width: 96px; height: 96px; min-width: 96px; }
  .res-buttons .btn.big-round { width: 68px; height: 68px; font-size: 32px; }
  .res-rank li { font-size: 16px; }
  /* unlock reveal: the cards in one row */
  .unlock-title { font-size: 28px; }
  .gift { font-size: 110px; }
  .unlock-items, .unlock-items.many { flex-wrap: nowrap; }
  .unlock-card { width: 124px; }
  .unlock-ring { width: 74px; height: 74px; }
  .unlock-emoji { font-size: 56px; }
  .unlock-content .btn.big { min-height: 72px; }
}
@media (max-height: 360px) {
  .menu-title { font-size: 36px; }
  .menu-card { width: 108px; height: 108px; }
  .menu-ring { width: 82px; height: 82px; }
  .play-btn { width: 104px; height: 104px; min-width: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  .spin, .play-btn, .foot-play, .gift, .unlock-rays, .unlock-card, .new-badge { animation: none !important; }
}
