/* Layout: phone-first campfire ledger. Full-screen title/loading screens over an ember canvas;
   in game, a sticky character sheet, one scrolling panel per tab, and a fixed tab bar.
   Single dark look by choice. */
:root {
  --bg: #16110d;
  --panel: #211912;
  --panel-2: #2b2118;
  --line: #463627;
  --fg: #ecdfc6;
  --muted: #a6957a;
  --gold: #d6a94c;
  --gold-dim: #8a6a2c;
  --ember: #c2563f;
  --moss: #7fa66a;
  --ink: #1d150c;
  --r-common: #9b8f7d;
  --r-uncommon: #6fb05a;
  --r-rare: #5591d8;
  --r-epic: #a873d9;
  --display: "IM Fell English SC", "Iowan Old Style", Georgia, serif;
  --body: "Alegreya", "Iowan Old Style", Georgia, serif;
  --ui: "Alegreya Sans", "Gill Sans", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); min-height: 100%; }
body {
  color: var(--fg);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  padding-top: env(safe-area-inset-top, 0px);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, .class-card:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

#embers { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.screen { position: relative; z-index: 1; }
body.in-game #embers { display: none; }

/* Buttons */
.btn {
  font-family: var(--ui); font-weight: 700; font-size: 14px;
  padding: 9px 15px; border-radius: 4px;
  border: 1px solid var(--gold-dim); background: var(--panel-2); color: var(--gold);
}
.btn.primary { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.btn.danger { color: var(--ember); border-color: color-mix(in srgb, var(--ember) 55%, transparent); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Title screen */
.title-screen {
  min-height: calc(100vh - env(safe-area-inset-top, 0px));
  min-height: calc(100dvh - env(safe-area-inset-top, 0px));
  display: flex; flex-direction: column; justify-content: center; gap: 40px;
  padding: 48px max(28px, env(safe-area-inset-left, 0px)) calc(28px + env(safe-area-inset-bottom, 0px));
  max-width: 620px; margin: 0 auto;
  background: radial-gradient(90% 50% at 30% 30%, rgba(214,169,76,.08), transparent 70%);
}
.kicker { font-family: var(--ui); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); margin: 0 0 8px; }
.game-title {
  font-family: var(--display); font-weight: 400; margin: 0;
  font-size: clamp(46px, 13vw, 84px); line-height: .92; letter-spacing: .01em;
  text-shadow: 0 0 40px rgba(214,169,76,.25);
}
.game-title span { color: var(--gold); font-size: .7em; display: block; margin: 4px 0 2px; }
.menu-list { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.menu-item {
  background: none; border: 0; padding: 10px 0 10px 18px; text-align: left; position: relative;
  font-family: var(--display); font-size: 27px; color: var(--fg); letter-spacing: .02em;
}
.menu-item small { display: block; font-family: var(--ui); font-size: 13px; color: var(--muted); letter-spacing: 0; }
.menu-item::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  transform: rotate(45deg); background: var(--gold); opacity: 0; transition: opacity .15s;
}
.menu-item:hover, .menu-item:focus-visible { color: var(--gold); outline: none; }
.menu-item:hover::before, .menu-item:focus-visible::before { opacity: 1; }
.menu-item[disabled] { color: var(--line); cursor: default; }
.menu-item[disabled]::before { display: none; }
.menu-foot { font-family: var(--ui); font-size: 13px; color: var(--muted); margin: 0; }
.menu-foot b { color: var(--moss); font-weight: 500; }
.menu-foot b.off { color: var(--ember); }

/* Character creation */
.create-screen { padding-block: 28px calc(40px + env(safe-area-inset-bottom, 0px)); }
.create-inner { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.create-title { font-family: var(--display); font-weight: 400; font-size: 34px; margin: -14px 0 0; line-height: 1.05; text-wrap: balance; }
.field { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend { font-family: var(--ui); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); padding: 0; margin-bottom: 8px; }
.field legend small { letter-spacing: 0; text-transform: none; color: var(--muted); font-size: 12px; }
.hint { font-family: var(--ui); font-size: 12px; color: var(--muted); }
input[type=text], input:not([type]), input[type=number], input[type=password] {
  width: 100%; min-width: 0; padding: 11px 12px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg); font: inherit; font-size: 16px;
}
input::placeholder { color: #6f604c; }
.money { display: flex; align-items: center; gap: 10px; max-width: 220px; }
.money b { font-family: var(--ui); color: var(--gold); font-weight: 500; }
.classes { display: grid; gap: 8px; }
.class-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); cursor: pointer; }
.class-card input { accent-color: var(--gold); margin-top: 4px; width: 18px; height: 18px; flex: none; }
.class-card b { display: block; font-family: var(--display); font-weight: 400; font-size: 20px; line-height: 1.1; }
.class-card small { font-family: var(--ui); color: var(--muted); font-size: 13px; }
.class-card:has(input:checked) { border-color: var(--gold); background: var(--panel-2); }
.companions { display: flex; flex-direction: column; gap: 10px; }
.companion { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.companion input { padding: 9px 10px; font-size: 15px; }
@media (max-width: 460px) {
  .companion { grid-template-columns: 1fr 1fr; }
  .companion input:first-child { grid-column: 1 / -1; }
}
.create-actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
textarea {
  width: 100%; min-width: 0; padding: 11px 12px; border-radius: 4px; resize: vertical;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg); font: inherit; font-size: 16px;
}

/* War council */
.council-days { display: flex; flex-direction: column; gap: 8px; }
.council-day { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.council-day.is-out { opacity: .65; }
.cd-main { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cd-main input:not([type=checkbox]) { padding: 9px 10px; }
.cd-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-family: var(--ui); font-size: 13px; color: var(--muted); padding: 4px 10px 4px 8px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.tag input { accent-color: var(--gold); width: 15px; height: 15px; margin: 0; }
.tag:has(input:checked) { color: var(--gold); border-color: var(--gold-dim); background: var(--panel-2); }
.how { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: var(--panel); }
.how summary { font-family: var(--ui); font-weight: 700; color: var(--gold); cursor: pointer; }
.how p { margin: 8px 0 2px; color: var(--muted); font-size: 15px; }
.quest.out { opacity: .7; }

/* Loading screen */
.loading-screen {
  min-height: calc(100vh - env(safe-area-inset-top, 0px));
  min-height: calc(100dvh - env(safe-area-inset-top, 0px));
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: 14px; padding: 32px max(24px, env(safe-area-inset-left, 0px)) calc(32px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(60% 40% at 50% 40%, rgba(194,86,63,.12), transparent 70%);
}
.loading-art { width: 120px; height: 120px; display: grid; place-items: center; margin-bottom: 6px; }
.rune {
  width: 92px; height: 92px; border: 2px solid var(--gold-dim); transform: rotate(45deg);
  position: relative; animation: turn 6s linear infinite;
}
.rune::before, .rune::after { content: ""; position: absolute; inset: 12px; border: 1px solid var(--gold); }
.rune::after { inset: 32px; background: var(--gold); box-shadow: 0 0 24px var(--gold); animation: pulse 1.6s ease-in-out infinite; }
@keyframes turn { to { transform: rotate(405deg); } }
@keyframes pulse { 50% { opacity: .35; } }
#loading-title { font-family: var(--display); font-weight: 400; font-size: 34px; margin: 0; }
.loading-sub { margin: 0; color: var(--muted); font-style: italic; max-width: 34ch; }
.loading-bar { width: min(320px, 80vw); height: 4px; background: var(--panel-2); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.loading-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); transition: width .3s ease; }
.loading-tip { font-family: var(--ui); font-size: 14px; color: var(--muted); max-width: 40ch; margin: 22px 0 0; }
.loading-tip b { color: var(--gold); letter-spacing: .12em; text-transform: uppercase; font-size: 11px; margin-right: 6px; }

/* Sign-in note, household */
.sync-note { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px; border: 1px dashed var(--gold-dim); border-radius: 6px; background: var(--panel); font-family: var(--ui); font-size: 14px; color: var(--muted); }
.sync-note span { flex: 1 1 200px; }
.invite-code { font-family: var(--ui); font-weight: 700; font-size: 30px; letter-spacing: .14em; color: var(--gold); padding: 10px 0 6px; font-variant-numeric: tabular-nums; user-select: all; }

/* Debrief, recipe book, leftovers */
.raters { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 14px; }
.rater { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; }
.rater + .rater { border-top: 1px solid var(--line); }
.rater > span { font-weight: 500; color: var(--fg); min-width: 0; overflow-wrap: anywhere; }
.thumbs { display: flex; gap: 6px; flex: none; }
.thumb { width: 44px; height: 40px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); font-size: 18px; filter: grayscale(1); opacity: .55; }
.thumb[aria-pressed="true"] { filter: none; opacity: 1; border-color: var(--gold); background: color-mix(in srgb, var(--gold) 18%, var(--panel-2)); }
.debrief .again { margin-bottom: 14px; }
.stepper { display: flex; align-items: center; gap: 8px; flex: none; }
.stepper .thumb { filter: none; opacity: 1; font-family: var(--ui); font-weight: 700; color: var(--gold); width: 38px; }
.stepper b { min-width: 18px; text-align: center; font-family: var(--ui); font-variant-numeric: tabular-nums; }
.debrief .again b { font-size: 17px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg-btn { padding: 9px 4px; border: 0; background: var(--panel-2); font-family: var(--ui); font-weight: 700; color: var(--muted); }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
.cd-input { display: flex; gap: 6px; }
.cd-input input { flex: 1; }
.cd-input .btn { padding: 8px 10px; }
button.tag { background: none; }
.book-entry { width: 100%; text-align: left; grid-template-columns: 1fr; color: var(--fg); }
.book-entry:hover { border-color: var(--gold-dim); }
.book-entry.has-photo { grid-template-columns: 64px 1fr; align-items: center; }
.dish-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.dish-photo { display: block; width: 100%; max-height: 360px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); margin: 12px 0 4px; }
.photo-pick { display: flex; align-items: center; gap: 12px; }

/* Ledger */
button.purse { background: none; border: 0; padding: 4px 0 4px 8px; }
.ledger-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-family: var(--ui); color: var(--muted); }
.ledger-head b { font-family: var(--display); font-weight: 400; font-size: 40px; color: var(--gold); line-height: 1; font-variant-numeric: tabular-nums; }
.bar { position: relative; height: 10px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); overflow: visible; }
.bar.big { height: 14px; margin-top: 10px; }
.bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }
.bar i.over { background: linear-gradient(90deg, #7a3326, var(--ember)); }
.bar em { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--fg); opacity: .7; }
.bars { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 34%) 1fr 52px; align-items: center; gap: 10px; font-family: var(--ui); font-size: 14px; }
.bar-row span { min-width: 0; overflow-wrap: anywhere; color: var(--muted); }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; color: var(--fg); font-weight: 500; }
.purchases { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.purchase { border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.purchase summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; list-style: none; }
.purchase summary::-webkit-details-marker { display: none; }
.purchase summary small { display: block; font-family: var(--ui); font-size: 12px; color: var(--muted); }
.purchase summary b { font-family: var(--ui); color: var(--gold); font-variant-numeric: tabular-nums; }
.purchase ul { list-style: none; margin: 0; padding: 0 12px 10px; font-family: var(--ui); font-size: 14px; }
.purchase li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-top: 1px solid var(--line); color: var(--muted); }
.purchase li span:last-child { font-variant-numeric: tabular-nums; }

