:root {
  --bg: #09090b;
  --panel: rgba(24, 24, 27, 0.6);
  --panel-strong: rgba(39, 39, 42, 0.8);
  --ink: #f4f4f5;
  --muted: #a1a1aa;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --gold: #f59e0b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "SFMono-Regular", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.15), transparent 40%),
    radial-gradient(circle at bottom left, rgba(245, 158, 11, 0.1), transparent 40%),
    var(--bg);
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.hero-card,
.console-card,
.result-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 28px;
}

.eyebrow-row,
.card-header,
.result-topline,
.chart-label-row,
.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.card-kicker,
.step-label,
.panel-label {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.2);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-pill.mellow {
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold);
  border-color: rgba(245, 158, 11, 0.2);
}

.status-pill.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.2);
}

.hero-grid,
.dashboard-grid,
.result-grid,
.leaderboard-grid {
  display: grid;
  gap: 24px;
}

.hero-grid {
  grid-template-columns: 1.5fr 1fr;
  align-items: stretch;
  margin-top: 18px;
}

.dashboard-grid {
  grid-template-columns: 1.2fr 0.8fr;
  margin-top: 24px;
}

.leaderboard-grid {
  grid-template-columns: 1fr 0.8fr;
  margin-top: 24px;
}

.hero-copy h1,
.console-card h2,
.result-card h2,
.step-panel h3 {
  margin: 0;
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero-copy h1 {
  max-width: 9ch;
  font-size: clamp(3.7rem, 8vw, 6.8rem);
}

.lede,
.panel-body,
.result-reason,
.result-next,
.panel-note {
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.98rem;
}

.cta-row,
.trust-list,
.nav-row,
.result-actions,
.badge-row,
.micro-grid,
.seal-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.cta-row {
  margin-top: 24px;
}

.trust-list {
  padding: 0;
  margin: 22px 0 0;
  list-style: none;
}

.trust-list li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.82rem;
}

.primary-button,
.ghost-button,
.tile {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary-button,
.ghost-button {
  padding: 14px 20px;
}

.primary-button {
  color: #000;
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
  font-weight: 600;
}

.ghost-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  font-weight: 500;
}

.primary-button:hover,
.ghost-button:hover,
.tile:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.hero-panel,
.attempt-box,
.micro-card,
.metric-card,
.chart-card,
.log-card,
.tribunal-box,
.leaderboard-item,
.seal,
.choice-card,
.field input,
.checkbox-row,
.tile {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
}

.hero-panel,
.console-card,
.result-card {
  padding: 24px;
}

.hero-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
}

.risk-value {
  margin-top: 8px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Baskerville", Georgia, serif;
  font-size: 2.2rem;
}

.teapot-illustration {
  position: relative;
  width: 210px;
  height: 170px;
  margin: 0 auto 20px;
}

.teapot-body,
.teapot-lid,
.teapot-handle,
.teapot-spout,
.teapot-base {
  position: absolute;
  border: 4px solid #6d5647;
}

.teapot-body {
  left: 38px;
  top: 44px;
  width: 118px;
  height: 76px;
  border-radius: 52% 48% 48% 52%;
  background: linear-gradient(180deg, #fff7ea 0%, #e9dbc6 100%);
}

.teapot-lid {
  left: 68px;
  top: 20px;
  width: 56px;
  height: 30px;
  border-radius: 64% 64% 40% 40%;
  background: #f2e4d0;
}

.teapot-lid::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 20px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 4px solid #6d5647;
  background: #fff6e7;
}

.teapot-handle {
  top: 52px;
  right: 10px;
  width: 48px;
  height: 56px;
  border-left: 0;
  border-radius: 0 60% 60% 0;
}

.teapot-spout {
  top: 62px;
  left: 8px;
  width: 42px;
  height: 18px;
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 75% 0 0;
  transform: skewX(-18deg);
  background: transparent;
}

.teapot-base {
  left: 58px;
  bottom: 16px;
  width: 78px;
  height: 12px;
  border-radius: 999px;
  background: #ebdcc8;
}

.console-card {
  padding: 22px;
}

.flow-card {
  min-height: 720px;
}

.attempt-box {
  min-width: 94px;
  padding: 12px;
  text-align: center;
}

.attempt-box strong {
  display: block;
  margin-top: 8px;
  font-size: 1.9rem;
}

.panel {
  margin-top: 22px;
}

.hidden {
  display: none !important;
}

.step-panel {
  display: none;
}

.active-step {
  display: block !important;
}

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

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  min-height: 120px;
  padding: 18px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

.tile-icon {
  font-size: 1.7rem;
}

.tile.active {
  outline: 2px solid var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 16px rgba(16, 185, 129, 0.2);
}

