* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4efe6;
  --bg-alt: #ebe4d2;
  --ink: #262610;
  --ink-soft: #36361a;
  --muted: #6b6157;
  --accent: #b54614;
  --accent-soft: #d6a87e;
  --rule: #c8c0ad;
  --green: #4a6b3e;
  --red: #a83232;
  --amber: #b88019;
  --header-h: 60px;
  --sidebar-w: 300px;
}

html, body { height: 100%; }

body {
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.screen { min-height: 100vh; }
.hidden { display: none !important; }

.banner {
  background: var(--accent);
  color: var(--bg);
  padding: clamp(0.3rem, 0.5vw, 0.45rem) clamp(0.8rem, 1.5vw, 1.4rem);
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.5rem, 0.65vw, 0.7rem);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  text-align: center;
  border-radius: 999px;
  width: clamp(200px, 43vw, 660px);
  max-width: calc(100% - 4rem);
  box-shadow: 0 2px 14px rgba(181,70,20,0.25);
  position: absolute;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
}
.banner strong { color: white; font-weight: 600; margin-right: 0.4rem; letter-spacing: 0.08em; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-thickness: 2px; }

::selection { background: var(--ink); color: var(--bg); }

/* ---------- Login ---------- */
#login-screen {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 1.25rem;
  padding: 1.25rem;
  min-height: 100vh;
  background: var(--rule);
  box-sizing: border-box;
}

/* ---- Left branding panel ---- */
.login-left {
  background: var(--bg-alt);
  padding: 3.5rem 3.5rem 3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  border-top: 3px solid var(--accent);
  box-shadow: 0 2px 16px rgba(38,38,16,0.07);
}
.login-left::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 60%, rgba(181,70,20,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.login-left::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(38,38,16,0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}
.login-left-body {
  position: relative;
  z-index: 1;
  animation: fadeLeft 0.7s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes fadeLeft {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}
.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(181,70,20,0.3);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  margin-bottom: 3rem;
  width: fit-content;
  background: rgba(181,70,20,0.06);
}
.login-badge::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
  flex-shrink: 0;
}
.login-left h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: clamp(3.5rem, 7vw, 6.5rem);
  line-height: 0.88;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}
.login-left h1 em {
  font-style: italic;
  color: var(--accent);
}
.login-left .tagline {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 26ch;
  position: relative;
  z-index: 1;
  padding: 0.75rem 1.1rem;
  background: rgba(181,70,20,0.05);
  border: 1px solid rgba(181,70,20,0.12);
  border-radius: 1.25rem;
}
.login-left-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  position: relative;
  z-index: 1;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  animation: fadeLeft 0.7s 0.15s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.login-left-footer span,
.login-left-footer button {
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.login-left-footer button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* ---- Right form panel ---- */
.login-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 5rem;
  background: var(--bg-alt);
  background-image:
    radial-gradient(ellipse at 70% 40%, rgba(181,70,20,0.05) 0%, transparent 60%),
    radial-gradient(circle, rgba(38,38,16,0.06) 1px, transparent 1px);
  background-size: auto, 28px 28px;
  border-radius: 1.5rem;
  border-top: 3px solid var(--accent);
  box-shadow: 0 2px 16px rgba(38,38,16,0.07);
  position: relative;
  overflow: hidden;
}
.login-card {
  width: clamp(300px, 45vw, 700px);
  animation: fadeUp 0.55s 0.1s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-intro {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 2rem;
  line-height: 1.5;
  padding: 0.75rem 1.1rem;
  background: rgba(181,70,20,0.05);
  border: 1px solid rgba(181,70,20,0.12);
  border-radius: 1.25rem;
}

/* ---------- Login circle ---------- */
@keyframes orb-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 1.5px rgba(181,70,20,0.65),
      0 0 0 4px rgba(181,70,20,0.06),
      0 0 0 5px rgba(181,70,20,0.22),
      0 0 50px rgba(181,70,20,0.16),
      0 0 100px rgba(181,70,20,0.06);
  }
  50% {
    box-shadow:
      0 0 0 1.5px rgba(181,70,20,0.9),
      0 0 0 4px rgba(181,70,20,0.1),
      0 0 0 5px rgba(181,70,20,0.38),
      0 0 70px rgba(181,70,20,0.26),
      0 0 130px rgba(181,70,20,0.1);
  }
}

.login-circle {
  position: relative;
  width: 100%;
  margin: 1.5rem auto 0;
  border-radius: 2.5rem;
  background: rgba(30, 28, 26, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 2.75rem 3rem;
  overflow: hidden;
  animation: fadeUp 0.55s 0.1s cubic-bezier(0.4, 0, 0.2, 1) both,
             orb-pulse 4.5s 0.7s ease-in-out infinite;
}

/* Inner inset ring */
.login-circle::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 2rem;
  border: 1px solid rgba(181,70,20,0.1);
  pointer-events: none;
  z-index: 0;
}

/* Dot grid */
.login-circle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 2.5rem;
  background-image: radial-gradient(circle, rgba(244,239,230,0.04) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 0;
}

