@font-face {
  font-family: "Fredoka";
  src: url("../fonts/Fredoka/Fredoka-VariableFont_wdth,wght.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter/Inter-VariableFont_opsz,wght-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-024F, U+1E00-1EFF, U+2000-206F, U+20A0-20CF, U+2100-214F, U+2190-21FF, U+2200-22FF, U+25A0-27BF, U+FEFF;
}

:root {
  color-scheme: dark;
  font-family: "Inter", system-ui, sans-serif;
  --ink: #fff;
  --muted: #c7c3dc;
  --panel: #211a43;
  --outline: rgba(255, 255, 255, 0.14);
  --accent: #ffdc5e;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.overlay::-webkit-scrollbar { display: none; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(117, 82, 211, 0.3), transparent 32rem),
    radial-gradient(circle at 82% 76%, rgba(35, 170, 233, 0.2), transparent 30rem),
    #100d24;
  overscroll-behavior: none;
}

button, a { font: inherit; }
button { color: inherit; }

.game-shell {
  width: min(100%, 1500px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) clamp(12px, 2.5vw, 36px) max(14px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr;
  gap: clamp(10px, 1.5vw, 18px);
}

.game-header {
  min-height: 54px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.back-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}
.back-link:hover { color: #fff; }
.back-link span:first-child { font-size: 1.3rem; }
.back-link-logo {
  display: block;
  width: auto;
  height: 46px;
  flex: 0 0 auto;
}

.game-brand { text-align: center; }
.game-kicker {
  display: block;
  color: #a7a0cc;
  font-size: clamp(0.6rem, 1.4vw, 0.74rem);
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.game-brand h1 {
  margin: 0;
  font-family: "Fredoka", sans-serif;
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  line-height: 1;
}

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--outline);
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.header-icon-button:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.11); }
.header-icon-button:disabled { opacity: .38; cursor: not-allowed; transform: none; border-color: var(--outline); background: rgba(255,255,255,0.04); }
.header-icon-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.header-icon-button img { display: block; width: 23px; height: 23px; margin: auto; filter: invert(91%) sepia(7%) saturate(483%) hue-rotate(207deg); }
.sound-button[aria-pressed="false"] img { opacity: .58; }

.game-card {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--outline);
  border-radius: clamp(20px, 3vw, 34px);
  background: #171232;
  box-shadow: 0 26px 70px rgba(0,0,0,0.35);
}

