/* Technocore Protocol Arena — deliberately single-theme (dark). This is a
 * CTF-style proving ground, not a document; committing to one dark,
 * terminal-adjacent look is the design choice, not a missing light mode. */
:root {
  --bg: #0a0d0f;
  --bg-panel: #12171a;
  --bg-raised: #171d21;
  --ink: #e7eae6;
  --muted: #98a3a8;
  --faint: #626d72;
  --line: #232b2f;
  --line-strong: #313c41;
  --accent: #f0873b;
  --accent-ink: #14181c;
  --verified: #2dd4bf;
  --verified-bg: #0f2624;
  --network: #38bdf8;
  --bad: #f87171;
  --bad-bg: #241414;
  --code-bg: #0d1114;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}
code, .mono {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
}
code {
  background: var(--code-bg);
  padding: 0.1em 0.4em;
  font-size: 0.87em;
  border-radius: 2px;
  border: 1px solid var(--line);
}
a { color: var(--network); }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page { max-width: 860px; margin: 0 auto; padding: 0 1.5rem 5rem; }

.prompt {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.6rem;
}
.demo-pill {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bad);
  border: 1px solid var(--bad);
  padding: 0.1em 0.5em;
  margin-left: 0.5em;
  vertical-align: middle;
}

/* --- top nav ------------------------------------------------------------ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: rgba(10, 13, 15, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topnav .brand {
  font-family: ui-monospace, monospace;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  font-size: 0.95rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.topnav .brand .slash { color: var(--accent); }
.topnav nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.topnav nav button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}
.topnav nav button:hover { color: var(--ink); }
.topnav nav button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* --- hero / dashboard ----------------------------------------------------*/
.hero {
  padding: 3rem 0 2.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2.5rem;
}
.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 1.4rem;
}
.net-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--network); box-shadow: 0 0 8px var(--network); animation: net-pulse 2.4s ease-in-out infinite; flex-shrink: 0; }
@keyframes net-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.hero-eyebrow .season { color: var(--accent); }

