:root{color-scheme:dark;--night:#081923;--panel:#112a35;--ink:#e3f3f5;--muted:#94b3c0;--mint:#8ce5dc;--line:#31515f;--ember:#ffad94;font-family:system-ui,sans-serif;background:var(--night);color:var(--ink)}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;background:radial-gradient(ellipse at 48% -25%,#245362 0%,#102934 48%,#081923 90%);min-height:100dvh}
button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation}
button:focus-visible{outline:2px solid #cffef9;outline-offset:3px}
.shell{width:min(100%,980px);min-height:100dvh;margin:auto;padding:max(15px,env(safe-area-inset-top)) max(18px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left))}
.mast{height:70px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:10px}
.brand{display:flex;align-items:center;gap:13px}
.crest{float:left;width:39px;height:39px;display:grid;place-items:center;transform:rotate(45deg);margin:0 4px;background:#14303a;border:1px solid var(--mint);color:#b9f3ea;box-shadow:0 0 24px #77ddd336;font-size:25px}
.eyebrow,.label,.pill,.credits,.score span,.round small{font-size:12px;letter-spacing:.15em;text-transform:uppercase;font-weight:750}
.eyebrow,.label{margin:0;color:#98dedb}
h1{font:600 clamp(1.35rem,4vw,2.1rem)/1.06 Georgia,serif;margin:3px 0 0}
.pill{padding:8px 9px;border:1px solid #416071;border-radius:6px;background:#07182076;color:#b2d0d8;white-space:nowrap}
.lobby{position:relative;margin:22px 0 16px;padding:clamp(17px,4vw,34px);border:1px solid #3e626c;border-radius:14px;overflow:hidden;background:radial-gradient(ellipse at 72% 5%,#31787944,transparent 53%),linear-gradient(145deg,#163640,#102a35 56%,#0a222d);box-shadow:0 20px 60px #0005}
.lobby::after{content:"";position:absolute;pointer-events:none;z-index:0;inset:-180px -170px auto auto;width:510px;height:475px;border:1px solid #8ce5dc22;transform:rotate(37deg);box-shadow:0 0 0 30px #8ce5dc12,0 0 0 65px #8ce5dc0c,0 0 0 110px #8ce5dc09}
.lobby>*{position:relative;z-index:1}
.intro{margin-bottom:25px}
.intro h2,.result h2{margin:.17em 0;font:600 clamp(2.35rem,7.2vw,5rem)/.96 Georgia,serif;letter-spacing:-.045em}
.intro p:not(.eyebrow),.result p{color:#b4cbd3;max-width:430px;line-height:1.5;margin:14px 0}
.roster{display:grid;grid-template-columns:repeat(4,1fr);gap:9px;margin:8px 0 20px}
.class{border:1px solid var(--line);background:#0b222ddb;text-align:left;padding:12px;border-radius:8px;min-height:127px}
.class[aria-pressed=true]{border-color:var(--mint);background:#22515a;box-shadow:0 0 0 1px #8ce5dc40}
.class:hover{border-color:var(--mint)}
.class i{font-style:normal;font-size:22px;display:block;line-height:1;margin-bottom:8px}
.class b{font-size:16px;display:block}
.class span{display:block;font-size:.84rem;color:#cce6eb;margin:2px 0 5px}
.class small{color:#a8c7d0;display:block;font-size:.79rem;line-height:1.28}
.start{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:.83rem}
.primary{background:#a1ebe1;border:1px solid #dcfdf7;color:#072733;border-radius:7px;padding:11px 17px;min-height:45px;font-weight:780}
.primary:hover{background:#d3fff4}
.credits{display:flex;justify-content:space-between;color:#8ca9b5;font-size:10px;padding:3px 0}
.scoreboard{height:54px;display:grid;grid-template-columns:1fr minmax(98px,154px) 1fr;gap:10px;align-items:center;max-width:800px;margin:auto}
.score{display:flex;align-items:center;gap:9px}.blue{justify-content:flex-end;color:#96ebfb}.red{justify-content:flex-start;color:var(--ember)}
.score b{font-size:22px}.round{text-align:center;line-height:1.05}.round b{display:block;font:700 20px Georgia,serif;font-variant-numeric:tabular-nums}.round small{color:#a0b8c2;font-size:9px}
.field{position:relative;margin:auto;width:min(100%,800px,calc((100dvh - 192px)*1.3514));border-radius:11px;overflow:hidden;border:1px solid #3d6470;box-shadow:0 15px 35px #0005;aspect-ratio:800/592;background:#081d29}
canvas{display:block;width:100%;height:100%;touch-action:none;image-rendering:pixelated;cursor:crosshair}
.notice{pointer-events:none;position:absolute;top:7px;left:50%;transform:translateX(-50%);background:#081923df;color:#ccf6f5;border-radius:6px;padding:6px 10px;text-align:center;font-size:13px;white-space:nowrap}
.notice:empty{display:none}
.deck{max-width:800px;margin:10px auto 5px;display:flex;align-items:center;justify-content:space-between;gap:10px}
.current{display:grid;gap:4px;min-width:0}.current strong{font-size:15px}.current span{color:var(--muted);font-size:12px}.current #status[data-hurt=true]{color:#ffd1a0}.buttons{display:flex;gap:7px}
.buttons button{padding:7px 9px;min-width:78px;min-height:52px;display:grid;grid-template-columns:auto 1fr;gap:3px 6px;text-align:left;align-content:center;border:1px solid #426877;border-radius:7px;background:#112d39}
.buttons button:disabled{opacity:.52;cursor:default}.buttons button strong{line-height:1.1;font-size:14px}.buttons button small{grid-column:1/-1;color:#9bc0cd;font-size:11px}
.buttons button.ability{border-color:#69b4ae;background:#174149}
 .buttons button[data-aiming=true]{outline:2px solid var(--mint);outline-offset:2px}
kbd{background:#294c55;color:#c7f0f1;border-radius:3px;font:600 11px monospace;padding:1px 3px}
.foot{max-width:800px;margin:auto;display:flex;justify-content:space-between;align-items:center;gap:10px;color:#8eacb8;font-size:12px}
.quiet{border:0;background:transparent;color:#d5e9ef;padding:6px 3px;min-height:30px;text-decoration:underline;text-underline-offset:3px;white-space:nowrap}
.result{position:absolute;inset:0;display:grid;place-items:center;background:#081720b5;z-index:2;overflow:auto;padding:8px}
.result-card{background:#102c39;border:1px solid #589a9e;padding:clamp(10px,3vw,26px);text-align:center;border-radius:12px;box-shadow:0 14px 40px #0008}
.result h2{font-size:clamp(1.7rem,6vw,3.5rem)}.result p{margin:9px auto}.result .quiet{margin-left:10px}
.pad,.touch-help{display:none}
@media (pointer:coarse),(max-width:600px),(max-height:540px) and (orientation:landscape){
 .field{width:min(100%,800px)}.deck{justify-content:space-between}.desktop-help,kbd{display:none}.touch-help{display:block}
 .pad{position:relative;display:block;touch-action:none;flex:0 0 82px;height:82px;border:1px solid #588393;border-radius:50%;background:radial-gradient(#1d4653,#0e2a36);color:#a8cdd4}
 .pad i{position:absolute;width:28px;height:28px;left:calc(50% - 14px);top:calc(50% - 14px);border:1px solid #a3e5e0;background:#5eaaa8;border-radius:50%;pointer-events:none}
 .pad small{position:absolute;bottom:6px;left:0;right:0;text-align:center;font:700 8px system-ui;letter-spacing:.14em}
 .pad-n,.pad-e,.pad-w{position:absolute;width:3px;height:3px;border-radius:50%;background:#7db8bd;top:9px;left:calc(50% - 1px)}
 .pad-e{left:auto;right:8px;top:40px}.pad-w{left:8px;top:40px}
 .buttons button{display:flex;flex-direction:column;min-width:50px;min-height:49px;justify-content:center;padding:6px}.buttons button strong{font-size:12px}
 .deck{display:grid;grid-template-columns:82px minmax(64px,1fr) auto;gap:7px}.current #status{font-size:11px}
}
@media(max-width:600px){
 .shell{padding-left:max(8px,env(safe-area-inset-left));padding-right:max(8px,env(safe-area-inset-right));padding-top:max(5px,env(safe-area-inset-top))}
 .mast{height:56px;padding-inline:3px}.brand{gap:8px}.crest{width:26px;height:26px;font-size:16px}
 .pill{font-size:8px;padding:6px 5px}.eyebrow{font-size:10px}.scoreboard{height:46px}.score span{font-size:9px}
 .lobby{margin-top:11px}.roster{grid-template-columns:repeat(2,1fr)}.class{min-height:105px}
}
@media(max-height:525px) and (orientation:landscape){
 .shell{padding-top:3px}.mast{height:38px}.mast .eyebrow{display:none}.crest{width:23px;height:23px;font-size:15px}.mast h1{font-size:19px}.scoreboard{height:34px}
 #running{position:relative}.field{width:min(calc(100% - 180px),calc((100dvh - 81px)*1.3514))}.deck{position:absolute;inset:45px 1px 13px;display:flex;align-items:flex-end;margin:0;max-width:none;pointer-events:none}
 .deck>*{pointer-events:auto}.deck .current,.foot>span{display:none}.deck .pad{width:74px;height:74px;flex-basis:74px}.deck .buttons{flex-direction:column}.foot{position:absolute;right:1px;top:0}.lobby{margin-top:8px}
}

/* Phone play surface: keep the whole round between Safari's controls and the
   safe areas. Leave the roster scrollable and zoomable. */
.ready{position:absolute;inset:0;display:grid;align-content:center;justify-items:center;gap:3px;background:#122d3b70;pointer-events:none;text-align:center;color:#f3ffff;text-shadow:0 2px 7px #081722}
.ready span{letter-spacing:.18em;font-size:13px;font-weight:800}
.ready b{font:650 clamp(2.8rem,13vw,6rem)/.95 Georgia,serif;color:#c7fff4}
.ready small{font-size:12px}
@media (pointer:coarse),(max-width:600px),(max-height:540px) and (orientation:landscape){
 body.playing{overscroll-behavior:none}
 .playing .shell{
   position:fixed;inset:0;width:100%;height:100vh;height:100dvh;min-height:0;
   padding:max(4px,env(safe-area-inset-top)) max(7px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(7px,env(safe-area-inset-left));
   display:flex;flex-direction:column;overflow:hidden;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;
 }
 .playing .mast{height:46px;flex:0 0 auto;padding-inline:3px}
 .playing .mast h1{font-size:clamp(16px,5.1vw,23px)}
 .playing .brand .eyebrow{display:none}
 .playing #running{flex:1;min-height:0;display:grid;grid-template-rows:43px minmax(0,1fr) auto auto;position:static}
 .playing .scoreboard{width:100%;height:43px}
 .playing .field{width:auto;max-width:100%;height:auto;max-height:100%;margin:auto;aspect-ratio:800/592;align-self:stretch;justify-self:stretch}
 .playing .deck{width:100%;margin:6px auto 0;display:grid;grid-template-columns:auto 1fr;align-items:center;gap:3px 10px;pointer-events:auto;position:static}
 .playing .pad{grid-row:1/3;width:clamp(102px,29vw,134px);height:auto;aspect-ratio:1;flex-basis:auto}
 .playing .pad i{width:36px;height:36px;left:calc(50% - 18px);top:calc(50% - 18px);border:2px solid #bdfbf0}
 .playing .pad small{bottom:8px;font-size:10px}
 .playing .pad-n{top:10%}.playing .pad-w,.playing .pad-e{top:49%}
 .playing .current{display:flex;justify-content:space-between;align-items:center;gap:5px;padding-right:2px}
 .playing .current strong,.playing .current #status{font-size:12px}
 .playing .current .touch-help{display:none}
 .playing .buttons{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;width:100%}
 .playing .buttons button{min-width:0;min-height:62px;padding:4px 3px;align-items:center;text-align:center;justify-content:center}
 .playing .buttons button strong{font-size:clamp(10px,3.6vw,15px)}
 .playing .buttons button small{font-size:clamp(9px,2.7vw,11px)}
 .playing .foot{width:100%;position:static;line-height:1.2;font-size:11px;gap:2px;min-height:42px}
 .playing .foot .quiet{min-height:44px;padding-inline:5px}
 .playing .notice{max-width:95%;width:max-content;white-space:normal;font-size:11px}
 .playing .result-card{max-width:96%}
}
@media (orientation:portrait) and (max-width:600px){
 .playing .field{width:min(100%, calc((100vh - 245px)*1.35135));width:min(100%, calc((100dvh - 245px)*1.35135));max-width:none;justify-self:center}
}
@media (orientation:landscape) and (max-height:540px){
 .playing .mast{height:34px}
 .playing #running{grid-template-rows:31px minmax(0,1fr);grid-template-columns:clamp(78px,15vw,128px) minmax(0,1fr) clamp(85px,16vw,130px);column-gap:5px}
 .playing .scoreboard{height:31px;grid-column:2;grid-row:1;grid-template-columns:1fr minmax(56px,95px) 1fr;gap:3px}
 .playing .score{gap:3px}.playing .score span{font-size:9px}.playing .round small{font-size:8px}
 .playing .field{grid-column:2;grid-row:2;width:min(100%,calc((100vh - 80px)*1.35135));width:min(100%,calc((100dvh - 80px)*1.35135));justify-self:center;align-self:start;margin:0 auto}
 .playing .deck{display:contents}
 .playing .pad{align-self:end;justify-self:center;grid-column:1;grid-row:2;width:100%;max-width:129px;min-width:0;margin:0 0 6px}
 .playing .current{display:none}
 .playing .buttons{grid-column:3;grid-row:2;align-self:end;grid-template-columns:1fr;gap:4px;margin-bottom:5px}
 .playing .buttons button{min-height:46px}
 .playing .buttons button strong{font-size:13px}
 .playing .foot{grid-column:3;grid-row:1;height:31px;min-height:0;justify-content:flex-end}
 .playing .foot>span{display:none}.playing .foot .quiet{min-height:31px;font-size:10px}
}

/* Include the HUD and gaps around thumb controls, not just the rink,
   so a second finger can't start a viewport gesture on a different element. */
html.match-gestures, html.match-gestures body,
html.match-gestures .shell, html.match-gestures .shell * { touch-action: none; }

/* Keep the fourth action reachable without shrinking the arena or joystick. */
.loot-intro{font-size:.88rem}
.buttons button.item[data-loaded=true]{background:#27344a;border-color:var(--item-color,#d7beff);box-shadow:inset 0 0 16px #cba4ff1c;color:var(--item-color,#d7beff)}
.buttons button.item[data-rare=true]{background:#3a2e55}
#status[data-boost=true]{color:#e1c9fc}
@media (pointer:coarse),(max-width:600px){
 .playing .buttons{grid-template-columns:repeat(2,minmax(0,1fr))}
 .playing .buttons button{min-height:44px;display:flex}
}
@media (orientation:landscape) and (max-height:540px){
 .playing .buttons{grid-template-columns:1fr}
 .playing .buttons button{min-height:44px}
}

.round small[data-rare=true]{color:#ebbcff}
@media (orientation:landscape) and (max-height:265px){
 .playing #running{grid-template-columns:clamp(70px,14vw,110px) minmax(0,1fr) minmax(104px,20vw)}
 .playing .buttons{grid-template-columns:repeat(2,minmax(0,1fr))}
 .playing .buttons button strong{font-size:11px}
}

.frontier-link{display:inline-flex;align-items:baseline;flex-wrap:wrap;gap:5px 11px;margin-top:12px;color:#bdeff3;font-weight:750;text-underline-offset:3px}.frontier-link small{color:#b4c7d4;font-weight:500}
