/* Chronology (History37) — page styles.
 *
 * Generated from extragames/Chronology.html's <style>, scoped for embedding
 * in the site shell:
 *   - every selector lives under #chron-root; the sheet used generic class
 *     names (.card, .btn, .modal, .toast, .overlay) that collide with
 *     base.css, and its own `:root { --bg; --surface; --text; ... }` block
 *     reused the SAME custom-property names as base.css's site-wide theme
 *     tokens — left alone, that :root block would have clobbered the theme
 *     for the entire page (nav bar included), not just the game. Every
 *     custom property below is renamed --chron-* and scoped to #chron-root.
 *   - the prototype's `body` rule collapsed onto #chron-root, which becomes
 *     the game's own dark surface (kept deliberately — it's the game's art
 *     direction, already reads as dark-theme against the site's own --bg).
 *   - #top-panel's sticky offset changed from `top:0` to `top:var(--nav-h)`
 *     so it docks under the site's fixed nav bar instead of behind/under it.
 *   - #main-menu's `min-height:100vh` (meant for a bare standalone page)
 *     reduced — the site already stacks a nav bar + game header above it,
 *     so 100vh here would push the mode buttons off-screen.
 */

#chron-root {
  --chron-bg: #070b12;
  --chron-surface: #131c2e;
  --chron-surface-border: #22314a;
  --chron-primary: #a78bfa;
  --chron-primary-hover: #8b5cf6;
  --chron-primary-glow: rgba(167, 139, 250, 0.15);
  --chron-text: #f8fafc;
  --chron-text-muted: #64748b;
  --chron-success: #4ade80;
  --chron-danger: #f87171;
  --chron-info: #38bdf8;
  --chron-font: 'Segoe UI', system-ui, -apple-system, sans-serif;

  font-family: var(--chron-font);
  background: var(--chron-bg);
  color: var(--chron-text);
  line-height: 1.5;
  /* `overflow-x: hidden` alone makes the spec auto-promote overflow-y to
     `auto` (the "visible" axis can't stay visible once the other axis
     isn't), which silently turns #chron-root into #top-panel's sticky
     scroll container instead of the page/viewport — sticky then measured
     its `top` offset against the wrong box and sat ~62px (exactly the nav
     bar's height) lower than it should have, permanently, not just at
     game-over. `overflow-x: clip` blocks horizontal overflow the same way
     without triggering that promotion, so overflow-y can stay `visible`
     and sticky positioning resolves against the real page again. */
  overflow-x: clip;
  overflow-y: visible;
  border-radius: var(--radius-lg);
  padding-bottom: 24px;
  position: relative;
}

#chron-root * { box-sizing: border-box; }

#chron-root #main-menu, #chron-root #top-panel {
  background: rgba(7, 11, 18, 0.96);
  backdrop-filter: blur(12px);
  text-align: center;
}

#chron-root #main-menu {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  border-radius: var(--radius-lg);
}

#chron-root .menu-title {
  font-size: 3.2rem;
  font-weight: 900;
  color: var(--chron-primary);
  letter-spacing: -2px;
  margin-bottom: 0.25rem;
  text-shadow: 0 0 40px var(--chron-primary-glow);
}

#chron-root .menu-subtitle {
  color: var(--chron-text-muted);
  margin-bottom: 2.5rem;
  font-size: 1.1rem;
  letter-spacing: 1px;
}

#chron-root #top-panel {
  position: sticky;
  top: var(--nav-h);
  border-bottom: 1px solid var(--chron-surface-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1rem 1rem 1.25rem;
  /* Was 100 — exactly tied with the site nav bar's own z-index (base.css
     .nav), so on scroll the sticky card ended up winning the tie and
     rendering over the nav instead of under it. */
  z-index: 90;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  display: none;
}

#chron-root .header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 650px;
  margin: 0 auto 0.75rem auto;
}

#chron-root h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--chron-primary);
}

#chron-root #score-display {
  background: var(--chron-surface);
  padding: 0.5rem 1.25rem;
  border-radius: 30px;
  font-weight: 800;
  border: 1px solid var(--chron-surface-border);
}

#chron-root .card {
  background: linear-gradient(135deg, var(--chron-surface) 0%, #0f1624 100%);
  border: 1px solid var(--chron-surface-border);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 650px;
  margin: 0 auto;
  position: relative;
  color: var(--chron-text);
}

/* Timeline cards with source links reserve room for the icon. */
#chron-root .card:has(.wiki-link) {
  padding-right: 4.5rem;
}

#chron-root #timeline-wrapper .card::before {
  content: '';
  position: absolute;
  left: -34px;
  top: 32px;
  width: 12px;
  height: 12px;
  background: var(--chron-primary);
  border-radius: 50%;
  border: 3px solid var(--chron-bg);
  z-index: 2;
  box-shadow: 0 0 12px var(--chron-primary);
}

