:root {
  color-scheme: light;
  --bg: #f5f1e7;
  --ink: #201b16;
  --muted: #6d6257;
  --panel: #fffaf0;
  --line: #d9cbb9;
  --accent: #a73422;
  --accent-dark: #732318;
  --green: #2d6545;
  --gold: #c58b27;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

body.theme-slavic {
  --bg: #f0eadb;
  --panel: #fff8e8;
  --ink: #211812;
  --muted: #6d5d4c;
  --line: #cdb98f;
  --accent: #9d2f20;
  --accent-dark: #612014;
  --green: #315f42;
  --gold: #b98628;
}

body.theme-detective {
  --bg: #ece8dc;
  --panel: #fbf7eb;
  --ink: #1d1a16;
  --muted: #625d53;
  --line: #b8ad9a;
  --accent: #5e4030;
  --accent-dark: #2d211b;
  --green: #315c61;
  --gold: #ad812c;
}

body.theme-urban {
  --bg: #eef0f2;
  --panel: #ffffff;
  --ink: #171a1f;
  --muted: #59616c;
  --line: #c8ced6;
  --accent: #285f9f;
  --accent-dark: #173b67;
  --green: #237160;
  --gold: #bf8a24;
}

body.theme-fantasy {
  --bg: #eee9f2;
  --panel: #fffaf6;
  --ink: #20192b;
  --muted: #625872;
  --line: #c6b7d7;
  --accent: #6f3f8f;
  --accent-dark: #432458;
  --green: #376d58;
  --gold: #c18b32;
}

body.theme-expedition {
  --bg: #edf0e4;
  --panel: #fffdf3;
  --ink: #18211a;
  --muted: #586450;
  --line: #b9c4a8;
  --accent: #8b3d2e;
  --accent-dark: #51271f;
  --green: #2f6f55;
  --gold: #b69031;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: rgba(245, 241, 231, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

body.theme-detective .topbar,
body.theme-urban .topbar,
body.theme-fantasy .topbar,
body.theme-expedition .topbar,
body.theme-slavic .topbar {
  background: color-mix(in srgb, var(--bg) 92%, #fff);
}

body.theme-detective .hero {
  background:
    linear-gradient(rgba(29, 26, 22, 0.14), rgba(29, 26, 22, 0.05)),
    repeating-linear-gradient(135deg, rgba(94, 64, 48, 0.08) 0 2px, transparent 2px 14px),
    var(--panel);
}

body.theme-detective .entry-card,
body.theme-detective .task-text,
body.theme-detective .chat-message {
  border-style: dashed;
}

body.theme-detective .path-token {
  border-radius: 8px;
  transform: rotate(-2deg);
}

body.theme-urban .hero {
  background:
    linear-gradient(rgba(23, 26, 31, 0.06), rgba(23, 26, 31, 0.02)),
    linear-gradient(90deg, rgba(40, 95, 159, 0.08) 0 1px, transparent 1px 32px),
    linear-gradient(0deg, rgba(40, 95, 159, 0.06) 0 1px, transparent 1px 32px),
    var(--panel);
}

body.theme-urban .entry-card,
body.theme-urban .path-card,
body.theme-urban .task-card {
  border-radius: 4px;
}

body.theme-urban .path-token,
body.theme-urban .map-marker,
body.theme-urban .map-pin {
  border-radius: 4px;
}

body.theme-fantasy .hero {
  background:
    linear-gradient(rgba(111, 63, 143, 0.13), rgba(55, 109, 88, 0.08)),
    var(--panel);
}

body.theme-fantasy .letter-tile,
body.theme-fantasy .earned-runes span,
body.theme-fantasy .completion-reveal strong {
  border-radius: 50%;
}

body.theme-fantasy .path-token {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent), 0 0 22px color-mix(in srgb, var(--accent) 28%, transparent);
}

body.theme-expedition .hero {
  background:
    linear-gradient(rgba(47, 111, 85, 0.1), rgba(139, 61, 46, 0.06)),
    repeating-linear-gradient(45deg, rgba(47, 111, 85, 0.07) 0 1px, transparent 1px 18px),
    var(--panel);
}

body.theme-expedition .entry-card,
body.theme-expedition .map-card,
body.theme-expedition .task-card {
  background:
    repeating-linear-gradient(45deg, rgba(47, 111, 85, 0.035) 0 1px, transparent 1px 18px),
    var(--panel);
}

body.theme-slavic .hero {
  background:
    linear-gradient(rgba(157, 47, 32, 0.1), rgba(49, 95, 66, 0.06)),
    var(--panel);
}

body.theme-slavic .path-token,
body.theme-slavic .earned-runes span,
body.theme-slavic .letter-tile {
  border-radius: 8px 3px 8px 3px;
}

body.theme-slavic .artifact-panel {
  border-color: color-mix(in srgb, var(--gold) 50%, var(--line));
}

.brand {
  font-weight: 800;
  text-decoration: none;
}

.topnav {
  display: flex;
  gap: 10px;
  font-size: 14px;
}

.topnav a {
  text-decoration: none;
  color: var(--muted);
}

.page {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 22px 16px 44px;
}

.hero,
.dashboard-head,
.panel,
.station-page {
  background: var(--panel);
  background-image: var(--panel-bg-image);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.hero {
  min-height: 72vh;
  display: grid;
  align-content: start;
  justify-items: stretch;
  gap: 22px;
  background-color: var(--panel);
  background-image:
    linear-gradient(rgba(32, 27, 22, 0.1), rgba(32, 27, 22, 0.05));
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.hero.has-hero-image {
  background-image: linear-gradient(rgba(32, 27, 22, 0.08), rgba(32, 27, 22, 0.03));
}

.hero-image-inline {
  display: block;
  width: 100%;
  max-height: min(48vh, 520px);
  object-fit: contain;
  border: 1px solid color-mix(in srgb, var(--line) 75%, #fff);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, #fff);
  box-shadow: 0 16px 38px rgba(32, 27, 22, 0.14);
}

.hero h1 {
  max-width: 780px;
  font-size: clamp(36px, 7vw, 72px);
  letter-spacing: 0;
}

.hero h2 {
  max-width: 680px;
  color: var(--muted);
}

.hero-copy p:last-child {
  max-width: 760px;
  font-size: 18px;
}

.hero-copy {
  width: 100%;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, #fff);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, #fff);
  box-shadow: 0 14px 34px rgba(32, 27, 22, 0.16);
  backdrop-filter: blur(8px);
}

.portal-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-status span {
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 80%, #fff);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
}

.entry-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.entry-choice.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.entry-card {
  display: grid;
  gap: 6px;
  min-height: 132px;
  align-content: center;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 86%, #fff);
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(32, 27, 22, 0.1);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.entry-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 16px 34px rgba(32, 27, 22, 0.16);
}

.entry-card span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.entry-card strong {
  font-size: 22px;
  line-height: 1.1;
}

.entry-card small {
  color: var(--muted);
  font-size: 14px;
}

.entry-card.organizer {
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
}

.entry-card.organizer span {
  color: var(--green);
}

.form-links {
  margin-top: 16px;
}

.dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.expedition-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 45%),
    var(--panel);
}

.progress-rail {
  display: block;
  height: 10px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 72%, #000 6%);
}

.progress-rail span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.team-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.team-identity.centered {
  justify-content: center;
  text-align: center;
}

.team-symbol {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 2px solid color-mix(in srgb, var(--team-color, var(--accent)) 68%, #fff);
  border-radius: 50%;
  background: color-mix(in srgb, var(--team-color, var(--accent)) 16%, #fff);
  color: var(--team-color, var(--accent));
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 10px 22px rgba(32, 27, 22, 0.12);
}

.team-symbol.large {
  width: 78px;
  height: 78px;
  font-size: 38px;
}

.team-symbol img {
  display: block;
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.team-symbol.large img {
  width: 74%;
  height: 74%;
}

.team-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--team-color, var(--accent)) 32%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--team-color, var(--accent)) 9%, var(--panel));
}

.narrow {
  max-width: 520px;
  margin: 0 auto;
}

.kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.1;
}

h2 {
  font-size: 22px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.ghost {
  border-color: var(--line);
  color: var(--muted);
}

.button.danger {
  border-color: #9f2d2d;
  color: #9f2d2d;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.form {
  display: grid;
  gap: 14px;
}

.form p {
  display: grid;
  gap: 6px;
  margin: 0;
}

.admin-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-form p:has(textarea),
.admin-form p:has(input[type="file"]) {
  grid-column: 1 / -1;
}

.compact-form {
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
}

.formset-block {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.messages {
  width: min(100%, 920px);
  margin: 12px auto 0;
  padding: 0 16px;
}

.announcements {
  display: grid;
  gap: 8px;
  width: min(100%, 920px);
  margin: 12px auto 0;
  padding: 0 16px;
}

.announcement {
  padding: 12px 14px;
  border: 1px solid #d8b15c;
  border-radius: 8px;
  background: #fff8df;
}

.announcement strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-dark);
}

.announcement p:last-child {
  margin-bottom: 0;
}

.staff-alert {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  width: min(360px, calc(100% - 32px));
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(32, 27, 22, 0.2);
}

.staff-alert a {
  display: grid;
  gap: 4px;
  padding: 14px;
  text-decoration: none;
}

.staff-alert strong {
  color: var(--accent-dark);
}

.staff-alert span {
  color: var(--muted);
  font-size: 14px;
}

.staff-alert.pulse {
  animation: alertPulse 900ms ease-out;
}

@keyframes alertPulse {
  0% {
    transform: translateY(0) scale(1);
  }
  35% {
    transform: translateY(-4px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

.message {
  padding: 10px 12px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid var(--line);
}

.message.success {
  border-color: #9fc2a4;
  background: #eef8ee;
}

.message.error {
  border-color: #d89a9a;
  background: #fff0f0;
}

.letters {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.letters span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.letter-scatter {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 18px;
  min-height: 190px;
  margin: 20px 0 24px;
  padding: 24px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
}

.letter-scatter.interactive {
  align-items: flex-start;
}

.letter-tile {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid #8a5a24;
  border-radius: 8px;
  background: #f4ddb5;
  color: #2a1c12;
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 5px 0 rgba(77, 48, 22, 0.16);
  cursor: pointer;
}

button.letter-tile {
  padding: 0;
  appearance: none;
}

.letter-tile:disabled {
  opacity: 0.32;
  transform: translateY(8px) scale(0.94);
  cursor: default;
}

.final-builder {
  display: grid;
  gap: 12px;
  margin: 18px 0 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, #fff);
}

.answer-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.answer-slots span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 48px;
  border-bottom: 3px solid var(--accent);
  color: var(--accent-dark);
  font-size: 24px;
  font-weight: 900;
}

.answer-slots span.filled {
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-bottom-width: 3px;
  border-radius: 7px;
  background: #fffdf7;
}

.tile-1,
.tile-5,
.tile-9 {
  transform: rotate(-8deg) translateY(8px);
}

.tile-2,
.tile-6 {
  transform: rotate(7deg) translateY(-10px);
}

.tile-3,
.tile-7 {
  transform: rotate(-3deg) translateY(16px);
}

.tile-4,
.tile-8 {
  transform: rotate(10deg) translateY(2px);
}

.station-list {
  display: grid;
  gap: 12px;
}

.artifact-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin: 16px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--green) 10%, transparent), transparent),
    var(--panel);
}

