/* ── ITHACA FONT ── */
/* @font-face {
  font-family: 'Ithaca';
  src: url('fonts/Ithaca-LVB75.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
} */

.nunito {
  font-family: "Nunito", sans-serif;
  font-optical-sizing: auto;
  font-weight: 200;
  font-style: normal;
}

:root {
  --bg: #091a27;
  --surface: #021525;
  --surface2: #205b4390;
  --surface3: #1c3144;
  --border: rgba(255, 255, 255, 0.07);
  --border-md: rgba(255, 255, 255, 0.13);
  --border-hi: rgba(255, 255, 255, 0.22);
  --text: #e8eaf0;
  --text-muted: #cbede2;
  --text-dim: #e0fce8;
  --accent: #69B437;
  --accent-light: #91DA73;
  --accent-bg: #0E3338;
  --green: #4f9520;
  --green-bg: rgba(34, 199, 122, 0.1);
  --red: #f0566b;
  --red-bg: rgba(86, 227, 240, 0.1);
  --amber: #d6f523;
  --amber-bg: rgba(102, 245, 35, 0.1);
  --mono: 'Nunito', monospace;
  --sans: 'Nunito', sans-serif;
  --radius: 4px;
  --radius-lg: 2px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  font-size: 25px;
  line-height: 1.6;
}

/* ── LAYOUT ── */
.page {
  max-width: none;
  margin: 0;
  padding: 0 1.5rem 0;
}

/* ── FOOTER ── */
.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.site-footer img {
  height: 20px;
  opacity: 0.7;
  vertical-align: middle;
}

.site-footer p {
  font-size: 21px;
  color: var(--text-muted);
  text-align: center;
}

.site-footer a {
  color: var(--accent-light);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ── HEADER ── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

/* ── SITE NAV ── */
.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.site-nav-link {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.site-nav-link:hover {
  color: var(--text);
  background: var(--surface2);
}

.site-nav-link.active {
  color: var(--accent-light);
  background: var(--accent-bg);
}

/* ── LANGUAGE TOGGLE ── */
.lang-toggle {
  display: flex;
  margin-left: 8px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  overflow: hidden;
}

.lang-toggle-btn {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.lang-toggle-btn:hover {
  color: var(--text);
  background: var(--surface2);
}

.lang-toggle-btn.active {
  color: var(--accent-light);
  background: var(--accent-bg);
}

/* ── KO-FI NAV BUTTON ── */
.kofi-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-bg);
  background: var(--accent);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: var(--radius);
  margin-left: 8px;
  white-space: nowrap;
  transition: background 0.15s;
}

.kofi-nav-btn:hover {
  background: var(--accent-light);
}

/* ── SIDEBAR DATE ROW ── */
.dock-meta-row {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dock-meta-row .pill {
  font-size: 14px;
}

.logo-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
}

.logo-sub {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  margin-top: -8px;
}

.logo {
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--accent-light);
}

.header-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pill {
  font-size: 18px;
  font-family: var(--mono);
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid var(--border-md);
  color: var(--text-muted);
  background: var(--surface);
}

.pill.accent {
  color: var(--accent-light);
  border-color: var(--accent);
  background: var(--accent-bg);
}

/* ── HOW TO PLAY (compact pill, lives in dock-meta-row) ── */
.how-bar {
  /* display: inline-flex; */
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-family: var(--mono);
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--amber);
  color: var(--amber);
  background: var(--amber-bg);
  margin-left: auto;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  margin-top: 1rem;
  width: 100%;
}

.how-bar:hover {
  background: var(--amber);
  color: #1a1209;
}

.how-bar .how-icon {
  font-size: 14px;
  line-height: 1;
}

.how-bar>p {
  text-align: center;
}

/* Modal overlay */
.how-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.how-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.how-modal {
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  max-width: 480px;
  width: 100%;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.22s ease;
  position: relative;
}

.how-overlay.open .how-modal {
  transform: translateY(0) scale(1);
}

.how-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.how-modal-title {
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.4px;
}

.how-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 31px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.1s, background 0.1s;
}

.how-close:hover {
  color: var(--text);
  background: var(--surface2);
}

.how-modal ol {
  padding-left: 1.2rem;
  font-size: 1rem;
  color: var(--text-dim);
  line-height: 1.8;
}

.how-modal li {
  margin-bottom: 6px;
}

.how-modal strong {
  color: var(--text);
}

