/* ============================================================
   ascen — Race to Ascension 10
   ============================================================ */

:root {
  --void: #08070a;
  --stone-900: #121017;
  --stone-800: #1a1721;
  --stone-700: #23202c;
  --stone-600: #2f2b3a;
  --stone-500: #423d50;
  --edge: #3a3546;

  --ink: #e8e3f0;
  --ink-dim: #a49cb5;
  --ink-faint: #6d6580;

  --gold: #f0c060;
  --gold-bright: #ffe9a8;
  --gold-deep: #a87a1e;
  --ember: #e2683c;
  --blood: #c0392b;
  --jade: #4fc08d;
  --violet: #8b6bd9;

  --radius: 14px;
  --radius-sm: 8px;
  --shell: 1120px;

  --font-display: 'Trebuchet MS', 'Gill Sans', 'Segoe UI', sans-serif;
  --font-body: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Cascadia Mono', Consolas, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1100px 700px at 50% -10%, rgba(240, 192, 96, 0.10), transparent 65%),
    radial-gradient(800px 600px at 15% 110%, rgba(139, 107, 217, 0.10), transparent 70%),
    linear-gradient(180deg, var(--void) 0%, #0d0b11 40%, var(--void) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 22px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------- masthead ---------------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(8, 7, 10, 0.82);
  border-bottom: 1px solid var(--edge);
}

.masthead-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 62px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.98rem;
  color: var(--ink);
  margin-right: auto;
}

.brand .brand-mark {
  width: 26px;
  height: 26px;
  object-fit: contain;
  align-self: center;
  filter: drop-shadow(0 0 8px rgba(79, 192, 141, 0.45));
}

.brand .brand-sub {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  font-weight: 600;
}

.nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav a {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  border: 1px solid transparent;
}

.nav a:hover {
  color: var(--ink);
  background: var(--stone-800);
}

.nav a.is-current {
  color: var(--gold);
  border-color: rgba(240, 192, 96, 0.35);
  background: rgba(240, 192, 96, 0.08);
}

/* live badge */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  border: 1px solid var(--edge);
  color: var(--ink-faint);
  background: var(--stone-800);
}

.live-pill .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.live-pill.is-live {
  color: #ffd9d0;
  border-color: rgba(224, 60, 40, 0.55);
  background: rgba(224, 60, 40, 0.14);
}

.live-pill.is-live .dot {
  background: #ff4d33;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 51, 0.7); opacity: 1; }
  50%      { box-shadow: 0 0 0 7px rgba(255, 77, 51, 0); opacity: 0.65; }
}

/* ---------------- hero ---------------- */

.hero {
  position: relative;
  padding: 58px 0 30px;
  text-align: center;
  overflow: hidden;
}

