:root {
  --cream: #f5efdf;
  --parchment: rgba(252, 248, 239, 0.95);
  --pine: #0b3b2e;
  --pine-strong: #08281f;
  --sage: #204f40;
  --gold: #c9a24b;
  --gold-soft: #e7d2a0;
  --brick: #8e4a32;
  --ink: #13231f;
  --muted: #56645e;
  --line: rgba(11, 59, 46, 0.14);
  --shadow: 0 24px 60px rgba(9, 29, 23, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(201, 162, 75, 0.42), transparent 24%),
    radial-gradient(circle at 85% 20%, rgba(11, 59, 46, 0.14), transparent 28%),
    linear-gradient(180deg, #f8f2e7 0%, #efe5d2 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(11, 59, 46, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 59, 46, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.34), transparent 70%);
}

body.embed-mode {
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

h1,
h2,
p,
ol {
  margin: 0;
}

.embed-banner {
  display: none;
  padding: 0.75rem 1rem;
  background: rgba(11, 59, 46, 0.92);
  color: #fff7e8;
  font-size: 0.92rem;
  line-height: 1.4;
}

.embed-banner a {
  color: var(--gold-soft);
}

.shell {
  width: min(1320px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
}

.panel {
  position: relative;
  background: var(--parchment);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  border-radius: 30px;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--pine), var(--gold), var(--pine));
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.95fr);
  gap: 1.25rem;
  align-items: end;
  padding: 1.6rem;
  margin-bottom: 1.25rem;
}

.eyebrow,
.panel-label,
.stat-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  color: var(--muted);
}

.hero-copy h1 {
  margin-top: 0.35rem;
  font-size: clamp(2.4rem, 5vw, 5rem);
  line-height: 0.92;
}

.disclaimer-copy {
  margin-top: 0.8rem;
  max-width: 52ch;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted);
}

.lede {
  margin-top: 0.95rem;
  max-width: 56ch;
  line-height: 1.55;
  color: var(--muted);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.stat {
  padding: 1rem 1.05rem;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.94), rgba(240, 230, 209, 0.84));
  border: 1px solid rgba(11, 59, 46, 0.1);
}

.stat strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.35rem;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(360px, 450px) minmax(0, 1fr);
  gap: 1.25rem;
}

.left-rail,
.map-panel {
  padding: 1rem;
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: rgba(11, 59, 46, 0.07);
}

.mode-pill {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1rem;
  background: transparent;
  color: var(--pine);
  cursor: pointer;
}

.mode-pill--active {
  background: linear-gradient(180deg, var(--pine), var(--sage));
  color: #fff8eb;
}

.image-card__meta h2,
.player-card h2,
.leaderboard-head h2,
.admin-head h2,
.map-topbar h2 {
  margin-top: 0.25rem;
  font-size: 1.9rem;
}

.image-frame {
  margin-top: 0.9rem;
  min-height: 330px;
  border-radius: 24px;
  border: 1px solid rgba(11, 59, 46, 0.12);
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(11, 59, 46, 0.18), rgba(201, 162, 75, 0.24)),
    linear-gradient(180deg, rgba(255, 250, 242, 0.9), rgba(240, 230, 209, 0.8));
}

.image-frame--empty {
  display: grid;
  place-items: center;
  padding: 1.4rem;
}

.image-frame img {
  display: block;
  width: 100%;
  height: 360px;
  object-fit: cover;
}

.image-empty,
.player-copy {
  color: var(--muted);
  line-height: 1.55;
}

.image-empty {
  max-width: 30ch;
  text-align: center;
}

.actions,
.player-form,
.field-grid {
  display: grid;
  gap: 0.75rem;
}

.actions {
  margin-top: 1rem;
}

.button {
  border: none;
  border-radius: 999px;
  padding: 0.92rem 1.15rem;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease, filter 150ms ease;
}

