@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@400;500;600;700;900&family=Noto+Sans+KR:wght@500;700;900&display=swap");

:root {
  --paper-texture: url("./assets/exam-gaengji-texture.png");
  --paper: #d7c9ad;
  --page: #bdb19a;
  --ink: #151515;
  --muted: #58544c;
  --line: #1e2430;
  --line-soft: rgba(30, 36, 48, 0.22);
  --blue: #10234a;
  --blue-soft: #e8edf5;
  --red: #b3212b;
  --red-soft: #f8e9e7;
  --green: #246f54;
  --shadow: 0 24px 52px rgba(31, 27, 20, 0.22);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(rgba(43, 36, 25, 0.18), rgba(43, 36, 25, 0.18)),
    var(--paper-texture) center / 860px auto,
    var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    "Noto Serif KR",
    "AppleMyungjo",
    "Batang",
    "Times New Roman",
    system-ui,
    sans-serif;
  letter-spacing: 0;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 26px 18px 42px;
}

.exam-sheet {
  position: relative;
  min-height: calc(100vh - 70px);
  overflow: hidden;
  background:
    linear-gradient(rgba(215, 201, 173, 0.42), rgba(215, 201, 173, 0.42)),
    var(--paper-texture) center / cover,
    var(--paper);
  border: 2px solid #161616;
  box-shadow: var(--shadow);
}

.exam-sheet::before {
  content: "";
  position: absolute;
  inset: 20px;
  border: 1.5px solid rgba(20, 20, 20, 0.72);
  pointer-events: none;
  opacity: 0.82;
}

.exam-sheet::after {
  content: "채점란";
  position: absolute;
  inset: 30px 32px auto auto;
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border: 4px double rgba(179, 33, 43, 0.62);
  border-radius: 50%;
  transform: rotate(-12deg);
  color: rgba(179, 33, 43, 0.68);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.92rem;
  font-weight: 900;
  opacity: 0.42;
}

.start-page,
.result-page {
  display: grid;
  align-content: center;
  min-height: calc(100vh - 72px);
  padding: clamp(42px, 7vw, 88px);
}

.start-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 330px);
  gap: clamp(28px, 5vw, 74px);
  align-items: center;
}

.exam-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin-bottom: 18px;
  padding: 4px 10px;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.exam-kicker::before,
.exam-kicker::after {
  content: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.start-page h1,
.result-title {
  max-width: 740px;
  color: var(--ink);
  font-size: clamp(2.7rem, 7vw, 5.9rem);
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: 0;
  word-break: keep-all;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 10px;
}

.start-copy {
  max-width: 640px;
  margin-top: 28px;
  color: #24211c;
  font-size: clamp(1.08rem, 2vw, 1.34rem);
  line-height: 1.78;
  font-weight: 500;
  word-break: keep-all;
}

.exam-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.round-selector {
  position: relative;
  width: min(100%, 190px);
  margin-top: 18px;
  border: 2px solid var(--ink);
  background: rgba(238, 228, 203, 0.42);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-weight: 950;
}

.round-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.round-option {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-top: 1px solid rgba(20, 20, 20, 0.46);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.round-option:hover,
.round-current:hover {
  background: rgba(20, 20, 20, 0.08);
}

.student-strip {
  display: grid;
  grid-template-columns: auto minmax(96px, 140px) auto minmax(150px, 220px);
  width: min(100%, 560px);
  margin-top: 18px;
  border: 2px solid var(--ink);
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.88rem;
}

.student-strip span,
.student-strip strong,
.student-strip label,
.student-strip input {
  min-height: 34px;
  padding: 7px 10px;
  border-right: 1px solid var(--ink);
}

.student-strip span,
.student-strip label {
  background: rgba(20, 20, 20, 0.08);
  font-weight: 900;
}

.student-strip strong,
.student-strip input {
  background: rgba(238, 228, 203, 0.34);
  font-weight: 800;
}

.student-strip input {
  width: 100%;
  min-width: 0;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  color: var(--ink);
  caret-color: var(--red);
  font: inherit;
  outline: 0;
}

.student-strip input:focus {
  background: rgba(255, 246, 219, 0.54);
  box-shadow: inset 0 0 0 2px rgba(179, 33, 43, 0.42);
}

.student-strip input.is-empty {
  caret-color: #fff;
  animation: blankNamePulse 1.1s ease-in-out infinite;
}

.student-strip input.is-empty:focus {
  background: rgba(255, 255, 255, 0.62);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.92),
    0 0 18px rgba(255, 255, 255, 0.62);
}

@keyframes blankNamePulse {
  0%,
  100% {
    background: rgba(255, 255, 255, 0.36);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.58);
  }

  50% {
    background: rgba(255, 255, 255, 0.72);
    box-shadow:
      inset 0 0 0 2px rgba(255, 255, 255, 0.96),
      0 0 18px rgba(255, 255, 255, 0.68);
  }
}

