:root {
  --ink: #183d38;
  --deep: #10332f;
  --paper: #f4f6f1;
  --yellow: #f5c451;
  --muted: #5d6d66;
  --line: #d5ded6;
  --white: #fff;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-width: 0; overflow-x: hidden; background: var(--paper); color: var(--ink); font: 17px/1.55 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; overflow-wrap: anywhere; }
img, svg, video, canvas { max-width: 100%; }
button, input, textarea, select { font: inherit; max-width: 100%; }
input, textarea, select { min-width: 0; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-underline-offset: 4px; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #cb7a12; outline-offset: 4px; }
h1, h2, h3, p { margin: 0 0 18px; }
h1, h2 { font-family: Georgia, serif; line-height: 1.06; font-weight: normal; }
h1 { font-size: clamp(44px, 5.5vw, 76px); letter-spacing: -2px; }
h2 { font-size: clamp(32px, 4vw, 48px); letter-spacing: -1px; }
h3 { font-size: 20px; line-height: 1.35; }
small, .meta { font-size: 14px; }
.top { max-width: 1250px; margin: auto; display: flex; align-items: center; gap: 28px; padding: 23px 32px; border-bottom: 1px solid var(--line); }
.brand { min-width: 0; display: flex; align-items: center; gap: 13px; text-decoration: none; font-size: 18px; font-weight: 800; letter-spacing: 2px; }
.brand > span:last-child { min-width: 0; }
.brand small { display: block; font-size: 11px; letter-spacing: 1.5px; font-weight: 500; }
.brandmark { display: grid; place-items: center; width: 46px; height: 46px; background: var(--ink); color: var(--yellow); font: 32px Georgia; border-radius: 50%; }
.location { margin-left: auto; font-size: 12px; letter-spacing: 1.4px; }
.quiet { border: 0; background: transparent; color: var(--ink); padding: 10px 4px; text-decoration: underline; text-underline-offset: 5px; font-size: 14px; }
.quiet.danger { color: #111; font-weight: 600; }
.quiet.danger:hover { color: #333; }
.shell { max-width: 1186px; margin: 38px auto 70px; padding: 0 28px; }
.intro { display: grid; grid-template-columns: 1.05fr 1fr; gap: 0; background: var(--white); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.intro-copy { padding: 44px; }
.eyebrow { text-transform: uppercase; font-size: 12px; letter-spacing: 2.4px; font-weight: 700; display: block; margin-bottom: 19px; }
.intro p { max-width: 430px; }
.image-panel { position: relative; min-height: 560px; background: var(--ink); }
.image-panel img { width: 100%; height: 100%; object-fit: cover; position: absolute; }
.photo-label { position: absolute; bottom: 20px; left: 22px; right: 22px; color: white; background: #10332ee8; padding: 18px; border-left: 3px solid var(--yellow); }
.photo-label strong { font: 25px Georgia; }
.photo-label small { display: block; margin-top: 4px; }
.facts { display: flex; gap: 22px; flex-wrap: wrap; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 17px 0; margin: 24px 0; }
.facts b { display: block; font-size: 22px; }
.facts span { font-size: 13px; }
.primary, .secondary { display: inline-flex; justify-content: center; align-items: center; gap: 12px; min-height: 50px; padding: 13px 22px; border: 1px solid var(--ink); border-radius: 4px; font-weight: 650; text-decoration: none; }
.primary { background: var(--ink); color: white; }
.primary:hover { background: #25554d; }
.secondary { background: transparent; color: var(--ink); }
.gold { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
label { display: block; font-size: 14px; font-weight: 650; margin-bottom: 7px; }
input[type=text], input[type=password], textarea { width: 100%; padding: 13px; border: 1px solid #a5b6aa; border-radius: 4px; background: white; color: var(--ink); margin-bottom: 13px; }
textarea { min-height: 100px; resize: vertical; }
.muted { color: var(--muted); }
.fine { font-size: 14px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 22px; }
.under-intro { display: flex; justify-content: space-between; gap: 20px; margin-top: 22px; font-size: 14px; }
.game-layout { display: grid; grid-template-columns: 285px minmax(0,1fr); gap: 42px; }
.rail h2 { font-size: 32px; }
.route { list-style: none; margin: 22px 0; padding: 0; }
.route li { display: flex; align-items: flex-start; gap: 13px; padding-bottom: 19px; }
.route .num { flex: 0 0 31px; height: 31px; display: grid; place-items: center; border: 1px solid #b9c7bc; border-radius: 50%; font-size: 12px; }
.route .done .num { background: var(--ink); color: white; border-color: var(--ink); }
.route .current .num { background: var(--yellow); border-color: var(--yellow); font-weight: 800; }
.route span:last-child { font-size: 14px; line-height: 1.35; }
.route small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.route .future { opacity: .55; }
.notebook { padding: 21px; background: #e4ebe1; border: 1px solid #ccd8c9; }
.words { display: flex; flex-wrap: wrap; gap: 7px; margin: 15px 0; }
.word { padding: 5px 9px; border: 1px solid #b5c5b2; background: white; font-size: 12px; font-weight: 700; letter-spacing: .5px; }
.word.locked { background: transparent; color: #6d7a6e; border-style: dashed; }
.progress-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 9px; }
.progress { height: 5px; background: #dce5db; margin-bottom: 28px; }
.progress span { display: block; height: 100%; background: var(--ink); }
.stage-card { background: white; border: 1px solid var(--line); padding: 34px; border-radius: 6px; }
.stage-head { display: flex; align-items: center; gap: 15px; margin-bottom: 18px; }
.big-num { font: 46px Georgia; color: #7a8e79; }
.stage-head .eyebrow { margin: 0; }
.badge { font-size: 13px; display: inline-block; background: #eaf0e6; padding: 4px 10px; border-radius: 30px; margin-bottom: 20px; }
.direction { border-left: 3px solid var(--yellow); padding: 3px 0 3px 19px; margin: 22px 0; }
.direction strong { font-size: 14px; display: block; margin-bottom: 8px; }
.direction p { margin-bottom: 8px; }
.observe { background: #f0f4ec; padding: 20px; margin: 24px 0; }
.observe p { margin: 8px 0 0; }
.choices { display: grid; gap: 11px; }
.choice { text-align: left; display: flex; gap: 15px; align-items: center; width: 100%; background: white; border: 1px solid #b9c8bc; border-radius: 4px; min-height: 60px; padding: 14px 17px; color: var(--ink); }
.choice:hover:not(:disabled) { border-color: var(--ink); background: #f4f7ef; }
.choice .letter { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border: 1px solid #b9c8bc; border-radius: 4px; font-size: 13px; }
.choice.selected { border: 2px solid var(--ink); background: #edf3e9; }
.choice.correct { background: #e7f1df; border: 2px solid #47723e; opacity: 1; }
.choice.wrong { background: #fcf0e8; border-color: #b46c45; opacity: 1; }
.feedback { margin-top: 18px; padding: 20px; border-left: 4px solid #47723e; background: #edf4e7; }
.feedback.wrong { border-color: #b46c45; background: #fcf0e8; }
.feedback p:last-child { margin-bottom: 0; }
.hint { padding: 15px; background: #fff4d6; margin: 12px 0; }
.stage-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 20px; }
.source { font-size: 12px; color: var(--muted); margin: 20px 0 0; }
.village-info-card { margin: 24px 0; padding: 22px 24px; background: #fdfbf7; border: 1px solid #dfd7ca; border-left: 5px solid #d49728; border-radius: 6px; box-shadow: 0 1px 5px rgba(0,0,0,0.03); }
.village-info-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #8c5d08; margin-bottom: 8px; }
.village-info-card h3 { font: 22px Georgia, serif; color: var(--deep); margin: 0 0 14px 0; line-height: 1.35; }
.village-info-body p { font-size: 15px; line-height: 1.65; color: #273430; margin: 0 0 12px 0; }
.village-info-body p:last-child { margin-bottom: 0; }
.notes-village-info { margin-top: 12px; padding: 10px 14px; background: #fdfbf7; border: 1px solid #dfd7ca; border-left: 3px solid #d49728; border-radius: 4px; }
.notes-badge { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; font-weight: 700; color: #8c5d08; display: inline-block; margin-bottom: 3px; }
.quiz-item { margin: 28px 0; border-top: 1px solid var(--line); padding-top: 25px; }
.quiz-item legend { font-weight: 650; margin-bottom: 15px; }
.quiz-item fieldset { border: 0; padding: 0; margin: 0; }
.quiz-item label { font-weight: 400; font-size: 16px; margin: 0; cursor: pointer; }
.result { background: var(--ink); color: white; padding: 38px; border-radius: 6px; }
.result h1 { font-size: 54px; }
.score { font: 70px Georgia; color: var(--yellow); margin: 20px 0; }
.score small { font: 20px system-ui; color: white; }
.result .word { color: var(--ink); }
.section { margin-top: 28px; background: white; border: 1px solid var(--line); padding: 28px; border-radius: 6px; }
.section h2 { font-size: 32px; }
.sources-list { padding-left: 20px; }
.sources-list li { margin-bottom: 13px; }
footer { max-width: 1186px; margin: 0 auto; padding: 25px 28px 35px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
dialog { max-width: 550px; width: calc(100% - 32px); border: 1px solid var(--line); padding: 30px; border-radius: 8px; color: var(--ink); }
dialog::backdrop { background: #10332fb0; }
.warning { padding: 15px; background: #fff2d1; border: 1px solid #d9bb76; margin-bottom: 18px; }
body.printing footer, body.printing header { display: none; }
input[type=number], select { width: 100%; padding: 13px; border: 1px solid #a5b6aa; border-radius: 4px; background: white; color: var(--ink); font: inherit; margin-bottom: 15px; min-height: 48px; }
.route-link { padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 4px; min-height: 30px; }
.count-row { border-bottom: 1px solid var(--line); padding: 16px 0; }
.stepper { display: flex; align-items: stretch; gap: 12px; margin: 10px 0; }
.stepper button { width: 52px; min-height: 52px; border: 1px solid var(--ink); color: var(--ink); background: #e8efe2; font: 24px system-ui; border-radius: 4px; }
.stepper input { width: 90px; text-align: center; margin: 0; font-weight: 750; font-size: 24px; }
.tick { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; font-size: 15px; margin: 12px 0; }
.tick input, .choice input { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; accent-color: var(--ink); }
.tally { margin: 20px 0; font: 28px Georgia; }
.sighting { padding: 20px; border: 1px solid var(--line); background: #f6f8f3; margin: 16px 0; }
.zones { border: 0; padding: 0; margin: 20px 0; }
.zones legend { font-weight: 650; font-size: 15px; }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 15px; }
.tool-grid label { font-size: 16px; font-weight: 400; }
.success { color: #365f29; font-weight: 650; }
details { margin: 15px 0; border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; font-size: 16px; }
dialog { max-height: 85vh; overflow-y: auto; }
.hint p:last-child { margin-bottom: 0; }
.progress { overflow: hidden; }

.start-actions { margin: 20px 0 25px; }
.start-actions .primary { display: flex; width: 100%; min-height: 58px; font-size: 18px; }
.start-actions form { display: grid; gap: 8px; }
.start-actions form input { margin-bottom: 2px; }
.ranking h2 { margin-bottom: 8px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 22px 0; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.current-team { background: #fff4d6; font-weight: 700; }
.ranking form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; }
.ranking form input { margin: 0; }

.admin-shell { max-width: 1186px; }
.admin-login { max-width: 620px; margin: 70px auto; }
.admin-login form { max-width: 430px; }
.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.admin-stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; margin: 25px 0; }
.admin-stats article { background: var(--ink); color: white; padding: 25px; border-radius: 6px; }
.admin-stats span { display: block; font-size: 14px; }
.admin-stats b { display: block; color: var(--yellow); font: 48px Georgia; margin-top: 6px; }
.admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 18px; }
.admin-table { min-width: 850px; }
.admin-table th { white-space: nowrap; }
.admin-comment { white-space: pre-wrap; min-width: 240px; }
.stars { color: #9b6500; font-size: 19px; letter-spacing: 1px; white-space: nowrap; }
.config-editor { margin-top: 14px; }
.config-editor summary { cursor: pointer; font-weight: 800; color: var(--ink); }
.config-editor textarea { min-height: 420px; margin: 16px 0; font: 13px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace; }
.analytics-stats { margin: 16px 0; }
.metric-list { list-style: none; padding: 0; margin: 10px 0; }
.metric-list li { display: flex; justify-content: space-between; gap: 15px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.metric-list span { white-space: nowrap; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px; margin-top: 15px; }
.photo-grid figure { margin: 0; background: #fff; border: 1px solid var(--line); }
.photo-grid img { display: block; width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.photo-grid figcaption { padding: 9px 10px; font-size: 13px; }
.category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.category-grid h3 { margin: 0 0 8px; }
.danger { display: inline-flex; justify-content: center; align-items: center; min-height: 50px; padding: 13px 22px; border: 1px solid #9f352d; border-radius: 4px; background: #9f352d; color: white; font-weight: 700; }
.danger:disabled { opacity: .5; }
.admin-delete-actions { margin: 14px 0 4px; }
.participant-table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ink); }
.organizer-credit { display: grid; gap: 2px; margin: 20px 0; padding: 14px 17px; background: #fff4d6; border-left: 4px solid var(--yellow); }
.organizer-credit span { font-size: 12px; text-transform: uppercase; letter-spacing: 1.3px; font-weight: 700; }
.organizer-credit b { font: 28px Georgia; color: var(--deep); }
.organizer-credit small { color: var(--muted); font-size: 14px; }
.admin-records h2 { margin-bottom: 8px; }
.admin-records .admin-table-wrap { margin: 18px 0 0; }
.participant-table { min-width: 600px; }

@media(max-width:900px) {
  .admin-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media(max-width:800px) {
  body { font-size: 16px; }
  .top { padding: 16px max(18px, env(safe-area-inset-right)) 16px max(18px, env(safe-area-inset-left)); gap: 12px; }
  .brand { flex: 1 1 auto; font-size: 16px; gap: 10px; letter-spacing: 1.5px; }
  .brandmark { flex: 0 0 44px; width: 44px; height: 44px; }
  .location { display: none; }
  .top .quiet { flex: 0 0 auto; margin-left: auto; white-space: nowrap; }
  .shell { margin: 23px auto 45px; padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  .intro { grid-template-columns: 1fr; }
  .intro-copy { padding: clamp(22px, 6vw, 30px); }
  .intro h1 { font-size: clamp(40px, 11vw, 49px); }
  .image-panel { min-height: clamp(225px, 55vw, 340px); order: -1; }
  .photo-label { bottom: 13px; left: 14px; right: 14px; width: auto; padding: 10px 15px; }
  .photo-label strong { font-size: 20px; }
  .photo-label small { font-size: 12px; }
  .facts { margin: 18px 0; }
  .under-intro { display: block; }
  .game-layout { grid-template-columns: 1fr; gap: 18px; }
  .rail { order: 2; }
  .rail .route { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 16px; }
  .rail .route li { padding-bottom: 10px; min-width: 0; }
  .stage-card { padding: clamp(21px, 5vw, 26px); }
  .stage-card h2 { font-size: clamp(32px, 8vw, 36px); }
  .stage-head { margin-bottom: 12px; }
  .result { padding: clamp(24px, 6vw, 30px); }
  .result h1 { font-size: clamp(38px, 10vw, 44px); }
  .score { font-size: clamp(54px, 14vw, 68px); }
  .section { padding: clamp(21px, 5vw, 28px); }
  .primary, .secondary, .danger { font-size: 16px; }
  .actions > .primary, .actions > .secondary, .actions > .danger { flex: 1 1 220px; }
  .category-grid { grid-template-columns: 1fr; gap: 18px; }
  .admin-heading { align-items: stretch; flex-direction: column; gap: 12px; }
  .admin-heading .secondary { align-self: flex-start; }
  .admin-login { margin: 30px auto; }
  .config-editor textarea { min-height: 320px; }
  footer { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); padding-bottom: max(35px, env(safe-area-inset-bottom)); }
  dialog { max-height: calc(100dvh - 24px); }
}

@media(max-width:560px) {
  input[type=text], input[type=password], input[type=number], textarea, select { font-size: 16px; }
  .facts { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 18px; }
  .facts > div { min-width: 0; }
  .tool-grid { grid-template-columns: 1fr; }
  .ranking form { grid-template-columns: 1fr; }
  .ranking form .primary, .ranking form .secondary, .ranking form button { width: 100%; }
  .admin-stats { grid-template-columns: 1fr; gap: 12px; }
  .admin-stats article { padding: 20px; }
  .admin-stats b { font-size: 42px; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); }
}

@media(max-width:480px) {
  h1 { font-size: clamp(36px, 11vw, 44px); letter-spacing: -1.3px; }
  h2 { font-size: clamp(28px, 9vw, 34px); letter-spacing: -.7px; }
  .top { padding-top: 12px; padding-bottom: 12px; }
  .brand { font-size: 14px; letter-spacing: 1.1px; gap: 8px; }
  .brand small { font-size: 9px; letter-spacing: .8px; }
  .brandmark { flex-basis: 40px; width: 40px; height: 40px; font-size: 28px; }
  .top .quiet { font-size: 13px; padding-left: 2px; padding-right: 2px; }
  .shell { margin-top: 16px; margin-bottom: 34px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .intro-copy { padding: 20px; }
  .intro h1 { font-size: clamp(36px, 12vw, 43px); }
  .image-panel { min-height: clamp(205px, 65vw, 280px); }
  .photo-label { left: 10px; right: 10px; bottom: 10px; padding: 9px 12px; }
  .photo-label strong { font-size: 18px; }
  .eyebrow { font-size: 11px; letter-spacing: 1.55px; margin-bottom: 14px; }
  .facts { gap: 12px; padding: 14px 0; }
  .facts b { font-size: 20px; }
  .facts span { font-size: 12px; }
  .organizer-credit { padding: 12px 14px; }
  .organizer-credit b { font-size: 24px; }
  .rail .route { grid-template-columns: 1fr; gap: 4px; }
  .notebook { padding: 17px; }
  .stage-card { padding: 18px; }
  .stage-card h2 { font-size: clamp(29px, 9vw, 33px); }
  .stage-head { gap: 10px; align-items: flex-start; }
  .big-num { font-size: 39px; }
  .badge { max-width: 100%; overflow-wrap: anywhere; }
  .direction { padding-left: 14px; margin: 18px 0; }
  .direction a { display: inline-block; margin-top: 4px; }
  .observe, .sighting, .feedback, .village-info-card { padding: 16px; }
  .village-info-card { padding-left: 17px; }
  .choice { align-items: flex-start; gap: 11px; padding: 13px; }
  .choice .letter { margin-top: 1px; }
  .stepper { width: 100%; gap: 8px; }
  .stepper button { flex: 0 0 50px; width: 50px; }
  .stepper input { flex: 1 1 auto; width: auto; min-width: 0; }
  .actions { align-items: stretch; }
  .actions > .primary, .actions > .secondary, .actions > .danger { width: 100%; flex-basis: 100%; }
  .stage-card > .primary, .stage-card > .secondary, .stage-bottom > button, .result .primary, .result .secondary { width: 100%; }
  .stage-bottom { align-items: stretch; }
  .section { padding: 18px; }
  .result { padding: 22px 18px; }
  .result h1 { font-size: 38px; }
  .result p[style*="28px"] { font-size: 23px !important; }
  .table-wrap { margin-left: -8px; margin-right: -8px; padding: 0 8px; }
  th, td { padding: 10px 8px; }
  .metric-list li { flex-direction: column; gap: 2px; }
  .metric-list span { white-space: normal; }
  .admin-table-wrap { margin-left: -8px; margin-right: -8px; padding: 10px 8px; }
  .config-editor textarea { min-height: 260px; }
  dialog { width: calc(100% - 20px); padding: 20px; border-radius: 6px; }
  dialog .primary, dialog .secondary { width: 100%; }
  footer { gap: 14px; padding-top: 20px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  footer nav { width: 100%; display: grid; gap: 10px; }
}

@media(max-width:360px) {
  .brand { font-size: 13px; }
  .brand small { display: none; }
  .brandmark { flex-basis: 38px; width: 38px; height: 38px; font-size: 26px; }
  .top .quiet { font-size: 12px; }
  .intro-copy, .stage-card, .section { padding: 16px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .photo-label strong { font-size: 17px; }
}

@media(prefers-reduced-motion: no-preference) {
  .stage-card { animation: appear .25s ease; }
  @keyframes appear { from { opacity: .5; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