/* the Spire itself, behind the title */
.hero-art {
  position: absolute;
  inset: 0;
  background: url('../assets/bg/main-menu.png') center 28% / cover no-repeat;
  opacity: 0.5;
  /* fade the art out at every edge so the title stays legible */
  -webkit-mask-image: radial-gradient(120% 92% at 50% 34%, #000 22%, rgba(0, 0, 0, 0.35) 58%, transparent 88%);
  mask-image: radial-gradient(120% 92% at 50% 34%, #000 22%, rgba(0, 0, 0, 0.35) 58%, transparent 88%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 7, 10, 0.55) 0%, rgba(8, 7, 10, 0.2) 45%, var(--void) 100%);
  pointer-events: none;
}

.hero-inner { position: relative; z-index: 2; }

/* interior pages: no Spire art, tighter */
.hero.hero-compact { padding: 40px 0 20px; }
.hero.hero-compact::after { display: none; }
.hero.hero-compact h1 { font-size: clamp(1.8rem, 4.4vw, 2.7rem); }

.hero-silent {
  position: absolute;
  right: -14px;
  bottom: -30px;
  width: clamp(120px, 17vw, 210px);
  opacity: 0.9;
  filter: drop-shadow(-10px 10px 26px rgba(0, 0, 0, 0.75));
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 6px 15px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: rgba(8, 7, 10, 0.6);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.hero-eyebrow img { width: 15px; height: 15px; object-fit: contain; }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  line-height: 1.03;
  margin: 0 0 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 45%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(240, 192, 96, 0.18);
}

.hero .tagline {
  color: var(--ink-dim);
  font-size: clamp(0.95rem, 2.2vw, 1.1rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 20px;
}

.hero .tagline strong { color: var(--ink); font-weight: 700; }

/* challenge progress bar */
.climb-progress {
  max-width: 560px;
  margin: 0 auto;
}

.climb-progress .cp-track {
  height: 9px;
  border-radius: 999px;
  background: var(--stone-800);
  border: 1px solid var(--edge);
  overflow: hidden;
}

.climb-progress .cp-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-bright));
  box-shadow: 0 0 16px rgba(240, 192, 96, 0.55);
  transition: width 1s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.climb-progress .cp-label {
  margin-top: 10px;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.climb-progress .cp-label b { color: var(--gold); }

/* ---------------- section frames ---------------- */

.section {
  padding: 40px 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 1.32rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0;
  color: var(--ink);
}

.section-head h2::before {
  content: '';
  display: inline-block;
  width: 26px;
  height: 2px;
  vertical-align: 6px;
  margin-right: 12px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.section-head p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.86rem;
}

/* ---------------- current run panel ---------------- */

.run-panel {
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(240, 192, 96, 0.05), transparent 30%),
    linear-gradient(180deg, var(--stone-800), var(--stone-900));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.run-panel-top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--edge);
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.22);
}

.now-badge {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(240, 192, 96, 0.35);
  background: radial-gradient(circle at 50% 0%, rgba(240, 192, 96, 0.16), transparent 70%), var(--stone-700);
  min-width: 132px;
  text-align: center;
}

.now-badge .nb-label {
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
}

.now-badge .nb-value {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 22px rgba(240, 192, 96, 0.4);
}

.now-copy { flex: 1 1 260px; }

.now-copy h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: var(--ink);
}

.now-copy p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

.goal-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.94rem;
  font-weight: 700;
  border: 1px solid rgba(240, 192, 96, 0.4);
  background: rgba(240, 192, 96, 0.10);
  color: var(--gold-bright);
}

.goal-chip img { width: 17px; height: 17px; object-fit: contain; }

.goal-chip span {
  font-family: var(--font-body);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
}

/* stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  /* separators are drawn on the tiles themselves, so a short final row
     blends into the panel instead of leaving a visible empty box */
  background: var(--stone-900);
}

.stat {
  padding: 16px 18px 15px;
  background: var(--stone-900);
  border-top: 1px solid var(--edge);
  border-right: 1px solid var(--edge);
  margin: -1px -1px 0 0;
  position: relative;
  transition: background 0.25s ease;
}

.stat:hover { background: var(--stone-800); }

.stat-label {
  font-size: 0.63rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  margin-bottom: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.42rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.stat-sub {
  margin-top: 5px;
  font-size: 0.72rem;
  color: var(--ink-faint);
}

.stat-value.is-gold  { color: var(--gold); text-shadow: 0 0 18px rgba(240, 192, 96, 0.32); }
.stat-value.is-good  { color: var(--jade); }
.stat-value.is-bad   { color: var(--ember); }
.stat-value.is-muted { color: var(--ink-faint); }

/* ---------------- the climb ---------------- */

.climb {
  position: relative;
  padding: 20px 0 40px;
}

/* the Spire's spine */
.climb::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  margin-left: -1.5px;
  /* 0deg runs bottom-to-top, putting the gold end at A10 now that the list
     reads downward. Keeps the brightest point on the final Ascension. */
  background: linear-gradient(0deg, rgba(240, 192, 96, 0.55) 0%, var(--stone-600) 22%, var(--stone-600) 78%, rgba(139, 107, 217, 0.35) 100%);
  border-radius: 2px;
}