#chron-root .card-year {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--chron-primary);
  line-height: 1;
}

#chron-root .card-date-spec {
  font-size: 0.85rem;
  color: var(--chron-info);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

#chron-root .card-text {
  font-size: 1.1rem;
  color: var(--chron-text);
  font-weight: 500;
}

#chron-root .card-bio-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  margin-bottom: 0.6rem;
}

#chron-root .card-bio-badge--birth {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.14);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

#chron-root .card-bio-badge--death {
  color: #f87171;
  background: rgba(248, 113, 113, 0.14);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

#chron-root .wiki-link {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 36px;
  height: 36px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.1rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

#chron-root .wiki-link:hover {
  background: var(--chron-info);
  transform: scale(1.05);
}

#chron-root .wiki-link--result {
  position: static;
  width: fit-content;
  height: auto;
  min-height: 44px;
  margin: 0.25rem auto 1rem;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  gap: 0.4rem;
  color: var(--chron-info);
  font-size: 0.95rem;
  font-weight: 800;
}

#chron-root .wiki-link--result:hover {
  color: var(--chron-bg);
}

#chron-root #active-card-container {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chron-root .active-card {
  cursor: grab;
  border: 1px solid var(--chron-primary);
  box-shadow: 0 15px 40px rgba(139, 92, 246, 0.15);
  padding-right: 1.75rem;
}

#chron-root .active-card:active { cursor: grabbing; transform: scale(0.99); }
#chron-root .drag-instruction { font-size: 0.8rem; color: var(--chron-text-muted); text-transform: uppercase; letter-spacing: 2px; }

/* Game over: no more active card to drag, so the instruction line and the
   card's reserved slot space are just dead air above the score/timeline. */
#chron-root #top-panel.game-over .drag-instruction { display: none; }
#chron-root #top-panel.game-over #active-card-container { min-height: 0; }
#chron-root #top-panel.game-over .header-content { margin-bottom: 0; }

#chron-root #timeline-wrapper {
  padding: 2.75rem 1rem 6rem 2.5rem;
  max-width: 650px;
  margin: 0 auto;
  position: relative;
  display: none;
}

#chron-root #timeline-wrapper::after {
  content: '';
  position: absolute;
  left: 15px; top: 40px; bottom: 40px; width: 2px;
  background: linear-gradient(to bottom, transparent, var(--chron-surface-border) 10%, var(--chron-surface-border) 90%, transparent);
  z-index: 1;
}

#chron-root #timeline-container { position: relative; z-index: 2; display: flex; flex-direction: column; }
#chron-root .time-label { text-align: center; font-weight: 800; color: var(--chron-text-muted); letter-spacing: 3px; text-transform: uppercase; padding: 1.5rem 0; font-size: 0.8rem; }

#chron-root .timeline-slot {
  transition: margin-top 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  position: relative;
  margin-top: 14px;
}
#chron-root .timeline-slot:first-child { margin-top: 0; }

#chron-root .drop-zone {
  width: 100%;
  min-height: var(--dz-height, 8px);
  margin: var(--dz-margin, 6px 0);
  opacity: var(--dz-opacity, 0.2);
  border: 2px dashed var(--chron-surface-border);
  background: var(--chron-bg);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--chron-text-muted);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

#chron-root .drop-zone:hover,
#chron-root body.is-dragging .drop-zone:hover {
  border-color: var(--chron-primary) !important;
  color: var(--chron-text) !important;
  background: var(--chron-primary-glow) !important;
}

#chron-root .drop-zone.hover { min-height: 64px !important; background: var(--chron-primary) !important; color: var(--chron-bg) !important; border-style: solid; }

#chron-root .drop-zone.correct-target {
  border-color: var(--chron-success) !important;
  color: var(--chron-text) !important;
  background: rgba(74, 222, 128, 0.1) !important;
  min-height: 64px !important;
  margin: 20px 0 !important;
  opacity: 1 !important;
  border-style: solid;
  position: relative;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 14px 20px;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  cursor: default;
}

#chron-root .drop-zone.correct-target:has(.wiki-link) {
  padding-right: 4.5rem;
}

#chron-root .drop-zone.placing {
  border-color: var(--chron-primary) !important;
  color: var(--chron-text) !important;
  background: var(--chron-primary-glow) !important;
  min-height: 64px !important;
  margin: 20px 0 !important;
  opacity: 1 !important;
  border-style: solid;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 14px 20px;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  cursor: default;
  animation: chron-placing-pulse 0.9s ease-in-out infinite;
}

#chron-root .drop-zone.chosen-target {
  border-color: var(--chron-danger) !important;
  color: var(--chron-danger) !important;
  background: rgba(248, 113, 113, 0.1) !important;
  min-height: 64px !important;
  margin: 20px 0 !important;
  opacity: 1 !important;
  border-style: solid;
  cursor: default;
}

