/* style.css — all styling */
:root {
  --bg: #0c0e14;
  --bg-2: #131620;
  --surface: #1a1e2a;
  --surface-2: #232838;
  --surface-3: #2c3245;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f0f2f8;
  --muted: #8b94a8;
  --muted-2: #646d82;
  --accent: #ffd166;
  --accent-2: #ef476f;
  --accent-3: #06d6a0;
  --accent-4: #3a86ff;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.3);
  --radius: 16px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef0f7;
    --bg-2: #ffffff;
    --surface: #ffffff;
    --surface-2: #f3f5fb;
    --surface-3: #e8ebf4;
    --border: rgba(15, 17, 28, 0.08);
    --border-strong: rgba(15, 17, 28, 0.16);
    --text: #1a1d28;
    --muted: #646d82;
    --muted-2: #9aa3b8;
    --shadow: 0 12px 36px rgba(20, 25, 45, 0.1);
    --shadow-sm: 0 4px 14px rgba(20, 25, 45, 0.06);
    color-scheme: light;
  }
}

html[data-theme="dark"] {
  --bg: #0c0e14; --bg-2: #131620; --surface: #1a1e2a; --surface-2: #232838; --surface-3: #2c3245;
  --border: rgba(255, 255, 255, 0.07); --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f0f2f8; --muted: #8b94a8; --muted-2: #646d82;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.5); --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #eef0f7; --bg-2: #ffffff; --surface: #ffffff; --surface-2: #f3f5fb; --surface-3: #e8ebf4;
  --border: rgba(15, 17, 28, 0.08); --border-strong: rgba(15, 17, 28, 0.16);
  --text: #1a1d28; --muted: #646d82; --muted-2: #9aa3b8;
  --shadow: 0 12px 36px rgba(20, 25, 45, 0.1); --shadow-sm: 0 4px 14px rgba(20, 25, 45, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
}

body { overflow: hidden; }

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 720px;
  margin: 0 auto;
  background:
    radial-gradient(1100px 580px at 50% -8%, rgba(155, 93, 229, 0.16), transparent 62%),
    radial-gradient(800px 460px at 100% 100%, rgba(6, 214, 160, 0.1), transparent 60%),
    radial-gradient(700px 400px at 0% 60%, rgba(58, 134, 255, 0.08), transparent 60%),
    var(--bg);
}

/* ---------- Top bar ---------- */
.topbar {
  flex: 0 0 auto;
  padding: 16px 18px 4px;
}

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

.logo-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #ef476f, #ffd166, #06d6a0, #3a86ff, #9b5de5, #ef476f);
  box-shadow: 0 0 14px rgba(255, 209, 102, 0.45), inset 0 0 4px rgba(0,0,0,0.2);
  animation: logoSpin 8s linear infinite;
}
@keyframes logoSpin { to { transform: rotate(360deg); } }

.brand h1 {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1;
}

.tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 2px;
}

.tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s, border-color 0.18s, box-shadow 0.18s;
  white-space: nowrap;
}
.tab:hover { background: var(--surface-2); border-color: var(--border-strong); }
.tab:active { transform: scale(0.95); }
.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1d24;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(239, 71, 111, 0.35);
}
.tab-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  opacity: 0.55;
  transition: opacity 0.15s, background 0.15s;
}
.tab-del:hover { opacity: 1; background: rgba(0, 0, 0, 0.2); }
.add-tab {
  border-style: dashed;
  color: var(--muted);
  border-color: var(--border-strong);
}
.add-tab:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Wheel ---------- */
.wheel-wrap {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 4px 8px;
}

.wheel-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wheel {
  display: block;
  filter: drop-shadow(0 16px 36px rgba(0, 0, 0, 0.45));
}

.wheel-hint {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
  transition: opacity 0.3s;
  white-space: nowrap;
}

/* ---------- Winner card ---------- */
.winner-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.8) translateY(8px);
  width: min(84%, 330px);
  background: rgba(22, 26, 36, 0.94);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 24px 24px 20px;
  text-align: center;
  box-shadow: var(--shadow), 0 0 70px rgba(255, 209, 102, 0.22);
  opacity: 0;
  transition: opacity 0.24s, transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.5);
  z-index: 5;
}
html[data-theme="light"] .winner-card { background: rgba(255, 255, 255, 0.95); }

.winner-card.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) translateY(0);
}
.winner-card.locked {
  box-shadow: var(--shadow), 0 0 90px rgba(6, 214, 160, 0.38);
  border-color: rgba(6, 214, 160, 0.4);
}

.winner-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
}
.winner-card.locked .winner-eyebrow { color: var(--accent-3); }

.winner-name {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin: 8px 0 16px;
  word-break: break-word;
  line-height: 1.1;
  background: linear-gradient(135deg, #ffd166, #ef476f 55%, #9b5de5);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.veto-meter {
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin-bottom: 8px;
}
html[data-theme="light"] .veto-meter { background: rgba(15, 17, 28, 0.08); }

.veto-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transform-origin: left center;
  transform: scaleX(1);
  transition: transform 0.08s linear;
}

