:root {
  color-scheme: light;
  --bg: #eef2f0;
  --ink: #16201c;
  --muted: #62706a;
  --surface: #ffffff;
  --line: #d8e0dc;
  --accent: #006c67;
  --accent-strong: #004d49;
  --warm: #c84b31;
  --success: #177245;
  --danger: #b42318;
  --shadow: 0 22px 60px rgba(22, 32, 28, 0.16);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(120deg, rgba(0, 108, 103, 0.08), transparent 36%),
    linear-gradient(240deg, rgba(200, 75, 49, 0.12), transparent 40%),
    var(--bg);
  color: var(--ink);
}

a {
  color: var(--accent-strong);
  font-weight: 700;
}

button {
  border: 0;
  font: inherit;
}

.shell {
  display: grid;
  min-height: 100vh;
  padding: 28px;
  place-items: start center;
}

.game {
  width: min(1120px, 100%);
}

.view {
  display: none;
  width: min(1120px, 100%);
}

.view.active {
  display: block;
}

.topbar {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.top-actions,
.admin-toolbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.mode-tabs {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
}

.mode-button {
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
  min-height: 42px;
  padding: 0 14px;
  white-space: nowrap;
}

.mode-button.active {
  background: var(--accent);
  color: #fff;
}

.eyebrow {
  color: var(--warm);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.35rem, 6vw, 4.9rem);
  line-height: 0.95;
  margin-bottom: 0;
}

h2 {
  font-size: clamp(1.8rem, 3.2vw, 3rem);
  line-height: 1.08;
  margin-bottom: 28px;
}

.ghost-button,
.actions a,
.actions button {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  text-decoration: none;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
}

.ghost-button:hover,
.actions a:hover {
  background: #fff;
  transform: translateY(-1px);
}

.scoreboard {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.scoreboard div {
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}

.scoreboard span {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.scoreboard strong {
  font-size: 1.55rem;
}

.status {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--muted);
  font-weight: 700;
  padding: 18px;
}

.status:empty {
  display: none;
}

.loading-card {
  background: var(--surface);
  border: 1px solid rgba(22, 32, 28, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(260px, 42%) 1fr;
  min-height: 420px;
  overflow: hidden;
}

.loading-portrait {
  align-items: end;
  background:
    linear-gradient(180deg, rgba(0, 108, 103, 0.08), rgba(22, 32, 28, 0.04)),
    #dfe6e2;
  display: flex;
  justify-content: center;
  padding-top: 60px;
}

.loading-portrait span {
  animation: loadingPulse 1.6s ease-in-out infinite;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.86) 0 18%, transparent 19%),
    linear-gradient(180deg, rgba(22, 32, 28, 0.12), rgba(22, 32, 28, 0.2));
  border-radius: 130px 130px 0 0;
  display: block;
  height: 310px;
  width: min(70%, 260px);
}

.loading-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 5vw, 58px);
}

.loading-content h2 {
  margin-bottom: 12px;
}

.loading-content p:not(.question-kicker) {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.45;
  margin-bottom: 24px;
}

.loading-dots {
  display: flex;
  gap: 14px;
  margin-top: 6px;
}

.loading-dots span {
  animation: loadingDot 1.15s ease-in-out infinite;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.18);
  height: 20px;
  width: 20px;
}

.loading-dots span:nth-child(2) {
  animation-delay: 120ms;
}

.loading-dots span:nth-child(3) {
  animation-delay: 240ms;
}

.loading-dots span:nth-child(4) {
  animation-delay: 360ms;
}

@keyframes loadingPulse {
  0%,
  100% {
    opacity: 0.58;
    transform: scale(0.98);
  }
  50% {
    opacity: 0.95;
    transform: scale(1);
  }
}

@keyframes loadingDot {
  0%,
  100% {
    opacity: 0.56;
    transform: translateY(0) scale(0.82);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.06);
    opacity: 1;
    transform: translateY(-7px) scale(1.08);
  }
}

.question-card {
  background: var(--surface);
  border: 1px solid rgba(22, 32, 28, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(280px, 42%) 1fr;
  min-height: 620px;
  overflow: hidden;
}

.portrait-frame {
  background:
    linear-gradient(180deg, rgba(0, 108, 103, 0.08), rgba(22, 32, 28, 0.04)),
    #dfe6e2;
  align-items: start;
  display: flex;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.portrait-frame img {
  display: block;
  width: 100%;
}

.blur-region {
  backdrop-filter: blur(46px) saturate(0.08) brightness(0.82) contrast(0.78);
  background:
    radial-gradient(circle, rgba(38, 48, 43, 0.68) 0%, rgba(38, 48, 43, 0.62) 52%, rgba(38, 48, 43, 0.36) 78%, rgba(38, 48, 43, 0) 100%);
  border-radius: 50%;
  box-shadow:
    inset 0 0 32px rgba(255, 255, 255, 0.08),
    0 0 22px rgba(38, 48, 43, 0.24);
  pointer-events: none;
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.question-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 5vw, 58px);
}

.question-kicker {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 900;
  margin-bottom: 12px;
  text-transform: uppercase;
}

#memberRole,
#memberMeta {
  color: var(--muted);
  font-size: 1.02rem;
  font-weight: 650;
}

