*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #3b6fcd;
  --blue-dark: #2952a3;
  --blue-light: #dce9ff;
  --blue-bg: #f0f4ff;
  --green: #1e8e3e;
  --green-light: #e6f4ea;
  --gold: #f59e0b;
  --gold-light: #fef3c7;
  --red: #d32f2f;
  --white: #fff;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #eee;
  --gray-300: #e0e0e0;
  --gray-400: #bdbdbd;
  --gray-500: #9e9e9e;
  --gray-600: #757575;
  --gray-800: #424242;
  --gray-900: #212121;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.12);
  --shadow: 0 2px 8px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.15);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body { font-family: var(--font); background: #eef2f7; color: var(--gray-900); min-height: 100vh; line-height: 1.5; }
#app { min-height: 100vh; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border: none; border-radius: var(--radius-sm); font-size: .95rem; font-weight: 600; cursor: pointer; transition: all .15s ease; text-decoration: none; white-space: nowrap; font-family: var(--font); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,111,205,.35); }
.btn-secondary { background: #fff; color: var(--blue); border: 2px solid var(--blue); }
.btn-secondary:hover:not(:disabled) { background: var(--blue-light); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.08); }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-200); }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; border-radius: var(--radius); }
.btn-sm { padding: 6px 14px; font-size: .85rem; }

/* Inputs */
.input { width: 100%; padding: 10px 14px; border: 2px solid var(--gray-300); border-radius: var(--radius-sm); font-size: .95rem; font-family: var(--font); transition: border-color .15s; background: #fff; color: var(--gray-900); outline: none; }
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,111,205,.15); }

/* Card */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.badge-host { background: var(--blue-light); color: var(--blue-dark); }
.badge-winner { background: var(--gold-light); color: #92400e; }
.badge-finished { background: var(--green-light); color: var(--green); }

/* Avatar */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--gray-200); }

/* Player card */
.player-card { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--gray-50); border-radius: var(--radius-sm); border: 1px solid var(--gray-200); transition: background .2s; }
.player-card.is-you { border-color: var(--blue); background: var(--blue-bg); }
.player-name { font-weight: 600; font-size: .95rem; }
.player-info { flex: 1; min-width: 0; }

/* Loading */
.loading-overlay { position: absolute; inset: 0; background: rgba(255,255,255,.88); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; z-index: 100; backdrop-filter: blur(2px); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--gray-200); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
#toast-container { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 12px 20px; background: var(--gray-900); color: #fff; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 500; box-shadow: var(--shadow-lg); animation: toast-in .3s ease, toast-out .3s ease 2.7s forwards; pointer-events: none; }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toast-out { to { opacity: 0; } }

