:root {
  --navy: #0b1c33;
  --navy-2: #122743;
  --gold: #c9a227;
  --gold-soft: #e8d48b;
  --paper: #f4efe4;
  --ink: #152033;
  --muted: #5c6b80;
  --ok: #1f7a4d;
  --bad: #9b2c2c;
  --line: rgba(201, 162, 39, 0.35);
  --pad: clamp(14px, 3vw, 28px);
  --wrap: min(880px, calc(100% - 24px));
  --tap: 44px;
}

* { box-sizing: border-box; }
html {
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
}
html, body { overflow-x: hidden; }
body {
  margin: 0;
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a3358 0%, transparent 50%),
    radial-gradient(900px 500px at 100% 0%, #2a1d08 0%, transparent 45%),
    var(--navy);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
}

.wrap {
  width: var(--wrap);
  max-width: 880px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 0 calc(40px + env(safe-area-inset-bottom));
}

.masthead {
  color: var(--gold-soft);
  text-align: center;
  margin-bottom: clamp(16px, 3vw, 22px);
}
.logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(12px, 3vw, 20px);
  margin: 0 auto 12px;
  flex-wrap: wrap;
}
.logos img {
  width: clamp(72px, 18vw, 108px);
  height: clamp(72px, 18vw, 108px);
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.masthead .dept {
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: clamp(11px, 2.6vw, 13px);
  opacity: 0.85;
  padding: 0 8px;
}
.masthead h1 {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: clamp(26px, 7vw, 42px);
  letter-spacing: 0.04em;
  margin: 6px 0 0;
  color: #fff8e7;
  line-height: 1.1;
}
.masthead p {
  margin: 6px 0 0;
  color: #c9d3e2;
  font-size: clamp(13px, 3.2vw, 15px);
  padding: 0 10px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  border-radius: 4px;
  padding: var(--pad);
  position: relative;
}
.card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(11, 28, 51, 0.12);
  pointer-events: none;
  z-index: 0;
}
.card > * {
  position: relative;
  z-index: 1;
}

label {
  display: block;
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
input[type="text"], input[type="password"] {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid #cfc6b4;
  background: #fffdf8;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 14px;
  border-radius: 2px;
}
.row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}
.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mode-row .btn { width: 100%; }
@media (max-width: 480px) {
  .mode-row { grid-template-columns: 1fr; }
}

.rules {
  background: #efe6d2;
  border-left: 4px solid var(--gold);
  padding: 12px 14px;
  margin: 8px 0 20px;
  font-size: clamp(14px, 3.4vw, 16px);
  color: #2a3340;
  line-height: 1.45;
}
.rules strong {
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.04em;
}
.notice-banner {
  background: #f3d6d2;
  border-left-color: var(--bad);
}

.btn {
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 0;
  cursor: pointer;
  padding: 12px 18px;
  min-height: var(--tap);
  background: var(--navy);
  color: var(--gold-soft);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.btn:hover { background: var(--navy-2); }
.btn.gold {
  background: var(--gold);
  color: var(--navy);
}
.btn.gold:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid #cfc6b4;
}
.btn-block { width: 100%; }
.begin-wrap {
  text-align: center;
  margin: 18px 0 0;
}
.begin-text {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 20px;
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.begin-text:hover { color: #3a4d6b; }
.begin-text.mock {
  font-size: 15px;
  color: var(--muted);
  text-decoration: none;
}
.begin-text.mock:hover { text-decoration: underline; }

.progress {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}
.timer {
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.12em;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  min-width: 4.2em;
  text-align: right;
  text-transform: none;
}
.timer.warn { color: var(--bad); }
.bar {
  height: 4px;
  background: #ddd3be;
  margin: 8px 0 22px;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--navy);
  width: 0%;
  transition: width 0.25s ease;
}

.qtext {
  font-size: clamp(17px, 4.2vw, 22px);
  line-height: 1.35;
  margin: 0 0 18px;
}

.options { display: grid; gap: 10px; }
.opt {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid #d7cdb8;
  background: #fffdf8;
  cursor: pointer;
  min-height: var(--tap);
}
.opt:hover { border-color: var(--navy); }
.opt.selected {
  border-color: var(--navy);
  background: #e8eef7;
}
.letter {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: var(--gold-soft);
  flex-shrink: 0;
}
.opt.selected .letter { background: var(--gold); color: var(--navy); }

.actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.actions .btn { flex: 1 1 140px; }

.hidden { display: none !important; }

.done {
  text-align: center;
  padding: 24px 8px 8px;
}
.done h2 {
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.06em;
  font-size: clamp(24px, 6vw, 32px);
  margin: 0 0 8px;
}
.done p { color: #3a4658; }

.notice {
  color: #9b2c2c;
  font-size: 14px;
  margin: 0 0 10px;
}
.phone-crash-notice {
  color: #ff3b3b;
  text-transform: uppercase;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  font-size: clamp(14px, 3.6vw, 18px);
  line-height: 1.35;
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 1px solid #ff3b3b;
  background: rgba(155, 44, 44, 0.18);
}

.login-box { max-width: 420px; margin: 0 auto; }

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 520px;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #ddd3be;
  vertical-align: top;
}
th {
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}
.pass { color: var(--ok); font-weight: 700; }
.fail { color: var(--bad); font-weight: 700; }
.sub {
  font-size: 13px;
  color: var(--muted);
}
details { margin-top: 6px; }
details summary {
  cursor: pointer;
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 12px;
}
.review-item { margin: 8px 0; }
.row-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
  vertical-align: middle;
}
.btn-delete {
  min-height: 36px;
  padding: 8px 14px;
  color: var(--bad);
  border-color: #e0b4b4;
}
.btn-delete:hover {
  background: #f8e8e8;
  color: var(--bad);
}
.review-item.ok { color: var(--ok); }
.review-item.no { color: var(--bad); }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.toolbar-actions .btn { min-height: 40px; }

.foot {
  text-align: center;
  color: #8ea0b8;
  font-size: 12px;
  margin-top: 18px;
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0 12px;
}

@media (max-width: 720px) {
  .row { grid-template-columns: 1fr; }
  .card { padding: 18px 16px 22px; }
  .card::before { inset: 6px; }
  .masthead .dept { letter-spacing: 0.12em; }
  .progress { align-items: center; }
  table { min-width: 0; }
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  td.row-actions { text-align: right; }
  tr {
    border: 1px solid #ddd3be;
    background: #fffdf8;
    margin-bottom: 12px;
    padding: 10px 12px;
  }
  td { border: 0; padding: 6px 0; }
  td::before {
    content: attr(data-label);
    display: block;
    font-family: "Barlow Condensed", sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 2px;
  }
}

@media (max-width: 480px) {
  .wrap { width: calc(100% - 16px); }
  .actions {
    position: sticky;
    bottom: calc(8px + env(safe-area-inset-bottom));
    background: var(--paper);
    padding: 10px 0 0;
    z-index: 2;
  }
  .btn { width: 100%; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .btn,
  .toolbar-actions label.btn { flex: 1 1 calc(50% - 8px); }
}