#chron-root .drop-zone .target-marker__label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--chron-success);
  margin-bottom: 4px;
}

#chron-root .drop-zone.chosen-target .target-marker__label {
  color: var(--chron-danger);
  margin-bottom: 0;
}

#chron-root .drop-zone .target-marker__year {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--chron-success);
  line-height: 1.1;
}

#chron-root .drop-zone .target-marker__date {
  font-size: 0.78rem;
  color: var(--chron-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  margin-top: 2px;
}

#chron-root .drop-zone .target-marker__text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--chron-text);
  margin-top: 4px;
}

#chron-root #timeline-wrapper.game-over .timeline-slot { margin-top: 24px !important; }
#chron-root #timeline-wrapper.game-over .drop-zone:not(.correct-target):not(.chosen-target) { display: none !important; }

#chron-root #overlay {
  display: none; position: fixed; inset: 0; background: rgba(5, 7, 12, 0.85); backdrop-filter: blur(8px); z-index: 200;
  align-items: center; justify-content: center; padding: 1rem; text-align: center;
}

#chron-root .modal {
  background: var(--chron-surface); padding: 3.5rem 2.5rem; border-radius: 28px; max-width: 480px; width: 100%;
  border: 1px solid var(--chron-surface-border); box-shadow: 0 20px 50px rgba(0,0,0,0.7); color: var(--chron-text);
}
#chron-root .modal h2 { margin-bottom: 1rem; font-size: 2.2rem; font-weight: 900; }

#chron-root .btn {
  background: var(--chron-primary); color: var(--chron-bg); border: none; padding: 1.1rem 2rem; font-size: 1.1rem;
  border-radius: 14px; cursor: pointer; font-weight: 800; margin-top: 1rem; width: 100%; transition: all 0.2s;
  font-family: inherit;
}
#chron-root .btn:hover { background: #c084fc; transform: translateY(-1px); }
#chron-root .btn-secondary { background: transparent; border: 2px solid var(--chron-surface-border); color: var(--chron-text); }
#chron-root .btn-secondary:hover { border-color: var(--chron-text-muted); background: rgba(255,255,255,0.02); }

#chron-root #toast-container {
  position: fixed; top: 30px; left: 50%; transform: translateX(-50%); z-index: 300;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
#chron-root .toast {
  background: #22c55e; color: #05070c; padding: 0.8rem 1.8rem; border-radius: 30px;
  font-weight: 800; font-size: 1rem; box-shadow: 0 8px 24px rgba(34,197,94,0.3);
  opacity: 0; transform: translateY(-20px); transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#chron-root #minimap-container {
  position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%); width: 85%; max-width: 550px; height: 44px;
  background: rgba(21, 31, 50, 0.85); border: 1px solid var(--chron-surface-border); border-radius: 22px;
  display: none; align-items: center; padding: 0 20px; z-index: 90; backdrop-filter: blur(10px);
}
#chron-root #minimap-line { width: 100%; height: 4px; background: #1e293b; border-radius: 2px; position: relative; }
#chron-root .minimap-dot {
  position: absolute; width: 10px; height: 10px; background: var(--chron-primary); border-radius: 50%; top: 50%;
  transform: translate(-50%, -50%); box-shadow: 0 0 8px var(--chron-primary);
  transition: left 0.4s ease, transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

#chron-root .minimap-dot:hover {
  transform: translate(-50%, -50%) scale(1.6);
  box-shadow: 0 0 14px var(--chron-primary), 0 0 4px var(--chron-primary);
}

#chron-root .minimap-dot::after {
  content: attr(data-year);
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  background: var(--chron-surface);
  border: 1px solid var(--chron-surface-border);
  color: var(--chron-text);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

#chron-root .minimap-dot:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

#chron-root .timeline-slot.minimap-jump-highlight .card {
  animation: chron-jump-pulse 1.2s ease;
}

@keyframes chron-placing-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

@keyframes chron-jump-pulse {
  0% { box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.55); }
  30% { box-shadow: 0 0 0 12px rgba(167, 139, 250, 0); }
  100% { box-shadow: 0 0 0 0 rgba(167, 139, 250, 0); }
}

#chron-root #loading { display: none; min-height: 50vh; flex-direction: column; justify-content: center; align-items: center; gap: 2rem; padding: 2rem; text-align: center; }
#chron-root #loading-quote { font-size: 1.25rem; max-width: 520px; color: var(--chron-text); font-weight: 500; min-height: 70px; font-style: italic; }
#chron-root #loading-tip { font-size: 0.9rem; color: var(--chron-text-muted); max-width: 450px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; }
#chron-root .spinner { width: 50px; height: 50px; border: 4px solid var(--chron-surface-border); border-top-color: var(--chron-primary); border-radius: 50%; animation: chron-spin 0.8s linear infinite; }
@keyframes chron-spin { to { transform: rotate(360deg); } }

