:root {
  --cream: #f7f4ea;
  --ink: #1f2a22;
  --primary: #2d8b35;
  --accent: #c89b3c;
  --primary-soft: #3fa25e;
  --card: rgba(255, 255, 255, 0.86);
  --card-strong: rgba(255, 255, 255, 0.95);
  --shadow: 0 15px 40px rgba(31, 42, 34, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Outfit', sans-serif;
  color: var(--ink);
}

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image: radial-gradient(#1b1a1e 0.5px, transparent 0.5px);
  background-size: 5px 5px;
}

.brand-bar {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 18px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 46px;
  width: auto;
  border-radius: 0;
  object-fit: contain;
  box-shadow: none;
}

.brand-text {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.brand-name {
  display: block;
  margin-top: 2px;
  font-size: 19px;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--ink);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 18px 28px;
  display: grid;
  gap: 20px;
  grid-template-columns: 1.3fr 1fr;
}

.site-footer {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 18px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.site-footer .brand-text {
  text-align: center;
}

.site-footer .brand-name {
  display: inline;
  margin-top: 0;
  font-size: 19px;
}

.site-footer .brand-logo {
  height: 56px;
}

.footer-admin-link {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(31, 42, 34, 0.52);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.footer-admin-link:hover,
.footer-admin-link:focus-visible {
  color: rgba(31, 42, 34, 0.78);
  border-color: rgba(31, 42, 34, 0.38);
}

.admin-shell,
.admin-footer {
  width: min(100%, 1000px);
}

.admin-shell {
  grid-template-columns: 1fr;
  align-items: start;
}

.admin-shell > .quiz-card,
.admin-shell > .feed-card {
  width: 100%;
  min-width: 0;
}

.quiz-card,
.feed-card {
  background: var(--card-strong);
  border: 1px solid rgba(31, 42, 34, 0.08);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(7px);
  padding: 24px;
  animation: fade-rise 0.45s ease both;
  position: relative;
  overflow: hidden;
}

.quiz-card::before,
.feed-card::before {
  content: '';
  position: absolute;
  width: 140px;
  height: 140px;
  top: -70px;
  right: -50px;
  background: radial-gradient(circle, rgba(200, 155, 60, 0.22), transparent 65%);
  pointer-events: none;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--primary);
  font-size: 12px;
  margin: 0;
}

.question-day-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: linear-gradient(135deg, rgba(45, 139, 53, 0.12), rgba(200, 155, 60, 0.18));
  border: 1px solid rgba(45, 139, 53, 0.18);
  box-shadow: 0 10px 24px rgba(45, 139, 53, 0.08);
}

.question-day-badge::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  box-shadow: 0 0 0 4px rgba(45, 139, 53, 0.08);
}

h1,
h2 {
  margin: 20px 0 8px;
  font-family: 'Space Grotesk', sans-serif;
}

#title {
  font-size: clamp(1.25rem, 2.2vw, 1.8rem);
  line-height: 1.3;
}

.status {
  margin: 0 0 16px;
}

.countdown {
  background: rgba(242, 122, 33, 0.12);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-weight: 600;
}

.options {
  display: grid;
  gap: 12px;
}

