:root {
  --blue-900: #12395f;
  --blue-700: #1f5f99;
  --blue-600: #2874b8;
  --blue-050: #edf6fc;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #dbe4ef;
  --surface: #ffffff;
  --page: #f5f8fb;
  --good: #15803d;
  --good-bg: #eaf8ef;
  --bad: #dc2626;
  --bad-bg: #fff0f0;
  --warn: #b45309;
  --warn-bg: #fff7ed;
  --shadow: 0 14px 35px rgba(18, 57, 95, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  text-align: left;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--blue-700);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  color: var(--blue-900);
  font-size: 1.06rem;
  line-height: 1.25;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.hero {
  padding: 28px 0 22px;
}

.hero h2 {
  margin: 0;
  color: var(--blue-900);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.25;
}

.hero p {
  margin: 10px 0 0;
  max-width: 740px;
  color: #4b5563;
  line-height: 1.7;
}

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

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric strong {
  display: block;
  color: var(--blue-900);
  font-size: 1.45rem;
}

.metric span {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.select-card {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
}

.card h3,
.panel h3 {
  margin: 0;
  color: var(--blue-900);
  font-size: 1.12rem;
}

.card p,
.panel p {
  color: var(--muted);
  line-height: 1.6;
}

.tag-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--blue-050);
  color: var(--blue-900);
  font-size: 0.8rem;
  font-weight: 700;
}

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--blue-700);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:hover {
  background: var(--blue-600);
  transform: translateY(-1px);
}

.btn.secondary {
  background: #e7eef6;
  color: var(--blue-900);
}

.btn.secondary:hover {
  background: #d9e7f3;
}

.btn.ghost {
  background: transparent;
  color: var(--blue-900);
  border: 1px solid var(--line);
}

.btn.danger {
  background: var(--bad);
}

.btn.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.88rem;
}

.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 18px;
}

.section-title h2 {
  margin: 0;
  color: var(--blue-900);
}

.section-title p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.category-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.category-card strong {
  color: var(--blue-900);
}

.category-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.exam-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.exam-status {
  position: sticky;
  top: 73px;
  z-index: 8;
  background: var(--blue-900);
  color: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.timer time {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 8px;
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: #8ed0ff;
  width: 0;
}

.number-list {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.num-btn {
  height: 38px;
  border-radius: 8px;
  background: #f2f6fb;
  color: var(--blue-900);
  font-weight: 800;
}

.num-btn.current {
  background: #8ed0ff;
}

.num-btn.answered {
  background: #d9f8e3;
  color: var(--good);
}

.num-btn.flagged {
  outline: 2px solid #f59e0b;
}

.question-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.question-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.question-head strong {
  color: var(--blue-900);
}

.question-body {
  padding: 22px;
}

.question-text {
  margin: 0 0 18px;
  font-size: 1.08rem;
  line-height: 1.75;
  color: #111827;
}

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

.choice {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: white;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--ink);
  text-align: left;
}

.choice:hover {
  border-color: var(--blue-600);
  background: #f8fbff;
}

.choice.selected {
  border-color: var(--blue-700);
  background: var(--blue-050);
}

.choice.correct {
  border-color: var(--good);
  background: var(--good-bg);
}

.choice.wrong {
  border-color: var(--bad);
  background: var(--bad-bg);
}

.choice-index {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e7eef6;
  color: var(--blue-900);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
}

.exam-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

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

.score-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.score-box strong {
  display: block;
  color: var(--blue-900);
  font-size: 1.55rem;
}

.score-box span {
  color: var(--muted);
  font-size: 0.88rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

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

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

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

th {
  color: var(--blue-900);
  background: #f6f9fc;
  font-size: 0.9rem;
}

.review-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
}

.review-item.good {
  border-color: rgba(21, 128, 61, 0.35);
}

.review-item.bad {
  border-color: rgba(220, 38, 38, 0.35);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.status-pill.good {
  color: var(--good);
  background: var(--good-bg);
}

.status-pill.bad {
  color: var(--bad);
  background: var(--bad-bg);
}

.empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
  background: white;
  border: 1px dashed #b9c7d8;
  border-radius: 8px;
}

.notice {
  padding: 13px 14px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid #fed7aa;
  line-height: 1.55;
}

@media (max-width: 860px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .grid,
  .stats-strip,
  .result-summary {
    grid-template-columns: 1fr;
  }

  .category-grid,
  .exam-layout {
    grid-template-columns: 1fr;
  }

  .exam-status {
    top: 0;
  }

  .number-list {
    grid-template-columns: repeat(10, 1fr);
  }
}

@media (max-width: 540px) {
  .container,
  .topbar-inner {
    width: min(100% - 20px, 1180px);
  }

  .brand h1 {
    font-size: 0.98rem;
  }

  .nav-actions,
  .nav-actions .btn,
  .category-card {
    width: 100%;
  }

  .category-card {
    grid-template-columns: 1fr;
  }

  .number-list {
    grid-template-columns: repeat(5, 1fr);
  }

  .question-head,
  .exam-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
