/* ============================================================
   Spin the Bottle — styles.css
   A wine-cellar / speakeasy design system for a party-game
   name picker. Bottle spins in the middle of a round table;
   name tags sit around the rim like place cards.
   ============================================================ */

:root {
  /* Color tokens */
  --ink: #17100c;
  --ink-2: #1e150f;
  --panel: #2a1b14;
  --panel-2: #33221a;
  --wood-ring: #4a2c1c;
  --wood-ring-2: #5c3a26;
  --cream: #f2e7ce;
  --cream-dim: #cbb89a;
  --wine: #7a1f2b;
  --wine-light: #9c3040;
  --gold: #c9a24b;
  --gold-bright: #e6c064;
  --glass-dark: #16241c;
  --glass: #1f332a;
  --glass-hi: #3e5b49;
  --danger: #b23b3b;
  --success: #4c8c5b;

  --hairline-rgb: 242, 231, 206;

  /* Type */
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Space Mono", "Courier New", monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-tight: 0 4px 14px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(ellipse at 50% -10%, #2a1c14 0%, #17100c 55%, #100b08 100%);
  color: var(--cream);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: var(--gold);
  color: #1a1006;
}

a {
  color: var(--gold-bright);
}

button {
  font-family: var(--font-body);
}

/* ---------------- Light theme ---------------- */

body.theme-light {
  --ink: #f7f1e2;
  --ink-2: #efe4cb;
  --panel: #fdf8ec;
  --panel-2: #f3e9d2;
  --wood-ring: #c79f68;
  --wood-ring-2: #e0c08a;
  --cream: #2a1c10;
  --cream-dim: #6b5842;
  --hairline-rgb: 43, 28, 16;
  --shadow-soft: 0 10px 30px rgba(90, 70, 40, 0.18);
  --shadow-tight: 0 4px 14px rgba(90, 70, 40, 0.16);
}

body.theme-light {
  background: radial-gradient(ellipse at 50% -10%, #fffaf0 0%, #f7f1e2 55%, #efe4cb 100%);
}

body.theme-light .table-ring {
  box-shadow:
    inset 0 0 0 2px rgba(43, 28, 16, 0.18),
    inset 0 18px 50px rgba(90, 70, 40, 0.25),
    var(--shadow-soft);
}

body.theme-light .modal-backdrop {
  background: rgba(60, 45, 25, 0.35);
}

* {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}



.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(201, 162, 75, 0.18);
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-text .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  color: var(--cream);
  margin: 0;
}

.brand-text .tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 4px;
}

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

/* ---------------- Buttons ---------------- */

.btn {
  border: 1px solid rgba(var(--hairline-rgb), 0.18);
  background: var(--panel-2);
  color: var(--cream);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(201, 162, 75, 0.5);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

.btn-gold {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #211405;
  border: none;
  font-weight: 700;
}

.btn-gold:hover {
  filter: brightness(1.06);
}

.btn-wine {
  background: linear-gradient(180deg, var(--wine-light), var(--wine));
  color: var(--cream);
  border: 1px solid rgba(var(--hairline-rgb), 0.15);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(var(--hairline-rgb), 0.22);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------------- Layout ---------------- */

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 28px;
  padding: 28px;
  max-width: 1440px;
  margin: 0 auto;
  align-items: start;
}

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

/* ---------------- Stage (bottle + table) ---------------- */

.stage-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.title-row {
  width: 100%;
  display: flex;
  justify-content: center;
}

#pageTitle {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  text-align: center;
  background: transparent;
  border: none;
  color: var(--cream);
  border-bottom: 2px dashed transparent;
  padding: 4px 10px;
  max-width: 90%;
  transition: border-color 0.2s ease;
}

#pageTitle:hover,
#pageTitle:focus {
  border-bottom-color: rgba(201, 162, 75, 0.5);
  outline: none;
}

.stage {
  position: relative;
  width: min(640px, 92vw);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, var(--wood-ring-2) 0%, var(--wood-ring) 55%, #3a2416 78%, #2a1810 100%);
  box-shadow:
    inset 0 0 0 2px rgba(201, 162, 75, 0.25),
    inset 0 18px 50px rgba(0, 0, 0, 0.55),
    var(--shadow-soft);
}

.table-ring::before {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  border: 1px dashed rgba(var(--hairline-rgb), 0.14);
}

.table-ring::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle at 50% 50%,
    rgba(0, 0, 0, 0.05) 0px,
    rgba(0, 0, 0, 0.05) 1px,
    transparent 2px,
    transparent 7px
  );
  opacity: 0.5;
  mix-blend-mode: overlay;
}

.entries-layer {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    0 0 0 3px rgba(201, 162, 75, 0.35),
    inset 0 0 40px rgba(0, 0, 0, 0.45),
    var(--shadow-soft);
  z-index: 1;
}

.wedge {
  transition: filter 0.25s ease;
}

