/* Neolithia — white / black / Courier New */

:root {
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-border: #000000;
  --color-ink: #000000;
  --color-muted: #333333;
  --color-accent: #000000;
  --color-correct: #15803d;
  --color-correct-bg: #dcfce7;
  --color-wrong: #b91c1c;
  --color-wrong-bg: #fee2e2;
  --color-mystery: #000000;
  --font-display: "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-brand: "Cinzel Decorative", Georgia, "Times New Roman", serif;
  --font-mono: "Courier New", Courier, monospace;
  --radius: 0;
  --shadow: none;
  --timeline-cell-width: 11rem;
  --timeline-cell-height: 8.5rem;
  --mystery-dock-height: 21rem;
  --mystery-dock-gap: 2.5rem;
  --mystery-card-min-height: 10.75rem;
}

@media (max-height: 56.25rem) {
  :root {
    --timeline-cell-width: clamp(8.4rem, 15.5vw, 11rem);
    --timeline-cell-height: clamp(6.5rem, 11.8vh, 8.5rem);
    --mystery-dock-height: clamp(15rem, 34vh, 21rem);
    --mystery-dock-gap: clamp(0.5rem, 1.5vh, 2.5rem);
    --mystery-card-min-height: clamp(7.3rem, 17vh, 10.75rem);
  }
}