.student-strip :last-child {
  border-right: 0;
}

.exam-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1.5px solid var(--ink);
  background: rgba(215, 201, 173, 0.38);
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
}

.primary-action,
.secondary-action,
.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-weight: 850;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.primary-action {
  margin-top: 34px;
  background: var(--ink);
  color: #fff;
  box-shadow: 6px 6px 0 rgba(179, 33, 43, 0.18);
}

.primary-action:hover,
.secondary-action:hover,
.ghost-action:hover,
.option-button:hover {
  transform: translateY(-1px);
}

.primary-action:disabled,
.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
  box-shadow: none;
}

.secondary-action {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.ghost-action {
  border-color: var(--ink);
  background: rgba(215, 201, 173, 0.58);
  color: var(--ink);
}

.answer-visual {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 2px solid var(--ink);
  background:
    linear-gradient(rgba(215, 201, 173, 0.46), rgba(215, 201, 173, 0.46)),
    var(--paper-texture) center / cover;
}

.answer-visual::before {
  content: "답안지";
  position: absolute;
  top: -13px;
  left: 18px;
  padding: 3px 9px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.answer-row {
  display: grid;
  grid-template-columns: 38px repeat(5, 1fr);
  gap: 8px;
  align-items: center;
}

.answer-row-number {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.answer-bubble {
  aspect-ratio: 1;
  border: 1.5px solid #2d2d2d;
  border-radius: 50%;
  background: rgba(238, 228, 203, 0.34);
}

.answer-row:nth-child(2) .answer-bubble:nth-child(4),
.answer-row:nth-child(4) .answer-bubble:nth-child(3),
.answer-row:nth-child(7) .answer-bubble:nth-child(5) {
  background: radial-gradient(circle at center, var(--blue) 0 45%, transparent 47%);
}

.question-page {
  min-height: calc(100vh - 72px);
  padding: clamp(18px, 4vw, 38px);
}

.exam-header {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  gap: 18px;
  align-items: center;
  min-height: 58px;
  padding: 10px 0 16px;
  border-top: 3px solid var(--ink);
  border-bottom: 3px double var(--ink);
}

.exam-brand {
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: clamp(1rem, 2vw, 1.18rem);
  font-weight: 900;
}

.exam-student {
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.92rem;
  font-weight: 900;
  white-space: nowrap;
}

.progress-label {
  min-width: 82px;
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.98rem;
  font-weight: 850;
  text-align: center;
}

.timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  height: 40px;
  border: 2px solid var(--ink);
  background: rgba(215, 201, 173, 0.44);
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.timer.is-urgent {
  border-color: rgba(179, 40, 47, 0.45);
  background: var(--red-soft);
  color: var(--red);
}

.timer.is-critical {
  animation: pulse 480ms steps(2, end) infinite;
}

.timer.is-overtime {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

@keyframes pulse {
  50% {
    opacity: 0.42;
  }
}

.progress-track {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(20, 20, 20, 0.58);
  background: rgba(238, 228, 203, 0.3);
}

.progress-fill {
  height: 100%;
  width: 100%;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 9px,
    rgba(20, 20, 20, 0.82) 9px 18px
  );
  transform-origin: left;
  transition: width 240ms linear;
}

.question-body {
  display: grid;
  grid-template-columns: minmax(0, 880px);
  justify-content: center;
  gap: 22px;
  padding-top: clamp(24px, 5vw, 48px);
}

.question-number {
  display: inline-block;
  margin-bottom: 16px;
  padding: 4px 12px;
  border: 2px solid var(--ink);
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.9rem;
  font-weight: 900;
}

.question-prompt {
  color: var(--blue);
  font-weight: 900;
  word-break: keep-all;
}

.question-prompt {
  max-width: 860px;
  font-size: clamp(1.32rem, 2.6vw, 2.05rem);
  line-height: 1.32;
}

.question-emphasis {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 6px;
}

.dialogue-box {
  margin-top: 22px;
  display: grid;
  gap: 2px;
  padding: 18px 24px 19px;
  border: 2px solid var(--ink);
  background:
    linear-gradient(rgba(215, 201, 173, 0.5), rgba(215, 201, 173, 0.5)),
    var(--paper-texture) center / cover;
}

.passage-label {
  justify-self: center;
  min-width: 86px;
  margin-bottom: 12px;
  padding: 2px 14px 4px;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 900;
  text-align: center;
}

.dialogue-line {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 2px 0;
  background: transparent;
  line-height: 1.48;
}

.speaker {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 900;
  white-space: nowrap;
}

.speaker::after {
  content: ":";
  margin-left: 1px;
}

.utterance {
  color: #1f1f1f;
  font-size: 0.99rem;
  font-weight: 500;
  word-break: keep-all;
}

.options-panel {
  align-self: start;
  padding: 18px 24px 20px;
  border: 2px solid var(--ink);
  background:
    linear-gradient(rgba(215, 201, 173, 0.48), rgba(215, 201, 173, 0.48)),
    var(--paper-texture) center / cover;
}

.options-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 3px double var(--ink);
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.95rem;
  font-weight: 900;
}

.option-list {
  display: grid;
  gap: 2px;
  margin-top: 10px;
}

.option-button {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  min-height: 0;
  padding: 5px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.option-button.is-selected {
  background: transparent;
  box-shadow: none;
}

.option-button.is-selected::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at center, var(--ink) 0 45%, transparent 48%);
  transform: translateY(-50%);
  pointer-events: none;
}

.option-label {
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 900;
  line-height: 1.38;
}

.option-text {
  align-self: center;
  font-size: 0.99rem;
  line-height: 1.42;
  font-weight: 500;
  word-break: keep-all;
}

.question-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.result-page {
  align-content: start;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1.08fr);
  gap: clamp(24px, 4vw, 54px);
  align-items: start;
}

