﻿@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700&display=swap");

:root {
  color-scheme: light;
  --bg: #0e1116;
  --panel: #161b22;
  --surface: #11151c;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #60a5fa;
  --accent-2: #f87171;
  --border: #1f2937;
  --border-strong: #273245;
  --radius: 10px;
  --font: "Manrope", "Inter", system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --surface: #f2f4f7;
  --text: #1f2937;
  --muted: #4b5563;
  --accent: #2563eb;
  --accent-2: #dc2626;
  --border: #d1d5db;
  --border-strong: #b7c2d6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% 20%, #111827 0, #0b0f16 35%, #080c12 70%),
    linear-gradient(145deg, rgba(96, 165, 250, 0.08), rgba(248, 113, 113, 0.06));
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  padding: 32px 16px 48px;
}

[data-theme="light"] body {
  background: #f0f4f8;
}

.layout {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero {
  background: linear-gradient(120deg, rgba(96, 165, 250, 0.18), rgba(248, 113, 113, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 20px 22px;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.hero.minimal {
  justify-content: space-between;
}

.hero h1 {
  margin: 4px 0 8px;
  font-size: 28px;
}

.hero .lede {
  margin: 0;
  color: var(--muted);
  max-width: 720px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  margin: 0;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  white-space: nowrap;
}

.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(96, 165, 250, 0.9);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  align-items: start;
}

.controls.single {
  grid-template-columns: 1fr;
  justify-items: center;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

input:disabled {
  opacity: 0.5;
}

button {
  height: 44px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #5aa8ff, #7bb8ff);
  color: #0b1020;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 12px 25px rgba(59, 130, 246, 0.25);
  transition: transform 0.08s ease, box-shadow 0.1s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 15px 28px rgba(59, 130, 246, 0.35);
}

[data-theme="light"] button:hover {
  box-shadow: 0 15px 28px rgba(37, 99, 235, 0.25);
}

button:active,
.ghost:active {
  transform: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

@media (hover: none) {
  button:hover {
    transform: none;
    box-shadow: 0 12px 25px rgba(59, 130, 246, 0.25);
  }
  [data-theme="light"] button:hover {
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.2);
  }
}
[data-theme="light"] button:not(.ghost) {
  background: linear-gradient(135deg, #5aa8ff, #7bb8ff);
  color: #0b1020;
}

.ghost.small {
  height: 36px;
  padding: 0 12px;
}

.die-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.die-button {
  min-width: 64px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  padding: 10px 16px 10px 28px;
  border-radius: 999px;
}

.die-button:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.pool {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.pool-die {
  position: relative;
  padding: 10px 14px;
  background: rgba(96, 165, 250, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.5);
  color: #cfe6ff;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: none;
  padding-left: 30px;
}

.pool-die:hover {
  background: rgba(96, 165, 250, 0.22);
  border-color: rgba(96, 165, 250, 0.6);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.pill-label {
  pointer-events: none;
}

.pill-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translate(-4px, -50%) scale(0.95);
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
  pointer-events: none;
}

.pill-icon.plus {
  color: var(--accent);
}

.pill-icon.remove {
  color: var(--accent-2);
}

.die-button:hover .pill-icon,
.pool-die:hover .pill-icon {
  opacity: 1;
  transform: translate(-4px, -50%) scale(1);
}

.remove {
  color: var(--accent-2);
  font-weight: 800;
}

.remove {
  color: var(--accent-2);
  font-weight: 800;
}

.centered {
  text-align: center;
}

.rule-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.rule-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  box-shadow: none;
}

.chip.active {
  background: rgba(96, 165, 250, 0.16);
  border-color: rgba(96, 165, 250, 0.5);
  color: var(--text);
}

[data-theme="light"] .chip.active {
  background: rgba(37, 99, 235, 0.16);
  border-color: #2563eb;
  color: #0b1020;
}

.count-stepper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-left: 4px;
}

.count-stepper button {
  width: 70px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
  color: var(--text);
  font-weight: 700;
}

.count-value {
  display: inline-block;
  min-width: 32px;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.value {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.chart-card,
.table-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.card-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.outcome-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.outcomes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.outcome-row {
  display: grid;
  grid-template-columns: auto 1.5fr 1.6fr 0.9fr auto;
  gap: 10px;
  align-items: center;
}
.label-pill {
  padding: 4px 2px;
  border-radius: 4px;
  background: transparent;
  border: none;
  font-weight: 700;
  color: var(--text);
  min-width: 100px;
  text-align: left;
}

.text-input,
.outcome-row input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.outcome-row input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.outcome-row input[type="number"]::-webkit-outer-spin-button,
.outcome-row input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.range-inputs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.prob {
  font-weight: 700;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.lock-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--text);
}

.lock-btn.locked {
  color: var(--accent-2);
  border-color: var(--accent-2);
}



.error { color: var(--accent-2); font-weight: 700; }
.warning { color: #fbbf24; font-weight: 700; }
.range-field input[type="number"] { width: 80px; }
.range-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.compact {
  width: 32px;
  height: 32px;
  padding: 0;
}

.range-field {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px;
  align-items: center;
}

.ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: none;
}

.ghost.danger {
  color: var(--accent-2);
}

h2 {
  margin: 0;
  font-size: 20px;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.small {
  font-size: 12px;
}

.chart {
  width: 100%;
  height: 320px;
}

.chart svg {
  width: 100%;
  height: 100%;
}

.table-card table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
}

.table-card th,
.table-card td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.table-card th {
  background: var(--surface);
  color: var(--muted);
}

.table-card tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  background: rgba(96, 165, 250, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: #cfe6ff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}

@media (max-width: 640px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  button {
    width: 100%;
  }
}

