@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #14161b00;
  --bg-raised: #1C1F26;
  --gold: #c9a32700;
  --gold-bright: #E4C348;
  --teal: #1F6F6F;
  --ink: #F4F1EA;
  --ink-dim: #A9AEB8;
  --danger: #C24545;
  --radius: 14px;
  --display: 'Fraunces', serif;
  --body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 50% -10%, #22262F 0%, #14161B 55%);
  color: var(--ink);
  font-family: var(--body);
  min-height: 100vh;
}

h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.01em;
}

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

button {
  font-family: var(--body);
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 15px;
  transition: transform 0.08s ease, filter 0.15s ease;
}
button:active { transform: translateY(1px) scale(0.98); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--gold); color: #14161B; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-secondary { background: var(--bg-raised); color: var(--ink); border: 1px solid #333947; }
.btn-secondary:hover:not(:disabled) { filter: brightness(1.2); }
.btn-danger { background: var(--danger); color: var(--ink); }
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); }
.btn-ghost { background: transparent; color: var(--ink-dim); padding: 8px 12px; }
.btn-ghost:hover { color: var(--ink); }

input[type="text"], input[type="number"], input[type="password"], select {
  background: #10121600;
  background: #0F1116;
  border: 1px solid #333947;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 11px;
  font-family: var(--body);
  font-size: 14px;
  width: 100%;
}
input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid #333947;
  background: #0F1116;
}
label { font-size: 12px; color: var(--ink-dim); display: block; margin-bottom: 4px; }

/* ---------- Wheel ---------- */
.wheel-stage {
  position: relative;
  width: min(72vmin, 560px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}
.wheel-ring {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--gold) 0 8%, #8a6d1c 8% 10%, var(--gold) 10% 18%, #8a6d1c 18% 20%, var(--gold) 20% 100%);
  box-shadow: 0 0 0 4px #0f1116, 0 12px 40px rgba(0,0,0,0.55);
}
.wheel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  will-change: transform;
  box-shadow: inset 0 0 0 6px #0f1116, 0 0 0 2px #0f1116;
  background: #222;
}
.wheel-hub {
  position: absolute;
  top: 50%; left: 50%;
  width: 15%; height: 15%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, var(--gold-bright), var(--gold) 60%, #8a6d1c 100%);
  border-radius: 50%;
  box-shadow: 0 0 0 4px #0f1116, 0 4px 14px rgba(0,0,0,0.5);
  z-index: 3;
}
.pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 34px solid var(--gold-bright);
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.5));
  z-index: 4;
}

.winner-banner {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -40%) scale(0.85);
  background: var(--bg-raised);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  padding: 16px 28px;
  border-radius: var(--radius);
  font-family: var(--display);
  font-size: clamp(18px, 3vw, 26px);
  text-align: center;
  box-shadow: 0 14px 40px rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 5;
  white-space: nowrap;
}
.winner-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- View page ---------- */
.view-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 16px;
  gap: 28px;
}
.view-title { font-size: clamp(22px, 4vw, 34px); color: var(--ink); text-align: center; margin: 0; }
.view-sub { color: var(--ink-dim); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; margin-top: -18px; }

/* ---------- Dashboard ---------- */
.dash {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.dash-grid {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .dash-grid { grid-template-columns: 1fr; }
}
.card {
  background: var(--bg-raised);
  border: 1px solid #2A2F3A;
  border-radius: var(--radius);
  padding: 20px;
}
.card h2 { font-size: 17px; margin: 0 0 14px; }
.control-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  background: #0F1116; border: 1px solid #333947; border-radius: 999px;
  padding: 5px 12px; color: var(--ink-dim);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-dim); }