.earned-runes {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.earned-runes span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid color-mix(in srgb, var(--gold) 75%, #000);
  border-radius: 8px;
  background: #f4ddb5;
  color: #2a1c12;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(77, 48, 22, 0.16);
}

.expedition-path {
  position: relative;
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.expedition-path::before {
  content: "";
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 26px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(var(--accent), var(--green));
  opacity: 0.28;
}

.path-card {
  position: relative;
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(42, 28, 18, 0.06);
}

.path-card.active {
  border-color: color-mix(in srgb, var(--accent) 54%, var(--line));
}

.path-card.completed {
  border-color: color-mix(in srgb, var(--green) 70%, var(--line));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--green) 12%, transparent), transparent 55%),
    var(--panel);
}

.path-card.bonus {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--gold) 16%, transparent), transparent 58%),
    var(--panel);
}

.path-card.locked-card {
  opacity: 0.72;
}

.path-card.locked-card::after {
  content: "Zapieczętowane";
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 85%, #fff);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.path-token {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);
}

.path-card.completed .path-token {
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 28%, transparent);
}

.path-card.bonus .path-token {
  background: var(--gold);
  color: #201b16;
}

.path-content h2 {
  margin-bottom: 4px;
}

.path-actions {
  display: flex;
  justify-content: flex-end;
}