@media (max-height: 44rem) {
  :root {
    --timeline-cell-width: clamp(7.8rem, 14.5vw, 9.75rem);
    --timeline-cell-height: clamp(5.9rem, 10.4vh, 7.2rem);
    --mystery-card-min-height: clamp(6.6rem, 15vh, 8.4rem);
    --mystery-dock-gap: 0.5rem;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html.theme-inverted {
  filter: invert(1) hue-rotate(180deg);
}

body {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-ink);
  background: var(--color-bg);
  min-height: 100vh;
}

/* Titles and bold UI — Proxima Nova; body copy stays Courier New */
h2,
h3,
.panel-title,
.card-title,
.score-value,
.scoreboard,
.round-label,
.btn,
.feedback,
.drop-zone-label,
.geo-picker-title,
.geo-picker-label,
.geo-picker-action,
.overlay-card h2,
.end-score strong,
.card-tooltip-title,
.map-tooltip-title,
.card-region,
.card-region--compact {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.app {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1rem 1rem 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1rem;
  position: relative;
  margin-bottom: 0.35rem;
}

.app-title {
  font-family: var(--font-brand);
  font-size: clamp(2rem, 6.2vw, 3.1rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.1em;
  margin: 0;
  padding-bottom: 0.15rem;
  color: var(--color-ink);
}

.tagline {
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--color-muted);
  max-width: 32rem;
  margin-inline: auto;
}

.tagline-mobile {
  display: none;
}

@media (max-width: 47.9375rem) {
  .tagline-desktop {
    display: none;
  }

  .tagline-mobile {
    display: inline;
  }
}

.scoreboard {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.score-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.round-label {
  margin-left: 0.75rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* Panels */
.panel-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin: 0 0 0.75rem;
}

.game-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  gap: var(--mystery-dock-gap);
}

.game-stage--in-play .game-top {
  flex: 1 1 auto;
  min-height: 0;
}

.game-stage--in-play .timeline-section {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.game-stage--in-play .timeline-scroll {
  flex: 1 1 auto;
  min-height: var(--timeline-cell-height);
}

.game-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  justify-content: flex-start;
}

/* Mystery card dock — fixed at bottom, foreground feel */
.mystery-dock {
  position: relative;
  margin-top: auto;
  flex: 0 0 auto;
  z-index: 40;
  padding: 0.75rem 0 1rem;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  pointer-events: auto;
}

.mystery-dock-core {
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
}

.mystery-dock--split .mystery-dock-core {
  max-width: min(52rem, 100%);
}

.mystery-dock-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.mystery-dock--split .mystery-dock-row {
  display: grid;
  grid-template-columns: min(26rem, 100%) minmax(10rem, 18rem);
  gap: 1.5rem;
  justify-content: center;
  align-items: start;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

.mystery-dock--split .mystery-panel {
  grid-column: 1;
  width: 100%;
  max-width: 26rem;
  min-width: 0;
  justify-self: end;
}

.mystery-dock-messages {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  pointer-events: auto;
}

.mystery-dock--split .mystery-dock-messages {
  display: flex;
  grid-column: 2;
  width: 18rem;
  max-width: 18rem;
  min-width: 10rem;
  min-height: 5.5rem;
  margin: 0;
  align-self: stretch;
  justify-content: center;
}

.mystery-dock-messages .drag-hint {
  margin: 0;
  padding: 0 0.15rem;
  max-width: none;
  line-height: 1.5;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--color-muted);
  text-align: left;
}

.mystery-dock-messages .drag-hint[hidden] {
  display: none;
}

.mystery-dock-messages > .feedback,
.mystery-dock-messages > .round-actions {
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
}

.mystery-dock-messages .round-actions .btn--primary {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.mystery-dock--split .round-actions {
  text-align: left;
}

@media (max-width: 47.9375rem) {
  .mystery-dock--split .mystery-dock-row {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    width: 100%;
    gap: 1rem;
  }

  .mystery-dock--split .mystery-panel {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
    max-width: 26rem;
  }

  .mystery-dock--split .mystery-dock-messages {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    max-width: 26rem;
    min-height: 4.5rem;
    margin-top: 0.85rem;
  }

  .mystery-dock--split .round-actions {
    text-align: center;
  }

  .mystery-dock-messages .drag-hint {
    text-align: center;
  }
}

.mystery-dock .placement-panel {
  width: 100%;
  margin-bottom: 0.75rem;
}

.round-actions {
  text-align: center;
  padding-top: 0.15rem;
}

.round-actions[hidden] {
  display: none;
}

.round-actions .btn--primary {
  min-width: 10rem;
}

.mystery-panel {
  text-align: center;
}

.mystery-panel .card--mystery {
  margin-top: 0.1rem;
  text-align: left;
  min-height: var(--mystery-card-min-height);
  padding: 1.35rem 1.45rem;
  border-width: 2px;
  box-shadow:
    0 -6px 20px rgba(0, 0, 0, 0.12),
    0 8px 24px rgba(0, 0, 0, 0.18);
  transform: translateY(-2px) scale(1.02);
  transform-origin: center bottom;
}

.mystery-panel .card--mystery.card--dragging:not(.card--drag-source-hidden) {
  animation: mystery-card-jiggle 0.32s ease-in-out infinite;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.mystery-panel .card--mystery.card--drag-source-hidden {
  opacity: 0 !important;
}

.mystery-drag-follower {
  position: fixed;
  z-index: 10000;
  margin: 0;
  pointer-events: none;
  cursor: grabbing;
  text-align: left;
  padding: 1.35rem 1.45rem;
  border-width: 2px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
  animation: mystery-card-jiggle-follower 0.32s ease-in-out infinite;
  transform-origin: center center;
}

.mystery-drag-image-stub {
  position: fixed;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0.01;
  overflow: hidden;
  pointer-events: none;
}

@keyframes mystery-card-jiggle {
  0%,
  100% {
    transform: translateY(-2px) scale(1.04) rotate(0deg);
  }
  25% {
    transform: translateY(-2px) scale(1.04) rotate(-2deg);
  }
  50% {
    transform: translateY(-2px) scale(1.04) rotate(2deg);
  }
  75% {
    transform: translateY(-2px) scale(1.04) rotate(-1deg);
  }
}

@keyframes mystery-card-jiggle-follower {
  0%,
  100% {
    transform: scale(1.02) rotate(0deg);
  }
  25% {
    transform: scale(1.02) rotate(-2.5deg);
  }
  50% {
    transform: scale(1.02) rotate(2.5deg);
  }
  75% {
    transform: scale(1.02) rotate(-1.25deg);
  }
}

body.is-dragging-mystery {
  cursor: grabbing;
}

.mystery-panel .card-title {
  font-size: 1.1rem;
}

.mystery-panel .card-description {
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.mystery-panel .card-date,
.mystery-panel .card-date span {
  font-family: var(--font-mono);
  font-weight: 400;
}

.mystery-panel .placeholder {
  padding: 1rem;
  border: 1px dashed var(--color-border);
}

/* Cards */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 1rem 1.25rem;
}

.card--mystery {
  border: 2px dashed var(--color-ink);
}

.card--draggable {
  cursor: grab;
  touch-action: none;
}

.card--draggable:active {
  cursor: grabbing;
}

.card--dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.drag-hint {
  font-size: 0.875rem;
  margin: 0 0 0.75rem;
  font-weight: 700;
}

/* Compact timeline cards — same size as drop zones */
.card--timeline.card--compact {
  flex: 0 0 var(--timeline-cell-width);
  width: var(--timeline-cell-width);
  min-width: var(--timeline-cell-width);
  max-width: var(--timeline-cell-width);
  height: var(--timeline-cell-height);
  min-height: var(--timeline-cell-height);
  max-height: var(--timeline-cell-height);
  padding: 0.4rem 0.45rem;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.card-header--compact {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.2rem;
  min-width: 0;
}

.card-header--compact .card-geo {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.card-header--compact .card-geo svg {
  width: 0.8rem;
  height: 0.8rem;
}

.card-region--compact {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1.15;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-title--compact {
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  flex: 1;
}

.card-date-compact {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  margin: 0;
  color: var(--color-ink);
  flex-shrink: 0;
}

.card--revealed-correct {
  border: 2px solid var(--color-correct);
  background: var(--color-correct-bg);
  color: var(--color-correct);
}

.card--revealed-correct .card-title--compact,
.card--revealed-correct .card-region--compact,
.card--revealed-correct .card-date-compact {
  color: inherit;
}

/* Correct placement — brief jiggle + black/white spark burst */
.timeline-slot--celebrate {
  position: relative;
  overflow: visible;
  z-index: 4;
}

.card--timeline.card--compact.card--celebrate-correct {
  overflow: visible;
}

.card--timeline.card--celebrate-correct {
  position: relative;
  overflow: visible;
  animation: correct-card-jiggle 0.65s ease-in-out;
  z-index: 5;
  will-change: transform;
}

.card--timeline.card--celebrate-correct::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #ffffff;
  opacity: 0;
  animation: correct-card-flash 0.58s ease-out;
}

@keyframes correct-card-jiggle {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  12% {
    transform: scale(1.04) rotate(-2.5deg);
  }
  28% {
    transform: scale(1.06) rotate(2.5deg);
  }
  44% {
    transform: scale(1.05) rotate(-1.5deg);
  }
  60% {
    transform: scale(1.06) rotate(1.5deg);
  }
  76% {
    transform: scale(1.02) rotate(-0.5deg);
  }
}

@keyframes correct-card-flash {
  0%,
  100% {
    opacity: 0;
  }
  18% {
    opacity: 0.85;
  }
  36% {
    opacity: 0;
  }
  48% {
    opacity: 0.35;
  }
}

.correct-spark-burst {
  position: absolute;
  inset: -0.35rem;
  pointer-events: none;
  overflow: visible;
  z-index: 2;
}

.correct-spark-burst--fixed {
  position: fixed;
  inset: auto;
  width: 1px;
  height: 1px;
  margin: 0;
  z-index: 10050;
}

.correct-spark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  margin-top: -2.5px;
  background: #000000;
  opacity: 0;
  transform: rotate(var(--spark-angle, 0deg)) translateY(0) scale(1);
  animation: correct-spark-fly 0.62s ease-out forwards;
  animation-delay: var(--spark-delay, 0s);
}

.correct-spark--light {
  background: #ffffff;
  box-shadow: 0 0 0 1px #000000;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  margin-top: -3px;
}

.correct-spark:nth-child(3n) {
  width: 3px;
  height: 8px;
  margin-left: -1.5px;
  margin-top: -4px;
  border-radius: 0;
}

.correct-spark:nth-child(3n).correct-spark--light {
  width: 3px;
  height: 8px;
  margin-left: -1.5px;
  margin-top: -4px;
}

@keyframes correct-spark-fly {
  0% {
    opacity: 1;
    transform: rotate(var(--spark-angle, 0deg)) translateY(0) scale(1);
  }
  70% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--spark-angle, 0deg)) translateY(-4.5rem) scale(0.2);
  }
}

.card--revealed-wrong {
  border: 2px solid var(--color-wrong);
  background: var(--color-wrong-bg);
  color: var(--color-wrong);
}

.card--revealed-wrong .card-title--compact,
.card--revealed-wrong .card-region--compact,
.card--revealed-wrong .card-date-compact {
  color: inherit;
}

.card--has-tooltip {
  cursor: help;
}

.card--has-tooltip:focus {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}

/* Floating tooltip for timeline cards */
.card-tooltip {
  position: fixed;
  z-index: 200;
  width: min(18rem, calc(100vw - 1.5rem));
  padding: 0.75rem 0.85rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--color-ink);
  pointer-events: none;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.22s ease,
    visibility 0.22s ease;
}

.card-tooltip[hidden] {
  display: none;
}

.card-tooltip.card-tooltip--visible {
  opacity: 1;
  visibility: visible;
}

.card-tooltip-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
}