/* Recipe */
.recipe-screen { padding-block: 16px calc(40px + env(safe-area-inset-bottom, 0px)); background: var(--bg); min-height: 100vh; }
.recipe-inner { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.recipe-inner > .btn { align-self: flex-start; margin-bottom: 8px; }
.recipe-title { font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1.05; margin: 0; text-wrap: balance; }
.recipe-block { margin-top: 14px; }
.recipe-block h3 { font-family: var(--display); font-weight: 400; font-size: 22px; color: var(--gold); margin: 0 0 2px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.recipe-block .hint { display: block; margin: 6px 0 8px; }
.ingredients { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); overflow: hidden; }
.ingredients li + li { border-top: 1px solid var(--line); }
.ing { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; background: none; border: 0; text-align: left; }
.ing .ing-name { flex: 1; min-width: 0; }
.ing .ing-name b { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.ing.ticked .box { background: var(--gold); border-color: var(--gold); }
.ing.ticked .ing-name { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--gold-dim); }
.src { font-family: var(--ui); font-size: 11px; white-space: nowrap; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.src.have { color: var(--moss); border-color: color-mix(in srgb, var(--moss) 45%, transparent); }
.src.buy { color: var(--ember); border-color: color-mix(in srgb, var(--ember) 45%, transparent); }
@media (max-width: 420px) { .ing { flex-wrap: wrap; } .src { margin-left: 34px; } }
.steps { margin: 10px 0 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 14px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 32px 1fr; gap: 10px; font-size: 17px; line-height: 1.5; }
.steps li::before { content: counter(step); font-family: var(--display); font-size: 22px; color: var(--gold); line-height: 1.2; text-align: center; border: 1px solid var(--gold-dim); border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; }
.tip { margin: 16px 0 0; padding: 12px 14px; border-left: 3px solid var(--gold-dim); background: var(--panel); color: var(--fg); }
.tip b { font-family: var(--ui); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-right: 6px; }
.plain { margin: 8px 0; padding-left: 20px; }
.recipe-actions { margin-top: 20px; }

/* Act complete */
.actend-screen { padding-block: 40px calc(40px + env(safe-area-inset-bottom, 0px)); }
.actend-inner { max-width: 520px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.actend-inner h2 { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1; margin: 0; color: var(--gold); }
.ledger { width: 100%; border-top: 1px solid var(--line); text-align: left; }
.ledger div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); font-family: var(--ui); }
.ledger b { font-variant-numeric: tabular-nums; }
.ledger .good { color: var(--moss); }
.ledger .bad { color: var(--ember); }
.actend-inner .stack { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }

/* Game header */
#game { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); max-width: 560px; margin: 0 auto; }
header.sheet {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: var(--panel); border-bottom: 1px solid var(--line); padding-block: 12px;
}
body.in-game::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--panel); }
.sheet-row { display: flex; align-items: center; gap: 12px; }
.crest {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--gold); color: var(--gold);
  font-family: var(--display); font-size: 21px; background: var(--panel-2); padding: 0;
}
.who { flex: 1; min-width: 0; }
.who h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 21px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .sub { font-family: var(--ui); font-size: 13px; color: var(--muted); }
.purse { text-align: right; font-family: var(--ui); }
.purse b { display: block; font-size: 18px; color: var(--gold); font-variant-numeric: tabular-nums; }
.purse b.over { color: var(--ember); }
.purse span { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.xp { margin-top: 10px; display: flex; align-items: center; gap: 10px; font-family: var(--ui); font-size: 12px; color: var(--muted); }
.xp-track { flex: 1; height: 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.xp-fill { height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); transition: width .5s ease; }
.xp .num { font-variant-numeric: tabular-nums; }

/* Panels */
.panel { padding-block: 18px 8px; }
.eyebrow { font-family: var(--ui); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin: 0 0 4px; }
h2.view-title { font-family: var(--display); font-weight: 400; font-size: 27px; margin: 0 0 4px; text-wrap: balance; line-height: 1.1; }
.lede { color: var(--muted); margin: 0 0 16px; font-style: italic; }
.section-gap { height: 22px; }

/* Camp */
.tonight { background: var(--panel); border: 1px solid var(--gold-dim); border-radius: 6px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.tonight .dish { font-family: var(--display); font-size: 25px; line-height: 1.1; margin: 0; }
.bark { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 14px; border-left: 3px solid var(--gold-dim); background: linear-gradient(90deg, var(--panel-2), transparent); }
.bark .crest { width: 44px; height: 44px; font-size: 19px; }
.bark .speaker { font-family: var(--ui); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.bark .line { margin: 2px 0 10px; font-style: italic; font-size: 17px; }
.replies { display: flex; flex-direction: column; gap: 4px; }
.reply { text-align: left; background: none; border: 0; padding: 6px 0; color: var(--fg); font-size: 15px; display: flex; gap: 8px; }
.reply span { color: var(--gold); font-family: var(--ui); font-weight: 700; font-variant-numeric: tabular-nums; }
.reply em { color: var(--r-rare); font-style: normal; font-family: var(--ui); font-weight: 700; font-size: 13px; }
.reply:hover { color: var(--gold); }
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { width: 100%; text-align: left; color: var(--fg); display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-family: var(--ui); font-size: 14px; }
.alert .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ember); flex: none; }
.alert.ok .dot { background: var(--moss); }
.alert.info .dot { background: var(--gold); }
.alert span { flex: 1; min-width: 0; }

/* Quest log */
.quests { display: flex; flex-direction: column; gap: 10px; }
.quest { display: grid; grid-template-columns: 52px 1fr; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.quest.today { border-color: var(--gold-dim); box-shadow: 0 0 0 1px var(--gold-dim) inset; }
.quest.done, .quest.skipped { opacity: .6; }
.day { text-align: center; font-family: var(--ui); border-right: 1px solid var(--line); padding-right: 10px; }
.day b { display: block; font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1; }
.day span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.q-body { min-width: 0; }
.q-title { font-weight: 700; font-size: 17px; line-height: 1.25; margin: 0; }
.quest.done .q-title { text-decoration: line-through; text-decoration-color: var(--gold-dim); }
.q-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; font-family: var(--ui); font-size: 12px; }
.chip { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.chip.easy { color: var(--moss); border-color: color-mix(in srgb, var(--moss) 45%, transparent); }
.chip.moderate { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.chip.hard { color: var(--ember); border-color: color-mix(in srgb, var(--ember) 45%, transparent); }
.chip.status { color: var(--fg); background: var(--panel-2); }
.chip.new { color: var(--r-rare); border-color: color-mix(in srgb, var(--r-rare) 45%, transparent); }
.q-approve { font-family: var(--ui); font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.yes { color: var(--moss); }
.no { color: var(--ember); }

/* Supplies */
.aisle { margin-bottom: 18px; }
.aisle h3 { font-family: var(--ui); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; display: flex; justify-content: space-between; }
.list { border: 1px solid var(--line); border-radius: 6px; background: var(--panel); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; }
.item:last-child { border-bottom: 0; }
.box { width: 22px; height: 22px; flex: none; border: 2px solid var(--gold-dim); border-radius: 3px; display: grid; place-items: center; color: var(--ink); font-size: 14px; font-weight: 700; font-family: var(--ui); }
.item.got .box { background: var(--gold); border-color: var(--gold); }
.item .nm { flex: 1; min-width: 0; }
.item .nm b { font-weight: 500; display: block; }
.item.got .nm b { color: var(--muted); text-decoration: line-through; }
.item .nm small { font-family: var(--ui); color: var(--muted); font-size: 12px; }
.item .cost { font-family: var(--ui); font-variant-numeric: tabular-nums; color: var(--gold); font-size: 14px; }
.item.inpack { opacity: .6; }
.item.inpack .box { border-color: var(--moss); color: var(--moss); }
.item.inpack .nm small { color: var(--moss); }
.add { display: flex; gap: 8px; margin-bottom: 18px; }
.tally { font-family: var(--ui); font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; margin-bottom: 14px; }
.tally b { color: var(--fg); font-variant-numeric: tabular-nums; }
.scan {
  display: flex; gap: 14px; align-items: center; width: 100%; text-align: left;
  padding: 14px; margin-bottom: 18px; border-radius: 6px;
  border: 1px dashed var(--gold-dim); background: var(--panel);
}
.scan svg { width: 34px; height: 34px; flex: none; stroke: var(--gold); fill: none; stroke-width: 1.5; }
.scan b { display: block; font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--gold); }
.scan small { font-family: var(--ui); color: var(--muted); font-size: 13px; }

/* Pack */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.slot {
  position: relative; aspect-ratio: 1; max-width: 100%;
  border-radius: 6px; border: 2px solid var(--rc, var(--r-common));
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--rc) 22%, var(--panel-2)), var(--panel) 75%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 6px; text-align: center;
}
.slot.pick { outline: 3px solid var(--gold); outline-offset: 1px; }
.slot .glyph { font-family: var(--display); font-size: 26px; line-height: 1; color: var(--rc); }
.slot .lbl { font-family: var(--ui); font-size: 12px; line-height: 1.15; overflow-wrap: anywhere; }
.slot .qty { position: absolute; right: 6px; bottom: 4px; font-family: var(--ui); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.slot .spoil { position: absolute; left: 5px; top: 4px; font-family: var(--ui); font-size: 10px; font-weight: 700; color: var(--ember); letter-spacing: .04em; }
.slot .lo { position: absolute; right: 5px; top: 4px; font-family: var(--ui); font-size: 9px; font-weight: 700; color: var(--gold); letter-spacing: .06em; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-family: var(--ui); font-size: 12px; color: var(--muted); margin: 10px 0 20px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.alchemy { border: 1px dashed var(--gold-dim); border-radius: 6px; padding: 14px; background: var(--panel); }
.alchemy h3 { margin: 0 0 4px; font-family: var(--display); font-weight: 400; font-size: 20px; }
.alchemy p { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.pick-bar {
  position: sticky; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 5; margin-top: 14px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px;
  background: #0f0b08; border: 1px solid var(--gold-dim); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.pick-bar span { font-family: var(--ui); font-size: 14px; color: var(--gold); margin-right: auto; }
.empty { padding: 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; }

/* Party */
.party { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.member { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.member:hover { border-color: var(--gold-dim); }
.member .crest { width: 42px; height: 42px; font-size: 19px; }
.member .info { flex: 1; min-width: 0; }
.member .info b { font-size: 17px; }
.member .info small { display: block; font-family: var(--ui); color: var(--muted); font-size: 13px; }
.meter { margin-top: 6px; height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--moss); }
.mood { font-family: var(--ui); font-size: 12px; color: var(--moss); white-space: nowrap; }
.perks { display: flex; flex-wrap: wrap; gap: 6px; }
.perks .chip { color: var(--gold); border-color: var(--gold-dim); font-family: var(--ui); font-size: 13px; }
.journal { display: flex; flex-direction: column; gap: 6px; font-family: var(--ui); font-size: 13px; color: var(--muted); }
.journal div { display: flex; gap: 10px; }
.journal time { color: var(--gold-dim); flex: none; font-variant-numeric: tabular-nums; }

/* Tab bar */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: var(--panel); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
nav.tabs .inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
nav.tabs button { background: none; border: 0; padding: 10px 2px 12px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-family: var(--ui); font-size: 12px; color: var(--muted); }
nav.tabs button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }
nav.tabs button[aria-selected="true"] { color: var(--gold); }

/* Toasts */
.toasts { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 108px); z-index: 40; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 16px; }
.toast { font-family: var(--ui); font-size: 14px; font-weight: 500; background: #0f0b08; border: 1px solid var(--gold-dim); color: var(--fg); padding: 8px 14px; border-radius: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.5); animation: rise 2.8s ease forwards; max-width: 100%; }
.toast .g { color: var(--gold); }
.toast .y { color: var(--moss); }
.toast .n { color: var(--ember); }
@keyframes rise { 0% { opacity: 0; transform: translateY(8px); } 10%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px); } }

/* Modal */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(8,6,4,.8); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.dialog { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--gold-dim); border-radius: 8px; padding: 22px 18px 18px; text-align: center; max-height: calc(100dvh - 32px); overflow-y: auto; }
.dialog h3 { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 0 0 6px; color: var(--gold); line-height: 1.1; }
.dialog p { margin: 0 0 16px; color: var(--muted); }
.dialog .row { justify-content: center; }
.dialog.left { text-align: left; }
.dialog.left .row { justify-content: flex-end; }
.die {
  width: 108px; height: 108px; margin: 4px auto 14px; display: grid; place-items: center;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(160deg, var(--gold), var(--gold-dim));
  color: var(--ink); font-family: var(--display); font-size: 44px;
}
.die.spin { animation: spin .9s cubic-bezier(.2,.7,.3,1); }
.die.crit { background: linear-gradient(160deg, #f2d27a, var(--gold)); box-shadow: 0 0 30px var(--gold); }
.die.fail { background: linear-gradient(160deg, var(--ember), #6d2a1d); }
@keyframes spin { from { transform: rotate(-540deg) scale(.6); } to { transform: none; } }
.choices { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.choice { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.choice b { display: block; color: var(--fg); }
.choice small { font-family: var(--ui); color: var(--muted); }
.choice:hover { border-color: var(--gold-dim); }
.loot { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 6px; margin: 0 0 14px; max-height: 46dvh; overflow-y: auto; text-align: left; }
.loot label { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.loot label:last-child { border-bottom: 0; }
.loot input { accent-color: var(--gold); width: 18px; height: 18px; flex: none; }
.loot .nm { flex: 1; min-width: 0; }
.loot .nm small { display: block; font-family: var(--ui); font-size: 12px; color: var(--muted); }
.loot .tick { color: var(--moss); }
.loot .pr { font-family: var(--ui); color: var(--gold); font-variant-numeric: tabular-nums; }
.settings { display: flex; flex-direction: column; gap: 18px; text-align: left; }
.settings .field > span { margin-bottom: 0; }
.keyrow { display: flex; gap: 8px; }
.note { font-family: var(--ui); font-size: 12px; color: var(--muted); text-align: center; padding: 18px 0 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