/* ── STATS ROW ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: center;
}

.stat-val {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

.stat-lbl {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ── GAME POOL ── */
.section-label {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-family: var(--mono);
}

/* pool-area replaced by bottom dock */
/* pool-card and pc-cover defined in BOTTOM DOCK section below */
.pc-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pc-cover-icon {
  font-size: 45px;
  opacity: 0.25;
}

.pc-body {
  padding: 5px 7px 7px;
}

.pool-card .pc-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 28px;
}

.pc-platform {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.pool-card .pc-check {
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 18px;
  color: var(--green);
  background: rgba(0, 0, 0, 0.65);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

.pool-card.placed .pc-check {
  display: flex;
}

/* Timeline thumbnail */
.tl-thumb {
  width: 40px;
  /* was 36px */
  height: 53px;
  /* was 36px — matches 3:4 ratio */
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
}

.tl-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tl-thumb-icon {
  font-size: 28px;
  opacity: 0.25;
}

/* ── TIMELINE SECTIONS ── */
.tl-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom: none;
}

.tl-section-header.complete {
  background: rgba(34, 199, 122, 0.12);
  border-color: var(--green);
}

.tl-section-label {
  font-size: 18px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  font-weight: 700;
}

.tl-section-header.complete .tl-section-label {
  color: var(--green);
}

.tl-section-badge {
  font-size: 18px;
  font-family: var(--mono);
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid var(--green);
  border-radius: 20px;
  padding: 2px 10px;
}

.tl-section-progress {
  font-size: 18px;
  font-family: var(--mono);
  color: var(--text-muted);
}

.tl-section-status {
  font-size: 18px;
  font-family: var(--mono);
  border-radius: 20px;
  padding: 2px 10px;
}

.tl-section-status.wrong {
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid var(--red);
}

.tl-section-status.perfect {
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid var(--green);
}

.tl-section-status.incomplete {
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
}

.tl-section-wrap {
  position: relative;
}

.tl-section-divider {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

/* ── TIMELINE ── */
.timeline-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.timeline-track {
  position: relative;
}

.tl-spine {
  position: absolute;
  left: 50px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--surface3);
  border-radius: 2px;
}

.tl-items {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

/* Slot between items */
.tl-gap {
  display: flex;
  align-items: center;
  height: 44px;
  position: relative;
}

.tl-gap-line {
  position: absolute;
  left: 50px;
  width: 2px;
  height: 100%;
  background: var(--surface3);
}

.tl-drop-zone {
  margin-left: 66px;
  flex: 1;
  height: 36px;
  border-radius: 4px;
  transition: height 0.12s, background 0.12s, border-color 0.12s, box-shadow 0.12s;
  border: 2px dashed var(--border-md);
  background: var(--surface2);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tl-drop-zone::after {
  content: '+ Drop here';
  font-size: 17px;
  font-family: var(--mono);
  color: var(--text-muted);
  letter-spacing: 0.5px;
  pointer-events: none;
  opacity: 0.6;
}

.tl-drop-zone.drag-over {
  height: 100px;
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  z-index: 1000;
}

.tl-drop-zone.drag-over::after {
  color: var(--accent-light);
  opacity: 1;
}

.tl-section-wrap.complete .tl-drop-zone {
  display: none;
}

.tl-section-wrap.complete .tl-gap {
  height: 8px;
}

/* Placed item row */
.tl-item {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}

.tl-year-col {
  width: 50px;
  text-align: right;
  padding-right: 12px;
  font-family: var(--mono);
  font-size: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.tl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface3);
  border: 2px solid var(--border-md);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  margin-right: 8px;
  margin-left: -4px;
}

.tl-dot.anchor {
  background: var(--accent);
  border-color: var(--accent-light);
}

.tl-dot.correct {
  background: var(--green);
  border-color: var(--green);
}

.tl-dot.wrong {
  background: var(--red);
  border-color: var(--red);
}

.tl-card {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  transition: border-color 0.15s;
  cursor: default;
}

.tl-card.removable {
  cursor: grab;
}

.tl-card.removable:active {
  cursor: grabbing;
}

.tl-card.removable:hover {
  border-color: var(--border-hi);
}

.tl-card.dragging {
  opacity: 0.35;
}

.tl-card.correct {
  border-color: var(--green);
  background: var(--green-bg);
}

.tl-card.wrong {
  border-color: var(--red);
  background: var(--red-bg);
}

.tl-card.anchor-card {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.tl-card-left {
  min-width: 0;
}

.tl-card-title {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1.1rem;
}

.tl-card-platform {
  color: var(--text-muted);
  font-size: 0.825rem; /* same ratio to tl-card-title (1.1rem) as pc-platform is to pc-title */
  margin-top: 2px;
}

.tl-card-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tl-card-year {
  font-family: var(--mono);
  font-size: 1rem;
}

.tl-card-year.hidden {
  visibility: hidden;
}

.tl-card-year.green {
  color: var(--green);
}

.tl-card-year.red {
  color: var(--red);
}

.tl-card-year.amber {
  color: var(--amber);
}

.remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  /* font-size: 25px; */
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.1s, background 0.1s;
}

.remove-btn:hover {
  color: var(--red);
  background: var(--red-bg);
}

.tl-status-icon {
  font-size: 25px;
}

/* ── EMPTY SLOT PLACEHOLDER ── */
.tl-empty {
  display: flex;
  align-items: center;
  gap: 0;
  opacity: 0.4;
}

/* ── ACTIONS ── */
.actions-row {
  display: flex;
  gap: 10px;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

/* ── TIMELINE LAYOUT ── */
.timeline-layout {
  margin-bottom: 1.75rem;
}

.timeline-area {
  margin-bottom: 1rem;
}

.timeline-actions-panel {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.timeline-actions-panel .btn {
  flex: 1;
  text-align: center;
}

.btn {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border-md);
  cursor: pointer;
  transition: all 0.12s;
  background: var(--surface2);
  color: var(--text);
}

.btn:hover {
  background: var(--surface3);
  border-color: var(--border-hi);
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  color: #0d0f14;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  font-size: 1rem;
  padding: 6px 14px;
}

.btn-ghost {
  background: transparent;
}

/* ── TOAST POPUP ── */
.msg-box {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 2000;
  border-radius: var(--radius);
  padding: 12px 20px;
  /* font-size: 23px; */
  line-height: 1.6;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: calc(100vw - 2rem);
  white-space: normal;
  text-align: center;
}

.msg-box.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.msg-box.success {
  background: var(--green-bg);
  border: 1px solid var(--green);
  color: var(--green);
}

.msg-box.error {
  background: var(--red-bg);
  border: 1px solid var(--red);
  color: var(--red);
}

.msg-box.info {
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  color: var(--accent-light);
}

.msg-box.warning {
  background: var(--amber-bg);
  border: 1px solid var(--amber);
  color: var(--amber);
}

.msg-box strong {
  font-weight: 600;
}

/* ── END SCREEN ── */
#end-screen {
  display: none;
}

.end-card {
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
}

.end-emoji {
  font-size: 83px;
  margin-bottom: 12px;
}

.end-score {
  font-family: var(--mono);
  font-size: 90px;
  font-weight: 700;
  color: var(--text);
}

.end-score-sub {
  font-size: 24px;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.end-breakdown {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.end-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 23px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}

.end-row:last-child {
  border-bottom: none;
}

.end-row .er-title {
  color: var(--text-dim);
}

.end-row .er-year {
  font-family: var(--mono);
  font-size: 21px;
}

.end-row .er-status {
  font-size: 23px;
}

.share-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.copy-confirm {
  font-size: 21px;
  color: var(--green);
  margin-top: 8px;
  min-height: 18px;
}

/* ── PROGRESS BAR ── */
.progress-bar-wrap {
  background: var(--surface3);
  border-radius: 20px;
  height: 4px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 20px;
  transition: width 0.3s ease;
}

/* ── DRAG FEEDBACK ── */
.dragging {
  opacity: 0.5;
}

.drag-over .tl-insert-btn {
  border-color: var(--accent);
  color: var(--accent-light);
  background: var(--accent-bg);
}

/* ── BOTTOM DOCK ── */
body.has-sidebar {
  padding-bottom: 240px;
  /* reserve space so content isn't hidden behind dock */
}

.bottom-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  border-top: 1px solid var(--border-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.45);
  padding: 10px 0 12px;
}

.dock-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1rem;
  background-color: var(--bg);
}

.dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dock-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-family: var(--mono);
}