.card-tooltip-region {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-tooltip-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  line-height: 1.25;
}

.card-tooltip-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
  color: var(--color-muted);
}

.card-tooltip-description {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  margin: 0;
  color: var(--color-muted);
  line-height: 1.4;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.card-geo {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.card-geo svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.card-geo--asia {
  color: #b45309;
  background: rgba(180, 83, 9, 0.12);
}

.card-geo--europe {
  color: #1d4ed8;
  background: rgba(29, 78, 216, 0.1);
}

.card-geo--africa {
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.1);
}

.card-geo--americas {
  color: #15803d;
  background: rgba(21, 128, 61, 0.1);
}

.card-geo--oceania {
  color: #0e7490;
  background: rgba(14, 116, 144, 0.1);
}

.card-geo--middle-east {
  color: #a16207;
  background: rgba(161, 98, 7, 0.12);
}

.card-geo--eurasia {
  color: #6d28d9;
  background: rgba(109, 40, 217, 0.1);
}

.card-geo--beringia {
  color: #475569;
  background: rgba(71, 85, 105, 0.12);
}

.card-region {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
  line-height: 1.25;
  min-width: 0;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}

.card-description {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--color-muted);
  margin: 0;
  line-height: 1.45;
}

.card-date {
  margin: 0.75rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.9rem;
  font-weight: 700;
}

