/* Secret Mission -- phone-first. Same case-file language as the printed kit:
   cranberry and gold on warm paper, typewriter for the stamps and labels. */

:root {
  --paper: #f7f5f0;
  --ink: #241a1c;
  --muted: #6d5f5f;
  --rule: #d9d0c8;
  --cranberry: #9b1d34;
  --gold: #b9811c;
  --green: #1f6b45;
  --card: #ffffff;
  --stamp-bg: #f3e3e5;
  --shadow: 0 1px 2px rgba(36, 26, 28, .06), 0 4px 16px rgba(36, 26, 28, .05);
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --type: "Special Elite", "Courier New", Courier, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #1b1517; --ink: #f1e9e6; --muted: #b3a4a3; --rule: #3d3134;
  --cranberry: #e0687c; --gold: #e2ad4f; --green: #5cc18c; --card: #241c1f;
  --stamp-bg: #3a2228; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.5;
  padding: 0 max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-bottom));
  padding-top: max(14px, env(safe-area-inset-top));
}
#app { max-width: 34rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.pad { padding: 1rem; }

/* -- type ----------------------------------------------------------- */
h1 { font-family: var(--display); font-weight: 800; font-size: 1.9rem; line-height: 1.05; margin: 0; }
h1 em { font-style: normal; color: var(--cranberry); }
h2 { font-family: var(--display); font-weight: 800; font-size: 1.15rem; margin: 0; }
p { margin: 0; }
.stamp {
  align-self: flex-start; font-family: var(--type); color: var(--cranberry);
  border: 2px solid var(--cranberry); padding: .1rem .55rem; letter-spacing: .12em;
  text-transform: uppercase; font-size: .72rem; transform: rotate(-1.5deg);
  background: var(--stamp-bg);
}
.label { font-family: var(--type); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); font-size: .88rem; }
.err { color: var(--cranberry); font-size: .9rem; font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }

/* -- header --------------------------------------------------------- */
header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-top: .25rem; }
header .who { display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; }
header .who b { font-family: var(--display); font-size: .95rem; }
.linkish { background: none; border: none; padding: 0; font: inherit; font-size: .78rem;
  color: var(--muted); text-decoration: underline; cursor: pointer; }
.linkish:hover { color: var(--cranberry); }

/* -- panels --------------------------------------------------------- */
.panel {
  background: var(--card); border: 1px solid var(--rule); border-radius: 10px;
  padding: 1rem 1.05rem; display: flex; flex-direction: column; gap: .7rem; box-shadow: var(--shadow);
}
.panel.focus { border-color: var(--cranberry); border-width: 2px; }
.panel.flat { box-shadow: none; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }

/* The mission itself -- the one thing that should dominate the screen. */
.mission { font-family: var(--display); font-weight: 800; font-size: 1.5rem; line-height: 1.2; text-wrap: balance; }
.cardno { font-family: var(--display); font-weight: 800; font-size: 1.4rem; color: var(--cranberry); }

/* -- buttons -------------------------------------------------------- */
button, .btn {
  font: inherit; font-weight: 600; border-radius: 8px; border: 1px solid var(--rule);
  background: var(--card); color: var(--ink); padding: .8rem 1rem; cursor: pointer;
  min-height: 48px; text-align: center; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: .4rem; touch-action: manipulation;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--cranberry); border-color: var(--cranberry); color: #fff; }
.good { background: var(--green); border-color: var(--green); color: #fff; }
.ghost { background: transparent; }
.danger { color: var(--cranberry); border-color: var(--cranberry); }
.small { min-height: 38px; padding: .4rem .7rem; font-size: .85rem; font-weight: 500; }
.stack { display: flex; flex-direction: column; gap: .55rem; }
.row { display: flex; gap: .55rem; flex-wrap: wrap; }
.row > * { flex: 1 1 auto; }

/* -- forms ---------------------------------------------------------- */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
input, select {
  font: inherit; padding: .75rem .8rem; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--paper); color: var(--ink); min-height: 48px; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--cranberry); outline-offset: 2px;
}
input[inputmode="numeric"] { font-family: var(--type); letter-spacing: .3em; font-size: 1.25rem; }

/* -- scoreboard ----------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .45rem .3rem; text-align: right; border-bottom: 1px solid var(--rule); }
th { font-family: var(--type); font-weight: 400; font-size: .68rem; letter-spacing: .05em;
     text-transform: uppercase; color: var(--muted); }
th:first-child, td:first-child { text-align: left; }
th:not(:first-child), td:not(:first-child) { width: 3.4rem; }
td.held { font-family: var(--display); font-weight: 800; font-size: 1.05rem; }
tr.me { background: var(--stamp-bg); }
tr.me td { font-weight: 600; }
td .rank { color: var(--muted); font-size: .78rem; margin-right: .35rem; }
.chip { display: inline-block; font-family: var(--type); font-size: .64rem; letter-spacing: .06em;
  text-transform: uppercase; border: 1px solid currentColor; border-radius: 3px;
  padding: .02rem .3rem; margin-left: .35rem; vertical-align: 1px; white-space: nowrap; }
.chip.need { color: var(--cranberry); }
.chip.max { color: var(--gold); }

/* -- history / log -------------------------------------------------- */
ol.trail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; }
ol.trail li { display: flex; gap: .5rem; align-items: baseline; }
ol.trail time { font-family: var(--type); font-size: .7rem; color: var(--muted); flex: 0 0 auto; }

/* -- deck grid (master) --------------------------------------------- */
.deck { display: flex; flex-wrap: wrap; gap: .25rem; font-family: var(--type); font-size: .72rem; }
.deck span { border: 1px solid var(--rule); border-radius: 3px; padding: .05rem .3rem; color: var(--muted); }

/* -- awards --------------------------------------------------------- */
.award { display: flex; flex-direction: column; gap: .15rem; padding: .6rem 0; border-bottom: 1px dotted var(--rule); }
.award:last-child { border-bottom: none; }
.award b { font-family: var(--display); font-size: 1rem; }
.award .winner { color: var(--cranberry); font-weight: 600; }
.trophy { font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1.1; color: var(--cranberry); text-wrap: balance; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: max(1rem, env(safe-area-inset-bottom));
  background: var(--ink); color: var(--paper); padding: .7rem 1.1rem; border-radius: 999px;
  font-size: .9rem; font-weight: 500; z-index: 20; max-width: 90vw; box-shadow: var(--shadow);
}
.spin { color: var(--muted); font-family: var(--type); font-size: .85rem; padding: 2rem 0; text-align: center; }
footer { text-align: center; padding: .5rem 0 1.5rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

details.panel summary { cursor: pointer; display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
details.panel summary h2 { font-size: 1.15rem; }
details.panel[open] summary { margin-bottom: .5rem; }
footer.stack { gap: .75rem; padding-top: 1rem; }
button.linkish[data-game="reset"] { color: var(--cranberry); }
/* Give-list rows: name takes the room, the action stays thumb-sized. */
td:has(> button.small) { width: 5.2rem; text-align: right; }
