/* Wild Oak Home palette: warm oak, walnut, linen and botanical greens */
:root {
  --cream: #F6F0E6;
  --linen: #EDE3D3;
  --sand: #D8C3A5;
  --oak: #A47551;
  --walnut: #5C4033;
  --espresso: #3B2A20;
  --sage: #8A9A5B;
  --olive: #6B7A55;
  --terracotta: #C47A5A;
  --gold: #C9A45C;

  --ink: var(--espresso);
  --muted: #7d6a5c;
  --card: rgba(255, 252, 246, 0.78);
  --line: rgba(92, 64, 51, 0.16);
  --shadow: 0 18px 40px -18px rgba(59, 42, 32, 0.45);
  --radius: 18px;
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  font-family: var(--body);
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(900px 600px at 8% -10%, rgba(138, 154, 91, 0.18), transparent 60%),
    radial-gradient(800px 600px at 105% 15%, rgba(196, 122, 90, 0.16), transparent 60%),
    radial-gradient(700px 500px at 50% 110%, rgba(164, 117, 81, 0.18), transparent 60%);
  background-attachment: fixed;
  overflow-x: hidden;
}

button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ---------- decorative sprigs ---------- */
.sprig {
  position: fixed;
  width: 110px;
  height: 240px;
  fill: rgba(107, 122, 85, 0.22);
  stroke: rgba(107, 122, 85, 0.35);
  stroke-width: 2;
  pointer-events: none;
  z-index: 0;
}
.sprig path { fill: none; }
.sprig-left { left: -10px; bottom: -20px; transform: rotate(14deg); }
.sprig-right { right: -10px; top: 20px; transform: rotate(200deg); }

/* ---------- header ---------- */
.site-header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 36px 16px 8px;
}
.brand {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--oak);
}
.brand span { color: var(--olive); }
.site-header h1 {
  margin: 6px 0 4px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 1;
  color: var(--walnut);
}
.tagline { margin: 0 auto; max-width: 520px; color: var(--muted); }
.header-tools {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.icon-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--walnut);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
}
.icon-btn:hover { background: #fff; }

/* ---------- layout ---------- */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr);
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  align-items: start;
}

/* ---------- wheel stage ---------- */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  position: sticky;
  top: 16px;
}
.wheel-wrap {
  position: relative;
  width: min(100%, 580px);
  aspect-ratio: 1;
  margin-top: 18px;
}
.wheel-wrap::before {
  /* soft glow behind the wheel */
  content: "";
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 164, 92, 0.28), transparent 65%);
  z-index: -1;
}
#wheel {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  box-shadow: 0 30px 60px -25px rgba(59, 42, 32, 0.65), 0 0 0 1px rgba(59, 42, 32, 0.08);
}
.pointer {
  position: absolute;
  top: -22px;
  left: 50%;
  width: 52px;
  height: 64px;
  margin-left: -26px;
  z-index: 3;
  transform-origin: 50% 30%;
  filter: drop-shadow(0 6px 6px rgba(59, 42, 32, 0.35));
}
.pointer svg { width: 100%; height: 100%; }
.pointer path { fill: var(--terracotta); stroke: var(--cream); stroke-width: 3; }
.pointer circle { fill: var(--cream); }

.hub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 21%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 5px solid var(--gold);
  background: radial-gradient(circle at 35% 30%, #7a5743, var(--walnut) 55%, var(--espresso));
  color: var(--cream);
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1rem, 3vw, 1.6rem);
  letter-spacing: 0.12em;
  box-shadow: 0 8px 20px rgba(59, 42, 32, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.15);
  z-index: 2;
  transition: transform 0.15s ease;
}
.hub:disabled { opacity: 1; cursor: default; }
.hub:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.06); }
.hub:active:not(:disabled) { transform: translate(-50%, -50%) scale(0.97); }

.spin-btn {
  border: none;
  border-radius: 999px;
  padding: 16px 44px;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--cream);
  background: linear-gradient(135deg, var(--terracotta), var(--oak));
  box-shadow: 0 14px 26px -12px rgba(164, 117, 81, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.spin-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 18px 30px -12px rgba(164, 117, 81, 0.95); }
.spin-btn:active:not(:disabled) { transform: translateY(1px); }
.spin-btn.small { font-size: 1.2rem; padding: 12px 32px; }

.stage-meta { margin: 0; color: var(--muted); font-size: 0.95rem; text-align: center; }
.stage-meta strong { color: var(--walnut); }
kbd {
  font-family: var(--body);
  font-size: 0.8em;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #fff;
}