.card-date--hidden {
  display: none;
}

.card-date--visible {
  display: block;
  animation: fadeIn 0.4s ease;
}

.date-label {
  font-weight: 700;
  color: var(--color-muted);
  margin-right: 0.35rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.placeholder {
  color: var(--color-muted);
  font-style: italic;
  margin: 0;
}

/* Placement — before / after reference event (in mystery dock during play) */
.placement-panel {
  text-align: center;
  padding: 0 0 0.25rem;
}

.placement-panel[hidden] {
  display: none;
}

@media (min-width: 48rem) {
  .placement-panel--mobile-only {
    display: none !important;
  }
}

.placement-panel .panel-title {
  margin-bottom: 0.4rem;
}

.placement-hint {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin: 0 0 1rem;
  max-width: 36rem;
  margin-inline: auto;
}

.placement-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: stretch;
}

.placement-choice {
  flex: 1 1 12rem;
  max-width: 20rem;
  text-align: center;
  line-height: 1.3;
  padding: 0.85rem 1rem;
}

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

.btn {
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.btn--primary {
  padding: 0.75rem 1.5rem;
  background: var(--color-ink);
  color: var(--color-bg);
  border: 1px solid var(--color-border);
  font-weight: 700;
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--color-bg);
  color: var(--color-ink);
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}

.btn--secondary {
  padding: 0.5rem 1rem;
  background: var(--color-bg);
  color: var(--color-ink);
  border: 1px solid var(--color-border);
  font-weight: 700;
}

.btn--secondary:hover,
.btn--secondary:focus-visible {
  background: var(--color-ink);
  color: var(--color-bg);
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}

.header-menu {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 110;
}

@media (min-width: 58rem) {
  .header-menu {
    left: calc(50vw - 28rem + 1rem);
  }
}

.btn-header-menu-toggle {
  font-size: 0.85rem;
}

.header-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 11rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.12);
}

.header-menu-dropdown[hidden] {
  display: none;
}

