:root {
  --bg0: #0c0b0a;
  --bg1: #161311;
  --bg2: #211c18;
  --text: #f4efe8;
  --muted: #9a9086;
  --line: rgba(244, 239, 232, 0.12);
  --sam: #5b8fd9;
  --sam-deep: #2f5f9e;
  --dean: #d4a017;
  --dean-deep: #9a6f08;
  --danger: #e85d4c;
  --ok: #3ecf8e;
  --radius: 18px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  --font-display: "Bebas Neue", Impact, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg0);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(212, 160, 23, 0.12), transparent 55%),
    radial-gradient(90% 60% at 100% 100%, rgba(91, 143, 217, 0.1), transparent 50%),
    linear-gradient(180deg, #12100e 0%, var(--bg0) 45%, #090807 100%);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

img {
  display: block;
  max-width: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

.app {
  width: min(100%, 480px);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    calc(12px + var(--safe-top))
    16px
    calc(16px + var(--safe-bottom));
  position: relative;
}

/* HOTTER SPLASH */
.hotter-splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(24px + var(--safe-top))
    24px
    calc(24px + var(--safe-bottom));
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(212, 160, 23, 0.18), transparent 55%),
    radial-gradient(90% 60% at 100% 100%, rgba(91, 143, 217, 0.14), transparent 50%),
    linear-gradient(180deg, #12100e 0%, var(--bg0) 45%, #090807 100%);
  transition:
    opacity 0.65s ease,
    transform 0.65s ease,
    visibility 0.65s ease;
}

.hotter-splash[hidden] {
  display: none;
}

.hotter-splash.is-out {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.06) translateY(-18px);
  pointer-events: none;
}

.hotter-splash-inner {
  width: min(100%, 360px);
  text-align: center;
  animation: splash-in 0.55s ease both;
}

.hotter-splash-portrait {
  position: relative;
  width: min(72%, 260px);
  margin: 0 auto 18px;
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  filter: drop-shadow(0 22px 36px rgba(0, 0, 0, 0.6));
}

.hotter-splash-portrait[hidden] {
  display: none;
}

.hotter-splash-portrait.is-tied {
  align-items: stretch;
  filter: drop-shadow(0 22px 36px rgba(0, 0, 0, 0.6));
  background: none;
  border: none;
  border-radius: 0;
}

.hotter-splash-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
}

.hotter-splash-portrait.is-tied img {
  object-fit: cover;
  object-position: center;
}

.hotter-splash-tied {
  display: none;
}

.hotter-splash-kicker {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  font-weight: 600;
}

.hotter-splash-line {
  margin: 12px 0 0;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 13vw, 3.8rem);
  letter-spacing: 0.03em;
  line-height: 1;
}

.hotter-splash-line.is-sam {
  color: var(--sam);
}

.hotter-splash-line.is-dean {
  color: var(--dean);
}

.hotter-splash-line.is-tie {
  color: var(--muted);
}

.hotter-splash-bar {
  margin-top: 22px;
  width: min(100%, 300px);
}

@keyframes splash-in {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hotter-splash,
  .hotter-splash-inner {
    animation: none;
    transition-duration: 0.01ms;
  }

  .hotter-splash.is-out {
    transform: none;
  }
}

.top-bar {
  text-align: center;
  padding: 4px 8px 12px;
  flex-shrink: 0;
}

.hotter-line {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6vw, 2rem);
  letter-spacing: 0.04em;
  line-height: 1;
}

.hotter-line.is-sam {
  color: var(--sam);
}

.hotter-line.is-dean {
  color: var(--dean);
}

.hotter-line.is-tie {
  color: var(--muted);
}

.vote-counts {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  animation: fade-up 0.35s ease both;
}

.screen.is-active {
  display: flex;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* NAME */
.name-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 8px 8px 16px;
  min-height: 0;
}

.home-shot {
  margin: 14px auto 0;
  width: min(100%, 260px);
  max-height: min(32vh, 280px);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: fade-up 0.45s ease 0.05s both;
  flex-shrink: 1;
  line-height: 0;
}

