:root {
  --bg: #f5f8ff;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #66758f;
  --navy: #09152f;
  --navy-soft: #12295d;
  --line: rgba(9, 21, 47, 0.12);
  --blue: #0a54ff;
  --green: #88f0c4;
  --amber: #ffd293;
  --shadow: 0 20px 50px rgba(9, 21, 47, 0.08);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top right, rgba(10, 84, 255, 0.12), transparent 24%),
    linear-gradient(180deg, #f9fbff 0%, #edf3ff 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.page-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.return-link,
.ghost-button {
  border-radius: 999px;
  font-weight: 600;
}

.return-link {
  padding: 10px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
}

.tool-stage,
.debug-panel {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.tool-stage {
  border-radius: 36px;
  padding: 24px 26px 20px;
  color: white;
  background:
    radial-gradient(circle at top right, rgba(10, 84, 255, 0.24), transparent 26%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-soft) 68%, #1a469f 100%);
}

.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.stage-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.eyebrow,
.section-kicker,
.lane-label,
.countdown-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
}

.eyebrow,
.section-kicker,
.lane-label,
.countdown-label {
  color: #9dbfff;
}

.stage-head h1,
.debug-panel h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

.stage-head h1 {
  font-size: clamp(2rem, 3.3vw, 3rem);
  line-height: 0.96;
}

.live-chip {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.84);
  white-space: nowrap;
}

.timer-board {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(220px, 0.82fr) minmax(340px, 1.35fr) minmax(220px, 0.82fr);
  gap: 12px;
}

.timer-lane {
  min-height: 184px;
  padding: 20px 20px 18px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.09);
}

.timer-lane-state,
.timer-lane-next {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.timer-lane-countdown {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.14);
}

.lane-value {
  margin: 18px 0 0;
  font-size: clamp(1.8rem, 2.2vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1.03;
}

.countdown-value {
  margin: 12px 0 0;
  font-size: clamp(2.8rem, 5vw, 5rem);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.06em;
}

.lane-note {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.45;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.utility-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.utility-item {
  margin: 0;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.92rem;
}

.utility-item-source a {
  color: rgba(255, 255, 255, 0.9);
}

.risk-panel {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.risk-intro {
  margin: 0;
  max-width: 68ch;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.5;
}

.risk-head {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.risk-head h2,
.risk-card-title,
.risk-card-copy {
  margin: 0;
}

.risk-head h2 {
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  letter-spacing: -0.03em;
}

.risk-link {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  white-space: nowrap;
}

.risk-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.risk-card {
  min-height: 122px;
  padding: 16px 16px 14px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.risk-card-title {
  color: white;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.risk-card-copy {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.74);
  line-height: 1.45;
}

.tool-stage[data-state="boosted"] .lane-value-state {
  color: var(--green);
}

.tool-stage[data-state="standard"] .lane-value-state {
  color: var(--amber);
}

.tool-stage[data-state="inactive"] .lane-value-state {
  color: #e5ecfb;
}

.debug-panel {
  margin-top: 18px;
  border-radius: 28px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.92);
}

.debug-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.debug-head h2 {
  color: var(--ink);
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-weight: 600;
}

.field span {
  color: var(--ink);
}

.field input,
.debug-state {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  padding: 14px 16px;
}

.ghost-button {
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  cursor: pointer;
}

@media (max-width: 1080px) {
  .stage-head {
    flex-direction: column;
    align-items: stretch;
  }

  .timer-board {
    grid-template-columns: 1fr;
  }

  .risk-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timer-lane {
    min-height: auto;
  }

  .timer-lane-countdown {
    order: -1;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 16px;
  }

  .topbar {
    flex-wrap: wrap;
    align-items: center;
  }

  .debug-head {
    flex-direction: column;
    align-items: stretch;
  }

  .risk-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .tool-stage,
  .debug-panel {
    border-radius: 24px;
  }

  .tool-stage {
    padding: 20px 18px 18px;
  }

  .timer-lane,
  .debug-panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  .live-chip {
    align-self: flex-start;
  }

  .return-link {
    padding: 10px 14px;
  }

  .risk-grid {
    grid-template-columns: 1fr;
  }
}