/* ── SETUP SCREEN ── */
.setup-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.setup-card { max-width: 660px; width: 100%; }
.setup-card h1 { color: var(--blue-dark); margin-bottom: 6px; font-size: 1.6rem; }
.setup-card > p { color: var(--gray-600); margin-bottom: 24px; }
.step { display: flex; gap: 14px; margin-bottom: 18px; align-items: flex-start; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; margin-top: 2px; }
.step > div { line-height: 1.6; }
.code-block { background: #1e2433; color: #7dd3fc; padding: 14px 16px; border-radius: var(--radius-sm); font-family: 'Courier New', monospace; font-size: .82rem; overflow-x: auto; white-space: pre; margin: 10px 0; }

/* ── HOME SCREEN ── */
.home-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(150deg, #0f2244 0%, #1a3c7a 45%, #3b6fcd 100%); }
.home-container { max-width: 440px; width: 100%; }
.home-logo { text-align: center; margin-bottom: 32px; color: #fff; }
.home-logo h1 { font-size: 3.8rem; font-weight: 900; letter-spacing: -2px; text-shadow: 0 2px 16px rgba(0,0,0,.4); }
.home-logo .subtitle { font-size: 1rem; opacity: .8; margin-top: 6px; }
.avatar-section { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.avatar-section-info { flex: 1; }
.avatar-btn { position: relative; width: 72px; height: 72px; flex-shrink: 0; cursor: pointer; background: none; border: none; padding: 0; }
.avatar-btn img { width: 72px; height: 72px; border-radius: 50%; border: 3px solid var(--blue-light); display: block; object-fit: cover; }
.avatar-btn-badge { position: absolute; bottom: 2px; right: 2px; width: 20px; height: 20px; background: var(--blue); border-radius: 50%; border: 2px solid #fff; display: flex; align-items: center; justify-content: center; font-size: .65rem; color: #fff; pointer-events: none; }
.avatar-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.avatar-modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 20px; width: 100%; max-width: 380px; max-height: 90vh; overflow-y: auto; }
.avatar-modal h3 { font-size: 1rem; font-weight: 700; margin-bottom: 14px; text-align: center; }
.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.avatar-grid-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 2px solid var(--gray-200); border-radius: var(--radius-sm); background: #fff; cursor: pointer; transition: all .12s; }
.avatar-grid-item:hover { border-color: var(--blue); background: var(--blue-bg); }
.avatar-grid-item.selected { border-color: var(--blue); background: var(--blue-light); box-shadow: 0 0 0 2px var(--blue); }
.avatar-grid-item img { border-radius: 50%; width: 56px; height: 56px; object-fit: cover; }
.avatar-grid-item span { font-size: .65rem; font-weight: 600; color: var(--gray-700); text-align: center; line-height: 1.2; }
.field-label { display: block; font-size: .78rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.shuffle-btn { margin-top: 8px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--gray-400); font-size: .85rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }
.join-row { display: flex; gap: 8px; }
.join-row .input { text-transform: uppercase; letter-spacing: 3px; font-weight: 700; }

/* ── LOBBY SCREEN ── */
.lobby-screen { min-height: 100vh; background: #eef2f7; padding: 20px; display: flex; justify-content: center; }
.lobby-container { max-width: 600px; width: 100%; padding-top: 20px; }
.lobby-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.lobby-header h2 { font-size: 1.4rem; }
.room-code-box { display: flex; align-items: center; justify-content: space-between; background: var(--blue-bg); border: 2px solid var(--blue-light); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; gap: 12px; }
.room-code-label { font-size: .78rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin-bottom: 4px; }
.room-code-value { font-size: 2.4rem; font-weight: 900; letter-spacing: 7px; color: var(--blue); font-family: 'Courier New', monospace; line-height: 1; }
.section-title { font-size: .8rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.players-list { display: flex; flex-direction: column; gap: 8px; }
.pair-select { width: 100%; padding: 9px 12px; border: 2px solid var(--gray-300); border-radius: var(--radius-sm); font-size: .9rem; background: #fff; cursor: pointer; font-family: var(--font); }
.pair-select:focus { outline: none; border-color: var(--blue); }
.article-display { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-sm); margin-bottom: 10px; }
.article-col { flex: 1; min-width: 0; }
.article-name { font-weight: 700; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.article-arrow { font-size: 1.4rem; flex-shrink: 0; color: var(--gray-400); }
.custom-inputs { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.custom-inputs .input { font-size: .85rem; }

/* ── GAME SCREEN ── */
.game-screen { display: flex; flex-direction: column; height: 100vh; overflow: hidden; background: #fff; }
.game-header { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--blue); color: #fff; flex-shrink: 0; min-height: 54px; }
.game-articles { flex: 1; display: flex; align-items: center; gap: 8px; font-size: .88rem; overflow: hidden; min-width: 0; }
.game-article-pill { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.game-article-target { color: #fef08a; }
.game-arrow { opacity: .6; flex-shrink: 0; }
.game-stats { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.game-stat { text-align: center; line-height: 1.2; }
.game-stat-lbl { font-size: .62rem; opacity: .7; text-transform: uppercase; letter-spacing: .05em; }
.game-stat-val { font-size: 1.05rem; font-weight: 700; }
.game-body { display: flex; flex: 1; overflow: hidden; }
.game-sidebar { width: 210px; border-right: 1px solid var(--gray-200); overflow-y: auto; flex-shrink: 0; background: var(--gray-50); padding: 10px; }
.game-sidebar-title { font-size: .72rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.game-main { flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.game-breadcrumb { padding: 6px 12px; background: var(--gray-100); border-bottom: 1px solid var(--gray-200); font-size: .78rem; color: var(--gray-600); display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.game-breadcrumb strong { color: var(--gray-900); }
.wiki-content { flex: 1; overflow-y: auto; padding: 16px 20px; font-family: -apple-system,'Linux Libertine',Georgia,serif; font-size: 14px; line-height: 1.65; color: #202122; }
.wiki-content a { color: #3366cc; }
.wiki-content h1 { font-family:'Linux Libertine',Georgia,serif; font-size: 1.9em; font-weight: normal; border-bottom: 1px solid #a2a9b1; padding-bottom: 4px; margin: 6px 0 14px; }
.wiki-content h2 { font-family:'Linux Libertine',Georgia,serif; font-size: 1.5em; font-weight: normal; border-bottom: 1px solid #a2a9b1; margin: 20px 0 8px; }
.wiki-content h3 { font-size: 1.15em; margin: 14px 0 5px; }
.wiki-content h4 { font-size: 1em; margin: 10px 0 4px; }
.wiki-content p { margin: .5em 0; }
.wiki-content ul, .wiki-content ol { margin: .5em 0 .5em 2em; }
.wiki-content li { margin: 2px 0; }
.wiki-content table { border-collapse: collapse; margin: 10px 0; font-size: .9em; max-width: 100%; }
.wiki-content table.wikitable th, .wiki-content table.wikitable td { border: 1px solid #a2a9b1; padding: 5px 10px; vertical-align: top; }
.wiki-content table.wikitable th { background: #eaecf0; font-weight: bold; }
.wiki-content .infobox, .wiki-content table.infobox { float: right; clear: right; margin: 0 0 16px 24px; border: 1px solid #a2a9b1; font-size: .88em; max-width: 270px; background: #f8f9fa; }
.wiki-content .infobox td, .wiki-content .infobox th, .wiki-content table.infobox td, .wiki-content table.infobox th { padding: 3px 8px; vertical-align: top; border: 1px solid #a2a9b1; }
.wiki-content .infobox-above, .wiki-content .infobox-title { background: #cee0f2; text-align: center; font-weight: bold; padding: 6px; }
.wiki-content .thumb { max-width: 250px; margin: 0 0 16px 16px; float: right; }
.wiki-content .thumbinner { border: 1px solid #a2a9b1; background: #f8f9fa; padding: 3px; }
.wiki-content .thumbcaption { font-size: .8em; padding: 3px; }
.wiki-content img { max-width: 100%; height: auto; }
.wiki-content .mw-editsection { display: none !important; }
.wiki-content .navbox, .wiki-content .navbox-inner, .wiki-content .vertical-navbox, .wiki-content .mw-authority-control { display: none !important; }
.wiki-content .reflist, .wiki-content .references, .wiki-content .refbegin { display: none !important; }
.wiki-content .hatnote { background: #f4f4f4; border-left: 3px solid #a2a9b1; padding: 6px 10px; margin: 8px 0; font-style: italic; font-size: .9em; color: #555; }
/* Hide all native Wikipedia TOC variants */
.wiki-content #toc, .wiki-content .toc, .wiki-content .toc-wrapper,
.wiki-content .mw-toc-container, .wiki-content .toccolours { display: none !important; }
/* ── TOC PANEL (left drawer, always visible) ── */
.wiki-area { display: flex; flex: 1; overflow: hidden; }
.wiki-toc-panel { display: flex; flex-direction: row; flex-shrink: 0; width: 210px; background: var(--gray-50); border-right: 1px solid var(--gray-200); transition: width .2s ease; overflow: hidden; }
.wiki-toc-panel.collapsed { width: 26px; }
.wiki-toc-toggle { width: 26px; flex-shrink: 0; border: none; background: none; cursor: pointer; padding: 10px 0 0; color: var(--gray-500); font-size: 1rem; display: flex; justify-content: center; align-self: flex-start; font-family: var(--font); }
.wiki-toc-toggle:hover { color: var(--gray-900); }
.wiki-toc-inner { flex: 1; overflow-y: auto; padding: 10px 10px 10px 4px; min-width: 0; }
.wiki-toc-panel.collapsed .wiki-toc-inner { visibility: hidden; }
.wr-toc-heading { font-size: .7rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.wr-toc-list { margin: 0; padding: 0; list-style: none; }
.wr-toc-list li { margin: 3px 0; }
.wr-toc-list li.wr-toc-sub { padding-left: 10px; }
.wr-toc-list a { color: #3366cc; text-decoration: none; font-size: .78rem; line-height: 1.4; display: flex; align-items: baseline; gap: 4px; }
.wr-toc-list a:hover { text-decoration: underline; }
.wr-toc-num { color: #aaa; font-size: .78rem; flex-shrink: 0; }
/* Article wrapper (loader + content) */
.article-wrap { flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; }
/* Mobile-only TOC elements (hidden on desktop) */
.toc-mobile-btn { display: none; align-items: center; justify-content: center; width: 28px; height: 28px; border: none; background: none; cursor: pointer; color: var(--gray-600); font-size: 1.15rem; flex-shrink: 0; padding: 0; }
.toc-mobile-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 199; }
@media (max-width: 640px) {
  .wiki-content .infobox, .wiki-content table.infobox, .wiki-content .thumb { float: none; max-width: 100%; width: 100% !important; margin: 0 0 12px 0; }
  /* Convert TOC panel to a slide-in overlay on mobile */
  .wiki-toc-panel { position: fixed; left: -225px; top: 0; height: 100%; width: 220px !important; z-index: 200; display: flex; transition: left .25s ease; box-shadow: none; }
  .wiki-toc-panel.mobile-open { left: 0; box-shadow: 4px 0 20px rgba(0,0,0,.25); }
  .wiki-toc-panel.collapsed { width: 220px !important; }
  .wiki-toc-panel .wiki-toc-toggle { display: none; }
  .wiki-toc-panel .wiki-toc-inner { visibility: visible !important; padding: 14px 12px; }
  .toc-mobile-btn { display: flex; }
  .toc-mobile-backdrop.active { display: block; }
}
.game-sidebar-player { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm); margin-bottom: 5px; font-size: .8rem; background: #fff; border: 1px solid var(--gray-200); }
.game-sidebar-player.is-you { border-color: var(--blue); background: var(--blue-bg); }
.game-sidebar-player.is-winner { border-color: var(--gold); background: var(--gold-light); }
.gsp-name { font-weight: 600; font-size: .8rem; }
.gsp-article { font-size: .72rem; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gsp-clicks { font-size: .72rem; color: var(--gray-400); flex-shrink: 0; margin-left: auto; }
.winner-banner { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; border: 3px solid var(--gold); border-radius: var(--radius); padding: 28px 36px; text-align: center; box-shadow: var(--shadow-lg); z-index: 50; min-width: 280px; }
.winner-banner h2 { font-size: 1.9rem; margin-bottom: 8px; }
.winner-banner p { color: var(--gray-600); margin-bottom: 18px; }

/* ── RESULTS SCREEN ── */
.results-screen { min-height: 100vh; background: linear-gradient(150deg, #0f2244 0%, #1a3c7a 50%, #3b6fcd 100%); padding: 40px 20px; display: flex; justify-content: center; }
.results-container { max-width: 580px; width: 100%; }
.results-hero { text-align: center; color: #fff; margin-bottom: 28px; }
.results-hero .trophy-emoji { font-size: 5rem; display: block; margin-bottom: 10px; }
.results-hero h2 { font-size: 2.2rem; font-weight: 900; margin-bottom: 4px; }
.results-hero p { opacity: .8; font-size: 1rem; }
.results-hero-avatar { width: 96px; height: 96px; border-radius: 50%; border: 4px solid var(--gold); margin: 0 auto 14px; display: block; }
.results-entry { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; background: #fff; border-radius: var(--radius-sm); margin-bottom: 8px; box-shadow: var(--shadow-sm); }
.results-rank { font-size: 1.3rem; font-weight: 900; width: 38px; text-align: center; color: var(--gray-300); flex-shrink: 0; padding-top: 2px; }
.results-rank.r1 { color: var(--gold); }
.results-rank.r2 { color: var(--gray-500); }
.results-rank.r3 { color: #cd7f32; }
.results-player-name { font-weight: 700; }
.results-player-meta { font-size: .8rem; color: var(--gray-500); }
.results-dnf { font-style: italic; color: var(--gray-400); }
.article-path { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin-top: 6px; padding: 6px 8px; background: var(--gray-100); border-radius: var(--radius-sm); font-size: .72rem; width: 100%; box-sizing: border-box; }
.path-chunk { display: inline-flex; align-items: center; gap: 2px; }
.path-step { color: var(--gray-700); word-break: break-word; }
.path-step-final { color: var(--green); font-weight: 700; }
.path-arrow { color: var(--gray-400); font-size: .65rem; flex-shrink: 0; }
.results-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }
.filter-row { margin-bottom: 10px; }
.filter-label { font-size: .75rem; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: .05em; display: block; margin-bottom: 5px; }
.diff-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.diff-chip { padding: 4px 11px; border-radius: 20px; font-size: .78rem; font-weight: 600; border: 2px solid var(--gray-300); background: #fff; color: var(--gray-600); cursor: pointer; transition: all .12s; }
.diff-chip:hover { border-color: var(--blue); color: var(--blue); }
.diff-chip.active                  { background: var(--blue);   border-color: var(--blue);   color: #fff; }
.diff-chip[data-diff="Easy"].active       { background: var(--green); border-color: var(--green); color: #fff; }
.diff-chip[data-diff="Medium"].active     { background: #f59e0b;      border-color: #f59e0b;      color: #fff; }
.diff-chip[data-diff="Hard"].active       { background: #e65100;      border-color: #e65100;      color: #fff; }
.diff-chip[data-diff="Impossible"].active { background: #b71c1c;      border-color: #b71c1c;      color: #fff; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.cat-chip { padding: 3px 9px; border-radius: 20px; font-size: .73rem; font-weight: 600; border: 2px solid var(--gray-300); background: #fff; color: var(--gray-600); cursor: pointer; transition: all .12s; }
.cat-chip:hover { border-color: var(--blue); color: var(--blue); }
.cat-chip.active { background: var(--blue-light); border-color: var(--blue); color: var(--blue-dark); }

/* ── DAILY CHALLENGE SCREEN ── */
.daily-screen { min-height: 100vh; background: #eef2f7; padding: 20px; display: flex; justify-content: center; }
.daily-container { max-width: 540px; width: 100%; padding-top: 20px; }
.daily-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.daily-header h2 { font-size: 1.4rem; }
.daily-date-label { font-size: .75rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px; }
.daily-hero { text-align: center; padding: 20px 16px 8px; }
.daily-hero-start { font-size: 1.55rem; font-weight: 900; color: var(--gray-900); margin-bottom: 6px; }
.daily-hero-arrow { font-size: 1.6rem; opacity: .35; margin: 8px 0; }
.daily-hero-end { font-size: 1.55rem; font-weight: 900; color: var(--blue); }
.daily-played-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--green-light); color: var(--green); border-radius: 20px; padding: 7px 16px; font-size: .83rem; font-weight: 700; margin-top: 16px; }
.daily-lb-row { border-bottom: 1px solid var(--gray-200); }
.daily-lb-row:last-child { border-bottom: none; }
.daily-lb-entry { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.daily-lb-path-toggle { background: none; border: none; cursor: pointer; color: var(--gray-400); font-size: .75rem; padding: 4px 6px; border-radius: 4px; flex-shrink: 0; transition: transform .2s, color .2s; line-height: 1; }
.daily-lb-path-toggle:hover { color: var(--blue); }
.daily-lb-path-toggle.open { transform: rotate(180deg); color: var(--blue); }
.daily-lb-path-expand { display: none; padding: 0 0 10px 40px; }
.daily-lb-path-expand.open { display: block; }
/* Stats modal */
.stats-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.stats-modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 360px; padding: 24px 20px 20px; position: relative; box-shadow: 0 8px 40px rgba(0,0,0,.25); animation: slideUp .2s ease; }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.stats-modal-close { position: absolute; top: 10px; right: 10px; background: none; border: none; font-size: 1rem; cursor: pointer; color: var(--gray-500); padding: 4px 8px; border-radius: 4px; line-height: 1; }
.stats-modal-close:hover { background: var(--gray-100); color: var(--gray-800); }
.stats-numbers { display: flex; justify-content: space-around; margin: 14px 0 18px; text-align: center; }
.stats-number-val { font-size: 2rem; font-weight: 900; color: var(--gray-900); line-height: 1; }
.stats-number-label { font-size: .65rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; line-height: 1.3; }
.daily-lb-rank { font-size: 1.15rem; font-weight: 900; width: 30px; text-align: center; flex-shrink: 0; color: var(--gray-300); }
.daily-lb-rank.r1 { color: var(--gold); }
.daily-lb-rank.r2 { color: var(--gray-500); }
.daily-lb-rank.r3 { color: #cd7f32; }
.daily-lb-info { flex: 1; min-width: 0; }
.daily-lb-name { font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daily-lb-meta { font-size: .74rem; color: var(--gray-500); margin-top: 1px; }
.daily-lb-you { font-size: .7rem; color: var(--blue); font-weight: 700; flex-shrink: 0; background: var(--blue-bg); padding: 2px 8px; border-radius: 10px; }
/* Daily button on home screen */
.btn-daily { background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%); color: #fff; }
.btn-daily:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(79,70,229,.4); }

/* ── RACE COUNTDOWN OVERLAY ── */
.race-countdown { position: fixed; inset: 0; background: linear-gradient(150deg, #0f2244 0%, #1a3c7a 50%, #3b6fcd 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 9990; color: #fff; text-align: center; padding: 28px; }
.rcd-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; opacity: .65; margin-bottom: 8px; }
.rcd-title { font-size: 2.4rem; font-weight: 900; max-width: 80vw; line-height: 1.2; }
.rcd-target { color: #fef08a; }
.rcd-arrow { font-size: 2rem; opacity: .45; margin: 18px 0; }
.rcd-num { font-size: 7rem; font-weight: 900; margin-top: 32px; line-height: 1; animation: rcd-pop .45s cubic-bezier(.22,.61,.36,1) both; }
.rcd-go { font-size: 5.5rem; font-weight: 900; color: #4ade80; margin-top: 32px; animation: rcd-pop .3s cubic-bezier(.22,.61,.36,1) both; }
@keyframes rcd-pop { from { transform: scale(1.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (max-width: 640px) {
  .rcd-title { font-size: 1.7rem; }
  .rcd-num { font-size: 5.5rem; }
  .rcd-go { font-size: 4.5rem; }
}

/* Ad slots */
.ad-slot { width: 100%; text-align: center; margin: 12px 0; overflow: hidden; }
.ad-slot ins { display: block; }

/* Ko-fi button */
.kofi-btn { position: fixed; bottom: 16px; right: 16px; z-index: 1000; display: flex; align-items: center; gap: 7px; padding: 8px 14px; background: #ff5e5b; color: #fff; border-radius: 20px; font-size: .82rem; font-weight: 700; text-decoration: none; box-shadow: 0 2px 10px rgba(0,0,0,.2); transition: transform .15s, box-shadow .15s; white-space: nowrap; }
.kofi-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.25); color: #fff; }
.kofi-btn svg { flex-shrink: 0; }
/* On mobile during the game the bottom bar is ~50px + safe area — push Ko-fi above it */
@media (max-width: 640px) {
}

/* Responsive */
@media (max-width: 640px) {
  .game-sidebar { display: none; }
  .room-code-value { font-size: 1.8rem; letter-spacing: 4px; }
  .home-logo h1 { font-size: 2.8rem; }
  /* Move game header to bottom so article content fills the screen */
  /* dvh adjusts as Safari chrome shows/hides; safe-area-inset-top clears the notch */
  .game-screen { height: 100dvh; padding-top: env(safe-area-inset-top, 50px); }
  .game-header {
    order: 1;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 12px calc(8px + env(safe-area-inset-bottom, 6px));
    min-height: auto;
    align-items: center;
  }
  .game-body { order: 0; }
  /* Hide Ko-fi during gameplay — it overlaps the bottom bar on mobile */
  body:has(.game-screen) .kofi-btn { display: none; }
  /* Two-row layout: articles fill the full width, stats sit below */
  .game-articles { width: 100%; justify-content: center; font-size: .85rem; gap: 6px; }
  .game-article-pill { max-width: 42vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .game-stats { width: 100%; justify-content: center; gap: 16px; }
  .game-stat-lbl { font-size: .58rem; }
  .game-stat-val { font-size: .95rem; }
  /* Breadcrumb: truncate long article titles */
  .game-breadcrumb { font-size: .72rem; padding: 5px 8px; gap: 5px; }
  #bread-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 38vw; display: inline-block; vertical-align: bottom; }
  /* Results: wrap buttons so 3 don't overflow on small screens */
  .results-actions { flex-wrap: wrap; }
  .results-actions .btn { flex: 1 1 auto; min-width: 140px; }
  /* ── Lobby mobile fixes ── */
  .lobby-screen { padding: 12px; }
  .lobby-container { padding-top: 10px; }
  .card { padding: 16px; }
  .lobby-header { margin-bottom: 14px; }
  .lobby-header h2 { font-size: 1.2rem; }
  /* Stack room code box vertically so the copy button doesn't crowd the code */
  .room-code-box { flex-direction: column; align-items: flex-start; padding: 14px 16px; gap: 10px; margin-bottom: 14px; }
  .room-code-value { font-size: 2rem; letter-spacing: 5px; }
  /* Article display: tighten spacing */
  .article-display { gap: 6px; padding: 10px 12px; }
  .article-name { font-size: .9rem; }
  /* Custom input row: stack vertically on small screens */
  .custom-inputs { flex-direction: column; align-items: stretch; }
  .custom-inputs .btn { width: 100%; margin-top: 2px; }
  /* Player card: smaller avatar + padding */
  .player-card { padding: 10px; gap: 10px; }
  .player-card .avatar { width: 34px; height: 34px; }
  .player-name { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55vw; }
}

/* ── Wikipedia support / attribution ── */
.donate-card { display: flex; align-items: center; gap: 16px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; margin-bottom: 16px; border-left: 4px solid #202122; }
.donate-text { flex: 1; font-size: .88rem; color: var(--gray-800); line-height: 1.5; }
.btn-donate { background: #202122; color: #fff; flex-shrink: 0; }
.btn-donate:hover { background: #000; color: #fff; transform: translateY(-1px); }
.home-footer { margin-top: 18px; text-align: center; font-size: .75rem; line-height: 1.6; color: rgba(255,255,255,.7); }
.home-footer a { color: #fff; }
.join-invite { background: var(--blue-bg); border: 1px solid var(--blue-light); color: var(--blue-dark); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .88rem; margin-bottom: 14px; }
.bread-license { font-size: .68rem; color: #bbb; text-decoration: none; white-space: nowrap; }
.bread-license:hover { color: var(--gray-600); text-decoration: underline; }
@media (max-width: 640px) {
  .donate-card { flex-direction: column; align-items: stretch; text-align: center; }
  .bread-license { display: none; }
}

/* ── Static pages ── */
.static-page h2 { font-size: 1.1rem; color: var(--blue-dark); margin: 18px 0 6px; }
.static-page h2:first-child { margin-top: 0; }
.static-page p, .static-page li { font-size: .95rem; line-height: 1.65; color: var(--gray-800); }
.static-page ul { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* Article failed to load */
.article-error { max-width: 420px; margin: 60px auto; text-align: center; font-family: var(--font); color: var(--gray-800); }
.article-error p { margin: 10px 0 16px; line-height: 1.6; }

.avatar-credits { text-align: center; margin-top: 12px; font-size: .72rem; }
.avatar-credits a { color: var(--gray-500); }
