:root {
  --bg: #14121f;
  --panel: rgba(28, 24, 44, 0.92);
  --panel2: #231f36;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4efe4;
  --dim: #b7b0c8;
  --gold: #ffc857;
  --gold2: #ff9f1c;
  --red: #ff4d4d;
  --green: #5ee07a;
  --blue: #4fc3f7;
  --purple: #b388ff;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; overflow: auto; }
.row { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.err { color: var(--red); min-height: 1.2em; text-align: center; }
.hint { color: var(--dim); margin: 4px 0; }

button.big { display: block; width: 100%; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel2); font-size: 1.15rem; font-weight: 700; margin: 8px 0; }
button.big.primary { background: linear-gradient(180deg, var(--gold), var(--gold2)); color: #2a1a00; border: none; box-shadow: 0 6px 18px rgba(255, 159, 28, 0.35); }
button.big:disabled { opacity: 0.45; }
button.join { background: linear-gradient(180deg, #5ee07a, #2fb35a); color: #062b12; border: none; }
button.link { background: none; border: none; color: var(--gold); text-decoration: underline; padding: 8px; font-size: 1rem; }
a.link { color: var(--gold); padding: 8px; }

/* ---------- home ---------- */
#home { background: radial-gradient(ellipse at 50% 0%, #3a2d5c 0%, var(--bg) 60%); display: flex; padding: 16px max(16px, var(--safe-r)) 16px max(16px, var(--safe-l)); }
.home-box { width: min(440px, 100%); margin: auto; }
@media (max-height: 500px) { .logo { font-size: 2.2rem; } .tag { margin-bottom: 8px; } button.big { padding: 12px 16px; margin: 6px 0; } }
.logo { font-size: clamp(2.4rem, 9vw, 3.6rem); text-align: center; margin: 0 0 4px; letter-spacing: 1px; color: var(--gold); text-shadow: 0 0 24px rgba(255, 200, 87, 0.55), 0 3px 0 #6b3d00; font-family: Georgia, "Times New Roman", serif; }
.tag { text-align: center; color: var(--dim); margin: 0 0 18px; }
.field { display: block; font-weight: 600; margin: 8px 0 10px; }
.field input { display: block; width: 100%; margin-top: 6px; padding: 14px; font-size: 1.15rem; border-radius: 12px; border: 1px solid var(--line); background: #0e0c18; color: var(--text); }
.save-card { font-size: 0.95rem; }
.small-links { margin-top: 6px; }

/* ---------- lobby ---------- */
#lobby { padding: max(10px, var(--safe-t)) max(14px, var(--safe-r)) max(10px, var(--safe-b)) max(14px, var(--safe-l)); }
.lobby-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.lobby-top h2 { margin: 4px 0; }
.qr { width: 92px; flex: none; background: #fff; border-radius: 8px; padding: 4px; }
.qr svg { display: block; width: 100%; height: auto; }
.qr p { color: #333; font-size: 0.65rem; margin: 2px 0 0; text-align: center; word-break: break-all; }
.qr .qr-code { color: #111; font-size: 1.5rem; font-weight: 800; letter-spacing: 0.08em; text-align: center; line-height: 1.1; }
.h-code { position: absolute; right: calc(136px + var(--safe-r)); top: calc(58px + var(--safe-t)); padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 12px; white-space: nowrap; }
.h-code b { color: var(--gold); letter-spacing: 0.06em; }
.menu .invite { display: flex; gap: 10px; align-items: center; margin: 6px 0 8px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); }
.menu .invite .qr { width: 88px; }
.menu .invite p { margin: 2px 0; font-size: 13px; }
.menu .invite-code { font-size: 26px; font-weight: 800; letter-spacing: 0.1em; color: var(--gold); }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.hero-card { position: relative; text-align: left; padding: 10px; border-radius: 14px; background: var(--panel2); border: 2px solid transparent; min-height: 150px; }
.hero-card.on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 200, 87, 0.25); }
.hero-card .ic { font-size: 2rem; height: 56px; display: flex; align-items: center; }
.hero-card .ic .cls { width: 56px; height: 56px; display: block; pointer-events: none; }
.hero-card b { display: block; font-size: 1.1rem; }
.hero-card .role { color: var(--gold); font-size: 0.85rem; font-weight: 600; }
.hero-card p { margin: 4px 0 0; font-size: 0.82rem; color: var(--dim); }
.hero-card .who { position: absolute; top: 8px; right: 8px; display: flex; gap: 3px; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 2px solid rgba(0, 0, 0, 0.4); }
.lobby-bottom { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.lobby-bottom .big { grid-column: 1 / -1; }
.lobby-bottom .lobby-leave { grid-column: 1 / -1; justify-self: center; font-size: 0.9rem; padding: 4px 8px; }
.lobby-players { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { padding: 6px 10px; border-radius: 999px; background: var(--panel2); font-size: 0.9rem; display: flex; gap: 6px; align-items: center; }
.pchip.ready::after { content: '✓'; color: var(--green); font-weight: 800; }
.pchip.away { opacity: 0.5; }
.engine-wait { grid-column: 1 / -1; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--panel2); }
.engine-wait .ew-text { font-size: 0.92rem; margin-bottom: 8px; }
.engine-wait .ew-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.engine-wait .ew-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--green); transition: width 1s linear; }
.host-settings { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.seg { display: inline-flex; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.seg button { background: transparent; border: none; padding: 8px 12px; }
.seg button.on { background: var(--gold); color: #2a1a00; font-weight: 700; }
.check { font-size: 0.9rem; color: var(--dim); }

/* ---------- game ---------- */
#game { overflow: hidden; touch-action: none; background: #000; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* Loading the models (app.js showWorldLoad) */
#worldLoad { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; background: var(--bg); text-align: center; }
#worldLoad .wl-title { font-size: 1.1rem; }
#worldLoad .wl-track { width: min(320px, 70vw); height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
#worldLoadBar { width: 0; height: 100%; background: var(--gold); transition: width 0.3s; }
#worldLoad .wl-slow { max-width: 340px; font-size: 0.9rem; opacity: 0.8; }
#labels { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 2; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); }
#hud * { pointer-events: none; }
#hud .tap, #hud .tap * { pointer-events: auto; }
.nametag { font: 700 12px system-ui, sans-serif; color: #fff; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.45); white-space: nowrap; transform: translateY(-4px); }
.dmg { position: absolute; font: 800 15px system-ui, sans-serif; color: #fff; text-shadow: 0 0 3px #000, 0 2px 2px #000; transform: translate(-50%, -50%); white-space: nowrap; will-change: transform, opacity; }
.dmg.crit { color: var(--gold); font-size: 20px; }
.dmg.hurt { color: var(--red); font-size: 17px; }
.dmg.heal { color: var(--green); }
.dmg.dot { font-size: 12px; opacity: 0.85; }
.dmg.miss { color: #9fe8ff; font-size: 14px; }

.h-me { position: absolute; left: calc(10px + var(--safe-l)); top: calc(8px + var(--safe-t)); width: 210px; }
.h-me .name { font-size: 13px; display: flex; justify-content: space-between; }
.bar { position: relative; height: 14px; background: rgba(0, 0, 0, 0.55); border-radius: 7px; overflow: hidden; margin-top: 3px; border: 1px solid rgba(255, 255, 255, 0.15); }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 7px; }
.bar .hp { background: linear-gradient(180deg, #7dff8a, #26b347); }
.bar .sh { background: rgba(170, 220, 255, 0.85); }
.bar span { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 14px; }
.bar.xp { height: 6px; }
.bar.xp > i { background: linear-gradient(90deg, #b388ff, #7c4dff); }
.potions { font-size: 13px; margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.potions .pot { font: inherit; font-size: 13px; color: inherit; text-shadow: inherit; padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(0, 0, 0, 0.45); cursor: pointer; }
.potions .pot:active { transform: scale(0.95); }
.potions .pot.glow { border-color: #ffc857; box-shadow: 0 0 10px rgba(255, 200, 87, 0.8); animation: potGlow 1s ease-in-out infinite alternate; }
@keyframes potGlow { from { box-shadow: 0 0 4px rgba(255, 200, 87, 0.5); } to { box-shadow: 0 0 14px rgba(255, 200, 87, 1); } }
@media (prefers-reduced-motion: reduce) { .potions .pot.glow { animation: none; } }
.team { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.team .tm { display: flex; align-items: center; gap: 5px; font-size: 11px; }
.team .tm .bar { flex: 1; height: 7px; margin: 0; }
.team .tm .bar > i { background: #7dff8a; }
.team .tm.down { color: var(--red); }
.team .tm.picking { color: var(--dim); font-style: italic; } /* on the hero screen: no hero in the game yet, no health bar */

.h-top { position: absolute; left: calc(var(--safe-l) + 232px); right: calc(var(--safe-r) + 188px); top: calc(6px + var(--safe-t)); text-align: center; }
.clock { display: inline-block; font-size: 13px; padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.5); }
.clock.night { background: rgba(40, 30, 110, 0.75); }
.coach { display: inline-block; margin-top: 4px; max-width: min(46vw, 420px); font-size: 13px; font-weight: 600; line-height: 1.25; padding: 3px 9px; border-radius: 8px; background: rgba(0, 0, 0, 0.38); opacity: 0; transition: opacity 0.35s; }
.coach.on { opacity: 1; }
.coach.alert { background: rgba(190, 25, 25, 0.75); font-weight: 700; }
.bossbar { margin: 5px auto 0; max-width: 520px; }
.bossbar .bar { height: 12px; background: rgba(70, 0, 0, 0.75); border: 1px solid rgba(255, 138, 128, 0.8); }
.bossbar .bar > i { background: linear-gradient(180deg, #ff6b6b, #c0392b); }
.bossbar .bn { font-size: 13px; color: #ffd0d0; }
.bossbar.underbanner { visibility: hidden; } /* sideways, for a banner's few seconds (hud.js) */

.h-map { position: absolute; right: calc(10px + var(--safe-r)); top: calc(8px + var(--safe-t)); width: 120px; height: 120px; border-radius: 50%; overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.35); background: #12304f; }
.h-map canvas { width: 100%; height: 100%; display: block; }
.h-menu { position: absolute; right: calc(136px + var(--safe-r)); top: calc(8px + var(--safe-t)); width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.5); font-size: 20px; }

.btns { position: absolute; right: calc(12px + var(--safe-r)); bottom: calc(10px + var(--safe-b)); width: 260px; height: 262px; }
.btn { position: absolute; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.55); background: rgba(20, 16, 36, 0.55); display: flex; align-items: center; justify-content: center; flex-direction: column; color: #fff; font-size: 11px; overflow: hidden; }
.btn .ring { position: absolute; inset: -3px; border-radius: 50%; }
.btn .ic { font-size: 30px; line-height: 1; position: relative; height: 40px; display: flex; align-items: center; justify-content: center; }
/* Your hero's painted icon (hud.js setArt): a fixed box, shown once loaded, the glyph until then */
.btn .ic .art { display: none; width: 40px; height: 40px; pointer-events: none; -webkit-user-drag: none; user-select: none; }
/* the label tucked up under the icon's round bottom, so it sits about as high as it did under the glyph and the round
   button doesn't clip it */
.btn .ic + .lb { margin-top: -7px; }
.btn.art .ic .gl { display: none; }
.btn.art .ic .art { display: block; }
.btn.atk .ic { height: 62px; }
.btn.atk .ic .art { width: 62px; height: 62px; }
/* the Shaman's element on her Totem icon */
.btn .ic .elb { display: none; position: absolute; right: -9px; bottom: -4px; width: 24px; height: 24px; border-radius: 50%; font-size: 15px; line-height: 24px; text-align: center; background: rgba(20, 16, 36, 0.9); border: 2px solid var(--gold); }
.btn.art .ic .elb:not(:empty) { display: block; }
/* a locked Ultimate: its icon greyed as well as dimmed */
.btn.big.locked .ic .art { filter: grayscale(1) brightness(0.8); }
.btn .key { display: none; position: absolute; top: 5px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 700; line-height: 1; padding: 2px 5px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.5); background: rgba(0, 0, 0, 0.55); color: #fff; letter-spacing: 0.3px; }
@media (hover: hover) and (pointer: fine) { .btn .key { display: block; } }
/* The Shaman's totem keys (1 to 4) beside Power, and on the totem wheel: on screens with a mouse only. */
.tkeys { display: none; position: absolute; left: 22px; top: 84px; flex-direction: column; gap: 3px; pointer-events: none; }
.tkeys span { display: flex; align-items: center; gap: 3px; font-size: 14px; line-height: 1; padding: 2px 5px 2px 3px; border-radius: 6px; background: rgba(20, 16, 36, 0.7); border: 1px solid rgba(255, 255, 255, 0.4); }
.tkeys b { font-size: 10px; font-weight: 700; color: #fff; padding: 1px 4px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.5); background: rgba(0, 0, 0, 0.55); }
.wopt .wkey { display: none; position: absolute; top: 3px; right: 5px; font-style: normal; font-size: 10px; font-weight: 700; padding: 0 3px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.5); background: rgba(0, 0, 0, 0.55); }
@media (hover: hover) and (pointer: fine) { .btns.shaman .tkeys { display: flex; } .wopt .wkey { display: block; } }
/* How to play: the PC keys, on screens with a mouse only (pad.js) */
.how-keys { display: none; margin: 0 0 10px; font-size: 14px; color: var(--gold); text-align: center; }
@media (hover: hover) and (pointer: fine) { .how-keys { display: block; } }
.btn .lb { position: relative; margin-top: 2px; max-width: 94%; text-align: center; line-height: 1.05; font-size: 10px; letter-spacing: -0.2px; }
.btn.atk .lb { font-size: 12px; }
.btn .num { position: absolute; top: 50%; left: 0; right: 0; text-align: center; transform: translateY(-72%); font-size: 22px; font-weight: 800; text-shadow: 0 1px 3px #000; }
.btn.cool .ic { opacity: 0.3; }
.btn .num.badge { top: 2px; right: 6px; left: auto; transform: none; font-size: 13px; background: rgba(0, 0, 0, 0.6); border-radius: 999px; padding: 0 6px; }
/* Attack is the big button in the corner. Power, Special, Defensive and Ultimate sit around it. */
.btn.atk { width: 112px; height: 112px; right: 0; bottom: 0; border-color: #ff8a65; }
.btn.atk .ic { color: #ffab91; font-size: 42px; }
.btn.pow { width: 80px; height: 80px; right: 112px; bottom: 92px; border-color: var(--gold); }
.btn.pow .ic { color: var(--gold); }
.btn.spec { width: 80px; height: 80px; right: 14px; bottom: 122px; border-color: #80deea; }
.btn.spec .ic { color: #80deea; }
.btn.dodge { width: 76px; height: 76px; right: 124px; bottom: 4px; border-color: #9fe8ff; }
.btn.dodge .ic { color: #9fe8ff; }
.btn.big { width: 76px; height: 76px; right: 130px; bottom: 184px; border-color: var(--purple); }
.btn.big .ic { color: var(--purple); }
.btn.big.full { box-shadow: 0 0 22px 6px rgba(179, 136, 255, 0.85); animation: pulse 1s infinite; }
.btn.big.locked { opacity: 0.35; }
.btn.cool { filter: grayscale(0.6) brightness(0.75); }
.btn.pressed { transform: scale(0.92); }
@keyframes pulse { 50% { box-shadow: 0 0 34px 10px rgba(179, 136, 255, 1); } }

.cardbtn { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--safe-b)); padding: 12px 18px; border-radius: 999px; border: none; background: linear-gradient(180deg, var(--gold), var(--gold2)); color: #2a1a00; font-weight: 800; font-size: 16px; box-shadow: 0 0 22px rgba(255, 200, 87, 0.8); animation: pulse2 1.2s infinite; }
@keyframes pulse2 { 50% { box-shadow: 0 0 36px rgba(255, 200, 87, 1); } }

.joy { position: absolute; width: 130px; height: 130px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.06); transform: translate(-50%, -50%); }
.joy i { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(255, 255, 255, 0.45); }
.joyhint { position: absolute; left: calc(40px + var(--safe-l)); bottom: calc(40px + var(--safe-b)); width: 120px; height: 120px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, 0.3); display: flex; align-items: center; justify-content: center; text-align: center; font-size: 12px; color: rgba(255, 255, 255, 0.7); }

.edge { position: absolute; width: 0; height: 0; border-left: 11px solid transparent; border-right: 11px solid transparent; border-bottom: 22px solid #fff; transform-origin: 50% 50%; filter: drop-shadow(0 0 3px #000); }
.edge.goal { border-bottom-color: var(--gold); }

/* A banner is as wide as its words (from the middle it used to get only half the screen, so titles broke into 2 or 3 lines). */
.banner { position: absolute; left: 50%; top: 23%; transform: translate(-50%, -50%); text-align: center; animation: fadein 0.5s; width: max-content; max-width: calc(100% - 24px); }
.banner b { display: block; font-size: clamp(24px, 4.5vw, 40px); color: var(--gold); font-family: Georgia, serif; text-shadow: 0 0 20px rgba(255, 200, 87, 0.7), 0 3px 0 #000; }
.banner span { display: block; font-size: clamp(12px, 1.8vw, 15px); max-width: 70vw; margin: 6px auto 0; }
@keyframes fadein { from { opacity: 0; transform: translate(-50%, -40%); } }
.countdown { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); font-size: 22px; padding: 8px 16px; border-radius: 12px; background: rgba(0, 0, 0, 0.6); }

.intro { position: absolute; left: calc(10px + var(--safe-l)); top: 50%; transform: translateY(-50%); width: 230px; padding: 10px 12px; border-radius: 14px; background: var(--panel); border: 2px solid #ff6b6b; animation: slidein 0.4s; }
.intro small { color: #ff9e9e; text-transform: uppercase; font-size: 11px; letter-spacing: 1px; }
.intro b { display: block; font-size: 17px; margin: 2px 0; }
.intro p { margin: 0; font-size: 13px; font-weight: 600; }
@keyframes slidein { from { opacity: 0; transform: translate(-30px, -50%); } }

.down { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; flex-direction: column; background: radial-gradient(circle, rgba(120, 0, 0, 0.1) 30%, rgba(80, 0, 0, 0.55)); font-size: 22px; text-align: center; }
.down b { font-size: 48px; }
.down .bar { width: 220px; height: 12px; }
.down .bar > i { background: var(--green); }
.hurtflash { position: absolute; inset: 0; box-shadow: inset 0 0 90px 30px rgba(255, 0, 0, 0.55); opacity: 0; transition: opacity 0.25s; }
.hurtflash.on { opacity: 1; transition: none; }
.pausebox { position: absolute; inset: 0; z-index: 7; background: rgba(5, 3, 12, 0.88); overflow: auto; pointer-events: auto; display: flex; padding: calc(12px + var(--safe-t)) calc(14px + var(--safe-r)) calc(14px + var(--safe-b)) calc(14px + var(--safe-l)); text-shadow: none; }
.pausebox .big { width: min(320px, 80vw); }
/* Paused: the message and buttons, then sound and your build (owner 2026-11-19). Side by side when there's room. */
.pause-cols { margin: auto; width: min(760px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.pause-main { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 22px; text-align: center; padding-top: 8px; }
.pause-side { min-width: 0; }
.pause-side h3 { margin: 6px 0; color: var(--gold); }
.pause-open .readyrow, .pause-open .cardbtn, .pause-open .intro, .pause-open .storycard { visibility: hidden; }
@media (orientation: portrait) { html:not(.sideways) .pause-cols { grid-template-columns: 1fr; } }

/* cards (talents and objects) */
.sheet { position: absolute; inset: 0; background: rgba(5, 3, 12, 0.72); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px calc(10px + var(--safe-r)) 10px calc(10px + var(--safe-l)); }
.sheet h3 { margin: 0 0 8px; font-size: 20px; color: var(--gold); }
.cards { display: flex; gap: 10px; width: 100%; max-width: 860px; justify-content: center; }
.card { touch-action: manipulation; position: relative; flex: 1 1 0; max-width: 270px; min-height: 180px; padding: 12px; border-radius: 16px; background: linear-gradient(180deg, #2c2546, #1a1630); border: 2px solid rgba(255, 255, 255, 0.2); text-align: left; font-weight: 600; text-shadow: none; }
.card.star { border-color: var(--gold); box-shadow: 0 0 18px rgba(255, 200, 87, 0.6); }
.card .badge { position: absolute; top: -10px; right: 10px; background: var(--gold); color: #2a1a00; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.card b { display: block; font-size: 17px; margin-bottom: 4px; }
.card p { margin: 0 0 6px; font-size: 14px; color: #e9e3f5; line-height: 1.25; }
.card .rar { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.card .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tagchip { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); }
.unlock { margin-top: 6px; font-size: 12px; color: var(--gold); }
.card .rank { font-size: 12px; color: var(--dim); }
.sheet .later { margin-top: 10px; pointer-events: auto; }

/* menu */
.menu { position: absolute; inset: 0; background: rgba(5, 3, 12, 0.85); overflow: auto; padding: calc(12px + var(--safe-t)) calc(14px + var(--safe-r)) 14px calc(14px + var(--safe-l)); text-shadow: none; }
.menu h3 { margin: 6px 0; color: var(--gold); }
.menu .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.menu .big { margin: 6px 0; }
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--panel2); margin: 6px 0; font-weight: 600; }
.build-list { font-size: 13px; font-weight: 500; }
.build-list div { padding: 3px 0; border-bottom: 1px solid var(--line); }
.setline { color: var(--gold); }

/* report */
#report { background: radial-gradient(ellipse at 50% 0%, #3a2d5c 0%, var(--bg) 60%); padding: max(14px, var(--safe-t)) max(14px, var(--safe-r)) 14px max(14px, var(--safe-l)); }
.report-box { max-width: 960px; margin: 0 auto; text-align: center; }
.report-box h2 { color: var(--gold); font-size: 2rem; margin: 6px 0; font-family: Georgia, serif; }
.rep-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin: 12px 0; text-align: left; }
.rep-card { background: var(--panel2); border-radius: 14px; padding: 12px; border-top: 5px solid var(--gold); }
.rep-card h4 { margin: 0 0 6px; }
/* The run is over: the last moment's toasts (someone is down) don't cover the cards (2026-11-22). */
body:has(#report:not(.hidden)) .toast { display: none; }
/* what this player did most for the team (2026-11-22) */
.rep-card .credit { margin: -2px 0 6px; font-size: 14px; font-weight: 600; color: #cfe6c4; }
.rep-card .stat { display: flex; justify-content: space-between; font-size: 14px; padding: 2px 0; border-bottom: 1px solid var(--line); }
.rep-card .tip { margin-top: 8px; font-size: 14px; color: var(--gold); }
/* A detail line under the row above it (the red attacks a minute), so neither wraps on a narrow phone (QA 2026-11-21). */
.rep-card .stat.sub { font-size: 12.5px; color: var(--dim); padding-top: 0; margin-top: -1px; }
.rep-card .stat:has(+ .stat.sub) { border-bottom: none; }
.report-box .row .big { width: auto; flex: 1; min-width: 180px; }

/* how to play */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(5, 3, 12, 0.92); overflow: auto; padding: max(14px, var(--safe-t)) max(14px, var(--safe-r)) 14px max(14px, var(--safe-l)); }
.how-box { max-width: 900px; margin: 0 auto; }
/* Patch notes (2026-11-19). Only the list scrolls (2026-11-24): the title and Close stay at the top and Got it at the
   bottom, clear of the iPhone's home bar. Solid, so nothing shows through behind them or the list. */
#notes.overlay { overflow: hidden; background: rgb(5, 3, 12); padding-bottom: max(14px, var(--safe-b)); }
.notes-box { max-width: 640px; height: 100%; margin: 0 auto; display: flex; flex-direction: column; }
.notes-head, .notes-foot { flex: none; background: rgb(5, 3, 12); }
.notes-head { padding-bottom: 4px; border-bottom: 1px solid var(--line); }
/* 14px wider than the box each side, padded back in, so a phone's scrollbar runs beside the notes, not over them. */
.notes-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -14px; padding: 12px 14px 4px; }
.notes-foot { padding-top: 10px; border-top: 1px solid var(--line); }
.notes-foot button.big { margin: 0; }
@media (max-height: 500px) { .notes-foot button.big { padding: 11px 18px; } }
.notes-list { display: flex; flex-direction: column; gap: 10px; }
.notes-list .note { padding: 12px 14px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); }
.notes-list .note h3 { margin: 0 0 4px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--dim); }
.notes-list .note b { display: block; font: 700 1.15rem Georgia, serif; color: var(--gold); }
.notes-list .note ul { margin: 6px 0 0; padding-left: 20px; line-height: 1.45; }
.notes-list .note li + li { margin-top: 4px; }
/* The end of the feed (2026-11-24): quiet, the same height whether it loads, ends or offers a retry, so nothing jumps. */
.notes-end { min-height: 40px; margin-top: 10px; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--dim); font-size: 0.9rem; }
.notes-end[data-state="end"] { font-style: italic; opacity: 0.8; }
.notes-end button.link { font-size: 0.9rem; }
/* The leaderboard (2026-11-18). */
.board-box { max-width: 720px; margin: 0 auto; }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.board-head h2 { color: var(--gold); font-family: Georgia, serif; margin: 6px 0; }
.board-tabs, .board-diff { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.board-tabs button, .board-diff button { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); font-weight: 600; }
.board-tabs button.on, .board-diff button.on { border-color: var(--gold); background: rgba(255, 200, 87, 0.15); color: var(--gold); }
.board-list { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.board-list li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-areas: 'rank names res' 'rank date res'; gap: 2px 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); }
.board-list li:nth-child(1) .rank { color: var(--gold); }
.board-list .rank { grid-area: rank; font: 700 20px Georgia, serif; text-align: center; color: var(--dim); }
.board-list .names { grid-area: names; display: flex; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.board-list .who { white-space: nowrap; }
.board-list .marks { display: inline-flex; gap: 4px; }
.board-list .res { grid-area: res; text-align: right; font-weight: 700; display: flex; flex-direction: column; align-items: flex-end; }
.board-list .res small { font-weight: 500; color: var(--dim); }
.board-list .date { grid-area: date; font-size: 12px; color: var(--dim); }
.board-list .empty { display: block; text-align: center; color: var(--dim); }
.rep-board { text-align: center; color: var(--gold); font-weight: 700; margin: 6px 0; }
.how-box h2 { color: var(--gold); text-align: center; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.how-item { background: var(--panel2); border-radius: 14px; padding: 10px; }
.how-item p { margin: 4px 0 0; color: var(--dim); font-size: 0.9rem; }
.how-pic { font-size: 30px; }
.how-pic.pow { color: var(--gold); } .how-pic.dodge { color: #9fe8ff; } .how-pic.red { color: var(--red); } .how-pic.big { color: var(--purple); }

.rotate { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 22px; text-align: center; }
.rotate .spin { font-size: 80px; animation: spin 2s infinite; }
@keyframes spin { 50% { transform: rotate(90deg); } }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 70; background: var(--panel); padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); width: max-content; max-width: min(90vw, 420px); text-align: center; pointer-events: none; }

@media (max-height: 430px) {
  .btns { transform: scale(0.85); transform-origin: right bottom; }
  .h-me { width: 180px; }
  .h-top { left: calc(var(--safe-l) + 200px); right: calc(var(--safe-r) + 166px); }
  .h-map { width: 96px; height: 96px; }
  .h-menu { right: calc(112px + var(--safe-r)); }
  .h-code { right: calc(112px + var(--safe-r)); top: calc(56px + var(--safe-t)); }
  .card { min-height: 150px; padding: 10px; }
  .card p { font-size: 13px; }
}

/* ---------- guide, hero sheets, hold-for-info ---------- */
.hero-card .info { position: absolute; left: 6px; bottom: 6px; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--gold); background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); }
.hero-card { padding-bottom: 44px; }
.guide-box { max-width: 900px; margin: 0 auto; }
.guide-head { position: sticky; top: calc(-1 * max(14px, var(--safe-t))); z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: rgba(5, 3, 12, 0.96); padding: 4px 0; }
.guide-head h2 { margin: 0; color: var(--gold); font-size: 1.4rem; }
.guide-head .big { width: auto; margin: 4px 0; padding: 10px 22px; }
.guide-tabs { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.guide-tabs button, .herobar button { padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); font-weight: 700; }
.guide-tabs button.on, .herobar button.on { background: var(--gold); color: #2a1a00; border-color: var(--gold); }
.herobar { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.herobar button { padding: 7px 10px; font-size: 0.9rem; }
.guide-body h4, #guideBody h4 { color: var(--gold); margin: 14px 0 6px; }
.sheet-hero .sh-head { display: flex; gap: 12px; align-items: flex-start; }
.sheet-hero .sh-ic { font-size: 44px; line-height: 1; }
/* the painted class icons in the Guide, the hero sheets and the leaderboard (guide.js heroIcon): sized before they load */
img.hic { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: middle; margin: -0.2em 0.3em -0.1em 0; border-radius: 0.22em; }
.sheet-hero .sh-ic img.hic { width: 56px; height: 56px; margin: 0; display: block; border-radius: 9px; }
.sheet-hero h3 { margin: 0; font-size: 1.3rem; }
.sheet-hero .role { color: var(--gold); font-weight: 600; font-size: 0.9rem; }
.sheet-hero .sh-head p { margin: 4px 0 0; color: var(--dim); }
.ab { display: flex; gap: 10px; align-items: flex-start; background: var(--panel2); border-radius: 12px; padding: 8px 10px; margin: 6px 0; }
.ab p { margin: 2px 0; font-size: 0.92rem; }
.ab small { color: var(--dim); }
.ab-btn { flex: none; width: 84px; text-align: center; padding: 6px 0; border-radius: 999px; border: 2px solid rgba(255, 255, 255, 0.5); font-size: 0.78rem; font-weight: 800; }
.ab-atk { border-color: #ff8a65; color: #ffab91; } .ab-pow { border-color: var(--gold); color: var(--gold); }
.ab-spec { border-color: #80deea; color: #80deea; } .ab-dodge { border-color: #9fe8ff; color: #9fe8ff; }
.ab-big { border-color: var(--purple); color: var(--purple); } .ab-pass { border-color: #a5d6a7; color: #a5d6a7; } .ab-night { border-color: #7986cb; color: #9fa8da; }
.tals, .mons, .sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.tal, .mon, .set, .obj { background: var(--panel2); border-radius: 10px; padding: 7px 9px; }
.tal p, .mon p, .set p, .obj p { margin: 3px 0 0; font-size: 0.85rem; color: var(--dim); }
.tal.have { border: 1px solid var(--green); }
.tal .got { color: var(--green); font-weight: 800; }
.obj { margin: 5px 0; }
.obj .tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.setn { display: inline-block; min-width: 18px; font-weight: 800; color: var(--text); }
.mon.unknown { opacity: 0.45; }
.mon .rank { font-size: 0.75rem; color: var(--gold); border: 1px solid var(--gold); border-radius: 6px; padding: 0 5px; }
.matk { font-size: 0.82rem; margin-top: 3px; }
.abtip { position: absolute; right: calc(284px + var(--safe-r)); bottom: calc(14px + var(--safe-b)); width: 250px; padding: 10px 12px; border-radius: 14px; background: var(--panel); border: 2px solid rgba(255, 255, 255, 0.4); text-shadow: none; pointer-events: none; z-index: 5; }
.abtip small { text-transform: uppercase; letter-spacing: 1px; font-size: 11px; color: var(--dim); }
.abtip b { display: block; font-size: 17px; margin: 1px 0 3px; }
.abtip p { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.abtip i { font-size: 12px; color: var(--dim); font-style: normal; }
.abtip.ab-pow { border-color: var(--gold); } .abtip.ab-spec { border-color: #80deea; } .abtip.ab-dodge { border-color: #9fe8ff; } .abtip.ab-big { border-color: var(--purple); }
#game, #game * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
@media (max-height: 430px) { .abtip { right: calc(240px + var(--safe-r)); width: 230px; } }
#guide { background: var(--bg); }

/* ---------- sideways mode (sideways.js): the game turns itself while the screen stays upright ---------- */
html.sideways body { position: fixed; top: 0; left: 0; width: var(--sw-w); height: var(--sw-h); overflow: hidden; transform-origin: 0 0; }
html.sw-cw body { transform: translateX(var(--sw-h)) rotate(90deg); }
html.sw-ccw body { transform: translateY(var(--sw-w)) rotate(-90deg); }
html.sw-cw { --safe-l: env(safe-area-inset-top, 0px); --safe-r: env(safe-area-inset-bottom, 0px); --safe-t: 0px; --safe-b: 0px; }
html.sw-ccw { --safe-l: env(safe-area-inset-bottom, 0px); --safe-r: env(safe-area-inset-top, 0px); --safe-t: 0px; --safe-b: 0px; }
/* Same compact layout as a phone held sideways (the max-height: 430px rules), since the screen itself still reads as upright. */
html.sideways .btns { transform: scale(0.85); transform-origin: right bottom; }
html.sideways .h-me { width: 180px; }
html.sideways .h-top { left: calc(var(--safe-l) + 200px); right: calc(var(--safe-r) + 166px); }
html.sideways .h-map { width: 96px; height: 96px; }
html.sideways .h-menu { right: calc(112px + var(--safe-r)); }
html.sideways .h-code { right: calc(112px + var(--safe-r)); top: calc(56px + var(--safe-t)); }
html.sideways .card { min-height: 150px; padding: 10px; }
html.sideways .card p { font-size: 13px; }
html.sideways .abtip { right: calc(240px + var(--safe-r)); width: 230px; }
html.sideways .coach { max-width: min(calc(var(--sw-w) * 0.46), 420px); }
html.sideways .banner span { font-size: 14px; max-width: calc(var(--sw-w) * 0.7); }
html.sideways .banner b { font-size: 34px; }
html.sideways .storycard { max-width: min(calc(var(--sw-w) * 0.44), 420px); }
.rotate .sw-note { font-size: 14px; color: #b7b0c8; margin: 8px 24px 4px; }
.rotate #swBtn { width: auto; padding: 14px 28px; margin-top: 10px; }

/* Shaman element wheel around the Power button */
.wheel { position: absolute; width: 0; height: 0; z-index: 6; pointer-events: none; }
.wopt { position: absolute; left: calc(var(--dx) * 82px - 34px); top: calc(var(--dy) * 82px - 30px); width: 68px; height: 60px; border-radius: 16px; background: rgba(20, 16, 36, 0.92); border: 2px solid rgba(255, 255, 255, 0.45); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; text-shadow: none; }
.wopt span { font-size: 24px; line-height: 1.1; }
.wopt.on { border-color: var(--gold); background: rgba(80, 60, 10, 0.95); transform: scale(1.12); box-shadow: 0 0 14px rgba(255, 200, 87, 0.7); }
.wmid { position: absolute; left: -60px; top: 42px; width: 120px; text-align: center; font-size: 10px; color: #fff; opacity: 0.8; display: none; }

/* Lobby chapter line and picker */
.chapter-note { margin: 4px 0 8px; }
.chapter-note:empty { display: none; }
/* Choose your adventure: cards dealt face down that flip over, like the fortune reading */
.adventure { background: rgba(8, 4, 12, 0.985); display: grid; place-items: center; }
.adv-box { max-width: 720px; width: 100%; margin: 0 auto; text-align: center; }
.adv-box h3 { font-family: Georgia, serif; color: var(--gold); font-size: 24px; margin: 6px 0 2px; }
.adv-box .hint { margin: 0; }
.adv-cards { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 12px 0 4px; perspective: 900px; }
.adv-card { width: 156px; background: none; border: none; color: inherit; font: inherit; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px; border-radius: 14px; cursor: pointer; transition: transform 0.25s, opacity 0.25s; }
.adv-card .flip { width: 120px; height: 150px; position: relative; transform-style: preserve-3d; transform: rotateY(180deg); }
.adv-card.deal .flip { animation: cardflip 0.7s var(--d) both; }
.adv-card .flip > div { position: absolute; inset: 0; backface-visibility: hidden; }
.adv-card .front { transform: rotateY(180deg); }
.adv-card svg { width: 100%; height: 100%; display: block; }
.adv-card b { color: var(--gold); font-family: Georgia, serif; font-size: 17px; margin-top: 6px; }
.adv-card span { font-size: 12.5px; line-height: 1.3; color: #efe6d8; font-weight: 400; }
.adv-card i { font-size: 11.5px; color: #c9b07a; }
.adv-cards:has(.on) .adv-card:not(.on) { opacity: 0.5; }
.adv-card.on { transform: translateY(-6px); }
/* the glow sits on the face itself: a filter on the flipping box would flatten the 3D flip */
.adv-card .front { border-radius: 10px; transition: box-shadow 0.25s; }
.adv-card.on .front { box-shadow: 0 0 16px 3px rgba(230, 180, 80, 0.85); }
.adv-h { margin: 14px 0 6px; color: #c9b07a; text-transform: uppercase; letter-spacing: 1px; font-size: 12px; }
.adv-plates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.plate { text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(230, 180, 80, 0.35); background: rgba(36, 24, 48, 0.85); color: inherit; font: inherit; display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.plate b { color: var(--gold); font-family: Georgia, serif; font-size: 15px; }
.plate span { font-size: 12px; line-height: 1.3; color: #d8cfe0; font-weight: 400; }
.plate.on { border-color: var(--gold); box-shadow: 0 0 10px rgba(230, 180, 80, 0.5); background: rgba(70, 46, 20, 0.6); }
#advGo { margin-top: 14px; width: 100%; }
.adv-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 3px 6px 3px 3px; border-radius: 10px; background: rgba(36, 24, 48, 0.85); border: 1px solid rgba(230, 180, 80, 0.4); font-size: 14px; }
.adv-chip .mini { width: 28px; height: 35px; display: inline-block; flex: none; }
.adv-chip .mini svg { width: 100%; height: 100%; display: block; }
.adv-chip .link { padding: 4px 6px; font-size: 14px; }
.adv-chip .advtxt { line-height: 1.3; }
.adv-chip .advlinks { display: inline-flex; flex: none; }
/* Narrow (a phone upright, beside the join code): two lines at most, with the Map and Change links stacked on the right
   beside the text; on the narrowest phones the small picture goes. */
@media (max-width: 560px) {
  .adv-chip { font-size: 13px; gap: 6px; }
  .adv-chip .advtxt { flex: 1 1 auto; min-width: 0; }
  .adv-chip .advlinks { flex-direction: column; align-items: flex-end; }
  .adv-chip .link { padding: 1px 3px; font-size: 13px; }
}
@media (max-width: 379px) { .adv-chip .mini { display: none; } .adv-chip { padding-left: 8px; } }
@media (prefers-reduced-motion: reduce) { .adv-card.deal .flip { animation-duration: 0.01s; } }
#chapterSeg { margin-bottom: 8px; }

/* Story cards: small, low on the screen, out of the way, gone on their own */
.storycard { position: absolute; left: 50%; bottom: calc(14px + var(--safe-b, 0px)); transform: translateX(-50%); max-width: min(44vw, 420px); z-index: 5;
  font: italic 13px/1.35 Georgia, serif; color: #efe6d8; background: rgba(20, 14, 24, 0.72); border: 1px solid rgba(230, 180, 80, 0.4);
  border-radius: 10px; padding: 6px 12px; opacity: 0; transition: opacity 0.6s; pointer-events: none; }
.storycard.on { opacity: 1; pointer-events: auto; }
/* QA 2026-11-21: a long story card folds to one line after a few seconds (a tap opens it again), sits above the ready row
   while the row shows a button, and steps aside while a toast shows. Story cards never sit over buttons or toasts. */
.storycard.fold { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(56vw, 420px); }
.storycard.fold::before { content: '📜 '; font-style: normal; }
body:has(.readyrow > :not(.hidden)) .storycard { bottom: calc(72px + var(--safe-b, 0px)); }
body:has(#toast:not(.hidden)) .storycard.on { opacity: 0; pointer-events: none; }
/* The fortune-teller's reading and the story log */
.reading { position: absolute; inset: 0; z-index: 40; pointer-events: auto; background: rgba(8, 4, 12, 0.86); display: grid; place-items: center; overflow-y: auto; padding: 12px; }
.reading-box { max-width: 900px; text-align: center; }
.reading-box h3 { font-family: Georgia, serif; color: var(--gold); margin: 4px 0; }
.reading-box .hint { margin: 0 0 8px; font-size: 13px; }
.rcards { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 10px; }
.rcard { width: 132px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; line-height: 1.25; }
.rcard .flip { width: 96px; height: 120px; position: relative; transform-style: preserve-3d; animation: cardflip 0.7s var(--d) both; }
.rcard .flip > div { position: absolute; inset: 0; backface-visibility: hidden; }
.rcard .front { transform: rotateY(180deg); }
.rcard small { color: #c9b07a; text-transform: uppercase; letter-spacing: 0.5px; font-size: 10px; margin-top: 4px; }
.rcard b { font-size: 13px; }
.rcard span { color: #efe6d8; }
.rcard i { color: #a99cc0; font-size: 10.5px; }
@keyframes cardflip { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }
.story-log { max-width: 560px; text-align: left; background: var(--panel); padding: 14px 18px; border-radius: 14px; }
.story-log p { font: italic 14px/1.45 Georgia, serif; color: #efe6d8; margin: 0 0 10px; }

/* Gate button: small, next to the ability buttons, only while standing at a gate */
.gatebtn { position: absolute; right: calc(250px + var(--safe-r)); bottom: calc(104px + var(--safe-b)); padding: 9px 14px; border-radius: 999px;
  border: 2px solid rgba(230, 180, 80, 0.7); background: rgba(30, 22, 14, 0.78); color: #f3e6cf; font-weight: 700; font-size: 14px; }
.gatebtn.broken { opacity: 0.6; }
.gatebtn .ginfo { display: inline-block; margin: -6px -8px -6px 10px; padding: 6px 10px; border-left: 1px solid rgba(230, 180, 80, 0.5); font-size: 16px; }
/* The notes' handwriting: Caveat (Google Fonts, SIL Open Font License, public/fonts/OFL-Caveat.txt), Latin letters, one variable file for every weight. */
@font-face { font-family: 'Caveat'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/fonts/Caveat-latin.woff2') format('woff2'); }
/* Readable notes: a scorched, crumpled page over the game (owner 2026-11-13). Tall upright, wide sideways. */
.notepop { position: absolute; inset: 0; z-index: 60; background: rgba(8, 5, 10, 0.5); }
.notepop .npaper { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-2deg); width: min(440px, 88%, calc((100% - 56px) * 0.77)); container-type: inline-size; }
.notepop.wide .npaper { width: min(620px, 80%); }
.notepop .npaper svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.7)); }
.notepop .ntext { position: absolute; left: 10%; right: 16%; top: 9%; bottom: 14%; color: #3a2614; overflow: hidden;
  font-family: 'Caveat', 'Bradley Hand', 'Noteworthy', 'Segoe Print', 'Comic Sans MS', cursive; font-weight: 500; font-size: 5.6cqw; line-height: 1.16; }
.notepop.wide .ntext { left: 8%; right: 9%; top: 9%; bottom: 17%; font-size: 4.1cqw; }
.notepop .ntext::before { content: ''; float: right; width: 26%; height: 24%; shape-outside: ellipse(100% 100% at 100% 0); }
.notepop.wide .ntext::before { width: 22%; height: 30%; }
.notepop .ntext p { margin: 0 0 0.45em; }
.notepop .ntext .nsig { text-align: right; font-weight: 700; margin-top: 0.3em; padding-right: 0.25em; } /* room for the slanted last letter */
.notepop .nhint { position: absolute; left: 50%; bottom: calc(14px + var(--safe-b, 0px)); transform: translateX(-50%); color: #f3e6cf; font-size: 14px; opacity: 0.85;
  background: rgba(30, 22, 14, 0.7); padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(230, 180, 80, 0.5); white-space: nowrap; }
/* Omen cards: the flip at the start of a Long Night run, and the line in the menu (owner 2026-11-13) */
.omenpop { position: absolute; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; gap: 22px; background: rgba(8, 5, 12, 0.82); color: #f3e6cf; }
.omenpop .ocard { width: min(200px, 34vh, 42vw); aspect-ratio: 120 / 150; perspective: 900px; flex: none; }
.omenpop .oflip { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateY(180deg); transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
.omenpop.flipped .oflip { transform: rotateY(0deg); }
.omenpop .oface { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.omenpop .oback { transform: rotateY(180deg); }
.omenpop .oface svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 18px rgba(230, 180, 80, 0.35)); }
.omenpop .owords { max-width: 300px; display: flex; flex-direction: column; gap: 8px; opacity: 0; transform: translateY(6px); transition: opacity 0.5s 0.7s, transform 0.5s 0.7s; }
.omenpop.flipped .owords { opacity: 1; transform: none; }
.omenpop small, .omenrow small { letter-spacing: 0.16em; text-transform: uppercase; font-size: 12px; opacity: 0.8; }
.omenpop h2 { margin: 0; font-family: Georgia, serif; font-size: 30px; color: #ffd98a; line-height: 1.05; }
.omenpop .og, .omenrow .og { color: #ffd36b; font-size: 16px; } .omenpop .or, .omenrow .or { color: #ff8a7a; font-size: 16px; }
.omenpop .otap { position: absolute; left: 50%; bottom: calc(14px + var(--safe-b, 0px)); transform: translateX(-50%); font-size: 13px; opacity: 0.8; background: rgba(30, 22, 14, 0.7);
  padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(230, 180, 80, 0.5); white-space: nowrap; }
/* tall = the HUD is taller than wide (an upright phone, not one turned sideways by the game) */
.omen-open > .banner, .omen-open > .storycard { visibility: hidden; }
.omenpop.tall { flex-direction: column; text-align: center; } .omenpop.tall .ocard { width: min(220px, 56%); }
.omenrow { display: flex; gap: 12px; align-items: center; padding: 10px; margin-bottom: 10px; border-radius: 12px; border: 1px solid rgba(230, 180, 80, 0.45); background: rgba(30, 22, 14, 0.55); }
.omenrow .omini { width: 56px; flex: none; } .omenrow .omini svg { width: 100%; height: auto; display: block; }
.omenrow > div:last-child { display: flex; flex-direction: column; gap: 3px; } .omenrow b { color: #ffd98a; font-size: 17px; } .omenrow .og, .omenrow .or { font-size: 14px; }
/* The hammer game strip above a Repair button */
.hammer { position: absolute; right: calc(250px + var(--safe-r)); bottom: calc(152px + var(--safe-b)); width: 210px; padding: 6px 10px 8px; border-radius: 12px;
  border: 2px solid rgba(230, 180, 80, 0.7); background: rgba(30, 22, 14, 0.82); color: #f3e6cf; pointer-events: none; text-align: center; }
.hammer small { display: block; font-size: 11px; opacity: 0.85; margin-bottom: 4px; }
.hammer .hbar { position: relative; height: 18px; border-radius: 9px; background: rgba(255, 255, 255, 0.12); }
.hammer .hnail { position: absolute; left: 39%; width: 22%; top: 0; bottom: 0; border-radius: 9px; background: rgba(255, 196, 80, 0.55); }
.hammer .hhead { position: absolute; top: -7px; transform: translateX(-50%); font-size: 22px; line-height: 1; }
.hammer.hit .hnail { animation: nailed 0.35s ease-out; }
@keyframes nailed { 0% { background: #fff3c4; box-shadow: 0 0 12px #ffd36b; } 100% { background: rgba(255, 196, 80, 0.55); box-shadow: none; } }
.gateinfo { position: absolute; right: calc(250px + var(--safe-r)); bottom: calc(150px + var(--safe-b)); max-width: min(320px, 60vw); padding: 10px 14px;
  border-radius: 12px; border: 2px solid rgba(230, 180, 80, 0.7); background: rgba(30, 22, 14, 0.92); color: #f3e6cf; font-size: 14px; line-height: 1.35; }

/* Online: join with the host's 4-letter code */
.code-join { display: flex; gap: 8px; margin: 6px 0; }
.invite-note { margin: 6px 0; padding: 8px 12px; border-radius: 10px; background: rgba(255, 200, 87, 0.15); border: 1px solid rgba(255, 200, 87, 0.5); text-align: center; font-weight: 600; }
.code-join input { flex: 1 1 auto; width: auto; min-width: 0; font-size: 20px; letter-spacing: 4px; text-transform: uppercase; text-align: center; padding: 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.25); background: rgba(0,0,0,0.3); color: inherit; }
.code-join .big { flex: 0 0 auto; width: auto; margin: 0; padding-left: 28px; padding-right: 28px; }

/* ---------- upright play (phone upright and not using sideways mode): keep pop-ups off the middle and the buttons ---------- */
@media (orientation: portrait) {
  html:not(.sideways) .h-me { width: 180px; }
  html:not(.sideways) .h-top { left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); top: calc(136px + var(--safe-t)); }
  html:not(.sideways) .coach { max-width: 100%; }
  html:not(.sideways) .intro { top: calc(214px + var(--safe-t)); left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); width: auto; transform: none; padding: 8px 10px; }
  html:not(.sideways) .abtip { right: auto; left: calc(10px + var(--safe-l)); bottom: calc(286px + var(--safe-b)); width: min(320px, calc(100% - 20px)); }
  html:not(.sideways) .cardbtn { bottom: calc(286px + var(--safe-b)); white-space: nowrap; }
  html:not(.sideways) .readyrow { bottom: calc(286px + var(--safe-b)); }
  html:not(.sideways) .storycard { bottom: calc(340px + var(--safe-b)); max-width: calc(100% - 40px); }
  html:not(.sideways) body:has(.readyrow > :not(.hidden)) .storycard { bottom: calc(340px + var(--safe-b)); }
  html:not(.sideways) .storycard.fold { max-width: calc(100% - 60px); }
  /* The bell's countdown sits above the hero's head, clear of the ready row (QA 2026-11-21). */
  html:not(.sideways) .countdown { top: calc(40% + var(--safe-t)); }
  html:not(.sideways) .sheet { justify-content: flex-end; padding-bottom: calc(16px + var(--safe-b)); }
  html:not(.sideways) .cards { flex-direction: column; align-items: stretch; max-width: 380px; }
  html:not(.sideways) .card { min-height: 0; flex: none; max-width: none; padding: 10px; }
  html:not(.sideways) .menu .cols { grid-template-columns: 1fr; }
  html:not(.sideways) .banner span { max-width: 90vw; }
  /* Upright the top line sits under the minimap (136 px), so a banner starts below it and its coach line instead of over them. */
  html:not(.sideways) .banner { top: calc(196px + var(--safe-t)); transform: translateX(-50%); }
  html:not(.sideways) .toast { bottom: calc(286px + var(--safe-b)); }
  html:not(.sideways) body:has(.readyrow > :not(.hidden)) .toast { bottom: calc(344px + var(--safe-b)); }
}
/* A toast goes just above the ready row while the row shows a button, so it never hides one (QA 2026-11-21). */
body:has(.readyrow > :not(.hidden)) .toast { bottom: calc(70px + var(--safe-b)); }

/* Hold to aim: a short card while aiming, and the held button glows. */
html .abtip.aimtip { top: calc(64px + var(--safe-t, 0px)); bottom: auto; left: 50%; right: auto; transform: translateX(-50%); width: max-content; max-width: min(340px, calc(100% - 20px)); padding: 6px 12px; text-align: center; }
.abtip.aimtip b { font-size: 16px; margin: 0; }
.abtip.aimtip p { margin: 0; font-size: 12.5px; }
.abtip.aimtip p.ffwarn { color: #ff9a7a; font-weight: 600; }
.btn.aiming { box-shadow: 0 0 0 3px rgba(255, 210, 122, 0.85), 0 0 18px rgba(255, 210, 122, 0.6); }
.menu .netline { margin: 2px 0 6px; font-size: 12px; opacity: 0.65; }
.toggle.vol input[type=range] { width: min(55%, 220px); accent-color: var(--gold); }
/* The Long Night: door prices and lucky drops over the manor. */
.lnprice { font: 700 12px system-ui, sans-serif; color: #ffe2a8; padding: 2px 8px; border-radius: 8px; background: rgba(20, 12, 28, 0.78); border: 1px solid rgba(230, 180, 80, 0.55); white-space: nowrap; }
.lndrop { font-size: 26px; filter: drop-shadow(0 0 6px rgba(255, 210, 120, 0.9)); }

/* Expedition calls (owner 2026-11-14): the Call ready button (temporary spot: the gate button's) and the two calls. */
.callbtn { border-color: #ffd36b; box-shadow: 0 0 14px rgba(255, 200, 87, 0.55); }
.callbtn.open { background: rgba(60, 44, 20, 0.9); }
.callbtn.jammed { border-color: #9d97b8; box-shadow: none; filter: grayscale(0.7); opacity: 0.75; } /* in a fog totem's fog */
.callbtn .badge { display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--gold); color: #2a1a00; font-size: 12px; line-height: 18px; text-align: center; text-shadow: none; }
.callchips { position: absolute; display: flex; flex-direction: column; gap: 8px; z-index: 4; }
.callchip { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: 999px; border: 2px solid rgba(230, 180, 80, 0.7); background: rgba(30, 22, 14, 0.88); color: #f3e6cf; font-size: 14px; white-space: nowrap; }
.callchip .ci { font-size: 20px; line-height: 1; }
.callchip b { display: block; font-size: 14px; }
.callchip small { display: block; font-size: 10.5px; font-weight: 600; opacity: 0.8; }
.callchip.wait { opacity: 0.55; filter: grayscale(0.8); }
.callchip.held { border-color: #ff8a7a; box-shadow: 0 0 0 3px rgba(255, 120, 100, 0.45), 0 0 16px rgba(255, 120, 100, 0.5); }
/* The hero screen's "Your calls. Pick 2" (Expedition only). */
.call-pick { margin: 6px 0 10px; }
.call-pick h3 { margin: 4px 0 6px; font-size: 1rem; } .call-pick h3 span { color: var(--dim); font-weight: 400; font-size: 0.85rem; }
.call-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.call-card { position: relative; text-align: left; padding: 8px 10px; border-radius: 14px; background: var(--panel2); border: 2px solid transparent; color: var(--dim); font-size: 0.8rem; line-height: 1.3; }
.call-card .ci { font-size: 1.5rem; } .call-card b { display: block; color: var(--text); font-size: 0.95rem; margin: 2px 0; }
.call-card.on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 200, 87, 0.25); }
.call-card.on::after { content: '✓'; position: absolute; top: 6px; right: 9px; color: var(--green); font-weight: 800; }
.call-card .ff { color: #ff9a7a; font-weight: 600; }
/* Lock picking (owner 2026-11-14): the panel with the padlock and the pick, styled like the hammer strip. */
.lockp { position: absolute; left: 12px; top: 96px; width: 230px; box-sizing: border-box; padding: 6px 10px 8px; border-radius: 12px; border: 2px solid rgba(230, 180, 80, 0.7);
  background: rgba(30, 22, 14, 0.86); color: #f3e6cf; text-align: center; pointer-events: none; z-index: 5; }
.lockp.tall { width: 214px; }
.lockp small { display: block; font-size: 11px; opacity: 0.9; line-height: 1.25; min-height: 2.5em; }
.lockp .stage { position: relative; height: 104px; margin-top: 2px; }
.lockp .ring { position: absolute; left: 50%; top: 2px; width: 84px; height: 84px; margin-left: -42px; border-radius: 50%;
  background: conic-gradient(#ffd36b calc(var(--p, 0) * 1%), rgba(255, 255, 255, 0.1) 0);
  -webkit-mask: radial-gradient(circle, transparent 36px, #000 37px); mask: radial-gradient(circle, transparent 36px, #000 37px); }
.lockp .lk { position: absolute; left: 50%; top: 9px; height: 70px; transform: translateX(-50%); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.8)); }
.lockp .lk.ghost { opacity: 0; filter: blur(0.6px); }
.lockp .shake { position: absolute; top: 26px; font-size: 22px; line-height: 1; color: #ffd98a; letter-spacing: -3px; }
.lockp .shake.l { right: calc(50% + 44px); } .lockp .shake.r { left: calc(50% + 44px); }
.lockp .arc { position: absolute; left: 50%; top: 18px; width: 150px; height: 75px; margin-left: -75px; border: 2px dashed rgba(243, 230, 207, 0.25); border-top: none; border-radius: 0 0 75px 75px; }
.lockp .pk { position: absolute; left: 50%; top: 52px; width: 62px; margin-left: -62px; transform-origin: 100% 40%; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9)); }
.lockp .foot { display: flex; justify-content: space-between; align-items: center; font-size: 11px; margin-top: 2px; min-height: 14px; }
.lockp .tier { color: #ffd98a; } .lockp .guard { color: #9fe8ff; }
.lockp .pins i { display: inline-block; width: 9px; height: 9px; margin-left: 4px; border-radius: 50%; border: 1px solid #ffd98a; vertical-align: -1px; }
.lockp .pins i.on { background: #ffd98a; }
.lockp .flash { position: absolute; left: 0; right: 0; top: 34px; font-size: 18px; font-weight: 800; color: #ff8a7a; text-shadow: 0 0 8px #000, 0 2px 2px #000; }
.lockp.snap { border-color: #ff6b6b; background: rgba(60, 14, 14, 0.9); }
.lockp.snap .ring { background: rgba(255, 90, 90, 0.35); }
.lockp.open { border-color: #5ee07a; }
.lockp.open .ring { background: conic-gradient(#5ee07a 100%, transparent 0); }
.gatebtn.held { border-color: #ffd36b; box-shadow: 0 0 0 3px rgba(255, 210, 122, 0.5), 0 0 16px rgba(255, 210, 122, 0.5); }
.gatebuy { position: absolute; padding: 5px 12px; border-radius: 999px; border: 1px solid rgba(230, 180, 80, 0.6); background: rgba(30, 22, 14, 0.78); color: #f3e6cf; font-weight: 700; font-size: 13px; }
/* Over a hero picking a lock, on everyone's phone: a padlock with a ring that fills as the lock turns. */
.lnlockl { display: flex; flex-direction: column; align-items: center; transform: translateY(-6px); pointer-events: none; }
.lnlockl .lr { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px;
  background: radial-gradient(circle, rgba(30, 22, 14, 0.9) 58%, transparent 60%), conic-gradient(#ffd36b calc(var(--p, 0) * 1%), rgba(255, 255, 255, 0.2) 0); }
.lnlockl.snap .lr { background: radial-gradient(circle, rgba(60, 14, 14, 0.95) 58%, transparent 60%), conic-gradient(#ff6b6b 100%, transparent 0); }
.lnlockl .gd { font: 700 11px system-ui, sans-serif; color: #9fe8ff; text-shadow: 0 1px 2px #000; }
/* A teammate standing guard by a hero who is picking a lock. */
.nametag.guarding::before { content: '🛡 '; color: #9fe8ff; }

/* "Game updated" (owner 2026-11-14): a small notice under your health with a Reload button. */
.updnote { position: absolute; left: calc(10px + var(--safe-l)); top: 96px; z-index: 6; display: flex; align-items: center; gap: 10px; max-width: min(320px, calc(100% - 20px));
  padding: 7px 8px 7px 12px; border-radius: 12px; border: 2px solid rgba(230, 180, 80, 0.75); background: rgba(30, 22, 14, 0.9); color: #f3e6cf; text-shadow: none; }
.updnote b { display: block; font-size: 13px; }
.updnote small { display: block; font-size: 11.5px; font-weight: 600; opacity: 0.85; line-height: 1.25; }
.updnote .updbtn { flex: none; padding: 8px 14px; border-radius: 999px; border: none; background: linear-gradient(180deg, var(--gold), var(--gold2)); color: #2a1a00; font-weight: 800; font-size: 14px; }
/* The version, small, at the foot of the menu. */
.menu .verline { margin: 10px 0 2px; font-size: 11px; opacity: 0.5; text-align: center; }

/* The menu sits above the story text, the update notice and the other HUD pieces (owner 2026-11-14). */
.menu { z-index: 30; }

/* The update notice while the game is paused: bottom middle, above the pause screen. */
.updnote.inpause { z-index: 8; top: auto !important; bottom: calc(16px + var(--safe-b, 0px)); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(420px, calc(100% - 24px)); }

/* The story text hides while the menu is open (coordinator 2026-11-14). */
.menu-open > .storycard { visibility: hidden; }

/* One ready row (owner 2026-11-14, option 2 of the clutter study): where you stand first, then Call ready, then
   level-up and object cards, in the bottom middle. The first shows in full, the rest as small chips. */
.readyrow { position: absolute; left: 0; right: 0; bottom: calc(14px + var(--safe-b)); display: flex; justify-content: center; align-items: center; gap: 8px; }
html body .readyrow > .gatebtn, html body .readyrow > .cardbtn { position: relative; left: auto; right: auto; bottom: auto; transform: none; white-space: nowrap; }
.readyrow > .gatebtn:not(.chip) { padding: 11px 18px; font-size: 16px; }
.readyrow > .chip { padding: 8px 12px; font-size: 18px; line-height: 1.1; }
.readyrow > .cardbtn.chip { box-shadow: 0 0 12px rgba(255, 200, 87, 0.75); }
.readyrow .badge { display: inline-block; margin-left: 4px; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--gold); color: #2a1a00; font-size: 12px; line-height: 18px; text-align: center; vertical-align: middle; text-shadow: none; }
.readyrow > .cardbtn .badge { background: #2a1a00; color: var(--gold); }

/* The map of the isles (Expedition, PLAN-expedition-followups.md step 4): the chart left and the isle's panel right
   when sideways; the chart on top and the panel under it when upright. */
.islemap { background: rgba(8, 4, 12, 0.985); padding: max(10px, var(--safe-t)) max(10px, var(--safe-r)) max(10px, var(--safe-b)) max(10px, var(--safe-l)); }
.im-box { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 300px); gap: 10px; height: 100%; max-width: 1280px; margin: 0 auto; }
.im-map { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.im-map svg { width: 100%; height: 100%; max-height: 100%; display: block; border-radius: 14px; }
.im-panel { position: relative; min-width: 0; overflow: auto; background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.im-panel h3 { margin: 0 34px 0 0; font-family: Georgia, serif; color: var(--gold); font-size: 21px; font-variant: small-caps; }
.im-panel h4 { margin: 6px 0 2px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.im-sub { margin: 0; color: var(--dim); font-size: 13px; }
.im-bar { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.im-bar i, .ri-bar i { width: 22px; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.16); display: inline-block; }
.im-bar i.on, .ri-bar i.on { background: var(--gold2); }
.im-bar span { margin-left: 6px; }
.im-missions { display: flex; flex-direction: column; gap: 6px; }
.im-missions button { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); font-weight: 600; }
.im-missions button.on { border-color: var(--gold); background: rgba(255, 200, 87, 0.12); }
.im-missions button:disabled { opacity: 1; cursor: default; }
.im-gives { margin: 2px 0; font-size: 13px; color: var(--dim); }
.im-lock { margin: 6px 0; color: var(--dim); }
.im-panel button.big { margin-top: auto; }
/* Sideways the panel is shorter than its contents: the Sail button stays at its bottom edge instead of below the fold. */
.im-panel > button.big:last-child { position: sticky; bottom: 0; box-shadow: 0 -8px 16px rgba(20, 16, 30, 0.85), 0 14px 0 4px var(--panel2); }
.im-close { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); font-size: 16px; }
.im-isle { cursor: pointer; }
.im-isle.locked { filter: saturate(0.25) brightness(0.85); opacity: 0.6; }
.im-isle:focus { outline: none; }
.im-name { font-family: Georgia, serif; font-variant: small-caps; font-size: 24px; font-weight: 700; fill: #3a2a1a; text-anchor: middle; paint-order: stroke; stroke: #e9dcbb; stroke-width: 5px; stroke-linejoin: round; }
.im-status { font-size: 15px; fill: #3a2a1a; text-anchor: middle; paint-order: stroke; stroke: #e9dcbb; stroke-width: 4px; stroke-linejoin: round; }
.im-far { font-family: Georgia, serif; font-variant: small-caps; font-size: 22px; fill: #3a2a1a; text-anchor: middle; opacity: 0.8; }
.im-far.locked { opacity: 0.5; }
.im-n { font-family: Georgia, serif; font-size: 16px; fill: #3a2a1a; text-anchor: middle; }
@media (max-aspect-ratio: 1/1) {
  .im-box { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; height: auto; }
  .im-map svg { height: auto; }
  .im-name { font-size: 36px; stroke-width: 7px; }
  .im-status { font-size: 26px; stroke-width: 6px; }
  .im-far { font-size: 30px; }
}
.rep-isle { margin: 8px auto 4px; max-width: 520px; padding: 10px 12px; border-radius: 12px; background: var(--panel2); border: 1px solid rgba(255, 200, 87, 0.35); text-align: center; }
.rep-isle p { margin: 6px 0 0; }
.ri-bar { display: flex; justify-content: center; gap: 6px; }
.ri-bar i.new { animation: riFill 0.9s ease-out 0.4s both; }
@keyframes riFill { from { background: rgba(255, 255, 255, 0.16); transform: scaleX(0.4); } to { background: var(--gold2); transform: scaleX(1); } }

/* Carrying the Expedition's reliquary: Power and Special are out of reach (2026-11-21). */
.carrying { opacity: 0.35; filter: grayscale(1); }
.im-mtext { margin: 6px 0 0; font-size: 0.9em; opacity: 0.85; }

/* Operations on the isles map and in the report (2026-11-21). */
.im-ops button { text-align: left; line-height: 1.35; }
/* The report's two kinds of progress (QA 2026-11-21): the operation, then the isle's bar, each under its own heading. */
.rep-isle h5 { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.rep-isle .ri-sec + .ri-sec { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 200, 87, 0.25); }
.ri-opbar i { width: 34px; }
.ri-bar i.lost { background: #d0574f; }
/* Device mini games (2026-11-21, public/devices.js): the rune code, the sigil, the runes to light and the mark, in the
   look of the lock picking panel. One grid; each game's parts take their places in it (upright above the device's
   button, sideways on the left under your health). */
.devp { position: absolute; left: 12px; top: 96px; z-index: 6; display: grid; gap: 6px 8px; align-items: center; justify-items: center; width: 300px;
  padding: 6px 10px 8px; border-radius: 12px; border: 2px solid rgba(230, 180, 80, 0.7); background: rgba(30, 22, 14, 0.9); color: #f3e6cf;
  text-align: center; touch-action: none; grid-template-areas: "head" "help" "body" "foot"; }
.devp .dbody { display: contents; }
.devp .dhead { grid-area: head; justify-self: stretch; display: flex; align-items: center; gap: 8px; min-height: 26px; }
.devp .dname { flex: 1; text-align: left; font-size: 13px; color: #ffd98a; }
.devp .dguard { font-size: 11px; color: #9fe8ff; white-space: nowrap; }
.devp .dx { width: 36px; height: 28px; padding: 0; border-radius: 8px; border: 1px solid rgba(230, 180, 80, 0.5); background: rgba(60, 44, 20, 0.8); font-size: 14px; }
.devp .dhelp { grid-area: help; display: block; justify-self: stretch; font-size: 11.5px; line-height: 1.3; min-height: 2.6em; opacity: 0.92; }
.devp .dfoot { grid-area: foot; justify-self: stretch; }
.devp .dbar { display: block; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.devp .dbar i { display: block; height: 100%; width: calc(var(--p, 0) * 1%); background: #ffd36b; transition: width 0.15s; }
.devp button { touch-action: none; }
.devp.done { border-color: #5ee07a; }
.devp.done .dbar i { background: #5ee07a; }
.devp.bad { border-color: #ff6b6b; }
.devp.jolt { animation: devjolt 0.35s; }
@keyframes devjolt { 20% { transform: translateX(-7px) rotate(-1.2deg); } 45% { transform: translateX(6px) rotate(1deg); } 70% { transform: translateX(-3px); } }
@keyframes devpulse { 50% { box-shadow: 0 0 0 3px rgba(255, 216, 138, 0.45), 0 0 12px rgba(255, 216, 138, 0.6); } }

/* Rune code: the row of runes to enter, and four arrows. */
.devp.k-runes { grid-template-areas: "head" "help" "row" "pad" "foot"; }
.devp.k-runes.wide { width: 296px; grid-template-columns: 1fr auto; grid-template-areas: "head head" "row row" "help pad" "foot pad"; }
.devp.k-runes.wide .dhelp { align-self: center; text-align: left; }
.devp .rrow { grid-area: row; display: flex; gap: 4px; justify-content: center; min-height: 38px; }
.devp .rn { display: grid; place-items: center; width: 32px; height: 38px; border-radius: 7px; background: linear-gradient(#3a2f25, #241b14); border: 1px solid rgba(230, 180, 80, 0.35); }
.devp .rn svg, .devp .ra svg { width: 20px; height: 20px; fill: #a08c72; transform: rotate(var(--r, 0deg)); }
.devp .rn.ok { background: rgba(255, 211, 107, 0.22); border-color: #ffd36b; box-shadow: 0 0 8px rgba(255, 211, 107, 0.6); }
.devp .rn.ok svg { fill: #ffe39a; }
.devp .rn.cur { border-color: #f3e6cf; animation: devpulse 0.9s infinite; }
.devp.bad .rn { border-color: #ff6b6b; } .devp.bad .rn svg { fill: #ff8a7a; }
.devp .rpad { grid-area: pad; display: grid; grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(3, 50px); gap: 4px; grid-template-areas: ". u ." "l c r" ". d ."; }
.devp.wide .rpad { grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(3, 48px); }
.devp .ra { display: grid; place-items: center; padding: 0; border-radius: 12px; border: 2px solid rgba(230, 180, 80, 0.7); background: rgba(60, 44, 20, 0.92); }
.devp .ra svg { width: 26px; height: 26px; fill: #ffd98a; }
.devp .ra.on { background: #ffd36b; } .devp .ra.on svg { fill: #2a1a00; }
.devp .rmid { grid-area: c; display: flex; gap: 4px; align-items: center; justify-content: center; }
.devp .rmid i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid #ffd98a; }
.devp .rmid i.on { background: #ffd98a; } .devp .rmid i.cur { box-shadow: 0 0 6px #ffd98a; }

/* Align the sigil: a ring to turn around a sigil that glows as it lines up, and two turn buttons. */
.devp.k-sigil { column-gap: 6px; grid-template-columns: 52px auto 52px; grid-template-areas: "head head head" "help help help" "ccw stage cw" "meter meter meter" "foot foot foot"; }
.devp .sstage { grid-area: stage; position: relative; width: 164px; height: 164px; touch-action: none; }
.devp.wide .sstage { width: 148px; height: 148px; }
.devp .sstage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.devp .sring { fill: none; stroke: #8c7a63; stroke-width: 5; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8)); }
.devp .sring g { stroke: #5e5143; stroke-width: 2; }
.devp .sring .notch { fill: #ffd36b; stroke: #2a1a00; stroke-width: 1; }
.devp .stgt { fill: #9fe8ff; opacity: 0.7; }
.devp .sstage .ssig { inset: 22%; width: 56%; height: 56%; fill: rgba(255, 216, 138, calc(0.18 + var(--sig, 0) * 0.82)); stroke: #ffd98a; stroke-width: 1.5;
  filter: drop-shadow(0 0 calc(var(--sig, 0) * 12px) rgba(255, 200, 90, 0.95)); }
.devp .shold { position: absolute; inset: 18%; border-radius: 50%; background: conic-gradient(#5ee07a calc(var(--h, 0) * 1%), rgba(255, 255, 255, 0.08) 0);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 64%); mask: radial-gradient(circle, transparent 62%, #000 64%); }
.devp.aligned .sring .notch { fill: #fff1c4; }
.devp .sbtn { width: 52px; height: 64px; padding: 0; border-radius: 12px; border: 2px solid rgba(230, 180, 80, 0.7); background: rgba(60, 44, 20, 0.92); font-size: 26px; line-height: 1; color: #ffd98a; }
.devp .sbtn.ccw { grid-area: ccw; } .devp .sbtn.cw { grid-area: cw; }
.devp .sbtn.on { background: #ffd36b; color: #2a1a00; }
.devp .smeter { grid-area: meter; justify-self: stretch; position: relative; display: flex; align-items: center; justify-content: center; height: 14px; border-radius: 7px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.devp .smeter i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #8c6a2a, #ffd36b); }
.devp .smeter b { position: relative; font-size: 10px; line-height: 1; color: #fff3d6; }

/* Light the runes: a grid of runes to tap. */
.devp.k-lights { grid-template-areas: "head" "help" "lgrid" "foot"; }
.devp .lgrid { grid-area: lgrid; display: grid; grid-template-columns: repeat(var(--cols, 4), 60px); gap: 8px; }
.devp .lru { position: relative; display: grid; place-items: center; width: 60px; height: 60px; padding: 0; border-radius: 12px; border: 2px solid rgba(230, 180, 80, 0.35);
  background: radial-gradient(circle, #3a2f25, #1d1610); }
.devp .lru svg { width: 34px; height: 34px; fill: none; stroke: #7a6852; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.devp .lru b { position: absolute; top: 2px; left: 6px; font-size: 12px; color: #ffd98a; }
.devp .lru.lit { border-color: #ffd36b; background: radial-gradient(circle, rgba(255, 190, 90, 0.6), #3a2610); box-shadow: 0 0 14px rgba(255, 190, 80, 0.75); }
.devp .lru.lit svg { stroke: #fff1c4; filter: drop-shadow(0 0 4px #ffb84d); }
.devp .lru.next { animation: devpulse 0.9s infinite; border-color: #f3e6cf; }
.devp .lru.out { animation: devout 0.6s; }
.devp .lru.focus { outline: 2px dashed #9fe8ff; outline-offset: 2px; }
@keyframes devout { 0% { background: #ff8a4a; } 100% { background: radial-gradient(circle, #3a2f25, #1d1610); } }

/* Set the mark: a lettered grid, the cell to mark and the Set button. */
.devp.k-mark { width: auto; grid-template-columns: auto 104px; grid-template-areas: "head head" "grid help" "grid side" "foot foot"; }
.devp.k-mark .dhelp { align-self: end; text-align: left; min-height: 0; }
.devp .mgrid { grid-area: grid; display: grid; grid-template-columns: 16px repeat(var(--n), var(--c)); grid-template-rows: 14px repeat(var(--n), var(--c)); touch-action: none; }
.devp .mgrid .lab { display: grid; place-items: center; font-size: 10px; color: #ffd98a; }
.devp .mc { position: relative; border: 1px solid rgba(243, 230, 207, 0.14); background: rgba(255, 255, 255, 0.03); }
.devp .mc.tg::after { content: '★'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; color: rgba(159, 232, 255, 0.85); font-style: normal; }
.devp .mc.set { background: rgba(94, 224, 122, 0.3); }
.devp .mc.cur::before { content: ''; position: absolute; inset: 2px; border-radius: 50%; border: 3px solid #ffd36b; box-shadow: 0 0 8px rgba(255, 211, 107, 0.8); z-index: 1; }
.devp .mside { grid-area: side; align-self: start; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.devp .mtgt b { display: block; font-size: 28px; line-height: 1.1; color: #ffd98a; }
.devp .mtgt small { display: block; font-size: 10.5px; opacity: 0.85; }
.devp .mset { height: 54px; padding: 0; border-radius: 12px; border: none; background: linear-gradient(180deg, var(--gold), var(--gold2)); color: #2a1a00; font-size: 18px; font-weight: 800; }