/* ── Mode tabs: Daily stays a fixed narrow width (same convention as
   Labyrinth/2048's own Daily tab) since it's a single always-available
   option; the other three share the remaining row width evenly via
   .tab-pill's own flex:1 default. ── */
#chronModeTabs #chron-nav-daily { flex: 0 0 auto; padding-left: 18px; padding-right: 18px; }

/* ── Tutorial spotlight (same pattern as Labyrinth's LabTutorial) ── */
#chronTutorialOverlay { align-items: flex-end; padding: 28px 20px; background: rgba(0,0,0,.4); backdrop-filter: none; }
#chronTutorialOverlay.chron-tut-has-target { background: transparent; }
.chron-tut-modal { max-height: 42vh; overflow-y: auto; }
.chron-tut-step-indicator { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text3); font-weight: 700; margin-bottom: 8px; }
.chron-tut-dontshow { border: none; background: none; color: var(--text3); font-size: .75rem; text-decoration: underline; cursor: pointer; font-family: inherit; padding: 4px; }
.chron-tut-dontshow:hover { color: var(--text2); }
.chron-tut-spotlight-box {
  display: none; position: fixed; z-index: 150; border-radius: 12px;
  pointer-events: none; animation: chron-tut-pulse 1.4s ease-in-out infinite;
}
.chron-tut-spotlight-box.visible { display: block; }
@keyframes chron-tut-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(167,139,250,.75), 0 0 0 9999px rgba(0,0,0,.55); }
  50%      { box-shadow: 0 0 0 6px rgba(167,139,250,1), 0 0 0 9999px rgba(0,0,0,.55); }
}

/* The minimap dots bar (#minimap-container) is position:fixed, bottom: 25px,
   height: 44px — it floats above the page rather than taking flow space, so
   the Wikipedia-attribution citation right after it in the flow could land
   directly underneath it whenever the timeline content was short. Reserve
   that same footprint (44px + 25px, plus a little clearance) so the two
   never overlap regardless of viewport height. */
#chron-citation { margin-bottom: 85px; }

/* Chronology Daily results — sort toolbar (Card/Placed/Actual order) and the
   narrower Wiki/Time/% Correct column layout. The results host renders as a
   sibling of #chron-root (js/daily-review.js inserts it right after
   #chronModeTabs), so these rules stay unscoped like #chron-citation above. */
.chron-daily-sort {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 2px 0 10px; font-size: .78rem; color: var(--text3);
}
.chron-daily-sort__btn {
  border: 1px solid var(--chron-surface-border, rgba(255,255,255,.14));
  background: rgba(255,255,255,.04); color: var(--text2);
  border-radius: 999px; padding: 4px 12px; font-size: .74rem; font-weight: 700;
  cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.chron-daily-sort__btn:hover { background: rgba(255,255,255,.08); }
.chron-daily-sort__btn.is-active {
  background: var(--chron-primary, #7c6ff7); border-color: var(--chron-primary, #7c6ff7); color: #05070c;
}
.shell-daily-run.is-chronology .shell-daily-run__columns {
  grid-template-columns: 1.1fr 0.4fr 1fr 1fr 0.75fr 0.7fr;
  gap: 4px;
}
.shell-daily-run.is-chronology .shell-daily-run__column { padding: 6px 4px; }
/* Only the short numeric-ish tiles (Wiki icon, Time, % Correct) need
   nowrap — Placement/Actual can legitimately run long ("1099–1977") and
   should still be free to wrap rather than overflow their tile. */
.shell-daily-run.is-chronology .shell-daily-run__column:nth-child(2) b,
.shell-daily-run.is-chronology .shell-daily-run__column:nth-child(5) b,
.shell-daily-run.is-chronology .shell-daily-run__column:nth-child(6) b {
  white-space: nowrap;
}
/* The fixed 6-track layout above has no room to breathe under ~560px — Wiki/
   Placement/Actual visibly collide. Fall back to the shared runColumns
   behavior (auto-fit, wraps to as many rows as it needs) there instead of
   forcing 6 cramped tracks. */
@media (max-width: 560px) {
  .shell-daily-run.is-chronology .shell-daily-run__columns {
    grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
  }
}
/* The row's own left padding, between its colored border and the badge/
   title/tiles, read as a gap before the whole row. Narrower on Chronology's
   rows specifically. */
.shell-daily-run.is-chronology { padding-left: 8px; }
.chron-daily-datefacts {
  margin: 2px 0 12px; padding: 10px 12px;
  border: 1px solid var(--chron-surface-border, rgba(255,255,255,.14));
  border-radius: 8px; background: rgba(255,255,255,.03);
  color: var(--text2); font-size: .82rem; line-height: 1.5;
}