.climb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  /* A1 first, reading downward to A10. Plain `column` keeps the visual order
     identical to the DOM order, so screen readers and tab order agree. */
  flex-direction: column;
  gap: 26px;
}

.node-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 74px 1fr;
  align-items: center;
}

.node-row .rung {
  grid-column: 2;
  display: flex;
  justify-content: center;
}

.node-row.is-left  .node { grid-column: 1; }
.node-row.is-right .node { grid-column: 3; }

/* rung marker on the spine */
.rung-mark {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--stone-700);
  border: 2px solid var(--stone-500);
  z-index: 2;
}

.node-row.state-completed .rung-mark {
  background: var(--gold);
  border-color: var(--gold-bright);
  box-shadow: 0 0 18px rgba(240, 192, 96, 0.65);
}

.node-row.state-active .rung-mark {
  background: var(--ember);
  border-color: #ffb08a;
  box-shadow: 0 0 18px rgba(226, 104, 60, 0.7);
  animation: pulse-ember 2s ease-in-out infinite;
}

@keyframes pulse-ember {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.22); }
}

/* ---------------- node card ---------------- */

.node {
  position: relative;
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--edge);
  background: linear-gradient(180deg, var(--stone-800), var(--stone-900));
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.node:hover { transform: translateY(-3px); }

/* connector from spine to card */
.node::before {
  content: '';
  position: absolute;
  top: 50%;
  width: 30px;
  height: 1px;
  background: linear-gradient(90deg, var(--stone-600), transparent);
}

.node-row.is-left  .node::before { right: -30px; background: linear-gradient(270deg, var(--stone-600), transparent); }
.node-row.is-right .node::before { left: -30px; }

.node-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.node-row.is-left .node-head { flex-direction: row-reverse; }
.node-row.is-left .node,
.node-row.is-left .node-foot { text-align: right; }
.node-row.is-left .node-foot { justify-content: flex-end; }

.node-sigil {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--stone-700);
  border: 1px solid var(--stone-500);
  overflow: hidden;
}

.node-sigil img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.node-titles { min-width: 0; }

.node-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
  color: var(--ink);
}

.node-status {
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-faint);
  margin-top: 3px;
}

.node-time {
  font-family: var(--font-mono);
  font-size: 1.72rem;
  font-weight: 700;
  line-height: 1;
  margin: 2px 0 8px;
  color: var(--ink-dim);
}

.node-foot {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.73rem;
  color: var(--ink-faint);
}

.node-foot .chip {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--stone-600);
  background: rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}

.node-note {
  margin: 10px 0 0;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-dim);
  line-height: 1.45;
}

/* --- locked --- */
.node-row.state-locked .node {
  opacity: 0.55;
  filter: saturate(0.35);
  border-style: dashed;
}

.node-row.state-locked .node:hover { opacity: 0.8; transform: none; }

.node-row.state-locked .node-sigil img { opacity: 0.7; }

.node-time.is-sealed {
  color: var(--stone-500);
  letter-spacing: 0.06em;
}

/* --- active --- */
.node-row.state-active .node {
  border-color: rgba(226, 104, 60, 0.55);
  background:
    radial-gradient(400px 120px at 50% 0%, rgba(226, 104, 60, 0.14), transparent 70%),
    linear-gradient(180deg, var(--stone-700), var(--stone-900));
  box-shadow: 0 0 0 1px rgba(226, 104, 60, 0.18), 0 18px 44px rgba(0, 0, 0, 0.5);
}

.node-row.state-active .node-sigil {
  border-color: rgba(226, 104, 60, 0.7);
  background: rgba(226, 104, 60, 0.16);
  color: #ffbf9e;
}

