@layer base {
  :root {
    --ink: #2b211d;
    --muted: #695950;
    --paper: #f8f2e8;
    --card: #fffaf2;
    --line: #e6d7c7;
    --accent: #963b25;
    --accent-hover: #78301e;
    --green: #34553c;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-synthesis: none;
  }
  * { box-sizing: border-box; }
  body { margin: 0; }
  [hidden] { display: none !important; }
  p, h1, h2 { margin: 0; }
  a { color: inherit; }
  button, input { font: inherit; }
  :focus-visible { outline: 3px solid #9a4329; outline-offset: 3px; }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.topbar { background: var(--ink); color: #fff3df; }
.top-inner { width: min(1160px, calc(100% - 44px)); margin: auto; min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; gap: 10px; align-items: center; text-decoration: none; font-family: Georgia, serif; font-weight: 700; font-size: 1.18rem; }
.brand-icon { color: #e2a368; font: 1.5rem system-ui; line-height: 1; }
.nav-link { text-decoration: none; font-size: .84rem; color: #f2dfcb; padding: 12px 0; background: none; border: 0; cursor: pointer; }
.nav-link:hover { text-decoration: underline; }
.topbar :focus-visible { outline-color: #edb575; }
.shell { width: min(1160px, calc(100% - 44px)); margin: auto; padding-bottom: 52px; }
.login-shell { max-width: 560px; }
.login-shell h1 { font-size: clamp(3.1rem, 9vw, 5.4rem); }
.login-shell .mast-compass { margin-right: 0; }
.intro { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: clamp(35px,6vw,78px) 0 clamp(28px,5vw,54px); }
.eyebrow { font-size: .68rem; font-weight: 800; color: var(--accent); letter-spacing: .18em; text-transform: uppercase; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: -.058em; }
h1 { font-size: clamp(3.1rem, 8vw, 7.15rem); line-height: .98; margin: 8px 0 14px; }
h1 em { color: var(--accent); font-weight: 500; }
h2 { font-size: clamp(1.75rem, 3vw, 2.35rem); line-height: 1; margin-top: 5px; }
.intro-copy { font-size: clamp(.95rem,2vw,1.16rem); color: var(--muted); }
.mast-compass { color: var(--accent); width: clamp(78px, 13vw, 148px); aspect-ratio: 1; border: 1px solid #d5b9a0; border-radius: 50%; flex: none; display: grid; place-items: center; position: relative; transform: rotate(13deg); margin-right: clamp(0px, 4vw, 52px); }
.mast-compass::before { content: ""; position: absolute; inset: 12%; border: 1px dashed #c9a388; border-radius: 50%; }
.mast-north, .mast-south { position: absolute; background: var(--paper); line-height: 1; font: 700 .7rem Georgia, serif; padding: 0 6px; }
.mast-north { top: -6px; }
.mast-south { bottom: -6px; }
.mast-rose { font: clamp(3rem, 7vw, 6.2rem)/1 Georgia, serif; transform: translateY(-2%); }
.player-grid, .desk-grid { display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(305px, 1fr); gap: 22px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 19px; box-shadow: 0 13px 26px -23px #6e3e28; overflow: hidden; }
.card-top { margin-bottom: 19px; }
.map-top { display: flex; justify-content: space-between; align-items: end; gap: 10px; }
.map-card > .card-top { padding: 22px 24px 0; }
.map-tag { flex: none; display: inline-flex; gap: 7px; align-items: center; padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .72rem; font-weight: 650; }
.map-tag i { display: inline-block; width: 8px; height: 8px; background: #a6422b; border-radius: 50%; }
.map-tag[data-state="live"] { color: #fff; background: var(--green); border-color: var(--green); }
.map { isolation: isolate; height: clamp(320px, 43vw, 470px); background: #e9e3d7; color: var(--ink); border-top: 1px solid var(--line); }
.map .leaflet-tile-pane { filter: saturate(.63) sepia(.12); }
.map .leaflet-control-attribution { background: #fffaf0e8; }
.map .map-pin { border-radius: 50%; background: var(--accent); color: white; border: 2px solid white; display: grid; place-items: center; box-shadow: 0 2px 5px #0005; font-weight: 800; }
.map .map-pin.test { background: var(--green); }
.check-in, .setup-card { padding: 24px; }
.stamp { display: grid; place-items: center; margin: 0 0 20px; width: 42px; height: 42px; font-size: 1.35rem; border-radius: 50%; border: 1px solid #d8b59e; color: var(--accent); background: #f7eadd; }
.stack { display: grid; gap: 12px; }
.stack p, .small { line-height: 1.48; color: var(--muted); }
label { font-weight: 700; font-size: .84rem; }
input:not([type=file]) { width: 100%; min-width: 0; min-height: 46px; padding: 10px 12px; background: #fffdfa; border: 1px solid #c9b7a5; border-radius: 9px; color: var(--ink); font-size: 16px; }
input::placeholder { color: #766960; }
input.code-input { font-family: ui-monospace, monospace; font-weight: 750; font-size: 1.3rem; letter-spacing: .14em; min-height: 55px; text-transform: uppercase; }
.small, .stack .small { font-size: .83rem; }
.primary, .secondary { display: inline-flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 45px; padding: 10px 14px; cursor: pointer; border-radius: 9px; font-weight: 700; border: 1px solid transparent; }
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-hover); }
.secondary { border-color: #d9c6b4; color: var(--ink); background: #fffaf2; }
.secondary:hover { background: #f4e8da; }
button:disabled { cursor: default; opacity: .58; }
.text-button { width: fit-content; background: transparent; border: 0; min-height: 42px; padding: 4px 0; text-decoration: underline; color: var(--accent); cursor: pointer; }
.message { color: var(--accent); line-height: 1.45; font-size: .84rem; margin-top: 8px; }
.message.ok { color: var(--green); }
.message:empty { display: none; }
.clue { display: grid; place-items: center; gap: 8px; background: #f3e7d8; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.dial { display: grid; place-items: center; width: 104px; height: 104px; border: 1px dashed #b7886d; border-radius: 50%; }
#arrow { display: inline-grid; place-items: center; width: 66px; height: 66px; color: var(--accent); font: 700 3rem/1 system-ui; }
#compass-point { font-size: 1.08rem; }
.timer { font-variant-numeric: tabular-nums; font-size: .8rem; color: var(--muted); }
.host-shell h1 { font-size: clamp(3rem, 7vw, 6rem); }
.desk-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.desk-nav a { display: inline-flex; align-items: center; min-height: 42px; border: 1px solid #d9c6b4; padding: 0 12px; border-radius: 999px; color: var(--ink); text-decoration: none; font-size: .83rem; font-weight: 700; }
.desk-nav a:hover { background: #f4e8da; }
.desk-grid section[id] { scroll-margin-top: 14px; }
.desk-grid { grid-template-columns: minmax(0,1.17fr) minmax(330px,1fr); }
.desk-side { display: grid; gap: 16px; }
.host-map { height: clamp(330px, 40vw, 485px); }
.map-tools { padding: 17px 22px; }
.row { display: flex; align-items: end; gap: 8px; }
.row input, .row label { flex: 1; min-width: 0; }
.row label { display: grid; gap: 5px; }
.row button { flex: none; }
.file-label { color: var(--accent); }
input[type=file] { max-width: 100%; color: var(--muted); font-size: .82rem; }
input::file-selector-button { background: #fffaf2; border: 1px solid #d9c6b4; border-radius: 7px; cursor: pointer; padding: 8px; color: var(--ink); }
.captain-intro { margin-bottom: 14px; }
.code-summary { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0 8px; margin-top: 8px; }
.code-summary button { font-size: .83rem; }
.teams { list-style: none; padding: 0; margin: 8px 0 0; }
.teams li { display: flex; align-items: center; gap: 6px; padding: 9px 0; border-top: 1px solid var(--line); font-size: .85rem; }
.team-entry { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.team-entry strong { width: 100%; overflow-wrap: anywhere; }
.captain-code { font-family: ui-monospace, monospace; font-weight: 700; letter-spacing: .06em; }
.team-status { color: var(--muted); font-size: .76rem; }
.team-status.ready { color: var(--green); font-weight: 700; }
.teams button { font-size: .75rem; min-height: 42px; padding-inline: 9px; white-space: nowrap; }
.issued-code { margin-top: 14px; border: 1px solid #d9c6b4; border-radius: 10px; padding: 10px 12px; background: #f4e8da; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.issued-code p { font-size: .8rem; overflow-wrap: anywhere; }
.issued-code strong { font-family: ui-monospace, monospace; font-size: 1.4rem; letter-spacing: .12em; }
.reveal-card > .small, .rehearsal > .small { margin-bottom: 12px; }
.rehearsal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 760px) {
  .top-inner, .shell { width: calc(100% - 30px); }
  .top-inner { min-height: 56px; }
  .player-grid, .desk-grid { grid-template-columns: minmax(0,1fr); gap: 15px; }
  .player-grid .check-in { grid-row: 1; }
  .check-in, .setup-card { padding: 19px; }
  .map-card > .card-top { padding-inline: 18px; }
  .map-tools { padding-inline: 17px; }
  .map { height: 350px; }
  .intro { padding-block: 31px; }
}
@media (max-width: 390px) {
  .map-tools .row { flex-wrap: wrap; }
  .map-tools .row button { width: 100%; }
  .mast-compass { width: 58px; margin-right: 1px; }
  .mast-rose { font-size: 2.8rem; }
}
