/* ╔══════════════════════════════════════════╗
   ║  6steps — Dark Premium Theme              ║
   ╚══════════════════════════════════════════╝ */

/* ───── CSS Variables ───── */
:root {
  color-scheme: dark;
  --bg: #0c1118;
  --bg-soft: rgba(255, 255, 255, 0.07);
  --card: rgba(15, 20, 29, 0.82);
  --card-border: rgba(255, 255, 255, 0.12);
  --text: #f4f0e8;
  --muted: rgba(244, 240, 232, 0.72);
  --accent: #f2c94c;
  --accent-strong: #ffb703;
  --accent-contrast: #1a1300;
  --link: #8bd3ff;
  --link-hover: #bceaff;
  --danger: #ff7f8a;
  --success: #73e2a7;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --font-body: "Space Grotesk", sans-serif;
  --font-display: "Fraunces", serif;
  --nav-height: 64px;
}

/* ───── Reset ───── */
* { box-sizing: border-box; }

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(242, 201, 76, 0.16), transparent 32%),
    radial-gradient(circle at top right, rgba(139, 211, 255, 0.16), transparent 28%),
    linear-gradient(180deg, #111827 0%, #0c1118 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: transparent;
  padding-top: var(--nav-height);
}

button, input, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }

/* ───── Custom Scrollbar ───── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.14) rgba(255,255,255,0.03); }

/* ───── Background Blobs ───── */
.background-blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.background-blobs::before,
.background-blobs::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.5;
  animation: blobFloat 18s ease-in-out infinite alternate;
}
.background-blobs::before {
  width: 24rem; height: 24rem;
  background: rgba(242, 201, 76, 0.12);
  top: -6rem; left: -8rem;
}
.background-blobs::after {
  width: 18rem; height: 18rem;
  background: rgba(139, 211, 255, 0.12);
  bottom: 4rem; right: -4rem;
  animation-delay: -9s;
}
@keyframes blobFloat {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -20px) scale(1.08); }
}

/* ───── Top Nav Bar ───── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  z-index: 100;
  background: rgba(15, 20, 29, 0.75);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--card-border);
}
.nav-inner {
  max-width: 1220px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
}
.logo-icon { font-size: 1.4rem; }
.logo-text strong { color: var(--accent); font-family: var(--font-display); letter-spacing: -0.02em; }
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.auth-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-button {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 200ms ease;
}
.nav-button:hover { background: rgba(255,255,255,0.14); transform: translateY(-1px); }
.nav-button--danger { color: var(--danger); border-color: rgba(255,127,138,0.2); }
.nav-button--danger:hover { background: rgba(255,127,138,0.12); }
.language-dropdown {
  appearance: none;
  -webkit-appearance: none;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f4f0e8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 1.1em;
  cursor: pointer;
}
.language-dropdown:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(242,201,76,0.15);
}
.language-dropdown option {
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}
.user-info { display: flex; align-items: center; gap: 0.6rem; }
.username-display {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  padding: 0.3rem 0.75rem;
  background: rgba(242,201,76,0.1);
  border-radius: 999px;
}

/* ───── Shell ───── */
.shell {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 2rem;
  position: relative;
  z-index: 1;
}

/* ───── Card (glassmorphic) ───── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

/* ───── Hero ───── */
.hero {
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem;
  align-items: center;
  animation: fadeInUp 0.6s ease-out;
  overflow: hidden;
  position: relative;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 50%, rgba(242, 201, 76, 0.06), transparent 60%);
  pointer-events: none;
}
.hero-left { z-index: 1; }
.hero-right {
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.eyebrow, .stat-label {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--muted);
}
h1, h2, .hero .lede, .stat-card p, .article-status, .trail-list, .trail-list li, .article-content { margin: 0; }
h1, h2 { font-family: var(--font-display); letter-spacing: -0.02em; }
h1 { font-size: clamp(1.9rem, 3.5vw, 3.2rem); line-height: 1.05; max-width: 18ch; }
h1 em { color: var(--accent); font-style: normal; }
.lede { max-width: 62ch; margin-top: 0.9rem; font-size: 1rem; line-height: 1.65; color: var(--muted); }
.hero-link { color: var(--accent); font-weight: 600; }
.hero-link:hover { color: var(--accent-strong); }

/* Six Degrees Badge */
.six-degrees-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.25rem;
  padding: 0.65rem 1.1rem;
  background: rgba(242, 201, 76, 0.1);
  border: 1px solid rgba(242, 201, 76, 0.25);
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--text);
  animation: fadeInUp 0.6s ease-out 0.3s both;
}
.six-badge-icon { font-size: 1.1rem; }
.six-badge-text strong { color: var(--accent); }