.status-dot.spinning { background: var(--gold-bright); box-shadow: 0 0 8px var(--gold-bright); }
.status-dot.stopped { background: #3E7C4A; }

.section-row {
  border: 1px solid #2A2F3A;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: end;
}
.section-row .thumb {
  width: 44px; height: 44px; border-radius: 8px; object-fit: cover;
  border: 1px solid #333947; background: #0F1116;
}
.section-row .field { min-width: 0; }
.field-inline { display: flex; gap: 8px; align-items: end; }
.remove-btn { color: var(--danger); background: transparent; border: 1px solid transparent; padding: 8px; }
.remove-btn:hover { text-decoration: underline; }

.hint { color: var(--ink-dim); font-size: 12px; line-height: 1.5; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--bg-raised); border: 1px solid var(--gold); color: var(--ink);
  padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0;
  transition: opacity 0.25s ease; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; }

.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.login-card { width: 320px; }
.login-card p.err { color: var(--danger); font-size: 13px; min-height: 16px; }

/* ---------- Effects ---------- */
.pointer { transform-origin: 50% 20%; }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; }
.wheel-stage.won .wheel-ring {
  animation: ringGlow 1.1s ease-in-out infinite alternate;
}
@keyframes ringGlow {
  from { box-shadow: 0 0 0 4px #0f1116, 0 12px 40px rgba(0,0,0,0.55), 0 0 18px 2px rgba(228,195,72,0.35); }
  to   { box-shadow: 0 0 0 4px #0f1116, 0 12px 40px rgba(0,0,0,0.55), 0 0 60px 14px rgba(228,195,72,0.75); }
}
.sound-btn {
  position: fixed; top: 16px; right: 16px; z-index: 40;
  background: var(--bg-raised); color: var(--ink); border: 1px solid #333947;
  padding: 8px 14px; font-size: 13px; border-radius: 999px; opacity: 0.85;
}
.sound-btn.attention { border-color: var(--gold-bright); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(228,195,72,0.25); } }

/* ---------- Presets / settings (dashboard) ---------- */
.preset-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.preset-bar select { flex: 1; min-width: 140px; width: auto; }
.preset-bar button { padding: 9px 12px; font-size: 13px; }
.mode-toggle { display: inline-flex; border: 1px solid #333947; border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.mode-toggle button { border-radius: 0; background: #0F1116; color: var(--ink-dim); padding: 7px 14px; font-size: 13px; }
.mode-toggle button.active { background: var(--gold-bright); color: #14161B; }
textarea.list-input {
  width: 100%; min-height: 220px; resize: vertical; background: #0F1116; border: 1px solid #333947;
  color: var(--ink); border-radius: 8px; padding: 10px 12px; font-family: var(--body); font-size: 15px; line-height: 1.6;
}
.list-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.list-chips span { font-size: 12px; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 14px; margin-bottom: 12px; }
.settings-grid .full { grid-column: 1 / -1; }
.check { display: flex !important; align-items: center; gap: 8px; font-size: 13px !important; color: var(--ink) !important; margin: 0 !important; }
.check input { width: auto; }
details.card-section { border-top: 1px solid #2A2F3A; margin-top: 16px; padding-top: 12px; }
details.card-section summary { cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 15px; margin-bottom: 12px; }
input[type="range"] { width: 100%; }

/* ---------- Tabs / entry list / media cards ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid #2A2F3A; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn { background: transparent; color: var(--ink-dim); border-radius: 8px 8px 0 0; padding: 9px 14px; font-size: 14px; }
.tab-btn.active { color: var(--ink); background: #0F1116; box-shadow: inset 0 -2px 0 var(--gold-bright); }
.card-section h3 { font-size: 15px; margin: 0 0 12px; }
.entry-row { display: grid; grid-template-columns: auto auto 1fr 76px auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.entry-row.off .lbl { opacity: 0.45; text-decoration: line-through; }
.entry-row input[type="checkbox"] { width: 18px; height: 18px; }
.entry-row .swatch { width: 14px; height: 30px; border-radius: 4px; border: 1px solid #333947; }
.media-card { border: 1px solid #2A2F3A; border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.media-card.off { opacity: 0.5; }
.media-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.media-head .thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; border: 1px solid #333947; }
.media-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.media-line label { margin: 0; min-width: 62px; }
.media-line button { padding: 6px 10px; font-size: 12px; }