.score-panel {
  position: relative;
  min-height: 520px;
  padding: clamp(26px, 4vw, 44px);
  border: 2px solid var(--ink);
  background:
    linear-gradient(rgba(215, 201, 173, 0.48), rgba(215, 201, 173, 0.48)),
    var(--paper-texture) center / cover;
}

.score-panel::after {
  content: attr(data-grade);
  position: absolute;
  right: clamp(16px, 4vw, 38px);
  bottom: clamp(20px, 4vw, 40px);
  display: grid;
  place-items: center;
  width: clamp(116px, 18vw, 172px);
  aspect-ratio: 1;
  border: 7px double rgba(179, 40, 47, 0.72);
  border-radius: 50%;
  color: rgba(179, 40, 47, 0.82);
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  font-weight: 950;
  transform: rotate(-12deg);
}

.score-label {
  margin-top: 34px;
  color: var(--muted);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.95rem;
  font-weight: 900;
}

.score-number {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 8px;
  color: var(--ink);
  font-size: clamp(4.8rem, 13vw, 8.8rem);
  line-height: 0.86;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.score-number span {
  padding-bottom: 0.34em;
  color: var(--muted);
  font-size: 0.22em;
  font-weight: 850;
}

.grade-line {
  margin-top: 26px;
  color: var(--ink);
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  line-height: 1.25;
  font-weight: 900;
  word-break: keep-all;
}

.result-name {
  width: fit-content;
  margin-top: 28px;
  padding: 6px 13px;
  border: 2px solid var(--ink);
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.95rem;
  font-weight: 900;
}

.grade-copy {
  max-width: 440px;
  margin-top: 16px;
  color: #2a261f;
  line-height: 1.75;
  font-weight: 500;
  word-break: keep-all;
}

.fact-punch {
  max-width: 480px;
  margin-top: 22px;
  padding: 15px 16px;
  border: 2px solid var(--ink);
  background: rgba(238, 228, 203, 0.34);
}

.fact-punch-label {
  width: fit-content;
  margin-bottom: 8px;
  padding: 2px 8px;
  background: var(--ink);
  color: var(--paper);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.82rem;
  font-weight: 900;
}

.fact-punch p {
  color: #1d1a15;
  font-size: 1.02rem;
  line-height: 1.68;
  font-weight: 800;
  word-break: keep-all;
}

.result-side {
  display: grid;
  gap: 18px;
}

.result-summary-line,
.analysis-card,
.review-card {
  border: 2px solid var(--ink);
  background:
    linear-gradient(rgba(215, 201, 173, 0.46), rgba(215, 201, 173, 0.46)),
    var(--paper-texture) center / cover;
}

.result-summary-line {
  padding: 15px 18px;
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 1rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.analysis-card {
  padding: 18px;
}

.section-heading {
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 1.05rem;
  font-weight: 950;
}

.analysis-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.analysis-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(100px, 1.15fr) 54px;
  gap: 12px;
  align-items: center;
  color: #24211c;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.93rem;
  font-weight: 800;
}

.bar {
  height: 9px;
  overflow: hidden;
  border: 1px solid rgba(20, 20, 20, 0.58);
  background: rgba(238, 228, 203, 0.3);
}

.bar-fill {
  height: 100%;
  width: var(--score-width);
  background: linear-gradient(90deg, var(--ink), var(--green));
}

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

.share-status {
  min-height: 20px;
  color: var(--green);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
}

.review-section {
  display: none;
  margin-top: 22px;
}

.review-section.is-visible {
  display: grid;
  gap: 12px;
}

.review-card {
  padding: 16px;
}

.review-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  color: var(--ink);
  font-weight: 950;
}