.node-row.state-active .node-status { color: var(--ember); }
.node-row.state-active .node-time { color: var(--ink); }

/* --- completed: engraved in stone --- */
.node-row.state-completed .node {
  border-color: #4a4436;
  background:
    /* chiselled grain */
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(15deg, rgba(0, 0, 0, 0.10) 0 3px, transparent 3px 9px),
    linear-gradient(165deg, #3b3730 0%, #2a2722 48%, #211f1b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 220, 0.10),
    inset 0 -2px 6px rgba(0, 0, 0, 0.6),
    0 16px 40px rgba(0, 0, 0, 0.55);
}

.node-row.state-completed .node-title,
.node-row.state-completed .node-time {
  /* engraved lettering: dark above, light below */
  color: #cbbf9d;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.75), 0 1px 0 rgba(255, 240, 200, 0.16);
}

.node-row.state-completed .node-status { color: var(--gold-deep); }

.node-row.state-completed .node-sigil {
  background: linear-gradient(165deg, #4a4335, #2b2721);
  border-color: #5c523d;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.55);
}

/* the Silent mask reads as chiselled relief on a cleared level */
.node-row.state-completed .node-sigil img {
  filter: sepia(0.45) saturate(0.7) brightness(0.95) drop-shadow(0 1px 0 rgba(255, 240, 200, 0.18));
}

.node-row.state-active .node-sigil img {
  filter: drop-shadow(0 0 8px rgba(79, 192, 141, 0.6));
}

.node-row.state-completed .node-foot .chip {
  border-color: #4a4436;
  color: #9c9075;
}

/* --- sub-goal: animated gold outline --- */
.node.is-record { z-index: 1; }

/* The sweep animates the gradient's own angle. Rotating the element instead
   would swing its corners outside the card and leak gold lines across the page. */
@property --trace-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

/* complete outline, so the frame is whole even if --trace-angle can't animate */
.node.is-record { border-color: rgba(240, 192, 96, 0.55); }

.node.is-record::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius) + 2px);
  padding: 2px;
  background: conic-gradient(
    from var(--trace-angle),
    transparent 0deg,
    rgba(240, 192, 96, 0.15) 40deg,
    var(--gold) 85deg,
    var(--gold-bright) 100deg,
    var(--gold) 115deg,
    rgba(240, 192, 96, 0.15) 160deg,
    transparent 220deg,
    transparent 360deg
  );
  /* keep only the 2px frame, punching out the middle */
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: trace 3.4s linear infinite;
  pointer-events: none;
}

@keyframes trace {
  to { --trace-angle: 360deg; }
}

.node.is-record {
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 220, 0.12),
    inset 0 -2px 6px rgba(0, 0, 0, 0.6),
    0 0 26px rgba(240, 192, 96, 0.20),
    0 16px 44px rgba(0, 0, 0, 0.6);
}

.node.is-record .node-time {
  color: var(--gold-bright) !important;
  text-shadow: 0 0 20px rgba(240, 192, 96, 0.45), 0 -1px 0 rgba(0, 0, 0, 0.7) !important;
}

.record-seal img {
  width: 15px;
  height: 15px;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.4));
}

.record-seal {
  position: absolute;
  top: -11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #241c07;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  box-shadow: 0 4px 14px rgba(240, 192, 96, 0.4);
}

.node-row.is-right .record-seal { left: 18px; }
.node-row.is-left  .record-seal { right: 18px; }