.home-shot img {
  width: 100%;
  height: 100%;
  max-height: min(32vh, 280px);
  display: block;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 11vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand span {
  display: inline;
  font-size: 0.55em;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin: 0 0.2em;
  vertical-align: 0.08em;
}

.tagline {
  margin: 14px auto 0;
  max-width: 26ch;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.name-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 8px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.name-input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 16px 18px;
  font-size: 1.05rem;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.name-input:focus {
  border-color: rgba(212, 160, 23, 0.55);
  background: rgba(255, 255, 255, 0.06);
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: linear-gradient(180deg, #f0d078 0%, var(--dean) 100%);
  color: #1a1408;
  box-shadow: 0 10px 28px rgba(212, 160, 23, 0.28);
  margin-top: 4px;
}

.btn--ghost {
  color: var(--muted);
  font-weight: 600;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(154, 144, 134, 0.45);
}

.btn--ghost:hover {
  color: var(--text);
}

/* SWIPE */
.progress-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 0 4px;
}

.progress-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.progress-dot.is-current {
  transform: scale(1.25);
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.progress-dot.is-sam {
  background: var(--sam);
  border-color: rgba(91, 143, 217, 0.7);
  box-shadow: 0 0 10px rgba(91, 143, 217, 0.35);
}

.progress-dot.is-dean {
  background: var(--dean);
  border-color: rgba(212, 160, 23, 0.7);
  box-shadow: 0 0 10px rgba(212, 160, 23, 0.35);
}

.deck {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: min(72vw, 360px);
  perspective: 1200px;
  touch-action: none;
}

.card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(100%, 420px);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg2);
  box-shadow: var(--shadow);
  will-change: transform;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  touch-action: none;
}

.card--next {
  z-index: 1;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.94);
  opacity: 0.92;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.card--next.is-rising {
  transition:
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.34s ease;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.card--next.is-empty {
  opacity: 0;
  visibility: hidden;
}

.card--active {
  z-index: 2;
  cursor: grab;
  transition: box-shadow 0.2s ease;
}

.card--active.is-dragging {
  cursor: grabbing;
  box-shadow: 0 28px 50px rgba(0, 0, 0, 0.65);
}

.card--active.is-fly-sam {
  transition: transform 0.38s cubic-bezier(0.4, 0, 1, 0.4) !important;
}

.card--active.is-fly-dean {
  transition: transform 0.38s cubic-bezier(0.4, 0, 1, 0.4) !important;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 8px 14px;
  border: 4px solid currentColor;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 2.2rem;
  letter-spacing: 0.08em;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  transition: opacity 0.08s linear;
}

.stamp--sam {
  color: var(--sam);
  transform: translate(-50%, -50%) rotate(-18deg) scale(1.1);
}

.stamp--dean {
  color: var(--dean);
  transform: translate(-50%, -50%) rotate(18deg) scale(1.1);
}

.stamp.is-pop {
  animation: stamp-pop 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes stamp-pop {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-18deg) scale(1.35);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-18deg) scale(1);
  }
}

.stamp--dean.is-pop {
  animation-name: stamp-pop-dean;
}

@keyframes stamp-pop-dean {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(18deg) scale(1.35);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(18deg) scale(1);
  }
}

.actions {
  display: grid;
  grid-template-columns: 64px 1fr 1fr;
  gap: 12px;
  padding-top: 18px;
  align-items: center;
}

.action {
  height: 64px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.action:active:not(:disabled) {
  transform: scale(0.96);
}

.action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.action--undo {
  width: 64px;
  color: var(--muted);
}

.action--sam {
  border-color: rgba(91, 143, 217, 0.45);
  background: linear-gradient(180deg, rgba(91, 143, 217, 0.18), rgba(91, 143, 217, 0.06));
  color: #c9dcff;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.06em;
  line-height: 1;
}

.action--dean {
  border-color: rgba(212, 160, 23, 0.5);
  background: linear-gradient(180deg, rgba(212, 160, 23, 0.2), rgba(212, 160, 23, 0.06));
  color: #ffe7a0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.06em;
  line-height: 1;
}

/* RESULTS */
.back-link {
  align-self: flex-start;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 4px 0 12px;
}

.back-link:hover {
  color: var(--text);
}

.results-hero {
  text-align: center;
  padding: 4px 4px 20px;
}

.winner-portrait {
  position: relative;
  width: min(58%, 220px);
  margin: 0 auto 12px;
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-up 0.4s ease both;
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.55));
}

.winner-portrait.is-tied {
  align-items: stretch;
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.55));
  background: none;
  border: none;
  border-radius: 0;
}

.winner-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
}

.winner-portrait.is-tied img {
  object-fit: cover;
  object-position: center;
}

