:root {
  --navy: #0e2a47;
  --navy-deep: #0a1f35;
  --cream: #f5f0e6;
  --cream-card: #fbf8f1;
  --gold: #c9a961;
  --gold-bright: #d8b96e;
  --ink: #1c2733;
  --muted: #6b7785;
  --green: #2e8b57;
  --red: #b3473f;
  --line: #e3dccb;
  --shadow: 0 6px 24px rgba(14, 42, 71, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* Header */
.topbar {
  background: var(--navy);
  color: var(--cream);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar img { height: 30px; width: auto; }
.topbar h1 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: 0.2px; }
.topbar .spacer { flex: 1; }
.save-state { font-size: 12px; color: var(--gold-bright); min-width: 90px; text-align: right; }

/* Toggle */
.controls {
  max-width: 720px;
  margin: 22px auto 0;
  padding: 0 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.seg {
  display: flex;
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px;
  box-shadow: var(--shadow);
}
.seg button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  padding: 11px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.seg button.active { background: var(--navy); color: var(--cream); box-shadow: var(--shadow); }

.tabs { display: flex; gap: 8px; justify-content: center; }
.tabs button {
  border: 1px solid var(--line);
  background: var(--cream-card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.tabs button.active { background: var(--gold); color: var(--navy-deep); border-color: var(--gold); }

/* Stage / carousel */
.stage-wrap { max-width: 560px; margin: 22px auto 0; padding: 0 18px; }
.carousel { display: flex; align-items: center; gap: 10px; }
.arrow {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--cream-card);
  color: var(--navy);
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}
.arrow:disabled { opacity: 0.35; cursor: default; }

.stage {
  position: relative;
  flex: 1;
  max-height: 74vh;
  background: var(--navy-deep);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}
.stage.static { aspect-ratio: 1 / 1; }
.stage.video { aspect-ratio: 9 / 16; }
.stage img, .stage video {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.watermark {
  position: absolute;
  inset: 0;
  background-image: var(--wm);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 82%;
  opacity: 0.17;
  pointer-events: none;
  z-index: 5;
}

/* Previous-winner highlight */
.stage.winner { box-shadow: 0 0 0 4px var(--green), var(--shadow); }
.winner-badge {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  z-index: 6;
  pointer-events: none;
  box-shadow: var(--shadow);
  display: none;
}
.stage.winner .winner-badge { display: block; }
.rank-item.winner-row { border-color: var(--green); box-shadow: 0 0 0 1.5px var(--green), var(--shadow); }

.meta { text-align: center; margin-top: 14px; }
.counter { font-size: 13px; color: var(--muted); }
.label { font-size: 16px; font-weight: 600; margin-top: 3px; }
.current-decision { font-size: 13px; font-weight: 700; margin-top: 6px; height: 18px; }
.current-decision.approved { color: var(--green); }
.current-decision.declined { color: var(--red); }

/* Decision buttons */
.decide { display: flex; gap: 14px; justify-content: center; margin-top: 16px; padding-bottom: 40px; }
.decide button {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--cream-card);
  font-size: 26px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.1s ease;
}
.decide button:active { transform: scale(0.92); }
.decide .approve { color: var(--green); }
.decide .decline { color: var(--red); }
.decide .approve.on { background: var(--green); color: #fff; border-color: var(--green); }
.decide .decline.on { background: var(--red); color: #fff; border-color: var(--red); }

.clear-wrap { text-align: center; margin-top: -28px; padding-bottom: 30px; height: 20px; }
.clear-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  visibility: hidden;
}
.clear-btn.show { visibility: visible; }

/* Buckets */
.bucket { max-width: 560px; margin: 22px auto 60px; padding: 0 18px; }
.bucket .hint { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.bucket .empty { text-align: center; color: var(--muted); padding: 40px 0; }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  cursor: grab;
}
.rank-item.sortable-ghost { opacity: 0.4; }
.rank-num {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy-deep);
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.rank-thumb {
  flex: 0 0 auto;
  width: 42px; height: 56px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--navy-deep);
  position: relative;
}
.rank-thumb-wrap { position: relative; flex: 0 0 auto; }
.rank-thumb-wrap .vbadge {
  position: absolute; bottom: 2px; right: 2px;
  background: rgba(14,42,71,0.85); color: #fff;
  font-size: 9px; padding: 1px 4px; border-radius: 4px;
}
.rank-label { flex: 1; font-size: 14px; font-weight: 600; }
.rank-move {
  flex: 0 0 auto;
  border: none; background: transparent;
  font-size: 13px; color: var(--muted); cursor: pointer;
  padding: 6px;
}
.rank-remove { color: var(--red); }
.grip { color: var(--muted); font-size: 16px; }

/* Dashboard */
.dash { max-width: 1100px; margin: 24px auto; padding: 0 18px; }
.dash h2 { color: var(--navy); border-bottom: 2px solid var(--gold); padding-bottom: 6px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.dash-col h3 { margin: 0 0 10px; }
.dash-col .approved-h { color: var(--green); }
.dash-col .declined-h { color: var(--red); }
.dash-section { margin-bottom: 34px; }
.dash-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--cream-card); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; margin-bottom: 8px;
}
.dash-card img.thumb { width: 38px; height: 50px; object-fit: cover; border-radius: 5px; background: var(--navy-deep); }
.dash-updated { font-size: 12px; color: var(--muted); margin-bottom: 18px; }
@media (max-width: 760px) { .dash-grid { grid-template-columns: 1fr; } }