.review-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(20, 20, 20, 0.42);
  background: rgba(238, 228, 203, 0.34);
  color: var(--muted);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.82rem;
  font-weight: 850;
}

.tag.correct {
  border-color: rgba(36, 114, 92, 0.32);
  background: #effaf5;
  color: var(--green);
}

.tag.misread,
.tag.wrong {
  border-color: rgba(179, 40, 47, 0.26);
  background: var(--red-soft);
  color: var(--red);
}

.review-explanation {
  margin-top: 12px;
  color: #2a261f;
  line-height: 1.68;
  font-weight: 500;
  word-break: keep-all;
}

.admin-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px 18px 42px;
}

.admin-panel {
  min-height: calc(100vh - 66px);
  padding: clamp(24px, 4vw, 44px);
  border: 2px solid var(--ink);
  background:
    linear-gradient(rgba(215, 201, 173, 0.46), rgba(215, 201, 173, 0.46)),
    var(--paper-texture) center / cover,
    var(--paper);
  box-shadow: var(--shadow);
}

.admin-header {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 3px double var(--ink);
}

.admin-header h1 {
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1.05;
  font-weight: 900;
}

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

.admin-actions .ghost-action {
  width: auto;
  min-height: 42px;
}

.admin-login {
  max-width: 520px;
  margin-top: 26px;
  padding: 18px;
  border: 2px solid var(--ink);
  background: rgba(238, 228, 203, 0.36);
}

.admin-login label {
  display: block;
  margin-bottom: 8px;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-weight: 900;
}

.admin-login-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 8px;
}

.admin-login input {
  min-height: 48px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.38);
  color: var(--ink);
  font: inherit;
  outline: 0;
  padding: 0 12px;
}

.admin-login p {
  min-height: 24px;
  margin-top: 10px;
  color: var(--green);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-weight: 900;
}

.admin-login p.is-error {
  color: var(--red);
}

