/* Big Dog, Little Quest: the viewer.
   Palette is the app's "campfire and leather" theme (app/.../ui/theme/Theme.kt), so the phone and
   this page read as one thing. Type: the cards' own face, DejaVu Sans Mono Bold, for names and
   numbers; the system face for reading. Pixels stay square: card art is never smoothed. */
@font-face { font-family: "BDQ Mono"; src: url("../tools/fonts/DejaVuSansMono-Bold.ttf"); font-weight: 700; }
@font-face { font-family: "BDQ Mono"; src: url("../tools/fonts/DejaVuSansMono.ttf"); font-weight: 400; }

:root {
  --bg: #1B1712; --surface: #231E17; --raised: #2A241C; --high: #332B22; --line: #4A3F33;
  --ink: #EDE3D6; --soft: #D4C4B0; --dim: #8C7B68;
  --honey: #F2C46D; --bark: #5D3A1A; --moss: #7FA650; --ember: #E07A3F; --warn: #FF8A80;
  --mono: "BDQ Mono", ui-monospace, Consolas, monospace;
  --r: 4px; --pad: 16px;
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, "Segoe UI", sans-serif; }
body { margin: 0; padding-bottom: 76px; min-height: 100vh;
  background: radial-gradient(1200px 500px at 50% -180px, #3A2A18 0%, transparent 70%) no-repeat, var(--bg); }
h1, h2, h3 { font-family: var(--mono); font-weight: 700; margin: 0; letter-spacing: .01em; }
h1 { font-size: 1.15rem; } h2 { font-size: 1.25rem; } h3 { font-size: .95rem; color: var(--soft); }
button, input, select { font: inherit; color: inherit; }
img { image-rendering: pixelated; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px var(--pad);
  border-bottom: 2px solid var(--bark); position: sticky; top: 0; z-index: 5; background: rgba(27, 23, 18, .94); backdrop-filter: blur(6px); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand > div { min-width: 0; }
.brand h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { margin: 0; font-size: .8rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The mark: a paw print in honey, built from blocks so it stays pixel art at any size. */
.mark { width: 36px; height: 36px; flex: none; background:
  linear-gradient(var(--honey), var(--honey)) 12px 18px / 12px 12px,
  linear-gradient(var(--honey), var(--honey)) 9px 21px / 18px 9px,
  linear-gradient(var(--honey), var(--honey)) 3px 12px / 6px 6px,
  linear-gradient(var(--honey), var(--honey)) 9px 6px / 6px 6px,
  linear-gradient(var(--honey), var(--honey)) 21px 6px / 6px 6px,
  linear-gradient(var(--honey), var(--honey)) 27px 12px / 6px 6px;
  background-repeat: no-repeat; background-color: var(--bark); border-radius: var(--r); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .35); }
.head-chip { font: 400 .72rem var(--mono); color: var(--soft); background: var(--raised); border: 1px solid var(--line);
  padding: 6px 10px; border-radius: var(--r); white-space: nowrap; }
.head-chip b { color: var(--moss); font-weight: 700; }
.head-chip.bad b { color: var(--warn); }

main { max-width: 1180px; margin: 0 auto; padding: 0 var(--pad); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0 12px; }
.bar.sub { padding-top: 28px; border-top: 1px solid var(--line); margin-top: 24px; }
.lede, .note, .count { color: var(--soft); max-width: 62ch; margin: 0 0 16px; }
.count, .note { font-size: .85rem; color: var(--dim); }
.hint { font: 400 .78rem system-ui; color: var(--dim); margin-left: 6px; }
input[type=search], select { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; min-width: 0; }
input[type=search] { width: min(280px, 50vw); }
input:focus-visible, select:focus-visible, button:focus-visible, .card:focus-visible { outline: 2px solid var(--honey); outline-offset: 2px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.chip { flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .85rem; cursor: pointer; }
.chip b { font-family: var(--mono); color: var(--honey); margin-right: 6px; }
.chip.on { background: var(--bark); border-color: var(--honey); }
.chip small { color: var(--dim); margin-left: 6px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding-bottom: 24px; }
.card { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; border-radius: 6px; transition: transform .12s ease; position: relative; }
.card:hover { transform: translateY(-4px); }
.card-img { display: block; width: 100%; aspect-ratio: 750 / 1050; border-radius: 6px; background: var(--surface); box-shadow: 0 6px 0 rgba(0, 0, 0, .35); }
.card .owned { position: absolute; left: 6px; bottom: 6px; font: 700 .68rem var(--mono); background: var(--moss); color: #12230A; padding: 2px 6px; border-radius: 3px; }

.bench-top { display: grid; grid-template-columns: minmax(180px, 280px) 1fr; gap: 24px; align-items: start; }
.bench-side h3 { margin: 4px 0 10px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.row .card { width: 104px; }
.row .card.picked .card-img { outline: 3px solid var(--honey); outline-offset: 2px; }
.row .card.dim .card-img { opacity: .38; }

.log { list-style: none; margin: 0; padding: 0 0 24px; }
.log li { display: grid; grid-template-columns: 54px 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.log .seq { font: 700 .8rem var(--mono); color: var(--honey); padding-top: 3px; }
.log .seq small { display: block; font-weight: 400; color: var(--dim); text-transform: uppercase; font-size: .62rem; letter-spacing: .06em; margin-top: 2px; }
.log blockquote { margin: 0 0 8px; font-size: 1.02rem; color: var(--ink); max-width: 68ch; }
.log blockquote::before { content: "Saucer: "; font: 700 .72rem var(--mono); color: var(--ember); text-transform: uppercase; letter-spacing: .05em; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill { font: 400 .74rem var(--mono); padding: 3px 8px; border-radius: 3px; background: var(--raised); border: 1px solid var(--line); color: var(--soft); }
.pill.seen { border-color: var(--moss); color: #D9F0BF; }
.pill.unseen { border-color: var(--warn); color: var(--warn); }
.pill.made { border-color: var(--honey); color: var(--honey); }
.pill.link { color: var(--dim); }

.plot { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 18px; margin-bottom: 16px; display: grid; grid-template-columns: 1fr 150px; gap: 20px; }
.plot h3 { color: var(--ink); font-size: 1.05rem; margin-bottom: 4px; }
.steps { display: flex; flex-wrap: wrap; gap: 0; margin: 14px 0; padding: 0; list-style: none; }
.steps li { font: 700 .76rem var(--mono); padding: 7px 14px 7px 22px; background: var(--raised); color: var(--dim); position: relative; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); margin-right: -4px; }
.steps li:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); padding-left: 14px; }
.steps li.done { background: var(--bark); color: var(--honey); }
.steps li.now { background: var(--honey); color: #3A2508; }
.history { margin: 0; padding: 0; list-style: none; font-size: .88rem; color: var(--soft); }
.history li { padding: 3px 0; }
.history code, .kv code, pre { font: 400 .78rem var(--mono); color: var(--dim); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 20px; }
.kv dt { color: var(--dim); font-size: .85rem; } .kv dd { margin: 0; overflow-wrap: anywhere; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 18px; margin-bottom: 16px; }
.panel h3 { color: var(--ink); margin-bottom: 12px; }
.att { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.att:last-child { border: 0; }
.dot { width: 10px; height: 10px; background: var(--moss); flex: none; } .dot.bad { background: var(--warn); }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; overflow-x: auto; color: var(--soft); margin: 8px 0 0; }
.empty { color: var(--dim); padding: 24px 0; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 2px solid var(--bark); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
.tabs button { background: none; border: 0; padding: 10px 4px 12px; font-size: .74rem; color: var(--dim); cursor: pointer; display: grid; justify-items: center; gap: 5px; }
.tabs button.on { color: var(--honey); }
.ico { width: 22px; height: 22px; display: block; background: currentColor; }
.ico-cards { clip-path: polygon(14% 9%, 59% 9%, 59% 18%, 86% 18%, 86% 91%, 41% 91%, 41% 82%, 14% 82%); }
.ico-bench { clip-path: polygon(0 32%, 100% 32%, 100% 50%, 86% 50%, 86% 100%, 73% 100%, 73% 50%, 27% 50%, 27% 100%, 14% 100%, 14% 50%, 0 50%); }
.ico-land { clip-path: polygon(41% 0, 59% 0, 59% 14%, 95% 14%, 82% 27%, 95% 41%, 59% 41%, 59% 82%, 100% 82%, 100% 100%, 0 100%, 0 82%, 41% 82%); }
.ico-record { clip-path: polygon(9% 9%, 41% 9%, 41% 27%, 59% 27%, 59% 9%, 91% 9%, 91% 41%, 73% 41%, 73% 59%, 91% 59%, 91% 91%, 59% 91%, 59% 73%, 41% 73%, 41% 91%, 9% 91%, 9% 59%, 27% 59%, 27% 41%, 9% 41%); }

dialog { border: 0; padding: 0; background: var(--surface); color: var(--ink); border-radius: 8px; width: min(880px, 94vw); max-height: 92vh; box-shadow: 0 30px 80px rgba(0, 0, 0, .7); }
dialog::backdrop { background: rgba(10, 8, 6, .78); }
.close { position: absolute; right: 10px; top: 8px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); width: 36px; height: 36px; font-size: 1.3rem; cursor: pointer; z-index: 2; }
.detail-body { display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: 24px; padding: 24px; }
.flip { background: none; border: 0; padding: 0; cursor: pointer; display: block; width: 100%; }
.detail-body h2 { margin-bottom: 2px; } .detail-body .sub { color: var(--honey); margin: 0 0 14px; font-size: .92rem; }
.status { display: inline-block; font: 700 .7rem var(--mono); border: 1px dashed var(--honey); color: var(--honey); padding: 2px 8px; border-radius: 3px; margin-left: 8px; vertical-align: middle; }
.textbox { background: var(--bg); border-left: 3px solid var(--bark); padding: 12px 14px; margin: 0 0 16px; border-radius: 0 var(--r) var(--r) 0; }

.mark { cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 12px); max-width: min(440px, 88vw); background: var(--high); color: var(--ink);
  border: 1px solid var(--honey); border-left: 4px solid var(--ember); border-radius: var(--r); padding: 12px 16px; opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease; z-index: 9; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.toast::before { content: "Saucer: "; font: 700 .72rem var(--mono); color: var(--ember); text-transform: uppercase; letter-spacing: .05em; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .bench-top, .plot, .detail-body { grid-template-columns: 1fr; }
  .bench-card { max-width: 220px; } .head-chip { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .plot img { max-width: 150px; }
}
@media (min-width: 900px) {
  body { padding-bottom: 0; padding-top: 0; }
  .tabs { position: sticky; top: 67px; bottom: auto; max-width: 1180px; margin: 0 auto; border: 0; border-bottom: 1px solid var(--line); background: var(--bg); grid-template-columns: repeat(4, max-content); justify-content: start; gap: 8px; width: 100%; padding: 0 var(--pad); order: -1; }
  .tabs button { grid-auto-flow: column; align-items: center; padding: 12px 14px; font-size: .88rem; border-bottom: 3px solid transparent; }
  .tabs button.on { border-bottom-color: var(--honey); }
  body { display: flex; flex-direction: column; } .top { order: -2; } main { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .card { transition: none; } }