/* Handle row inside circle */
.circle-handle {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid rgba(244,239,230,0.1);
  position: relative;
  z-index: 1;
}
.circle-handle label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-soft);
  background: rgba(181,70,20,0.18);
  border: 1px solid rgba(181,70,20,0.35);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.circle-handle input {
  flex: 1;
  background: rgba(244,239,230,0.05);
  border: 1px solid rgba(244,239,230,0.08);
  border-radius: 0.6rem;
  padding: 0.4rem 0.75rem;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.2rem;
  color: var(--bg);
  outline: none;
  letter-spacing: -0.01em;
  min-width: 0;
  transition: background 0.15s, border-color 0.15s;
}
.circle-handle input:focus {
  background: rgba(244,239,230,0.09);
  border-color: rgba(181,70,20,0.4);
}
.circle-handle input::placeholder { color: rgba(244,239,230,0.18); font-style: italic; }
.circle-handle:focus-within label { color: var(--bg); background: rgba(181,70,20,0.35); }

/* Separator */
.circle-sep {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.6rem 0 0.4rem;
  position: relative;
  z-index: 1;
}
.circle-sep::before,
.circle-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(181,70,20,0.3);
}
.circle-sep span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: rgba(214,168,126,0.9);
  background: rgba(181,70,20,0.22);
  border: 1px solid rgba(181,70,20,0.4);
  border-radius: 999px;
  padding: 0.18rem 0.65rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Email row inside circle */
.circle-auth-section { position: relative; z-index: 1; }
.circle-email-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.3rem 0 0.6rem;
}
.circle-email-row label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-soft);
  background: rgba(181,70,20,0.18);
  border: 1px solid rgba(181,70,20,0.35);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.circle-email-row input {
  flex: 1;
  background: rgba(244,239,230,0.05);
  border: 1px solid rgba(244,239,230,0.08);
  border-radius: 0.6rem;
  padding: 0.4rem 0.75rem;
  font-family: 'Inter Tight', sans-serif;
  font-size: 1rem;
  color: var(--bg);
  outline: none;
  min-width: 0;
  transition: background 0.15s, border-color 0.15s;
}
.circle-email-row input:focus {
  background: rgba(244,239,230,0.09);
  border-color: rgba(181,70,20,0.4);
}
.circle-email-row input::placeholder { color: rgba(244,239,230,0.2); font-style: italic; }
.circle-email-row:focus-within label { color: var(--bg); background: rgba(181,70,20,0.35); }

/* Toggle row */
.login-toggle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding-top: 0.65rem;
  position: relative;
  z-index: 1;
}
.toggle-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(244,239,230,0.3);
  transition: color 0.2s;
  user-select: none;
}
.toggle-label.toggle-active { color: var(--accent-soft); }

.toggle-switch {
  position: relative;
  display: inline-block;
  cursor: pointer;
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-track {
  display: block;
  width: 2.8rem;
  height: 1.4rem;
  background: rgba(181,70,20,0.25);
  border: 1.5px solid rgba(181,70,20,0.45);
  border-radius: 999px;
  position: relative;
  transition: background 0.25s, border-color 0.25s;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.4rem - 8px);
  height: calc(1.4rem - 8px);
  background: var(--accent-soft);
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s;
  box-shadow: 0 0 6px rgba(181,70,20,0.4);
}
.toggle-switch input:checked + .toggle-track { background: rgba(181,70,20,0.35); border-color: var(--accent-soft); }
.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(1.4rem);
  background: var(--bg);
  box-shadow: 0 0 8px rgba(181,70,20,0.5);
}

/* Code rows inside circle */
.circle-codes { position: relative; z-index: 1; }

.code-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.42rem 0;
  border-bottom: 1px solid rgba(244,239,230,0.05);
}
.code-row:last-child { border-bottom: none; }
.code-row-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: var(--accent);
  font-weight: 500;
  min-width: 1.4rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.code-step {
  flex: 1;
  font-size: 0.78rem;
  color: rgba(244,239,230,0.92);
  line-height: 1.3;
  min-width: 0;
}
.code-step em { color: rgba(244,239,230,0.55); font-style: normal; }
.code-part {
  flex-shrink: 0;
  width: 3rem;
  border: 1.5px solid rgba(181,70,20,0.5);
  border-radius: 0.6rem;
  background: rgba(244,239,230,0.05);
  padding: 0.35rem 0.4rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  text-align: center;
  outline: none;
  color: var(--accent-soft);
  letter-spacing: 0.08em;
  box-shadow: 0 0 5px rgba(181,70,20,0.15), inset 0 0 4px rgba(181,70,20,0.06);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.code-part:focus {
  border-color: var(--accent-soft);
  box-shadow: 0 0 14px rgba(181,70,20,0.5), inset 0 0 7px rgba(181,70,20,0.18);
}
.code-part::placeholder { color: rgba(181,70,20,0.55); }

/* Footer inside circle */
.code-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0 0;
  border-top: 1px solid rgba(244,239,230,0.07);
  margin-top: 0.55rem;
  position: relative;
  z-index: 1;
}
.code-preview-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: rgba(244,239,230,0.6);
  letter-spacing: 0.04em;
}
.code-preview-label strong {
  display: inline-block;
  color: var(--accent-soft);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  margin-left: 0.4rem;
  padding: 0.15rem 0.65rem;
  border: 1px solid rgba(181,70,20,0.4);
  border-radius: 999px;
  box-shadow: 0 0 5px rgba(181,70,20,0.2);
  text-transform: none;
}
#login-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 12px rgba(181,70,20,0.3);
}
#login-btn:hover {
  background: rgba(38,38,16,0.9);
  transform: translateX(3px);
  box-shadow: 0 2px 18px rgba(38,38,16,0.25);
}

