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

:root {
  --ink: #0f172a;
  --muted: #5f6b7a;
  --line: #d9e0ea;
  --paper: #ffffff;
  --soft: #f6f8fb;
  --accent: #2456d6;
  --accent-dark: #123177;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  --panel-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #eef2f8 0, #f7f8fb 300px, #f4f6fa 100%);
  font-family: "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 38px 28px 22px;
}

.program,
.section-kicker {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-family: "Noto Serif KR", serif;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.16;
  font-weight: 900;
}

h2 {
  font-size: 24px;
  line-height: 1.35;
}

h3 {
  font-size: 19px;
  line-height: 1.35;
}

.status-chip,
.save-state {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 8px 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip {
  border-radius: 999px;
}

.save-state {
  border-radius: 999px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  border-color: var(--line);
  border-radius: 999px;
  background: #fff;
  color: #1f2a3d;
  padding: 0;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.icon-button:hover {
  border-color: #b8c5d8;
  background: #f8fafc;
  color: var(--accent-dark);
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.icon-button svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.layout {
  max-width: 1240px;
  margin: 0 auto 56px;
  padding: 0 28px;
}

.login-panel,
.exam-shell {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  display: grid;
  grid-template-columns: 1fr minmax(320px, 420px);
  gap: 32px;
  align-items: center;
  padding: 38px 40px;
}

.muted {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.lookup-form,
.admin-form {
  display: grid;
  gap: 10px;
}

label {
  color: #293241;
  font-size: 14px;
  font-weight: 800;
}

.inline-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c9d1df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.secondary,
.ghost-button {
  background: #fff;
  color: var(--accent-dark);
}

.secondary:hover,
.ghost-button:hover {
  background: #eef4ff;
  color: var(--accent-dark);
}

.disabled-link,
.disabled-link:hover {
  border-color: #cbd5e1;
  background: #e5e7eb;
  color: #6b7280;
  cursor: not-allowed;
  pointer-events: none;
}

.message {
  grid-column: 1 / -1;
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.message.error {
  color: var(--danger);
}

.message.ok {
  color: var(--ok);
}

.hidden {
  display: none;
}

.exam-shell {
  margin-top: 22px;
  padding: 30px;
  box-shadow: var(--panel-shadow);
}

.identity-bar,
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.exam-timers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.exam-timers > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fc;
  padding: 13px 15px;
}

.exam-timers span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.exam-timers strong {
  color: var(--accent-dark);
  font-size: 20px;
  font-weight: 900;
}

.exam-timers .closed {
  color: var(--danger);
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 26px 0;
}

.task-grid:not(.practical-visible) {
  grid-template-columns: 1fr;
}

.task-card,
.answer-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.task-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.task-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.task-number {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.answer-panel {
  margin-top: 16px;
  padding: 26px;
}

.answer-progress {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f0f4fb;
  color: var(--accent-dark);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 900;
}

.theory-frame {
  width: 100%;
  height: min(82vh, 980px);
  margin-top: 14px;
  border: 1px solid #111827;
  border-radius: 8px;
  background: #d7d7d7;
}

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

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  background: rgba(10, 16, 28, 0.62);
  padding: 24px;
}

.modal-backdrop.hidden {
  display: none;
}

.admin-modal {
  width: min(1120px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.44);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.26);
  padding: 24px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.admin-auth {
  display: grid;
  gap: 8px;
  max-width: 460px;
  margin-top: 20px;
}

.admin-tools {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(280px, 0.95fr);
  gap: 16px;
  margin-top: 20px;
}

.admin-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  padding: 18px;
}

.admin-card-wide {
  grid-column: 1 / -1;
}

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

.check-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.check-row input {
  width: auto;
}

.code-result {
  min-height: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.6;
}

.issued-code {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-top: 6px;
  border: 1px solid #111827;
  border-radius: 6px;
  background: #fff;
  padding: 4px 10px;
  color: #111827;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
}

.bulk-result-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.bulk-result-list div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
}

.bulk-result-list .error {
  border-color: #f3b7b1;
  color: var(--danger);
}

.exam-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #000;
  color: #fff;
  padding: 24px;
}

.exam-lock-overlay.hidden {
  display: none;
}

.exam-lock-overlay > div {
  width: min(460px, 100%);
  text-align: center;
}

.exam-lock-overlay .section-kicker {
  color: #93c5fd;
}

.exam-lock-overlay p {
  color: #d1d5db;
  line-height: 1.7;
}

.exam-lock-overlay button {
  margin-top: 18px;
}

.admin-results {
  margin-top: 16px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 13px;
}

th,
td {
  border: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f0f4fb;
  color: #293241;
}

@media (max-width: 820px) {
  .site-header,
  .identity-bar,
  .panel-head,
  .modal-head {
    align-items: stretch;
    flex-direction: column;
  }

  .login-panel,
  .task-grid,
  .exam-timers,
  .admin-tools {
    grid-template-columns: 1fr;
  }

  .theory-frame {
    height: 76vh;
  }
}

@media (max-width: 520px) {
  .site-header {
    padding-top: 28px;
  }

  .layout {
    padding: 0 14px;
  }

  .login-panel,
  .exam-shell,
  .answer-panel,
  .admin-modal {
    padding: 18px;
  }

  .inline-control {
    grid-template-columns: 1fr;
  }
}