/* --- unlock animation --- */
.node.just-unlocked {
  animation: unlock-rise 1.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes unlock-rise {
  0%   { opacity: 0; transform: translateY(26px) scale(0.9); filter: brightness(2.4) blur(3px); }
  45%  { opacity: 1; filter: brightness(1.6) blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: brightness(1); }
}

.node.just-unlocked .node-sigil {
  animation: sigil-flare 1.4s ease-out both;
}

@keyframes sigil-flare {
  0%   { box-shadow: 0 0 0 0 rgba(255, 233, 168, 0.9); transform: scale(0.7) rotate(-14deg); }
  40%  { box-shadow: 0 0 34px 12px rgba(255, 233, 168, 0.55); transform: scale(1.12) rotate(4deg); }
  100% { box-shadow: 0 0 0 0 rgba(255, 233, 168, 0); transform: scale(1) rotate(0); }
}

/* shockwave ring on unlock */
.node.just-unlocked > .unlock-ring {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  border: 2px solid var(--gold-bright);
  animation: shockwave 1.25s ease-out forwards;
  pointer-events: none;
}

@keyframes shockwave {
  0%   { opacity: 0.85; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.14); }
}

/* ---------------- recent runs ---------------- */

.log {
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--stone-900);
}

.log-row {
  display: grid;
  grid-template-columns: 62px 1fr 92px 108px;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--stone-800);
  font-size: 0.87rem;
}

.log-row:last-child { border-bottom: 0; }
.log-row.log-head {
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.63rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
}

.log-lv {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--gold);
}

.log-time { font-family: var(--font-mono); font-weight: 700; }
.log-note { color: var(--ink-dim); }

.verdict {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.verdict.win  { color: #b9f2d6; background: rgba(79, 192, 141, 0.16); border: 1px solid rgba(79, 192, 141, 0.4); }
.verdict.loss { color: #f6cfc4; background: rgba(192, 57, 43, 0.16); border: 1px solid rgba(192, 57, 43, 0.45); }

/* ---------------- achievements ---------------- */

.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
}

.ach {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 17px;
  border-radius: var(--radius);
  border: 1px solid var(--edge);
  background: linear-gradient(180deg, var(--stone-800), var(--stone-900));
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.ach:hover { transform: translateY(-3px); }

.ach-icon {
  width: 52px; height: 52px;
  flex: 0 0 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  background: var(--stone-700);
  border: 1px solid var(--stone-500);
  overflow: hidden;
  filter: grayscale(1) opacity(0.4);
  transition: filter 0.3s ease;
}

.ach-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ach-body { min-width: 0; flex: 1; }

.ach-name {
  font-family: var(--font-display);
  font-size: 0.98rem;
  letter-spacing: 0.05em;
  margin: 0 0 4px;
  color: var(--ink-dim);
}

.ach-desc {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-faint);
}

.ach-meta {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.7rem;
  color: var(--ink-faint);
}

.ach-bar {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--stone-700);
  overflow: hidden;
}

.ach-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--stone-500), var(--ink-faint));
  transition: width 0.8s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.ach-tag {
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--stone-600);
  color: var(--ink-faint);
}

/* unlocked */
.ach.is-unlocked {
  border-color: rgba(240, 192, 96, 0.4);
  background:
    radial-gradient(300px 90px at 20% 0%, rgba(240, 192, 96, 0.12), transparent 70%),
    linear-gradient(180deg, var(--stone-700), var(--stone-900));
  box-shadow: 0 0 24px rgba(240, 192, 96, 0.10), 0 14px 34px rgba(0, 0, 0, 0.45);
}

.ach.is-unlocked .ach-icon {
  filter: none;
  border-color: rgba(240, 192, 96, 0.55);
  background: rgba(240, 192, 96, 0.12);
  box-shadow: 0 0 18px rgba(240, 192, 96, 0.28);
}

.ach.is-unlocked .ach-name { color: var(--gold-bright); }
.ach.is-unlocked .ach-desc { color: var(--ink-dim); }
.ach.is-unlocked .ach-bar i { background: linear-gradient(90deg, var(--gold-deep), var(--gold)); }

.ach.is-unlocked .ach-tag {
  border-color: rgba(240, 192, 96, 0.5);
  color: var(--gold);
}

.ach.tier-gold.is-unlocked { border-color: rgba(240, 192, 96, 0.6); }

