:root {
  --bg: #0b1410; --panel: #12201a; --panel2: #182b22; --line: #2a4436;
  --text: #eef5f0; --muted: #8fa89a; --accent: #ffd23f; --accent2: #3ee08f; --nitro: #ffb13b; --danger: #ff5a5f;
  --min: #58a6ff; --med: #ff8c2a; --max: #ff4d5a;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-user-select: none; user-select: none; touch-action: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.h { font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .02em; }
@keyframes fin { from { opacity: 0; transform: translateY(-4px); } }

/* ------------------------------------------------------------ HUD (phone portrait) */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button, #hud .pin, #hud .tray, #hud .panel, #hud .feed div, #hud .viewing { pointer-events: auto; }
.box { background: rgba(8, 14, 11, .88); border: 1px solid #ffffff22; border-radius: 12px; box-shadow: 0 6px 20px #0008; }
.money { position: absolute; top: calc(10px + var(--sat)); left: calc(10px + var(--sal)); padding: 5px 11px 7px; min-width: 124px; text-align: left; }
.money b { display: block; white-space: nowrap; font-size: 21px; font-weight: 900; font-style: italic; color: var(--accent); line-height: 1.05; font-variant-numeric: tabular-nums; }
.money b.neg { color: #ff8a8d; }
.money span { display: block; white-space: nowrap; font-size: 10.5px; font-weight: 900; color: var(--accent2); margin-top: 2px; }
.money span.bad { color: #ff8a8d; }
.clock { position: absolute; top: calc(10px + var(--sat)); right: calc(60px + var(--sar)); padding: 5px 9px 6px; text-align: center; white-space: nowrap; }
.clock b { display: block; font-size: 14px; font-weight: 900; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.spd { display: flex; gap: 3px; justify-content: center; margin-top: 3px; }
.spd button { font-size: 10px; font-weight: 900; padding: 2px 6px; border-radius: 6px; background: #ffffff12; color: var(--muted); min-width: 28px; }
.spd button.sel { background: var(--accent); color: #1a1400; }
.mbtn { position: absolute; top: calc(12px + var(--sat)); right: calc(12px + var(--sar)); width: 40px; height: 40px; border-radius: 11px; border: 1px solid #ffffff2a;
  background: rgba(8, 14, 11, .8); font-weight: 900; display: grid; place-items: center; font-size: 17px; }
.reg { position: absolute; top: calc(64px + var(--sat)); left: calc(10px + var(--sal)); right: calc(10px + var(--sar)); padding: 5px 9px 7px; text-align: left; }
.reg .t { display: flex; justify-content: space-between; align-items: baseline; font-size: 9.5px; font-weight: 900; letter-spacing: .14em; color: var(--muted); }
.reg .t b { color: var(--text); font-size: 13px; letter-spacing: .03em; font-style: italic; }
.reg .t em { font-style: normal; color: var(--accent); }
.hrs { display: grid; grid-template-columns: repeat(24, 1fr); gap: 1.5px; margin-top: 5px; }
.hrs i { height: 8px; border-radius: 2px; display: block; }
.hrs i.now { outline: 2px solid #fff; outline-offset: 1px; position: relative; z-index: 1; }
.pris { position: absolute; top: calc(112px + var(--sat)); left: calc(10px + var(--sal)); padding: 5px 10px; display: flex; gap: 10px; align-items: center; text-align: left; }
.pris .n { font-size: 9px; font-weight: 900; letter-spacing: .14em; color: var(--muted); }
.pris .n b { display: block; color: var(--text); font-size: 15px; letter-spacing: .02em; font-style: italic; font-variant-numeric: tabular-nums; }
.pris .n b small { font-size: 11px; color: var(--muted); font-style: normal; }
.cats3 { display: flex; gap: 3px; }
.cats3 span { font-size: 10px; font-weight: 900; padding: 2px 6px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.c-min { background: #58a6ff33; color: #8ec5ff; } .c-med { background: #ff8c2a33; color: #ffb36b; } .c-max { background: #ff4d5a33; color: #ff8a8d; }
.danger { position: absolute; top: calc(112px + var(--sat)); right: calc(10px + var(--sar)); padding: 6px 10px; width: 116px; text-align: left; }
.danger .n { font-size: 9px; font-weight: 900; letter-spacing: .14em; color: var(--muted); display: flex; justify-content: space-between; }
.danger .n b { color: var(--accent2); } .danger .n b.mid { color: var(--nitro); } .danger .n b.hi { color: #ff8a8d; }
.danger .g { height: 7px; border-radius: 4px; background: #ffffff14; margin-top: 5px; overflow: hidden; }
.danger .g i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #3ee08f, #ffd23f 55%, #ff5a5f); transition: width .5s; }
.grantchip { position: absolute; top: calc(160px + var(--sat)); left: calc(10px + var(--sal)); padding: 4px 10px 4px 6px; display: flex; align-items: center; gap: 7px; max-width: calc(100vw - 20px); text-align: left; }
.grantchip .ic { font-size: 16px; }
.grantchip .tx b { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.grantchip .tx small { display: block; font-size: 9.5px; color: var(--muted); font-weight: 800; white-space: nowrap; }
.grantchip em { font-style: italic; font-weight: 900; color: var(--accent); font-size: 12px; margin-left: 4px; }
.grantchip.done em { color: var(--accent2); }
.feed { position: absolute; top: calc(204px + var(--sat)); left: calc(10px + var(--sal)); right: calc(10px + var(--sar)); display: flex; flex-direction: column; align-items: flex-start; gap: 4px; pointer-events: none; }
.feed div { background: rgba(8, 14, 11, .9); border: 1px solid #ffffff1c; border-radius: 999px; padding: 3px 11px 3px 4px; font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; gap: 7px; max-width: 100%; animation: fin .25s ease-out; transition: opacity .6s; cursor: pointer; }
.feed div > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed div.hot { border-color: #ff5a5f88; }
.feed div.fade { opacity: 0; }
.feed i { color: var(--accent2); font-style: normal; font-weight: 900; }
.feed div.hot i { color: #ff8a8d; }
.av { width: 18px; height: 18px; border-radius: 50%; flex: 0 0 18px; background: #9c978b; position: relative; border: 1.5px solid #6f6a60; overflow: hidden; display: inline-block; }
.av::after { content: ""; position: absolute; left: 3px; right: 3px; top: 4px; height: 2px; border-left: 2.5px solid #ffd23f; border-right: 2.5px solid #ffd23f; }
.av::before { content: ""; position: absolute; left: -2px; right: -2px; bottom: -1px; height: 6px; background: var(--c, #ff8c2a); }
.toast { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(230px + var(--sab)); background: rgba(8, 14, 11, .95); border: 1px solid #ffffff22;
  border-left: 4px solid var(--danger); padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 700; width: max-content; max-width: min(92vw, 420px); line-height: 1.35; animation: fin .2s ease-out; pointer-events: none; z-index: 3; }
.toast.ok { border-left-color: var(--accent2); }
.toast b { color: var(--accent); }
.viewing { position: absolute; top: calc(204px + var(--sat)); right: calc(10px + var(--sar)); display: flex; align-items: center; gap: 6px; background: var(--accent); color: #1a1400; border-radius: 999px; padding: 4px 4px 4px 12px; font-size: 11px; font-weight: 900; letter-spacing: .04em; }
.viewing button { width: 24px; height: 24px; border-radius: 50%; background: #1a140022; font-weight: 900; }
.banner { position: absolute; top: calc(236px + var(--sat)); left: 50%; transform: translateX(-50%); text-align: center; background: rgba(8, 14, 11, .92); border: 2px solid var(--accent);
  border-radius: 16px; padding: 10px 20px 12px; box-shadow: 0 10px 40px #ffd23f33; animation: pop .4s ease-out; max-width: 92vw; z-index: 3; }
.banner.bad { border-color: var(--danger); box-shadow: 0 10px 40px #ff5a5f44; }
.banner .big { display: block; font-size: 26px; color: var(--accent); white-space: nowrap; }
.banner.bad .big { color: #ff8a8d; }
.banner .small { display: block; font-size: 12.5px; font-weight: 700; color: var(--text); margin-top: 3px; }
@keyframes pop { 0% { transform: translateX(-50%) scale(.4); opacity: 0; } 70% { transform: translateX(-50%) scale(1.06); } }

/* tray */
.tray { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px calc(8px + var(--sar)) calc(10px + var(--sab)) calc(8px + var(--sal));
  background: linear-gradient(180deg, rgba(11, 20, 16, 0), rgba(11, 20, 16, .9) 22px, rgba(11, 20, 16, .97)); }
.brush { display: flex; gap: 6px; margin: 0 2px 8px; align-items: center; min-height: 38px; }
.chips-row { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.bc { flex: 0 0 auto; background: rgba(18, 32, 26, .96); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 11.5px; font-weight: 900; letter-spacing: .03em; white-space: nowrap; }
.bc.sel { background: #2a2a10; border-color: var(--accent); color: var(--accent); }
.bc.info { border-style: dashed; color: var(--muted); }
.bc.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.rnd { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; background: rgba(18, 32, 26, .96); border: 1px solid var(--line); display: grid; place-items: center; font-size: 17px; font-weight: 900; }
.rnd.sel { background: var(--danger); border-color: #fff8; }
.rnd:disabled { opacity: .35; }
.items { display: flex; gap: 6px; overflow-x: auto; padding: 6px 2px 8px; scrollbar-width: none; touch-action: pan-x; }
.items::-webkit-scrollbar { display: none; }
.it { flex: 0 0 82px; background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: 5px 4px 6px; text-align: center; position: relative; }
.it .sw { height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 18px; position: relative; overflow: hidden; background: #ffffff0d; }
.it .sw canvas { width: 30px; height: 30px; }
.it .nm { font-size: 10px; font-weight: 900; margin-top: 4px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it .pr { font-size: 9.5px; font-weight: 800; color: var(--accent); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it .pr.g { color: var(--accent2); } .it .pr.m { color: var(--muted); } .it .pr.b { color: #ff8a8d; }
.it.sel { border-color: var(--accent); background: #2a2a10; }
.it.lock { opacity: .5; }
.it .cnt { position: absolute; top: -6px; left: -4px; background: var(--accent2); color: #002313; border-radius: 9px; font-size: 10px; font-weight: 900; padding: 0 6px; line-height: 17px; }
.it .k { position: absolute; top: -6px; right: -4px; background: #0b1410; color: var(--text); border: 1px solid #ffffff44; border-radius: 5px; font-size: 9.5px; font-weight: 900; padding: 0 5px; line-height: 16px; display: none; }
.cats { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.cat { background: rgba(18, 32, 26, .96); border: 1px solid var(--line); border-radius: 12px; padding: 6px 0 5px; text-align: center; font-size: 17px; line-height: 1.1; position: relative; }
.cat small { display: block; font-size: 8px; font-weight: 900; letter-spacing: .04em; color: var(--muted); margin-top: 3px; text-transform: uppercase; white-space: nowrap; }
.cat.sel { background: var(--accent); border-color: var(--accent); } .cat.sel small { color: #1a1400; }
.cat .dot { position: absolute; top: 4px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.cat .kk { position: absolute; top: 3px; left: 5px; font-size: 9px; font-weight: 900; color: var(--muted); font-style: normal; display: none; }
.cat.sel .kk { color: #1a1400; }

/* map-pinned UI */
.pin { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: auto; }
.ghostchip { background: rgba(8, 14, 11, .93); border: 1.5px solid var(--accent2); border-radius: 12px; padding: 5px 10px 6px; box-shadow: 0 8px 20px #0009; pointer-events: none; }
.ghostchip .a { font-size: 9.5px; font-weight: 900; letter-spacing: .14em; color: var(--accent2); }
.ghostchip .b { font-size: 13px; font-weight: 900; margin-top: 1px; }
.ghostchip .b em { font-style: normal; color: var(--accent); }
.ghostchip.bad { border-color: var(--danger); } .ghostchip.bad .a { color: #ff8a8d; } .ghostchip.bad .b em { color: #ff8a8d; }
.okx { display: flex; gap: 12px; }
.okx button { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; font-weight: 900; border: 2px solid #ffffff55; box-shadow: 0 6px 16px #0009; }
.okx .ok { background: radial-gradient(circle at 35% 30%, #8ff7c1, #1fb46d); color: #002313; }
.okx .ok:disabled { filter: saturate(.2) brightness(.6); }
.okx .x { background: radial-gradient(circle at 35% 30%, #ff9a9d, #d8323a); color: #fff; }

/* sheet: inspect and panels */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 72vh; overflow-y: auto; background: var(--panel); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0;
  padding: 8px 14px calc(14px + var(--sab)); box-shadow: 0 -10px 30px #000a; z-index: 5; animation: up .2s ease-out; touch-action: pan-y; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: #ffffff30; margin: 0 auto 8px; }
.hd { display: flex; align-items: center; gap: 10px; }
.hd .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--panel2); display: grid; place-items: center; font-size: 21px; border: 1px solid #ffffff22; flex: 0 0 44px; }
.hd .ic canvas { width: 40px; height: 40px; }
.hd .nm { font-size: 18px; line-height: 1.05; }
.hd .ds { font-size: 11px; color: var(--muted); font-weight: 800; margin-top: 3px; line-height: 1.3; }
.hd .x { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; background: var(--panel2); display: grid; place-items: center; font-weight: 900; color: var(--muted); flex: 0 0 34px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 6px; }
.kpi { background: var(--panel2); border-radius: 10px; padding: 6px 9px; min-width: 0; }
.kpi span { display: block; font-size: 9px; font-weight: 900; letter-spacing: .12em; color: var(--muted); white-space: nowrap; }
.kpi b { font-size: 16px; font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.kpi b.bad { color: #ff8a8d; } .kpi b.good { color: var(--accent2); } .kpi b.mid { color: var(--accent); }
.probs { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 6px; }
.probs span { background: #ff5a5f22; border: 1px solid #ff5a5f66; border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 800; }
.probs span.ok { background: #3ee08f18; border-color: #3ee08f55; }
.needs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 14px; }
.nd { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 800; }
.nd span { width: 78px; color: var(--muted); white-space: nowrap; }
.nd .b { flex: 1; height: 8px; border-radius: 4px; background: #ffffff12; overflow: hidden; }
.nd .b i { display: block; height: 100%; border-radius: 4px; }
.acts2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.acts2 button { background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px; font-size: 12.5px; font-weight: 900; line-height: 1.2; text-align: left; }
.acts2 button small { display: block; font-size: 10px; color: var(--muted); font-weight: 800; margin-top: 2px; }
.acts2 button.y { background: linear-gradient(180deg, #ffe066, #f0b400); color: #241900; border: 0; } .acts2 button.y small { color: #5a4300; }
.acts2 button.r { border-color: #ff5a5f66; }
.acts2 button:disabled { opacity: .45; }
.blurb { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 8px; }
.blurb b { color: var(--accent); }
.sec { font-size: 9.5px; font-weight: 900; color: var(--muted); letter-spacing: .14em; margin: 12px 0 6px; display: flex; justify-content: space-between; text-transform: uppercase; }
.rows { display: grid; gap: 5px; }
.row { display: flex; align-items: center; gap: 9px; background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 7px 9px; text-align: left; width: 100%; font-size: 12.5px; font-weight: 800; }
.row .ic { font-size: 19px; width: 26px; text-align: center; }
.row b { display: block; font-size: 13px; } .row small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 700; line-height: 1.3; }
.row .rt { margin-left: auto; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.row .rt em { font-style: italic; font-weight: 900; color: var(--accent); }
.row.done { opacity: .6; } .row.done .rt em { color: var(--accent2); }
.row.now { border-color: var(--accent); background: #2a2a10; }
.step { width: 32px; height: 32px; border-radius: 9px; background: #ffffff12; font-size: 17px; font-weight: 900; display: grid; place-items: center; }
.step:disabled { opacity: .3; }
.num { min-width: 26px; text-align: center; font-size: 16px; font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; }
.pbar { height: 6px; border-radius: 3px; background: #ffffff14; margin-top: 4px; overflow: hidden; } .pbar i { display: block; height: 100%; background: var(--accent); }
.tog { width: 42px; height: 24px; border-radius: 12px; background: #ffffff1a; position: relative; flex: 0 0 42px; }
.tog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #8fa89a; transition: left .15s; }
.tog.on { background: var(--accent2); } .tog.on::after { left: 21px; background: #fff; }
.tabs { display: flex; gap: 6px; margin: 10px 0 4px; }
.tabs button { flex: 1; text-align: center; padding: 7px; border-radius: 9px; background: var(--panel2); font-size: 11px; font-weight: 900; color: var(--muted); }
.tabs button.sel { background: var(--accent); color: #1a1400; }
.pal { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.pal button { border-radius: 999px; padding: 6px 10px 6px 8px; font-size: 11px; font-weight: 900; display: flex; gap: 5px; align-items: center; background: var(--panel2); border: 1px solid var(--line); }
.pal button i { width: 10px; height: 10px; border-radius: 3px; display: block; }
.pal button.sel { border-color: var(--accent); color: var(--accent); background: #2a2a10; }
.rgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.rh { border-radius: 9px; padding: 5px 6px 6px; font-size: 10.5px; font-weight: 900; color: #0b1410; text-align: left; line-height: 1.15; min-height: 40px; }
.rh small { display: block; font-size: 9px; opacity: .7; font-weight: 900; }
.rh.now { outline: 2px solid #fff; outline-offset: 1px; }
.rh.dk { color: #eef5f0; }
.rh.mix { background: repeating-linear-gradient(135deg, #3a4a44 0 6px, #2c3a35 6px 12px) !important; color: #eef5f0; }
.ledger div { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 800; padding: 4px 2px; border-bottom: 1px solid #ffffff10; }
.ledger div span { color: var(--muted); }
.ledger em { font-style: normal; font-variant-numeric: tabular-nums; }
.ledger em.p { color: var(--accent2); } .ledger em.n { color: #ff8a8d; }
.ledger .tot { border: 0; padding-top: 8px; font-size: 15px; }
.ledger .tot em { font-size: 20px; font-style: italic; }
.gr { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-weight: 900; font-style: italic; font-size: 16px; color: #002313; }
.gr-A, .gr-B { background: var(--accent2); } .gr-C { background: var(--accent); } .gr-D { background: var(--nitro); } .gr-F { background: var(--danger); color: #fff; }

/* ------------------------------------------------------------ phone landscape */
body.land .money { top: calc(8px + var(--sat)); left: calc(84px + var(--sal)); padding: 4px 10px 5px; min-width: 0; }
body.land .money b { font-size: 18px; }
body.land .clock { top: calc(8px + var(--sat)); right: calc(58px + var(--sar)); }
body.land .mbtn { top: calc(8px + var(--sat)); right: calc(10px + var(--sar)); width: 38px; height: 38px; }
body.land .reg { top: calc(8px + var(--sat)); left: calc(222px + var(--sal)); right: calc(196px + var(--sar)); }
body.land .pris { top: calc(60px + var(--sat)); left: auto; right: calc(136px + var(--sar)); }
body.land .danger { top: calc(60px + var(--sat)); }
body.land .grantchip { top: calc(60px + var(--sat)); left: calc(84px + var(--sal)); max-width: 300px; }
body.land .feed { top: calc(104px + var(--sat)); left: calc(84px + var(--sal)); right: calc(200px + var(--sar)); }
body.land .viewing { top: calc(104px + var(--sat)); }
body.land .tray { top: 0; right: auto; width: 100%; padding: 0; background: none; pointer-events: none; }
body.land .tray > * { pointer-events: auto; }
body.land .cats { position: absolute; left: 0; top: 0; bottom: 0; width: 74px; padding: calc(8px + var(--sat)) 7px calc(8px + var(--sab)) calc(7px + var(--sal)); display: flex; flex-direction: column; gap: 4px; overflow-y: auto;
  background: linear-gradient(90deg, rgba(11, 20, 16, .97), rgba(11, 20, 16, .9) 85%, rgba(11, 20, 16, 0)); }
body.land .cat { padding: 3px 0 2px; font-size: 14px; flex: 0 0 auto; }
body.land .items { position: absolute; left: 80px; right: 10px; bottom: calc(6px + var(--sab)); padding: 6px 0 0; }
body.land .it { flex-basis: 76px; }
body.land .it .sw { height: 28px; }
body.land .brush { position: absolute; left: 84px; right: calc(10px + var(--sar)); bottom: calc(86px + var(--sab)); margin: 0; }
body.land .brush.solo { bottom: calc(8px + var(--sab)); }
body.land .toast { bottom: calc(140px + var(--sab)); }
body.land .banner { top: calc(100px + var(--sat)); }
body.land .sheet { left: auto; right: 0; top: 0; width: min(390px, 62vw); max-height: none; border-radius: 18px 0 0 18px; border-top: 0; border-left: 1px solid var(--line); }

/* ------------------------------------------------------------ desktop */
body.desk .money { top: 12px; left: 12px; min-width: 150px; }
body.desk .money b { font-size: 24px; }
body.desk .clock { top: 12px; left: 174px; right: auto; padding: 6px 12px; height: 56px; }
body.desk .clock b { font-size: 16px; }
body.desk .reg { top: 12px; left: 332px; right: auto; width: min(520px, calc(100vw - 900px)); height: 56px; min-width: 300px; }
body.desk .pris { top: 12px; left: auto; right: 260px; height: 56px; }
body.desk .danger { top: 12px; right: 74px; width: 176px; height: 56px; padding: 9px 12px; }
body.desk .mbtn { top: 12px; width: 52px; height: 56px; }
body.desk .grantchip { top: 78px; left: 12px; width: 290px; max-width: none; }
body.desk .grantchip .tx b { max-width: 200px; }
body.desk .feed { display: none; }
body.desk .viewing { top: 78px; right: auto; left: 316px; }
body.desk .vine { display: block; }
.panel { position: absolute; padding: 10px 10px 6px; }
.panel .lbl { font-size: 10px; font-weight: 900; color: var(--muted); letter-spacing: .16em; margin-bottom: 8px; display: flex; justify-content: space-between; }
.panel .lbl b { color: var(--accent); letter-spacing: .04em; }
.vine { top: 128px; left: 12px; width: 290px; max-height: calc(100vh - 360px); overflow: hidden; }
.post { display: flex; gap: 8px; padding: 7px 6px; border-radius: 9px; background: #ffffff07; margin-bottom: 5px; font-size: 12px; line-height: 1.3; width: 100%; text-align: left; cursor: pointer; }
.post .av { width: 26px; height: 26px; flex: 0 0 26px; border-width: 2px; }
.post .av::after { left: 4px; right: 4px; top: 7px; height: 3px; }
.post .av::before { height: 8px; }
.post b { font-size: 11px; } .post b span { color: var(--muted); font-weight: 700; margin-left: 3px; }
.post.hot { background: #ff5a5f1a; border: 1px solid #ff5a5f55; }
body.desk .tray { left: 50%; right: auto; bottom: 12px; transform: translateX(-50%); width: min(820px, calc(100vw - 660px)); min-width: 600px; padding: 8px 10px 10px; border-radius: 18px;
  background: rgba(11, 20, 16, .95); border: 1px solid var(--line); box-shadow: 0 6px 20px #0008; }
body.desk .items { padding: 8px 2px 8px; }
body.desk .it .k, body.desk .cat .kk { display: block; }
body.desk .cat { font-size: 15px; padding: 5px 0 4px; }
body.desk .brush { margin-bottom: 2px; }
body.desk .mini { display: block; right: 12px; bottom: 12px; padding: 6px; width: 300px; }
.mini canvas { display: block; width: 100%; height: 115px; border-radius: 8px; cursor: pointer; }
body.desk .keys { display: grid; position: absolute; left: 12px; bottom: 12px; width: 290px; padding: 8px 10px; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 10.5px; font-weight: 800; color: var(--muted); }
.keys b { color: var(--text); display: inline-block; min-width: 46px; }
body.desk .sheet { left: auto; right: 12px; top: 78px; bottom: auto; width: 340px; max-height: calc(100vh - 230px); border-radius: 16px; border: 1px solid var(--line); }
body.desk .sheet .grab { display: none; }
body.desk .toast { bottom: 200px; }
body.desk .banner { top: 90px; }

/* ------------------------------------------------------------ menu */
.screen { position: fixed; inset: 0; overflow-y: auto; touch-action: pan-y; background: radial-gradient(120% 60% at 50% 0%, #1d3a2c 0%, var(--bg) 60%); z-index: 10; }
.screen .wrap { padding: calc(16px + var(--sat)) 16px calc(24px + var(--sab)); max-width: 520px; margin: 0 auto; }
.logo { text-align: center; margin: 0 0 10px; }
.logo svg { display: block; margin: 0 auto 4px; }
.logo .t1 { font-size: 42px; line-height: .9; color: var(--accent); text-shadow: 0 4px 0 #8a6a00, 0 10px 26px #000; }
.logo .t2 { font-size: 26px; line-height: 1; margin-top: 2px; text-shadow: 0 3px 0 #2a4436; }
.logo .sub { color: var(--muted); font-size: 10px; letter-spacing: .3em; margin-top: 6px; }
.card { background: rgba(18, 32, 26, .92); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; margin-bottom: 8px; display: block; width: 100%; text-align: left; }
.lbl { font-size: 10.5px; font-weight: 900; color: var(--muted); letter-spacing: .14em; margin-bottom: 8px; text-transform: uppercase; display: flex; justify-content: space-between; }
.lbl b { color: var(--accent); letter-spacing: .06em; }
.saved { display: flex; align-items: center; gap: 10px; background: var(--panel2); border-radius: 12px; padding: 5px 6px 5px 5px; margin-bottom: 5px; width: 100%; text-align: left; }
.saved:last-child { margin-bottom: 0; }
.saved canvas, .saved img { width: 70px; height: 48px; border-radius: 8px; flex: 0 0 70px; background: #2d4a33; object-fit: cover; }
.saved .nm { font-weight: 900; font-size: 14px; font-style: italic; }
.saved .ds { font-size: 10.5px; color: var(--muted); font-weight: 800; margin-top: 2px; }
.saved .gr { margin-left: auto; }
.saved .del { font-size: 14px; padding: 8px 6px; opacity: .55; }
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.chip { text-align: center; padding: 10px 4px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); font-size: 12.5px; }
.chip.sel { background: var(--accent); color: #1a1400; border-color: var(--accent); }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.hint b { color: var(--accent); }
.plots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.plot { border-radius: 12px; background: var(--panel2); border: 2px solid var(--line); padding: 5px 5px 7px; text-align: center; }
.plot.sel { border-color: var(--accent); background: #2a2a10; }
.plot.lock { opacity: .4; }
.plot canvas { width: 100%; height: 54px; border-radius: 8px; display: block; background: #2d4a33; }
.plot b { display: block; font-size: 11px; margin-top: 5px; }
.plot small { font-size: 9.5px; color: var(--muted); font-weight: 800; }
.namerow { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 11px; font-weight: 900; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.inp { flex: 1; min-width: 0; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font-size: 15px; font-weight: 800; color: var(--text); -webkit-user-select: text; user-select: text; touch-action: manipulation; }
.dice { font-size: 18px; width: 40px; height: 40px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.set { background: var(--panel2); border-radius: 10px; padding: 9px 10px; display: flex; justify-content: space-between; gap: 6px; font-size: 12px; font-weight: 800; color: var(--muted); }
.set b { color: var(--text); white-space: nowrap; }
.how summary { cursor: pointer; margin: 0; list-style: none; }
.how summary::-webkit-details-marker { display: none; }
.how ul { margin: 8px 0 2px 16px; font-size: 12px; line-height: 1.45; color: #cfe0d6; }
.how li { margin-bottom: 5px; } .how b { color: var(--accent); }
.go { display: block; width: 100%; padding: 14px; border-radius: 14px; background: linear-gradient(180deg, #ffe066, #f0b400); color: #241900; font-size: 19px; box-shadow: 0 6px 0 #a37a00; text-align: center; margin-top: 6px; }
.btn { padding: 13px; border-radius: 12px; text-align: center; font-size: 15px; }
.btn.ghost { background: var(--panel2); border: 1px solid var(--line); }
.btn.wide { display: block; width: 100%; margin-top: 10px; }
.foot { text-align: center; font-size: 11px; color: var(--muted); margin-top: 10px; }
.ggs-foot { text-align: center; font-size: 11px; margin-top: 12px; }
.ggs-foot a { color: var(--muted); text-underline-offset: 2px; }

/* ------------------------------------------------------------ overlays: pause, daily report */
.overlay { position: fixed; inset: 0; background: rgba(4, 9, 6, .74); backdrop-filter: blur(3px); z-index: 8; overflow-y: auto; touch-action: pan-y; }
.panel2 { max-width: 380px; margin: 0 auto; padding: calc(56px + var(--sat)) 16px 30px; display: grid; gap: 8px; }
.ptitle { text-align: center; font-size: 38px; color: var(--accent); margin-bottom: 4px; }
.pstats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.prow { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.res { max-width: 400px; margin: max(20px, 4vh) auto 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px 16px 16px; text-align: center; box-shadow: 0 20px 50px #000c; width: calc(100% - 24px); }
.res .pre { font-size: 10px; font-weight: 900; letter-spacing: .2em; color: var(--muted); }
.res .ttl { font-size: 30px; color: var(--accent); margin-top: 4px; line-height: 1; }
.res .sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.grade { width: 92px; height: 92px; margin: 12px auto 6px; border-radius: 24px; display: grid; place-items: center; font-size: 58px;
  background: radial-gradient(circle at 35% 30%, #8ff7c1, #1fb46d); color: #002313; box-shadow: 0 10px 30px #1fb46d55; border: 3px solid #ffffff55; animation: gpop .5s ease-out; }
@keyframes gpop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.1); } }
.grade.g-C { background: radial-gradient(circle at 35% 30%, #fff0a0, #f0b400); color: #241900; box-shadow: 0 10px 30px #f0b40055; }
.grade.g-D { background: radial-gradient(circle at 35% 30%, #ffc98a, #e07a20); color: #241000; box-shadow: 0 10px 30px #e07a2055; }
.grade.g-none { background: var(--panel2); color: var(--muted); box-shadow: none; }
.gr-N { background: var(--panel2); color: var(--muted); }
.grade.g-F { background: radial-gradient(circle at 35% 30%, #ff9a9d, #d8323a); color: #fff; box-shadow: 0 10px 30px #d8323a55; }
.tally { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.tally div { background: var(--panel2); border-radius: 10px; padding: 6px 4px; }
.tally b { display: block; font-size: 18px; font-style: italic; }
.tally span { font-size: 8.5px; font-weight: 900; letter-spacing: .1em; color: var(--muted); }
.tally b.bad { color: #ff8a8d; }
.res .ledger { text-align: left; margin-top: 10px; }
.res .ledger .tot em { color: var(--accent2); } .res .ledger .tot em.n { color: #ff8a8d; }
.grantbox { margin-top: 10px; background: #2a2a10; border: 1px solid var(--accent); border-radius: 12px; padding: 8px 10px; text-align: left; display: flex; gap: 10px; align-items: center; }
.grantbox .ic { font-size: 22px; }
.grantbox b { display: block; font-size: 13px; } .grantbox small { font-size: 11px; color: var(--muted); font-weight: 700; }
.grantbox em { margin-left: auto; font-style: italic; font-weight: 900; color: var(--accent); white-space: nowrap; }

#padcur { position: fixed; left: 0; top: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 3px solid #ffd23f; box-shadow: 0 0 0 2px #0b1410, 0 0 12px #ffd23f88; pointer-events: none; z-index: 50; }
#padcur::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #ffd23f; }
#padcur.down { transform: scale(.8); background: #ffd23f33; }