.header-menu-item {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  border: none;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.header-menu-item:last-child {
  border-bottom: none;
}

.header-menu-item:hover,
.header-menu-item:focus-visible {
  background: var(--color-ink);
  color: var(--color-bg);
  outline: none;
}

.header-menu-item[hidden] {
  display: none;
}


/* Feedback — below dock core (does not shift mystery card) */
.mystery-dock .feedback {
  flex-shrink: 0;
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  font-weight: 700;
  background: var(--color-bg);
  text-align: left;
}

.feedback[hidden] {
  display: none;
}

.feedback--correct {
  border: 2px solid var(--color-correct);
  background: var(--color-correct-bg);
  color: var(--color-correct);
}

.feedback--wrong {
  border: 2px solid var(--color-wrong);
  background: var(--color-wrong-bg);
  color: var(--color-wrong);
}

.mystery-dock-messages .feedback.dock-reveal-fade,
.mystery-dock-messages .round-actions.dock-reveal-fade {
  opacity: 0;
  animation: dockRevealFade 0.5s ease-out both;
}

@keyframes dockRevealFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Timeline — map fixed; cards scroll horizontally beneath */
.timeline-section {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 0;
}

.timeline-fixed-header {
  flex-shrink: 0;
  z-index: 2;
  background: var(--color-bg);
}

.timeline-scroll {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  margin-top: 40px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.4rem;
}

@media (max-height: 56.25rem) {
  .timeline-scroll {
    margin-top: 0.9rem;
  }

  .timeline-world-map,
  .timeline-range {
    margin-bottom: 0.4rem;
  }

  .mystery-dock {
    padding-top: 0.5rem;
    padding-bottom: 0.7rem;
  }

  .mystery-panel .card--mystery {
    padding: 0.95rem 1.05rem;
  }

  .mystery-panel .card-title {
    font-size: 0.98rem;
    margin-bottom: 0.35rem;
  }

  .mystery-panel .card-description {
    font-size: 0.84rem;
    line-height: 1.35;
  }

  .mystery-dock-messages .drag-hint {
    font-size: 0.82rem;
    line-height: 1.35;
  }
}

@media (max-height: 44rem) {
  .header {
    margin-bottom: 0.6rem;
  }

  .tagline {
    margin-bottom: 0.6rem;
    font-size: 0.88rem;
  }

  .scoreboard {
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
  }

  .score-value {
    font-size: 1.05rem;
  }
}

.timeline-track {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: 0;
  box-sizing: border-box;
  padding-bottom: 0.15rem;
}

.timeline-track--welcome {
  min-height: 11rem;
}

.timeline-welcome-map {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0;
  opacity: 0.2;
  pointer-events: none;
}

.timeline-welcome-map[hidden] {
  display: none;
}

.timeline-welcome-map-svg {
  display: block;
  width: 100%;
  max-width: 52rem;
  aspect-ratio: 360 / 155.97;
  height: auto;
  border: 1px solid var(--color-border);
  background: #fff;
}

.timeline-welcome-map-base {
  pointer-events: none;
}

.timeline-track--fits {
  align-items: center;
}

.timeline-track--fits .timeline {
  margin-inline: auto;
}

.timeline-scroll .timeline {
  flex: 0 0 auto;
  min-height: var(--timeline-cell-height);
}

/* Thin date-range reference below "Your timeline" */
.timeline-range {
  display: grid;
  grid-template-columns: minmax(3.5rem, auto) 1fr minmax(3.5rem, auto);
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.65rem;
  padding: 0.15rem 0;
  pointer-events: none;
  user-select: none;
}

.timeline-range[hidden] {
  display: none;
}

.timeline-range-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-muted);
}

.timeline-range-label:first-child {
  text-align: right;
}

.timeline-range-label:last-child {
  text-align: left;
}

.timeline-range-track {
  position: relative;
  height: 3px;
  background: #e5e5e5;
  border: 1px solid var(--color-border);
}

.timeline-range-markers {
  position: absolute;
  inset: 0;
}

.timeline-range-marker {
  position: absolute;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-left: 0;
  background: var(--color-ink);
  border: 1px solid var(--color-bg);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* World map — plate carrée (x = lon+180, y = 90−lat; full view crops south polar band) */
.timeline-world-map {
  margin: 0 0 0.65rem;
  user-select: none;
  position: relative;
}

.timeline-world-map-base,
.timeline-world-map-land {
  pointer-events: none;
}

.timeline-world-map[hidden] {
  display: none;
}

.timeline-world-map-svg {
  display: block;
  width: 100%;
  max-width: 52rem;
  aspect-ratio: 360 / 155.97;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--color-border);
  background: #ffffff;
}