/* ---------- side panel ---------- */
.panel { display: flex; flex-direction: column; gap: 18px; }
.card {
  background: var(--card);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--walnut);
}
.step {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sage);
  color: var(--cream);
  font-family: var(--body);
  font-size: 0.9rem;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px 16px;
  border: 2px dashed rgba(164, 117, 81, 0.5);
  border-radius: 14px;
  background: rgba(237, 227, 211, 0.55);
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.dropzone:hover, .dropzone.drag {
  background: rgba(216, 195, 165, 0.55);
  border-color: var(--oak);
}
.dropzone.drag { transform: scale(1.02); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone:focus-within { outline: 3px solid var(--gold); outline-offset: 3px; }
.dz-icon { font-size: 1.8rem; }
.dz-title { font-weight: 600; color: var(--walnut); }
.dz-sub { font-size: 0.85rem; color: var(--muted); }

.file-status {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: var(--olive);
}
.file-status.error { color: #a4442b; }

.import-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin-top: 12px;
  align-items: end;
}
.import-opts .check { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-size: 0.9rem; font-weight: 500; color: var(--walnut); }
.import-opts .field { margin-top: 0; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
select, textarea {
  width: 100%;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
}
textarea { resize: vertical; min-height: 140px; line-height: 1.5; font-size: 0.95rem; }
select:focus, textarea:focus { outline: none; border-color: var(--oak); box-shadow: 0 0 0 3px rgba(164, 117, 81, 0.2); }

.check { display: flex; align-items: center; gap: 9px; font-size: 0.95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--olive); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ghost-btn {
  border: 1px solid var(--line);
  background: #fffdf9;
  color: var(--walnut);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ghost-btn:hover:not(:disabled) { background: var(--linen); border-color: rgba(92, 64, 51, 0.3); }
.ghost-btn.danger { color: #a4442b; }

.winners { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.winners li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 12px;
  animation: slideIn 0.4s ease;
}
.winners .rank {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
}
.winners .w-name { font-weight: 600; word-break: break-word; }
.winners .w-time { margin-left: auto; flex: none; font-size: 0.8rem; color: var(--muted); }
.empty { margin: 0; color: var(--muted); font-size: 0.95rem; }

.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 10px 16px 30px;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--oak);
}

/* ---------- winner modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(59, 42, 32, 0.55);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}
.modal[hidden] { display: none; }
.modal-card {
  position: relative;
  width: min(100%, 560px);
  padding: 40px 32px 32px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(201, 164, 92, 0.25), transparent 60%),
    var(--cream);
  border-radius: 28px;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 8px rgba(246, 240, 230, 0.35), 0 40px 80px -20px rgba(0, 0, 0, 0.5);
  animation: popIn 0.6s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.modal-ribbon { color: var(--gold); letter-spacing: 0.6em; font-size: 1.1rem; }
.congrats {
  margin: 4px 0 6px;
  font-family: var(--display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(2.6rem, 9vw, 4rem);
  line-height: 1.05;
  background: linear-gradient(100deg, var(--terracotta), var(--gold) 40%, var(--oak) 60%, var(--terracotta));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 3s linear infinite;
}
.winner-label {
  margin: 10px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.8rem;
  color: var(--olive);
  font-weight: 600;
}
.winner-name {
  margin: 0 auto;
  display: inline-block;
  max-width: 100%;
  padding: 12px 28px;
  font-size: clamp(1.6rem, 6vw, 2.5rem);
  font-weight: 600;
  color: var(--cream);
  background: linear-gradient(135deg, var(--olive), var(--sage));
  border-radius: 16px;
  box-shadow: 0 12px 24px -12px rgba(107, 122, 85, 0.9);
  word-break: break-word;
  animation: bounceIn 0.8s 0.25s both cubic-bezier(0.2, 1.6, 0.4, 1);
}
.winner-meta { margin: 16px 0 0; color: var(--muted); font-size: 0.9rem; }
.modal-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  transform: translate(-50%, 30px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--walnut);
  color: var(--cream);
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- presentation mode ---------- */
body.present .panel,
body.present .tagline,
body.present .site-footer { display: none; }
body.present .layout { grid-template-columns: 1fr; }
body.present .stage { position: static; }
body.present .wheel-wrap { width: min(92vw, 78vh); }

/* ---------- animations ---------- */
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.6) rotate(-4deg); } }
@keyframes bounceIn { from { opacity: 0; transform: scale(0.3); } }
@keyframes shimmer { to { background-position: 200% center; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 12px 16px 32px; gap: 24px; }
  .stage { position: static; }
  .sprig { width: 70px; height: 150px; opacity: 0.7; }
}
@media (max-width: 480px) {
  .import-opts { grid-template-columns: 1fr; }
  .spin-btn { padding: 14px 32px; font-size: 1.3rem; }
  .modal-card { padding: 32px 20px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