/* Hero Steps Visualization */
.hero-steps-viz {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem;
}
.step-node {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  transition: all 300ms;
}
.start-node { background: rgba(115, 226, 167, 0.15); border-color: rgba(115, 226, 167, 0.3); color: var(--success); }
.target-node { background: rgba(242, 201, 76, 0.15); border-color: rgba(242, 201, 76, 0.3); color: #d4a017; }
.step-connector { color: var(--muted); font-size: 1.1rem; opacity: 0.5; }

/* ───── New Game Panel ───── */
.new-game-panel {
  margin-top: 1rem;
  border-radius: var(--radius-xl);
  padding: 1.75rem 2rem;
  animation: fadeInUp 0.6s ease-out 0.1s both;
}
.new-game-header {
  margin-bottom: 1.5rem;
}
.new-game-header h2 {
  font-size: 1.35rem;
  margin: 0 0 0.3rem;
}
.new-game-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Game Mode Tabs */
.game-mode-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  flex-wrap: wrap;
}
.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
  background: transparent;
  border: none;
  transition: all 220ms ease;
  cursor: pointer;
  white-space: nowrap;
}
.mode-tab:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.mode-tab.active {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.mode-tab-icon { font-size: 1rem; }

/* Difficulty inside panel */
.difficulty-section {
  margin-bottom: 1.5rem;
  text-align: center;
}
.difficulty-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 0.65rem;
}
.difficulty-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
  justify-content: center;
}
.difficulty-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 250ms ease;
  cursor: pointer;
}
.difficulty-pill:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  transform: translateY(-1px);
}
.difficulty-pill[data-difficulty="easy"].active {
  background: linear-gradient(135deg, #73e2a7, #34d399);
  color: #000;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(115,226,167,0.25);
  transform: scale(1.05);
}
.difficulty-pill[data-difficulty="medium"].active {
  background: linear-gradient(135deg, #facc15, #ffd36b);
  color: #1a1300;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(242,201,76,0.25);
  transform: scale(1.05);
}
.difficulty-pill[data-difficulty="hard"].active {
  background: linear-gradient(135deg, #fb923c, #f97316);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(251,146,60,0.25);
  transform: scale(1.05);
}
.difficulty-pill[data-difficulty="expert"].active {
  background: linear-gradient(135deg, #ff7f8a, #ef4444);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(255,127,138,0.25);
  transform: scale(1.05);
}
.difficulty-pill[data-difficulty="ultra"].active {
  background: linear-gradient(135deg, #4b5563, #1f2937);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  transform: scale(1.05);
}
.difficulty-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  transition: opacity 300ms;
  min-height: 1.4em;
}

/* Mode Content Area */
.mode-content {
  padding-top: 0.25rem;
}
.launch-button {
  min-width: 200px;
}

/* Custom inline form */
.custom-inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem;
  align-items: end;
}

/* ───── Buttons ───── */
.primary-button, .secondary-button {
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, opacity 160ms ease;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: center;
}
.primary-button {
  background: linear-gradient(135deg, var(--accent), #ffd36b);
  color: var(--accent-contrast);
  box-shadow: 0 14px 30px rgba(242, 201, 76, 0.25);
}
.secondary-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.primary-button:hover, .secondary-button:hover { transform: translateY(-2px); }
.primary-button:active, .secondary-button:active { transform: translateY(0) scale(0.98); }
.primary-button:disabled, .secondary-button:disabled { opacity: 0.55; cursor: progress; transform: none; }
.btn-icon { font-size: 1.05em; }
.icon-button {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--muted);
  width: 36px; height: 36px;
  display: grid; place-items: center;
  font-size: 1rem;
  transition: all 200ms;
}
.icon-button:hover { background: rgba(255,255,255,0.12); color: var(--text); }

/* ───── Game Top Bar ───── */
.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-lg);
  margin-bottom: 0.25rem;
}
.game-topbar .primary-button,
.game-topbar .secondary-button { padding: 0.6rem 1rem; }
.game-topbar-route {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 1;
  justify-content: center;
  font-size: 0.92rem;
}
.topbar-page {
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.topbar-page--target { color: var(--accent); }
.topbar-arrow { color: var(--muted); }

/* ───── Stats Grid ───── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.stat-card {
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.15rem;
  min-height: 142px;
  display: grid;
  align-content: start;
  gap: 0.45rem;
  animation: fadeInUp 0.5s ease-out both;
}
.stat-card:nth-child(1) { animation-delay: 0.15s; }
.stat-card:nth-child(2) { animation-delay: 0.25s; }
.stat-card:nth-child(3) { animation-delay: 0.35s; }
.stat-card strong {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.4vw, 2.05rem);
  line-height: 1.05;
}
.stat-card p, .article-status, .trail-list li, .article-content {
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.96rem;
}
.target-card { border-color: rgba(242, 201, 76, 0.22); }
.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.timer-display {
  font-family: "Space Grotesk", monospace;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--accent);
  background: rgba(242,201,76,0.1);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

/* ───── Undo / Go Back Button ───── */
.undo-button {
  margin-top: 0.85rem;
  width: 100%;
  background: rgba(255, 127, 138, 0.12);
  border: 1.5px solid rgba(255, 127, 138, 0.35);
  color: #ffb3ba;
  cursor: pointer;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  transition: transform 0.16s ease, background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.undo-button svg { flex-shrink: 0; }
.undo-button .undo-penalty {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-contrast);
  background: var(--danger);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.undo-button:hover:not(:disabled) {
  background: rgba(255, 127, 138, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 127, 138, 0.22);
  color: #fff;
}
.undo-button:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.undo-button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ───── Playfield ───── */
.playfield {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 1rem;
  margin-top: 1rem;
  align-items: start;
}
.article-card, .trail-card { border-radius: var(--radius-xl); min-width: 0; }
.article-card { padding: 1.15rem; animation: fadeInUp 0.6s ease-out 0.4s both; }
.trail-card { padding: 1.15rem; }
.sidebar-stack { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: calc(var(--nav-height) + 1rem); }
.article-header, .trail-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 0.85rem;
}
#current-title, .trail-header h2 { font-size: clamp(1.6rem, 2.5vw, 2.4rem); margin-top: 0.15rem; }
.visit-badge {
  align-self: center;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.88rem;
  white-space: nowrap;
}
.article-status {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1rem;
}
.article-content {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 1rem;
  max-height: 85vh;
  overflow: auto;
  scroll-behavior: smooth;
}
.article-content :is(h2, h3, h4) {
  font-family: var(--font-display);
  color: var(--text);
  margin: 1.3rem 0 0.5rem;
}
.article-content p, .article-content li { margin: 0 0 0.6rem; }

/* Hide only Wikipedia chrome/metadata */
.article-content figure,
.article-content .hatnote, .article-content .infobox,
.article-content table.infobox, .article-content .infobox_v2,
.article-content .navbox, .article-content .vertical-navbox,
.article-content .navbox-styles, .article-content .ambox,
.article-content .reflist, .article-content .mw-editsection,
.article-content .metadata, .article-content .mw-empty-elt,
.article-content .sidebar, .article-content .sistersitebox,
.article-content .thumb, .article-content sup.reference,
.article-content .noprint, .article-content .mw-jump-link,
.article-content style {
  display: none !important;
}

/* ── Lists ── */
.article-content ul, .article-content ol {
  margin: 0 0 0.9rem;
  padding-left: 1.5rem;
}
.article-content ul { list-style: disc; }
.article-content ol { list-style: decimal; }
.article-content ul ul, .article-content ol ol,
.article-content ul ol, .article-content ol ul { margin-bottom: 0.2rem; }
.article-content li { margin: 0 0 0.35rem; }
.article-content li::marker { color: var(--accent); }
.article-content dl { margin: 0 0 0.9rem; }
.article-content dt { font-weight: 700; color: var(--text); margin-top: 0.5rem; }
.article-content dd { margin: 0 0 0.4rem 1.2rem; color: var(--muted); }

/* ── Tables ── */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.1rem;
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: table;
}
.article-content table caption {
  caption-side: top;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
  padding: 0 0 0.5rem;
}
.article-content th, .article-content td {
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: top;
}
.article-content th {
  background: rgba(242, 201, 76, 0.1);
  color: var(--text);
  font-weight: 700;
}
.article-content tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }
.article-content table.wikitable { display: table; }