/* ---------- Header ---------- */
#game-screen {
  background: var(--rule);
  padding: 1.25rem;
  height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(0.75rem, 1.5vw, 1.5rem) 0 clamp(1rem, 2vw, 2rem);
  border-bottom: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 1.5rem 1.5rem 0 0;
  background: var(--bg);
  box-shadow: 0 2px 16px rgba(38,38,16,0.07);
  position: relative;
  z-index: 10;
  min-height: var(--header-h);
  flex-shrink: 0;
  gap: 0.5rem;
}
.brand-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-self: start;
}

.brand {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  align-self: center;
}
.brand em { color: var(--accent); font-style: normal; font-weight: 500; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: end;
}

.stats-bar {
  display: flex;
  align-items: center;
  gap: clamp(0.2rem, 0.4vw, 0.5rem);
  justify-self: center;
}
.stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.4rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  min-width: 80px;
}
.stat .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 2px;
}
.stat .value {
  font-family: 'JetBrains Mono', monospace;
  font-feature-settings: 'tnum';
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
}
.stat.progress { display: none; }
.progress-bar {
  width: 100%;
  height: 3px;
  background: var(--rule);
  margin-top: 6px;
  border-radius: 999px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.ghost-btn {
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  color: var(--ink);
  align-self: center;
  margin-left: 0.85rem;
}
.ghost-btn:hover, .ghost-btn.active { background: var(--ink); color: var(--bg); }
.ghost-btn.active { border-color: var(--ink); }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
  gap: 0;
  transition: grid-template-columns 0.25s ease;
  background: var(--bg);
  border-radius: 0 0 1.5rem 1.5rem;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(38,38,16,0.07);
  flex: 1;
  min-height: 0;
}
body.sidebar-collapsed .layout { grid-template-columns: minmax(0, 1fr) 0; }
body.sidebar-collapsed #sidebar { display: none; }

.game-area {
  padding: 2rem 5rem 4rem 3rem;
  border-right: 1px solid var(--rule);
  overflow-y: auto;
  height: 100%;
}
body.sidebar-collapsed .game-area { border-right: none; }

.card {
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Pair header (sticky) ---------- */
.pair-header {
  background: var(--bg);
  padding: 1rem 1.5rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 1.5rem 1.5rem 0 0;
  border-bottom: none;
  margin-bottom: 0;
}

.pair-body {
  border: 1px solid var(--rule);
  border-radius: 0 0 1.5rem 1.5rem;
  padding: 0 1.5rem 1.5rem;
  margin-bottom: 1rem;
  background: var(--bg);
}

.pair-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.pair-meta .meta-item b {
  color: var(--ink);
  font-weight: 500;
  margin-left: 0.25rem;
}
.pair-meta .onboarding-tag {
  background: var(--accent);
  color: var(--bg);
  padding: 0.18rem 0.65rem;
  letter-spacing: 0.18em;
  border-radius: 999px;
}
.pair-meta .hard-tag {
  background: var(--ink);
  color: var(--bg);
  padding: 0.18rem 0.65rem;
  letter-spacing: 0.18em;
  border-radius: 999px;
}

.skip-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  color: var(--muted);
}
.skip-btn:hover { background: var(--bg-alt); color: var(--ink); border-color: var(--ink); }