.hud {
  position: absolute;
  z-index: 30;
  top: clamp(10px, 2vw, 20px);
  left: 50%;
  width: min(calc(100% - 24px), 540px);
  min-height: 62px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr minmax(110px, 1.35fr) 1fr;
  align-items: center;
  padding: 8px 15px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 18px;
  background: rgba(21, 16, 50, 0.84);
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
  backdrop-filter: blur(12px);
}
.hud-item { display: flex; flex-direction: column; }
.hud-item-right { align-items: flex-end; }
.hud-label { color: var(--muted); font-size: .67rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.hud-best-label { display: inline-flex; align-items: center; gap: 4px; }
.hud-best-label img { width: 13px; height: 13px; filter: invert(86%) sepia(8%) saturate(563%) hue-rotate(207deg); }
.hud-item strong { font-family: "Fredoka"; font-size: 1.28rem; }
.hud-muted { color: #8983aa; }
.timer-wrap { text-align: center; }
.timer { display: block; font-family: "Fredoka"; font-size: clamp(1.65rem, 4vw, 2.25rem); line-height: 1; font-variant-numeric: tabular-nums; }
.timer-track { height: 4px; margin-top: 5px; overflow: hidden; border-radius: 10px; background: rgba(255,255,255,.12); }
.timer-track span { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left; }
.timer-wrap.urgent .timer { color: #ff6e84; animation: timer-pulse .55s infinite alternate; }
.timer-wrap.urgent .timer-track span { background: #ff5973; }

.arena {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: min(760px, calc(100svh - 105px));
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(123,85,244,.22) 0 22%, transparent 54%),
    radial-gradient(circle at 50% 48%, #2e245e 0 1px, transparent 2px) 0 0 / 24px 24px,
    linear-gradient(160deg, #201947, #110d2a 72%);
}
.arena::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .32;
  background: linear-gradient(110deg, transparent 0 46%, rgba(255,255,255,.05) 48% 50%, transparent 52%);
}
.arena-glow {
  position: absolute;
  left: 50%; top: 52%;
  width: 82%; height: 78%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(164,128,255,.18);
  box-shadow: 0 0 90px rgba(111,69,236,.25), inset 0 0 60px rgba(111,69,236,.14);
}

.platform {
  --platform-color: #fff;
  position: absolute;
  z-index: 4;
  width: clamp(136px, 19.5%, 270px);
  aspect-ratio: 1.26;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: filter .2s, opacity .25s;
}
.platform-shadow, .platform-surface {
  position: absolute;
  inset: 0;
  display: block;
  clip-path: polygon(17% 3%, 82% 3%, 99% 34%, 91% 90%, 49% 100%, 7% 89%, 0 35%);
}
.platform-shadow { transform: translateY(10%); background: color-mix(in srgb, var(--platform-color) 35%, #15102e); filter: brightness(.42); }
.platform-surface {
  overflow: hidden;
  border: clamp(3px, .4vw, 6px) solid rgba(255,255,255,.25);
  background:
    radial-gradient(circle at 50% 24%, rgba(255,255,255,.42), transparent 50%),
    var(--platform-color);
  box-shadow: inset 0 -18px 35px rgba(35,25,50,.14);
  transition: transform .18s ease, filter .25s, opacity .25s;
}
.platform:hover .platform-surface, .platform:focus-visible .platform-surface { transform: translateY(-5px); filter: brightness(1.06); }
.platform:focus-visible { outline: 4px solid #fff; outline-offset: 4px; border-radius: 34%; }
.platform.selected .platform-surface { transform: translateY(-7px); filter: brightness(1.12); box-shadow: inset 0 -18px 35px rgba(35,25,50,.14), 0 0 0 5px #fff, 0 0 30px var(--platform-color); }
.platform.correct .platform-surface { box-shadow: 0 0 0 6px #7affaa, 0 0 40px #40ed7f; }
.platform.unsafe { pointer-events: none; }
.platform.unsafe .platform-surface { animation: island-fall .72s cubic-bezier(.55,.05,.78,.5) forwards; }
.platform.unsafe .platform-shadow { animation: island-shadow-fall .55s ease-in forwards; }
.platform.is-resetting .platform-surface, .platform.is-resetting .platform-shadow { animation: island-return .45s cubic-bezier(.2,.8,.2,1) both; }
.platform:disabled { cursor: default; }

.platform-art {
  position: absolute;
  left: 50%; top: 46%;
  width: 76%; height: 87%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  filter: drop-shadow(0 8px 7px rgba(30,20,45,.24));
  pointer-events: none;
  user-select: none;
}
.platform-winter { --platform-color: #e9f2f6; left: 40.25%; top: 13%; }
.platform-forest { --platform-color: #6ef08f; left: 17%; top: 18%; }
.platform-fall { --platform-color: #e84f5f; right: 17%; top: 18%; }
.platform-desert { --platform-color: #fec782; left: 21%; bottom: 6%; }
.platform-beach { --platform-color: #2bcafa; right: 21%; bottom: 6%; }

.host-zone {
  position: absolute;
  z-index: 12;
  isolation: isolate;
  left: 91%; top: 82%;
  width: clamp(85px, 10%, 140px);
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.host-zone:has(.host.evil)::before {
  content: none;
}
.host {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: clamp(75px, 10vw, 130px);
  object-fit: contain;
  filter:
    drop-shadow(2px 0 0 #fff)
    drop-shadow(-2px 0 0 #fff)
    drop-shadow(0 2px 0 #fff)
    drop-shadow(0 -2px 0 #fff)
    drop-shadow(1.5px 1.5px 0 #fff)
    drop-shadow(-1.5px 1.5px 0 #fff)
    drop-shadow(1.5px -1.5px 0 #fff)
    drop-shadow(-1.5px -1.5px 0 #fff)
    drop-shadow(0 8px 1px rgba(18,12,38,.58));
  animation: host-float 2.1s ease-in-out infinite alternate;
}
.host.evil {
  height: clamp(100px, 13vw, 175px);
  filter:
    drop-shadow(2.5px 0 0 #fff)
    drop-shadow(-2.5px 0 0 #fff)
    drop-shadow(0 2.5px 0 #fff)
    drop-shadow(0 -2.5px 0 #fff)
    drop-shadow(2px 2px 0 #fff)
    drop-shadow(-2px 2px 0 #fff)
    drop-shadow(2px -2px 0 #fff)
    drop-shadow(-2px -2px 0 #fff)
    drop-shadow(0 9px 1px rgba(18,12,38,.62));
}
.callout {
  --callout-border: #211b31;
  position: absolute;
  z-index: 2;
  left: 50%; bottom: calc(100% + 16px);
  transform: translateX(-50%);
  color: #201936;
  filter: drop-shadow(0 10px 11px rgba(0,0,0,.25));
}
.callout::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: -13px;
  width: 24px;
  height: 18px;
  transform: translateX(-50%);
  clip-path: polygon(0 0, 100% 0, 58% 90%, 50% 100%, 42% 90%);
  background: #fff;
  pointer-events: none;
}
.callout-icons {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 7px;
  padding: 8px;
  border-radius: 17px;
  background: #fff;
}
.callout-icon {
  display: grid;
  place-items: center;
  width: clamp(42px, 3.7vw, 50px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid var(--callout-border);
  border-radius: 11px;
  background: var(--icon-color, #f3f1f8);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.42);
  isolation: isolate;
}
.callout-icon img {
  display: block;
  width: 76%;
  height: 76%;
  max-width: 76%;
  max-height: 76%;
  object-fit: contain;
  object-position: center;
}

.player {
  position: absolute;
  z-index: 16;
  width: clamp(130px, 17%, 255px);
  height: clamp(192px, 29%, 365px);
  transform: translate(-50%, -94%);
  transition: left .4s cubic-bezier(.2,.72,.25,1), top .4s cubic-bezier(.2,.72,.25,1);
  pointer-events: none;
}
.player img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 4px rgba(0,0,0,.35)); }
.player-home { position: absolute; z-index: 7; left: 50%; top: 88%; width: clamp(142px, 14%, 208px); aspect-ratio: 2.55; transform: translate(-50%, -50%); border: 3px solid rgba(255,255,255,.72); border-radius: 50%; background: rgba(255,255,255,.15); box-shadow: 0 8px 22px rgba(0,0,0,.22), inset 0 0 18px rgba(255,255,255,.08); pointer-events: none; }
.player.hopping img { animation: player-hop .4s ease; }
.player.falling { transition: none; animation: player-fall .78s ease-in forwards; }

.round-message {
  position: absolute;
  z-index: 35;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(.8);
  font-family: "Fredoka";
  font-size: clamp(2.4rem, 8vw, 5rem);
  font-weight: 700;
  text-align: center;
  text-shadow: 0 7px 0 rgba(20,14,42,.45), 0 0 30px rgba(20,14,42,.8);
  opacity: 0;
  pointer-events: none;
}
.round-message.show { animation: message-pop .75s ease both; }
.round-message.good { color: #86ffab; }
.round-message.bad { color: #ff7186; }

.overlay {
  position: absolute;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 36px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: rgba(11,8,29,.76);
  backdrop-filter: blur(13px);
}
.overlay[hidden], .hud[hidden], .player[hidden], .callout[hidden] { display: none; }
#start-overlay {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}
.overlay-panel {
  width: min(100%, 570px);
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: clamp(22px, 3vw, 32px);
  background: linear-gradient(160deg, rgba(53,42,103,.97), rgba(27,21,58,.98));
  box-shadow: 0 26px 70px rgba(0,0,0,.42);
  text-align: center;
}
.info-overlay {
  z-index: 70;
  padding: 12px;
  overflow: hidden;
  overscroll-behavior: none;
  background: rgba(9,7,27,.83);
}
.info-panel {
  position: relative;
  width: min(100%, 600px);
  max-height: calc(100% - 4px);
  padding: clamp(20px, 2.6vw, 28px);
  border-color: rgba(158,143,218,.28);
  background: #19152f;
  box-shadow: 0 30px 80px rgba(0,0,0,.52), inset 0 1px 0 rgba(255,255,255,.08);
  text-align: center;
  animation: result-panel-in .38s cubic-bezier(.2,.8,.2,1.08) both;
}
.info-close {
  position: absolute;
  top: 15px; right: 15px;
  width: 35px; height: 35px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  color: #d9d5ea;
  background: rgba(255,255,255,.055);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}
.info-close:hover { color: #fff; background: rgba(255,255,255,.11); }
.info-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.info-kicker img { width: 18px; height: 18px; filter: invert(87%) sepia(91%) saturate(686%) hue-rotate(328deg) brightness(105%); }
.info-panel h2 { margin: 6px 0 5px; font-size: clamp(2rem, 4vw, 2.6rem); line-height: .94; }
.info-panel .info-rule-lead {
  max-width: none;
  margin: 14px 0 7px;
  color: #aaa3c0;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .1em;
  line-height: 1;
  text-align: left;
  text-transform: uppercase;
}
.info-decision-board {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  background: rgba(255,255,255,.025);
}
.info-decision {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 70px;
  padding: 8px 13px;
  text-align: left;
}
.info-decision + .info-decision { border-top: 1px solid rgba(255,255,255,.1); }
.info-decision-follow { background: linear-gradient(90deg, rgba(56,211,153,.13), transparent 62%); }
.info-decision-avoid { background: linear-gradient(90deg, rgba(255,91,122,.13), transparent 62%); }
.info-host-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 49px;
  padding: 4px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 13px;
  background: #dfe8ff;
  box-shadow: inset 0 1px 0 #fff, 0 5px 12px rgba(0,0,0,.18);
}
.info-decision-avoid .info-host-avatar { background: #ffe2e9; }
.info-host-avatar img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 3px rgba(20,14,40,.22)); }
.info-decision-copy { min-width: 0; }
.info-decision-copy small { display: block; margin-bottom: 3px; color: #9e97b6; font-size: .67rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.info-decision-copy strong { display: block; color: #fff; font-size: .92rem; }
.info-command { min-width: 106px; padding: 7px 10px; border-radius: 999px; text-align: center; font-size: .63rem; font-weight: 950; letter-spacing: .07em; text-transform: uppercase; }
.info-decision-follow .info-command { color: #122e27; background: #7ef1c3; }
.info-decision-avoid .info-command { color: #3a1723; background: #ff9eb2; }
.info-footer-notes { display: flex; justify-content: center; gap: 28px; margin-top: 10px; color: #c7c2d8; font-size: .7rem; font-weight: 750; }
.info-footer-notes span { display: inline-flex; align-items: center; gap: 7px; }
.info-footer-notes img { width: 18px; height: 18px; object-fit: contain; filter: brightness(0) invert(1); opacity: .86; }
.info-got-it { display: flex; width: min(100%, 200px); min-height: 44px; margin: 11px auto 0; box-shadow: none; }
.info-got-it:active { transform: scale(.98); box-shadow: none; }
.start-panel { position: relative; padding-top: clamp(62px, 8vw, 78px); }
.start-host { position: absolute; left: 50%; top: 0; width: clamp(90px, 20%, 125px); height: 90px; transform: translate(-50%, -39%); object-fit: contain; filter: drop-shadow(0 10px 14px rgba(0,0,0,.3)); }
.eyebrow { display: block; color: #bcb4e6; font-size: .7rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.overlay h2 { margin: 5px 0 10px; font-family: "Fredoka"; font-size: clamp(2rem, 6vw, 3rem); line-height: 1; }
.overlay p { max-width: 470px; margin: 0 auto 21px; color: #d2cee4; font-size: clamp(.85rem, 2vw, 1rem); line-height: 1.55; }
.character-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(7px, 1.5vw, 11px); margin: 0 0 22px; }
.character-option { position: relative; overflow: hidden; min-height: clamp(106px, 17vw, 142px); padding: 8px 6px 9px; border: 2px solid transparent; border-radius: 17px; color: #d8d4e9; background: rgba(255,255,255,.06); cursor: pointer; font-size: clamp(.7rem, 1.7vw, .83rem); font-weight: 800; transition: transform .17s, border-color .17s, background .17s; }
.character-option:hover { transform: translateY(-2px); background: rgba(255,255,255,.1); }
.character-option.selected { border-color: var(--accent); color: #fff; background: rgba(255,220,94,.13); }
.character-portrait { display: grid; place-items: center; height: clamp(82px, 14vw, 116px); }
.character-portrait img { max-width: 82%; height: 100%; object-fit: contain; filter: drop-shadow(0 7px 5px rgba(0,0,0,.25)); }
.character-name {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  min-width: max-content;
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  color: #fff;
  background: rgba(21,16,50,.88);
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
  line-height: 1;
  pointer-events: none;
  backdrop-filter: blur(6px);
}
.character-option.selected .character-name { color: #2b213a; background: var(--accent); border-color: rgba(255,255,255,.45); }
.primary-button, .secondary-button { width: min(100%, 310px); min-height: 50px; border-radius: 99px; cursor: pointer; font-weight: 900; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; color: #251c36; background: var(--accent); box-shadow: 0 8px 0 #c5982f, 0 14px 26px rgba(0,0,0,.22); }
.primary-button img { width: 21px; height: 21px; object-fit: contain; }
#start-button { gap: 10px; font-size: clamp(1.05rem, 2.2vw, 1.18rem); }
#start-button img { width: 27px; height: 27px; }
.primary-button:hover { filter: brightness(1.06); }
.primary-button:active { transform: translateY(4px); box-shadow: 0 4px 0 #c5982f; }
.secondary-button { margin-top: 14px; border: 1px solid rgba(255,255,255,.2); color: #ded9ee; background: transparent; }
.best-note { margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 6px; color: #aaa4c4; font-size: .76rem; font-weight: 700; }
.best-note img { width: 17px; height: 17px; opacity: .75; filter: invert(72%) sepia(9%) saturate(606%) hue-rotate(207deg); }

.end-overlay {
  isolation: isolate;
  background:
    linear-gradient(135deg, rgba(125,92,255,.15), transparent 48%),
    rgba(9,6,27,.88);
}
.end-overlay.is-win { background: linear-gradient(135deg, rgba(255,215,82,.12), transparent 48%), rgba(9,8,26,.9); }
.end-overlay.is-loss { background: linear-gradient(135deg, rgba(255,91,122,.12), transparent 48%), rgba(9,6,27,.91); }
.end-panel {
  --result-bright: #ff6f8d;
  --result-soft: #ffc3d0;
  --result-deep: #321b50;
  position: relative;
  z-index: 2;
  isolation: isolate;
  overflow: hidden;
  width: min(100%, 660px);
  padding: clamp(24px, 4vw, 42px);
  border: 2px solid rgba(255,255,255,.18);
  background:
    linear-gradient(125deg, rgba(255,111,141,.13), transparent 38%),
    linear-gradient(155deg, rgba(58,32,89,.99), rgba(24,18,59,.99));
  box-shadow: 0 30px 90px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.13);
  animation: result-panel-in .58s cubic-bezier(.18,.86,.26,1.18) both;
}
.end-overlay.is-win .end-panel {
  --result-bright: #ffdc5e;
  --result-soft: #fff2a9;
  --result-deep: #153f55;
  border-color: rgba(255,231,130,.35);
  background:
    linear-gradient(125deg, rgba(255,221,94,.14), transparent 38%),
    linear-gradient(155deg, rgba(31,76,94,.99), rgba(24,24,64,.99));
}
.result-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  padding: 6px 13px;
  border: 1px solid color-mix(in srgb, var(--result-bright) 42%, transparent);
  border-radius: 999px;
  color: var(--result-soft);
  background: color-mix(in srgb, var(--result-bright) 12%, transparent);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.result-stage {
  position: relative;
  width: clamp(138px, 24vw, 170px);
  height: clamp(116px, 18vw, 138px);
  margin: 13px auto 14px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 2px solid color-mix(in srgb, var(--result-bright) 28%, transparent);
}
.result-character {
  position: relative;
  z-index: 1;
  width: 76%;
  height: 92%;
  max-height: 128px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 12px 10px rgba(0,0,0,.34));
  animation: result-character-in .7s .08s cubic-bezier(.2,.8,.2,1.2) both;
}
.is-loss .result-character { filter: drop-shadow(0 12px 10px rgba(0,0,0,.34)) saturate(.78); transform: rotate(-3deg); }
.end-panel h2 {
  position: relative;
  z-index: 2;
  margin: 0 0 8px;
  color: var(--result-soft);
  font-size: clamp(2.7rem, 7vw, 4.3rem);
  letter-spacing: -.035em;
  text-shadow: 0 3px 0 color-mix(in srgb, var(--result-deep) 68%, #000), 0 0 24px color-mix(in srgb, var(--result-bright) 18%, transparent);
}
.end-panel > p { max-width: 440px; margin-bottom: 18px; color: rgba(255,255,255,.77); }
.result-score {
  width: min(100%, 330px);
  min-height: 78px;
  margin: 0 auto 22px;
  padding: 12px 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--result-bright) 27%, rgba(255,255,255,.12));
  border-radius: 20px;
  background: rgba(10,8,30,.3);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  text-align: left;
}
.result-score-label { color: rgba(255,255,255,.67); font-size: .72rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.result-score-value { display: flex; align-items: baseline; gap: 4px; color: var(--result-soft); }
.result-score strong { font-family: "Fredoka"; font-size: 2.8rem; line-height: .8; }
.result-score small { color: rgba(255,255,255,.5); font-size: .86rem; font-weight: 900; }
.result-actions { width: min(100%, 470px); margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.result-actions .primary-button,
.result-actions .secondary-button { width: 100%; height: 52px; min-height: 52px; margin: 0; display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.result-actions .primary-button { color: #231b35; background: var(--result-bright); box-shadow: none; }
.result-actions .primary-button:active { transform: scale(.98); box-shadow: none; }
.result-actions .secondary-button { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.055); }
.result-actions img { width: 21px; height: 21px; object-fit: contain; }
.result-actions .secondary-button img { filter: invert(1); opacity: .78; }
.result-confetti { position: absolute; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; }
.result-confetti i {
  --confetti-color: #ffdc5e;
  position: absolute;
  left: var(--confetti-x);
  top: -28px;
  width: 10px;
  height: 18px;
  border-radius: 3px;
  background: var(--confetti-color);
  opacity: 0;
  animation: confetti-fall var(--confetti-speed) var(--confetti-delay) cubic-bezier(.2,.7,.35,1) forwards;
}

@keyframes host-float { to { transform: translateY(-5px); } }
@keyframes timer-pulse { to { transform: scale(1.08); } }
@keyframes player-hop { 45% { transform: translateY(-45%) scale(1.06); } }
@keyframes player-fall { to { transform: translate(-50%, 160%) rotate(18deg) scale(.7); opacity: 0; } }
@keyframes message-pop { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.6); } 22%,70% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 100% { opacity: 0; transform: translate(-50%,-55%) scale(1.08); } }
@keyframes island-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 25% { transform: translateY(3%) rotate(-1deg); } 100% { transform: translateY(120%) rotate(5deg) scale(.78); opacity: 0; } }
@keyframes island-shadow-fall { to { transform: translateY(80%) scale(.7); opacity: 0; } }
@keyframes island-return { from { transform: translateY(90%) scale(.8); opacity: 0; } to { opacity: 1; } }
@keyframes result-panel-in { from { opacity: 0; transform: translateY(24px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes result-character-in { from { opacity: 0; transform: translateY(25px) scale(.72) rotate(-5deg); } to { opacity: 1; transform: none; } }
@keyframes confetti-fall {
  0% { opacity: 0; transform: translate3d(0,-25px,0) rotate(0); }
  10% { opacity: 1; }
  100% { opacity: 1; transform: translate3d(var(--confetti-drift), calc(100svh + 70px), 0) rotate(var(--confetti-spin)); }
}

@media (max-width: 720px) {
  .game-shell { padding-inline: 0; padding-block: max(8px, env(safe-area-inset-top)) 0; gap: 7px; }
  .game-header { min-height: 48px; padding-inline: 12px; }
  .header-actions { gap: 6px; }
  .header-icon-button { width: 38px; height: 38px; }
  .header-icon-button img { width: 21px; height: 21px; }
  .back-link-logo { height: 40px; }
  .back-link span:last-child, .game-kicker { display: none; }
  .game-card { border-radius: 22px 22px 0 0; border-inline: 0; border-bottom: 0; }
  .arena { min-height: calc(100svh - 63px); }
  .hud { top: 9px; min-height: 55px; padding-block: 6px; border-radius: 15px; }
  .platform { width: clamp(140px, 39%, 220px); }
  .platform-winter { left: 30.5%; top: 13%; }
  .platform-forest { left: 1%; top: 32%; }
  .platform-fall { right: 1%; top: 32%; }
  .platform-desert { left: 4%; top: 59%; bottom: auto; }
  .platform-beach { right: 4%; top: 59%; bottom: auto; }
  .host-zone { left: 50%; top: 92%; width: clamp(90px, 22%, 124px); }
  .host { height: clamp(90px, 24vw, 132px); }
  .host.evil { height: clamp(120px, 31vw, 170px); }
  .callout::after { bottom: -15px; width: 28px; height: 21px; }
  .callout-icons { gap: 9px; padding: 10px; border-radius: 20px; }
  .callout-icon { width: 48px; border-radius: 13px; }
  .platform-art { width: 82%; height: 91%; }
  .player { width: clamp(84px, 22%, 128px); height: clamp(116px, 28%, 170px); transform: translate(-50%, -88%); }
  .player-home { top: 56.5%; width: clamp(104px, 27%, 138px); }
  .overlay { align-items: center; padding: 28px 12px 14px; }
  .overlay-panel { padding: 23px 16px; }
  .start-panel { padding-top: 50px; }
  .info-panel { width: min(calc(100% - 6px), 520px); padding: 20px 13px 17px; border-radius: 24px; }
  .info-close { top: 10px; right: 10px; width: 32px; height: 32px; }
  .info-panel h2 { margin-block: 5px; font-size: clamp(1.75rem, 8vw, 2.3rem); }
  .info-panel .info-rule-lead { margin-top: 10px; }
  .info-decision { grid-template-columns: 44px 1fr; gap: 9px; min-height: 70px; padding: 8px 10px; }
  .info-host-avatar { grid-row: span 2; width: 44px; height: 46px; }
  .info-decision-copy strong { font-size: .78rem; }
  .info-decision-copy small { font-size: .57rem; }
  .info-command { grid-column: 2; justify-self: start; min-width: 0; padding: 5px 9px; font-size: .55rem; }
  .info-footer-notes { flex-wrap: wrap; gap: 6px 16px; margin-top: 11px; font-size: .63rem; }
  .info-footer-notes img { width: 15px; height: 15px; }
  .info-got-it { min-height: 46px; margin-top: 13px; }
  .end-panel { width: min(100%, 510px); padding: 22px 16px 24px; border-radius: 25px; }
  .result-stage { width: 138px; height: 116px; margin-top: 7px; }
  .end-panel h2 { font-size: clamp(2.55rem, 13vw, 3.45rem); }
  .end-panel > p { margin-bottom: 14px; font-size: .84rem; }
  .result-score { min-height: 68px; margin-bottom: 17px; border-radius: 17px; }
  .result-score strong { font-size: 2.35rem; }
  .result-actions { grid-template-columns: 1fr; gap: 9px; }
  .result-actions .primary-button, .result-actions .secondary-button { min-height: 48px; }
}

@media (max-height: 650px) and (orientation: landscape) {
  .game-shell { padding-block: 7px; gap: 5px; }
  .game-header { min-height: 40px; }
  .back-link-logo { height: 34px; }
  .game-kicker { display: none; }
  .arena { min-height: calc(100svh - 54px); }
  .hud { top: 7px; min-height: 48px; padding-block: 4px; }
  .timer { font-size: 1.55rem; }
  .platform { width: min(18%, 190px); }
  .overlay-panel { padding: 16px 26px; }
  .start-panel { padding-top: 48px; }
  .start-host { height: 65px; }
  .character-portrait { height: 68px; }
  .overlay h2 { font-size: 1.8rem; }
  .overlay p { margin-bottom: 10px; font-size: .78rem; }
  .character-picker { margin-bottom: 12px; }
  .primary-button { min-height: 42px; }
  .best-note { margin-top: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .player, .platform-surface { transition-duration: .01ms !important; }
  .result-confetti { display: none; }
}
