:root {
  --ink: #0b1f2e;
  --panel: #0f2d40;
  --panel-soft: #15384c;
  --accent: #ff7a18;
  --accent-2: #18e2ff;
  --muted: #dce7ef;
  --card: rgba(12, 32, 47, 0.7);
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Space Grotesk", system-ui, -apple-system, sans-serif;
  background: radial-gradient(140% 140% at 20% 20%, #123b5a 0%, #0b1f2e 50%, #07131c 100%);
  color: #f4fbff;
}
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}
header {
  display: grid;
  gap: 12px;
  margin-bottom: 28px;
}
header h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
header h1 .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 16px rgba(24, 226, 255, 0.6);
}
header p { margin: 0; color: var(--muted); max-width: 780px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  position: relative;
  overflow: hidden;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 80% at 10% 0%, rgba(255, 122, 24, 0.12), transparent 60%),
              radial-gradient(60% 60% at 100% 20%, rgba(24, 226, 255, 0.08), transparent 55%);
  pointer-events: none;
}
.card h2 {
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}
.card h2 span {
  display: inline-flex;
  width: 24px;
  height: 24px;
  border-radius: 9px;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
form {
  display: grid;
  gap: 12px;
}
label {
  font-size: 14px;
  color: var(--muted);
  display: grid;
  gap: 6px;
}
textarea, input, button, select {
  font: inherit;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #f6fcff;
  padding: 12px 14px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid rgba(24, 226, 255, 0.4); }
button {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #04101a;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 15px 35px rgba(24, 226, 255, 0.25);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}
button:hover { transform: translateY(-1px); filter: brightness(1.04); }
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  filter: none;
  box-shadow: none;
}
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e1f5ff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stage {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}
.stage small { color: var(--muted); }
.stage .stage-flow {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.stage .step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-weight: 600;
  color: #fff;
}
.stage .step.active {
  background: rgba(24, 226, 255, 0.14);
  border-color: rgba(24, 226, 255, 0.4);
  box-shadow: 0 5px 20px rgba(24, 226, 255, 0.15);
}
.stage .arrow {
  opacity: 0.45;
  font-size: 13px;
}
.wheel-wrap {
  position: relative;
  aspect-ratio: 1;
  width: min(500px, 100%);
  margin: 0 auto;
}
canvas#wheel {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.06), rgba(11, 31, 46, 0.9));
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5), 0 20px 60px rgba(0, 0, 0, 0.45);
}
.pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-bottom: 26px solid var(--accent);
  filter: drop-shadow(0 8px 20px rgba(255, 122, 24, 0.35));
  z-index: 2;
}
.spin-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.pill-note {
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 13px;
}
.collapsed {
  display: none;
}
.history {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}
.history-entry {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.history-entry strong { font-size: 14px; }
.badge {
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.badge.name { color: #9be7ff; border-color: rgba(155, 231, 255, 0.4); }
.badge.game { color: #ffdf9b; border-color: rgba(255, 223, 155, 0.4); }
.badge.gift { color: #b6ffa8; border-color: rgba(182, 255, 168, 0.4); }
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.result-box {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  min-height: 72px;
}
.result-box h3 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}
.result-box .value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.pill.inactive { opacity: 0.4; }
.status {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}
.list-block {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  gap: 10px;
}
.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.list-head small { display: block; color: var(--muted); }
.list-rows {
  display: grid;
  gap: 8px;
}
.list-row {
  display: grid;
  grid-template-columns: 1.6fr 0.6fr auto;
  gap: 6px;
  align-items: center;
}
.list-row input[type="text"],
.list-row input[type="number"] {
  margin: 0;
}
.list-row .row-weight {
  width: 68px;
}
.list-row button {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  color: #fff;
  box-shadow: none;
}
.ghost {
  background: rgba(255,255,255,0.08);
  color: #e8f3ff;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: none;
}
.ghost:hover { filter: brightness(1.05); }
.session-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
}
.session-header label {
  display: block;
}
.session-header small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}
.session-name-display {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,0.2);
  font-size: 15px;
  background: rgba(255,255,255,0.02);
}
.list-head-actions {
  display: flex;
  gap: 6px;
}
.list-body {
  display: grid;
  gap: 8px;
}
.list-block[data-collapsed="true"] .list-body {
  display: none;
}
.list-block[data-collapsed="true"] .collapse-btn {
  opacity: 0.8;
}
.gift-generator {
  grid-template-columns: 1fr auto;
  align-items: end;
}
.saved-sessions-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
.saved-sessions-list {
  display: grid;
  gap: 10px;
}
.saved-session-button {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.04);
  color: #fff;
}
.saved-session-button small {
  color: var(--muted);
  font-size: 12px;
}
.list-block.generated .list-rows,
.list-block.generated #gifts-list,
.list-block.generated #gifts-add {
  display: none;
}
@media (max-width: 720px) {
  header h1 { font-size: 26px; }
  .wheel-wrap { width: 100%; }
}