.path-badge {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-weight: 800;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.control-card {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-decoration: none;
}

.control-card strong {
  font-size: 18px;
}

.control-card span {
  color: var(--muted);
}

.station-card,
.review-card,
.table-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.station-card h2,
.review-card h3 {
  margin-bottom: 4px;
}

.status,
.locked {
  color: var(--muted);
}

.story {
  color: #342a22;
}

.divider {
  height: 1px;
  margin: 22px 0;
  background: var(--line);
}

.preview {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.station-image {
  width: 100%;
  max-height: none;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 12px 0 18px;
  background: #fff;
}

.story-card {
  overflow: hidden;
}

.station-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.72fr);
  gap: 20px;
  align-items: start;
}

.station-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 16px;
}

.station-meta-row span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 86%, #fff);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.task-card {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--gold) 10%, transparent), transparent 120px),
    var(--panel);
}

.task-card-head h2 {
  margin-bottom: 0;
}

.task-text {
  padding: 14px;
  border: 1px dashed color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, #fff);
}

.station-action-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, #fff);
}

.review-state {
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--gold) 60%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--gold) 15%, transparent), transparent),
    #fffdf7;
}

.review-state h2 {
  margin-bottom: 4px;
}

.submitted-photo {
  box-shadow: 0 10px 24px rgba(32, 27, 22, 0.12);
}