.dock-count {
  font-size: 17px;
  font-family: var(--mono);
  color: var(--accent-light);
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 1rem;
}

.dock-scroll-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;

}

.dock-arrow {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border-md);
  color: var(--text-muted);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  z-index: 2;
  position: absolute;
}

.dock-arrow:active {
  background: var(--accent-bg);
  color: var(--accent-light);
}

.dock-arrow.hidden {
  opacity: 0;
  pointer-events: none;
}

.dock-scroll {

  flex: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 10px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: none;
  scrollbar-color: var(--accent) var(--surface2);
}

.dock-scroll::-webkit-scrollbar {
  height: 6px;
}

.dock-scroll::-webkit-scrollbar-track {
  background: var(--surface2);
  border-radius: 999px;
  display: none;
}

.dock-scroll::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 999px;
  display: none;
}

.dock-scroll::-webkit-scrollbar-button {
  display: none;
}

/* Pool cards in dock — slightly smaller than original */
.pool-card {
  background: var(--surface2);
  border: 1px solid var(--border-md);
  border-radius: 10px;
  cursor: grab;
  transition: border-color 0.12s, transform 0.15s;
  user-select: none;
  position: relative;
  overflow: hidden;
  width: 88px;
  flex-shrink: 0;
}

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

.pool-card:hover {
  border-color: var(--border-hi);
  transform: translateY(-2px);
}

