/* Trig Arena — the dark screen inside CodeLoom.
   Same type and hairlines as the site; blue and red carry the mathematics, as in the
   reference chart; green and red carry the verdicts. No glow, no gradients on text. */

.arena-body {
  --ag-bg: #0e1218;
  --ag-panel: #151c25;
  --ag-panel-2: #1b2430;
  --ag-line: #28323e;
  --ag-text: #eef2f7;
  --ag-dim: #a7b3c2;
  --ag-blue: #8fb4f2;
  --ag-red: #ef9b9e;
  --ag-green: #8ed6a8;
  --ag-amber: #e9c37c;
  background: var(--ag-bg);
  color: var(--ag-text);
}

.arena-body ::selection { background: #2b3a4d; color: var(--ag-text); }
.arena-body a { color: var(--ag-blue); }
/* the layout rules below set display on these blocks, which beats the UA [hidden] rule */
.arena-body [hidden] { display: none !important; }
.arena-body .skip { background: var(--ag-text); color: #0e1218; }

/* ---- top bar ---- */
.ag-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 58px;
  padding: 0 24px;
  background: rgba(14, 18, 24, 0.92);
  border-bottom: 1px solid var(--ag-line);
  backdrop-filter: blur(8px);
}
.ag-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ag-dim);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  min-height: 40px;
}
.ag-brand:hover { color: var(--ag-text); }
.ag-brand .i { width: 15px; height: 15px; }
.ag-bar__title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ag-dim);
}
.ag-bar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ag-account {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ag-text);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--ag-line);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
}
.ag-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ag-panel-2);
  color: var(--ag-blue);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px;
}

/* ---- layout ---- */
.arena {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ---- intro ---- */
.ag-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 48px;
  align-items: center;
  padding: 16px 0 40px;
}
.ag-intro h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 12px 0 16px;
}
.ag-lede { font-size: 1.0625rem; line-height: 1.6; color: var(--ag-dim); max-width: 46ch; }
.ag-intro .kicker { color: var(--ag-dim); }
.ag-intro .kicker::before { background: var(--ag-red); }
.ag-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 14px; }
.ag-note { font-size: 0.8125rem; color: var(--ag-dim); }
.ag-note a { color: var(--ag-blue); }
.ag-stats {
  display: flex; gap: 28px; flex-wrap: wrap;
  margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--ag-line);
}
.ag-stats div { display: flex; flex-direction: column; gap: 2px; }
.ag-stats b { font-family: var(--font-display); font-size: 1.75rem; line-height: 1; font-weight: 500; }
.ag-stats span {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ag-dim);
}
.ag-intro__circle { display: grid; justify-items: center; gap: 14px; }
.ag-caption { font-size: 0.75rem; color: var(--ag-dim); text-align: center; max-width: 34ch; margin: 0; }