.hint {
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
}

.hint-stack {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.hint-stack .hint {
  margin: 0;
}

.hint summary {
  cursor: pointer;
  font-weight: 900;
  color: var(--accent-dark);
}

.hint div {
  margin-top: 10px;
}

.hint-request,
.location-box {
  margin: 16px 0;
}

.location-box {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
}

.success-box {
  padding: 14px;
  border-radius: 8px;
  background: #edf7ef;
  border: 1px solid #9fc2a4;
}

.completion-reveal {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.completion-reveal strong {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 28px;
}

.completion-reveal p {
  margin: 0;
  color: var(--muted);
}

.code-reveal {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--green) 42%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--green) 12%, transparent), transparent 60%),
    color-mix(in srgb, var(--panel) 88%, #fff);
}

.code-reveal strong {
  display: inline-grid;
  place-items: center;
  width: fit-content;
  min-width: 160px;
  padding: 12px 16px;
  border: 1px dashed var(--green);
  border-radius: 8px;
  background: color-mix(in srgb, var(--green) 12%, #fff);
  color: var(--green);
  font-size: 30px;
  letter-spacing: 0;
}

.reward-pop {
  position: relative;
  overflow: hidden;
  animation: rewardRise 720ms ease both;
}

.reward-pop::after {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle, color-mix(in srgb, var(--accent) 28%, transparent) 0 4px, transparent 5px),
    radial-gradient(circle, color-mix(in srgb, var(--green) 24%, transparent) 0 3px, transparent 4px);
  background-size: 58px 58px, 74px 74px;
  opacity: 0;
  animation: rewardSpark 900ms ease both;
  pointer-events: none;
}

@keyframes rewardRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes rewardSpark {
  0% {
    opacity: 0;
    transform: scale(0.82) rotate(0deg);
  }
  35% {
    opacity: 0.65;
  }
  100% {
    opacity: 0;
    transform: scale(1.12) rotate(8deg);
  }
}

.final-strip {
  margin-top: 18px;
  text-align: center;
}

.table {
  display: grid;
  gap: 8px;
}

.table-row {
  grid-template-columns: 1.4fr 0.7fr 0.6fr 0.7fr;
}

.compact-table .table-row {
  grid-template-columns: 1fr 0.7fr 1.4fr;
}

.table-row.header {
  font-weight: 900;
  color: var(--muted);
}

.message-panel {
  display: grid;
  gap: 18px;
}

.message-head {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--green) 12%, transparent), transparent 52%),
    var(--panel);
}

.field-comms {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--green) 8%, transparent), transparent 160px),
    var(--panel);
}

.conversation {
  display: grid;
  gap: 10px;
}

.conversation.compact {
  max-height: 280px;
  overflow: auto;
}

.chat-message {
  max-width: 82%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(32, 27, 22, 0.06);
}