#pair-card h2, #onb-card h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.55rem, 2.4vw, 2.05rem);
  line-height: 1.18;
  letter-spacing: -0.015em;
  margin-bottom: 0.5rem;
  width: 100%;
}
.authors {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  color: var(--ink-soft);
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
  margin-bottom: 0.85rem;
  width: 100%;
}
.abstract-block { display: flex; flex-direction: column; gap: 0.4rem; width: 100%; margin: 0.5rem 0; }
.abstract {
  font-size: clamp(0.85rem, 1.4vw, 1.05rem);
  line-height: 1.55;
  max-height: 4.65em;
  overflow: hidden;
  padding: 0.85rem 1.2rem;
  border: 1px solid var(--ink);
  border-radius: 0.75rem;
  color: var(--ink-soft);
  position: relative;
  transition: max-height 0.35s ease;
  width: 100%;
}
.abstract.expanded {
  max-height: 20vh;
  overflow-y: auto;
}
.abstract:not(.expanded)::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2.5em;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
  border-radius: 0 0 0.75rem 0.75rem;
}
.abstract.muted-empty { color: var(--muted); font-style: italic; border-color: var(--rule); }
.abstract.expanded::-webkit-scrollbar { width: 3px; }
.abstract.expanded::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 999px; }
.abstract-toggle {
  margin-top: 0.6rem;
  align-self: center;
}
.abstract-edit {
  width: 100%;
  font-family: 'Inter Tight', sans-serif;
  font-size: 0.93rem;
  line-height: 1.55;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--ink);
  border-radius: 0.75rem;
  background: var(--bg-alt);
  resize: vertical;
  min-height: 140px;
  outline: none;
}
.abstract-tools {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  flex-wrap: wrap;
}
.abstract-tools-spacer { flex: 1; }
.link-btn {
  background: transparent;
  border: none;
  padding: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { text-decoration-thickness: 2px; }
.link-btn.small { font-size: 0.66rem; margin-top: 0.4rem; }

.oa-lock {
  display: inline-block;
  font-size: 0.85em;
  margin-right: 2px;
  vertical-align: baseline;
  filter: grayscale(0.3);
}
.oa-lock.gated { opacity: 0.65; }
.abstract-tools a,
.abstract-tools .link-btn,
.abstract-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0.4rem 0.85rem;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.abstract-tools a:hover,
.abstract-tools .link-btn:hover,
.abstract-toggle:hover { background: var(--ink); color: var(--bg); text-decoration: none; }
.original-info .meta a { white-space: nowrap; }

/* ---------- Split layout ---------- */
.card.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  align-items: stretch;
}
.card.split-layout .pair-header,
.card.split-layout .pair-body {
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
}
.card.split-layout .pair-header {
  border-radius: 1.5rem 0 0 1.5rem;
  border-right: none;
  border-bottom: 1px solid var(--rule); /* restore bottom border for side-by-side */
  margin-bottom: 0;
  overflow-y: auto;
}
.card.split-layout .pair-header .abstract.expanded {
  max-height: none;
  overflow: visible;
}
.card.split-layout .pair-body {
  border-radius: 0 1.5rem 1.5rem 0;
  border-top: 1px solid var(--rule); /* restore top border for side-by-side */
  margin-bottom: 0;
  padding: 1rem 1.5rem 1.5rem;
  background: var(--bg);
}
/* In onboarding the card has no border of its own */
#onb-card.split-layout { border: none; gap: 0; }

/* ---------- Pair body ---------- */

/* Gates */
.gate {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.gate:first-of-type { margin-top: 0.5rem; padding-top: 0.25rem; border-top: none; }
.gate h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  letter-spacing: -0.01em;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.gate-num {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
  font-size: 0.9rem;
  font-feature-settings: 'lnum';
}
.gate .question {
  color: var(--muted);
  margin-bottom: 1rem;
  font-size: clamp(0.82rem, 1.3vw, 1rem);
  width: 100%;
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
}

/* ---------- Gate accordion ---------- */
.gate-header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.gate-answered .gate-header-row { cursor: pointer; }
.gate-answered .gate-header-row:hover h3 { color: var(--accent); }
.gate-answered h3 { font-size: 1.15rem; margin-bottom: 0; transition: color 0.15s; }
.gate-answered .gate-body { display: none; }
.gate-answered .gate-body.open { display: block; }
.gate-answered { padding-bottom: 0.5rem; }
.gate-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  color: var(--bg);
  background: var(--ink);
}
.gate-chip.success { background: var(--green); }
.gate-chip.danger { background: var(--red); }
.gate-chip.warn { background: var(--amber); }
.gate-change-btn { margin-left: auto; font-size: 0.65rem; letter-spacing: 0.06em; }

.choices {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  border: 1px solid var(--ink);
  border-radius: 0.75rem;
  overflow: hidden;
  width: 100%;
}
.choice {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 0.95rem 1.2rem;
  background: transparent;
  border: none;
  border-right: 1px solid var(--ink);
  cursor: pointer;
  font-family: 'Inter Tight', sans-serif;
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  min-width: 130px;
  transition: background 0.12s;
}
.choice:last-child { border-right: none; }
.choice small {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 400;
}
.choice:hover { background: var(--bg-alt); }
.choice.selected {
  background: var(--ink);
  color: var(--bg);
}
.choice.selected small { color: var(--accent-soft); }
.choice.danger.selected { background: var(--red); }
.choice.success.selected { background: var(--green); }
.choice.warn.selected { background: var(--amber); }
.choice.danger.selected small,
.choice.success.selected small,
.choice.warn.selected small { color: rgba(244, 239, 230, 0.7); }

.small-choices .choice { padding: 0.6rem 0.9rem; font-size: 0.9rem; min-width: 100px; }

/* Original / outcome info */
.original-info {
  border-left: 2px solid var(--accent);
  padding: 0.2rem 0 0.2rem 1.25rem;
  margin-bottom: 1.25rem;
  max-width: 65ch;
}
.original-info .title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: 1.1rem;
  line-height: 1.3;
  margin-bottom: 0.35rem;
}
.original-info .meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.original-info .meta a { color: var(--accent); }
.original-info .evidence {
  margin-top: 0.6rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  line-height: 1.5;
}