.option {
  border: 1px solid rgba(27, 26, 30, 0.15);
  border-radius: 14px;
  padding: 14px 16px;
  min-height: 56px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.45;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.option input[type='radio'] {
  width: 22px;
  height: 22px;
  margin-top: 1px;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.option span {
  font-size: 1.02rem;
}

.option:hover {
  transform: translateX(3px);
  border-color: var(--primary);
  background: rgba(45, 139, 53, 0.04);
}

.option:active {
  transform: translateX(1px) scale(0.998);
}

.option.selected {
  border-color: var(--accent);
  border-width: 2px;
  background: rgba(200, 155, 60, 0.12);
  box-shadow: inset 0 0 0 1px rgba(200, 155, 60, 0.22);
}

.btn {
  margin-top: 14px;
  border: none;
  background: linear-gradient(120deg, var(--primary), var(--primary-soft));
  color: #fff;
  border-radius: 70px;
  padding: 11px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.btn:hover {
  filter: brightness(1.04);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.is-loading {
  position: relative;
  padding-right: 38px;
}

.btn.is-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-top-color: #fff;
  border-radius: 100%;
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  animation: spin 0.7s linear infinite;
}

.identity-form {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.admin-topbar h1 {
  flex: 1;
  min-width: 0;
}

.admin-topbar .btn {
  margin-top: 0;
  flex-shrink: 0;
}

.admin-settings-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.admin-settings-submit-row {
  grid-column: 1 / -1;
}

.admin-accordion-item {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.admin-accordion-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  font-weight: 700;
}

.admin-accordion-item summary span {
  min-width: 0;
}

.admin-accordion-item summary .muted {
  flex: 1;
  overflow-wrap: anywhere;
}

.admin-accordion-item summary::-webkit-details-marker {
  display: none;
}

.admin-accordion-item summary::after {
  content: '+';
  font-size: 18px;
  line-height: 1;
  color: var(--primary);
  margin-left: auto;
}

.admin-accordion-item[open] summary::after {
  content: '-';
}

.admin-accordion-content {
  padding: 0 12px 12px;
  border-top: 1px solid rgba(31, 42, 34, 0.08);
}

.admin-question-textarea,
.admin-question-select {
  width: 100%;
  border: 1px solid rgba(27, 26, 30, 0.2);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}

input {
  border: 1px solid rgba(27, 26, 30, 0.2);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}

.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-wrap input {
  flex: 1;
  padding-right: 40px;
}

.pw-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: rgba(31, 42, 34, 0.5);
  display: flex;
  align-items: center;
  line-height: 1;
}

.pw-toggle:hover {
  color: var(--primary);
}

.locked {
  margin-top: 16px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(242, 122, 33, 0.15);
  border: 1px solid rgba(242, 122, 33, 0.42);
}

.promo-banners {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.promo-banner-link {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(31, 42, 34, 0.12);
  box-shadow: 0 8px 18px rgba(31, 42, 34, 0.08);
}

.promo-banner-image {
  display: block;
  width: 100%;
  height: auto;
}

.promo-donate-btn {
  display: block;
  width: 100%;
  margin-top: 0;
  margin-bottom: 14px;
  text-align: center;
  text-decoration: none;
}

.hero {
  margin: 8px 0 14px;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(45, 139, 53, 0.15), rgba(242, 122, 33, 0.12));
  border: 1px solid rgba(45, 139, 53, 0.35);
  display: none;
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-crown {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.hero-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 3px;
}

.hero-name {
  font-size: 14px;
}

.hero-time {
  margin-top: 2px;
  font-size: 13px;
  color: rgba(31, 42, 34, 0.65);
}

.participants {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
}

.participants.participants-scroll {
  max-height: min(72vh, 760px);
  overflow-y: auto;
  padding-right: 6px;
}

.participant-empty {
  padding: 10px;
  color: rgba(31, 42, 34, 0.55);
  font-style: italic;
}

.participant-item {
  border: 1px solid rgba(27, 26, 30, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.75);
  transition: border-color 0.2s ease;
}

.participant-correct {
  border-color: rgba(45, 139, 53, 0.35);
  background: rgba(45, 139, 53, 0.05);
}

.participant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.participant-name {
  font-size: 14px;
}

.hero-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: linear-gradient(120deg, var(--primary), var(--primary-soft));
  color: #fff;
  border-radius: 20px;
  padding: 2px 9px;
  white-space: nowrap;
  flex-shrink: 0;
}

.incorrect-badge {
  font-size: 11px;
  font-weight: 600;
  color: rgba(31, 42, 34, 0.45);
  white-space: nowrap;
  flex-shrink: 0;
}

.participant-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: rgba(31, 42, 34, 0.6);
}

.muted {
  color: rgba(27, 26, 30, 0.7);
}

.hidden {
  display: none !important;
}

.splash-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 24, 18, 0.55);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.splash-overlay.is-open {
  opacity: 1;
}

.splash-card {
  width: min(92vw, 460px);
  background: #fff;
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 16px 50px rgba(15, 24, 18, 0.3);
  text-align: center;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.2s ease;
}

.splash-overlay.is-open .splash-card {
  transform: translateY(0) scale(1);
}

.splash-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.splash-success .splash-icon {
  color: #1f7b46;
  background: rgba(45, 139, 53, 0.16);
}

.splash-warning .splash-icon {
  color: #946d15;
  background: rgba(200, 155, 60, 0.18);
}

#splashMessage {
  white-space: pre-line;
}

@keyframes spin {
  from {
    transform: translateY(-50%) rotate(0deg);
  }
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

@keyframes fade-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Entries by Day: tab strip ─────────────────────────────── */
.stats-section {
  overflow: visible;
}

.day-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.day-tab {
  border: 1px solid rgba(45, 139, 53, 0.25);
  border-radius: 999px;
  padding: 6px 16px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(45, 139, 53, 0.06);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  touch-action: manipulation;
}

.day-tab:hover {
  background: rgba(45, 139, 53, 0.14);
}

.day-tab.is-active {
  background: linear-gradient(120deg, var(--primary), var(--primary-soft));
  color: #fff;
  border-color: transparent;
}

/* ── Day panels ─────────────────────────────────────────────── */
.day-panel {
  display: none;
}

.day-panel.is-active {
  display: block;
}

/* ── Stats summary pills ───────────────────────────────────── */
.stats-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  background: rgba(31, 42, 34, 0.07);
  color: var(--ink);
}