.timeline-world-map-cluster {
  fill: none;
  stroke: #999999;
  stroke-width: 0.35;
  stroke-dasharray: 1.2 0.8;
  pointer-events: none;
}

.timeline-world-map-marker {
  cursor: help;
  pointer-events: auto;
}

.timeline-world-map-dot-hit {
  fill: transparent;
  stroke: none;
  pointer-events: all;
}

.timeline-world-map-dot {
  stroke: none;
  pointer-events: none;
}

.timeline-world-map-marker:hover .timeline-world-map-dot,
.timeline-world-map-marker:focus-visible .timeline-world-map-dot {
  filter: brightness(1.12);
}

.timeline-world-map-marker:focus-visible {
  outline: none;
}

.timeline-world-map-marker:focus-visible .timeline-world-map-dot-hit {
  stroke: none;
}

.map-tooltip {
  width: min(14rem, calc(100vw - 1.5rem));
  padding: 0.55rem 0.7rem;
  pointer-events: none;
}

.map-tooltip-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  line-height: 1.25;
}

.map-tooltip-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  margin: 0;
  color: var(--color-muted);
  line-height: 1.35;
}

.timeline-world-map-dot--asia {
  fill: #b45309;
}

.timeline-world-map-dot--europe {
  fill: #1d4ed8;
}

.timeline-world-map-dot--africa {
  fill: #b91c1c;
}

.timeline-world-map-dot--americas {
  fill: #15803d;
}

.timeline-world-map-dot--oceania {
  fill: #0e7490;
}

.timeline-world-map-dot--middle-east {
  fill: #a16207;
}

.timeline-world-map-dot--eurasia {
  fill: #6d28d9;
}

.timeline-world-map-dot--beringia {
  fill: #475569;
}

.timeline {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: flex-start;
  min-height: var(--timeline-cell-height);
  padding: 0.25rem 0;
}

.timeline--placing,
.timeline--center-row {
  gap: 0.35rem;
  align-items: flex-start;
  width: max-content;
  box-sizing: border-box;
}

.timeline--dragging .drop-zone:not(.drop-zone--active) {
  opacity: 0.7;
}

.timeline--dragging .drop-zone--anchor-side:not(.drop-zone--active) {
  opacity: 1;
}

.drop-zone {
  flex: 0 0 var(--timeline-cell-width);
  width: var(--timeline-cell-width);
  min-width: var(--timeline-cell-width);
  max-width: var(--timeline-cell-width);
  height: var(--timeline-cell-height);
  min-height: var(--timeline-cell-height);
  max-height: var(--timeline-cell-height);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.45rem;
  border: 1px dashed var(--color-border);
  background: var(--color-bg);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.drop-zone-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-muted);
  text-align: center;
  line-height: 1.25;
  pointer-events: none;
  user-select: none;
}

.drop-zone:hover,
.drop-zone:focus-visible {
  background: #f5f5f5;
  outline: none;
}

.drop-zone--active {
  border-style: solid;
  border-width: 2px;
  background: #f0f0f0;
}

.drop-zone--active .drop-zone-label {
  color: var(--color-ink);
  font-weight: 700;
}

/* Checkerboard outline — pairs with mystery card dashed border */
.drop-zone--anchor-side {
  position: relative;
  border: none;
  background: var(--color-bg);
  isolation: isolate;
}

.drop-zone--anchor-side::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px;
  background: repeating-conic-gradient(
      from 0deg,
      var(--color-ink) 0deg 90deg,
      var(--color-bg) 90deg 180deg
    )
    50% / 8px 8px;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 0;
}

.drop-zone--anchor-side.drop-zone--active::before {
  padding: 3px;
  background: repeating-conic-gradient(
      from 0deg,
      var(--color-ink) 0deg 90deg,
      #f0f0f0 90deg 180deg
    )
    50% / 8px 8px;
}

.drop-zone--anchor-side.drop-zone--active {
  background: #f0f0f0;
}

.drop-zone--anchor-side .drop-zone-label {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  text-transform: none;
  letter-spacing: 0.02em;
}