.ach-manual-flag {
  position: absolute;
  top: 10px; right: 12px;
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  opacity: 0.75;
}

/* ---------------- admin ---------------- */

.card {
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--stone-800), var(--stone-900));
  padding: 20px 22px;
  margin-bottom: 20px;
}

.card > h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.card > .card-hint {
  margin: 0 0 18px;
  font-size: 0.83rem;
  color: var(--ink-faint);
  line-height: 1.5;
}

.field-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 150px;
  min-width: 0;
}

.field label {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
}

input[type='text'],
input[type='date'],
input[type='number'],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stone-500);
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9rem;
}

input[type='text']:focus,
input[type='date']:focus,
input[type='number']:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(240, 192, 96, 0.14);
}

textarea { resize: vertical; min-height: 68px; }

.btn {
  padding: 10px 17px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stone-500);
  background: var(--stone-700);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.btn:hover { background: var(--stone-600); border-color: var(--ink-faint); }
.btn:active { transform: translateY(1px); }

.btn-gold {
  border-color: var(--gold-deep);
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: #221a05;
}
.btn-gold:hover { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); }

.btn-danger { border-color: rgba(192, 57, 43, 0.6); color: #f0c4bc; }
.btn-danger:hover { background: rgba(192, 57, 43, 0.25); }

.btn-sm { padding: 6px 11px; font-size: 0.75rem; }

.btn-bar { display: flex; gap: 10px; flex-wrap: wrap; }

/* admin level table */
.lv-table { display: flex; flex-direction: column; gap: 8px; }

.lv-item {
  display: grid;
  grid-template-columns: 52px 116px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stone-600);
  background: rgba(0, 0, 0, 0.28);
}

.lv-item .lv-name {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.lv-item.st-completed { border-color: rgba(240, 192, 96, 0.38); }
.lv-item.st-active { border-color: rgba(226, 104, 60, 0.45); }
.lv-item.st-locked { opacity: 0.72; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  border: 1px solid var(--stone-500);
  color: var(--ink-faint);
  text-align: center;
}

.pill.st-completed { color: var(--gold); border-color: rgba(240, 192, 96, 0.5); background: rgba(240, 192, 96, 0.1); }
.pill.st-active { color: var(--ember); border-color: rgba(226, 104, 60, 0.5); background: rgba(226, 104, 60, 0.12); }

.lv-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.lv-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

.lv-meta > b { color: var(--ink); }

.lv-sub {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
}

.lv-flag {
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.lv-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  justify-self: center;
}

.lv-item.st-locked .lv-icon { filter: grayscale(1) opacity(0.5); }

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--stone-600);
  color: var(--gold);
}

/* ---------------- diagnostics ---------------- */

.diag-summary {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--stone-500);
  color: var(--ink-faint);
}

.diag-summary.is-pass { color: var(--jade);  border-color: rgba(79, 192, 141, 0.5); background: rgba(79, 192, 141, 0.1); }
.diag-summary.is-warn { color: var(--gold);  border-color: rgba(240, 192, 96, 0.5); background: rgba(240, 192, 96, 0.1); }
.diag-summary.is-fail { color: #f6a99a;      border-color: rgba(192, 57, 43, 0.55);  background: rgba(192, 57, 43, 0.14); }

.diag-list { display: flex; flex-direction: column; gap: 7px; }

.diag {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 11px;
  align-items: start;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stone-600);
  background: rgba(0, 0, 0, 0.28);
}

.diag-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.76rem;
  font-weight: 800;
  background: var(--stone-700);
  color: var(--ink-faint);
}

.diag-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.diag-body > b { font-size: 0.86rem; color: var(--ink); }

.diag-detail {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-dim);
  overflow-wrap: anywhere;
}

.diag-fix {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-faint);
  margin-top: 3px;
}