.pill-correct {
  background: rgba(45, 139, 53, 0.12);
  color: #1a6b27;
}

.pill-wrong {
  background: rgba(192, 57, 43, 0.1);
  color: #a02820;
}

.pill-fast {
  background: rgba(200, 155, 60, 0.15);
  color: #7a5c10;
}

.pill-winner {
  background: linear-gradient(120deg, rgba(45, 139, 53, 0.12), rgba(200, 155, 60, 0.15));
  color: var(--ink);
  font-weight: 600;
}

/* ── Question text above table ─────────────────────────────── */
.stats-question-text {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
  margin: 0 0 12px;
  padding: 10px 12px;
  background: rgba(45, 139, 53, 0.06);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
}

.stats-question-block {
  margin-bottom: 14px;
}

.stats-answer-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stats-answer-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(31, 42, 34, 0.07);
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.35;
}

.stats-answer-chip-correct {
  background: rgba(45, 139, 53, 0.14);
  color: #1a6b27;
  font-weight: 700;
}

.stats-answer-chip-correct::before {
  content: 'Answer-';
  margin-right: 7px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Table wrapper: horizontal scroll on narrow screens ─────── */
.stats-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid rgba(31, 42, 34, 0.09);
}

/* ── Stats table ───────────────────────────────────────────── */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 0;
}

.stats-table thead tr {
  background: linear-gradient(120deg, rgba(45, 139, 53, 0.1), rgba(200, 155, 60, 0.08));
}

.stats-table th {
  padding: 10px 12px;
  text-align: left;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  white-space: nowrap;
  border-bottom: 1px solid rgba(31, 42, 34, 0.1);
}

.stats-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(31, 42, 34, 0.06);
  vertical-align: middle;
  color: var(--ink);
}

.stats-table tbody tr:last-child td {
  border-bottom: none;
}

.stats-table tbody tr:hover td {
  background: rgba(45, 139, 53, 0.03);
}

.table-pagination {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.table-pagination-info {
  font-size: 0.9rem;
  color: rgba(31, 42, 34, 0.7);
  min-width: 92px;
  text-align: center;
}

.table-pagination-btn {
  border: 1px solid rgba(31, 42, 34, 0.2);
  background: #fff;
  color: #1f2a22;
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
}

.table-pagination-btn:hover {
  border-color: var(--primary);
}

.table-pagination-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.row-correct td {
  background: rgba(45, 139, 53, 0.03);
}

.row-incorrect td {
  background: rgba(192, 57, 43, 0.025);
}

/* ── Row chips ─────────────────────────────────────────────── */
.day-chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: linear-gradient(120deg, var(--primary), var(--primary-soft));
  color: #fff;
  white-space: nowrap;
}

.result-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.result-correct {
  background: rgba(45, 139, 53, 0.15);
  color: #1a6b27;
}

.result-wrong {
  background: rgba(192, 57, 43, 0.12);
  color: #a02820;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .brand-bar {
    padding-top: 22px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .admin-topbar {
    flex-direction: row;
    align-items: flex-start;
  }

  .admin-settings-form {
    grid-template-columns: 1fr;
  }

  .admin-settings-submit-row .btn {
    width: 100%;
  }

  .stats-table {
    font-size: 0.82rem;
  }

  .stats-table th,
  .stats-table td {
    padding: 8px 10px;
  }

  .stats-table-wrap {
    border-radius: 10px;
  }
}

@media (max-width: 640px) {
  .quiz-card,
  .feed-card {
    padding: 18px;
    border-radius: 18px;
  }

  .options {
    gap: 14px;
  }

  .option {
    padding: 14px;
    min-height: 62px;
    border-radius: 16px;
    gap: 14px;
  }

  .option input[type='radio'] {
    width: 24px;
    height: 24px;
  }

  .option span {
    font-size: 1.04rem;
    line-height: 1.5;
  }

  .question-day-badge {
    margin-top: 12px;
    padding: 9px 14px;
    font-size: 0.92rem;
  }

  .admin-topbar {
    gap: 10px;
  }

  .admin-topbar h1 {
    margin-top: 0;
    font-size: 1.35rem;
    line-height: 1.2;
  }

  .day-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .day-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .admin-accordion-item summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-pills,
  .stats-answer-list {
    gap: 6px;
  }

  .stats-table {
    font-size: 0.78rem;
  }

  .stats-table th,
  .stats-table td {
    padding: 8px;
  }

  #quizForm .btn,
  #identityForm .btn {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }
}
