:root {
  color-scheme: light;
  --paper: #f5efdf;
  --paper-deep: #eadfc8;
  --ink: #251f19;
  --muted: #6e6254;
  --line: rgba(37, 31, 25, 0.16);
  --red: #d94d38;
  --blue: #2f75b5;
  --green: #4f8b62;
  --yellow: #e0a83a;
  --clay: #aa6a45;
  --white: #fffaf0;
  --shadow: 0 28px 80px rgba(66, 51, 29, 0.22);
  font-family: Avenir Next, Gill Sans, Trebuchet MS, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(37, 31, 25, 0.045) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(rgba(37, 31, 25, 0.04) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 28px;
  align-items: stretch;
}

.wheel-panel,
.jobs-panel {
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.wheel-panel {
  min-height: calc(100vh - 64px);
  padding: clamp(22px, 4vw, 48px);
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.wheel-panel::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 2px dashed rgba(37, 31, 25, 0.1);
  pointer-events: none;
}

.intro,
.actions,
.wheel-stage {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: Georgia, Cambria, Times New Roman, serif;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: clamp(3.1rem, 8vw, 7.5rem);
  line-height: 0.86;
}

h2 {
  font-size: 2.3rem;
}

.result-label {
  min-height: 3.2em;
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1.08rem, 2.3vw, 1.55rem);
  font-weight: 700;
  line-height: 1.32;
}

.result-label.is-winner {
  color: var(--ink);
}

.wheel-stage {
  width: min(70vh, 100%);
  max-width: 680px;
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.wheel {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 24px 28px rgba(66, 51, 29, 0.24));
  transition: filter 180ms ease;
}

.wheel-stage.is-spinning .wheel {
  filter: drop-shadow(0 34px 36px rgba(66, 51, 29, 0.34));
}

.pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  z-index: 4;
  width: 34px;
  height: 56px;
  background: var(--ink);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  transform: translateX(-50%);
  filter: drop-shadow(0 8px 8px rgba(37, 31, 25, 0.28));
}

.spin-button {
  position: absolute;
  z-index: 5;
  width: clamp(108px, 18vw, 148px);
  aspect-ratio: 1;
  border: 7px solid var(--white);
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 240, 0.2),
    0 16px 30px rgba(37, 31, 25, 0.28);
  font-family: Georgia, Cambria, Times New Roman, serif;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0;
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.spin-button:hover {
  transform: scale(1.04);
  background: #3a3128;
}

.spin-button:active {
  transform: scale(0.98);
}

.spin-button:focus-visible,
.secondary-button:focus-visible,
.input-row button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.secondary-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 250, 240, 0.72);
  color: var(--ink);
  padding: 10px 14px;
  font-weight: 800;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease;
}

.secondary-button:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 31, 25, 0.34);
  background: var(--white);
}

.jobs-panel {
  max-height: calc(100vh - 64px);
  padding: 24px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 22px;
  overflow: hidden;
}

.panel-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.job-count {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.add-form {
  display: grid;
  gap: 10px;
}

.add-form label {
  font-weight: 900;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
}

input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
  color: var(--ink);
  padding: 12px 13px;
}

.input-row button {
  border: 0;
  border-radius: 4px;
  background: var(--red);
  color: var(--white);
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.job-list {
  min-height: 0;
  margin: 0 -8px 0 0;
  padding: 0 8px 0 0;
  overflow: auto;
  counter-reset: jobs;
  display: grid;
  gap: 8px;
}

.job-list li {
  list-style: none;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid rgba(37, 31, 25, 0.1);
  border-radius: 6px;
  background: rgba(255, 250, 240, 0.62);
  padding: 10px 11px 10px 8px;
  color: var(--ink);
  line-height: 1.32;
}

.job-list li::before {
  counter-increment: jobs;
  content: counter(jobs);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--paper-deep);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 920px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .wheel-panel,
  .jobs-panel {
    min-height: auto;
    max-height: none;
  }

  .jobs-panel {
    overflow: visible;
  }

  .job-list {
    max-height: 420px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: 100%;
    padding: 0;
    gap: 0;
  }

  .wheel-panel,
  .jobs-panel {
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }

  .wheel-panel {
    padding: 24px 18px 20px;
    grid-template-rows: auto auto auto;
  }

  .wheel-panel::before {
    inset: 10px;
  }

  .wheel-stage {
    width: min(94vw, 430px);
    margin: 18px auto;
  }

  .pointer {
    width: 26px;
    height: 44px;
  }
}

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