.button:hover:enabled {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button-primary {
  background: linear-gradient(180deg, var(--pine), var(--sage));
  color: #fff7e8;
}

.button-secondary {
  background: linear-gradient(180deg, var(--gold-soft), #dfc384);
  color: var(--pine-strong);
}

.button-ghost {
  background: transparent;
  color: var(--pine-strong);
  border: 1px solid rgba(11, 59, 46, 0.16);
}

.button-small {
  padding: 0.6rem 0.9rem;
}

.feedback,
.daily-status,
.mini-status,
.admin-panel {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 251, 244, 0.86);
  border: 1px solid rgba(11, 59, 46, 0.1);
}

.feedback,
.daily-status,
.mini-status {
  line-height: 1.55;
}

.daily-status--error {
  border-color: rgba(142, 74, 50, 0.35);
  color: #6b3320;
}

.player-form,
.admin-form {
  margin-top: 0.9rem;
}

.player-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
}

.player-copy {
  margin-top: 0.7rem;
  color: var(--muted);
  line-height: 1.5;
}

.text-input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(11, 59, 46, 0.16);
  background: rgba(255, 251, 244, 0.95);
  color: var(--pine-strong);
}

.leaderboard-head,
.admin-head,
.map-topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.leaderboard-list {
  list-style: none;
  padding: 0;
  margin-top: 1rem;
  display: grid;
  gap: 0.7rem;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 0.9rem;
  border-radius: 18px;
  background: rgba(255, 251, 244, 0.82);
  border: 1px solid rgba(11, 59, 46, 0.08);
}

.leaderboard-rank {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(11, 59, 46, 0.08);
  color: var(--pine);
  font-weight: 700;
}

.leaderboard-main {
  min-width: 0;
}

.leaderboard-main strong,
.leaderboard-main span {
  display: block;
}

.leaderboard-main span {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.leaderboard-delete {
  justify-self: end;
}

.leaderboard-item {
  animation: leaderboard-rise 420ms ease both;
}

.scheduled-list {
  display: grid;
  gap: 0.75rem;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(201, 162, 75, 0.22), transparent 28%),
    rgba(6, 25, 19, 0.68);
  backdrop-filter: blur(8px);
}

.modal-panel,
.countdown-panel {
  position: relative;
  width: min(100%, 560px);
  border-radius: 30px;
  border: 1px solid rgba(255, 248, 232, 0.18);
  box-shadow: 0 28px 70px rgba(5, 22, 17, 0.34);
  animation: modal-pop 280ms ease both;
}

.modal-panel {
  padding: 1.35rem;
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.98), rgba(242, 233, 215, 0.96));
}

.modal-panel--entry {
  width: min(100%, 520px);
}

.modal-panel--results {
  width: min(100%, 760px);
}

.player-form--modal {
  margin-top: 1rem;
}

.player-start {
  margin-top: 0.9rem;
  width: 100%;
}

.countdown-panel {
  display: grid;
  justify-items: center;
  gap: 0.8rem;
  padding: 2rem 1.5rem 1.8rem;
  background:
    radial-gradient(circle at top, rgba(201, 162, 75, 0.26), transparent 40%),
    linear-gradient(180deg, rgba(255, 251, 244, 0.98), rgba(239, 228, 202, 0.96));
}

.countdown-value {
  font-size: clamp(4.5rem, 18vw, 8rem);
  line-height: 0.9;
  color: var(--pine-strong);
  text-shadow: 0 12px 28px rgba(11, 59, 46, 0.15);
  animation: countdown-pulse 700ms ease infinite;
}

.countdown-copy {
  color: var(--muted);
  text-align: center;
}

.results-summary {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
  gap: 0.9rem;
  margin-top: 1rem;
  align-items: stretch;
}

.results-rank-card,
.leaderboard-toolbar {
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 251, 244, 0.8);
  border: 1px solid rgba(11, 59, 46, 0.08);
}

.results-rank-card strong {
  display: block;
  margin-top: 0.3rem;
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: var(--pine-strong);
}

.leaderboard-toolbar {
  margin-top: 0.95rem;
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  align-items: center;
}

.leaderboard-scroll {
  max-height: min(48vh, 420px);
  overflow: auto;
  padding-right: 0.3rem;
  margin-top: 0.8rem;
}

.leaderboard-scroll::-webkit-scrollbar {
  width: 10px;
}

.leaderboard-scroll::-webkit-scrollbar-thumb {
  background: rgba(11, 59, 46, 0.24);
  border-radius: 999px;
}

.queue-panel {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 20px;
  background: rgba(255, 251, 244, 0.72);
  border: 1px solid rgba(11, 59, 46, 0.1);
}

