/* Layout: full-bleed abyss canvas; readout floats over the scene; colony ledger docks right (bottom sheet on phones).
   Single dark world by choice: the abyss has no light theme. */
:root {
  --abyss: #03060b;
  --ink: #d3e2e3;
  --dim: #93a9b0;
  --faint: #6d838b;
  --glow: #7ff5e3;
  --ember: #ff6b78;
  --frost: #eef6c8;
  --gold: #f0c46e;
  --violet: #c7b6f2;
  --line: rgba(127, 245, 227, 0.13);
  --panel: rgba(5, 12, 19, 0.86);
  --display: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --body: 'IBM Plex Sans Condensed', 'Arial Narrow', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --panel-w: 380px;
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
body { background: var(--abyss); color: var(--ink); font-family: var(--body); font-size: 14px; overflow: hidden; -webkit-tap-highlight-color: transparent; margin: 0; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: manipulation; }
#scene.over-creature { cursor: pointer; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible { outline: 1px solid var(--glow); outline-offset: 2px; }

/* ---- readout ---- */
.hud { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 18px); left: max(20px, env(safe-area-inset-left, 0px)); pointer-events: none; display: grid; gap: 2px; z-index: 3; }
.brand { font-family: var(--display); font-style: italic; font-weight: 300; font-size: 22px; letter-spacing: 0.02em; color: var(--glow); text-shadow: 0 0 18px rgba(127,245,227,.35); }
.whale-id { font-size: 12px; color: var(--dim); letter-spacing: .04em; }
.whale-id i { font-family: var(--display); font-size: 14px; }
.age { font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; margin-top: 4px; }

.readout { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 14px); left: 0; width: calc(100% - var(--panel-w)); display: grid; justify-items: center; pointer-events: none; z-index: 2; padding-inline: 16px; box-sizing: border-box; }
.mass { font-family: var(--display); font-weight: 300; font-size: clamp(44px, 7.5vw, 84px); line-height: 1; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.01em; color: var(--ink); text-shadow: 0 0 30px rgba(127,245,227,.12); }
.mass small { font-size: .42em; color: var(--dim); margin-left: .12em; }
.sub { display: flex; gap: 14px; align-items: baseline; margin-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; flex-wrap: wrap; justify-content: center; }
.sub .rate { color: var(--glow); }
.layerbar { margin-top: 12px; width: min(440px, 86%); height: 6px; border-radius: 3px; background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px var(--line); display: flex; overflow: hidden; }
.layerbar span { height: 100%; transition: width .4s linear; }
.legend { display: flex; gap: 12px; margin-top: 7px; font-size: 11px; color: var(--faint); letter-spacing: .05em; text-transform: uppercase; flex-wrap: wrap; justify-content: center; }
.legend b { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.legend .on { color: var(--dim); }
.legend .spent { text-decoration: line-through; opacity: .55; }
.pills { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; justify-content: center; pointer-events: auto; }
.pill { font-family: var(--mono); font-size: 11px; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line); color: var(--dim); background: rgba(3,6,11,.5); letter-spacing: .04em; }
.pill.gold { color: var(--gold); border-color: rgba(240,196,110,.4); }
.pill.teal { color: var(--glow); border-color: rgba(127,245,227,.35); }
button.pill:disabled { opacity: .45; cursor: default; }
.sulfide { pointer-events: none; margin-top: 10px; width: min(320px, 80%); display: grid; gap: 4px; justify-items: center; }
.sulfide .lbl { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); text-align: center; }
.sulfide .track { position: relative; width: 100%; height: 6px; border-radius: 3px; background: linear-gradient(90deg, rgba(127,245,227,.1) 0 33%, rgba(240,196,110,.28) 33% 66%, rgba(255,93,108,.32) 66% 100%); }
.sulfide .mark { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--frost); box-shadow: 0 0 8px var(--frost); transition: left .3s; }