.timeline--placing .drop-zone--anchor-side {
  flex: 0 0 calc(var(--timeline-cell-width) * 0.72);
  width: calc(var(--timeline-cell-width) * 0.72);
  min-width: calc(var(--timeline-cell-width) * 0.72);
  max-width: calc(var(--timeline-cell-width) * 0.72);
}

.timeline-slot {
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--timeline-cell-width);
  width: var(--timeline-cell-width);
  height: var(--timeline-cell-height);
}

.timeline--placing .timeline-slot--anchor .card {
  outline: 3px solid var(--color-ink);
  outline-offset: 3px;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.14);
}

.timeline--placing .timeline-slot--context .card {
  outline: 1px dashed var(--color-ink);
  outline-offset: 2px;
}

.timeline--placing
  .timeline-slot:not(.timeline-slot--anchor):not(.timeline-slot--context)
  .card {
  opacity: 0.5;
}

.timeline--animating .timeline-slot,
.timeline--animating .timeline-arrow {
  z-index: 2;
}

.timeline--animating .timeline-slot .card--revealed-wrong {
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.12);
}

.timeline-arrow {
  font-size: 1rem;
  color: var(--color-ink);
  align-self: center;
  flex: 0 0 auto;
  user-select: none;
  padding: 0 0.15rem;
  line-height: var(--timeline-cell-height);
}

@media (prefers-reduced-motion: reduce) {
  .timeline--animating .timeline-slot,
  .timeline--animating .timeline-arrow {
    transition: none !important;
    transform: none !important;
  }

  .mystery-panel .card--mystery.card--dragging,
  .mystery-drag-follower {
    animation: none !important;
  }

  .card--celebrate-correct,
  .card--celebrate-correct::after,
  .correct-spark {
    animation: none !important;
  }

  .correct-spark-burst {
    display: none;
  }

  .dock-reveal-fade {
    animation: none !important;
  }
}

.timeline-slot .card {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
}

/* Overlay screens */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.overlay[hidden] {
  display: none;
}

.overlay-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 2rem;
  max-width: 24rem;
  text-align: center;
}

.overlay-card--wide {
  max-width: 28rem;
}

.geo-picker {
  margin: 0 0 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  text-align: left;
}

.geo-picker-title {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}

.geo-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}

.geo-picker-action {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0;
  border: none;
  background: none;
  color: var(--color-ink);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.geo-picker-action:hover,
.geo-picker-action:focus-visible {
  outline: none;
  text-decoration-thickness: 2px;
}

.geo-picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 0.75rem;
}

.geo-picker-list > li {
  min-width: 0;
}

.geo-picker-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  cursor: pointer;
  padding: 0.15rem 0.2rem;
}

.geo-picker-item:hover {
  background: #f5f5f5;
}

.geo-picker-item input {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--color-ink);
  cursor: pointer;
}

.geo-picker-item .card-geo {
  width: 1.5rem;
  height: 1.5rem;
  pointer-events: none;
}

.geo-picker-item .card-geo svg {
  width: 1rem;
  height: 1rem;
}

.geo-picker-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-ink);
  line-height: 1.2;
  min-width: 0;
}

.geo-picker-count {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--color-muted);
}

.geo-picker-status {
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--color-muted);
  text-align: center;
}

.geo-picker-status--warn {
  color: var(--color-ink);
  text-decoration: underline;
}

.btn--primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn--primary:disabled:hover,
.btn--primary:disabled:focus-visible {
  background: var(--color-ink);
  color: var(--color-bg);
  outline: none;
}

.overlay-card h2 {
  margin: 0 0 1rem;
  color: var(--color-ink);
}

.overlay-card p {
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--color-muted);
  font-size: 0.95rem;
  text-align: left;
}

.end-score {
  text-align: center;
  font-size: 1.1rem;
}

.end-score strong {
  font-size: 1.5rem;
}

@media (max-width: 22rem) {
  .geo-picker-list {
    grid-template-columns: 1fr;
  }

  :root {
    --timeline-cell-width: 9.5rem;
    --timeline-cell-height: 7.75rem;
    --mystery-dock-height: 19rem;
    --mystery-card-min-height: 9.75rem;
  }
}


@media (prefers-reduced-motion: reduce) {
  .card-date--visible {
    animation: none;
  }
}