.pool-card.placed {
  opacity: 0.28;
  cursor: default;
  pointer-events: none;
}

.pool-card.dragging {
  opacity: 0.35;
  cursor: grabbing;
}

.pc-cover {
  width: 100%;
  height: 110px;
  background: var(--surface3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-actions-panel.mobile {
  display: none;
}

/* ── MOBILE ── */
@media (max-width: 560px) {
  .stats-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .stat-val {
    font-size: 31px;
  }

  .site-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .actions-row {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .end-card {
    padding: 1.25rem;
  }

  body.has-sidebar {
    padding-bottom: 230px;
  }

  body.has-sidebar .site-footer {
    margin-bottom: 300px;
  }

  .pool-card {
    width: 91px;
  }

  .pc-cover {
    height: 91px;
  }

  /* ── COMPACT MOBILE BOTTOM DOCK ── */
  .bottom-dock {
    padding: 6px 0 8px;
  }

  .dock-meta-row {
    margin-bottom: 6px;
    gap: 4px;
  }

  .dock-meta-row .pill {
    font-size: 11px;
    padding: 2px 7px;
  }

  .dock-header {
    margin-bottom: 4px;
  }

  .dock-label {
    font-size: 11px;
  }

  .dock-count {
    font-size: 11px;
    padding: 1px 6px;
  }

  .how-bar {
    padding: 3px 8px;
    font-size: 11px;
    gap: 3px;
    margin-top: 1rem;
    text-align: center;
  }

  .how-bar .how-icon {
    font-size: 11px;
  }

  .dock-arrow {
    width: 26px;
    height: 26px;
    font-size: 18px;
  }

  .dock-scroll {
    padding-bottom: 6px;
    gap: 6px;
  }

  .pc-body {
    padding: 4px 6px 6px;
  }

  .pool-card .pc-title {
    font-size: 15px;
    line-height: 1.15;
    min-height: 0;
    -webkit-line-clamp: 1;
  }

  .pool-card .pc-check {
    width: 21px;
    height: 21px;
    font-size: 20px;
  }

  /* ── MOBILE VERTICAL TIMELINE CARDS ── */
  .tl-card {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    overflow: hidden;
  }

  .tl-card-left {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    flex: 1 !important;
  }

  .tl-thumb {
    width: 18.75%;
    /* was 37.5% — cut by another 50% per user request (still too much vertical space on mobile) */
    height: auto;
    aspect-ratio: 3 / 4;
    border-radius: 6px;
    margin: 0 auto;
    flex-shrink: 0;
  }

  .tl-thumb img {
    object-fit: cover;
  }

  .tl-card-title {
    white-space: normal;
    text-align: center;
    padding: 2px 5px;
    font-size: 13.5px;
    /* was 9px — bumped 50% per user request now that the smaller thumb size feels right */
    line-height: 1.2;
  }

  .tl-card-year {
    display: none;
  }

  .tl-card-right {
    width: 100%;
    padding: 0 6px 4px;
    justify-content: space-between;
  }

  .logo {
    font-size: 1rem;
  }

  .logo-wrap {
    align-items: flex-start;
  }

  .logo-sub {
    font-size: .25rem;
  }

  .site-nav-link.active {
    padding: .1rem .3rem;
  }

  .site-nav-link {
    font-size: .8rem;
  }

  .kofi-nav-btn {
    font-size: .75rem;
    padding: .2rem .5rem;
    margin-left: 0;
  }

  .lang-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
  }

  .lang-toggle-btn {
    font-size: .5rem;
    padding: .1rem .2rem;
  }

  .site-header {
    padding: 1rem 0 .5rem 0;
    margin-bottom: .5rem;
  }

  .stat-card {
    padding: .2rem;
  }

  .stat-val {
    font-size: 1.2rem;
    margin: 0;
  }

  .stat-lbl {
    font-size: .6rem;
    line-height: 1;
    margin: 0;
    text-transform: uppercase;
  }

  .stats-row,
  .progress-bar-wrap {
    margin-bottom: .3rem;
  }

  .timeline-area {
    padding: .3rem;
  }

  .timeline-area .section-label {
    font-size: .6rem;
    letter-spacing: 0;
    text-align: center;
    margin-bottom: .3rem !important;
  }

  .tl-year-col {
    position: absolute;
    top: .3rem;
    right: .3rem;
    font-size: 1rem;
    background-color: var(--bg);
    padding: .1rem .3rem;
    border-radius: 4px;
    border: 1px solid;
    border-color: #91DA73;
  }

  .tl-dot.anchor,
  .tl-spine,
  .tl-gap-line {
    display: none;
  }

  .tl-drop-zone {
    margin: 0;
  }

  .page {
    padding: 0 1rem;
  }

  .timeline-actions-panel {
    /* position: fixed;
    bottom: .6rem;
    left: 1rem;
    z-index: 999999999;
    opacity: 100;
    width: calc(100% - 2rem); */
    display: none;
  }

  .how-bar {
    position: absolute;
    top: 0;
    left: 35%;
    width: 8rem;
    margin-top: .5rem;
    padding: .1rem;
  }

  .dock-inner {
    height: fit-content;
  }

  .timeline-actions-panel.mobile {
    display: flex;
  }

  .dock-count,
  .dock-header {
    display: inline-block;
  }

  .dock-count {
    margin: 0;
    margin-left: 0rem;
    width: fit-content;
  }

  .dock-header {
    padding: 0 !important;
    margin: 0;
  }

  .bottom-dock {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
  }

  .dock-inner{
    padding: 1rem;
  }

  #dock-arrow-right{
    right: 0;
    width: 30px;
    height: 30px;
  }

}



/* ── DESKTOP LEFT SIDEBAR DOCK ── */
@media (min-width: 561px) {
  body.has-sidebar {
    padding-bottom: 0;
    padding-left: 310px;
  }

  .bottom-dock {
    top: 0;
    right: auto;
    width: 310px;
    border-top: none;
    border-right: 1px solid var(--border-md);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    padding: 14px 0;
    display: flex;
    flex-direction: column;
  }

  .dock-inner {
    max-width: none;
    margin: 0;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
  }

  .dock-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 10px;
  }

  .dock-label {
    white-space: normal;
    line-height: 1.3;
  }

  .dock-scroll-wrap {
    flex-direction: column;
    align-items: stretch;
    flex: 1;
    overflow: hidden;
    gap: 4px;
  }

  .dock-scroll {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 0;
    flex: 1;
  }

  .dock-scroll::-webkit-scrollbar {
    width: 4px;
    height: auto;
  }

  #pool-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .pool-card {
    width: auto;
  }

  /* Cards bigger */
  .pc-cover {
    height: 170px;
  }

  .pc-body {
    padding: 7px 9px 9px;
  }

  /* Fonts 20% bigger */
  .dock-label {
    font-size: 1rem;
  }

  .dock-count {
    font-size: 1rem;
    align-self: right !important;
    text-align: center;
  }

  .pool-card .pc-title {
    font-size: 1rem;
    min-height: 34px;
  }

  .pool-card .pc-check {
    font-size: 23px;
    width: 21px;
    height: 21px;
  }

  .pc-cover-icon {
    font-size: 53px;
  }

  #dock-arrow-left {
    font-size: 0;
    position: absolute;
    top: 10px;
    right: calc(50% - 14px);
  }

  #dock-arrow-left::after {
    font-size: 32px;
  }

  #dock-arrow-right {
    font-size: 0;
    position: absolute;
    bottom: 10px;
    right: calc(50% - 14px);
  }

  #dock-arrow-right::after {
    font-size: 32px;

  }

  /* Timeline 80/20 split */
  .timeline-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
  }

  .timeline-area {
    flex: 4;
    min-width: 0;
    margin-bottom: 0;
  }

  .timeline-actions-panel {
    flex: 1;
    flex-direction: column;
    flex-wrap: nowrap;
    position: sticky;
    top: 1rem;
    gap: 12px;
  }

  .timeline-actions-panel .btn {
    width: 100%;
    flex: none;
  }

  #howto {
    text-align: center !important;
  }

  .timeline-actions-panel.mobile {
  display: none;
}
}