.field,
.field-group {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.field input {
  width: 100%;
  padding: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.inline-button {
  margin-top: 12px;
}

.calibration-shell {
  margin-top: 18px;
}

.hold-button {
  width: 100%;
}

.progress-track {
  width: 100%;
  height: 18px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #8bbcaf 0%, #1e6b58 100%);
  transition: width 110ms linear;
}

.progress-note {
  margin: 12px 0 0;
  color: var(--muted);
}

.choice-card,
.checkbox-row {
  display: flex;
  gap: 12px;
  padding: 16px;
  color: var(--ink);
  cursor: pointer;
}

.choice-card input,
.checkbox-row input {
  margin-top: 3px;
}

.danger-choice {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.3);
}

.nav-row {
  justify-content: flex-end;
  margin-top: 22px;
}

.metric-cluster {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.metric-card,
.chart-card,
.log-card,
.leaderboard-item,
.seal,
.tribunal-box {
  padding: 16px;
}

.metric-card span,
.leaderboard-item span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-card strong,
.leaderboard-item strong,
.tribunal-box strong {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
}

.chart-card {
  margin-top: 16px;
}

.bar-chart {
  display: flex;
  align-items: end;
  gap: 8px;
  height: 120px;
  margin-top: 18px;
}

.bar {
  flex: 1;
  border-radius: 999px 999px 18px 18px;
  background: linear-gradient(180deg, rgba(36, 72, 61, 0.85), rgba(168, 122, 30, 0.6));
}

.bar.low {
  height: 32%;
}

.bar.medium {
  height: 58%;
}

.bar.tall {
  height: 84%;
}

.log-card {
  margin-top: 16px;
}

.audit-log {
  padding-left: 18px;
  margin: 12px 0 0;
  color: var(--muted);
  display: grid;
  gap: 10px;
}

.result-card {
  margin-top: 24px;
  padding: 26px;
}

.result-grid {
  grid-template-columns: 1.5fr 0.7fr;
  margin-top: 16px;
}

.result-code {
  font-size: clamp(3.2rem, 7vw, 5rem);
}

.badge-row {
  margin-top: 18px;
}

.badge {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  backdrop-filter: blur(4px);
}

.result-actions {
  margin-top: 20px;
}

.leaderboard-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.seal-grid {
  margin-top: 18px;
}

.seal {
  min-width: 110px;
  text-align: center;
  color: var(--gold);
  font-weight: 600;
}

.steam {
  position: fixed;
  width: 140px;
  height: 140px;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(24px);
  opacity: 0.38;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.7), transparent 65%);
  animation: drift 12s linear infinite;
}

.steam-a {
  top: 60px;
  left: 6%;
}

.steam-b {
  top: 180px;
  right: 10%;
  animation-duration: 16s;
}

.steam-c {
  bottom: 40px;
  left: 40%;
  animation-duration: 14s;
}

@keyframes drift {
  0% {
    transform: translate3d(0, 10px, 0) scale(0.9);
  }
  50% {
    transform: translate3d(18px, -12px, 0) scale(1.12);
  }
  100% {
    transform: translate3d(-12px, -36px, 0) scale(0.96);
  }
}

@keyframes jitter {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.primary-button:hover,
.danger-choice:hover {
  animation: jitter 0.2s linear infinite;
}

.teapot-illustration.boiling {
  animation: jitter 0.15s linear infinite;
}

.boiling-steam {
  animation: drift 1s linear infinite !important;
  opacity: 0.8 !important;
}

@media (max-width: 960px) {
  .hero-grid,
  .dashboard-grid,
  .leaderboard-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy h1 {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  .hero-card,
  .console-card,
  .result-card {
    border-radius: 22px;
  }

  .tile-grid,
  .metric-cluster {
    grid-template-columns: 1fr;
  }

  .nav-row {
    justify-content: stretch;
  }

  .nav-row .primary-button,
  .nav-row .ghost-button,
  .result-actions .primary-button,
  .result-actions .ghost-button,
  .cta-row .primary-button,
  .cta-row .ghost-button {
    width: 100%;
  }

  .cta-row,
  .nav-row,
  .result-actions {
    flex-direction: column;
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 16px 24px;
  border-radius: var(--radius-md);
  background: rgba(24, 24, 27, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: "Inter", sans-serif;
  font-size: 0.9rem;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.toast.show {
  transform: translateX(0);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

.toast-success {
  border-left: 4px solid var(--accent);
}

.toast-info {
  border-left: 4px solid var(--gold);
}

/* Rejection Stamp */
.stamp-container {
  position: absolute;
  top: -10px;
  right: -20px;
  z-index: 10;
  pointer-events: none;
}

.rejection-stamp {
  font-family: "Outfit", sans-serif;
  font-size: 4.5rem;
  font-weight: 800;
  color: transparent;
  -webkit-text-stroke: 4px var(--danger);
  text-transform: uppercase;
  transform: rotate(15deg) scale(3);
  opacity: 0;
}

.rejection-stamp.slam {
  animation: stampSlam 0.4s cubic-bezier(0.25, 1.4, 0.5, 1) forwards;
  animation-delay: 0.2s;
}

@keyframes stampSlam {
  0% { transform: rotate(15deg) scale(3); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: rotate(-8deg) scale(1); opacity: 1; -webkit-text-stroke: 2px var(--danger); filter: drop-shadow(0 0 12px rgba(239,68,68,0.6)); }
}