.veto-count {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

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

.btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  border: none;
  border-radius: 13px;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.18s, filter 0.18s;
}
.btn:active { transform: scale(0.94); }
.btn:hover { filter: brightness(1.08); }

.veto-btn {
  background: linear-gradient(135deg, #ef476f, #ff6b6b);
  color: #fff;
  box-shadow: 0 6px 20px rgba(239, 71, 111, 0.4);
}
.accept-btn {
  background: linear-gradient(135deg, #06d6a0, #3a86ff);
  color: #fff;
  box-shadow: 0 6px 20px rgba(6, 214, 160, 0.35);
}

/* ---------- Options panel ---------- */
.options-panel {
  flex: 0 0 auto;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 14px 16px 6px;
  max-height: 34vh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.options-head {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.opt-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 15px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.opt-input:focus {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.18);
}
.opt-input::placeholder { color: var(--muted-2); }

.add-btn {
  flex: 0 0 auto;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.02em;
  padding: 0 20px;
  border-radius: 13px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1d24;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.18s, filter 0.18s;
  box-shadow: 0 4px 16px rgba(239, 71, 111, 0.3);
}
.add-btn:hover { filter: brightness(1.06); }
.add-btn:active { transform: scale(0.93); }

.options-list {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 2px;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.options-list::-webkit-scrollbar { width: 5px; }
.options-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.options-list::-webkit-scrollbar-track { background: transparent; }

.opt-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 5px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, opacity 0.2s, transform 0.1s;
  animation: rowIn 0.28s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.opt-row:hover { background: var(--surface-2); border-color: var(--border); }
.opt-row:active { transform: scale(0.99); }

.opt-color {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.15);
}

.opt-label {
  flex: 1 1 auto;
  font-size: 15px;
  font-weight: 500;
  word-break: break-word;
  line-height: 1.3;
}

.opt-badge {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(239, 71, 111, 0.14);
  padding: 4px 9px;
  border-radius: 999px;
}
.opt-badge:empty { display: none; }

.opt-row.excluded { opacity: 0.45; }
.opt-row.excluded .opt-label { text-decoration: line-through; }

.opt-remove {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.opt-remove:hover { background: rgba(239, 71, 111, 0.22); color: #fff; }
.opt-remove:active { transform: scale(0.88); }

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 22px 0;
}

.opt-footer {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 2px;
}

.reset-vetoes, .clear-all {
  flex: 1;
  padding: 9px;
  border-radius: 11px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.reset-vetoes:hover { color: var(--accent-3); border-color: var(--accent-3); background: rgba(6,214,160,0.06); }
.clear-all:hover { color: var(--accent-2); border-color: var(--accent-2); background: rgba(239,71,111,0.06); }

/* ---------- Spin button ---------- */
.spin-btn {
  flex: 0 0 auto;
  display: block;
  width: calc(100% - 32px);
  max-width: 460px;
  margin: 10px auto 18px;
  padding: 19px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, #ef476f 0%, #ffd166 50%, #06d6a0 100%);
  background-size: 220% 220%;
  background-position: 0% 50%;
  color: #1a1d24;
  font-family: inherit;
  font-weight: 900;
  font-size: 21px;
  letter-spacing: 0.22em;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(239, 71, 111, 0.42), 0 2px 0 rgba(0, 0, 0, 0.18) inset;
  transition: transform 0.12s, box-shadow 0.2s, background-position 0.7s ease, opacity 0.2s, filter 0.2s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}
.spin-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  background-size: 250% 100%;
  background-position: 150% 0;
  transition: background-position 0.6s ease;
  pointer-events: none;
}
.spin-btn:hover { background-position: 100% 50%; }
.spin-btn:hover::before { background-position: -50% 0; }
.spin-btn:active { transform: translateY(2px) scale(0.99); box-shadow: 0 6px 20px rgba(239, 71, 111, 0.35); }
.spin-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: saturate(0.5);
}
.spin-btn.spinning {
  animation: spinPulse 0.9s ease-in-out infinite;
}
.spin-btn.spinning::before {
  animation: shimmer 1.4s linear infinite;
}
@keyframes spinPulse {
  0%, 100% { box-shadow: 0 12px 32px rgba(239, 71, 111, 0.42); }
  50% { box-shadow: 0 12px 44px rgba(255, 209, 102, 0.6); }
}
@keyframes shimmer {
  to { background-position: -150% 0; }
}

.spin-label { display: inline-block; position: relative; z-index: 1; }

/* ---------- Small screens ---------- */
@media (max-width: 380px) {
  .brand h1 { font-size: 19px; }
  .tag { display: none; }
  .winner-name { font-size: 26px; }
  .spin-btn { font-size: 18px; padding: 17px; letter-spacing: 0.18em; }
  .options-panel { max-height: 30vh; padding: 12px 14px 6px; }
  .topbar { padding: 14px 14px 4px; }
}

@media (min-height: 740px) {
  .options-panel { max-height: 38vh; }
}
