:root {
  --background: #f5f1e8;
  --foreground: #1d2521;
  --ink-soft: #5d665f;
  --paper: #fffaf0;
  --line: rgba(57, 72, 62, 0.18);
  --wood: #2f7a52;
  --fire: #c84432;
  --earth: #a87828;
  --metal: #7c8790;
  --water: #235f8f;
  --focus: #1c6b58;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(47, 122, 82, 0.16), transparent 30rem),
    radial-gradient(circle at top right, rgba(200, 68, 50, 0.12), transparent 24rem),
    linear-gradient(180deg, #faf5ea 0%, #ece4d5 100%);
  color: var(--foreground);
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

h1,
h2,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.exam-shell,
.admin-shell {
  width: min(100%, 520px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 18px 14px 32px;
}

.admin-shell {
  width: min(100%, 760px);
}

.top-panel,
.admin-hero,
.admin-controls,
.admin-summary,
.score-row,
.identity-band,
.question-card,
.submit-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.92);
}

.top-panel {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 14px;
  align-items: center;
  padding: 18px 16px 16px;
  box-shadow: 0 18px 38px rgba(60, 50, 34, 0.14);
}

.seal-visual {
  position: relative;
  width: 82px;
  aspect-ratio: 1;
  border: 1px solid rgba(29, 37, 33, 0.18);
  border-radius: 50%;
  background: conic-gradient(
    from -40deg,
    rgba(35, 95, 143, 0.28),
    rgba(47, 122, 82, 0.32),
    rgba(200, 68, 50, 0.3),
    rgba(168, 120, 40, 0.34),
    rgba(124, 135, 144, 0.3),
    rgba(35, 95, 143, 0.28)
  );
}

.seal-visual::after {
  position: absolute;
  inset: 22px;
  content: "";
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(29, 37, 33, 0.16);
}

.seal-visual span {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1d2521;
  color: #fffaf0;
  font-size: 13px;
  font-weight: 700;
}

.seal-visual span:nth-child(1) {
  top: 4px;
  left: 29px;
  background: var(--metal);
}

.seal-visual span:nth-child(2) {
  top: 28px;
  right: 1px;
  background: var(--wood);
}

.seal-visual span:nth-child(3) {
  right: 12px;
  bottom: 5px;
  background: var(--water);
}

.seal-visual span:nth-child(4) {
  bottom: 5px;
  left: 12px;
  background: var(--fire);
}

.seal-visual span:nth-child(5) {
  top: 28px;
  left: 1px;
  background: var(--earth);
}

.title-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--focus);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  font-size: clamp(26px, 8vw, 38px);
  line-height: 1.05;
  letter-spacing: 0;
}

.privacy-copy {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

.timer-card {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  background: #1d2521;
  color: #fffaf0;
}

.timer-card strong {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 26px;
  line-height: 1;
}

.exam-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.identity-band {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
}

.identity-band label,
.admin-controls label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.identity-band label span,
.relation-row span,
.pair-row span,
.admin-controls label span {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.identity-band input,
.admin-controls input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(29, 37, 33, 0.18);
  border-radius: 8px;
  background: #fff;
  color: var(--foreground);
  padding: 0 12px;
  outline: none;
}

.identity-band input:focus,
.admin-controls input:focus,
.compact-input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(28, 107, 88, 0.14);
}

