:root {
  --navy: #0A3D84;
  --magenta: #C7187A;
  --magenta-soft: #FCEEF5;
  --text: #2B2A2A;
  --muted: #595656;
  --surface: #F4F6F9;
  --line: #E3E7ED;
  --radius: 12px;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.6 Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; color: var(--text); background: #fff; }
p { margin: 0; }
h1 { margin: 0 0 16px; font-size: 22px; font-weight: 700; }
h2 { margin: 0; font-size: 18px; font-weight: 700; }

.screen { max-width: 560px; margin: 0 auto; padding: 24px 20px 32px; }
.logo { display: block; height: 40px; margin-bottom: 24px; }
.info { margin: 0 0 24px; padding: 16px 16px 16px 32px; background: var(--surface); border-radius: var(--radius); color: var(--muted); }
.fields { display: grid; gap: 8px; margin-bottom: 24px; }
.fields label { font-weight: 700; }
.error { margin-top: 16px; color: #B42318; }
.academy { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); }

input { width: 100%; min-height: 52px; padding: 0 16px; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
input:focus { outline: 2px solid var(--navy); outline-offset: -1px; }

button, a.button { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; margin-top: 8px; padding: 0 16px; font: inherit; font-weight: 700; color: var(--navy); text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.primary, a.button.primary { color: #fff; background: var(--navy); border-color: var(--navy); }
button:disabled { opacity: .4; cursor: default; }

/* 풀이 화면 */
.bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; background: #fff; }
.bar button { width: 52px; margin: 0; }
.timer { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--navy); }
.timer.urgent { color: var(--magenta); }
.progress { height: 6px; overflow: hidden; background: var(--line); border-radius: 3px; }
#progress-fill { width: 0; height: 100%; background: var(--navy); transition: width .2s; }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 16px 0; }
.grid button { min-height: 48px; margin: 0; padding: 0; font-weight: 400; color: var(--text); }
.grid button.answered { background: var(--surface); border-color: var(--navy); }
.grid button.current { outline: 2px solid var(--navy); }
.passage { max-height: 45vh; margin: 16px 0; padding: 16px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.passage h2 { margin-bottom: 8px; font-size: 16px; }
.passage .body { white-space: pre-line; }
.blank { display: inline-block; min-width: 3em; padding: 0 4px; font-weight: 700; text-align: center; border-bottom: 2px solid var(--muted); }
.blank.on { color: var(--magenta); background: var(--magenta-soft); border-color: var(--magenta); }
.question { margin: 16px 0 96px; }
.stem { margin-bottom: 8px; font-weight: 700; white-space: pre-line; }
.choice { justify-content: flex-start; padding: 12px 16px; font-weight: 400; color: var(--text); text-align: left; }
.choice[aria-pressed="true"] { color: #fff; background: var(--navy); border-color: var(--navy); }
.choice[aria-pressed="true"]::after { content: " ✓"; }
.nav { position: fixed; right: 0; bottom: 0; left: 0; display: flex; gap: 8px; max-width: 560px; margin: 0 auto; padding: 12px 20px; background: #fff; border-top: 1px solid var(--line); }
.nav button { flex: 1; margin: 0; }

/* 결과 화면 */
.score { display: flex; align-items: baseline; gap: 8px; margin-bottom: 24px; color: var(--muted); }
.score strong { font-size: 40px; line-height: 1; color: var(--navy); }
.hint { margin: 4px 0 16px; color: var(--muted); }
.classes { display: grid; gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; }
.classes li { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.classes li.featured { background: var(--magenta-soft); border-color: var(--magenta); }
.class-name { font-weight: 700; }
.class-name::before { content: "★ "; color: var(--magenta); }
.class-desc { margin-top: 4px; color: var(--muted); }
.contact { margin: 24px 0; padding: 16px; background: var(--surface); border-radius: var(--radius); }
.contact p { margin-bottom: 8px; color: var(--muted); text-align: center; }

/* 관리자 */
#login { display: grid; gap: 8px; }
.wide { max-width: 960px; }
.admin-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-bar button, .filters button { width: auto; margin: 0; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin: 16px 0; }
.filters label { display: grid; gap: 4px; }
.filters input { width: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { background: var(--surface); }

/* 관리자 수정 화면 */
.tabs { display: flex; gap: 8px; margin: 16px 0; overflow-x: auto; }
.tabs button { width: auto; margin: 0; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: #fff; background: var(--navy); border-color: var(--navy); }
.notice { margin-bottom: 16px; padding: 12px 16px; color: var(--magenta); background: var(--magenta-soft); border-radius: var(--radius); }
.card { margin-bottom: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.card h2 { margin-bottom: 8px; }
.field { display: grid; gap: 4px; margin-top: 8px; font-weight: 700; }
.field input, .field textarea, .field select { font-weight: 400; }
textarea, select { width: 100%; padding: 12px 16px; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
select { min-height: 52px; }
textarea { resize: vertical; }
.rows { display: grid; gap: 8px; margin: 8px 0; }
.row { display: grid; grid-template-columns: 2fr 3fr auto auto auto; gap: 8px; align-items: center; }
.row button { width: auto; min-height: 44px; margin: 0; padding: 0 12px; }
.status { margin-top: 8px; color: var(--muted); }
.status.error { color: #B42318; }
@media (max-width: 600px) {
  .row { grid-template-columns: 1fr 1fr 1fr; }
  .row input { grid-column: 1 / -1; }
}
