:root {
  color-scheme: light;
  --ink: #0f172a;
  --slate: #475569;
  --paper: #f8fafc;
  --accent: #f97316;
  --accent-strong: #ea580c;
  --accent-cool: #14b8a6;
  --border: rgba(15, 23, 42, 0.12);
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top left, #fff7ed 0%, #f8fafc 55%, #eff6ff 100%);
  color: var(--ink);
}

.page {
  position: relative;
  overflow: hidden;
}

.page::before {
  content: "";
  position: absolute;
  inset: -20% 0 0 0;
  background: radial-gradient(circle at 20% 20%, rgba(251, 146, 60, 0.18), transparent 45%),
    radial-gradient(circle at 70% 10%, rgba(45, 212, 191, 0.18), transparent 40%),
    radial-gradient(circle at 50% 70%, rgba(14, 116, 144, 0.12), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.page > * {
  position: relative;
  z-index: 1;
}

.card {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.eyebrow {
  letter-spacing: 0.3em;
}

.pill {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.9);
  padding: 0.5rem 1rem;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--slate);
  background: rgba(255, 255, 255, 0.8);
  transition: border 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.mode-pill input {
  accent-color: var(--accent);
}

.mode-pill:has(input:checked) {
  border-color: rgba(249, 115, 22, 0.5);
  color: var(--ink);
  background: rgba(255, 247, 237, 0.9);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--slate);
}

.field input {
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  font-family: "DM Mono", monospace;
  background: rgba(255, 255, 255, 0.9);
}

.dice-chip {
  display: grid;
  grid-template-columns: 2.2rem 1fr 2.2rem;
  align-items: center;
  gap: 0.2rem;
  border-radius: 18px;
  border: 1px dashed rgba(15, 23, 42, 0.2);
  padding: 0.15rem 0.15rem;
  font-weight: 600;
  color: var(--slate);
  background: rgba(255, 255, 255, 0.8);
  transition: transform 0.2s ease, border 0.2s ease, background 0.2s ease;
}

.dice-chip input {
  display: none;
}

.dice-label {
  text-align: center;
  font-family: "DM Mono", monospace;
  font-size: 0.95rem;
  color: var(--ink);
  transition: color 0.2s ease;
}

.dice-chip.is-zero .dice-label {
  color: #94a3b8;
  text-decoration: line-through;
}

.dice-chip.active {
  border-color: rgba(20, 184, 166, 0.6);
  background: rgba(240, 253, 250, 0.9);
  color: #0f766e;
}

.dice-chip:focus-within {
  border-color: rgba(249, 115, 22, 0.5);
}

.dice-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, border 0.2s ease, background 0.2s ease,
    color 0.2s ease;
}

.dice-step:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(249, 115, 22, 0.45);
  background: rgba(255, 247, 237, 0.9);
}

.dice-step:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.btn {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  padding: 0.6rem 1.3rem;
  font-weight: 600;
  color: var(--ink);
  background: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary {
  border-color: rgba(249, 115, 22, 0.5);
  background: linear-gradient(135deg, #fdba74 0%, #fb923c 45%, #f97316 100%);
  color: #7c2d12;
}

.btn-ghost {
  border-style: dashed;
}

.status-badge {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 0.3rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  background: rgba(255, 255, 255, 0.85);
  color: var(--slate);
}

.status-badge.running {
  background: rgba(14, 116, 144, 0.12);
  color: #0e7490;
  border-color: rgba(14, 116, 144, 0.3);
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #14b8a6 0%, #38bdf8 45%, #f97316 100%);
  transition: width 0.2s ease;
}

.stat {
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 0.9rem 1rem;
  background: rgba(248, 250, 252, 0.9);
  font-size: 0.85rem;
  color: var(--slate);
}

.stat h3 {
  margin-top: 0.35rem;
  font-size: 1.15rem;
  color: var(--ink);
}

.chart-wrap {
  position: relative;
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.95));
  padding: 1rem;
  min-height: 320px;
}

.chart-wrap #chart {
  width: 100%;
  height: 320px;
  display: block;
}

.highcharts-background {
  fill: transparent;
}

.highcharts-tooltip .hc-tooltip {
  min-width: 200px;
  max-width: 320px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.96);
  padding: 0.6rem 0.75rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  color: var(--ink);
  font-family: "DM Mono", monospace;
}

.highcharts-tooltip .hc-title {
  font-weight: 700;
  margin-bottom: 0.4rem;
  font-family: "Space Grotesk", sans-serif;
}

.highcharts-tooltip .hc-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.72rem;
}

.highcharts-tooltip .hc-combos {
  margin-top: 0.45rem;
  max-height: 170px;
  overflow-y: auto;
  padding-right: 0.25rem;
  overscroll-behavior: contain;
}

.highcharts-tooltip {
  pointer-events: auto !important;
}

.highcharts-tooltip .hc-combo {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.72rem;
}

.highcharts-tooltip .hc-note {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: #64748b;
}

@media (max-width: 768px) {
  .chart-wrap {
    padding: 0.75rem;
  }

  .chart-wrap #chart {
    height: 260px;
  }
}