/* ---- reference circle ---- */
.ag-circle { width: 100%; max-width: 380px; height: auto; }
.ag-axis { stroke: #46556a; stroke-width: 1.2; }
.ag-arrow { fill: #46556a; }
.ag-ring { fill: none; stroke: var(--ag-text); stroke-width: 1.6; stroke-opacity: 0.85; }
.ag-spoke { stroke: #33414f; stroke-width: 1; }
.ag-dot { fill: var(--ag-blue); }
.ag-dot--axis { fill: var(--ag-text); }
.ag-deg { fill: var(--ag-dim); font-family: var(--font-mono); font-size: 8.5px; }
.ag-rad { fill: var(--ag-blue); font-family: var(--font-mono); font-size: 10px; }
.ag-coord { fill: var(--ag-red); font-family: var(--font-mono); font-size: 9.5px; }
.ag-var { fill: var(--ag-dim); font-family: var(--font-display); font-size: 13px; font-style: italic; }

/* ---- stage table ---- */
.ag-table-wrap {
  grid-column: 1 / -1;
  margin-top: 12px;
  border-top: 1px solid var(--ag-line);
  padding-top: 8px;
  overflow-x: auto;
}
.ag-coords { color: var(--ag-red); font-family: var(--font-mono); font-size: 0.72rem; }
.ag-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; min-width: 620px; }
.ag-table th {
  text-align: left; padding: 12px 10px 10px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ag-dim); font-weight: 500;
  border-bottom: 1px solid var(--ag-line);
}
.ag-table td { padding: 11px 10px; border-bottom: 1px solid var(--ag-line); color: var(--ag-text); }
.ag-table td.muted { color: var(--ag-dim); }
.ag-table .num { font-variant-numeric: tabular-nums; }
.ag-table .mono { font-family: var(--font-mono); font-size: 0.78rem; }

/* ---- buttons ---- */
.ag-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--ag-line); border-radius: 3px;
  background: transparent; color: var(--ag-text);
  font-family: var(--font-ui); font-size: 0.9375rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  white-space: nowrap;
}
.ag-btn:hover { border-color: #3b4a5c; background: var(--ag-panel); }
.ag-btn--primary { background: var(--ag-text); color: #0e1218; border-color: var(--ag-text); }
.ag-btn--primary:hover { background: var(--ag-blue); border-color: var(--ag-blue); color: #0e1218; }
.ag-btn--sm { min-height: 36px; padding: 0 12px; font-size: 0.8125rem; }
.ag-btn--quiet { border-color: transparent; color: var(--ag-dim); padding: 0 8px; }
.ag-btn--quiet:hover { color: var(--ag-text); background: transparent; }
.ag-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---- HUD ---- */
.ag-hud {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--ag-line);
  border: 1px solid var(--ag-line);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 14px;
}
.ag-hud__item { background: var(--ag-panel); padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.ag-hud__item span {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ag-dim);
}
.ag-hud__item b { font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ag-hud__item--end { text-align: right; }

/* ---- timer ---- */
.ag-timer {
  position: relative;
  height: 16px;
  border-radius: 999px;
  background: var(--ag-panel-2);
  border: 1px solid var(--ag-line);
  overflow: hidden;
  margin-bottom: 26px;
}
.ag-timer__fill {
  height: 100%;
  width: 100%;
  background: var(--ag-green);
  border-radius: 999px;
  transform-origin: left center;
  transition: background-color 200ms linear;
}
.ag-timer.is-warn .ag-timer__fill { background: var(--ag-amber); }
.ag-timer.is-danger .ag-timer__fill { background: var(--ag-red); }
.ag-timer__label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 10px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em;
  color: #0e1218; font-weight: 600;
  mix-blend-mode: normal;
}
.ag-timer__unit { margin-left: 1px; font-size: 9px; }

/* ---- question ---- */
.ag-q { min-height: 300px; }
.ag-q__dots { display: flex; gap: 5px; margin-bottom: 18px; }
.ag-dot-q { width: 100%; height: 3px; border-radius: 2px; background: #2b3644; flex: 1; }
.ag-dot-q.is-ok { background: var(--ag-green); }
.ag-dot-q.is-bad { background: var(--ag-red); }
.ag-dot-q.is-now { background: var(--ag-text); }
.ag-q__prompt {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0 0 22px;
  max-width: 34ch;
}
.ag-q__prompt code, .ag-q__prompt .m {
  font-family: var(--font-mono); font-size: 0.9em; color: var(--ag-blue);
}
.ag-q__prompt .deg { color: var(--ag-text); }
.ag-q__body { display: grid; gap: 10px; }
.ag-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ag-option {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--ag-line); border-radius: 3px;
  background: var(--ag-panel);
  color: var(--ag-text);
  font-family: var(--font-mono); font-size: 1.0625rem;
  text-align: left; cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
  min-height: 56px;
}
.ag-option:hover:not([disabled]) { border-color: #46556a; background: var(--ag-panel-2); }
.ag-option kbd {
  font-family: var(--font-mono); font-size: 10px; color: var(--ag-dim);
  border: 1px solid var(--ag-line); border-radius: 2px; padding: 1px 5px;
}
.ag-option.is-picked { border-color: var(--ag-text); }
.ag-option.is-right { border-color: var(--ag-green); background: #16241c; color: var(--ag-green); }
.ag-option.is-wrong { border-color: var(--ag-red); background: #241618; color: var(--ag-red); }
.ag-option[disabled] { cursor: default; }

.ag-input-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ag-input {
  flex: 1 1 240px;
  min-height: 56px;
  padding: 0 16px;
  background: var(--ag-panel);
  border: 1px solid var(--ag-line);
  border-radius: 3px;
  color: var(--ag-text);
  font-family: var(--font-mono);
  font-size: 1.125rem;
}
.ag-input:focus { outline: 2px solid var(--ag-blue); outline-offset: 1px; border-color: var(--ag-blue); }
.ag-input.is-wrong { border-color: var(--ag-red); }
.ag-input.is-right { border-color: var(--ag-green); }
.ag-keys { font-size: 0.75rem; color: var(--ag-dim); margin-top: 8px; }

/* ---- feedback ---- */
.ag-feedback {
  margin-top: 22px;
  border: 1px solid var(--ag-line);
  border-left: 3px solid var(--ag-green);
  border-radius: 3px;
  background: var(--ag-panel);
  padding: 16px 18px;
}
.ag-feedback.is-bad { border-left-color: var(--ag-red); }
.ag-feedback.is-timeout { border-left-color: var(--ag-amber); }
.ag-feedback strong { display: block; font-size: 1.0625rem; margin-bottom: 6px; }
.ag-feedback p { margin: 0; color: var(--ag-dim); font-size: 0.9375rem; line-height: 1.55; }
.ag-feedback .m { font-family: var(--font-mono); color: var(--ag-blue); }
.ag-feedback .ok { color: var(--ag-green); }
.ag-feedback .no { color: var(--ag-red); }

/* ---- footer ---- */
.ag-foot {
  display: flex; align-items: center; gap: 12px;
  margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--ag-line);
  flex-wrap: wrap;
}
.ag-foot__hint { font-family: var(--font-mono); font-size: 10.5px; color: var(--ag-dim); margin-right: auto; }

/* ---- summary ---- */
.ag-summary { padding-top: 12px; }
.ag-summary h2 { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 6px; }
.ag-summary p { color: var(--ag-dim); }
.ag-summary__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1px; background: var(--ag-line); border: 1px solid var(--ag-line);
  border-radius: 4px; overflow: hidden; margin: 22px 0;
}
.ag-summary__cell { background: var(--ag-panel); padding: 14px 16px; }
.ag-summary__cell b { display: block; font-family: var(--font-display); font-size: 1.9rem; line-height: 1; font-weight: 500; }
.ag-summary__cell span {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ag-dim);
}
.ag-summary__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .ag-intro { grid-template-columns: 1fr; gap: 28px; }
  .ag-intro__circle { order: -1; }
  .ag-circle { max-width: 300px; }
  .ag-hud { grid-template-columns: repeat(3, 1fr); }
  .ag-hud__item--end { text-align: left; }
  .ag-options { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .ag-table { min-width: 0; }
  .ag-table th:last-child, .ag-table td:last-child { display: none; }
}
@media (max-width: 560px) {
  .ag-bar { height: 52px; padding: 0 14px; }
  .ag-bar__title { display: none; }
  .arena { padding: 20px 14px 48px; }
  .ag-hud { grid-template-columns: repeat(3, 1fr); }
  .ag-hud__item { padding: 8px 10px; }
  .ag-hud__item:nth-child(4), .ag-hud__item:nth-child(5) { display: none; }
  .ag-q__prompt { font-size: 1.45rem; }
  .ag-actions .ag-btn { width: 100%; }
  .ag-option { font-size: 1rem; min-height: 52px; }
  .ag-foot__hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ag-timer__fill { transition: none; }
}