/* ---- log, toast, tip ---- */
.log { position: fixed; left: max(20px, env(safe-area-inset-left, 0px)); top: calc(env(safe-area-inset-top, 0px) + 112px); width: 270px; max-height: calc(100% - 360px); overflow: hidden; display: flex; flex-direction: column; gap: 7px; pointer-events: none; z-index: 2; }
.log p { margin: 0; font-size: 13.5px; line-height: 1.4; color: var(--dim); transition: opacity 1.5s; }
.log p.omen, .log p.stage { font-family: var(--display); font-style: italic; font-size: 16px; line-height: 1.3; color: #a9c4c7; }
.log p.stage { color: var(--frost); }
.log p.event { color: var(--gold); }
.log p.warn { color: #f0a0a8; }
.log p.depart { color: var(--faint); font-style: italic; }
.toast { position: fixed; left: var(--toast-l, 0px); width: calc(100% - var(--panel-w) - var(--toast-l, 0px) - var(--toast-r, 0px)); top: calc(env(safe-area-inset-top, 0px) + 196px); text-align: center; padding-inline: 24px; box-sizing: border-box; pointer-events: none; z-index: 4; font-family: var(--display); font-style: italic; font-weight: 300; font-size: clamp(19px, 2.2vw, 27px); line-height: 1.35; color: var(--frost); text-shadow: 0 0 24px rgba(0,0,0,.9), 0 0 40px rgba(3,6,11,1); opacity: 0; transition: opacity .7s; text-wrap: balance; }
.toast.show { opacity: 1; }
.toast span { display: inline-block; max-width: 28em; }
.tip { position: fixed; z-index: 6; pointer-events: none; background: rgba(3,8,13,.92); border: 1px solid var(--line); border-left: 3px solid var(--c, var(--glow)); border-radius: 6px; padding: 7px 10px 8px; display: grid; gap: 2px; min-width: 150px; max-width: 240px; box-shadow: 0 6px 24px rgba(0,0,0,.6); }
.tip .n { font-size: 14px; font-weight: 500; color: var(--ink); }
.tip .p { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.tip .a { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--c, var(--glow)); margin-top: 2px; }

/* ---- panel ---- */
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-left: 1px solid var(--line); display: flex; flex-direction: column; z-index: 5; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px); box-sizing: border-box; }
.wallet { padding: 16px 18px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.wallet .k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.wallet .v { font-family: var(--mono); font-size: 26px; color: var(--glow); text-shadow: 0 0 14px rgba(127,245,227,.4); font-variant-numeric: tabular-nums; }
.wallet .r { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.tabs { display: flex; align-items: center; gap: 4px; padding: 8px 14px 0; }
.tab { padding: 7px 10px 9px; font-size: 13px; color: var(--dim); border-bottom: 2px solid transparent; letter-spacing: .03em; }
.tab[aria-selected="true"] { color: var(--ink); border-color: var(--glow); }
.tab .badge { font-family: var(--mono); font-size: 10px; color: var(--abyss); background: var(--gold); border-radius: 99px; padding: 1px 6px; margin-left: 5px; }
.list { flex: 1; overflow-y: auto; padding: 6px 12px 16px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; }
.hint { font-size: 12px; line-height: 1.45; color: var(--dim); padding: 4px 4px 2px; }
.hint b { color: var(--ink); font-weight: 500; }

.group { display: flex; flex-direction: column; gap: 8px; }
.gh { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 4px 0; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.gh .m { font-family: var(--mono); letter-spacing: .02em; text-transform: none; color: var(--faint); }
.gh.spent { opacity: .6; }
.foods { display: grid; gap: 5px; padding: 2px 4px 2px; }
.food { display: grid; grid-template-columns: 74px 1fr; gap: 2px 8px; align-items: center; }
.food .fn { font-size: 11.5px; color: var(--dim); }
.food .bar { height: 7px; border-radius: 2px; background: rgba(255,255,255,.035); box-shadow: inset 0 0 0 1px rgba(127,245,227,.08); display: flex; overflow: hidden; }
.food .bar span { height: 100%; transition: width .35s linear; }
.food .fnote { grid-column: 2; font-family: var(--mono); font-size: 11px; color: var(--faint); }

.col { --c: var(--glow); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px 10px; background: rgba(127,245,227,.022); display: grid; gap: 5px; position: relative; transition: border-color .2s, background .2s, box-shadow .2s; }
.col::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--c); opacity: .7; }
.col.hl { border-color: color-mix(in srgb, var(--c) 55%, transparent); background: color-mix(in srgb, var(--c) 7%, transparent); box-shadow: 0 0 18px color-mix(in srgb, var(--c) 18%, transparent); }
.col.empty { opacity: .9; }
.col .r1 { display: flex; align-items: center; gap: 8px; }
.col .nm { font-size: 15px; font-weight: 500; color: var(--ink); text-align: left; flex: 1; min-width: 0; }
.col .nm:hover { color: var(--c); }
.chip { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; padding: 2px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--dim); white-space: nowrap; }
.chip.thriving { color: var(--glow); border-color: rgba(127,245,227,.4); }
.chip.arriving { color: var(--frost); border-color: rgba(238,246,200,.35); }
.chip.crowded { color: var(--gold); border-color: rgba(240,196,110,.45); }
.chip.hungry { color: #e7b9a0; border-color: rgba(231,185,160,.35); }
.chip.starving, .chip.poisoned, .chip.suffocating { color: var(--ember); border-color: rgba(255,107,120,.45); }
.chip.hunted { color: #f0a0a8; border-color: rgba(240,160,168,.4); }
.chip.stable { color: #a9c4c7; }
.chip.dom { color: var(--violet); border-color: rgba(199,182,242,.45); }
.col .r2 { display: flex; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.col .tr.up { color: var(--glow); }
.col .tr.down { color: #f0a0a8; }
.fed { position: relative; height: 5px; border-radius: 3px; background: rgba(255,255,255,.05); overflow: visible; }
.fed .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--c); opacity: .75; transition: width .35s linear; }
.fed .mark { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink); opacity: .55; }
.col .r3 { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--faint); }
.col .r3 .eat { font-family: var(--mono); color: #9fd7cf; }
.acts { display: flex; gap: 6px; margin-top: 2px; }
.acts button { border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; font-size: 12px; color: var(--dim); text-align: left; transition: border-color .15s, color .15s, background .15s; }
.acts .call { flex: 1; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.acts .call .g { font-family: var(--mono); font-size: 11.5px; }
.acts .call.can { color: var(--ink); border-color: rgba(240,196,110,.45); }
.acts .call.can .g { color: var(--gold); }
.acts .call:not(.can) { opacity: .6; cursor: default; }
.acts .cull:hover { color: var(--ember); border-color: rgba(255,107,120,.45); }
.acts button:hover.can { background: rgba(240,196,110,.06); }
.info { display: grid; gap: 6px; padding-top: 4px; border-top: 1px dashed var(--line); margin-top: 2px; }
.info .lt { font-family: var(--display); font-style: italic; font-size: 15px; color: var(--dim); }
.info .ds { font-size: 12.5px; line-height: 1.45; color: var(--dim); }
.traits { display: flex; flex-wrap: wrap; gap: 5px; }
.traits span { font-size: 11px; color: var(--violet); border: 1px solid rgba(199,182,242,.25); border-radius: 4px; padding: 1px 6px; }
.info .diet { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.gone { font-size: 12px; color: var(--faint); padding: 6px 8px; border: 1px dashed var(--line); border-radius: 8px; line-height: 1.5; }

.card { text-align: left; width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: rgba(127,245,227,.025); display: grid; gap: 3px; }
.card.can { border-color: rgba(240,196,110,.4); background: rgba(240,196,110,.04); }
.card.cant { opacity: .62; }
.card .nm { font-family: var(--display); font-style: italic; font-size: 18px; color: var(--ink); }
.card .ds { font-size: 12.5px; line-height: 1.4; color: var(--dim); }
.card .cost { margin-top: 4px; font-family: var(--mono); font-size: 12px; color: var(--dim); }
.card.can .cost { color: var(--gold); }
.empty-note { font-family: var(--display); font-style: italic; font-size: 16px; color: var(--dim); padding: 18px 8px; text-align: center; }
.foot { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 10px; justify-content: space-between; align-items: center; font-size: 12px; color: var(--faint); }
.foot button { color: var(--dim); font-size: 12px; padding: 4px 2px; }
.foot button:hover { color: var(--ink); }
.foot .danger { color: #b97a80; }

/* ---- overlays ---- */
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 60%, rgba(7,16,25,.93), rgba(3,6,11,.99)); padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); overflow-y: auto; }
.ov { max-width: 620px; width: 100%; display: grid; gap: 18px; justify-items: center; text-align: center; padding-block: 24px; }
.ov h1 { margin: 0; font-family: var(--display); font-weight: 300; font-style: italic; font-size: clamp(54px, 11vw, 104px); line-height: .95; color: var(--ink); text-shadow: 0 0 40px rgba(127,245,227,.25); text-wrap: balance; }
.ov h2 { margin: 0; font-family: var(--display); font-weight: 300; font-size: clamp(32px, 6vw, 52px); line-height: 1.05; text-wrap: balance; }
.ov .tag { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--glow); }
.ov p { margin: 0; font-family: var(--display); font-size: 21px; line-height: 1.5; color: #b4c8ca; max-width: 32em; text-wrap: pretty; }
.ov .small { font-family: var(--body); font-size: 13.5px; color: var(--dim); line-height: 1.55; }
.ov .how { display: grid; gap: 8px; text-align: left; max-width: 30em; }
.ov .how div { font-size: 13.5px; line-height: 1.5; color: var(--dim); padding-left: 14px; border-left: 1px solid var(--line); }
.ov .how b { color: var(--ink); font-weight: 500; }
.go { margin-top: 6px; font-family: var(--display); font-style: italic; font-size: 24px; padding: 10px 34px; border: 1px solid rgba(127,245,227,.45); border-radius: 99px; color: var(--glow); background: rgba(127,245,227,.06); box-shadow: 0 0 30px rgba(127,245,227,.12); transition: background .2s, box-shadow .2s; }
.go:hover { background: rgba(127,245,227,.14); box-shadow: 0 0 40px rgba(127,245,227,.25); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; width: 100%; }
.stats-grid div { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 2px; }
.stats-grid b { font-family: var(--mono); font-weight: 400; font-size: 18px; color: var(--ink); }
.stats-grid span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.journey { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.journey span { font-size: 12px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--faint); }
.journey span.done { color: var(--dim); text-decoration: line-through; }
.journey span.now { color: var(--glow); border-color: rgba(127,245,227,.45); }
.perks { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; width: 100%; text-align: left; }
.perk { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 4px; text-align: left; }
.perk.can { border-color: rgba(240,196,110,.45); background: rgba(240,196,110,.05); }
.perk .top { display: flex; justify-content: space-between; align-items: baseline; }
.perk .nm { font-family: var(--display); font-style: italic; font-size: 19px; }
.perk .lv { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.perk .ds { font-size: 12.5px; color: var(--dim); }
.perk .cost { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.perk.can .cost { color: var(--gold); }
.larvae { font-family: var(--mono); font-size: 15px; color: var(--gold); }


/* ---- map dock: views, tool, patch readout ---- */
.dock { position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); right: calc(var(--panel-w) + 16px); bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); z-index: 4; display: grid; gap: 7px; justify-items: start; pointer-events: none; }
.dock > * { pointer-events: auto; }
.views { display: flex; gap: 6px; flex-wrap: wrap; }
.views button { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--dim); background: rgba(3,6,11,.62); }
.views button span { color: var(--faint); margin-left: 3px; }
.views button[aria-pressed="true"] { color: var(--glow); border-color: rgba(127,245,227,.45); background: rgba(127,245,227,.07); }
.views .current { color: #8fd0ff; border-color: rgba(143,208,255,.4); }
.views .current.on { background: rgba(143,208,255,.14); }
.views .current:disabled:not(.on) { opacity: .5; cursor: default; }
.views .current span { color: inherit; opacity: .8; }
.col .r2 .tr.eat { color: #9fd7cf; }
.views .lure { color: var(--gold); border-color: rgba(240,196,110,.35); }
.views .lure.on { background: rgba(240,196,110,.12); }
.views .lure:disabled { opacity: .45; cursor: default; }
.views .lure span { color: inherit; opacity: .75; }
.cellinfo { font-family: var(--mono); font-size: 11px; color: var(--dim); background: rgba(3,6,11,.55); border-radius: 6px; padding: 4px 8px; max-width: min(640px, 100%); line-height: 1.5; pointer-events: none; }
.cellinfo:empty { display: none; }
.cellinfo b { color: var(--ink); font-weight: 500; font-family: var(--body); font-size: 12px; margin-right: 6px; }
.cellinfo i { font-style: normal; color: var(--faint); }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border-radius: 8px; border: 1px solid var(--c, var(--glow)); background: rgba(3,8,13,.88); box-shadow: 0 0 22px color-mix(in srgb, var(--c, var(--glow)) 22%, transparent); }
.toolbar .tt { font-size: 12.5px; color: var(--ink); }
.toolbar .tt em { font-style: normal; color: var(--c, var(--glow)); }
.toolbar .short { display: none; }
.toolbar .tdone { font-size: 12px; padding: 3px 10px; border-radius: 6px; border: 1px solid var(--line); color: var(--dim); }
.toolbar .tdone:hover { color: var(--ink); }
#scene.tool { cursor: cell; }

/* ---- colony cards (compact) ---- */
.col .r1 .terr { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.acts .open { color: var(--dim); }
.acts .open:hover { color: var(--ink); border-color: rgba(127,245,227,.35); }
.acts .call.placing { color: var(--abyss); background: var(--c); border-color: var(--c); }
.acts .call.placing .g { color: var(--abyss); }
.foods .food .fnote { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- species drawer ---- */
.drawer { flex: 1; overflow-y: auto; padding: 0 14px 18px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; --c: var(--glow); }
.drawer .back { align-self: flex-start; font-size: 12px; color: var(--dim); padding: 8px 0 0; }
.drawer .back:hover { color: var(--ink); }
.drawer .hd { display: grid; gap: 2px; border-left: 2px solid var(--c); padding-left: 10px; }
.drawer .hd .t { display: flex; align-items: center; gap: 8px; }
.drawer .hd h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.1; color: var(--ink); flex: 1; }
.drawer .hd .lt { font-family: var(--display); font-style: italic; font-size: 15px; color: var(--dim); }
.drawer .ds { font-size: 12.5px; line-height: 1.5; color: var(--dim); margin: 0; }
.drawer .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.drawer .stats div { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; display: grid; gap: 1px; }
.drawer .stats b { font-family: var(--mono); font-weight: 400; font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.drawer .stats span { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.drawer .stats .up { color: var(--glow); } .drawer .stats .down { color: #f0a0a8; }
.drawer h4 { margin: 4px 0 0; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 500; display: flex; justify-content: space-between; }
.drawer h4 i { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--faint); font-family: var(--mono); font-size: 10.5px; }
.inf { display: grid; gap: 6px; }
.inf .row { display: grid; grid-template-columns: 1fr 54px; gap: 8px; align-items: center; font-size: 12px; line-height: 1.35; color: var(--dim); }
.inf .row .bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,.05); overflow: hidden; }
.inf .row .bar span { display: block; height: 100%; border-radius: 2px; transition: width .4s; }
.inf.help .bar span { background: var(--glow); }
.inf.hurt .bar span { background: var(--ember); }
.inf .row[data-src] { cursor: pointer; }
.inf .row[data-src]:hover { color: var(--ink); }
.inf .none { font-size: 12px; color: var(--faint); font-style: italic; }
.eats { display: grid; gap: 4px; }
.eats .e { display: grid; grid-template-columns: 96px 1fr 40px; gap: 8px; align-items: center; font-size: 11.5px; color: var(--dim); }
.eats .e .bar { height: 5px; border-radius: 2px; background: rgba(255,255,255,.05); overflow: hidden; }
.eats .e .bar span { display: block; height: 100%; background: var(--c); opacity: .8; transition: width .4s; }
.eats .e .v { font-family: var(--mono); font-size: 10.5px; color: var(--faint); text-align: right; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg button { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; text-align: left; display: grid; gap: 3px; align-content: start; }
.seg button .n { font-size: 13.5px; color: var(--ink); font-weight: 500; }
.seg button .d { font-size: 11.5px; line-height: 1.4; color: var(--dim); }
.seg button[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, transparent); }
.seg button[aria-pressed="true"] .n { color: var(--c); }
.adapting { font-family: var(--mono); font-size: 10.5px; color: var(--gold); }
.dial { display: grid; gap: 4px; }
.dial input { width: 100%; accent-color: var(--c); }
.dial .ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); }
.muts { display: grid; gap: 8px; }
.tier { display: grid; gap: 5px; }
.tier .tl { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); display: flex; justify-content: space-between; }
.tier .tl i { font-style: normal; text-transform: none; letter-spacing: 0; font-family: var(--mono); }
.tier .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mut { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; text-align: left; display: grid; gap: 3px; align-content: start; }
.mut .n { font-family: var(--display); font-style: italic; font-size: 16px; color: var(--ink); }
.mut .d { font-size: 11.5px; line-height: 1.4; color: var(--dim); }
.mut .c { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-top: 2px; }
.mut.can { border-color: rgba(240,196,110,.45); background: rgba(240,196,110,.04); }
.mut.can .c { color: var(--gold); }
.mut.taken { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, transparent); }
.mut.taken .c { color: var(--c); }
.mut.lost { opacity: .35; }
.mut:disabled { cursor: default; }
.dacts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dacts button { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; color: var(--dim); text-align: left; display: grid; gap: 1px; }
.dacts button .g { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.dacts .call.can { color: var(--ink); border-color: rgba(240,196,110,.45); }
.dacts .call.can .g { color: var(--gold); }
.dacts button.on, .dacts .call.can.on { color: var(--abyss); background: var(--c); border-color: var(--c); }
.dacts button.on .g, .dacts .call.can.on .g { color: var(--abyss); }
.dacts .cullt:hover, .dacts .thin:hover { color: var(--ember); border-color: rgba(255,107,120,.45); }
.dacts .wide { grid-column: 1 / -1; }
.backup textarea { width: 100%; min-height: 120px; background: rgba(255,255,255,.03); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; font-family: var(--mono); font-size: 11px; padding: 8px; box-sizing: border-box; }
.backup .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.backup .row button { border: 1px solid var(--line); border-radius: 99px; padding: 6px 16px; color: var(--dim); }
.backup .row button:hover { color: var(--ink); border-color: rgba(127,245,227,.4); }
.nlink { color: var(--glow); text-decoration: underline; text-underline-offset: 3px; }
.notice { font-size: 13px; color: var(--gold); border: 1px solid rgba(240,196,110,.35); border-radius: 8px; padding: 8px 12px; max-width: 30em; line-height: 1.45; }
.passing { width: min(320px, 80%); height: 4px; border-radius: 2px; background: rgba(255,255,255,.06); overflow: hidden; }
.passing span { display: block; height: 100%; background: var(--glow); box-shadow: 0 0 10px var(--glow); width: 0; }

/* ---- main page and record of runs ---- */
.ticker { display: none; }
.home-go { display: grid; gap: 6px; justify-items: center; }
.home-go .go + .runline { margin-top: 26px; }
.runline { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.awayline { font-size: 13px; color: var(--dim); font-style: italic; }
.menu { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.menu button { font-size: 14px; padding: 9px 18px; border-radius: 99px; border: 1px solid var(--line); color: var(--ink); background: rgba(127,245,227,.03); }
.menu button:hover:not(:disabled) { border-color: rgba(127,245,227,.45); }
.menu button:disabled { opacity: .4; cursor: default; }
.menu .danger { color: #e3a3aa; }
.go.small { font-size: 19px; padding: 8px 28px; }
.foot .menu-btn { color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 5px 12px; }
.runs { display: grid; gap: 6px; width: 100%; text-align: left; }
.run { display: grid; grid-template-columns: 46px 1fr; gap: 2px 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; text-align: left; }
.run.on { border-color: rgba(127,245,227,.5); background: rgba(127,245,227,.06); }
.run .rn { grid-row: span 2; font-family: var(--mono); font-size: 13px; color: var(--glow); align-self: center; }
.run .rw { font-family: var(--display); font-size: 19px; color: var(--ink); }
.run .rw i { font-family: var(--mono); font-style: normal; font-size: 12px; color: var(--dim); margin-left: 6px; }
.run .rs { font-size: 12.5px; color: var(--dim); line-height: 1.5; }
.run .rs b { font-family: var(--mono); font-weight: 400; color: var(--ink); }
.sphead { width: 100%; display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.sphead button { text-transform: none; letter-spacing: 0; color: var(--glow); font-size: 13px; }
.sptiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; width: 100%; }
.sptile { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; color: var(--ink); text-align: left; }
.sptile .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); flex: none; }
.sptile.unmet { color: var(--faint); }
.sptile.unmet .dot { background: transparent; box-shadow: none; border: 1px solid var(--faint); }
.sptile.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, transparent); }
.spdetail { width: 100%; text-align: left; border: 1px solid var(--c); border-radius: 10px; padding: 14px; display: grid; gap: 10px; background: color-mix(in srgb, var(--c) 5%, transparent); }
.spdetail .hd { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.spdetail h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 26px; }
.spdetail .lt { font-family: var(--display); font-style: italic; color: var(--dim); font-size: 16px; }
.spdetail .ds { font-family: var(--body); font-size: 13.5px; color: var(--dim); line-height: 1.5; margin: 0; }
.stats-grid.sm b { font-size: 15px; }
.mutlist { font-size: 13px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mutlist span { font-family: var(--display); font-style: italic; font-size: 15px; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; }
.drawer .back { position: sticky; top: 0; z-index: 2; background: #060e15; box-shadow: 0 6px 10px #060e15; width: 100%; text-align: left; padding: 10px 0 8px; font-size: 13px; color: var(--ink); }

/* ---- wide screens: the toast steps aside for the log ---- */
@media (min-width: 1180px) { :root { --toast-l: 300px; --toast-r: 24px; } }
@media (max-width: 1179px) { .log { display: none; } .hud .whale-id, .hud .age { display: none; } }
body.toasting .ticker { opacity: 0 !important; }
/* ---- phones, and tablets held upright: the panel becomes a bottom sheet ---- */
@media (max-width: 899px), (max-width: 1199px) and (orientation: portrait) {
  :root { --panel-w: 0px; }
  @media (orientation: portrait) { :root { --sheet-h: 44%; } }
  .panel { top: auto; left: 0; width: auto; height: var(--sheet-h, 48%); border-left: 0; border-top: 1px solid var(--line); padding-left: env(safe-area-inset-left, 0px); }
  .wallet { padding: 8px 16px 6px; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 10px; }
  .wallet .v { font-size: 20px; }
  .hud { top: calc(env(safe-area-inset-top, 0px) + 10px); left: max(14px, env(safe-area-inset-left, 0px)); }
  .hud .whale-id, .hud .age { display: none; }
  .brand { font-size: 18px; }
  .readout { top: calc(env(safe-area-inset-top, 0px) + 34px); width: 100%; }
  .mass { font-size: 46px; }
  .legend, .log, .hint { display: none; }
  .ticker { display: block; margin-top: 8px; max-width: min(520px, 92%); text-align: center; font-size: 13px; line-height: 1.35; color: var(--dim); opacity: 0; transition: opacity .6s; text-shadow: 0 0 12px #000; }
  .ticker.show { opacity: 1; } .ticker.warn { color: #f3b3ba; } .ticker.omen { font-family: var(--display); font-style: italic; font-size: 16px; color: #b9d0d3; } .ticker.event { color: var(--gold); }
  .ov p { font-size: 18px; }
  .toast { --toast-l: 0px; width: 100%; top: calc(env(safe-area-inset-top, 0px) + 142px); font-size: 19px; padding-inline: 18px; }
  .dock { right: max(12px, env(safe-area-inset-right, 0px)); left: max(12px, env(safe-area-inset-left, 0px)); bottom: calc(var(--sheet-h, 48%) + 8px); gap: 5px; }
  .cellinfo { display: none; }
  .views button { padding: 5px 9px; font-size: 11px; }
  .toolbar .tt { font-size: 12px; }
  /* the tool bar floats in open water under the readout, never over the seabed */
  .toolbar { position: fixed; left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); top: var(--tooltop, 134px); height: 40px; box-sizing: border-box; padding: 4px 6px 4px 12px; justify-content: space-between; }
  .toolbar .tt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.tooling .pills { visibility: hidden; }
  .toolbar .long { display: none; } .toolbar .short { display: inline; color: var(--dim); }
  body.tooling .ticker { opacity: 0 !important; }
  body.tooling .toast { top: calc(var(--tooltop, 134px) + 52px); }
  .acts button, .dacts button { min-height: 36px; }
}
@media (min-width: 600px) and (max-width: 1199px) and (orientation: portrait) {
  .mass { font-size: 58px; }
  .toast { top: calc(env(safe-area-inset-top, 0px) + 170px); font-size: 22px; }
}
/* ---- phones held sideways: a narrow side panel, a compact readout ---- */
@media (max-height: 520px) and (orientation: landscape) {
  :root { --panel-w: 300px; }
  .panel { top: 0; left: auto; right: 0; bottom: 0; width: var(--panel-w); height: auto; border-top: 0; border-left: 1px solid var(--line); }
  .readout { top: calc(env(safe-area-inset-top, 0px) + 6px); width: calc(100% - var(--panel-w)); }
  .mass { font-size: 36px; }
  .layerbar { margin-top: 6px; } .sub { margin-top: 2px; }
  .legend, .log, .hint, .hud .whale-id, .hud .age, .cellinfo { display: none; }
  .ticker { display: block; font-size: 12px; max-width: 90%; text-align: center; color: var(--dim); opacity: 0; transition: opacity .6s; }
  .ticker.show { opacity: 1; }
  .toast { --toast-l: 0px; width: calc(100% - var(--panel-w)); top: 40%; font-size: 17px; }
  .dock { right: calc(var(--panel-w) + 10px); bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); }
  .toolbar { position: fixed; left: max(12px, env(safe-area-inset-left, 0px)); right: calc(var(--panel-w) + 12px); top: calc(env(safe-area-inset-top, 0px) + 84px); padding: 4px 6px 4px 12px; justify-content: space-between; }
  .toolbar .long { display: none; } .toolbar .short { display: inline; color: var(--dim); }
  body.tooling .ticker { opacity: 0 !important; }
  .wallet { padding: 8px 14px 6px; } .wallet .v { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { .layerbar span, .toast, .log p, .food .bar span, .fed .fill { transition: none; } }