.winner-tied {
  display: none;
}

.results-kicker {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 600;
}

.results-title {
  margin: 10px 0 0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 12vw, 3.4rem);
  letter-spacing: 0.03em;
  line-height: 1;
}

.results-title.is-sam {
  color: var(--sam);
}

.results-title.is-dean {
  color: var(--dean);
}

.results-title.is-tie {
  color: var(--muted);
}

.results-bar-wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 16px auto 0;
  width: min(100%, 320px);
}

.results-bar-wrap--compact {
  margin-top: 14px;
  width: 100%;
}

.results-bar-score {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  line-height: 1;
  min-width: 1.6rem;
  text-align: center;
}

.results-bar-score.is-sam {
  color: var(--sam);
}

.results-bar-score.is-dean {
  color: var(--dean);
}

.results-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.results-bar-fill {
  display: block;
  height: 100%;
  min-width: 0;
  transition: width 0.35s ease;
}

.results-bar-fill.is-sam {
  background: linear-gradient(90deg, var(--sam-deep), var(--sam));
}

.results-bar-fill.is-dean {
  background: linear-gradient(90deg, var(--dean), var(--dean-deep));
}

.your-team {
  text-align: center;
  padding: 18px 16px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  animation: fade-up 0.45s ease 0.08s both;
}

.your-team-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
}

.your-team-name {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: 2.4rem;
  letter-spacing: 0.04em;
  line-height: 1;
}

.your-team.is-sam .your-team-name {
  color: var(--sam);
}

.your-team.is-dean .your-team-name {
  color: var(--dean);
}

.voter-list-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.voter-group + .voter-group {
  margin-top: 22px;
}

.image-results {
  margin-top: 24px;
  padding-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.image-results[hidden] {
  display: none !important;
}

.image-results-panel[hidden] {
  display: none !important;
}

.image-results-toggle {
  align-self: center;
  margin: 0;
  min-height: 40px;
  padding: 0 4px;
}

.image-results-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fade-up 0.3s ease both;
}

.image-results-heading {
  margin: 0;
}

.image-results-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.image-result-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fade-up 0.3s ease both;
}

.image-result-shot {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg2);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.image-result-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-result-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-result-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.image-result-meta .results-bar-wrap {
  margin: 0;
  width: 100%;
}

.image-result-meta .results-bar-score {
  font-size: 1.25rem;
}

.voter-list-heading {
  margin: 0 0 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-weight: 700;
}

.voter-group.is-sam .voter-list-heading {
  color: var(--sam);
}

.voter-group.is-dean .voter-list-heading {
  color: var(--dean);
}

.voter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.voter-list li {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
  animation: fade-up 0.3s ease both;
}

.voter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.voter-identity {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.voter-name {
  font-weight: 600;
  font-size: 1rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voter-diff {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  line-height: 1;
}

.voter-diff.is-sam {
  color: var(--sam);
}

.voter-diff.is-dean {
  color: var(--dean);
}

.voter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.voter-delete {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffb4a8;
  border: 1px solid rgba(232, 93, 76, 0.45);
  background: rgba(232, 93, 76, 0.14);
  border-radius: 999px;
  padding: 6px 10px;
  min-height: 0;
}

.voter-delete:active {
  transform: scale(0.96);
}

.team-pill {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.team-pill.is-sam {
  color: #c9dcff;
  background: rgba(91, 143, 217, 0.16);
  border-color: rgba(91, 143, 217, 0.35);
}

.team-pill.is-dean {
  color: #ffe7a0;
  background: rgba(212, 160, 23, 0.16);
  border-color: rgba(212, 160, 23, 0.35);
}

.voter-bar {
  display: flex;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.voter-bar-sam,
.voter-bar-dean {
  display: block;
  height: 100%;
  min-width: 0;
  transition: width 0.35s ease;
}

.voter-bar-sam {
  background: linear-gradient(90deg, var(--sam-deep), var(--sam));
}

.voter-bar-dean {
  background: linear-gradient(90deg, var(--dean), var(--dean-deep));
}

.voter-empty {
  margin: 24px 0 0;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  background: #2a2420;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 50;
  animation: fade-up 0.25s ease both;
  max-width: calc(100% - 32px);
  text-align: center;
}

@media (min-width: 480px) {
  .app {
    padding-top: calc(20px + var(--safe-top));
  }
}