.article-content img { max-width: 100%; height: auto; border-radius: 18px; }
.article-content a { color: var(--link); text-decoration: none; border-bottom: 1px solid rgba(139, 211, 255, 0.24); }
.article-content a:hover { color: var(--link-hover); border-bottom-color: currentColor; }

/* ───── Trail / Route ───── */
.trail-list {
  list-style: none;
  padding: 0;
  margin-top: 0.5rem;
  display: grid;
  gap: 0.5rem;
  /* Scrollable trail with max height */
  max-height: 360px;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.trail-list li {
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 200ms;
}
.trail-list li strong { display: block; color: var(--text); margin-bottom: 0.15rem; }
.trail-list li.is-start { border-color: rgba(115, 226, 167, 0.26); }
.trail-list li.is-current { border-color: rgba(242, 201, 76, 0.28); background: rgba(242,201,76,0.05); }

/* ───── Custom Setup ───── */
.hidden { display: none !important; }
.game-hidden { display: none !important; }
.game-revealed {
  animation: fadeInUp 0.4s ease-out both;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.input-group { display: flex; flex-direction: column; gap: 0.5rem; }
.input-group label { font-weight: 600; color: var(--muted); font-size: 0.9rem; }
.input-group input {
  padding: 0.75rem 1rem;
  border: 2px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(15,20,29,0.9);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242,201,76,0.15); }
.input-group input::placeholder { color: rgba(244,240,232,0.3); }
.validation-status { font-size: 0.82rem; min-height: 1.2em; }
.validation-status.valid { color: var(--success); }
.validation-status.invalid { color: var(--danger); }
.code-input { font-family: "Space Grotesk", monospace; font-size: 1.4rem !important; letter-spacing: 0.2em; text-align: center; text-transform: uppercase; }

/* ───── Party Section (flat — sits directly on the page background) ───── */
.party-section {
  margin-top: 0.7rem;
  padding: 0;
  animation: fadeInUp 0.4s ease-out;
}
.party-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.party-header h2 { font-size: 1.6rem; font-family: var(--font-display); }

/* Short helper text shown above the party / custom controls */
.mode-intro {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 640px;
  margin: 0 0 1.75rem;
}

.party-option-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 2rem;
  align-items: stretch;
}
.party-option-grid.single {
  grid-template-columns: minmax(auto, 400px);
  justify-content: center;
}
/* Flat option blocks — no card chrome, just breathing room + a subtle divider */
.party-option-card {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: flex-start;
}
.party-option-card h3 {
  font-family: var(--font-display);
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}
.party-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  position: relative;
}
/* Vertical hairline between the two flat columns */
.party-divider::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--card-border), transparent);
}
.party-divider span {
  background: var(--bg, #0d0f1a);
  padding: 0.4rem 0;
  z-index: 1;
}

/* ───── Party Lobby ───── */
.party-lobby { animation: fadeInUp 0.4s ease-out; }
.join-code-display {
  text-align: center;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  background: rgba(242,201,76,0.06);
  border: 1px solid rgba(242,201,76,0.15);
  border-radius: var(--radius-lg);
}
.code-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted); }
.code-value-row { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-top: 0.5rem; }
.code-value {
  font-family: "Space Grotesk", monospace;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.25em;
}
.lobby-players { margin-bottom: 1.25rem; }
.lobby-players h3 { font-family: var(--font-display); margin: 0 0 0.75rem; font-size: 1.05rem; }
.player-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}
.player-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  transition: all 200ms;
}
.player-avatar {
  width: 36px; height: 36px;
  border-radius: 999px;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-contrast);
  flex-shrink: 0;
}
.player-name { font-weight: 600; flex: 1; }
.player-host-badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: rgba(242,201,76,0.12);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}
.host-controls { text-align: center; }
.lobby-difficulty {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1rem;
}
.guest-waiting {
  text-align: center;
  padding: 1rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.waiting-pulse {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* ───── Players Sidebar (in-game multiplayer) ───── */
.players-sidebar { animation: fadeInUp 0.4s ease-out; }
.players-live-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
}
.players-live-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  transition: all 300ms;
}
.player-live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--link);
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}
.player-live-dot.finished { background: var(--success); animation: none; }
.player-live-info { flex: 1; min-width: 0; }
.player-live-name { font-weight: 600; font-size: 0.88rem; display: block; }
.player-live-page {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.player-live-page.blurred {
  filter: blur(4px);
  user-select: none;
  pointer-events: none;
}
.player-live-steps {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
  white-space: nowrap;
}
.player-live-finished {
  font-size: 0.82rem;
  color: var(--success);
  font-weight: 700;
}

/* Party reveal notice */
.party-reveal-notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.75rem;
  background: rgba(242, 201, 76, 0.07);
  border: 1px solid rgba(242, 201, 76, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--accent);
}

