:root {
  --blue-900: #08233f;
  --blue-800: #0b3158;
  --blue-700: #0e4f8a;
  --blue-600: #1268b3;
  --blue-100: #e7f2fb;
  --gray-950: #101820;
  --gray-850: #1f2a33;
  --gray-700: #44515f;
  --gray-500: #6d7a87;
  --gray-250: #d6dee6;
  --gray-150: #e8edf2;
  --gray-75: #f5f7f9;
  --white: #ffffff;
  --amber: #f3a51d;
  --green: #167a52;
  --red: #b42318;
  --shadow: 0 18px 44px rgba(8, 35, 63, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--gray-950);
  background:
    linear-gradient(180deg, rgba(231, 242, 251, 0.85), rgba(245, 247, 249, 0.95)),
    var(--gray-75);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid rgba(68, 81, 95, 0.16);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 38px;
  border-radius: 6px;
  color: var(--white);
  background: var(--blue-800);
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: inset 0 -4px 0 rgba(255, 255, 255, 0.12);
}

.brand strong {
  display: block;
  font-size: 1rem;
  line-height: 1.1;
}

.brand small {
  display: block;
  color: var(--gray-500);
  font-size: 0.78rem;
  line-height: 1.3;
}

main {
  flex: 1;
}

.screen {
  display: none;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 42px);
}

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

.start-layout {
  display: grid;
  gap: 18px;
}

.intro-panel,
.employee-card,
.question-card,
.status-card,
.admin-shell,
.admin-panel {
  border: 1px solid rgba(68, 81, 95, 0.14);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.intro-panel {
  min-height: 430px;
  padding: clamp(24px, 5vw, 56px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: var(--white);
  background:
    linear-gradient(180deg, rgba(8, 35, 63, 0.62), rgba(8, 35, 63, 0.94)),
    url("data:image/svg+xml,%3Csvg width='900' height='620' viewBox='0 0 900 620' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='900' height='620' fill='%230b3158'/%3E%3Cg fill='none' stroke='%232a5f8e' stroke-width='2' opacity='.55'%3E%3Cpath d='M80 120h220v140h-220zM360 70h320v210h-320zM112 390h650M112 430h650M112 470h650'/%3E%3Cpath d='M190 260v130M470 280v110M620 280v110'/%3E%3Ccircle cx='168' cy='190' r='28'/%3E%3Ccircle cx='520' cy='168' r='48'/%3E%3Cpath d='M715 110l72 56-72 56M250 454l42 0M520 454l42 0M640 454l42 0'/%3E%3C/g%3E%3Cg fill='%23f3a51d' opacity='.9'%3E%3Cpath d='M735 300h38l-28 54h35l-72 100 25-70h-32z'/%3E%3Ccircle cx='300' cy='190' r='8'/%3E%3Ccircle cx='660' cy='168' r='8'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
}

.eyebrow,
.card-kicker {
  margin: 0 0 10px;
  color: var(--amber);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro-panel h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2rem, 8vw, 4.4rem);
  line-height: 0.98;
}

.lead {
  max-width: 720px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  line-height: 1.6;
}

.feature-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.feature-strip span {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.88rem;
}

.employee-card,
.admin-login {
  padding: 22px;
}

.employee-card h2,
.status-card h2,
.admin-header h2,
.quiz-toolbar h2 {
  margin: 0;
  color: var(--blue-900);
}

label {
  display: block;
  margin: 18px 0 8px;
  color: var(--gray-700);
  font-size: 0.92rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--gray-250);
  border-radius: 6px;
  background: var(--white);
  color: var(--gray-950);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  accent-color: var(--blue-700);
}

input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 4px rgba(18, 104, 179, 0.14);
}

.privacy-notice {
  margin-top: 18px;
  padding: 14px;
  border-left: 4px solid var(--blue-700);
  border-radius: 6px;
  color: var(--gray-700);
  background: var(--blue-100);
  font-size: 0.92rem;
  line-height: 1.55;
}

.checkbox-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  margin-top: 14px;
  color: var(--gray-700);
  line-height: 1.45;
}

.field-error {
  min-height: 20px;
  margin: 8px 0 14px;
  color: var(--red);
  font-size: 0.88rem;
  font-weight: 700;
}

.form-note {
  margin: 14px 0 0;
  color: var(--gray-500);
  font-size: 0.9rem;
  line-height: 1.5;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 800;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.primary-button {
  width: 100%;
  color: var(--white);
  background: var(--blue-700);
  box-shadow: 0 12px 24px rgba(14, 79, 138, 0.18);
}

.primary-button:hover:not(:disabled) {
  background: var(--blue-600);
  transform: translateY(-1px);
}

.secondary-button {
  color: var(--blue-800);
  border-color: rgba(14, 79, 138, 0.22);
  background: var(--blue-100);
}

.ghost-button {
  color: var(--blue-800);
  border-color: rgba(68, 81, 95, 0.2);
  background: var(--white);
}

.compact {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.status-card {
  max-width: 680px;
  margin: 60px auto;
  padding: clamp(26px, 6vw, 48px);
  text-align: center;
}

.status-icon {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  border-radius: 50%;
  color: var(--white);
  background: var(--red);
  font-weight: 900;
}

.success-card .status-icon {
  background: var(--green);
}

.result-grid {
  display: grid;
  gap: 10px;
  margin: 24px 0;
}

.result-tile {
  padding: 14px;
  border-radius: 6px;
  background: var(--gray-75);
  text-align: left;
}

.result-tile span {
  display: block;
  color: var(--gray-500);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.result-tile strong {
  display: block;
  margin-top: 4px;
  font-size: 1.18rem;
}

.quiz-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.timer-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(14, 79, 138, 0.18);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.timer-box span {
  color: var(--gray-500);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.timer-box strong {
  color: var(--blue-900);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.progress-wrap {
  margin-bottom: 16px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--gray-700);
  font-size: 0.9rem;
  font-weight: 800;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--gray-150);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--blue-700), var(--amber));
  transition: width 220ms ease;
}

.question-card {
  overflow: hidden;
}

.visual-panel {
  min-height: 220px;
  padding: 14px;
  background: #eef3f7;
}

.technical-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 210px;
  border-radius: 6px;
  background: #f8fbfd;
}

