:root {
  --emu-burgundy: #6b0e55;
  --emu-burgundy-deep: #4d0a3f;
  --emu-burgundy-mid: #8f3178;
  --emu-orchid: #9c3f84;
  --emu-gold: #ddb74b;
  --emu-gold-soft: #f0d78a;
  --emu-blush: #f9eef5;
  --emu-blush-2: #f7eef7;
  --emu-ink: #171717;
  --emu-muted: #4b5563;
  --emu-line: rgba(107, 14, 85, 0.12);
  --emu-white: #ffffff;
  --emu-shadow: 0 24px 60px rgba(77, 10, 63, 0.14);
  --font: "Open Sans", "Segoe UI", sans-serif;
  --display: "Cormorant Garamond", "Times New Roman", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--emu-ink);
  background: var(--emu-white);
}

a {
  color: var(--emu-burgundy);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
.btn {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--emu-burgundy), var(--emu-orchid));
  color: var(--emu-white);
  box-shadow: 0 12px 30px rgba(107, 14, 85, 0.28);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-gold {
  background: linear-gradient(135deg, var(--emu-gold), var(--emu-gold-soft));
  color: var(--emu-burgundy-deep);
}

.btn-ghost {
  background: transparent;
  color: var(--emu-burgundy);
  border: 1.5px solid rgba(107, 14, 85, 0.25);
}

.btn-danger {
  background: #8b1e3f;
  color: white;
}