.outcome-info {
  background: var(--bg-alt);
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.25rem;
  max-width: 65ch;
  border-radius: 0.75rem;
}
.outcome-label {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 3px 9px;
  font-weight: 500;
  margin-bottom: 0.7rem;
  border: 1px solid currentColor;
  border-radius: 999px;
}
.outcome-label.replication, .outcome-label.reproduction, .outcome-label.success { color: var(--green); }
.question .outcome-label { margin-bottom: 0; vertical-align: middle; }
.outcome-label.failed, .outcome-label.failure { color: var(--red); }
.outcome-label.mixed { color: var(--amber); }
.outcome-label.uninformative {
  color: var(--accent);
  border-style: dashed;
  background: rgba(181, 70, 20, 0.08);
  letter-spacing: 0.16em;
}
.outcome-label.uninformative::before {
  content: "⚠ ";
  margin-right: 2px;
  letter-spacing: normal;
}

.outcome-quote {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.5;
  border-left: 2px solid var(--ink);
  padding: 0.1rem 0 0.1rem 1rem;
  margin: 0.5rem 0 0.4rem;
  color: var(--ink);
}
.outcome-quote-edit {
  width: 100%;
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--ink);
  border-radius: 0.75rem;
  background: var(--bg);
  resize: vertical;
  outline: none;
  margin: 0.5rem 0 0.4rem;
}

.note-section {
  margin-top: 1.5rem;
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
  width: 100%;
}
.note-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.75rem 1.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.note-toggle:hover { background: var(--ink); color: var(--bg); }
.note-toggle-icon { font-style: normal; font-size: 1rem; line-height: 1; }
.note-pts { color: var(--accent); }
.note-body { margin-top: 0.75rem; }

textarea.comment {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--ink);
  border-radius: 0.75rem;
  background: transparent;
  font-family: 'Inter Tight', sans-serif;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 80px;
  outline: none;
  color: var(--ink);
}
textarea.comment::placeholder { color: var(--muted); font-style: italic; }
textarea.comment:focus { background: var(--bg-alt); }

.actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  width: 100%;
  justify-content: space-between;
}
.shortcut-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border: none;
  padding: 0.85rem 1.75rem;
  border-radius: 999px;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) { background: var(--accent); }
.btn-primary:disabled { opacity: 0.25; cursor: not-allowed; }

/* Done screen */
#done-screen { padding: 4rem 0; }
#done-screen h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 3rem;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
#done-screen p { font-size: 1.1rem; color: var(--ink-soft); max-width: 50ch; }

/* ---------- Hard mode form ---------- */
.hard-form { display: flex; flex-direction: column; gap: 1rem; max-width: 65ch; }
.hard-row { display: flex; flex-direction: column; gap: 0.35rem; }
.hard-row label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.hard-row label small {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 0.4rem;
}
.hard-row input, .hard-row textarea {
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  background: var(--bg);
  padding: 0.55rem 0.75rem;
  font-family: 'Inter Tight', sans-serif;
  font-size: 0.95rem;
  outline: none;
  color: var(--ink);
}
.hard-row input:focus, .hard-row textarea:focus { border-color: var(--ink); background: var(--bg-alt); }
.hard-row.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
.hard-row.two-col > div { display: flex; flex-direction: column; gap: 0.35mm; }
.hard-row.two-col label { margin-bottom: 0.35rem; }

/* ---------- Onboarding screen ---------- */
#onboarding-screen {
  background: var(--rule);
  padding: 1.25rem;
  min-height: 100vh;
  box-sizing: border-box;
}
.onboarding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem 0.75rem 2rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky;
  top: 1.25rem;
  z-index: 10;
  border-radius: 1.5rem 1.5rem 0 0;
  border-top: 3px solid var(--accent);
  box-shadow: 0 2px 16px rgba(38,38,16,0.07);
}
body:has(.banner:not(.hidden)) .onboarding-header { top: 2.6rem; }
.onboarding-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  margin: 0 2rem;
  max-width: 380px;
}
.onboarding-progress .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.onboarding-progress #onb-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--ink);
  font-feature-settings: 'tnum';
}
.onboarding-progress .progress-bar { flex: 1; }

.onboarding-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: calc(100vh - 7.5rem);
  padding: 2.5rem 3rem 4rem;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 70% 40%, rgba(100,110,130,0.09) 0%, transparent 60%),
    radial-gradient(circle, rgba(60,70,90,0.06) 1px, transparent 1px);
  background-size: auto, 28px 28px;
  border-radius: 0 0 1.5rem 1.5rem;
  box-shadow: 0 2px 16px rgba(38,38,16,0.07);
}
.onb-intro {
  width: clamp(300px, 50vw, 800px);
}
.onb-intro .login-circle {
  background: rgba(30, 28, 26, 0.45);
}
.onb-intro h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-style: italic;
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 1.25rem;
}
.onb-intro p {
  font-size: 1.25rem;
  color: var(--ink-soft);
  margin-bottom: 0.75rem;
  line-height: 1.55;
}
.onb-intro .btn-primary {
  margin-top: 1.5rem;
  display: block;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.onb-feedback { margin-top: 2rem; }
.feedback-card {
  border-top: 4px solid var(--green);
  background: var(--bg-alt);
  padding: 1.5rem 1.75rem;
  max-width: 65ch;
  border-radius: 1rem;
  animation: fadeIn 0.3s ease-out;
}
.feedback-card.incorrect { border-top-color: var(--red); }
.feedback-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 0.85rem;
  color: var(--green);
  font-weight: 600;
}
.feedback-card.incorrect .feedback-header { color: var(--red); }
.feedback-intro {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 0.85rem;
}
.feedback-list {
  list-style: none;
  border-top: 1px solid var(--rule);
  padding-top: 0.85rem;
  margin-top: 0.85rem;
}
.feedback-list li {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-soft);
  border-bottom: 1px dashed var(--rule);
}
.feedback-list li:last-child { border-bottom: none; }
.feedback-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 0.5rem;
  color: var(--accent);
  font-weight: 600;
}
.feedback-actions { margin-top: 1rem; display: flex; justify-content: flex-end; }