.question-content {
  padding: 20px;
}

.question-content h3 {
  margin: 0 0 18px;
  color: var(--gray-950);
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  line-height: 1.35;
}

.answers {
  display: grid;
  gap: 10px;
}

.answer-option {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--gray-250);
  border-radius: 6px;
  background: var(--white);
  color: var(--gray-950);
  text-align: left;
}

.answer-option:hover {
  border-color: rgba(14, 79, 138, 0.45);
}

.answer-option.is-selected {
  border-color: var(--blue-700);
  background: var(--blue-100);
  box-shadow: 0 0 0 3px rgba(18, 104, 179, 0.12);
}

.answer-key {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--blue-900);
  background: var(--gray-150);
  font-weight: 900;
}

.answer-option.is-selected .answer-key {
  color: var(--white);
  background: var(--blue-700);
}

.quiz-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin-top: 16px;
}

.quiz-actions .primary-button,
.quiz-actions .secondary-button {
  width: 100%;
}

.admin-shell {
  padding: clamp(18px, 4vw, 28px);
}

.admin-header,
.panel-title-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.admin-login {
  border: 1px solid var(--gray-150);
  border-radius: var(--radius);
  background: var(--gray-75);
}

.admin-session {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid rgba(22, 122, 82, 0.22);
  border-radius: var(--radius);
  color: var(--green);
  background: rgba(22, 122, 82, 0.08);
  font-weight: 800;
}

.token-panel {
  margin-bottom: 16px;
}

.token-form label {
  margin-top: 0;
}

.token-output {
  display: none;
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 6px;
  color: var(--blue-900);
  background: var(--blue-100);
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.token-output.is-visible {
  display: block;
}

.pin-row {
  display: grid;
  gap: 10px;
}

.stat-grid {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.stat-card {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--blue-900);
  color: var(--white);
}

.stat-card span {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.6rem;
}

.admin-grid {
  display: grid;
  gap: 16px;
}

.admin-panel {
  padding: 18px;
  box-shadow: none;
}

.admin-panel h3 {
  margin: 0 0 14px;
  color: var(--blue-900);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--gray-150);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--gray-500);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: var(--gray-75);
}

.score-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--white);
  background: var(--blue-700);
  font-weight: 900;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--blue-800);
  background: var(--blue-100);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-pill.is-completed {
  color: var(--green);
  background: rgba(22, 122, 82, 0.12);
}

.status-pill.is-pending {
  color: var(--gray-700);
  background: var(--gray-150);
}

.answer-detail {
  display: grid;
  gap: 10px;
  max-height: 580px;
  overflow: auto;
  padding-right: 4px;
}

.empty-detail {
  color: var(--gray-500);
  line-height: 1.6;
}

.detail-row {
  padding: 12px;
  border: 1px solid var(--gray-150);
  border-left: 5px solid var(--green);
  border-radius: 6px;
  background: var(--gray-75);
}

.detail-row.is-wrong {
  border-left-color: var(--red);
}

.detail-row strong {
  display: block;
  margin-bottom: 6px;
}

.detail-row span {
  display: block;
  color: var(--gray-700);
  font-size: 0.9rem;
  line-height: 1.45;
}

.detail-row .detail-meta,
.detail-row .detail-reference {
  color: var(--blue-800);
  font-size: 0.82rem;
  font-weight: 800;
}

.detail-row .detail-explanation {
  margin-top: 8px;
  color: var(--gray-950);
}

.category-stats {
  display: grid;
  gap: 12px;
}

.category-row {
  display: grid;
  gap: 7px;
}

.category-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--gray-700);
  font-weight: 800;
}

.category-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--gray-150);
}

.category-bar span {
  display: block;
  height: 100%;
  background: var(--green);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 6px;
  color: var(--white);
  background: var(--gray-950);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 720px) {
  .start-layout {
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.7fr);
    align-items: stretch;
  }

  .employee-card {
    align-self: end;
  }

  .quiz-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .timer-box {
    min-width: 210px;
  }

  .question-card {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1fr);
  }

  .visual-panel {
    display: grid;
    align-items: center;
    min-height: 420px;
  }

  .result-grid,
  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .pin-row,
  .panel-title-row,
  .admin-header,
  .admin-session {
    grid-template-columns: 1fr auto;
    display: grid;
    align-items: end;
  }

  .pin-row .primary-button {
    width: auto;
  }
}

@media (min-width: 1020px) {
  .admin-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  }
}

@media (max-width: 520px) {
  .topbar {
    align-items: flex-start;
  }

  .brand small {
    display: none;
  }

  .topbar .ghost-button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .progress-meta {
    flex-direction: column;
    gap: 4px;
  }
}