.progress-pill {
  display: grid;
  min-height: 44px;
  place-items: center;
  white-space: nowrap;
  border-radius: 8px;
  background: rgba(35, 95, 143, 0.1);
  color: var(--water);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.question-card {
  padding: 15px 14px 16px;
}

.question-head {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
}

.question-head span {
  width: fit-content;
  border-radius: 999px;
  background: rgba(47, 122, 82, 0.12);
  color: var(--wood);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.question-head h2 {
  font-size: 18px;
  line-height: 1.3;
}

.answer-hint,
.question-prompt small {
  color: var(--earth);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.answer-hint {
  margin-top: 1px;
}

.question-prompt {
  display: grid;
  gap: 3px;
}

.input-grid {
  display: grid;
  gap: 8px;
}

.input-grid.five,
.input-grid.stems {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.compact-input {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid rgba(29, 37, 33, 0.18);
  border-radius: 8px;
  background: #fff;
  color: var(--foreground);
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  outline: none;
}

.compact-input::placeholder {
  color: rgba(93, 102, 95, 0.5);
  font-size: 12px;
  font-weight: 700;
}

.compact-input:disabled {
  opacity: 0.7;
}

.relation-list,
.pair-list,
.score-list {
  display: grid;
  gap: 8px;
}

.relation-row,
.pair-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  padding: 8px 0;
  border-top: 1px solid rgba(29, 37, 33, 0.08);
}

.relation-row:first-child,
.pair-row:first-child {
  border-top: 0;
}

.pair-row {
  grid-template-columns: minmax(0, 1fr) 116px;
}

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

.submit-panel {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  gap: 10px;
  padding: 12px;
  box-shadow: 0 -14px 28px rgba(60, 50, 34, 0.12);
}

.status-text {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

.status-text.success {
  color: var(--wood);
  font-weight: 700;
}

.status-text.error {
  color: var(--fire);
  font-weight: 700;
}

.result-box {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  background: rgba(47, 122, 82, 0.1);
  color: var(--foreground);
  padding: 10px;
}

.result-box strong {
  color: var(--wood);
  font-size: 18px;
}

.result-box span {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.submit-panel button,
.admin-controls button {
  width: 100%;
  min-height: 50px;
  border-radius: 8px;
  background: #1d2521;
  color: #fffaf0;
  font-size: 17px;
  font-weight: 800;
}

.submit-panel button:disabled,
.admin-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.admin-hero {
  display: grid;
  gap: 8px;
  padding: 18px 16px;
  box-shadow: 0 18px 38px rgba(60, 50, 34, 0.12);
}

.admin-hero h1 {
  font-size: clamp(28px, 9vw, 42px);
}

.admin-hero p:last-child {
  color: var(--ink-soft);
  line-height: 1.55;
}

.admin-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(86px, 0.5fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
  padding: 14px;
}

.admin-controls button {
  min-height: 44px;
  padding: 0 16px;
  white-space: nowrap;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 110px)) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 12px 14px;
}

.admin-summary div {
  display: grid;
  gap: 2px;
}

.admin-summary span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.admin-summary strong {
  color: var(--wood);
  font-size: 24px;
}

.admin-summary p {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.45;
}

.score-list {
  margin-top: 12px;
}

.score-row {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.score-main,
.score-meta,
.section-scores {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.score-main span {
  color: var(--water);
  font-size: 12px;
  font-weight: 800;
}

.score-main h2 {
  margin-top: 2px;
  font-size: 20px;
  line-height: 1.2;
}

.score-main strong {
  color: var(--wood);
  font-size: 24px;
  white-space: nowrap;
}

.score-meta {
  color: var(--ink-soft);
  font-size: 13px;
}

.section-scores {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.section-scores span {
  border-radius: 999px;
  background: rgba(35, 95, 143, 0.1);
  color: var(--water);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 420px) {
  .exam-shell,
  .admin-shell {
    padding-inline: 10px;
  }

  .top-panel {
    grid-template-columns: 72px 1fr;
    padding-inline: 12px;
  }

  .seal-visual {
    width: 70px;
  }

  .seal-visual span {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .seal-visual span:nth-child(1) {
    left: 24px;
  }

  .compact-input {
    height: 42px;
    font-size: 18px;
  }

  .identity-band,
  .admin-controls,
  .admin-summary {
    grid-template-columns: 1fr;
  }

  .progress-pill {
    justify-self: start;
  }

  .score-main,
  .score-meta {
    align-items: flex-start;
    flex-direction: column;
  }
}