.btn-block {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

input,
textarea,
select {
  width: 100%;
  font: inherit;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1.5px solid rgba(107, 14, 85, 0.18);
  background: rgba(255, 255, 255, 0.92);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus {
  border-color: var(--emu-burgundy);
  box-shadow: 0 0 0 4px rgba(107, 14, 85, 0.12);
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--emu-burgundy-deep);
  margin-bottom: 0.4rem;
}

.field {
  margin-bottom: 1rem;
}

.alert {
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: rgba(221, 183, 75, 0.18);
  color: var(--emu-burgundy-deep);
  border: 1px solid rgba(221, 183, 75, 0.45);
  margin-bottom: 1rem;
}

.alert-error {
  background: rgba(139, 30, 63, 0.08);
  border-color: rgba(139, 30, 63, 0.25);
  color: #8b1e3f;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-draft {
  background: #f3f4f6;
  color: #4b5563;
}

.badge-active {
  background: rgba(221, 183, 75, 0.25);
  color: var(--emu-burgundy-deep);
}

.badge-closed {
  background: rgba(107, 14, 85, 0.1);
  color: var(--emu-burgundy);
}

/* ========== DISPLAY (big screen) ========== */
.display-body {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 15% 10%, rgba(221, 183, 75, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 85%, rgba(156, 63, 132, 0.18), transparent 50%),
    linear-gradient(165deg, #fff 0%, var(--emu-blush) 42%, #fff8fc 100%);
  position: relative;
}

.display-body .lang-switch {
  display: none; /* language lives inside brand bar on big screen */
}

.display-body::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(107, 14, 85, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(107, 14, 85, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  pointer-events: none;
  animation: gridDrift 28s linear infinite;
}

@keyframes gridDrift {
  from { transform: translateY(0); }
  to { transform: translateY(48px); }
}

.display-shell {
  position: relative;
  z-index: 1;
  height: 100%;
  max-height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: clamp(0.6rem, 1.4vh, 1.25rem) clamp(1rem, 3vw, 2.5rem);
  gap: clamp(0.45rem, 1.2vh, 1rem);
  overflow: hidden;
}

.display-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  border-radius: 18px;
  background: linear-gradient(120deg, var(--emu-burgundy-deep), var(--emu-burgundy-mid));
  box-shadow: 0 12px 28px rgba(77, 10, 63, 0.18);
  flex-shrink: 0;
}

.display-brand-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.display-lang {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.display-lang a {
  min-width: 38px;
  text-align: center;
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  text-decoration: none;
}

.display-lang a.active {
  background: #fff;
  color: var(--emu-burgundy);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-lockup img {
  height: clamp(36px, 5vh, 58px);
  width: auto;
  animation: brandIn 0.9s ease both;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand-text strong {
  font-family: var(--display);
  font-size: clamp(1.2rem, 2.2vw, 1.85rem);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.brand-text span {
  font-size: clamp(0.65rem, 1.2vh, 0.78rem);
  color: var(--emu-gold-soft);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(10px);
  font-weight: 700;
  font-size: clamp(0.75rem, 1.4vh, 0.92rem);
  color: #fff;
  animation: fadeUp 0.8s ease 0.15s both;
  white-space: nowrap;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #bbb;
}

.live-pill.is-live .live-dot {
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 12px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.display-main {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(240px, 0.85fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: center;
  min-height: 0;
  overflow: hidden;
}

.question-panel {
  animation: fadeUp 0.9s ease 0.2s both;
  min-height: 0;
  overflow: auto;
}

.question-kicker {
  color: var(--emu-gold);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: clamp(0.7rem, 1.3vh, 0.85rem);
  margin-bottom: 0.5rem;
}

.question-title {
  font-family: var(--display);
  font-size: clamp(1.55rem, 3.6vw, 3rem);
  line-height: 1.12;
  color: var(--emu-burgundy-deep);
  margin: 0 0 0.65rem;
  font-weight: 700;
}

.question-text {
  font-size: clamp(0.98rem, 1.7vw, 1.4rem);
  line-height: 1.4;
  color: var(--emu-ink);
  margin: 0;
  max-width: 38ch;
  font-weight: 500;
}

.side-panel {
  display: grid;
  gap: clamp(0.55rem, 1.4vh, 1rem);
  justify-items: stretch;
  align-content: center;
  animation: fadeUp 1s ease 0.35s both;
  min-height: 0;
}

.qr-frame {
  background: var(--emu-white);
  padding: clamp(0.65rem, 1.4vh, 1rem);
  border-radius: 22px;
  box-shadow: var(--emu-shadow);
  border: 1px solid rgba(107, 14, 85, 0.08);
  position: relative;
  display: grid;
  justify-items: center;
}

.qr-frame::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 28px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(221, 183, 75, 0.7), transparent 40%, rgba(107, 14, 85, 0.35));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.qr-frame img {
  width: min(22vh, 210px);
  height: auto;
  border-radius: 10px;
}

.qr-caption {
  margin-top: 0.45rem;
  text-align: center;
  font-size: clamp(0.72rem, 1.3vh, 0.88rem);
  color: var(--emu-muted);
  font-weight: 600;
}

.vote-link {
  display: none; /* full token URL is too tall for TV; short /go is enough */
}

.vote-go {
  margin-top: 0.35rem;
  text-align: center;
  font-size: clamp(0.85rem, 1.5vh, 1.05rem);
  color: var(--emu-burgundy);
  font-weight: 800;
  word-break: break-all;
}

.question-panel,
.side-panel {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.counter-block {
  width: 100%;
  text-align: center;
  padding: clamp(0.7rem, 1.6vh, 1.1rem) 0.85rem;
  border-radius: 20px;
  background: linear-gradient(160deg, var(--emu-burgundy-deep), var(--emu-burgundy-mid));
  color: white;
  box-shadow: 0 16px 36px rgba(77, 10, 63, 0.24);
}

.counter-label {
  font-size: clamp(0.68rem, 1.2vh, 0.8rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
  font-weight: 700;
}

.counter-value {
  font-family: var(--display);
  font-size: clamp(2.6rem, 7vh, 4.6rem);
  font-weight: 700;
  line-height: 1;
  margin: 0.15rem 0;
  color: var(--emu-gold-soft);
  transition: transform 0.35s ease;
}

.counter-value.bump {
  transform: scale(1.08);
}

.counter-sub {
  font-size: 0.95rem;
  opacity: 0.9;
}

.option-bars {
  display: grid;
  gap: 0.45rem;
  margin-top: clamp(0.7rem, 1.8vh, 1.2rem);
  max-width: 520px;
}

.option-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
  font-weight: 600;
  color: var(--emu-burgundy-deep);
}

.option-bar .track {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 999px;
  background: rgba(107, 14, 85, 0.1);
  overflow: hidden;
}

.option-bar .fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--emu-burgundy), var(--emu-gold));
  transition: width 0.6s ease;
}

.display-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--emu-muted);
  font-size: clamp(0.72rem, 1.2vh, 0.85rem);
  font-weight: 600;
  flex-shrink: 0;
}

.empty-display {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
}

.empty-display h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--emu-burgundy);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes brandIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 960px) {
  .display-body {
    height: auto;
    max-height: none;
    overflow: auto;
  }
  .display-shell {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .display-main {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .question-text {
    max-width: none;
    margin-inline: auto;
  }
  .option-bars {
    margin-inline: auto;
  }
  .display-brand {
    flex-direction: column;
  }
  .qr-frame img {
    width: min(42vw, 220px);
  }
}

@media (max-height: 760px) {
  .qr-frame img {
    width: min(18vh, 170px);
  }
  .counter-value {
    font-size: clamp(2.2rem, 6vh, 3.4rem);
  }
}

/* ========== MOBILE VOTE ========== */
.vote-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(221, 183, 75, 0.2), transparent 40%),
    linear-gradient(180deg, var(--emu-blush) 0%, #fff 55%);
}

.vote-wrap {
  max-width: 440px;
  margin: 0 auto;
  padding: 1.5rem 1.15rem 2.5rem;
}

.vote-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(107, 14, 85, 0.08);
  border-radius: 28px;
  padding: 1.5rem 1.25rem;
  box-shadow: var(--emu-shadow);
  animation: fadeUp 0.55s ease both;
}

.vote-logo {
  height: 48px;
  margin: 0 auto 1rem;
}

.vote-card h1 {
  font-family: var(--display);
  font-size: 1.75rem;
  color: var(--emu-burgundy);
  margin: 0 0 0.4rem;
  text-align: center;
}

.vote-card .lead {
  text-align: center;
  color: var(--emu-muted);
  margin: 0 0 1.25rem;
  line-height: 1.45;
}

.vote-question {
  background: var(--emu-blush);
  border-radius: 18px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
}

.option-list {
  display: grid;
  gap: 0.75rem;
}

.option-list label.choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.05rem;
  border-radius: 16px;
  border: 1.5px solid rgba(107, 14, 85, 0.15);
  background: white;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.option-list label.choice:has(input:checked) {
  border-color: var(--emu-burgundy);
  background: rgba(107, 14, 85, 0.05);
}

.option-list input {
  width: auto;
  accent-color: var(--emu-burgundy);
}

.success-mark {
  width: 72px;
  height: 72px;
  margin: 0.5rem auto 1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--emu-burgundy), var(--emu-orchid));
  color: white;
  font-size: 2rem;
  animation: brandIn 0.5s ease both;
}