.wedge-label {
  pointer-events: none;
}

.wedge.winner {
  filter: brightness(1.28) saturate(1.15);
  animation: wedgeGlow 0.9s ease-in-out infinite;
}

.wedge-label.winner {
  font-weight: 700;
}

@keyframes wedgeGlow {
  0%, 100% { filter: brightness(1.28) saturate(1.15); }
  50% { filter: brightness(1.5) saturate(1.3); }
}

.bottle-pivot {
  position: relative;
  width: 50%;
  height: 50%;
  z-index: 5;
}

.bottle-pivot svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(0deg);
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.55));
}

.spin-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

#spinBtn {
  font-family: var(--font-display);
  font-size: 1.1rem;
  padding: 14px 38px;
  letter-spacing: 0.02em;
}

.hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cream-dim);
  letter-spacing: 0.06em;
}

/* ---------------- Sidebar / panel ---------------- */

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid rgba(201, 162, 75, 0.18);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.panel + .panel {
  margin-top: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-head h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 0;
  font-weight: 600;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

#entryCount {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--cream-dim);
}

#entriesInput {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  background: var(--ink-2);
  border: 1px solid rgba(var(--hairline-rgb), 0.14);
  border-radius: var(--radius-md);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.7;
  padding: 12px 14px;
  outline: none;
}

#entriesInput:focus {
  border-color: var(--gold);
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.row.between {
  justify-content: space-between;
  align-items: center;
}

.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}

.toggle-label {
  display: flex;
  flex-direction: column;
}

.toggle-label .t {
  font-weight: 600;
  font-size: 0.88rem;
}

.toggle-label .d {
  font-size: 0.74rem;
  color: var(--cream-dim);
  margin-top: 1px;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-pill {
  position: absolute;
  inset: 0;
  background: rgba(var(--hairline-rgb), 0.16);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.slider-pill::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--cream);
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.switch input:checked + .slider-pill {
  background: var(--gold);
}

.switch input:checked + .slider-pill::before {
  transform: translateX(18px);
  background: #221405;
}

.switch input:focus-visible + .slider-pill {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* Bottle color swatches */

.swatches {
  display: flex;
  gap: 10px;
}

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.swatch.active {
  border-color: var(--gold-bright);
}

.swatch:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* Saved lists */

#savedLists {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
}

.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ink-2);
  border: 1px solid rgba(var(--hairline-rgb), 0.1);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.85rem;
}

.saved-item .name {
  cursor: pointer;
  font-weight: 600;
}

.saved-item .del {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.9rem;
}

.empty-note {
  color: var(--cream-dim);
  font-size: 0.8rem;
  font-style: italic;
}

/* ---------------- Winner modal ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 3, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.winner-modal {
  background: linear-gradient(180deg, var(--panel), var(--ink));
  border: 1px solid rgba(201, 162, 75, 0.4);
  border-radius: var(--radius-lg);
  padding: 34px 40px;
  text-align: center;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  transform: translateY(14px) scale(0.97);
  transition: transform 0.25s ease;
}

.modal-backdrop.show .winner-modal {
  transform: translateY(0) scale(1);
}

.winner-modal .eyebrow {
  display: block;
  margin-bottom: 8px;
}

.winner-modal h3 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin: 0 0 22px;
  word-break: break-word;
  color: var(--gold-bright);
}

.winner-modal .modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------------- SEO content section ---------------- */

.content-panel {
  max-width: 1440px;
  margin: 0 auto;
  padding: 8px 28px 20px;
}

.content-inner {
  max-width: 720px;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid rgba(var(--hairline-rgb), 0.14);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
}

.content-inner h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 26px 0 10px;
}

.content-inner h2:first-child {
  margin-top: 0;
}

.content-inner h3 {
  font-family: var(--font-display);
  font-size: 0.98rem;
  margin: 16px 0 6px;
  color: var(--gold-bright);
}

.content-inner p,
.content-inner li {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--cream-dim);
}

.content-inner ul {
  margin: 0;
  padding-left: 20px;
}

.content-inner strong {
  color: var(--cream);
}



.history-panel {
  max-width: 1440px;
  margin: 0 auto 8px;
  padding: 20px 28px;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.history-list .empty-note {
  grid-column: 1 / -1;
}

.history-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: var(--ink-2);
  border: 1px solid rgba(var(--hairline-rgb), 0.12);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.85rem;
}

.history-item .n {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--gold);
  flex-shrink: 0;
}

.history-item .name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



.site-footer {
  text-align: center;
  padding: 30px 20px 40px;
  color: var(--cream-dim);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.site-footer a {
  color: var(--cream-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------------- Toast ---------------- */

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-2);
  border: 1px solid rgba(201, 162, 75, 0.4);
  color: var(--cream);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 60;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Confetti canvas */

#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 55;
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .wedge.winner {
    animation: none;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* Utility */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
