:root {
  --bg: #f4efe7;
  --paper: #fffaf2;
  --ink: #1f1a17;
  --muted: #6e6258;
  --line: #dccfbe;
  --accent: #d6603d;
  --accent-2: #2f6c62;
  --chip: #efe3d4;
  --shadow: 0 18px 50px rgba(74, 51, 29, 0.12);
  --radius: 22px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(214, 96, 61, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(47, 108, 98, 0.16), transparent 28%),
    linear-gradient(180deg, #f7f0e8 0%, #f2ebe3 100%);
  color: var(--ink);
}

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

button,
input,
textarea,
select {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 16px 0 48px;
}

.topbar,
.hero,
.content-grid {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: 1fr;
  align-items: end;
  margin-bottom: 18px;
}

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

.nav a,
.chip,
button {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 11px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.chip.active,
button,
.hero-card.accent {
  background: var(--accent);
  color: #fff8f1;
  border-color: transparent;
}

button.secondary {
  background: var(--chip);
  color: var(--ink);
}

.panel,
.hero-card {
  background: rgba(255, 250, 242, 0.88);
  border: 1px solid rgba(220, 207, 190, 0.9);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.hero {
  grid-template-columns: 1.35fr 0.85fr;
  margin-bottom: 16px;
}

.wheel-showcase {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 16px;
  align-items: center;
  justify-items: center;
  text-align: center;
}

.wheel-copy {
  width: min(100%, 760px);
}

.content-grid {
  grid-template-columns: 1.45fr 0.75fr;
  align-items: start;
}

.cards {
  display: grid;
  gap: 14px;
}

.sidebar {
  display: grid;
  gap: 14px;
}

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

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

h1,
h2,
h3,
.score {
  margin: 0;
}

h1,
h2,
h3 {
  line-height: 1.05;
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
}

h3 {
  font-size: clamp(1.15rem, 2vw, 1.7rem);
}

.lede,
.meta,
.address-line,
.reason,
.source,
.image-card figcaption,
.saved-item p,
.history-row p {
  color: var(--muted);
}

.score {
  font-size: 1.2rem;
}

.toolbar,
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.day-agenda {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.image-carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 260px);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin: 12px 0;
  scroll-snap-type: x proximity;
}

.image-card {
  margin: 0;
  background: rgba(255, 248, 238, 0.72);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  scroll-snap-align: start;
}

.image-card img {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.image-card figcaption {
  padding: 10px 12px 12px;
  font-size: 0.86rem;
}

.subtle {
  background: rgba(255, 248, 238, 0.72);
  box-shadow: none;
}

.wheel-result.is-revealed {
  border-color: rgba(214, 96, 61, 0.38);
}

.wheel-result-final {
  min-height: 0;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 240ms ease, transform 320ms ease;
  pointer-events: none;
}

.wheel-result-final.is-visible {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(214, 96, 61, 0.14), rgba(47, 108, 98, 0.12));
  border: 1px solid rgba(214, 96, 61, 0.28);
  box-shadow: var(--shadow);
  opacity: 1;
  transform: translateY(0) scale(1);
}

.winner-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.8);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.accent-eyebrow {
  color: rgba(255, 248, 241, 0.88);
}

.tags span {
  background: var(--chip);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.84rem;
}

.context-tags {
  margin-top: 10px;
}

.context-tags span {
  background: rgba(47, 108, 98, 0.12);
  color: var(--accent-2);
  border: 1px solid rgba(47, 108, 98, 0.16);
}

.inline-form {
  display: inline-block;
  margin-right: 8px;
  margin-top: 6px;
}

.stack {
  display: grid;
  gap: 14px;
}

.compact {
  margin-top: 12px;
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label span {
  display: block;
  margin-bottom: 6px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: #fffdf9;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox input {
  width: auto;
}

.auth-panel {
  max-width: 420px;
  margin: 12vh auto 0;
}

.error {
  color: #912f2f;
}

.table-list,
.saved-item {
  display: grid;
  gap: 12px;
}

.saved-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.source-row,
.history-row {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.source-row:first-child,
.history-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.source-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0;
}

.badge-on,
.badge-off {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.84rem;
}

.badge-on {
  background: rgba(47, 108, 98, 0.14);
  color: var(--accent-2);
}

.badge-off {
  background: rgba(110, 98, 88, 0.12);
  color: var(--muted);
}

.driver-result {
  margin-top: 12px;
  font-weight: 600;
}

.info-panel {
  margin-bottom: 16px;
}

.explainers {
  margin-top: 12px;
}

.learning-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(239, 227, 212, 0.58);
}

.submission-thumb {
  margin-top: 10px;
  max-width: min(100%, 220px);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.source-accordion,
.rate-box {
  margin-top: 10px;
}

.source-accordion summary,
.rate-box summary {
  cursor: pointer;
  color: var(--ink);
}

.source-preview {
  color: var(--muted);
  margin: 12px 0 8px;
}

.source-link {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.knock-draft {
  margin: 10px 0;
  min-height: 90px;
}

.wheel-stage {
  position: relative;
  display: grid;
  gap: 18px;
  align-items: center;
  justify-items: center;
  min-height: 380px;
  padding: 18px 0 8px;
}

.wheel {
  --wheel-gradient: conic-gradient(#d6603d 0deg 180deg, #2f6c62 180deg 360deg);
  width: min(360px, calc(100vw - 96px));
  height: min(360px, calc(100vw - 96px));
  border-radius: 50%;
  background-color: #d6603d;
  background-image: var(--wheel-gradient);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  border: 10px solid rgba(255, 250, 242, 0.98);
  outline: 1px solid rgba(31, 26, 23, 0.08);
  box-shadow: var(--shadow);
  position: relative;
  transition: transform 4.8s cubic-bezier(0.15, 0.9, 0.12, 1);
  overflow: hidden;
}

.wheel::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 250, 242, 0.42);
}

.wheel-center {
  position: absolute;
  inset: 50%;
  width: 124px;
  height: 124px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 250, 242, 0.96);
  z-index: 3;
  box-shadow: 0 10px 24px rgba(31, 26, 23, 0.16);
}

.wheel-center button {
  min-width: 0;
  width: 94px;
  height: 94px;
  border-radius: 50%;
  padding: 0;
}

.wheel-pointer {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 32px solid var(--ink);
  z-index: 5;
}

.wheel-labels {
  position: absolute;
  inset: 0;
}

.wheel-label {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 104px;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.wheel-label-text {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.18);
  color: #fffdf9;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.1;
  text-shadow: 0 2px 8px rgba(31, 26, 23, 0.42);
  box-shadow: 0 8px 20px rgba(31, 26, 23, 0.12);
  backdrop-filter: blur(4px);
}

@media (max-width: 780px) {
  .wheel-showcase,
  .hero,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 18px, 1120px);
  }

  .nav {
    overflow-x: auto;
    padding-bottom: 6px;
    flex-wrap: nowrap;
  }

  .topbar {
    gap: 14px;
  }

  .hero-card,
  .panel {
    padding: 16px;
  }

  .wheel-stage {
    min-height: 320px;
    padding-top: 10px;
  }

  .wheel {
    width: min(310px, calc(100vw - 72px));
    height: min(310px, calc(100vw - 72px));
  }

  .wheel-label {
    width: 92px;
    min-height: 38px;
  }

  .wheel-label-text {
    font-size: 0.66rem;
    padding: 5px 6px;
  }

  .rating-grid {
    grid-template-columns: 1fr;
  }
}
