:root {
  color-scheme: light;
  --cream: #f7f2e9;
  --paper: #fffdf7;
  --sage: #cbd9c1;
  --mint: #e6f0df;
  --forest: #183a2b;
  --leaf: #2f6f45;
  --olive: #76824b;
  --gold: #c69b4f;
  --clay: #a8673f;
  --ink: #1d221c;
  --muted: #6f7568;
  --line: rgba(24, 58, 43, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(24, 58, 43, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 58, 43, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 16% 18%, rgba(203, 217, 193, 0.62), transparent 26rem),
    radial-gradient(circle at 86% 12%, rgba(198, 155, 79, 0.2), transparent 24rem),
    var(--cream);
  background-size: 42px 42px, 42px 42px, auto, auto, auto;
  overflow-x: hidden;
}

#celebration {
  position: fixed;
  inset: 0;
  z-index: 20;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  justify-items: center;
  align-items: start;
  padding: clamp(16px, 4vw, 44px);
}

.wheel-stage {
  width: min(1080px, 100%);
  min-height: min(720px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  align-items: center;
  gap: clamp(14px, 2.4vw, 26px);
  padding: clamp(20px, 4vw, 42px);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.92), rgba(247, 242, 233, 0.82)),
    var(--paper);
  box-shadow: 0 28px 90px rgba(24, 58, 43, 0.15);
}

.brand-panel {
  width: min(480px, 82vw);
  text-align: center;
}

.top-logo {
  width: 100%;
  max-height: 92px;
  object-fit: contain;
  display: block;
  transform: translateX(22px);
  mix-blend-mode: multiply;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
}

.eyebrow,
.result-label {
  margin: 0;
  color: var(--leaf);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 8px 0 10px;
  color: var(--forest);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 7vw, 5.8rem);
  font-weight: 700;
  line-height: 0.94;
  letter-spacing: 0;
}

.tagline {
  margin: 0 auto;
  max-width: 52ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.14rem);
  line-height: 1.55;
}

.machine {
  position: relative;
  width: min(78vw, 640px, 53vh);
  min-width: 300px;
  display: grid;
  place-items: center;
  padding-top: 24px;
}

.pointer {
  position: absolute;
  z-index: 5;
  top: -2px;
  left: 50%;
  width: clamp(42px, 6vw, 58px);
  height: clamp(54px, 8vw, 82px);
  transform: translateX(-50%);
  filter: drop-shadow(0 6px 10px rgba(24, 58, 43, 0.22));
}

.pointer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--forest);
  clip-path: polygon(50% 100%, 8% 0, 50% 14%, 92% 0);
}

.pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(198, 155, 79, 0.2);
}

.wheel-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  box-shadow:
    0 0 0 1px var(--line),
    0 0 0 10px rgba(24, 58, 43, 0.12),
    0 28px 60px rgba(24, 58, 43, 0.18);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
}

.hub {
  position: absolute;
  width: 35%;
  min-width: 150px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 50%;
  background: var(--paper);
  border: 5px solid var(--paper);
  box-shadow:
    0 0 0 2px rgba(24, 58, 43, 0.22),
    0 16px 36px rgba(24, 58, 43, 0.18);
  overflow: hidden;
}

.hub img {
  width: 92%;
  height: 48%;
  object-fit: contain;
  display: block;
  mix-blend-mode: multiply;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
}

.actions {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(360px, 100%);
}

.spin-button {
  width: 100%;
  min-height: 60px;
  border: 0;
  border-radius: 4px;
  color: var(--paper);
  background: linear-gradient(135deg, var(--forest), var(--leaf));
  box-shadow: 0 14px 24px rgba(24, 58, 43, 0.22);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.spin-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 28px rgba(24, 58, 43, 0.25);
}

.spin-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.result {
  display: grid;
  gap: 3px;
  min-height: 58px;
  text-align: center;
}

.result[hidden] {
  display: none;
}

.result strong {
  color: var(--forest);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.3rem, 3vw, 2rem);
  line-height: 1.1;
}

.result:empty {
  display: none;
}

@media (max-width: 700px) {
  .wheel-stage {
    min-height: auto;
    padding: 22px 14px 26px;
  }

  .machine {
    width: min(88vw, 500px, 52vh);
    min-width: 0;
  }

  .pointer {
    right: -7px;
  }
}

.admin-shell {
  min-height: 100vh;
  padding: clamp(18px, 4vw, 42px);
  display: grid;
  place-items: start center;
}

.admin-panel {
  width: min(1120px, 100%);
  padding: clamp(18px, 3vw, 34px);
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.92);
  box-shadow: 0 28px 90px rgba(24, 58, 43, 0.12);
}

.admin-header {
  display: grid;
  grid-template-columns: minmax(170px, 280px) 1fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
}

.admin-logo {
  width: 100%;
  mix-blend-mode: multiply;
}

.admin-header h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 4vw, 4rem);
}

.admin-header p,
.admin-message,
.preview-link {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin-bottom: 18px;
}

.secondary-button,
.icon-button {
  min-height: 44px;
  border: 1px solid rgba(24, 58, 43, 0.28);
  border-radius: 4px;
  color: var(--forest);
  background: var(--paper);
  font-weight: 850;
  cursor: pointer;
}

.secondary-button {
  padding: 0 18px;
}

.icon-button {
  width: 42px;
  font-size: 1.5rem;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
}

.admin-table th {
  color: var(--leaf);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
}

.admin-table th,
.admin-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(24, 58, 43, 0.12);
}

.admin-table input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(24, 58, 43, 0.18);
  border-radius: 4px;
  padding: 0 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  font: inherit;
}

.admin-table input[type="color"] {
  padding: 4px;
}

.admin-message[data-type="success"] {
  color: var(--leaf);
  font-weight: 800;
}

.admin-message[data-type="error"] {
  color: #9d3528;
  font-weight: 800;
}

.preview-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--forest);
  font-weight: 850;
}

@media (max-width: 760px) {
  .admin-header {
    grid-template-columns: 1fr;
  }

  .admin-logo {
    max-width: 280px;
  }
}