.hero h1 {
  font-family: ui-monospace, monospace;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  letter-spacing: 0.01em;
  margin: 0 0 1rem;
  text-wrap: balance;
  font-weight: 700;
}
.hero h1 .slash { color: var(--faint); }
.hero .tagline {
  font-size: clamp(1.3rem, 3.4vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 1.5rem;
  max-width: 26ch;
  text-wrap: balance;
}
.enter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  border: none;
  padding: 0.75rem 1.4rem;
  cursor: pointer;
  margin-bottom: 2rem;
}
.enter-btn:hover { filter: brightness(1.08); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stat-cell { background: var(--bg-panel); padding: 1rem 1.1rem; }
.stat-cell .n { font-family: ui-monospace, monospace; font-size: 1.5rem; font-weight: 700; color: var(--ink); display: block; }
.stat-cell .l { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.progress-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.25rem 0 0; }
.progress-chip {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  border: 1px solid var(--line-strong);
  background: var(--bg-panel);
  padding: 0.4rem 0.8rem;
}
.progress-chip b { color: var(--accent); }

section { margin: 2.75rem 0; }
section > h2 {
  font-family: ui-monospace, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0 0 1rem;
}
.lede { color: var(--muted); font-size: 0.94rem; max-width: 62ch; }

/* --- CORE mascot (renamed from "elder"; same lego-minifig silhouette) --- */
.host { display: flex; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; }
.elder { position: relative; width: 76px; height: 108px; flex-shrink: 0; animation: elder-bob 3.2s ease-in-out infinite; }
@keyframes elder-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.elder-stud { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); width: 18px; height: 9px; background: #b45309; border-radius: 3px 3px 0 0; }
.elder-head { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 52px; height: 52px; background: #2a3338; border-radius: 50%; box-shadow: inset 0 -6px 10px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.06); }
.elder-visor { position: absolute; top: 21px; left: 50%; transform: translateX(-50%); width: 34px; height: 9px; background: var(--network); border-radius: 3px; box-shadow: 0 0 6px var(--network); }
.elder-eye { position: absolute; top: 24px; width: 4px; height: 4px; background: #04202a; border-radius: 50%; animation: elder-blink 5.5s infinite; z-index: 1; }
.elder-eye.left { left: 20px; }
.elder-eye.right { right: 20px; }
@keyframes elder-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
.elder-brow, .elder-hair { display: none; }
.elder-mustache { position: absolute; top: 34px; left: 50%; transform: translateX(-50%); width: 22px; height: 5px; background: var(--faint); border-radius: 2px; transition: transform 0.15s ease; }
.elder.talking .elder-mustache { animation: elder-talk 0.4s ease-in-out 3; }
@keyframes elder-talk { 0%, 100% { transform: translateX(-50%) scaleY(1); } 50% { transform: translateX(-50%) scaleY(2); } }
.elder-torso { position: absolute; top: 46px; left: 50%; transform: translateX(-50%); width: 62px; height: 40px; background: var(--bg-raised); border: 1px solid var(--line-strong); clip-path: polygon(18% 0, 82% 0, 100% 100%, 0% 100%); }
.elder-emblem { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.elder-arm { position: absolute; top: 50px; width: 10px; height: 26px; background: var(--bg-raised); border: 1px solid var(--line-strong); border-radius: 4px; transform-origin: top center; }
.elder-arm.left { left: 6px; transform: rotate(10deg); }
.elder-arm.right { right: 6px; animation: elder-wave 4.6s ease-in-out infinite; }
@keyframes elder-wave { 0%, 80%, 100% { transform: rotate(-10deg); } 88% { transform: rotate(-45deg); } 94% { transform: rotate(-20deg); } }

.speech { position: relative; background: var(--bg-panel); border: 1px solid var(--line-strong); padding: 0.6rem 0.85rem; font-size: 0.85rem; color: var(--ink); max-width: 42ch; margin-bottom: 0.35rem; }
.speech .who { display: block; font-family: ui-monospace, monospace; font-size: 0.68rem; letter-spacing: 0.06em; color: var(--verified); margin-bottom: 0.2rem; }
.speech::after { content: ""; position: absolute; left: -7px; bottom: 14px; width: 12px; height: 12px; background: var(--bg-panel); border-left: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) {
  .elder, .elder-eye, .elder-arm.right, .elder-mustache, .net-dot { animation: none; }
}

/* --- challenge grid ------------------------------------------------------*/
.challenge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.challenge-card {
  background: var(--bg-panel);
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  cursor: pointer;
  border: none;
  text-align: left;
  color: inherit;
  font-family: inherit;
}
.challenge-card:hover { background: var(--bg-raised); }
.challenge-card:disabled { cursor: default; opacity: 0.55; }
.challenge-card .row1 { display: flex; justify-content: space-between; align-items: center; }
.challenge-card .cid { font-family: ui-monospace, monospace; color: var(--faint); font-size: 0.72rem; }
.challenge-card h3 { margin: 0; font-size: 1rem; letter-spacing: 0.01em; }
.challenge-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }
.challenge-card .row2 { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }

.diff-badge { font-family: ui-monospace, monospace; font-size: 0.65rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.15em 0.55em; border: 1px solid; }
.diff-badge.easy { color: var(--verified); border-color: var(--verified); }
.diff-badge.medium { color: var(--accent); border-color: var(--accent); }
.diff-badge.hard { color: var(--bad); border-color: var(--bad); }
.diff-badge.extreme { color: var(--network); border-color: var(--network); }

.xp-tag { font-family: ui-monospace, monospace; font-size: 0.75rem; color: var(--accent); }
.status-tag { font-family: ui-monospace, monospace; font-size: 0.68rem; color: var(--muted); }
.status-tag.solved { color: var(--verified); }

/* --- challenge detail view ------------------------------------------------*/
.challenge-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.back-link { background: none; border: none; color: var(--muted); font-family: ui-monospace, monospace; font-size: 0.8rem; cursor: pointer; padding: 0; margin-bottom: 1rem; }
.back-link:hover { color: var(--ink); }

.terminal-block {
  background: var(--code-bg);
  border: 1px solid var(--line-strong);
  padding: 1rem 1.1rem;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.terminal-block .k { color: var(--faint); }
.terminal-block .v { color: var(--ink); }

.answer-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.answer-row input[type="text"] {
  flex: 1 1 320px;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-strong);
  background: var(--bg-panel);
  color: var(--ink);
  font-family: ui-monospace, monospace;
  font-size: 0.92rem;
}
.answer-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check-btn {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  border: none;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
}
.check-btn:hover { filter: brightness(1.08); }
.check-status { font-family: ui-monospace, monospace; font-size: 0.8rem; }
.check-status.ok { color: var(--verified); }
.check-status.bad { color: var(--bad); }

.reason-list { display: grid; gap: 0.5rem; margin: 1rem 0; }
.reason-item { display: flex; gap: 0.6rem; align-items: flex-start; border: 1px solid var(--line); background: var(--bg-panel); padding: 0.7rem 0.85rem; }
.reason-item label { font-size: 0.88rem; cursor: pointer; }
.reason-item input { margin-top: 0.2rem; }

.attempts-note { font-family: ui-monospace, monospace; font-size: 0.75rem; color: var(--faint); margin-top: 0.5rem; }

/* --- completion screen -----------------------------------------------------*/
.completion {
  border: 1px solid var(--verified);
  background: var(--verified-bg);
  padding: 2rem 1.75rem;
  text-align: center;
  animation: completion-in 0.4s ease-out;
}
@keyframes completion-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .completion { animation: none; } }
.completion .status { font-family: ui-monospace, monospace; letter-spacing: 0.12em; color: var(--verified); font-size: 0.85rem; margin-bottom: 0.5rem; }
.completion h3 { margin: 0 0 1.25rem; font-size: 1.3rem; }
.completion .xp-gain { font-family: ui-monospace, monospace; font-size: 2rem; color: var(--accent); font-weight: 700; margin-bottom: 1.25rem; }
.completion .meta-row { display: flex; justify-content: center; gap: 2rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.completion .meta-row div { font-family: ui-monospace, monospace; font-size: 0.85rem; color: var(--muted); }
.completion .meta-row b { display: block; color: var(--ink); font-size: 1rem; }
.completion .actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.completion .actions button {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  background: var(--bg-panel);
  color: var(--ink);
}
.completion .actions button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* --- proof / profile (challenge 001's live signed-write flow) ------------*/
.proof-message { border: 1px solid var(--line-strong); background: var(--bg-panel); padding: 0.9rem 1.1rem; margin: 1rem 0; }
.proof-message .label { display: block; font-family: ui-monospace, monospace; font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; }
.proof-message code { display: block; background: none; padding: 0; font-size: 1rem; border: none; }

.paths { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 620px) { .paths { grid-template-columns: 1fr 1fr; } }
.path { border: 1px solid var(--line); background: var(--bg-panel); padding: 1rem; }
.path .tag { display: block; font-family: ui-monospace, monospace; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.6rem; }
.path pre { margin: 0 0 0.5rem; padding: 0.7rem 0.8rem; background: var(--code-bg); overflow-x: auto; font-family: ui-monospace, monospace; font-size: 0.8rem; white-space: pre-wrap; word-break: break-all; }
.path .note { margin: 0; color: var(--muted); font-size: 0.82rem; }

.profile-form { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.profile-form label { display: grid; gap: 0.3rem; font-size: 0.8rem; color: var(--muted); }
.profile-form input { padding: 0.5rem 0.65rem; border: 1px solid var(--line-strong); background: var(--bg-panel); color: var(--ink); font-family: -apple-system, sans-serif; font-size: 0.92rem; }
.profile-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* --- leaderboard ----------------------------------------------------------*/
.board-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.board-filters button {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line-strong);
  background: var(--bg-panel);
  color: var(--muted);
  cursor: pointer;
}
.board-filters button.active { color: var(--accent); border-color: var(--accent); }
.board-search { display: block; width: 100%; max-width: 320px; margin: 0 0 0.9rem; padding: 0.5rem 0.7rem; border: 1px solid var(--line-strong); background: var(--bg-panel); color: var(--ink); font-family: -apple-system, sans-serif; font-size: 0.9rem; }
.board-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; min-width: 480px; font-size: 0.87rem; }
thead th { text-align: left; font-family: ui-monospace, monospace; font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line-strong); background: var(--code-bg); }
tbody td { padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--line); font-family: ui-monospace, monospace; }
tbody tr:last-child td { border-bottom: none; }
tbody td.empty { font-family: -apple-system, sans-serif; color: var(--faint); }
.pill { font-family: ui-monospace, monospace; font-size: 0.68rem; padding: 0.1em 0.5em; border: 1px solid; text-transform: uppercase; letter-spacing: 0.04em; }
.pill.verified { color: var(--verified); border-color: var(--verified); }
.pill.unverified { color: var(--faint); border-color: var(--line-strong); }
.pill.human { color: var(--network); border-color: var(--network); }
.pill.agent { color: var(--accent); border-color: var(--accent); }

.cell-profile { font-family: -apple-system, sans-serif; }
.cell-profile .p-name { font-weight: 600; }
.cell-profile .p-bio { display: block; color: var(--muted); font-size: 0.82rem; }
.cell-profile .p-link { display: block; color: var(--faint); font-size: 0.78rem; }
.cell-profile .p-none { color: var(--faint); }

/* --- proof card ------------------------------------------------------------*/
.proof-card {
  max-width: 380px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(155deg, var(--bg-raised), var(--bg-panel));
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.proof-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 40%, rgba(240,135,59,0.06) 50%, transparent 60%); pointer-events: none; }
.proof-card .brand { font-family: ui-monospace, monospace; font-size: 0.7rem; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 1rem; }
.proof-card .agent-id { font-family: ui-monospace, monospace; font-size: 1.3rem; color: var(--accent); margin-bottom: 0.2rem; }
.proof-card .level { font-family: ui-monospace, monospace; font-size: 0.8rem; color: var(--verified); margin-bottom: 1.1rem; }
.proof-card .stat-line { display: flex; justify-content: space-between; font-family: ui-monospace, monospace; font-size: 0.82rem; padding: 0.35rem 0; border-top: 1px solid var(--line); }
.proof-card .did-line { font-family: ui-monospace, monospace; font-size: 0.78rem; color: var(--muted); margin-top: 0.75rem; word-break: break-all; }
.proof-card .verified-mark { color: var(--verified); }