#onb-done {
  padding: 4rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
#onb-done h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 3rem;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
#onb-done p { font-size: 1.1rem; color: var(--ink-soft); max-width: 50ch; margin-bottom: 1.5rem; }

/* ---------- Leaderboard ---------- */
.leaderboard {
  padding: 2rem 1.75rem 2.5rem;
  position: sticky;
  top: var(--header-h);
  height: fit-content;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
body:has(.banner:not(.hidden)) .leaderboard { top: calc(var(--header-h) + 2.6rem); }
.sidebar-close {
  display: none;
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}
.sidebar-close:hover { color: var(--ink); }
.leaderboard h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-weight: 500;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.7rem;
}
.leaderboard ol { list-style: none; counter-reset: rank; }
.leaderboard ol > li {
  counter-increment: rank;
}
.leaderboard ol > li {
  display: grid;
  grid-template-columns: 1.75rem 1fr auto;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 0.92rem;
}
.leaderboard ol > li::before {
  content: counter(rank, decimal-leading-zero);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  font-feature-settings: 'tnum';
}
.leaderboard ol > li.me { color: var(--accent); }
.leaderboard ol > li.me::before { color: var(--accent); }
.lb-name {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1.02rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-pts {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  color: var(--muted);
  font-feature-settings: 'tnum';
  letter-spacing: 0.05em;
}
.leaderboard li.me .lb-pts { color: var(--accent); }

.legend {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.legend h4 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin-bottom: 0.8rem;
  font-weight: 500;
}
.legend ul { list-style: none; }
.legend li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  color: var(--ink-soft);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  gap: 0.5rem;
}
.legend li span { flex: 1; min-width: 0; line-height: 1.35; }
.legend li b {
  color: var(--ink);
  font-weight: 600;
  font-feature-settings: 'tnum';
  flex-shrink: 0;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: var(--ink);
  color: var(--bg);
  padding: 0.85rem 2rem;
  border-radius: 0 0 1.25rem 1.25rem;
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  z-index: 100;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  border-bottom: 3px solid var(--accent);
  display: flex;
  align-items: baseline;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast .num {
  font-family: 'JetBrains Mono', monospace;
  font-style: normal;
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--accent-soft);
  margin-right: 0.5rem;
  font-feature-settings: 'tnum';
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .leaderboard { display: none; position: static; max-height: none; }
  body.sidebar-open .leaderboard {
    display: block;
    position: fixed;
    top: var(--header-h);
    right: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--header-h));
    background: var(--bg);
    border-left: 1px solid var(--ink);
    z-index: 20;
    box-shadow: -8px 0 24px rgba(26, 22, 18, 0.08);
  }
  body.sidebar-open .sidebar-close { display: block; }
  .game-area { border-right: none; padding: 1.25rem 2.5rem 3rem; }
  .brand { font-size: 1rem; }
  .brand-group { gap: 0.4rem; }
  .stat { padding: 0.3rem 0.6rem; min-width: 58px; }
  .stat .label { font-size: 0.5rem; }
  .stat .value { font-size: 0.8rem; }
  .ghost-btn { padding: 0.35rem 0.6rem; font-size: 0.58rem; margin-left: 0; }
  .header-actions { gap: 0.3rem; }
}
@media (max-width: 860px) {
  .game-area { padding: 1rem 1.5rem 2.5rem; }
  .brand { font-size: 0.85rem; }
  .brand-group { gap: 0.3rem; }
  .stat { padding: 0.25rem 0.45rem; min-width: 44px; }
  .stat .label { display: none; }
  .stat .value { font-size: 0.75rem; }
  .ghost-btn { padding: 0.28rem 0.45rem; font-size: 0.54rem; letter-spacing: 0.06em; margin-left: 0; }
  .header-actions { gap: 0.2rem; }
  #login-screen {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }
  .login-left {
    padding: 3rem 2.5rem 2.5rem;
    min-height: auto;
  }
  .login-left h1 {
    font-size: clamp(2.8rem, 10vw, 4.5rem);
    margin-bottom: 1rem;
  }
  .login-badge { margin-bottom: 1.5rem; }
  .login-left .tagline { max-width: 38ch; }
  .login-right {
    padding: 3rem 2.5rem 4rem;
  }
}
@media (max-width: 760px) {
  .game-area, .onboarding-area { padding: 0.75rem 1rem 3rem; }
  /* Stack header into two rows on small screens */
  #game-screen header {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    min-height: auto;
    padding: 0.5rem 0.75rem;
    gap: 0.4rem;
  }
  .brand-group { grid-column: 1; grid-row: 1; justify-self: start; }
  .header-actions { grid-column: 2; grid-row: 1; justify-self: end; }
  .stats-bar {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    padding-bottom: 0.4rem;
    gap: 0.3rem;
  }
  .stat { padding: 0.25rem 0.5rem; min-width: auto; }
  .stat.progress { display: none; }
  .ghost-btn { display: none; }
  #logout-btn, #onb-logout-btn, #sidebar-toggle { display: inline-flex; }
  #login-screen { grid-template-columns: 1fr; padding: 0.75rem; gap: 0.75rem; }
  .login-left { padding: 2.5rem 1.75rem 2rem; border-radius: 1.25rem; }
  .login-right { padding: 2rem 1.5rem 3rem; border-radius: 1.25rem; }
  .login-card { width: 100%; }
  .login-circle { padding: 1.75rem 1.5rem; }
  .login-circle::before { inset: 8px; }
  .choices { flex-direction: column; }
  .choice { border-right: none; border-bottom: 1px solid var(--ink); }
  .choice:last-child { border-bottom: none; }
  header { padding: 0 1rem 0 1.25rem; }
  .pair-header { padding: 0.6rem 1rem 0.75rem; margin-bottom: 0.5rem; }
  .abstract.expanded { max-height: 10vh; }
  #game-screen { padding: 0.6rem; }
  .hard-row.two-col { grid-template-columns: 1fr; }
  .faq-panel { width: 100%; max-width: 100%; border-radius: 0; }
}


