@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: 360px; padding: 32px 0; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; }
.login-shell h1 { font-size: clamp(2.8rem, 9vw, 3.8rem); text-align: center; margin: 0 0 30px; }
.event-city { display: block; margin: 14px 0 0 .32em; font: 650 1rem system-ui, sans-serif; letter-spacing: .32em; color: var(--accent); }
.event-year { display: block; margin-top: 8px; font: 500 .72rem system-ui, sans-serif; letter-spacing: .15em; color: var(--muted); }
.event-invite { text-align: center; animation: invite-arrive .35s ease-out both; }
.event-invite h2 { font-size: 1.9rem; margin: 14px 0 10px; }
.meetup-time { color: var(--accent); font-size: .9rem; font-weight: 650; }
.meetup-address { display: inline-block; font-size: .85rem; color: var(--muted); line-height: 1.5; margin-bottom: 28px; text-underline-offset: 3px; }
.event-invite .primary { width: 100%; }
body:not(.signing-in) #login-panel { display: none; }
.signing-in #event-invite { display: none; }
#login-panel { animation: invite-arrive .32s ease-out both; }
body[data-game="active"] #back-to-invite { display: none; }
@keyframes invite-arrive { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { #login-panel, .event-invite { animation: none; } }
.error-banner { background: #fae5e1; border: 1px solid #d7a099; color: #8b241b; padding: 13px 16px; border-radius: 8px; line-height: 1.45; }
.admin-banner { background: #a82c28; color: white; text-align: center; font-weight: 750; font-size: .8rem; padding: 6px; }
.host-shell { padding-top: 22px; }
.game-shell { max-width: 760px; padding-top: 24px; }
.empty-game { max-width: 360px; margin: 15vh auto; }
.empty-game h1 { font-size: 2.5rem; margin-bottom: 24px; }
.empty-game label { display: grid; gap: 8px; }
.game-overview { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 22px; }
.game-overview h1 { font-size: 2.4rem; margin: 0 0 8px; }
.game-section { margin-bottom: 18px; }
.game-section h2 { font-size: 1.9rem; }
.game-section summary { cursor: pointer; min-height: 44px; padding: 13px 0; font-size: .88rem; font-weight: 650; }
.game-section .small { margin-bottom: 10px; }
.recap-map { height: 440px; border: 1px solid var(--line); border-radius: 10px; margin-top: 12px; }
#recap-select { display: block; margin: 16px 0 10px; width: 100%; min-height: 44px; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); padding: 8px; border-radius: 8px; }
.destructive { color: #b32622; background: #fff; border: 1px solid #e4bbb6; border-radius: 10px; min-height: 48px; font: inherit; font-weight: 650; cursor: pointer; }
.action-sheet h2 { font-size: 1.7rem; margin-bottom: 18px; }
@media (max-width: 600px) {
  dialog.action-sheet { position: fixed; top: auto; bottom: max(12px, env(safe-area-inset-bottom)); margin: 0 auto; padding: 22px; border-radius: 18px; }
  .game-overview h1 { font-size: 2rem; }
  .recap-map { height: 380px; }
}
.player-app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.player-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.player-app .top-inner { width: calc(100% - 32px); max-width: none; min-height: 56px; }
.player-app .brand { font-size: 1.1rem; }
.player-app.naming .player-main { overflow: auto; }
.name-panel { width: min(360px, calc(100% - 36px)); margin: auto; padding: 32px 0; }
.name-panel h1 { font-size: 2.5rem; margin-bottom: 26px; }
.player-controls { padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.player-summary { display: flex; gap: 8px; align-items: center; font-size: .85rem; overflow-wrap: anywhere; }
#player-label { color: var(--accent); font-size: .7rem; border: 1px solid var(--line); padding: 2px 6px; border-radius: 5px; }
.permission-banner { margin-top: 9px; width: 100%; border: 1px solid #d7a099; border-radius: 8px; background: #fae5e1; color: #8b241b; padding: 12px; display: flex; gap: 10px; align-items: center; text-align: left; cursor: pointer; font-size: .84rem; font-weight: 650; min-height: 48px; }
.permission-banner.optional { border-color: #dfc796; background: #fff1d5; color: #755018; }
#permission-icon { font-size: 1.3rem; }
.round-status { margin-top: 7px; font-size: .8rem; color: var(--muted); }
.player-map { flex: 1; min-height: 120px; position: relative; }
.player-map .map { height: 100%; width: 100%; border: 0; }
.player-map .clue { position: absolute; z-index: 500; bottom: 26px; left: 50%; transform: translateX(-50%); min-width: 200px; box-shadow: 0 5px 30px #2b211d33; }
.player-message { margin: 8px 16px; flex: none; }
.turkey-stage { height: 250px; flex-shrink: 0; padding: 20px; display: grid; place-items: center; overflow: visible; }
.turkey-button { position: relative; display: block; width: 210px; height: 210px; padding: 0; border: 0; background: transparent; border-radius: 50%; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.turkey-button .turkey { display: block; pointer-events: none; }
.turkey-button.toasting { animation: turkey-cheers .65s ease-in-out; }
.turkey-effects { position: absolute; inset: 0; pointer-events: none; }
.cash-bill { position: absolute; left: 28%; top: 54%; width: 29px; height: 16px; border: 2px solid #527b45; border-radius: 2px; background: #b9d59a; color: #3b6131; font: 700 11px Georgia, serif; line-height: 12px; text-align: center; box-shadow: inset 0 0 0 1px #dfedc9; animation: cash-flutter 1.3s ease-out both; }
.toast-bubble { position: absolute; left: 79%; top: 31%; width: 7px; height: 7px; border: 1px solid #c68a2f; background: #fff0c3; border-radius: 50%; animation: toast-fizz .7s ease-out both; }
@keyframes turkey-cheers { 0%, 100% { transform: rotate(0); } 28% { transform: translateY(-7px) rotate(-11deg); } 60% { transform: translateY(-3px) rotate(5deg); } }
@keyframes cash-flutter {
  0% { opacity: 0; transform: translate(0, 0) rotate(0); }
  15% { opacity: 1; }
  45% { opacity: 1; transform: translate(var(--cash-x), -26px) rotate(var(--cash-spin)) rotateY(140deg); }
  100% { opacity: 0; transform: translate(var(--cash-end), 100px) rotate(var(--cash-spin)) rotateY(320deg); }
}
@keyframes toast-fizz { from { opacity: 1; transform: translate(0, 0); } to { opacity: 0; transform: translate(var(--bubble-x), -40px) scale(.4); } }
@media (prefers-reduced-motion: reduce) { .turkey-button.toasting, .cash-bill, .toast-bubble { animation: none; } }
.turkey { width: 210px; height: 210px; object-fit: contain; mix-blend-mode: multiply; animation: turkey-waddle 2.6s ease-in-out infinite; transform-origin: 50% 85%; }
@keyframes turkey-waddle {
  0%, 100% { transform: translateX(-9px) rotate(-5deg); }
  20% { transform: translate(0, -8px) rotate(5deg); }
  40% { transform: translate(9px, 0) rotate(-4deg); }
  55% { transform: translate(8px, -17px) rotate(7deg); }
  70% { transform: translate(0, 0) rotate(-3deg); }
  85% { transform: translate(-8px, -7px) rotate(4deg); }
}
#check-in { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
dialog { width: min(360px, calc(100% - 36px)); border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); padding: 24px; }
dialog::backdrop { background: #2b211d88; }
dialog h2 { margin-bottom: 12px; }
dialog p { margin-bottom: 22px; line-height: 1.5; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .turkey { animation: none; } }
.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-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; }
}