/* --- activity feed ---------------------------------------------------------*/
.feed-list { display: grid; gap: 0.4rem; font-family: ui-monospace, monospace; font-size: 0.82rem; }
.feed-row { display: flex; gap: 0.9rem; padding: 0.4rem 0.6rem; border-left: 2px solid var(--line-strong); }
.feed-row .t { color: var(--faint); flex-shrink: 0; }
.feed-row .d { color: var(--network); flex-shrink: 0; }
.feed-row .e { color: var(--muted); }

/* --- badge section ----------------------------------------------------------*/
.badge-preview { display: block; margin: 0.25rem 0 0.9rem; }
.badge-snippet { margin: 0 0 1rem; padding: 0.7rem 0.8rem; background: var(--code-bg); overflow-x: auto; font-family: ui-monospace, monospace; font-size: 0.8rem; white-space: pre-wrap; word-break: break-all; }
.badge-variants { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* --- verify panel -----------------------------------------------------------*/
.verify-panel { border: 1px solid var(--line-strong); background: var(--bg-panel); padding: 1.25rem 1.4rem; }
.verify-panel .flow { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; font-family: ui-monospace, monospace; font-size: 0.78rem; color: var(--muted); margin-bottom: 1rem; }
.verify-panel .flow span { padding: 0.25rem 0.6rem; border: 1px solid var(--line-strong); }
.verify-panel .flow .arrow { border: none; padding: 0; color: var(--faint); }
.key-warning { border-left: 3px solid var(--bad); background: var(--bad-bg); padding: 0.75rem 1rem; font-size: 0.85rem; margin-bottom: 1rem; }

footer { margin-top: 3.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