/* ---------- Guided tour ---------- */
.tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(38,38,16,0.6);
  z-index: 15;
  pointer-events: none;
}

.tour-highlight {
  position: relative !important;
  z-index: 16 !important;
  box-shadow: 0 0 0 3px var(--accent-soft), 0 4px 24px rgba(38,38,16,0.15) !important;
  border-radius: 1rem !important;
}

.tour-callout {
  position: fixed;
  z-index: 17;
  width: 320px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 1.25rem 1.5rem 1.25rem;
  box-shadow: 0 8px 32px rgba(38,38,16,0.22);
  pointer-events: auto;
}

.tour-step-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.tour-step-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.tour-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: 1.1rem;
  margin-bottom: 0.45rem;
  color: var(--ink);
}

.tour-body {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 1rem;
}
.tour-body em { color: var(--ink); font-style: normal; font-weight: 500; }

.tour-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.tour-dots { display: flex; gap: 5px; align-items: center; }

.tour-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rule);
  transition: background 0.2s, transform 0.2s;
}
.tour-dot.active { background: var(--accent); transform: scale(1.35); }

.tour-next { font-size: 0.85rem; padding: 0.5rem 1.1rem; }

/* ---------- FAQ modal overlay ---------- */
.faq-overlay {
  position: fixed;
  inset: 0;
  background: rgba(38,38,16,0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.faq-panel {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 14px;
  width: 100%;
  max-width: 740px;
  box-shadow: 0 8px 40px rgba(38,38,16,0.18);
  overflow: hidden;
}

.faq-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-alt);
}

.faq-panel-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.faq-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 0.2rem;
}
.faq-close:hover { color: var(--ink); }

.faq-body {
  padding: 1.8rem 2rem 2.2rem;
  max-height: 75vh;
  overflow-y: auto;
}

.faq-loading {
  color: var(--muted);
  font-style: italic;
}

.faq-error {
  color: var(--red);
}

/* Markdown content styling inside the FAQ panel */
.faq-body h1 { font-family: 'Fraunces', Georgia, serif; font-size: 1.6rem; margin-bottom: 1rem; }
.faq-body h2 { font-family: 'Fraunces', Georgia, serif; font-size: 1.2rem; margin-top: 2rem; margin-bottom: 0.6rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--rule); }
.faq-body h3 { font-size: 0.95rem; font-weight: 600; margin-top: 1.4rem; margin-bottom: 0.35rem; }
.faq-body p { margin-bottom: 0.85rem; color: var(--ink-soft); }
.faq-body ul, .faq-body ol { padding-left: 1.4rem; margin-bottom: 0.85rem; }
.faq-body li { margin-bottom: 0.3rem; color: var(--ink-soft); }
.faq-body a { color: var(--accent); }
.faq-body code { font-family: 'JetBrains Mono', monospace; font-size: 0.82em; background: var(--bg-alt); padding: 0.1em 0.4em; border-radius: 4px; }
.faq-body pre { background: var(--bg-alt); border: 1px solid var(--rule); border-radius: 8px; padding: 1rem; overflow-x: auto; margin-bottom: 0.85rem; }
.faq-body pre code { background: none; padding: 0; }
.faq-body blockquote { border-left: 3px solid var(--accent-soft); padding-left: 1rem; margin: 0.8rem 0; color: var(--muted); font-style: italic; }
.faq-body hr { border: none; border-top: 1px solid var(--rule); margin: 1.5rem 0; }
.faq-body strong { color: var(--ink); }