/* ── GAME INFO POPUP ── */
.game-popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.game-popup-overlay.open {
  display: flex;
}

.game-popup {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 220px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  animation: popup-in 0.18s ease;
}

@keyframes popup-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

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

.game-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  color: #fff;
  font-size: 23px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.12s;
}

.game-popup-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.game-popup-cover {
  width: 100%;
  height: 293px;
  /* 220px wide × 4/3 ratio ≈ portrait game cover */
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 83px;
  opacity: 0.4;
}

.game-popup-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.game-popup-title {
  padding: 14px 16px 4px;
  font-size: 25px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  text-align: center;
}

.game-popup-platform {
  padding: 0 16px 18px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── SCANLINE OVERLAY ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.03) 2px,
      rgba(0, 0, 0, 0.03) 4px);
}

/* ── PREVIOUS CHALLENGES (HISTORY) VIEW ──
   Ported from the old standalone history.html (which used to be the real
   page before it was folded into index.html?view=history, but the CSS
   never made the move — history-view was rendering fully unstyled until
   this was noticed while adding the Rank 'Em tab). */
.history-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.history-hero {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.history-hero-title {
  font-family: var(--mono);
  font-size: clamp(36px, 6.5vw, 55px);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.history-hero-title span { color: var(--accent-light); }

.history-hero-sub {
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1.6;
}

/* Tab switcher (Daily Challenge / Rank 'Em) — same pattern as .lang-toggle */
.history-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.history-tab-btn {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.history-tab-btn:hover {
  color: var(--text);
  background: var(--surface2);
}

.history-tab-btn.active {
  color: var(--accent-light);
  background: var(--accent-bg);
  border-color: var(--accent);
}

/* Summary bar */
.history-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.hs-card {
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  text-align: center;
  min-width: 80px;
  flex: 1;
}

.hs-val {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.hs-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 2px;
  font-family: var(--mono);
}

/* Entry list */
.history-list { display: flex; flex-direction: column; gap: 10px; }

.history-entry {
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s;
}

.history-entry.unplayed { opacity: 0.75; }
.history-entry.unplayed:hover { opacity: 1; border-color: var(--accent); }
.history-entry.played:hover { border-color: var(--accent); }

.he-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0.85rem 1.25rem;
  text-decoration: none;
  color: inherit;
}

.he-header.expandable { cursor: pointer; user-select: none; }

.he-emoji { font-size: 22px; flex-shrink: 0; line-height: 1; }

.he-info { flex: 1; min-width: 0; }

.he-date {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.he-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.he-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.he-stars { font-size: 18px; letter-spacing: 2px; }

.he-play-btn {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-light);
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 4px 10px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.he-play-btn:hover { background: var(--accent); color: #fff; }

.he-chevron { font-size: 14px; color: var(--text-muted); transition: transform 0.2s; }
.he-header.open .he-chevron { transform: rotate(90deg); }

.he-today-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  padding: 2px 6px;
  vertical-align: middle;
  margin-left: 6px;
}

/* Breakdown */
.he-body { display: none; border-top: 1px solid var(--border); padding: 1rem 1.25rem; }
.he-body.open { display: block; }

.he-section { margin-bottom: 1rem; }
.he-section:last-child { margin-bottom: 0; }
.he-section-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.he-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.he-row:last-child { border-bottom: none; }

.he-row-title {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.he-row-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.he-row-year { font-family: var(--mono); font-size: 13px; color: var(--text-muted); }
.he-row-icon { font-size: 13px; }
.he-row.anchor .he-row-title { color: var(--text); font-weight: 600; }
.he-row.anchor .he-row-year { color: var(--amber); }
.he-row.correct .he-row-icon { color: var(--green); }
.he-row.wrong .he-row-icon { color: var(--red); }