:root {
  --bg: #f3efe7;
  --panel: #fffaf1;
  --ink: #171a1f;
  --muted: #6a6d75;
  --line: #d8d0c3;
  --green: #1f7a54;
  --green-dark: #176344;
  --blue: #2457a6;
  --red: #b64242;
  --shadow: 0 26px 80px rgba(34, 30, 24, .15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.24)),
    radial-gradient(circle at 22% 18%, rgba(191, 123, 40, .12), transparent 34%),
    radial-gradient(circle at 80% 12%, rgba(36, 87, 166, .12), transparent 30%),
    var(--bg);
}

button,
input {
  font: inherit;
}

table {
  border-collapse: collapse;
}

.consoleLink {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 5;
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, .88);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 12px 32px rgba(34, 30, 24, .12);
}

.consoleLink:hover {
  border-color: var(--blue);
}

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

.verifyPanel {
  width: min(480px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, .9);
  box-shadow: var(--shadow);
}

.brandMark {
  width: 46px;
  height: 46px;
  margin-bottom: 18px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 42%, #fffaf1 42%, #fffaf1 58%, transparent 58%),
    linear-gradient(0deg, transparent 42%, #fffaf1 42%, #fffaf1 58%, transparent 58%),
    var(--ink);
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

.caption {
  margin: 8px 0 24px;
  color: var(--muted);
}

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

.publicCount {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, .74);
}

.publicCount span {
  color: var(--muted);
  font-size: 14px;
}

.publicCount strong {
  font-size: 24px;
  line-height: 1;
}

.startPanel {
  display: grid;
  gap: 14px;
}

.startButton {
  width: 100%;
}

.nameField {
  display: grid;
  gap: 8px;
}

.nameField span {
  color: var(--muted);
  font-size: 14px;
}

.nameField input {
  width: 100%;
  height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, .96);
  outline: none;
}

.nameField input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(36, 87, 166, .14);
}

.resultText {
  min-height: 30px;
  display: grid;
  place-items: center;
  color: var(--green);
  font-size: 22px;
  font-weight: 850;
}

.button:disabled,
.answerField input:disabled {
  opacity: .58;
  cursor: not-allowed;
}

.hintBox {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(36, 87, 166, .24);
  border-radius: 8px;
  background: rgba(240, 246, 255, .78);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.hintBox b {
  color: var(--blue);
  font-size: 14px;
}

.imageFrame {
  position: relative;
  min-height: 166px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.8), rgba(248,242,232,.92)),
    repeating-linear-gradient(45deg, rgba(23,26,31,.04) 0, rgba(23,26,31,.04) 1px, transparent 1px, transparent 16px);
}

.imageFrame img {
  width: min(100%, 320px);
  max-height: 132px;
  object-fit: contain;
  border: 1px solid #ece1d0;
  background: white;
}

.emptyState {
  position: absolute;
  color: var(--muted);
  font-weight: 700;
}

.imageFrame img[src]:not([src=""]) + .emptyState {
  display: none;
}

.answerField {
  display: grid;
  gap: 8px;
}

.answerField span {
  color: var(--muted);
  font-size: 14px;
}

.answerField input {
  width: 100%;
  height: 58px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, .96);
  color: var(--ink);
  font-size: 26px;
  font-weight: 750;
  text-transform: lowercase;
  outline: none;
}

.answerField input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(36, 87, 166, .14);
}

.buttons {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 110px;
  gap: 10px;
  margin-top: 14px;
}

.button {
  display: inline-grid;
  place-items: center;
  height: 54px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.primary {
  background: var(--green);
  color: white;
}

.primary:hover {
  background: var(--green-dark);
}

.secondary {
  border-color: var(--line);
  background: #fffdf8;
  color: var(--ink);
}

.status {
  min-height: 22px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.status.good {
  color: var(--green);
}

.status.bad {
  color: var(--red);
}

.leaderboard {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.leaderboardHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.leaderboard h2 {
  margin: 0;
  font-size: 18px;
}

.leaderboardHeader span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.leaderboard table {
  width: 100%;
  font-size: 13px;
}

.leaderboard th,
.leaderboard td {
  padding: 9px 4px;
  border-top: 1px solid var(--line);
  text-align: right;
}

.leaderboard th:first-child,
.leaderboard td:first-child {
  text-align: left;
}

.leaderboard th {
  color: var(--muted);
  font-weight: 750;
}

.leaderboard td:first-child {
  max-width: 156px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adminShell {
  min-height: 100vh;
  padding: 28px;
}

.adminTopbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  width: min(1080px, 100%);
  margin: 0 auto 18px;
}

.adminTopbar h1 {
  font-size: 28px;
}

.adminGrid {
  width: min(1080px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.adminPanel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, .92);
  box-shadow: var(--shadow);
  padding: 24px;
}

.widePanel {
  width: min(1080px, 100%);
  margin: 18px auto 0;
}

.adminTabs {
  width: min(1080px, 100%);
  margin: 0 auto 18px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.tabButton {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.tabButton.active {
  border-color: var(--line);
  background: rgba(255, 250, 241, .92);
  color: var(--ink);
}

.loginPanel {
  width: min(420px, 100%);
  margin: 12vh auto 0;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.field span,
.adminLabel {
  color: var(--muted);
  font-size: 14px;
}

.field input,
.adminAnswer {
  width: 100%;
  height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  outline: none;
}

.field input:focus,
.adminAnswer:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(36, 87, 166, .14);
}

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

.statCard {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, .78);
}

.statCard span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.statCard strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.statNote {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.adminImageFrame {
  min-height: 190px;
  display: grid;
  place-items: center;
  margin: 14px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.adminImageFrame img {
  width: min(100%, 360px);
  max-height: 150px;
  object-fit: contain;
  border: 1px solid #ece1d0;
  background: white;
}

.adminActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.metaLine {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.reviewHeader {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.reviewHeader h2 {
  margin: 0;
  font-size: 26px;
}

.reviewGrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.reviewImageFrame {
  position: relative;
  min-height: 260px;
}

.reviewImageFrame img {
  width: min(100%, 480px);
  max-height: 220px;
}

.reviewCount {
  min-width: 96px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.answerList {
  display: grid;
  gap: 8px;
}

.answerOption {
  width: 100%;
  min-height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  cursor: pointer;
}

.answerOption.active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 84, .13);
}

.answerOption b {
  font-size: 22px;
}

.answerOption span {
  color: var(--muted);
  font-size: 13px;
}

.recentTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.splitTables {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.recentTable td,
.recentTable th {
  padding: 9px 0;
  border-top: 1px solid var(--line);
  text-align: left;
}

.recentTable th {
  color: var(--muted);
  font-weight: 700;
}

.recentTable td:last-child,
.recentTable th:last-child {
  text-align: right;
}

.hidden {
  display: none;
}

@media (max-width: 520px) {
  .splitTables {
    grid-template-columns: 1fr;
  }

  .verifyShell {
    padding: 16px;
  }

  .verifyPanel {
    padding: 22px;
  }

  h1 {
    font-size: 28px;
  }

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

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

@media (max-width: 880px) {
  .adminGrid {
    grid-template-columns: 1fr;
  }

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

  .statGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .consoleLink {
    top: 12px;
    right: 12px;
  }

  .adminShell {
    padding: 18px;
  }

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

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

  .adminActions {
    display: grid;
  }

  .adminActions .button {
    width: 100%;
  }
}
