:root {
  color-scheme: light;
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #e8edf5;
  --line: #d5dce8;
  --text: #111827;
  --muted: #5f6b7a;
  --soft: #7b8796;
  --brand: #2158df;
  --brand-strong: #1746b8;
  --green: #0fa77a;
  --yellow: #f0a51a;
  --red: #e84d68;
  --blue: #2563eb;
  --violet: #7c3aed;
  --teal: #0ea5b7;
  --radius: 8px;
  --shadow: 0 18px 40px rgba(26, 37, 64, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f8fbff 0, var(--bg) 420px, #eef2f7 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -50px;
  z-index: 10;
  background: var(--brand);
  border-radius: var(--radius);
  color: #fff;
  padding: 10px 14px;
}

.skip-link:focus {
  top: 12px;
}

.site-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
  font-weight: 800;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    conic-gradient(from -20deg, var(--blue) 0 22%, var(--green) 0 44%, var(--yellow) 0 63%, var(--red) 0 80%, var(--violet) 0 100%);
  border: 3px solid #fff;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.8), 0 2px 10px rgba(26, 37, 64, 0.18);
}

.brand-text {
  font-size: 1.05rem;
}

.top-nav,
.site-footer nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
}

.top-nav a:hover,
.site-footer a:hover {
  color: var(--text);
}

.site-footer nav {
  color: #c8d1df;
}

.site-footer a:hover {
  color: #fff;
}

.ad-slot,
.ad-rail,
.mini-ad {
  display: grid;
  place-items: center;
  color: #7a8494;
  border: 1px dashed #c4ccd8;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(245, 248, 252, 0.78));
  border-radius: var(--radius);
  min-height: 64px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.72rem;
}

.ad-slot-top {
  max-width: 760px;
  min-height: 54px;
  margin: 16px auto 0;
}

.tool-shell {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(460px, 1fr) minmax(180px, 280px);
  gap: 22px;
  width: min(1760px, calc(100% - 32px));
  margin: 18px auto 0;
  align-items: stretch;
}

.ad-rail {
  min-height: 176px;
  align-self: start;
  position: sticky;
  top: 88px;
  grid-column: 3;
  grid-row: 1;
}

.wheel-stage {
  min-height: 650px;
  display: grid;
  grid-template-rows: auto auto auto minmax(330px, 1fr);
  align-items: center;
  justify-items: center;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  grid-column: 2;
  grid-row: 1;
}

.stage-title {
  width: min(680px, 100%);
  justify-self: start;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.72rem;
  font-weight: 900;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 3.4rem;
  line-height: 1;
}

.stage-title p:not(.eyebrow),
.panel-intro p {
  color: var(--muted);
  margin: 8px 0 0;
}

.mode-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 8px;
}

.mode-card {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
  color: var(--text);
  text-align: left;
  padding: 12px;
}

.mode-card:hover,
.mode-card:focus-visible {
  border-color: #8fabff;
  box-shadow: 0 0 0 3px rgba(33, 88, 223, 0.12);
}

.mode-card span {
  display: block;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 900;
}

.mode-card strong {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
  line-height: 1.15;
}