.queue-item-head,
.queue-item-actions,
.queue-form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.queue-item-head strong {
  color: var(--pine-strong);
}

.scheduled-item {
  display: grid;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(255, 251, 244, 0.82);
  border: 1px solid rgba(11, 59, 46, 0.08);
}

.scheduled-empty {
  color: var(--muted);
}

.admin-panel {
  background:
    linear-gradient(180deg, rgba(11, 59, 46, 0.06), rgba(201, 162, 75, 0.08));
  max-height: calc(100vh - 10rem);
  overflow-y: auto;
  padding-right: 0.9rem;
}

.admin-panel::-webkit-scrollbar {
  width: 10px;
}

.admin-panel::-webkit-scrollbar-thumb {
  background: rgba(11, 59, 46, 0.22);
  border-radius: 999px;
}

.queue-panel {
  background: rgba(255, 250, 243, 0.9);
}

.admin-gate,
.admin-form {
  margin-top: 0.9rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field-grid {
  grid-template-columns: 1fr 1fr;
}

.scheduled-list {
  margin-top: 1rem;
  display: grid;
  gap: 0.7rem;
}

.scheduled-item,
.scheduled-empty {
  display: grid;
  gap: 0.18rem;
  padding: 0.85rem 0.9rem;
  border-radius: 18px;
  background: rgba(255, 251, 244, 0.82);
  border: 1px solid rgba(11, 59, 46, 0.08);
}

.scheduled-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.scheduled-item span:last-child {
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.queue-list {
  margin-top: 1rem;
  display: grid;
  gap: 0.8rem;
}

.queue-item {
  display: grid;
  gap: 0.7rem;
  padding: 0.95rem;
  border-radius: 18px;
  background: rgba(255, 251, 244, 0.86);
  border: 1px solid rgba(11, 59, 46, 0.08);
}

.queue-item-copy {
  color: var(--muted);
  line-height: 1.45;
}

.queue-item-actions {
  justify-content: flex-start;
}

.queue-item-actions .button {
  padding: 0.65rem 0.95rem;
}

.bounds-copy {
  max-width: 28ch;
  color: var(--muted);
  line-height: 1.45;
}

.map {
  min-height: 760px;
  height: calc(100vh - 210px);
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid rgba(11, 59, 46, 0.12);
}

.leaflet-container {
  font-family: inherit;
  background: #dde7dc;
}

.leaflet-control-zoom a {
  color: var(--pine-strong);
}

.guess-pin,
.answer-pin,
.setup-pin {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 3px solid #fff8eb;
}

.guess-pin {
  background: var(--brick);
  box-shadow: 0 0 0 5px rgba(142, 74, 50, 0.18);
}

.answer-pin {
  background: var(--pine);
  box-shadow: 0 0 0 5px rgba(11, 59, 46, 0.18);
}

.setup-pin {
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(201, 162, 75, 0.22);
}

body.embed-mode .embed-banner {
  display: block;
}

body.embed-mode .shell {
  width: min(100% - 0.75rem, 100%);
  padding: 0.375rem 0 0.75rem;
}

body.embed-mode .hero {
  display: none;
}

body.embed-mode .game-layout {
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  min-height: calc(100vh - 68px);
}

body.embed-mode .map {
  height: calc(100vh - 105px);
  min-height: 520px;
}

@media (max-width: 1100px) {
  .hero,
  .game-layout,
  .field-grid,
  .results-summary {
    grid-template-columns: 1fr;
  }

  .map {
    min-height: 480px;
    height: 58vh;
  }

  body.embed-mode {
    overflow: auto;
  }

  body.embed-mode .game-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  body.embed-mode .map {
    height: 56vh;
    min-height: 420px;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 1rem, 100%);
    padding-top: 1rem;
  }

  .hero {
    padding: 1.2rem;
  }

  .hero-stats {
    grid-template-columns: 1fr 1fr;
  }

  .leaderboard-head,
  .admin-head,
  .map-topbar,
  .leaderboard-toolbar,
  .queue-item-head,
  .queue-item-actions,
  .queue-form-actions {
    flex-direction: column;
    align-items: start;
  }

  .player-form {
    grid-template-columns: 1fr;
  }

  .image-frame img {
    height: 300px;
  }

  .modal-shell {
    padding: 0.8rem;
  }
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes countdown-pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

@keyframes leaderboard-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