#memberRole {
  color: var(--ink);
  margin-bottom: 8px;
}

#memberMeta {
  margin-bottom: 24px;
}

.answers {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.minister-guess {
  display: grid;
  gap: 10px;
}

.minister-guess label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.minister-search {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
}

.minister-search input {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  min-height: 54px;
  min-width: 0;
  padding: 0 14px;
}

.minister-search button {
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-weight: 850;
  min-height: 54px;
  padding: 0 18px;
}

.minister-search input:disabled,
.minister-search button:disabled {
  cursor: default;
  opacity: 0.72;
}

.question-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 14px;
}

.answer-button {
  align-items: center;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  gap: 12px;
  justify-content: center;
  min-height: 62px;
  padding: 12px;
  text-align: center;
}

.answer-button:hover:not(:disabled) {
  border-color: rgba(0, 108, 103, 0.45);
  background: #eef8f5;
}

.answer-button:disabled {
  cursor: default;
}

.answer-button.correct {
  border-color: rgba(23, 114, 69, 0.45);
  background: #eaf7f0;
}

.answer-button.wrong {
  border-color: rgba(180, 35, 24, 0.35);
  background: #fff0ed;
}

.swatch {
  border: 1px solid rgba(22, 32, 28, 0.14);
  border-radius: 50%;
  flex: 0 0 18px;
  height: 18px;
  width: 18px;
}

.answer-label {
  display: block;
  font-size: 1rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.result-panel {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 20px;
}

.result-panel p {
  font-size: 1.05rem;
  font-weight: 750;
  line-height: 1.45;
  margin-bottom: 16px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions button {
  background: var(--accent);
  color: #fff;
}

.actions button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.actions a {
  background: #fff;
}

.footer-actions {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 16px;
}

.footer-actions p {
  margin: 0;
}

.admin-view h1 {
  font-size: clamp(2.2rem, 5vw, 4.4rem);
}

.login-panel,
.admin-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  display: grid;
  gap: 14px;
  max-width: 460px;
  padding: 22px;
}

.login-panel label,
.review-tools label {
  color: var(--muted);
  display: grid;
  font-size: 0.88rem;
  font-weight: 800;
  gap: 8px;
}

.login-panel input {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  min-height: 44px;
  padding: 0 12px;
}

.login-panel button,
.primary-button {
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-weight: 850;
  min-height: 46px;
  padding: 0 16px;
}

.admin-panel {
  overflow: hidden;
}

.admin-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px;
}

.admin-toolbar strong,
.admin-toolbar span {
  display: block;
}

.admin-toolbar span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 3px;
}

#reviewQueueSummary {
  color: var(--accent);
}

.jump-control {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 850;
  gap: 8px;
}

.jump-control input {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-weight: 850;
  height: 44px;
  padding: 0 8px;
  width: 82px;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 280px;
}

.review-canvas {
  background: #dfe6e2;
  cursor: crosshair;
  overflow: hidden;
  position: relative;
  touch-action: none;
}

.review-canvas img {
  display: block;
  width: 100%;
}

.review-tools {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}

.review-tools p,
.review-count {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.45;
}

.review-tools button {
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 850;
  min-height: 44px;
  padding: 0 12px;
}

.admin-view .status {
  box-shadow: none;
  margin-bottom: 14px;
}

.admin-view .status.error {
  border-color: rgba(180, 35, 24, 0.35);
  color: var(--danger);
}

@media (max-width: 760px) {
  .shell {
    padding: 16px;
    place-items: start center;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .top-actions,
  .admin-toolbar-actions {
    justify-content: flex-start;
  }

  .mode-tabs {
    width: 100%;
  }

  .scoreboard {
    grid-template-columns: 1fr;
  }

  .question-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .loading-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .loading-portrait span {
    height: 220px;
  }

  .answers {
    grid-template-columns: 1fr;
  }

  .minister-search {
    grid-template-columns: 1fr;
  }

  .footer-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-toolbar,
  .review-layout {
    display: block;
  }

  .admin-toolbar-actions {
    margin-top: 12px;
  }

  .review-tools {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
