:root {
  color-scheme: dark;
  --page: #070707;
  --panel: #101010;
  --panel-2: #171717;
  --line: #2b2b2b;
  --text: #f7f7f7;
  --muted: #a7a7a7;
  --red: #b10f1f;
  --red-bright: #df2133;
  --green: #087830;
  --green-bright: #12a44c;
  --black: #111111;
  --gold: #d6b45a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(177, 15, 31, 0.17), transparent 35rem),
    radial-gradient(circle at 90% 20%, rgba(8, 120, 48, 0.13), transparent 30rem),
    linear-gradient(180deg, #0b0b0b 0%, #050505 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.site-header {
  width: min(1600px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-header h1,
.controls-summary h2 {
  margin: 0;
  letter-spacing: -0.03em;
}

.site-header h1 {
  font-size: clamp(1.65rem, 2vw, 2.25rem);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.app-shell {
  width: min(1600px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 40px;
}

.wheel-panel,
.controls-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background: rgba(16, 16, 16, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.wheel-panel {
  min-width: 0;
  padding: 24px;
}

.controls-panel {
  margin-top: 22px;
  overflow: hidden;
}

.controls-summary {
  min-height: 88px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.controls-summary::-webkit-details-marker {
  display: none;
}

.controls-summary:hover {
  background: rgba(255, 255, 255, 0.025);
}

.controls-summary h2 {
  font-size: 1.45rem;
}

.summary-action {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.hide-label {
  display: none;
}

.controls-panel[open] .show-label {
  display: none;
}

.controls-panel[open] .hide-label {
  display: inline;
}

.chevron {
  display: inline-block;
  color: var(--gold);
  font-size: 1.35rem;
  line-height: 1;
  transition: transform 160ms ease;
}

.controls-panel[open] .chevron {
  transform: rotate(180deg);
}

.controls-content {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 24px 26px;
  border-top: 1px solid var(--line);
}

.wheel-title-wrap {
  display: flex;
  justify-content: center;
}

.wheel-title {
  width: min(100%, 1050px);
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 2px 8px 10px;
  color: var(--text);
  background: transparent;
  text-align: center;
  font-size: clamp(1.55rem, 3vw, 2.8rem);
  font-weight: 850;
  letter-spacing: -0.04em;
  outline: none;
  transition: border-color 160ms ease;
}

.wheel-title:focus {
  border-color: var(--gold);
}

.wheel-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 22px 0 10px;
}

.wheel-frame {
  position: relative;
  width: min(100%, 850px);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: clamp(8px, 1.35vw, 16px);
  background:
    repeating-conic-gradient(
      from 0deg,
      #c7a94f 0 2deg,
      #5f4b1e 2deg 4deg
    );
  box-shadow:
    0 0 0 5px #050505,
    0 0 0 8px #c7a94f,
    0 30px 80px rgba(0, 0, 0, 0.58),
    inset 0 0 30px rgba(255, 255, 255, 0.18);
}

#wheelCanvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #090909;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.08);
  will-change: transform;
}

.pointer {
  position: absolute;
  top: clamp(-27px, -2vw, -19px);
  left: 50%;
  z-index: 8;
  min-width: 92px;
  padding: 7px 12px 8px;
  transform: translateX(-50%);
  border: 3px solid #fff1a8;
  border-radius: 999px;
  color: #090909;
  background: linear-gradient(180deg, #f6d97a, #c89e35);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.6),
    inset 0 2px 2px rgba(255, 255, 255, 0.45);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  line-height: 1;
  pointer-events: none;
}

.pointer::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -39px;
  transform: translateX(-50%);
  border-left: 19px solid transparent;
  border-right: 19px solid transparent;
  border-top: 40px solid #fff1a8;
  filter: drop-shadow(0 7px 5px rgba(0, 0, 0, 0.52));
}

.pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -33px;
  transform: translateX(-50%);
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 33px solid #d6b45a;
}

.spin-button {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 4;
  width: clamp(84px, 13vw, 138px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 7px solid #d0b15b;
  border-radius: 50%;
  color: white;
  background:
    radial-gradient(circle at 35% 30%, #18a850, #075523 64%, #032d12);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.55),
    inset 0 4px 7px rgba(255, 255, 255, 0.2),
    inset 0 -7px 11px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

.spin-button:hover:not(:disabled) {
  transform: translate(-50%, -50%) scale(1.05);
  filter: brightness(1.08);
}

.spin-button:active:not(:disabled) {
  transform: translate(-50%, -50%) scale(0.98);
}

.spin-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.5) brightness(0.75);
}

.spin-button span {
  font-weight: 950;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.55);
}

.result-panel {
  width: min(100%, 1050px);
  min-height: 82px;
  margin: 16px auto 18px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  text-align: center;
  background: linear-gradient(180deg, #181818, #111);
}

.result-panel.has-result {
  border-color: rgba(18, 164, 76, 0.72);
  box-shadow: 0 0 0 3px rgba(18, 164, 76, 0.09);
}

.result-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

#resultText {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(1.1rem, 2.3vw, 1.55rem);
}

.mode-row {
  width: min(100%, 1050px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mode-option {
  min-width: 0;
  cursor: pointer;
}

.mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-option span {
  min-height: 76px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 4px;
  background: #141414;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.mode-option:hover span {
  transform: translateY(-1px);
}

.mode-option input:checked + span {
  border-color: var(--green-bright);
  background: rgba(8, 120, 48, 0.16);
  box-shadow: inset 0 0 0 1px rgba(18, 164, 76, 0.25);
}

.mode-option small {
  color: var(--muted);
  line-height: 1.35;
}

.controls-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.helper {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.choice-list-header,
.choice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 42px;
  gap: 10px;
  align-items: center;
}

.choice-list-header {
  padding: 0 3px 7px;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.choice-list {
  max-height: 620px;
  padding-right: 3px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
}

.choice-row {
  margin-bottom: 9px;
}

.choice-row input,
.settings-grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  background: #0d0d0d;
  outline: none;
}

.choice-row input {
  min-width: 0;
  padding: 11px 12px;
}

.choice-row input:focus,
.settings-grid select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(214, 180, 90, 0.09);
}

.remove-choice {
  width: 42px;
  height: 42px;
  border: 1px solid #512127;
  border-radius: 11px;
  color: #ff7c89;
  background: rgba(177, 15, 31, 0.12);
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}

.remove-choice:hover {
  background: rgba(177, 15, 31, 0.24);
}

.choice-row.is-eliminated .choice-label,
.choice-row.is-eliminated .choice-weight {
  border-color: rgba(177, 15, 31, 0.55);
  color: #a8a8a8;
  background:
    linear-gradient(90deg, rgba(177, 15, 31, 0.14), rgba(13, 13, 13, 0.96) 42%);
}

.choice-row.is-eliminated .choice-label {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.settings-grid {
  max-width: 320px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.settings-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.settings-grid select {
  padding: 11px 12px;
}

.control-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  min-height: 42px;
  border-radius: 11px;
  padding: 10px 14px;
  border: 1px solid transparent;
  font-weight: 800;
  cursor: pointer;
  transition: transform 130ms ease, filter 130ms ease, border-color 130ms ease;
}

.button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.button-primary {
  border-color: #147d3b;
  background: linear-gradient(180deg, #109143, #08692e);
}

.button-secondary {
  border-color: #3b3b3b;
  background: linear-gradient(180deg, #202020, #151515);
}

.button-danger {
  border-color: #70252e;
  background: linear-gradient(180deg, #6e1520, #490c14);
}

.url-note {
  margin-top: 18px;
  padding: 15px 16px;
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(214, 180, 90, 0.07);
  line-height: 1.45;
}

.url-note strong {
  color: var(--text);
}

.url-note p {
  margin: 5px 0 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 15px;
  border: 1px solid #315b3e;
  border-radius: 12px;
  background: #102318;
  box-shadow: var(--shadow);
  animation: toast-in 180ms ease-out;
}

@keyframes toast-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
    padding-top: 18px;
  }

  .site-header .button {
    padding-inline: 11px;
  }

  .app-shell,
  .site-header {
    width: min(100% - 18px, 1600px);
  }

  .wheel-panel,
  .controls-panel {
    border-radius: 18px;
  }

  .wheel-panel {
    padding: 15px;
  }

  .controls-summary,
  .controls-content {
    padding-left: 15px;
    padding-right: 15px;
  }

  .wheel-stage {
    padding-top: 18px;
  }

  .pointer {
    top: -18px;
    min-width: 74px;
    padding: 6px 9px 7px;
    border-width: 2px;
    font-size: 0.61rem;
  }

  .pointer::before {
    bottom: -31px;
    border-left-width: 15px;
    border-right-width: 15px;
    border-top-width: 32px;
  }

  .pointer::after {
    bottom: -27px;
    border-left-width: 12px;
    border-right-width: 12px;
    border-top-width: 27px;
  }

  .mode-row {
    grid-template-columns: 1fr;
  }

  .controls-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .controls-heading .button {
    width: 100%;
  }

  .choice-list-header,
  .choice-row {
    grid-template-columns: minmax(0, 1fr) 78px 40px;
    gap: 7px;
  }

  .choice-list-header {
    font-size: 0.67rem;
  }

  .summary-action .show-label,
  .summary-action .hide-label {
    display: none;
  }

  .settings-grid {
    max-width: none;
  }

  .control-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.choice-weight {
  color: #00000000!important;
}