.chat-message.team {
  justify-self: end;
  background: color-mix(in srgb, var(--gold) 18%, #fff);
}

.chat-message.admin {
  justify-self: start;
  background: color-mix(in srgb, var(--green) 14%, #fff);
}

.chat-meta {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.thread-list {
  display: grid;
  gap: 14px;
}

.thread-card {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 0.7fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
}

.team-control-list {
  display: grid;
  gap: 14px;
}

.team-control {
  display: grid;
  gap: 14px;
}

.team-control-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.live-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 18px 0;
}

.danger-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.danger-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d89a9a;
  border-radius: 8px;
  background: #fff8f7;
}

.danger-details {
  padding: 9px 12px;
  border: 1px solid #d89a9a;
  border-radius: 8px;
  background: #fff8f7;
}

.danger-details summary {
  cursor: pointer;
  color: #9f2d2d;
  font-weight: 900;
}

.confirm-inline {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #f1e6d9;
}

.live-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.metric-card {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-card span {
  color: var(--muted);
  font-weight: 800;
}

.metric-card strong {
  font-size: 34px;
  line-height: 1;
}

.live-table .table-row {
  grid-template-columns: 1.2fr 0.6fr 0.5fr 1.2fr;
}

.ranking-table .table-row {
  grid-template-columns: 0.35fr 1.2fr 0.7fr 0.6fr 0.6fr 0.8fr 0.6fr 0.7fr;
}

.map-list {
  display: grid;
  gap: 12px;
}

.map-card {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.map-card.locked-card {
  opacity: 0.74;
}

.map-marker,
.map-pin {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.map-pin.bonus,
.map-marker.bonus {
  background: var(--green);
}

.map-pin.missing {
  background: var(--muted);
}

.map-actions {
  justify-content: flex-end;
}

.map-thumb {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.map-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.announcement-admin-list,
.day-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.announcement-admin,
.day-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
}

.announcement-admin p,
.day-item p {
  margin-bottom: 4px;
}

.day-head {
  border-color: var(--accent);
}

.day-summary .metric-card {
  min-height: 116px;
}

.metric-card.urgent {
  border-color: var(--accent);
}

.metric-card.urgent strong {
  color: var(--accent);
}

.metric-card.safety-error {
  border-color: #c75050;
}

.metric-card.safety-error strong {
  color: #9f2d2d;
}

.metric-card.safety-warning {
  border-color: #d8b15c;
}

.metric-card.safety-warning strong {
  color: #9c6b18;
}

.metric-card.safety-ok {
  border-color: #8eb58f;
}

.metric-card.safety-ok strong {
  color: #2f6f55;
}

.readiness-list {
  display: grid;
  gap: 10px;
}

.readiness-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
}

.readiness-item h3 {
  margin-bottom: 4px;
}

.readiness-item p:last-child {
  margin-bottom: 0;
}

.readiness-item.error {
  border-color: #d89a9a;
  background: #fff4f4;
}

.readiness-item.warning {
  border-color: #d8b15c;
  background: #fff9e8;
}

.readiness-item.ok {
  border-color: #a7c8a8;
  background: #f1f8f0;
}

.day-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.qr-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  break-inside: avoid;
}

.qr-card img {
  width: 160px;
  height: 160px;
  image-rendering: pixelated;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-card p {
  overflow-wrap: anywhere;
}

.print-cover,
.print-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.print-materials {
  display: grid;
  gap: 18px;
}

.print-cover {
  margin-bottom: 18px;
}

.print-card {
  display: grid;
  gap: 14px;
  break-inside: avoid;
}

.print-card-head {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 14px;
  align-items: start;
}

.print-card-head img {
  width: 130px;
  height: 130px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.print-block {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.print-block h3 {
  margin-bottom: 6px;
}

@media (max-width: 640px) {
  .topbar,
  .dashboard-head,
  .expedition-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .expedition-head,
  .artifact-panel,
  .path-card,
  .station-hero-grid,
  .completion-reveal {
    grid-template-columns: 1fr;
  }

  .expedition-path::before {
    left: 25px;
  }

  .path-actions,
  .earned-runes {
    justify-content: flex-start;
  }

  h1 {
    font-size: 28px;
  }

  .letters {
    gap: 5px;
  }

  .letters span {
    font-size: 18px;
  }

.letter-scatter {
    min-height: 230px;
    gap: 12px;
  }

  .letter-tile {
    width: 50px;
    height: 50px;
    font-size: 24px;
  }

  .hero {
    min-height: auto;
    align-content: start;
  }

  .hero-image-inline {
    width: 100%;
    max-height: 42vh;
    object-fit: contain;
  }

  .hero-copy {
    padding: 14px;
    background: var(--panel);
    backdrop-filter: none;
  }

  .station-card,
  .review-card,
  .table-row,
  .thread-card,
    .control-grid,
    .entry-choice,
    .entry-choice.three,
    .journal-grid,
    .keepsake-stats,
    .live-summary,
    .day-grid,
    .announcement-admin,
    .day-item,
    .readiness-item,
    .qr-grid,
    .print-card-head,
    .ranking-table .table-row,
    .map-card,
    .danger-grid,
  .admin-form,
  .compact-form {
    grid-template-columns: 1fr;
  }

  .qr-card {
    grid-template-columns: 1fr;
  }

  .team-control-head {
    flex-direction: column;
  }

  .live-controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .journal-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-message {
    max-width: 100%;
  }
}

.final-stage {
  min-height: 68vh;
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 16%, color-mix(in srgb, var(--gold) 28%, transparent), transparent 28%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 48%),
    var(--panel);
}

.victory-card,
.locked-final {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, #fff);
}

.victory-card {
  position: relative;
  overflow: hidden;
  min-height: 320px;
  display: grid;
  align-content: center;
  gap: 12px;
  border-color: color-mix(in srgb, var(--green) 65%, var(--line));
  background:
    radial-gradient(circle at 80% 18%, color-mix(in srgb, var(--gold) 34%, transparent), transparent 26%),
    linear-gradient(135deg, color-mix(in srgb, var(--green) 16%, transparent), transparent 60%),
    color-mix(in srgb, var(--panel) 82%, #fff);
}

.victory-card::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px dashed color-mix(in srgb, var(--green) 45%, transparent);
  border-radius: 8px;
  pointer-events: none;
}

.victory-rays {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.victory-rays span {
  position: absolute;
  width: 120px;
  height: 120px;
  border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent);
  border-radius: 50%;
  opacity: 0.42;
}

.victory-rays span:nth-child(1) {
  top: 20px;
  right: 28px;
}

.victory-rays span:nth-child(2) {
  top: 48px;
  right: 76px;
  width: 72px;
  height: 72px;
}

.victory-rays span:nth-child(3) {
  bottom: 24px;
  left: 34px;
  width: 88px;
  height: 88px;
}

.victory-rays span:nth-child(4) {
  bottom: 60px;
  left: 90px;
  width: 44px;
  height: 44px;
}

.victory-seal {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed var(--green);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 72%, #fff);
  color: var(--green);
  text-align: center;
}

.victory-seal span {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.victory-seal strong {
  font-size: 24px;
}

.victory-seal small {
  color: var(--muted);
  font-weight: 800;
}

.journal-head,
.journal-panel,
.keepsake-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, #fff);
  box-shadow: 0 12px 30px rgba(32, 27, 22, 0.1);
}

.journal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 22px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--team-color, var(--accent)) 12%, transparent), transparent 55%),
    color-mix(in srgb, var(--panel) 88%, #fff);
}

.journal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.journal-panel {
  padding: 18px;
}

.artifact-list,
.journal-timeline,
.journal-messages {
  display: grid;
  gap: 12px;
}

.artifact-entry {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
}

.artifact-entry > span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  font-weight: 900;
}