/* ───── Leaderboard ───── */
.leaderboard-section {
  margin-top: 1rem;
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  animation: fadeInUp 0.6s ease-out 0.5s both;
}
.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.leaderboard-header h2 { font-size: 1.4rem; margin: 0; }
.chevron-icon { transition: transform 300ms ease; }
.leaderboard-body.collapsed { max-height: 0; overflow: hidden; opacity: 0; transition: all 350ms ease; }
.leaderboard-body.expanded { max-height: 1200px; opacity: 1; transition: all 450ms ease; padding-top: 1rem; }
.leaderboard-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  background: rgba(255,255,255,0.04);
  border-radius: 999px;
  padding: 0.3rem;
}
.lb-tab {
  flex: 1;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  background: transparent;
  border: none;
  transition: all 200ms;
  cursor: pointer;
}
.lb-tab:hover { color: var(--text); }
.lb-tab.active {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}
.leaderboard-content { overflow-x: auto; }
.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.lb-table th {
  text-align: left;
  padding: 0.7rem 0.85rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.lb-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.lb-table tbody tr { transition: background 200ms; }
.lb-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.lb-table tbody tr:hover { background: rgba(255,255,255,0.06); }
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.82rem;
}
.rank-1 { background: linear-gradient(135deg, #ffd700, #ffb703); color: #1a1300; }
.rank-2 { background: linear-gradient(135deg, #c0c0c0, #a0a0a0); color: #1a1a1a; }
.rank-3 { background: linear-gradient(135deg, #cd7f32, #a0522d); color: #fff; }
.rank-default { background: rgba(255,255,255,0.08); color: var(--muted); }
.leaderboard-empty {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-style: italic;
}

/* ───── Locked board (game over) ───── */
.article-content.article-locked { position: relative; }
.article-content.article-locked a { pointer-events: none; opacity: 0.6; cursor: default; }

/* ───── Party lobby: room language shown right under the room code ───── */
.lobby-room-language {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.lobby-room-language strong { color: var(--text); }

/* ───── Navigation lock (Back / swipe-back trapped during a game) ───── */
body.nav-locked { overscroll-behavior-x: none; }
body.nav-locked .article-content { overscroll-behavior-x: contain; }

/* ───── In-page search highlights ───── */
mark.page-search-hl {
  background: rgba(242, 201, 76, 0.35);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
mark.page-search-hl.is-active {
  background: var(--accent, #f2c94c);
  color: #1a1a1a;
}

/* ───── Profile Nav Button ───── */
.nav-button--profile {
  color: var(--accent);
  border-color: rgba(242, 201, 76, 0.3);
  background: rgba(242, 201, 76, 0.08);
}
.nav-button--profile:hover { background: rgba(242, 201, 76, 0.16); }

/* ───── Profile Overlay ───── */
body.modal-open { overflow: hidden; }
.profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.profile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease-out;
}
.profile-panel {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(88vh, 900px);
  overflow-y: auto;
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  animation: winCardIn 0.4s ease-out;
}
.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.profile-identity { display: flex; align-items: center; gap: 1rem; }
.profile-avatar {
  width: 56px; height: 56px;
  border-radius: 18px;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--accent-contrast);
  background: var(--accent);
  flex-shrink: 0;
}
.profile-identity h2 { font-size: 1.6rem; margin-top: 0.1rem; }
.profile-login-prompt {
  text-align: center;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: rgba(242, 201, 76, 0.06);
  border: 1px solid rgba(242, 201, 76, 0.15);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}
.profile-login-prompt p { margin: 0; color: var(--muted); }
.profile-login-prompt .primary-button { width: auto; }
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.profile-stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem 0.75rem;
  text-align: center;
}
.profile-stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}
.profile-stat-value .rank-total {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  display: block;
}
.profile-stat-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-top: 0.35rem;
}
.profile-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  padding: 0.3rem;
}
.profile-tab {
  flex: 1;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  background: transparent;
  border: none;
  transition: all 200ms;
  cursor: pointer;
}
.profile-tab:hover { color: var(--text); }
.profile-tab.active { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.profile-table-wrap { overflow-x: auto; }
.lb-table tbody tr.is-me {
  background: rgba(242, 201, 76, 0.1) !important;
  outline: 1px solid rgba(242, 201, 76, 0.25);
}

/* ───── Party Results Modal ───── */
.results-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease-out;
}
.results-modal-card { max-width: 560px; }
.results-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  display: grid;
  gap: 0.55rem;
  text-align: left;
  max-height: 60vh;
  overflow-y: auto;
}
.result-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md, 12px);
}
.result-row.result-winner {
  background: rgba(242, 201, 76, 0.1);
  border-color: rgba(242, 201, 76, 0.3);
}
.result-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.result-rank {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.result-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-stats { font-weight: 700; color: var(--accent); font-size: 0.9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.result-score { color: var(--muted); }
.result-route {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.5;
  word-break: break-word;
  padding-left: calc(30px + 0.75rem);
}

/* ───── Win Modal ───── */
.win-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.win-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease-out;
}
.win-modal-card {
  position: relative;
  border-radius: var(--radius-xl);
  padding: 2rem 2.5rem;
  max-width: 500px;
  width: 100%;
  text-align: center;
  overflow: hidden;
  animation: winCardIn 0.5s ease-out;
  border-color: rgba(242,201,76,0.3);
  box-shadow: 0 0 80px rgba(242,201,76,0.15), var(--shadow);
}
@keyframes winCardIn {
  0% { transform: scale(0.8) translateY(40px); opacity: 0; }
  60% { transform: scale(1.02); }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.confetti-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 10px; height: 10px;
  top: -20px;
  animation: confettiFall 3s ease-in-out infinite;
}
.confetti-piece:nth-child(1) { left: 5%; background: #f2c94c; animation-delay: 0s; border-radius: 2px; }
.confetti-piece:nth-child(2) { left: 15%; background: #8bd3ff; animation-delay: 0.2s; border-radius: 50%; }
.confetti-piece:nth-child(3) { left: 25%; background: #73e2a7; animation-delay: 0.4s; width: 8px; height: 14px; }
.confetti-piece:nth-child(4) { left: 35%; background: #ff7f8a; animation-delay: 0.6s; border-radius: 2px; }
.confetti-piece:nth-child(5) { left: 45%; background: #f2c94c; animation-delay: 0.1s; border-radius: 50%; }
.confetti-piece:nth-child(6) { left: 55%; background: #8bd3ff; animation-delay: 0.3s; }
.confetti-piece:nth-child(7) { left: 65%; background: #73e2a7; animation-delay: 0.5s; border-radius: 50%; }
.confetti-piece:nth-child(8) { left: 75%; background: #ff7f8a; animation-delay: 0.7s; width: 6px; height: 12px; }
.confetti-piece:nth-child(9) { left: 85%; background: #f2c94c; animation-delay: 0.15s; border-radius: 2px; }
.confetti-piece:nth-child(10) { left: 92%; background: #8bd3ff; animation-delay: 0.45s; }
.confetti-piece:nth-child(11) { left: 50%; background: #ffb703; animation-delay: 0.25s; border-radius: 50%; }
.confetti-piece:nth-child(12) { left: 10%; background: #73e2a7; animation-delay: 0.55s; }
@keyframes confettiFall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(500px) rotate(720deg); opacity: 0; }
}
.win-content { position: relative; z-index: 1; }
.win-trophy { font-size: 4rem; margin-bottom: 0.5rem; animation: trophyBounce 0.8s ease-out; }
@keyframes trophyBounce {
  0% { transform: scale(0) rotate(-20deg); }
  50% { transform: scale(1.3) rotate(10deg); }
  70% { transform: scale(0.9) rotate(-5deg); }
  100% { transform: scale(1) rotate(0); }
}
.win-title {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--accent), #ffd36b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 0.5rem;
}
.win-subtitle { color: var(--muted); margin: 0 0 1.25rem; font-size: 1rem; }
.win-stats {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}
.win-stat { text-align: center; }
.win-stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}
.win-stat-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-top: 0.25rem;
}
.win-route {
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.7;
}
.win-route .route-arrow { color: var(--accent); margin: 0 0.3rem; }
.win-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }

/* ───── Toast Container ───── */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1000;
}
.toast {
  background: var(--card);
  backdrop-filter: blur(20px);
  border: 2px solid var(--accent);
  color: var(--text);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  font-family: var(--font-body);
  font-weight: 500;
  animation: toast-in 0.3s ease-out forwards;
  max-width: 380px;
}
.toast.toast--success { border-color: var(--success); }
.toast.toast--danger { border-color: var(--danger); }
@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast.fade-out { animation: toast-out 0.3s ease-in forwards; }
@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ───── Win / Error States ───── */
.state-win .target-card,
.state-win .article-card {
  border-color: rgba(115, 226, 167, 0.38);
  box-shadow: 0 24px 60px rgba(115, 226, 167, 0.12);
}
.state-error .article-card {
  border-color: rgba(255, 127, 138, 0.4);
}

/* ───── Skeleton Loading ───── */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ───── Animations ───── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ───── Responsive ───── */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .hero-right { display: none; }
  .playfield, .stats-grid { grid-template-columns: 1fr; }
  .trail-card { position: static; }
  .article-content { max-height: none; }
  .party-option-grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .party-divider { padding: 0.5rem 0; }
  .party-divider::before { top: 50%; bottom: auto; left: 0; right: 0; width: auto; height: 1px; background: linear-gradient(to right, transparent, var(--card-border), transparent); }
  .custom-inline-form { grid-template-columns: 1fr; }
  .game-topbar { flex-wrap: wrap; }
  .game-topbar-route { order: 3; width: 100%; }
}
@media (max-width: 640px) {
  :root { --nav-height: 56px; }
  .shell { width: min(100vw - 1rem, 1180px); padding-top: 0.5rem; }
  .hero, .article-card, .trail-card, .stat-card { border-radius: 20px; }
  .primary-button, .secondary-button { width: 100%; justify-content: center; }
  .nav-inner { padding: 0 0.75rem; }
  .nav-right { gap: 0.3rem; }
  .nav-button { padding: 0.4rem 0.7rem; font-size: 0.78rem; }
  .code-value { font-size: 1.8rem; }
  .win-modal-card { padding: 1.5rem; }
  .win-stats { gap: 1rem; }
  .win-stat-value { font-size: 1.6rem; }
  .difficulty-pills { gap: 0.35rem; }
  .difficulty-pill { padding: 0.5rem 0.8rem; font-size: 0.8rem; }
  .profile-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-panel { padding: 1.25rem; }
  .mode-tab { font-size: 0.78rem; padding: 0.55rem 0.5rem; }
  .new-game-panel { padding: 1.25rem; }
  .game-mode-tabs { gap: 0.25rem; }
}

/* Difficulty Colors */
body.difficulty-easy {
  --accent: #4ade80;
  --accent-strong: #22c55e;
}

body.difficulty-medium {
  --accent: #facc15;
  --accent-strong: #eab308;
}

body.difficulty-hard {
  --accent: #f97316;
  --accent-strong: #ea580c;
}

body.difficulty-expert {
  --accent: #991b1b;
  --accent-strong: #7f1d1d;
}

body.difficulty-ultra {
  --accent: #a855f7;
  --accent-strong: #9333ea;
}

@keyframes skull-fire {
  0% { text-shadow: 0 0 5px #ff0000, 0 0 10px #ff0000, 0 0 15px #ff7300, 0 0 20px #ff7300; }
  50% { text-shadow: 0 0 10px #ff0000, 0 0 20px #ff0000, 0 0 30px #ff7300, 0 0 40px #ff7300; }
  100% { text-shadow: 0 0 5px #ff0000, 0 0 10px #ff0000, 0 0 15px #ff7300, 0 0 20px #ff7300; }
}

.skull-animation {
  display: none;
  font-size: 2rem;
  margin-left: 0.5rem;
  animation: skull-fire 1s infinite alternate;
}

body.difficulty-ultra .skull-animation {
  display: inline-block;
}

@keyframes vibrate {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

.skull-animation:hover {
  animation: skull-fire 1s infinite alternate, vibrate 0.1s linear infinite both;
}

/* Wikipedia Dark Mode Overrides */
.article-content table,
.article-content .wikitable,
.article-content .infobox,
.article-content .navbox,
.article-content th,
.article-content td,
.article-content .navbox-title,
.article-content .navbox-group,
.article-content .navbox-abovebelow {
  background: #2a2a2a !important;
  background-color: #2a2a2a !important;
  color: #e0e0e0 !important;
  border-color: #444 !important;
}

.article-content tr:nth-child(even) td {
  background-color: #333 !important;
}

.article-content [style*="background"] {
  background-color: #2a2a2a !important;
  background: #2a2a2a !important;
}

.article-content [style*="color"] {
  color: #e0e0e0 !important;
}

.article-content a {
  color: var(--link) !important;
}
.article-content a:hover {
  color: var(--link-hover) !important;
}

/* Toggle Switch CSS */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .toggle-slider {
  background-color: #2196F3;
}
input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

/* Difficulty and Modifiers Container - Beat Saber Theme */
.difficulty-modifiers-container {
  display: flex;
  gap: 2rem;
  align-items: stretch;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.modificator-box {
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(10, 10, 12, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.modificator-box:hover {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.modifier-glow {
  border-color: rgba(115, 226, 167, 0.3);
  box-shadow: 0 0 20px rgba(115, 226, 167, 0.1), inset 0 0 10px rgba(115, 226, 167, 0.05);
}

.modifier-glow:hover {
  border-color: rgba(115, 226, 167, 0.6);
  box-shadow: 0 0 25px rgba(115, 226, 167, 0.2), inset 0 0 15px rgba(115, 226, 167, 0.1);
}

.difficulty-pills {
  margin-top: 0.75rem;
}

#difficulty-description {
  margin-top: 1rem;
  font-style: italic;
  opacity: 0.8;
}

.modifier-toggles {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 1;
}

.modifier-label {
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* Make toggle look like Beat Saber neon */
.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, #73e2a7, #34d399);
  box-shadow: 0 0 10px rgba(115, 226, 167, 0.6);
}


/* ───── Section title ───── */
.section-title {
  font-size: 1.25rem;
  margin: 1.6rem 0 1rem;
  font-family: var(--font-display);
}

/* ───── Game Mode Selection ───── */
.game-modes { margin-top: 2rem; animation: fadeInUp 0.6s ease-out 0.05s both; }
.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  text-align: left;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  color: var(--text);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  cursor: pointer;
}
.mode-card.active, .mode-card:hover {
  transform: translateY(-4px);
  border-color: rgba(242, 201, 76, 0.35);
  box-shadow: 0 26px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(242,201,76,0.1);
}
.mode-card--party.active, .mode-card--party:hover { border-color: rgba(242, 201, 76, 0.5); }
.mode-name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; pointer-events: none; }
.mode-desc { font-size: 0.85rem; color: var(--muted); line-height: 1.45; pointer-events: none; }

@media (max-width: 900px) {
  .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .mode-grid { grid-template-columns: 1fr; }
}

/* ───── Custom setup (flat — sits directly on the page background) ───── */
.custom-setup {
  margin-top: 0.25rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeInUp 0.4s ease-out;
}
.custom-route-fields {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.25rem;
  align-items: start;
}
.custom-route-fields .input-group { gap: 0.5rem; }
.custom-route-arrow {
  align-self: center;
  margin-top: 1.4rem;
  font-size: 1.6rem;
  color: var(--accent);
  font-weight: 700;
}
@media (max-width: 600px) {
  .custom-route-fields { grid-template-columns: 1fr; }
  .custom-route-arrow { margin: 0; transform: rotate(90deg); justify-self: center; }
}
.input-group { display: flex; flex-direction: column; gap: 0.5rem; }
.input-group label { font-weight: 600; color: var(--muted); font-size: 0.9rem; text-align: left; }
.input-group input {
  padding: 0.75rem 1rem;
  border: 2px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(15,20,29,0.9);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242,201,76,0.15); }
.input-group input::placeholder { color: rgba(244,240,232,0.3); }

#difficulty-section {
  margin-top: 2rem;
}
#custom-setup-section {
  margin-top: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.custom-actions { display: flex; justify-content: center; gap: 1rem; }

/* ───── Admin Overlay ───── */
.admin-formula {
  font-family: var(--font-display);
  font-size: 1.4rem;
  text-align: center;
  color: var(--text);
  margin: 0.25rem 0 0.5rem;
}
.admin-formula sub { font-size: 0.6em; }
.admin-formula-note {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}
.admin-field { display: flex; flex-direction: column; gap: 0.4rem; }
.admin-field span { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.admin-field input {
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(15,20,29,0.9);
  color: var(--text);
  font-size: 1rem;
}
.admin-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242,201,76,0.15);
}
.admin-preview {
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.admin-preview #admin-preview-value {
  font-weight: 800;
  color: var(--accent);
  font-size: 1.15rem;
}
.admin-preview-note { font-size: 0.8rem; }
.admin-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ───── Busy buttons (game start / room actions) ───── */
.primary-button.is-busy,
.secondary-button.is-busy,
.nav-button.is-busy {
  opacity: 0.6;
  cursor: progress;
}

/* ───── Party Spectator Screen ───── */
.spectator-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #0d0f1a);
  overflow-y: auto;
  padding: 2rem 1rem;
}
.spectator-overlay.hidden {
  display: none;
}
.spectator-box {
  width: 100%;
  max-width: 680px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  padding: 2rem 1.75rem;
  animation: fadeInUp 0.35s ease-out;
}
.spectator-head {
  text-align: center;
  margin-bottom: 1.75rem;
}
.spectator-trophy {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}
.spectator-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 0.35rem;
}
.spectator-subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
}
.spectator-players {
  margin-top: 1rem;
}
.spectator-section-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 1rem;
}
.spectator-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.7rem;
}
.spectator-player-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md, 12px);
  transition: border-color 0.2s, background 0.2s;
}
.spectator-player-item.is-finished {
  border-color: rgba(242, 201, 76, 0.3);
  background: rgba(242, 201, 76, 0.06);
}
.spectator-player-item.is-me {
  border-color: rgba(100, 108, 255, 0.4);
}
.spectator-rank {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 800;
}
.spectator-player-info {
  flex: 1;
  text-align: left;
  min-width: 0;
}
.spectator-player-toprow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.spectator-player-name {
  font-weight: 700;
  color: var(--text);
  font-size: 0.98rem;
}
.spectator-player-status {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.spectator-player-status.finished {
  color: var(--accent);
  font-weight: 700;
}
.spectator-player-current {
  display: block;
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 0.25rem;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spectator-player-path {
  font-size: 0.76rem;
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  color: var(--muted);
  line-height: 1.5;
  word-break: break-word;
}

/* ═══ Daily Challenge ═══ */
.mode-card--daily .mode-name::before {
  content: "📅 ";
}
/* Route/party detail modals open from *within* the profile overlay (z 210),
   so they must sit above it. */
#route-modal,
#party-players-modal {
  z-index: 300;
}

.daily-setup {
  text-align: center;
}
.daily-setup .daily-badge {
  margin-bottom: 0.5rem;
}
.daily-setup .mode-intro {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}
.daily-note {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  margin: 0.25rem 0 0.75rem;
}

/* ═══ History action buttons (route view / party players) ═══ */
.history-route-cell {
  font-size: 0.82rem;
  color: var(--muted);
}
.history-route-text {
  display: block;
  margin-bottom: 0.35rem;
}
.history-action-btn {
  display: inline-block;
  margin: 0.15rem 0.35rem 0.15rem 0;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.history-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
}
.history-action-btn--party {
  color: var(--accent);
}