.admin-content {
  margin-top: 22px;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.admin-summary div {
  min-height: 88px;
  padding: 14px;
  border: 2px solid var(--ink);
  background: rgba(238, 228, 203, 0.34);
}

.admin-summary span {
  display: block;
  color: var(--muted);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.84rem;
  font-weight: 900;
}

.admin-summary strong {
  display: block;
  margin-top: 9px;
  color: var(--ink);
  font-size: 1.7rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 2px solid var(--ink);
  background: rgba(238, 228, 203, 0.34);
}

.admin-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 0.92rem;
}

.admin-table th,
.admin-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(20, 20, 20, 0.28);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  background: rgba(20, 20, 20, 0.08);
  font-weight: 950;
  white-space: nowrap;
}

.admin-delete {
  min-height: 30px;
  padding: 0 9px;
  border: 1.5px solid var(--red);
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

@media (max-width: 860px) {
  html {
    background:
      linear-gradient(rgba(43, 36, 25, 0.08), rgba(43, 36, 25, 0.08)),
      var(--paper-texture) center / 720px auto,
      var(--paper);
  }

  body {
    font-family:
      "Noto Sans KR",
      "Apple SD Gothic Neo",
      system-ui,
      sans-serif;
  }

  .app-shell {
    padding: 0;
  }

  .exam-sheet {
    min-height: 100vh;
    overflow: visible;
    border-width: 0;
    box-shadow: none;
    background:
      linear-gradient(rgba(215, 201, 173, 0.32), rgba(215, 201, 173, 0.32)),
      var(--paper-texture) center / cover,
      var(--paper);
  }

  .exam-sheet::before,
  .exam-sheet::after {
    content: none;
  }

  .start-page,
  .result-page,
  .question-page {
    min-height: 100vh;
    padding: 18px 16px 28px;
  }

  .start-page {
    align-content: start;
    padding-top: max(24px, env(safe-area-inset-top));
  }

  .start-page h1,
  .result-title {
    font-size: clamp(2.05rem, 12vw, 3.35rem);
    line-height: 1.08;
    text-decoration-thickness: 2px;
    text-underline-offset: 7px;
  }

  .start-copy {
    margin-top: 20px;
    font-size: 1rem;
    line-height: 1.68;
  }

  .exam-meta-row {
    gap: 8px;
    margin-top: 20px;
  }

  .exam-chip {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.86rem;
  }

  .round-selector {
    margin-top: 14px;
    width: min(100%, 168px);
  }

  .round-current,
  .round-option {
    min-height: 40px;
    padding: 0 11px;
    font-size: 0.92rem;
  }

  .start-grid,
  .question-body,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .answer-visual {
    display: none;
  }

  .student-strip {
    grid-template-columns: auto minmax(0, 1fr);
    width: 100%;
    margin-top: 16px;
    font-size: 0.9rem;
  }

  .student-strip label:nth-child(3) {
    border-top: 1px solid var(--ink);
  }

  .student-strip input:nth-child(4) {
    border-top: 1px solid var(--ink);
  }

  .student-strip strong:nth-child(2),
  .student-strip input:nth-child(4) {
    border-right: 0;
  }

  .primary-action,
  .secondary-action,
  .ghost-action {
    min-height: 48px;
    width: 100%;
    padding: 0 14px;
  }

  .exam-header {
    position: sticky;
    top: 0;
    z-index: 5;
    grid-template-columns: 1fr auto;
    gap: 7px 10px;
    margin: -18px -16px 0;
    padding: max(10px, env(safe-area-inset-top)) 16px 10px;
    background:
      linear-gradient(rgba(215, 201, 173, 0.82), rgba(215, 201, 173, 0.82)),
      var(--paper-texture) center / cover,
      var(--paper);
    border-top: 0;
    border-bottom: 2px solid var(--ink);
  }

  .exam-brand {
    font-size: 0.95rem;
    line-height: 1.2;
  }

  .exam-student {
    grid-column: 1 / 2;
    grid-row: 2;
    justify-self: start;
    font-size: 0.82rem;
    line-height: 1.2;
  }

  .progress-label {
    grid-column: 1 / 2;
    grid-row: 3;
    justify-self: start;
    min-width: 0;
    font-size: 0.86rem;
  }

  .timer {
    grid-column: 2;
    grid-row: 1 / 4;
    align-self: center;
    min-width: 78px;
    height: 38px;
    font-size: 0.94rem;
  }

  .progress-track {
    grid-row: 4;
    height: 6px;
  }

  .question-body {
    gap: 14px;
    padding-top: 18px;
  }

  .question-number {
    margin-bottom: 10px;
    padding: 3px 9px;
    border-width: 1.5px;
    font-size: 0.82rem;
  }

  .question-prompt {
    max-width: none;
    color: var(--ink);
    font-family:
      "Noto Serif KR",
      "AppleMyungjo",
      "Batang",
      serif;
    font-size: clamp(1.12rem, 5.1vw, 1.42rem);
    line-height: 1.45;
  }

  .question-emphasis {
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
  }

  .dialogue-box {
    margin-top: 16px;
    padding: 14px 13px 15px;
    border-width: 1.5px;
    background:
      linear-gradient(rgba(215, 201, 173, 0.6), rgba(215, 201, 173, 0.6)),
      var(--paper-texture) center / cover;
  }

  .passage-label {
    min-width: 72px;
    margin-bottom: 9px;
    padding: 1px 10px 3px;
    font-size: 0.92rem;
  }

  .dialogue-line {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 7px;
    padding: 3px 0;
    line-height: 1.55;
  }

  .speaker {
    width: auto;
    font-size: 0.84rem;
  }

  .utterance {
    font-size: 0.95rem;
    line-height: 1.55;
  }

  .options-panel {
    padding: 13px 13px 14px;
    border-width: 1.5px;
    background:
      linear-gradient(rgba(215, 201, 173, 0.58), rgba(215, 201, 173, 0.58)),
      var(--paper-texture) center / cover;
  }

  .options-title {
    padding-bottom: 9px;
    border-bottom-width: 2px;
    font-size: 0.86rem;
  }

  .option-list {
    gap: 4px;
    margin-top: 8px;
  }

  .option-button {
    grid-template-columns: 28px minmax(0, 1fr);
    min-height: 46px;
    padding: 8px 2px;
  }

  .option-button.is-selected::after {
    left: 4px;
    width: 16px;
    height: 16px;
    border-width: 1.5px;
  }

  .option-label {
    font-size: 1rem;
    line-height: 1.45;
  }

  .option-text {
    font-size: 0.96rem;
    line-height: 1.5;
  }

  .question-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    margin: 10px -13px -14px;
    padding: 10px 13px max(10px, env(safe-area-inset-bottom));
    background:
      linear-gradient(rgba(215, 201, 173, 0), rgba(215, 201, 173, 0.95) 24%),
      var(--paper-texture) center / cover;
  }

  .score-panel {
    min-height: 0;
    padding: 22px 18px 26px;
  }

  .score-panel::after {
    width: 92px;
    right: 18px;
    bottom: 18px;
    font-size: 2.4rem;
  }

  .score-number {
    font-size: clamp(4.2rem, 23vw, 6.6rem);
  }

  .grade-line {
    max-width: calc(100% - 96px);
    font-size: 1.35rem;
  }

  .fact-punch {
    max-width: none;
    margin-top: 18px;
    padding: 13px;
  }

  .fact-punch p {
    font-size: 0.96rem;
    line-height: 1.58;
  }

  .result-summary-line {
    padding: 13px;
    font-size: 0.94rem;
  }

  .analysis-row {
    grid-template-columns: 1fr 82px;
    gap: 7px;
  }

  .analysis-row .bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .admin-shell {
    padding: 0;
  }

  .admin-panel {
    min-height: 100vh;
    padding: 18px 16px 28px;
    border: 0;
    box-shadow: none;
  }

  .admin-header {
    display: grid;
    gap: 12px;
    align-items: start;
  }

  .admin-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .admin-actions .ghost-action {
    width: 100%;
    min-height: 40px;
    padding: 0 8px;
    font-size: 0.86rem;
  }

  .admin-login {
    max-width: none;
    padding: 14px;
  }

  .admin-login-row {
    grid-template-columns: 1fr;
  }

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

  .admin-summary div {
    min-height: 76px;
    padding: 11px;
  }

  .admin-summary strong {
    font-size: 1.35rem;
  }

  .admin-table {
    font-size: 0.86rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