/* ========== ADMIN ========== */
.admin-body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--emu-blush-2), #fff 280px);
}

.admin-top {
  background: linear-gradient(120deg, var(--emu-burgundy-deep), var(--emu-burgundy-mid));
  color: white;
  padding: 1.1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.admin-top img {
  height: 40px;
  filter: brightness(0) invert(1);
}

.admin-top nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.admin-top a,
.admin-top button.linkish {
  color: white;
  background: transparent;
  border: 0;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
}

.admin-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.15rem 3rem;
}

.admin-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-hero h1 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  color: var(--emu-burgundy);
  margin: 0;
}

.session-grid {
  display: grid;
  gap: 1rem;
}

.session-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1.15rem 1.25rem;
  background: white;
  border-radius: 20px;
  border: 1px solid var(--emu-line);
  box-shadow: 0 10px 30px rgba(77, 10, 63, 0.05);
}

.session-row h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  color: var(--emu-burgundy-deep);
}

.session-meta {
  color: var(--emu-muted);
  font-size: 0.92rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 20% 20%, rgba(221, 183, 75, 0.25), transparent 40%),
    linear-gradient(160deg, var(--emu-burgundy-deep), var(--emu-burgundy));
}

.login-card {
  width: min(420px, 100%);
  background: white;
  border-radius: 28px;
  padding: 2rem 1.5rem;
  box-shadow: var(--emu-shadow);
  text-align: center;
}

.login-card img {
  height: 56px;
  margin: 0 auto 1rem;
}

.login-card h1 {
  font-family: var(--display);
  color: var(--emu-burgundy);
  margin: 0 0 1.25rem;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.stat-tile {
  background: white;
  border: 1px solid var(--emu-line);
  border-radius: 18px;
  padding: 1rem;
  text-align: center;
}

.stat-tile strong {
  display: block;
  font-family: var(--display);
  font-size: 2rem;
  color: var(--emu-burgundy);
  line-height: 1;
}

.stat-tile span {
  font-size: 0.8rem;
  color: var(--emu-muted);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel {
  background: white;
  border: 1px solid var(--emu-line);
  border-radius: 22px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: var(--emu-burgundy-deep);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table th,
.table td {
  text-align: left;
  padding: 0.65rem 0.4rem;
  border-bottom: 1px solid rgba(107, 14, 85, 0.08);
}

.table th {
  color: var(--emu-burgundy);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

/* Protocol print */
.protocol-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  background: white;
}

.protocol-page h1 {
  text-align: center;
  color: var(--emu-burgundy);
  font-family: var(--display);
}

.protocol-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

@media print {
  .protocol-actions,
  .admin-top,
  .no-print {
    display: none !important;
  }
  .protocol-page {
    padding: 0;
  }
}

@media (max-width: 720px) {
  .session-row,
  .admin-hero,
  .stats-strip {
    grid-template-columns: 1fr;
  }
  .admin-top {
    flex-direction: column;
    align-items: flex-start;
  }
}
