/* Scoutcamp — a warm board game on a wooden table.
   Palette from docs/implementation-plan.md "The art style". */
:root {
  --ink: #2E1F14;
  --ink-2: #5A4430;
  --ink-3: #7A6450;
  --parch: #E6D3B0;
  --parch-hi: #F2E6CC;
  --parch-lo: #D6BF96;
  --canvas: #F7EEDB;
  --wood: #9A6B3C;
  --wood-dk: #6D4524;
  --wood-xdk: #45291A;
  --brass: #C9A24A;
  --brass-dk: #9C7A2C;
  --teal: #3E7A7B;
  --teal-dk: #2F6366;
  --meadow: #7FA650;
  --forest: #3F6B35;
  --fire: #D9622B;
  --good: #2F6B3A;
  --bad: #A8322D;
  --warn: #9A6212;
  --night: #1F2A44;
  --mood-thrilled: #4E9A51;
  --mood-happy: #9CBB4C;
  --mood-meh: #E2B84B;
  --mood-sad: #DE8C3C;
  --mood-miserable: #C0443C;
  --lvl-poor: #8C7B6B;
  --lvl-good: #5E8F34;
  --lvl-great: #2F7374;
  --lvl-unforgettable: #C9A24A;
  --radius: 10px;
  --shadow: 0 2px 0 rgba(46, 31, 20, .25), 0 6px 18px rgba(20, 10, 4, .25);
  --font: "Segoe UI", Ubuntu, "DejaVu Sans", "Noto Sans", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-title: Georgia, "DejaVu Serif", "Noto Serif", "Times New Roman", serif;
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--wood-dk);
  background-image:
    repeating-linear-gradient(92deg, rgba(0,0,0,.05) 0 2px, transparent 2px 38px),
    repeating-linear-gradient(88deg, rgba(255,255,255,.035) 0 1px, transparent 1px 23px),
    linear-gradient(180deg, #7A4E2B, #5B3A21);
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-title); margin: 0; line-height: 1.2; }
p { margin: .35em 0; }
small { font-size: .82em; }
.fine { font-size: .84rem; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.flip { display: inline-flex; transform: scaleX(-1); }
.flip-x { transform: scaleX(-1); }
svg.ic { flex: none; vertical-align: -0.2em; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }

#app { height: 100dvh; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35em;
  min-height: 40px; padding: .4em .9em; border-radius: 8px;
  border: 2px solid var(--wood-dk); background: var(--parch-hi); color: var(--ink);
  font-weight: 600; cursor: pointer; box-shadow: 0 2px 0 var(--wood-dk);
  text-align: center;
}
.btn:hover:not(:disabled) { background: #fff6e2; }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 var(--wood-dk); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { min-height: 36px; padding: .25em .6em; font-size: .9rem; }
.btn.primary { background: var(--brass); border-color: var(--brass-dk); box-shadow: 0 2px 0 var(--brass-dk); }
.btn.primary:hover:not(:disabled) { background: #d8b35c; }
.btn.ready { background: var(--forest); border-color: #28461f; color: #FFF8E8; box-shadow: 0 3px 0 #28461f; font-size: 1.05rem; padding: .45em 1.2em; }
.btn.ready:hover:not(:disabled) { background: #4b7c40; }
.btn.big { font-size: 1.15rem; min-height: 48px; }
.iconbtn {
  display: inline-flex; align-items: center; gap: .3em; min-width: 40px; min-height: 40px; justify-content: center;
  border: 2px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; padding: 0 .4em;
}
.iconbtn:hover { background: rgba(255,255,255,.12); }
.iconbtn.small { min-width: 32px; min-height: 32px; }
.iconbtn:disabled { opacity: .4; cursor: default; }
.linkbtn { background: none; border: 0; color: var(--teal-dk); text-decoration: underline; cursor: pointer; min-height: 32px; }
.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: .25em; padding: .1em .5em; border-radius: 999px; background: rgba(0,0,0,.08); font-size: .85rem; }
.chip-btn {
  display: inline-flex; align-items: center; gap: .3em; min-height: 40px; padding: .3em .75em; border-radius: 999px;
  border: 2px solid var(--parch-lo); background: var(--canvas); cursor: pointer; font-weight: 500;
}
.chip-btn.on { border-color: var(--forest); background: #e3efd2; box-shadow: inset 0 0 0 1px var(--forest); font-weight: 700; }
.chip-btn:disabled { opacity: .45; cursor: not-allowed; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.choices-col { display: flex; flex-direction: column; gap: 4px; border: 0; padding: 0; margin: 6px 0; }
.choices-col legend { font-weight: 700; margin-bottom: 4px; }
.choice { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px; border-radius: 8px; border: 2px solid var(--parch-lo); background: var(--canvas); cursor: pointer; }
.choice.on { border-color: var(--forest); background: #e3efd2; }
.choice.disabled { opacity: .5; }
.choice input { width: 18px; height: 18px; accent-color: var(--forest); }
.choice-l { flex: 1; }
.choice-odds { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.toggle { display: flex; align-items: center; gap: 6px; min-height: 36px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--forest); flex: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 2px solid var(--wood); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: .25em .6em; min-height: 34px; cursor: pointer; font-size: .85rem; font-weight: 600; }
.seg button.on { background: var(--wood); color: #FFF8E8; }

/* ---------------------------------------------------------------- loading */
.loading-screen { flex: 1; display: grid; place-items: center; }
.loading-card { background: var(--parch); padding: 2em 3em; border-radius: 16px; box-shadow: var(--shadow); text-align: center; }
.loading-card h1 { font-size: 2.2rem; }

/* ---------------------------------------------------------------- panels */
.panel {
  background: var(--parch);
  background-image: radial-gradient(ellipse at 20% 0%, rgba(255,255,255,.35), transparent 60%);
  border: 2px solid var(--wood-dk); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 2px solid var(--parch-lo); flex: none; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.12rem; display: flex; align-items: center; gap: .3em; }
.head-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.panel-body { flex: 1; overflow: auto; padding: 8px 10px 12px; min-height: 0; overscroll-behavior: contain; }
.panel-foot { flex: none; display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 8px 10px; border-top: 2px solid var(--parch-lo); background: rgba(255,255,255,.18); }
.panel-foot .btn.ready { min-width: 50%; }
h3.sub { font-size: 1rem; margin: 12px 0 6px; display: flex; align-items: center; gap: .35em; flex-wrap: wrap; }
h3.sub.bad { color: var(--bad); }
.note { background: rgba(255,255,255,.35); border-left: 4px solid var(--teal); padding: 6px 8px; border-radius: 6px; font-size: .9rem; }
.note.warnnote { border-left-color: var(--warn); }
.note.warnnote.bad { border-left-color: var(--bad); background: #fbe3dc; color: var(--ink); }
.campwarn { display: grid; gap: 4px; margin: 6px 0; }
/* the meal after this block, from the preview */
.mealline { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0; padding: 6px 8px; border-radius: 6px; border-left: 4px solid var(--teal); background: rgba(255,255,255,.45); font-size: .9rem; }
.mealline > svg { flex: none; margin-top: 2px; }
.mealline small { color: var(--ink-2); }
.mealline.good { border-left-color: var(--good); background: #e6f0da; }
.mealline.warn { border-left-color: var(--warn); background: #fbf0d6; }
.mealline.bad { border-left-color: var(--bad); background: #fbe3dc; }
.mealline .fix { font-weight: 600; }
/* which Signatures are left this camp */
.sigstrip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 6px; font-size: .8rem; }
.sigstrip-l { display: inline-flex; align-items: center; gap: 2px; color: var(--brass-dk); font-weight: 700; }
.sigchip { display: inline-flex; align-items: center; gap: 1px; padding: 1px 7px; border-radius: 999px; border: 1.5px dashed var(--brass); background: #fff6db; white-space: nowrap; }
.sigchip small { color: var(--ink-2); }
.sigchip.planned { border-style: solid; background: #fbe7a8; font-weight: 700; }
.sigchip.notnow { opacity: .8; }
.sigchip.spent { border: 1.5px solid var(--parch-lo); background: rgba(0,0,0,.06); color: var(--ink-3); }
.sigchip.spent .sigchip-n { text-decoration: line-through; }
.toggle.sig.spent { border-style: solid; border-color: var(--parch-lo); background: rgba(0,0,0,.05); color: var(--ink-3); cursor: not-allowed; }
.opt.spent .opt-title s { text-decoration-thickness: 1px; }
.opt-sub .does { color: var(--ink); }
.warn { color: var(--warn); font-weight: 600; font-size: .9rem; }
.bad { color: var(--bad); }
.good { color: var(--good); }
.engine-error { background: #F6DDD6; border: 2px solid var(--bad); color: #5d1712; border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.engine-error ul { margin: 4px 0 0; padding-left: 1.2em; }
.problem { color: var(--bad); font-weight: 600; font-size: .88rem; margin-top: 4px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  flex: none; color: var(--parch-hi);
  background: linear-gradient(180deg, #4E311C, #3B2415);
  border-bottom: 3px solid #2a190e; box-shadow: 0 3px 10px rgba(0,0,0,.35);
  padding: 4px 8px; display: flex; flex-direction: column; gap: 3px;
}
.tb-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-main > * { flex: none; }
.daytrack { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto !important; }
.dayno { font-family: var(--font-title); font-size: 1.3rem; font-weight: 700; color: #FFE9B8; white-space: nowrap; }
.dayno small { font-size: .7em; font-weight: 400; color: var(--parch); }
.phases { display: flex; list-style: none; margin: 0; padding: 0; gap: 2px; }
.phase { padding: 3px 9px; border-radius: 999px; font-size: .85rem; color: #d9c7a4; border: 1px solid rgba(230,211,176,.25); }
.phase.done { color: #a8977a; text-decoration: line-through; text-decoration-thickness: 1px; }
.phase.now { background: var(--brass); color: var(--ink); font-weight: 700; border-color: var(--brass); }
.phase { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.phase.moonnight .ic { color: #ffe39a; }
.phase.now.moonnight .ic { color: var(--ink); }
.mailmark { display: inline-flex; margin-left: 6px; color: #ffe39a; vertical-align: middle; }
.diftag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; border: 1.5px solid #ffb38a; color: #ffd2b8; font-family: var(--font); font-size: .6em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; vertical-align: middle; }
.daytrack { overflow: hidden; }
.topbar .chip { background: rgba(230,211,176,.15); color: var(--parch-hi); }
.weather { display: flex; align-items: center; gap: 6px; }
.wx { display: flex; align-items: center; gap: 5px; background: rgba(230,211,176,.12); border: 1px solid rgba(230,211,176,.22); border-radius: 8px; padding: 2px 7px; }
.wx-t { display: flex; flex-direction: column; line-height: 1.05; }
.wx-t small { font-size: .7rem; color: #cdb993; }
.wx-t b { font-size: .92rem; }
.wx-t .rain { color: #9fd0e0; }
.wx.fam-wet { border-color: #6fa6c4; }
.wx.fam-wild { border-color: #d98a5b; }
.wind { display: flex; flex-direction: column; align-items: center; font-size: .7rem; color: #cdb993; }
.track { display: flex; align-items: center; gap: 6px; }
.track small { font-size: .7rem; color: #cdb993; display: block; }
.track > b { font-size: 1.1rem; }
.track .delta { font-size: .85rem; color: #ffd58a; }
.pips { display: flex; gap: 3px; }
.pip { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #e8c77a; display: inline-block; }
.pips .pip.on { background: #f0b545; }
.pips .pip.gain { background: #b8e08c; border-style: dashed; }
.pips .pip.spend { background: transparent; border-color: #ff9d7a; border-style: dashed; }
.spirit .ic { color: #ffab4a; }
.phone {
  display: flex; flex-direction: column; gap: 2px; width: 230px; text-align: left;
  background: #1c1c22; color: #eee; border: 2px solid #111; border-radius: 12px; padding: 4px 8px 5px; cursor: pointer;
  box-shadow: inset 0 0 0 1px #3a3a44;
}
.phone-head { display: flex; align-items: center; gap: 5px; font-size: .72rem; color: #bbb; }
.phone-head b { margin-left: auto; font-size: .85rem; color: #fff; }
.phone-bar { height: 4px; background: #333; border-radius: 3px; overflow: hidden; }
.phone-bar i { display: block; height: 100%; background: #6fc16b; }
.phone.warn .phone-bar i { background: #e8b23d; }
.phone.danger .phone-bar i { background: #e2533f; }
.phone.danger { border-color: #e2533f; }
.bubble { background: #2e7d5b; color: #fff; border-radius: 10px 10px 10px 2px; padding: 2px 7px; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.phone.warn .bubble { background: #8a6a1f; }
.phone.danger .bubble { background: #9b2b20; }
.topbar .iconbtn { color: var(--parch-hi); }
.topbar .iconbtn.on { background: rgba(230,211,176,.2); }
.tb-res { justify-content: flex-start; }
.resources { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.res { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 6px; background: rgba(230,211,176,.1); font-size: .85rem; }
.res b { font-size: .95rem; }
.res small { color: #cdb993; font-size: .72rem; }
.res.wet { outline: 1px dashed #9fd0e0; }
.res .delta { font-size: .8rem; font-weight: 700; }
.res .delta.up { color: #b8e08c; }
.res .delta.down { color: #ffb08f; }

/* ---------------------------------------------------------------- board */
.board {
  flex: 1; min-height: 0; display: grid; gap: 8px; padding: 8px;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(340px, 410px);
  grid-template-rows: minmax(0, 1fr);
}
.centre { display: flex; flex-direction: column; min-height: 0; gap: 6px; }
.mapwrap { flex: 0 1 auto; min-height: 160px; display: flex; justify-content: center; }
.mapscroll { flex: 1; display: flex; min-height: 0; justify-content: center; }
.map {
  width: 100%; height: auto; max-height: 100%; display: block;
  background: #2b4d3a; border: 3px solid var(--wood-xdk); border-radius: 12px; box-shadow: var(--shadow);
}
.mapinfo { flex: none; }
.belowmap { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.tabs { display: none; }
.logpanel { display: none; }
body[data-log="open"] .logpanel {
  display: flex; position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: 10px; width: min(880px, 94vw); height: min(56vh, 520px);
}

/* ---------------------------------------------------------------- map */
.mapbg { fill: #274635; }
.hex { cursor: pointer; }
.hexbg { stroke: rgba(46,31,20,.42); stroke-width: 1.2; }
.hex:hover .hexbg { stroke: #fff4d6; stroke-width: 2.4; }
.hex.sel .hexbg { stroke: #FFE9A8; stroke-width: 4; }
.hex.facedown .hexbg { fill: #2E5227; }
.qmark { font: 700 20px var(--font); fill: #cfe3bf; text-anchor: middle; opacity: .8; pointer-events: none; }
.wave { fill: none; stroke: rgba(255,255,255,.35); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.grass { stroke: #7d7a2e; stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.tileicon { color: rgba(30, 50, 20, .55); pointer-events: none; }
.t-road .tileicon { color: rgba(90,60,30,.5); }
.t-hilltop .tileicon, .t-slope .tileicon { color: rgba(90,60,30,.45); }
.t-spring .tileicon { color: #e9fbff; }
.bldbg { fill: var(--canvas); stroke: var(--wood-xdk); stroke-width: 2; }
.bldicon { color: var(--ink); }
.bld.damaged .bldbg { fill: #f3c9bd; }
.dmg { stroke: var(--bad); stroke-width: 3; stroke-linecap: round; }
.q { stroke: var(--ink); stroke-width: 1.5; }
.q0 { fill: #C9573F; } .q1 { fill: #E0A93F; } .q2 { fill: #CFC65A; } .q3 { fill: #7FB85A; } .q4 { fill: #3E9A55; }
.qtext { font: 700 11px var(--font); fill: var(--ink); text-anchor: middle; pointer-events: none; }
.fpline { stroke: var(--wood-xdk); stroke-width: 3; stroke-dasharray: 3 3; }
.fpdot { fill: var(--canvas); stroke: var(--wood-xdk); stroke-width: 2; }
.ghost { opacity: .78; }
.ghostbg { fill: rgba(255,241,207,.7); stroke: var(--brass-dk); stroke-width: 2; stroke-dasharray: 4 3; }
.sitebg { fill: rgba(247,238,219,.75); stroke: var(--wood-xdk); stroke-width: 2; stroke-dasharray: 5 3; }
.progbg { fill: rgba(46,31,20,.25); }
.prog { fill: var(--brass-dk); }
.sitetext { font: 700 10px var(--font); fill: var(--ink); text-anchor: middle; paint-order: stroke; stroke: var(--canvas); stroke-width: 3px; }
.tentshape { fill: var(--pc); stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.tentside { fill: color-mix(in srgb, var(--pc) 70%, #000); stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.tentdoor { stroke: var(--ink); stroke-width: 2; }
.pole { stroke: var(--ink); stroke-width: 2; }
.flagcloth { fill: var(--pc); stroke: var(--ink); stroke-width: 1.3; }
.meeplebg { fill: #FFF3D6; stroke: var(--ink); stroke-width: 2; }
.meepleicon { color: var(--ink); }
.plume { fill: rgba(240,240,240,.35); stroke: rgba(255,255,255,.7); stroke-dasharray: 4 3; }
.windbg { fill: rgba(247,238,219,.9); stroke: var(--wood-xdk); stroke-width: 1.5; }
.windarrow { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.windtext { font: 600 11px var(--font); fill: var(--ink); }
.map.picking .hex.dim .hexbg { filter: saturate(.35) brightness(.7); }
.map.picking .hex.cand .hexbg { stroke: #fff; stroke-width: 1.6; }
.heatfill { opacity: .82; stroke: var(--ink); stroke-width: 1.2; }
.heatq { font: 800 17px var(--font); fill: #fff; text-anchor: middle; paint-order: stroke; stroke: var(--ink); stroke-width: 3px; }
.heatdot { fill: #fff; stroke: var(--ink); stroke-width: 2; }
.hex.foot .hexbg { stroke: #FFE9A8; stroke-width: 3.5; stroke-dasharray: 5 3; }
.nightveil { fill: #0c1430; opacity: 0; transition: opacity .6s; }
.map.nighttime .nightveil { opacity: .45; }
.hexinfo, .pickbanner {
  background: var(--parch); border: 2px solid var(--wood-dk); border-radius: var(--radius); padding: 6px 10px; box-shadow: var(--shadow);
  display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: .9rem;
}
.hexinfo.muted { color: var(--ink-2); }
.hexb { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.like { color: var(--good); margin-right: 6px; }
.dislike { color: var(--bad); margin-right: 6px; }
.pickbanner { border-color: var(--brass-dk); background: #FFF1CF; }
.pick-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%; }
.pickdetail { width: 100%; }
.pickdetail.illegal { color: var(--bad); }
.pick-actions { display: flex; gap: 8px; width: 100%; justify-content: flex-end; }
.affects { color: var(--warn); font-weight: 600; }

/* ---------------------------------------------------------------- calendar + project */
.calendar { display: flex; gap: 4px; list-style: none; margin: 0; padding: 4px; background: rgba(0,0,0,.18); border-radius: 10px; flex: none; overflow-x: auto; }
.calday { flex: 1 0 52px; display: flex; align-items: center; justify-content: center; gap: 3px; background: var(--parch); border: 2px solid var(--parch-lo); border-radius: 8px; padding: 2px 4px; min-height: 34px; font-size: .85rem; }
.calday.today { border-color: var(--brass-dk); background: #FFF1CF; box-shadow: 0 0 0 2px var(--brass); }
.calday.past { opacity: .6; }
.calday.fam-wet { background: #dbe8ee; }
.calday.fam-wild { background: #f1dccb; }
.calmarks { display: inline-flex; gap: 1px; }
.project { background: var(--parch); border: 2px solid var(--wood-dk); border-radius: var(--radius); padding: 6px 10px; box-shadow: var(--shadow); }
.proj-head { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.milestones { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .88rem; }
.milestones li.done { color: var(--good); font-weight: 700; }
.ms-kids { font-size: .82rem; color: var(--ink-2); }
.ms-group { border-bottom: 1px dotted var(--ink-3); cursor: help; }

/* ---------------------------------------------------------------- roster */
.roster .panel-body { padding: 6px; }
.mat { border: 2px solid var(--pc); border-radius: 10px; margin-bottom: 8px; background: color-mix(in srgb, var(--pc) 9%, var(--parch-hi)); overflow: hidden; }
.mat-head { display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 4px 8px; background: color-mix(in srgb, var(--pc) 22%, var(--parch)); flex-wrap: wrap; }
.mat-marks { display: flex; gap: 6px; align-items: center; font-size: .82rem; }
.mark { display: inline-flex; align-items: center; gap: 2px; }
.mark.bad { color: var(--bad); }
.mat-tokens { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 8px; font-size: .82rem; }
.mat-tokens.empty { color: var(--ink-3); font-style: italic; }
.mat-discs { padding: 0 8px 4px; font-size: .75rem; color: var(--ink-2); }
.pbadge { display: inline-flex; align-items: center; gap: 4px; }
.pbadge b { font-weight: 700; }
.pshape * { fill: var(--pc); stroke: var(--ink); stroke-width: 1.4; }
.kid {
  display: flex; width: 100%; gap: 6px; align-items: flex-start; text-align: left; padding: 5px 7px; border: 0; border-top: 1px solid rgba(46,31,20,.12);
  background: transparent; cursor: pointer; min-height: 44px;
}
.kid:hover { background: rgba(255,255,255,.4); }
.kid.home { opacity: .55; filter: grayscale(.8); }
.kid.crisis { background: #F6DDD6; box-shadow: inset 4px 0 0 var(--bad); }
.kid.flash { animation: flash 1.2s ease-out 1; box-shadow: inset 4px 0 0 var(--brass); }
@keyframes flash { 0% { background: #ffe08a; } 100% { background: transparent; } }
.kid-face { flex: none; padding-top: 2px; }
.kid-main { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.kid-top { display: flex; align-items: center; gap: 4px; }
.kid-name { font-size: .98rem; }
.kid-h { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: .9rem; }
.kid-h .delta { font-size: .8rem; font-weight: 700; color: var(--teal-dk); }
.kid-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: .78rem; color: var(--ink-2); }
.kid-state { display: flex; flex-wrap: wrap; gap: 3px 5px; align-items: center; font-size: .78rem; }
.quirk { font-style: italic; }
.mems { display: inline-flex; align-items: center; gap: 1px; }
.kproj { display: inline-flex; align-items: center; gap: 1px; color: var(--teal-dk); font-weight: 600; }
.predv, .ft { display: inline-flex; color: var(--brass-dk); }
.ft { color: var(--forest); gap: 2px; font-size: .78rem; }
.homeline { color: var(--ink-2); display: flex; gap: 4px; align-items: center; }
.homeline.big { font-size: 1rem; color: var(--bad); font-weight: 600; }
.hpips { display: inline-flex; gap: 2px; }
.hpips .pip { width: 9px; height: 9px; border: 1.5px solid var(--ink-2); }
.hpips .pip.on { background: var(--ink-2); }
.hpips .pip.gain { background: #8fc46a; border-color: var(--good); }
.hpips .pip.loss { background: #f2b7a8; border-color: var(--bad); border-style: dashed; }
.face .face-bg { stroke: var(--ink); stroke-width: 1.5; }
.face-ink { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
.face-ink.thin { stroke-width: 1.3; }
.face-ink-fill { fill: var(--ink); stroke: var(--ink); stroke-width: 1; }
.face-tear { fill: #6fb7e8; stroke: var(--ink); stroke-width: .6; }
.mood-thrilled .face-bg { fill: var(--mood-thrilled); }
.mood-happy .face-bg { fill: var(--mood-happy); }
.mood-meh .face-bg { fill: var(--mood-meh); }
.mood-sad .face-bg { fill: var(--mood-sad); }
.mood-miserable .face-bg { fill: var(--mood-miserable); }
.stok { display: inline-flex; align-items: center; gap: 2px; padding: 0 5px 0 3px; border-radius: 6px; border: 1.5px solid; font-size: .76rem; font-weight: 600; background: var(--canvas); }
.stok.on-patrol { border-color: #6f5a44; }
.stok.on-kid { border-color: #8a3b6b; color: #6b2451; }
.stok.going { text-decoration: line-through; opacity: .6; border-style: dashed; }
.stok.coming { border-style: dashed; background: #fbe3d8; }
.st-wet { color: #1f5f80; } .st-dirty { color: #6a4a23; } .st-hungry { color: #8a4b12; } .st-tired { color: #4b4a7a; } .st-sore { color: #a2412b; }
.tagi { display: inline-flex; align-items: center; position: relative; }
.tag-love { color: var(--good); }
.tag-hate { color: var(--bad); }
.tag-mark { font-style: normal; font-size: .7em; font-weight: 800; margin-left: -1px; }
.wish { display: inline-flex; align-items: center; gap: 2px; }
.wish.granted { color: var(--good); font-weight: 700; }
.rx { display: inline-flex; align-items: center; gap: 1px; padding: 0 4px; border-radius: 5px; font-weight: 700; font-size: .78rem; }
.rx.up { background: #d7ecc4; color: #1f4f16; }
.rx.down { background: #f6d2c8; color: #7b1e12; }
.rx.hl { background: #fff0b8; color: #6b5310; }
.rx.mem { background: #e6d7f5; color: #4a2a74; }
.nightchip { display: inline-flex; align-items: center; gap: 1px; font-weight: 700; padding: 0 4px; border-radius: 5px; background: rgba(31,42,68,.1); color: var(--night); white-space: nowrap; }
.nightchip.drop { background: #fbe9c7; color: #6b4a0e; }
.nightchip.bad { background: #f6d2c8; color: #7b1e12; }
.crisis-tag { color: var(--bad); font-weight: 700; display: inline-flex; gap: 2px; align-items: center; }
.flashbits { display: inline-flex; gap: 2px; }
.rel { display: inline-flex; align-items: center; gap: 2px; font-size: .8rem; padding: 0 5px; border-radius: 6px; }
.rel.friend { color: #22531b; background: #dfeccd; }
.rel.friend.apart { color: #7a5410; background: #f3e4c0; }
.rel.rival { color: #7b1e12; background: #f6dcd4; }
.rel.rival.apart { background: #eee4d4; color: var(--ink-2); }
.legend { margin-top: 8px; }

/* ---------------------------------------------------------------- level chips */
.lvl { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px 1px 5px; border-radius: 6px; color: #fff; font-weight: 700; font-size: .8rem; }
.lvl-bars { display: inline-flex; align-items: flex-end; gap: 1px; height: 11px; }
.lvl-bars i { width: 3px; background: rgba(255,255,255,.35); border-radius: 1px; }
.lvl-bars i:nth-child(1) { height: 4px; } .lvl-bars i:nth-child(2) { height: 6px; } .lvl-bars i:nth-child(3) { height: 8px; } .lvl-bars i:nth-child(4) { height: 11px; }
.lvl-bars i.on { background: #fff; }
.lvl-poor { background: var(--lvl-poor); }
.lvl-good { background: var(--lvl-good); }
.lvl-great { background: var(--lvl-great); }
.lvl-unforgettable { background: var(--lvl-unforgettable); color: var(--ink); }
.lvl-unforgettable .lvl-bars i.on { background: var(--ink); }

/* ---------------------------------------------------------------- plan panel */
.planpanel, .dawnpanel, .resolvepanel { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.prow { border: 2px solid var(--parch-lo); border-radius: 10px; padding: 6px 8px; margin-bottom: 6px; background: var(--parch-hi); }
.prow.patrolrow { border-left: 6px solid var(--pc); }
.prow.has-problem { border-color: var(--bad); }
.prow.busy { opacity: .7; }
.prow-head { display: flex; align-items: center; gap: 8px; }
.prow-head .who { display: inline-flex; align-items: center; gap: 4px; min-width: 88px; flex: none; }
.prow-head .what { flex: 1; min-width: 0; display: block; font-size: .9rem; }
.prow-head .what > svg { margin-right: 4px; color: var(--wood-dk); }
.prow-head .what small { display: block; color: var(--ink-2); }
.prow-head .btn { flex: none; }
.lock { display: inline-flex; align-items: center; gap: 2px; font-size: .8rem; color: var(--ink-2); padding: 0 6px; }
.lvline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; font-size: .82rem; }
.lvline .up { color: var(--good); }
.lvline .down { color: var(--bad); }
.lvline .from { color: var(--ink-3); }
.sigmark { color: var(--brass-dk); font-weight: 800; }
.kidrx { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.kx { display: inline-flex; align-items: center; gap: 3px; font-size: .78rem; padding: 1px 5px; border-radius: 6px; background: rgba(255,255,255,.55); border: 1px solid var(--parch-lo); }
.kx-ic { font-style: normal; font-weight: 800; }
.kx-love .kx-ic { color: var(--good); }
.kx-hate .kx-ic { color: var(--bad); }
.kx-sits_out, .kx-shallows { color: var(--ink-2); }
.res-list { margin-top: 4px; display: flex; flex-direction: column; gap: 3px; }
.res-one { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.res-one .lvline { margin: 0; }
.inline-sel { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: .86rem; flex-wrap: wrap; }
.inline-sel select { min-height: 34px; border-radius: 6px; border: 2px solid var(--parch-lo); background: var(--canvas); max-width: 100%; }
.toggle.sig { margin-top: 4px; font-size: .86rem; padding: 2px 6px; border-radius: 8px; border: 2px dashed var(--brass); background: #fff6db; }
.toggle.sig.on { border-style: solid; background: #fbe7a8; }
.stchanges { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: .8rem; margin-top: 4px; }
.stchanges .gain { color: var(--bad); }
.stchanges .lose { color: var(--good); }
.odds { font-size: .82rem; margin-top: 3px; color: #6b3a0e; }
.pv-sec { border-top: 2px dashed var(--parch-lo); padding-top: 6px; margin-top: 8px; }
.pv-sec h4 { font-size: .95rem; display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.nightlist, .oddslist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; font-size: .86rem; }
.nightlist li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; padding: 3px 6px; border-radius: 6px; }
.nightlist li.bad { background: #f6d2c8; }
.nightlist li.warn { background: #fbe9c7; }
.nightlist small { width: 100%; color: var(--ink-2); padding-left: 22px; }
.crisis-word { color: var(--bad); }
.odds-n { display: inline-block; min-width: 3.6em; color: #6b3a0e; }
.reslist { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .86rem; }
.reslist .res { background: rgba(0,0,0,.05); }
.reslist .res.up { color: var(--good); }
.reslist .res.down { color: var(--bad); }
.buy { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 2px 12px; margin-top: 4px; }
.buy > .fine { grid-column: 1 / -1; }
.buyrow { display: flex; align-items: center; gap: 6px; font-size: .86rem; }
.buyname { flex: 1; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper .iconbtn { border: 2px solid var(--parch-lo); background: var(--canvas); }
.stepper b { min-width: 1.4em; text-align: center; }
.phoneorder summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; gap: 4px; font-size: .9rem; }
.finalebox { border: 2px solid var(--brass); background: #fff3d2; border-radius: 8px; padding: 6px 8px; margin-top: 6px; }
.extras > * + * { margin-top: 6px; }

/* ---------------------------------------------------------------- sheet / dialogs */
.scrim { position: fixed; inset: 0; background: rgba(20,10,4,.55); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 12px; }
.scrim.light { background: rgba(20,10,4,.25); align-items: flex-start; justify-content: flex-start; }
.sheet {
  width: min(660px, 100%); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--parch); border: 3px solid var(--wood-dk); border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 2px solid var(--parch-lo); background: color-mix(in srgb, var(--pc, #9A6B3C) 16%, var(--parch)); border-radius: 12px 12px 0 0; }
.sheet-title { flex: 1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.sheet-title h3 { font-size: 1.15rem; }
.sheet-title small { width: 100%; color: var(--ink-2); }
.sheet-body { flex: 1; overflow: auto; padding: 8px 12px 12px; overscroll-behavior: contain; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 12px; border-top: 2px solid var(--parch-lo); flex-wrap: wrap; }
.opt-sec h4 { font-size: .95rem; margin: 10px 0 4px; color: var(--ink-2); }
.opt {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; text-align: left; padding: 6px 10px; margin-bottom: 4px;
  border: 2px solid var(--parch-lo); border-radius: 10px; background: var(--canvas); cursor: pointer;
}
.opt:hover:not(:disabled) { border-color: var(--wood); background: #fffaf0; }
.opt.selected { border-color: var(--forest); background: #e3efd2; }
.opt.disabled { opacity: .55; cursor: not-allowed; }
.opt-ic { flex: none; display: inline-flex; color: var(--wood-dk); }
.opt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.opt-title { font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.opt-chips { display: inline-flex; gap: 4px; align-items: center; font-weight: 400; }
.opt-sub { font-size: .82rem; color: var(--ink-2); }
.opt-why { font-size: .82rem; color: var(--bad); }
.opt-go { flex: none; color: var(--wood); }
.qchip { font-size: .75rem; padding: 0 5px; border-radius: 5px; background: #dfeccd; color: var(--good); font-weight: 700; }
.cannot { margin-top: 10px; font-size: .85rem; color: var(--ink-2); }
.cannot summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; }
.cannot ul { margin: 4px 0; padding-left: 1.2em; }
.opt-sub .down { color: var(--bad); }
.steppv { margin-top: 10px; border-top: 2px dashed var(--parch-lo); padding-top: 6px; }
.steppv h4 { font-size: .95rem; display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.res-one.col { flex-direction: column; align-items: flex-start; gap: 2px; margin-bottom: 6px; }
.res-one .row { gap: 6px; }
.problembox { background: #F6DDD6; border: 2px solid var(--bad); color: #5d1712; border-radius: 8px; font-size: .86rem; padding: 6px 8px; margin-top: 8px; }
.actinfo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .88rem; }
.pchip { border-color: var(--pc); }
.pchip.on { background: color-mix(in srgb, var(--pc) 22%, #fff); border-color: var(--pc); box-shadow: inset 0 0 0 1px var(--pc); }
.popover { background: var(--parch); border: 2px solid var(--wood-dk); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.45); padding: 8px; }
.popover.menu { margin: 52px 0 0 8px; display: flex; flex-direction: column; min-width: 250px; }
.popover.menu .menu-camp { margin: 2px 10px 6px; padding-bottom: 6px; border-bottom: 1px solid var(--parch-lo); max-width: 300px; }
.popover.menu button, .popover.menu label { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: left; }
.popover.menu button:hover, .popover.menu label:hover { background: var(--parch-hi); }
.filebtn { position: relative; overflow: hidden; }
.filebtn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chat-pop { margin: 52px 0 0 auto; margin-right: 60px; max-width: 360px; }
.phone-big { background: #1c1c22; color: #eee; border-radius: 22px; padding: 10px; border: 3px solid #0d0d10; }
.phone-big .phone-head { font-size: .9rem; padding: 4px 6px; }
.phone-screen { background: #e9e3d8; border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; color: #222; }
.msg { border-radius: 12px; padding: 5px 9px; font-size: .86rem; max-width: 88%; background: #fff; }
.msg small { display: block; color: #777; font-size: .7rem; }
.msg.bad { background: #fde2dc; }
.msg.good { background: #dcf3d2; margin-left: auto; }
.msg.parent { background: #fff; border: 2px solid #2e7d5b; font-weight: 600; }
.msg.sys { background: transparent; color: #555; font-style: italic; }
.phone-big .fine { color: #ccc; }
.phone-big .btn { margin-top: 6px; width: 100%; }

.toast-root, #toast-root { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--parch-hi); padding: 8px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: .92rem; transition: opacity .4s; max-width: 90vw; }
.toast.out { opacity: 0; }

/* ---------------------------------------------------------------- dawn */
.crisis-card { border: 3px solid var(--bad); border-radius: 12px; background: #fff3ef; padding: 8px 10px; margin-bottom: 10px; }
.crisis-card.answered { border-color: var(--wood); background: var(--parch-hi); }
.crisis-card header { display: flex; gap: 10px; align-items: center; }
.crisis-card h3 { font-size: 1.15rem; }
.crisis-line { font-style: italic; color: var(--ink-2); font-size: .88rem; }
.why { font-size: .9rem; }
.diebar { display: inline-flex; gap: 2px; }
.diebar i { width: 8px; height: 12px; border-radius: 2px; background: #e5cfc7; border: 1px solid #b89a8f; }
.diebar i.win { background: var(--forest); border-color: #28461f; }
.fallbacks { display: flex; flex-direction: column; gap: 0; font-size: .88rem; margin-top: 4px; }
.dawn-top { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.wxcard { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #e7f0f4; border: 2px solid #8fb6c8; flex: 1 1 150px; }
.wxcard div { display: flex; flex-direction: column; }
.wxcard.fam-fair { background: #fbf1cf; border-color: var(--brass); }
.wxcard.fam-wild { background: #f5dfcf; border-color: #c97a4a; }
.eventcard { flex: 2 1 220px; padding: 8px 10px; border-radius: 10px; background: var(--canvas); border: 2px solid var(--wood); box-shadow: 0 2px 0 var(--wood); }
.eventcard small { text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-size: .7rem; display: block; }
.eventcard b { font-family: var(--font-title); font-size: 1.05rem; }
.eventcard.cancelled { opacity: .6; text-decoration: line-through; }
.eventcard.night { background: #28324f; color: #eef; border-color: #111a33; box-shadow: none; }
.eventcard.night small { color: #aab; }
.meal { border-top: 1px dashed var(--parch-lo); padding: 6px 0; }
.meal-name { display: block; margin-bottom: 2px; }
.dish { font-size: .86rem; }
.mq { font-size: .72rem; font-weight: 800; padding: 0 5px; border-radius: 5px; background: #ddd; margin-left: 2px; }
.mq-feast { background: var(--brass); }
.mq-good { background: #cfe5b8; }
.mq-ok { background: #eee2c8; }
.mq-poor { background: #f1c7b9; }
.mq-missed { background: #e79b8b; }
.mq-cant { background: #ddd3c0; color: #6b5a47; font-style: italic; }

/* ---------------------------------------------------------------- resolve */
.resolvepanel .stepno { font-size: .85rem; color: var(--ink-2); }
.rgroup { border: 2px solid var(--parch-lo); border-radius: 10px; padding: 6px 8px; margin-bottom: 8px; background: var(--parch-hi); }
.rgroup.current { border-color: var(--brass-dk); box-shadow: 0 0 0 2px var(--brass); }
.rgroup.past { opacity: .8; }
.rgroup h3 { font-size: 1rem; display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.rgroup.collapsed { padding: 0 8px; opacity: .92; }
.rgroup.collapsed > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.rgroup.collapsed > summary small { color: var(--ink-2); }
.rgroup.collapsed.night > summary small { color: #c5cbe0; }
.rgroup.collapsed[open] { padding-bottom: 6px; }
.upnext { margin-top: 6px; }
.rgroup.night { background: #25304b; color: #eef0f8; border-color: #111a33; }
.rgroup.night .fine, .rgroup.night small { color: #c5cbe0; }
.evlist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.ev { display: flex; align-items: flex-start; gap: 6px; font-size: .88rem; padding: 2px 4px; border-radius: 6px; }
.ev .ev-t { flex: 1; }
.ev.big { background: #fff3cf; border: 1px solid var(--brass); font-weight: 600; padding: 4px 6px; }
.ev.big.bad { background: #f9ddd5; border-color: var(--bad); }
.ev.good .ic { color: var(--good); }
.ev.bad .ic { color: var(--bad); }
.ev-activity { flex-direction: column; gap: 2px; border-left: 5px solid var(--pc); background: rgba(255,255,255,.4); padding: 4px 6px; }
.act-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.chance { color: var(--ink-3); }
.nightscene { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.nightscene .eventcard { flex: none; }
.nightpatrol { border-left: 5px solid var(--pc); background: rgba(255,255,255,.06); border-radius: 6px; padding: 4px 6px; }
.np-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.np-tokens { display: inline-flex; gap: 3px; }
.nightkids { list-style: none; padding: 0; margin: 2px 0 0; font-size: .86rem; }
.nightkids li { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; padding: 1px 0; }
.nightkids li small { width: 100%; padding-left: 24px; color: #c5cbe0; }
.nightkids li.zero { color: #ffb7a8; font-weight: 700; }
.rgroup.night .crisis-word { color: #ff9c8a; }
.rgroup.night .ev { color: #eef0f8; }
.rgroup.night .ev.big { color: var(--ink); }
.rgroup.night .ev.good .ic { color: #9fe08a; }
.rgroup.night .ev.bad .ic { color: #ff9c8a; }
.rgroup.night .ev.big .ic { color: var(--ink); }
.rgroup.night .resdetails summary, .rgroup.night .statusdetails summary { color: #eef0f8; }
.rgroup.night .pbadge b { color: #fff; }
.statusdetails, .resdetails { font-size: .84rem; margin-top: 4px; }
.statusdetails summary, .resdetails summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; gap: 4px; }
.statusdetails ul, .resdetails ul { margin: 2px 0; padding-left: 1.2em; }
.resolvepanel.night .panel-body { background: rgba(20,28,52,.08); }

/* ---------------------------------------------------------------- log */
.logfilters { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 6px 10px; align-items: center; font-size: .88rem; }
.logfilters select, .logfilters input[type="search"] { min-height: 36px; border-radius: 6px; border: 2px solid var(--parch-lo); background: var(--canvas); padding: 0 6px; }
.logpanel .fine { padding: 0 10px; }
.loglist { list-style: none; margin: 0; padding: 0 10px 10px; overflow: auto; flex: 1; min-height: 0; font-size: .86rem; }
.loghead { position: sticky; top: 0; background: var(--parch-lo); font-weight: 700; padding: 3px 6px; margin-top: 6px; border-radius: 4px; }
.logrow { padding: 2px 6px; border-bottom: 1px dotted rgba(46,31,20,.15); }
.logrow.imp { font-weight: 600; }
.logrow.bad { color: #7b1e12; }
.logrow.good { color: #1f4f16; }

/* ---------------------------------------------------------------- kid modal */
.kidsheet { width: min(720px, 100%); }
.kc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 6px 0; }
.kc-grid > div > small { display: block; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-size: .7rem; }
.kc-mood { display: flex; align-items: center; gap: 4px; }
.kidhist { list-style: none; padding: 0; margin: 0; font-size: .86rem; }
.kidhist > li { margin-bottom: 6px; }
.kidhist ul { margin: 2px 0; padding-left: 1em; }
.kidhist li.bad { color: #7b1e12; }
.kidhist li.good { color: #1f4f16; }
.memlist { list-style: none; padding: 0; margin: 2px 0; font-size: .84rem; }

/* ---------------------------------------------------------------- help */
.helpsheet { width: min(760px, 100%); }
.helpsheet h4 { margin: 12px 0 4px; }
.helptable { border-collapse: collapse; font-size: .88rem; margin: 6px 0; }
.helptable th, .helptable td { border: 1px solid var(--parch-lo); padding: 3px 8px; text-align: left; }
.legend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px 10px; font-size: .88rem; }
.legend-grid.wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tilekey { display: inline-flex; align-items: center; gap: 4px; }
.tilekey .swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.35); flex: none; }
.hint { display: block; }
.glossary { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: .88rem; }
.glossary dt { font-style: italic; font-weight: 700; }
.glossary dd { margin: 0; }

/* ---------------------------------------------------------------- start */
.screen-start, .screen-end { flex: 1; overflow: auto; min-height: 0; }
.startscreen { max-width: 1040px; margin: 0 auto; padding: 18px 14px 40px; display: flex; flex-direction: column; gap: 14px; }
.starthero { display: flex; gap: 16px; align-items: center; color: var(--parch-hi); }
.starthero h1 { font-size: 2.6rem; color: #FFE9B8; text-shadow: 0 2px 0 #2a190e; }
.starthero .kicker { font-weight: 700; color: var(--brass); margin: 0; }
.logo { width: 84px; height: 84px; border-radius: 20px; display: grid; place-items: center; background: var(--brass); color: var(--ink); border: 3px solid #2a190e; box-shadow: var(--shadow); flex: none; }
.card { background: var(--parch); border: 2px solid var(--wood-dk); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.card h2 { font-size: 1.35rem; margin-bottom: 6px; }
.card h3 { font-size: 1.02rem; margin: 14px 0 6px; }
.card h3 small { font-family: var(--font); font-weight: 400; color: var(--ink-2); }
.continue { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-color: var(--forest); }
.rolegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 8px; }
.rolecard, .projcard { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 10px; border-radius: 12px; border: 2px solid var(--parch-lo); background: var(--canvas); cursor: pointer; min-height: 44px; }
.rolecard.on, .projcard.on { border-color: var(--forest); background: #eaf3dd; box-shadow: inset 0 0 0 1px var(--forest); }
.rolecard:disabled { opacity: .5; cursor: not-allowed; }
.rc-head, .pc-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rc-head small { color: var(--ink-2); }
.rc-check { margin-left: auto; color: var(--forest); min-width: 18px; }
.rc-text { font-size: .84rem; }
.rc-sig { font-size: .8rem; color: var(--brass-dk); font-weight: 600; }
.rc-once { color: var(--ink-2); font-weight: 700; }
.difgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.difcard { flex-direction: column; align-items: flex-start; gap: 2px; border-radius: 12px; padding: 8px 12px; text-align: left; }
.difcard small { font-weight: 400; font-size: .84rem; color: var(--ink-2); }
.continue.oldsave { border-color: var(--warn); background: #f6e7c6; }
.continue.oldsave > div:first-child { flex: 1 1 380px; }
.continue.oldsave h2 { display: flex; align-items: center; gap: 6px; color: #6b430c; }
.continue.oldsave p { margin: 4px 0; }
.projgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.pc-fin { font-size: .88rem; font-weight: 600; }
.pc-twist { font-size: .82rem; color: var(--ink-2); }
.projcard ul { margin: 2px 0; padding-left: 1.1em; font-size: .82rem; }
.pc-lean { font-size: .8rem; color: var(--teal-dk); }
.pc-lean.warn { color: var(--bad); font-weight: 700; }
.seed { min-height: 44px; border-radius: 8px; border: 2px solid var(--wood); background: var(--canvas); padding: 0 10px; width: 160px; }
.startfoot { color: #d9c7a4; text-align: center; }
.notice { background: var(--parch); border-radius: 10px; padding: 10px 12px; }

/* ---------------------------------------------------------------- sort */
.screen-sort { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sorthead { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; color: var(--parch-hi); background: linear-gradient(180deg, #4E311C, #3B2415); border-bottom: 3px solid #2a190e; }
.sorthead h1 { font-size: 1.5rem; color: #FFE9B8; }
.sorthead p { margin: 2px 0 0; font-size: .9rem; max-width: 70ch; }
.sortproblems { flex: none; margin: 8px 14px 0; background: var(--parch); border-radius: 8px; padding: 6px 10px; font-size: .9rem; border: 2px solid var(--warn); color: #5a3b08; }
.sortbody { flex: 1; min-height: 0; overflow: auto; padding: 10px 14px 90px; display: grid; grid-template-columns: minmax(250px, 1fr) 3fr; gap: 10px; align-items: start; }
.sortbody.pool-empty { grid-template-columns: 1fr; }
.sortbody.pool-empty .pool { position: static; padding: 4px 10px; }
.sortbody.pool-empty .pool h2 { margin: 0; }
.pool { background: rgba(230,211,176,.92); border: 2px dashed var(--wood-dk); border-radius: 14px; padding: 8px; position: sticky; top: 0; }
.pool h2 { font-size: 1.05rem; display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.pool-kids { display: flex; flex-direction: column; gap: 6px; }
.sortpatrols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sortpatrol { background: color-mix(in srgb, var(--pc) 10%, var(--parch)); border: 3px solid var(--pc); border-radius: 14px; padding: 6px; display: flex; flex-direction: column; gap: 6px; min-height: 220px; }
.sortpatrol.droppable { box-shadow: 0 0 0 3px var(--brass); }
.sortpatrol.dragover { background: #fff3cf; }
.sp-head { display: flex; align-items: center; gap: 6px; border: 0; background: color-mix(in srgb, var(--pc) 25%, var(--parch)); border-radius: 10px; padding: 6px 8px; cursor: pointer; min-height: 44px; font-size: 1.05rem; width: 100%; text-align: left; }
.sp-head:disabled { cursor: default; }
.sp-head .count { margin-left: auto; font-weight: 700; }
.drophint { font-size: .8rem; color: var(--good); font-weight: 700; }
.tagsum { display: flex; flex-direction: column; gap: 2px; font-size: .82rem; }
.tagsum > div { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; }
.tagsum small { width: 58px; color: var(--ink-2); }
.tagcount { display: inline-flex; align-items: center; gap: 1px; }
.relsum { display: flex; flex-wrap: wrap; gap: 4px; font-size: .8rem; }
.relsum .wishes { width: 100%; color: var(--ink-2); }
.sp-kids { display: flex; flex-direction: column; gap: 6px; }
.slot { border: 2px dashed rgba(46,31,20,.3); border-radius: 10px; min-height: 48px; display: grid; place-items: center; color: var(--ink-2); font-size: .85rem; cursor: pointer; }
.sortkid { background: var(--canvas); border: 2px solid var(--parch-lo); border-radius: 10px; box-shadow: 0 2px 0 rgba(46,31,20,.2); cursor: grab; }
.sortkid.selected { border-color: var(--brass-dk); box-shadow: 0 0 0 3px var(--brass); transform: translateY(-1px); }
.sortkid.pred { border-color: var(--brass-dk); }
.sortkid-tap { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 8px; cursor: pointer; }
.sk-head { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.sk-head b { font-size: 1rem; }
.sk-tags { display: flex; gap: 10px; font-size: .84rem; }
.sk-tags .lov { color: var(--good); display: inline-flex; align-items: center; gap: 2px; }
.sk-tags .dis { color: var(--bad); display: inline-flex; align-items: center; gap: 2px; }
.sk-quirk { font-size: .78rem; }
.sk-quirk small { color: var(--ink-2); }
.sk-wish { font-size: .8rem; color: var(--ink-2); display: flex; align-items: center; gap: 2px; }
.sk-rel { display: flex; flex-wrap: wrap; gap: 4px; }
.predbtn { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; border: 0; border-top: 1px solid var(--parch-lo); background: rgba(0,0,0,.03); min-height: 36px; border-radius: 0 0 8px 8px; cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.predbtn.on { background: var(--brass); color: var(--ink); }
.predbtn:disabled { cursor: default; opacity: .6; font-weight: 400; }
.movebar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; z-index: 40; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; background: var(--ink); color: var(--parch-hi); padding: 8px 10px; border-radius: 14px; box-shadow: 0 8px 26px rgba(0,0,0,.5); max-width: calc(100vw - 16px); }
.movebar .btn.pbtn { border-color: var(--pc); box-shadow: 0 2px 0 var(--pc); }
.movebar .iconbtn { color: var(--parch-hi); }

/* ---------------------------------------------------------------- end */
.endscreen { max-width: 1240px; margin: 0 auto; padding: 14px 14px 40px; display: flex; flex-direction: column; gap: 14px; }
.endhero { background: var(--parch); border: 3px solid var(--wood-dk); border-radius: 16px; padding: 16px 20px; box-shadow: var(--shadow); text-align: center; }
.endhero.lost { border-color: var(--bad); background: #f7e1da; }
.endhero h1 { font-size: 2rem; }
.endhero .kicker { color: var(--ink-2); font-weight: 600; margin: 0; }
.lostreason { color: var(--bad); font-weight: 700; }
.ratingrow { display: flex; justify-content: center; align-items: center; gap: 30px; flex-wrap: wrap; margin-top: 10px; }
.rating, .comingback { display: flex; flex-direction: column; align-items: center; }
.rating b { font-size: 3.2rem; font-family: var(--font-title); line-height: 1; }
.comingback b { font-size: 2.6rem; font-family: var(--font-title); color: var(--good); line-height: 1; }
.stars { display: flex; gap: 2px; }
.star { color: #bba98a; }
.star.on { color: var(--brass-dk); }
.star.on svg { filter: drop-shadow(0 1px 0 var(--ink)); }
.endcols { display: grid; grid-template-columns: minmax(280px, 1fr) 2.2fr; gap: 14px; align-items: start; }
.breakdown, .endkids { background: var(--parch); border: 2px solid var(--wood-dk); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.breakdown h2, .endkids h2 { font-size: 1.15rem; margin: 6px 0; }
.breakdown table { width: 100%; border-collapse: collapse; }
.breakdown td { padding: 4px 2px; border-bottom: 1px dotted var(--parch-lo); }
.breakdown td:last-child { text-align: right; font-weight: 700; }
.breakdown tr.neg td:last-child { color: var(--bad); }
.breakdown tr.total td { border-top: 2px solid var(--ink); font-size: 1.1rem; }
.wentlist { list-style: none; padding: 0; margin: 4px 0 10px; font-size: .88rem; display: flex; flex-direction: column; gap: 3px; }
.breakdown h3 { font-size: 1rem; margin: 8px 0 2px; }
.endbtns { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.endkidgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.endkid { background: var(--canvas); border: 2px solid var(--parch-lo); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.endkid.back { border-color: var(--forest); }
.endkid.home { background: #eee4d8; }
.endkid header { display: flex; gap: 8px; align-items: center; }
.backtag { margin-left: auto; font-size: .78rem; font-weight: 700; color: var(--good); display: inline-flex; align-items: center; gap: 2px; }
.endstats { display: flex; gap: 10px; font-size: .84rem; align-items: center; }
.endtotal { margin-left: auto; font-weight: 800; }
.wishend { font-size: .84rem; color: var(--ink-2); }
.wishend.granted { color: var(--good); font-weight: 700; }
.postcard { margin: 4px 0 0; padding: 8px 10px; background: #fffdf6; border: 1px solid #d9cbb0; border-radius: 4px; font-family: "Comic Sans MS", "Segoe Print", "DejaVu Sans", cursive; font-size: .84rem; transform: rotate(-.4deg); box-shadow: 1px 2px 0 rgba(0,0,0,.08); background-image: repeating-linear-gradient(transparent 0 19px, rgba(62,122,123,.18) 19px 20px); }
.postcard p { margin: 0 0 2px; }
.postcard footer { text-align: right; font-style: italic; }
.screen-end + .logpanel { }

/* ---------------------------------------------------------------- phone */
@media (max-width: 760px) {
  :root { font-size: 15.5px; }
  .topbar { padding: 3px 4px; gap: 2px; }
  .tb-main { gap: 4px; flex-wrap: nowrap; overflow: hidden; }
  .tb-main .iconbtn[data-testid="help-btn"] { display: none; }
  .dayno { font-size: 1.05rem; }
  .dayno small { display: none; }
  .dayno .diftag { display: none; } /* the menu names the difficulty on a phone */
  .daytrack { flex: 0 1 auto !important; overflow: hidden; }
  .weather { flex: 1 1 auto !important; min-width: 0; }
  .weather .wx { min-width: 0; }
  .wx-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 72px; }
  .phases .phase:not(.now) { display: none; }
  .phase { padding: 2px 7px; font-size: .8rem; }
  .daytrack { gap: 4px; }
  .daytrack .chip { padding: 1px 4px; }
  .weather .wx:not(:first-child), .weather .wind { display: none; }
  .wx-t small { display: none; }
  .wx { padding: 1px 4px; }
  .track small { display: none; }
  .pips { display: none; }
  .phone { width: 64px; padding: 3px 5px; min-height: 42px; justify-content: center; }
  .iconbtn.small { min-width: 40px; min-height: 40px; }
  .seg button { min-height: 40px; }
  .phone .bubble, .phone-head span { display: none; }
  .phone-head b { margin: 0 auto; }
  .tb-res { overflow-x: auto; scrollbar-width: none; }
  .resources { flex-wrap: nowrap; }
  .res { padding: 1px 5px; }
  .board { display: block; padding: 6px 6px 0; overflow: hidden; position: relative; }
  .board > * { display: none !important; height: 100%; }
  body[data-tab="plan"] .board > .side,
  body[data-tab="kids"] .board > .roster,
  body[data-tab="map"] .board > .centre,
  body[data-tab="log"] .board > .logpanel { display: flex !important; }
  .logpanel { position: static !important; transform: none !important; width: auto !important; height: 100% !important; }
  .centre { overflow: auto; }
  .mapwrap { flex: none; min-height: 0; }
  .mapscroll { overflow-x: auto; }
  .map { min-width: 620px; height: auto; }
  .belowmap { max-height: none; overflow: visible; }
  .tabs { display: flex; flex: none; background: #3B2415; border-top: 3px solid #2a190e; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); gap: 4px; }
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 54px; border: 0; border-radius: 10px; background: transparent; color: #d9c7a4; font-size: .8rem; font-weight: 600; position: relative; cursor: pointer; }
  .tab.on { background: var(--brass); color: var(--ink); }
  .tabbadge { position: absolute; top: 3px; right: 22%; background: var(--bad); color: #fff; font-style: normal; border-radius: 999px; min-width: 18px; height: 18px; font-size: .72rem; display: grid; place-items: center; }
  .scrim { padding: 0; align-items: flex-end; }
  .sheet { width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 0; border-bottom: 0; }
  .kc-grid { grid-template-columns: 1fr; }
  .prow-head { flex-wrap: wrap; }
  .prow-head .who { min-width: 0; }
  .prow-head .what { flex-basis: 100%; order: 3; }
  .prow-head .btn { margin-left: auto; }
  .panel-foot .btn.ready { flex: 1; }
  .popover.menu { margin: 44px 4px 0; }
  .chat-pop { margin: 44px 6px 0; }
  .scrim.light { align-items: flex-start; }
  /* sort */
  .sorthead { padding: 8px 10px; }
  .sorthead h1 { font-size: 1.2rem; }
  .sorthead p { font-size: .82rem; }
  .sorthead .head-actions { width: 100%; }
  .sorthead .head-actions .btn { flex: 1; }
  .sortbody { grid-template-columns: 1fr; padding: 8px 8px 130px; }
  .pool { position: static; }
  .pool-kids { display: grid; grid-template-columns: 1fr; }
  .sortpatrols { grid-template-columns: 1fr; }
  .sortpatrol { min-height: 0; }
  .movebar { bottom: 8px; width: calc(100vw - 16px); }
  .movebar .btn { flex: 1 1 28%; min-height: 44px; padding: 0 6px; }
  /* start/end */
  .starthero h1 { font-size: 2rem; }
  .logo { width: 60px; height: 60px; }
  .endcols { grid-template-columns: 1fr; }
  .ratingrow { gap: 16px; }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .board { grid-template-columns: minmax(230px, 260px) minmax(0, 1fr) minmax(320px, 360px); }
  .phone { width: 190px; }
  .weather .wx-fam { display: none; }
  .res small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