/* ============================================================
   ADMIN PANEL
   ============================================================ */

/* Screen */
#admin-screen { display: flex; flex-direction: column; min-height: 100vh; }

.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.admin-body {
  flex: 1;
  padding: 1.5rem 2rem 3rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* Filter tabs */
.admin-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.admin-filter-btn {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.admin-filter-btn:hover { border-color: var(--accent-soft); color: var(--ink); }
.admin-filter-btn.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.admin-filter-btn.active .filter-count { color: rgba(255,255,255,0.8); }

.filter-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Table */
.admin-table-wrap {
  border: 1px solid var(--rule);
  border-radius: 1rem;
  overflow: hidden;
  background: var(--bg);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table thead th {
  text-align: left;
  padding: 0.6rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  background: var(--bg-alt);
}

.admin-table tbody tr {
  border-bottom: 1px solid var(--rule);
  transition: background 0.1s;
}
.admin-table tbody tr:last-child { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--bg-alt); }

.admin-table td {
  padding: 0.55rem 0.85rem;
  vertical-align: middle;
  color: var(--ink);
}

.admin-cell-num  { color: var(--muted); font-size: 0.78rem; width: 2.5rem; }
.admin-cell-study { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-cell-validators { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--muted); }

.admin-loading { text-align: center; padding: 2rem; color: var(--muted); }
.admin-empty   { text-align: center; padding: 2rem; color: var(--muted); }

/* Status badges */
.admin-status {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.status-unvalidated  { background: var(--bg-alt); color: var(--muted); border: 1px solid var(--rule); }
.status-inprogress   { background: #fdf3e0; color: var(--amber); border: 1px solid var(--amber); }
.status-validated    { background: #eaf2e8; color: var(--green); border: 1px solid var(--green); }
.status-review       { background: #fde8e8; color: var(--red);   border: 1px solid var(--red); }

/* Flags */
.admin-flag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  margin-left: 0.3rem;
  vertical-align: middle;
}
.flag-llm   { background: #fde8e8; color: var(--red); }
.flag-tie   { background: #fdf3e0; color: var(--amber); }
.flag-admin { background: #eaf2e8; color: var(--green); }

/* Pagination */
.admin-pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.25rem;
}
.admin-page-info { font-size: 0.82rem; color: var(--muted); }

.admin-review-btn { padding: 0.25rem 0.65rem; font-size: 0.78rem; }

/* Detail modal panel */
.admin-detail-panel {
  background: var(--bg);
  border-radius: 1.5rem;
  width: 95vw;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(38,38,16,0.18);
}

.admin-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Two-column layout inside detail */
.admin-detail-cols {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
  align-items: start;
}

.admin-detail-pair { min-width: 0; }

/* Validator response cards */
.admin-val-cards { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.75rem; }

.admin-val-card {
  border: 1px solid var(--rule);
  border-radius: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg);
  font-size: 0.84rem;
}
.admin-val-empty { color: var(--muted); font-style: italic; }
.admin-val-label { font-weight: 600; margin-bottom: 0.3rem; color: var(--ink); }
.admin-val-checks { color: var(--ink-soft); }
.admin-val-corrections { margin-top: 0.3rem; color: var(--amber); font-size: 0.8rem; }
.admin-val-note { margin-top: 0.3rem; color: var(--muted); font-size: 0.8rem; font-style: italic; }
.admin-val-error { margin-top: 0.3rem; color: var(--red); font-size: 0.8rem; }

/* Resolution form */
.admin-resolve-form {
  position: sticky;
  top: 0;
  border: 1px solid var(--rule);
  border-radius: 1rem;
  padding: 1.25rem;
  background: var(--bg-alt);
}
.admin-resolve-form h3 { font-size: 1rem; margin-bottom: 0.3rem; }
.admin-resolve-hint { font-size: 0.82rem; color: var(--muted); margin-bottom: 1rem; }

.admin-form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.admin-select, .admin-input, .admin-textarea {
  width: 100%;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}
.admin-select:focus, .admin-input:focus, .admin-textarea:focus {
  outline: none;
  border-color: var(--accent-soft);
}
.admin-textarea { min-height: 70px; resize: vertical; }

.admin-resolve-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

.pair-abstract-details { margin-top: 0.5rem; font-size: 0.85rem; color: var(--muted); }
.pair-abstract-details summary { cursor: pointer; color: var(--accent); }
.pair-abstract-details p { margin-top: 0.4rem; line-height: 1.5; }
.pair-status-badge { font-size: 0.72rem; background: var(--bg-alt); border: 1px solid var(--rule); border-radius: 999px; padding: 0.1rem 0.5rem; color: var(--muted); }

@media (max-width: 860px) {
  .admin-detail-cols { grid-template-columns: 1fr; }
  .admin-resolve-form { position: static; }
  .admin-body { padding: 1rem 1rem 2rem; }
}