.diag-pass .diag-dot { background: rgba(79, 192, 141, 0.18); color: var(--jade); }
.diag-warn .diag-dot { background: rgba(240, 192, 96, 0.18); color: var(--gold); }
.diag-fail .diag-dot { background: rgba(192, 57, 43, 0.22);  color: #f6a99a; }

.diag-pass { border-color: rgba(79, 192, 141, 0.3); }
.diag-warn { border-color: rgba(240, 192, 96, 0.32); }
.diag-fail { border-color: rgba(192, 57, 43, 0.45); background: rgba(192, 57, 43, 0.07); }
.diag-fail .diag-fix { color: #f0bdb1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(18px);
  padding: 12px 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: #201804;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty {
  padding: 26px 18px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.88rem;
}

.note-banner {
  border: 1px solid rgba(139, 107, 217, 0.4);
  background: rgba(139, 107, 217, 0.1);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 0.84rem;
  color: var(--ink-dim);
  line-height: 1.5;
  margin-bottom: 20px;
}

/* signed in and publishing live */
.note-banner.is-authed {
  border-color: rgba(79, 192, 141, 0.45);
  background: rgba(79, 192, 141, 0.1);
}

/* signed out — panels are hidden behind this */
.note-banner.is-locked {
  border-color: rgba(240, 192, 96, 0.45);
  background: rgba(240, 192, 96, 0.08);
}

.note-banner .btn { margin-left: 8px; vertical-align: baseline; }

.auth-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.auth-error {
  display: block;
  margin: 0 0 14px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(192, 57, 43, 0.5);
  background: rgba(192, 57, 43, 0.12);
  color: #f6cfc4;
  font-size: 0.84rem;
  line-height: 1.5;
}

.auth-error-fix {
  display: block;
  margin-top: 6px;
  color: #e8b6a9;
  font-size: 0.81rem;
}

.auth-row input[type='text'] {
  flex: 1 1 240px;
  max-width: 340px;
  width: auto;
}

/* ---------------- footer ---------------- */

.footer {
  border-top: 1px solid var(--edge);
  margin-top: 40px;
  padding: 26px 0 40px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.8rem;
}

.footer .sep { opacity: 0.4; margin: 0 8px; }

.footer .credit {
  margin: 12px 0 0;
  font-size: 0.72rem;
  color: var(--ink-faint);
  opacity: 0.75;
}

/* ---------------- responsive ---------------- */

@media (max-width: 780px) {
  .climb::before { left: 26px; margin-left: 0; }

  .node-row {
    grid-template-columns: 52px 1fr;
    gap: 6px;
  }

  .node-row .rung { grid-column: 1; }
  .node-row.is-left .node,
  .node-row.is-right .node { grid-column: 2; text-align: left; }
  .node-row.is-left .node-head { flex-direction: row; }
  .node-row.is-left .node-foot { justify-content: flex-start; }

  .node-row.is-left .node::before,
  .node-row.is-right .node::before { left: -22px; right: auto; width: 22px; background: linear-gradient(90deg, var(--stone-600), transparent); }

  .node-row.is-left .record-seal,
  .node-row.is-right .record-seal { left: 16px; right: auto; }

  .log-row { grid-template-columns: 46px 1fr 78px; }
  .log-row .log-note { display: none; }

  .lv-item { grid-template-columns: 44px 1fr; }
  .lv-actions { grid-column: 1 / -1; justify-content: flex-start; }

  .hero { padding: 34px 0 18px; }
}

@media (max-width: 560px) {
  /* keep the header to two compact rows */
  .brand .brand-sub { display: none; }
  .brand { font-size: 0.86rem; margin-right: 0; }
  .masthead-inner { gap: 10px 12px; padding-bottom: 10px; min-height: 0; padding-top: 10px; }
  .nav { order: 3; width: 100%; }
  .nav a { padding: 6px 10px; font-size: 0.78rem; }
  #livePill { margin-left: auto; }
  .hero-silent { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