.wheel-wrap {
  position: relative;
  width: min(76vh, 760px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

#wheelCanvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 18px 28px rgba(26, 37, 64, 0.18));
}

.wheel-center {
  position: absolute;
  width: clamp(116px, 18%, 152px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0;
  color: var(--text);
  background: #fff;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  box-shadow: 0 10px 28px rgba(26, 37, 64, 0.18);
}

.wheel-center:disabled,
.primary-action:disabled {
  cursor: wait;
  opacity: 0.8;
}

.center-primary {
  font-size: 1.55rem;
  font-weight: 900;
}

.center-secondary {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.pointer {
  position: absolute;
  top: -2px;
  left: calc(50% - 28px);
  width: 0;
  height: 0;
  border-left: 28px solid transparent;
  border-right: 28px solid transparent;
  border-top: 58px solid #111827;
  filter: drop-shadow(0 6px 8px rgba(26, 37, 64, 0.22));
  z-index: 2;
}

.winner-strip {
  width: min(680px, 100%);
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.session-cards {
  width: min(680px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.session-cards div {
  min-height: 68px;
  display: grid;
  gap: 4px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
  padding: 12px;
}

.session-cards span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.session-cards strong {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.winner-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

#winnerName {
  font-size: 1.45rem;
  text-align: right;
  overflow-wrap: anywhere;
}

.control-panel {
  min-height: 660px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  grid-column: 1;
  grid-row: 1;
}

.panel-intro h2 {
  margin-bottom: 0;
  font-size: 1.7rem;
  line-height: 1.15;
}

.field-label span,
.section-heading h2 span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.8rem;
}

.toolbar-row,
.action-row,
.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.draw-settings {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.stepper {
  display: grid;
  grid-template-columns: 38px 54px 38px;
  gap: 6px;
  align-items: center;
}

.stepper input {
  width: 54px;
  height: 38px;
  border: 1px solid #c8d1df;
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  text-align: center;
  font-weight: 900;
}

.step-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-weight: 950;
}

.step-button:hover {
  background: var(--brand);
  color: #fff;
}

.icon-button,
.secondary-action,
.text-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-2);
  font-weight: 850;
}

.icon-button {
  min-height: 40px;
  padding: 0 13px;
}

.icon-button:hover,
.secondary-action:hover,
.text-button:hover {
  background: #333844;
  color: #fff;
}

.field-label {
  color: var(--muted);
  font-weight: 850;
}

textarea {
  width: 100%;
  min-height: 265px;
  resize: vertical;
  border: 1px solid #c8d1df;
  border-radius: var(--radius);
  color: var(--text);
  background: #fbfcff;
  padding: 14px;
  outline: none;
}

textarea:focus {
  border-color: #7fa0ff;
  box-shadow: 0 0 0 3px rgba(76, 125, 255, 0.24);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.primary-action,
.secondary-action {
  min-height: 48px;
  padding: 0 18px;
}

.primary-action {
  flex: 1;
  min-width: 180px;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-weight: 950;
}

.primary-action:hover {
  background: var(--brand-strong);
}

.secondary-action {
  min-width: 100px;
}

.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.results-panel {
  padding-top: 4px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.section-actions {
  display: flex;
  gap: 8px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.02rem;
}

.text-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.85rem;
}

.results-list {
  display: grid;
  gap: 6px;
  max-height: 130px;
  overflow: auto;
  margin: 0;
  padding-left: 26px;
  color: var(--muted);
}

.results-list li::marker {
  color: #7fa0ff;
  font-weight: 900;
}

.mini-ad {
  min-height: 58px;
  margin-top: auto;
}

.content-band {
  margin-top: 28px;
  background: #ffffff;
  color: #14171f;
}

.content-inner {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0;
}

.tool-copy {
  max-width: 760px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0 8px;
}

.feature-grid article {
  min-height: 150px;
  border: 1px solid #dde2ec;
  border-radius: var(--radius);
  background: #fff;
  padding: 18px;
}

.feature-grid h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.feature-grid p {
  margin: 0;
  color: #404756;
}

.tool-copy h2,
.faq h2,
.policy-page h1,
.policy-page h2 {
  letter-spacing: 0;
}

.tool-copy h2,
.faq h2 {
  font-size: 2.05rem;
  line-height: 1.15;
}

.tool-copy p,
.faq p,
.policy-page p,
.policy-page li {
  color: #404756;
}

.ad-slot-wide {
  min-height: 78px;
  margin: 28px 0;
  color: #687080;
  background: #fff;
  border-color: #d6dbe5;
}

.faq {
  display: grid;
  gap: 10px;
}

details {
  border: 1px solid #dde2ec;
  border-radius: var(--radius);
  background: #fff;
  padding: 16px 18px;
}

summary {
  cursor: pointer;
  font-weight: 900;
}

details p {
  margin: 10px 0 0;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  padding: 28px 24px;
  border-top: 1px solid var(--line);
  background: #111827;
  color: #fff;
}

.site-footer p {
  max-width: 520px;
  margin: 6px 0 0;
  color: #c8d1df;
}

.policy-page {
  background: #f5f7fb;
  color: #15171f;
}

.policy-main {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 64px;
}

.policy-main a {
  color: #245fe4;
  text-decoration: underline;
}

.policy-main section {
  padding: 22px 0;
  border-bottom: 1px solid #dce2ec;
}

.policy-main h1 {
  font-size: 2.75rem;
  line-height: 1.05;
}

.policy-main h2 {
  margin-bottom: 8px;
}

.policy-main ul {
  padding-left: 22px;
}

.notice-box {
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  background: #fff;
  padding: 16px;
  color: #404756;
}

@media (max-width: 1280px) {
  .tool-shell {
    grid-template-columns: minmax(420px, 1fr) minmax(330px, 390px);
  }

  .ad-rail {
    display: none;
  }

  .wheel-stage {
    grid-column: 1;
  }

  .control-panel {
    grid-column: 2;
  }
}

@media (max-width: 900px) {
  h1 {
    font-size: 2.55rem;
  }

  .tool-copy h2,
  .faq h2 {
    font-size: 1.8rem;
  }

  .policy-main h1 {
    font-size: 2.35rem;
  }

  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav,
  .site-footer nav {
    flex-wrap: wrap;
  }

  .tool-shell {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 680px);
  }

  .wheel-stage,
  .control-panel {
    grid-column: auto;
  }

  .wheel-stage,
  .control-panel {
    min-height: auto;
  }

  .wheel-wrap {
    width: min(100%, 600px);
  }

  .mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-panel {
    order: 1;
  }

  .wheel-stage {
    order: 2;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 2rem;
  }

  .center-primary {
    font-size: 1.15rem;
  }

  #winnerName {
    font-size: 1.16rem;
  }

  .tool-copy h2,
  .faq h2 {
    font-size: 1.55rem;
  }

  .policy-main h1 {
    font-size: 2rem;
  }

  .site-header {
    padding: 14px 16px;
  }

  .ad-slot-top {
    width: calc(100% - 20px);
    min-height: 48px;
  }

  .wheel-stage {
    padding: 12px;
  }

  .pointer {
    top: -1px;
    left: calc(50% - 19px);
    border-left-width: 19px;
    border-right-width: 19px;
    border-top-width: 39px;
  }

  .winner-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .session-cards,
  .draw-settings {
    grid-template-columns: 1fr;
  }

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

  .stepper {
    grid-template-columns: 42px 1fr 42px;
  }

  .stepper input {
    width: 100%;
  }

  #winnerName {
    text-align: left;
  }

  textarea {
    min-height: 220px;
  }

  .content-inner {
    padding: 32px 0;
  }
}