.artifact-entry small,
.journal-timeline small {
  color: var(--muted);
  font-weight: 800;
}

.journal-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.journal-gallery a {
  position: relative;
  overflow: hidden;
  min-height: 130px;
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
}

.journal-gallery img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.journal-gallery span {
  display: block;
  padding: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.journal-timeline article {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border: 3px solid color-mix(in srgb, var(--team-color, var(--accent)) 60%, #fff);
  border-radius: 50%;
  background: var(--panel);
}

.journal-messages p {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--green) 8%, var(--panel));
}

.keepsake-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 18px;
  text-align: center;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--team-color, var(--accent)) 14%, transparent), transparent 52%),
    color-mix(in srgb, var(--panel) 88%, #fff);
}

.keepsake-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.keepsake-stats span {
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--team-color, var(--accent)) 24%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--team-color, var(--accent)) 8%, var(--panel));
}

.keepsake-stats strong {
  display: block;
  color: var(--team-color, var(--accent));
  font-size: 22px;
}

@media print {
  .topbar,
  .messages,
  .no-print {
    display: none !important;
  }

  body {
    background: #fff !important;
  }

  .page {
    width: 100%;
    padding: 0;
  }

  .dashboard-head {
    border: 0;
  }

  .qr-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .qr-card {
    background: #fff;
  }

  .print-cover,
  .print-card {
    border-color: #999;
    background: #fff;
    page-break-inside: avoid;
  }

  .print-card {
    margin-bottom: 14px;
  }

  .print-card-head {
    grid-template-columns: 1fr 110px;
  }

  .print-card-head img {
    width: 110px;
    height: 110px;
  }
}
