/* 티움 복습테스트 — 깔끔 + 고급: 크림 바탕, 진초록 하나, 옅은 선 */
:root {
  --bg: #FAF4E5;
  --card: #FFFFFF;
  --ink: #1C2420;
  --ink-2: #4A544E;
  --ink-3: #8A918C;
  --line: #EDE6D6;
  --line-strong: #DCD5C3;
  --g: #1F3A2E;          /* 티움 진초록 */
  --g-2: #2D5B44;
  --g-tint: #DEEDE6;
  --ok: #1F7A4D;   --ok-bg: #E3F3EA;
  --no: #C2412D;   --no-bg: #FBE7E2;
  --part: #2F6A9A; --part-bg: #E1EDF7;
  --warn: #9A5B00; --warn-bg: #FFF3DB;
  --kor: #B4542B;  --kor-bg: #FBE3D3;
  --eng: #2F6A9A;  --eng-bg: #DCEBF7;
  --math: #8A6A10; --math-bg: #FBF0C9;
  --r: 18px;
  --shadow: 0 1px 2px rgba(31, 58, 46, .04), 0 6px 20px rgba(31, 58, 46, .05);
  --font: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { font-size: 16px; line-height: 1.5; word-break: keep-all; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.shell { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; }
.view { padding: 20px 20px 120px; }
.shell.no-tabs .view { padding-bottom: 40px; }

/* 머리 */
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 12px 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar { display: flex; align-items: center; gap: 6px; margin: 4px 0 18px; min-height: 44px; }
.topbar h1 { font-size: 18px; font-weight: 700; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 12px; display: grid; place-items: center; margin-left: -10px; }
.back:hover { background: rgba(0,0,0,.04); }
.sub { color: var(--ink-3); font-size: 14px; }
.section-title { font-size: 15px; font-weight: 700; color: var(--ink-2); margin: 28px 4px 10px; }

/* 카드 */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid rgba(220, 213, 195, .45); padding: 20px; margin-bottom: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.hero { background: var(--g); color: #fff; border: 0; padding: 26px 24px; position: relative; overflow: hidden; }
.hero h2 { font-size: 21px; line-height: 1.4; margin: 0 0 18px; font-weight: 700; letter-spacing: -0.01em; }
.hero .btn { background: #fff; color: var(--g); }
.hero-mark { position: absolute; right: -10px; bottom: -18px; opacity: .13; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 13px 20px; font-weight: 700; font-size: 16px; background: var(--g); color: #fff; transition: transform .08s ease, opacity .15s; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.block { width: 100%; padding: 16px; font-size: 17px; }
.btn.soft { background: var(--g-tint); color: var(--g); }
.btn.ghost { background: #F4EFE3; color: var(--ink); }
.btn.danger { background: var(--no-bg); color: var(--no); }
.btn.sm { padding: 9px 14px; font-size: 14px; border-radius: 12px; }
.btn.pill { border-radius: 999px; }
.link-btn { border: 0; background: none; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; padding: 8px 4px; font-size: 14px; }
.row-btns { display: flex; gap: 8px; }
.row-btns > * { flex: 1; }

/* 목록 줄 */
.list-row { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border: 0; background: transparent; width: 100%; text-align: left; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
button.list-row:hover { background: #FCFAF4; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .name { font-weight: 700; font-size: 16px; }
.list-row .meta { color: var(--ink-3); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--ink-3); flex: none; }
.empty { text-align: center; color: var(--ink-3); padding: 34px 20px; font-size: 15px; }

/* 과목 표시 */
.subj { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 17px; flex: none; }
.subj.s-국어 { background: var(--kor-bg); color: var(--kor); }
.subj.s-영어 { background: var(--eng-bg); color: var(--eng); }
.subj.s-수학 { background: var(--math-bg); color: var(--math); }
.subj.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--g-tint); color: var(--g); display: grid; place-items: center; font-weight: 800; flex: none; }

/* 태그 */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.no { background: var(--no-bg); color: var(--no); }
.tag.part { background: var(--part-bg); color: var(--part); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.mute { background: #F1ECE0; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* 필터 */
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.filter { border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.filter.on { background: var(--g); border-color: var(--g); color: #fff; }

/* 단계 표시 */
.steps { margin-bottom: 20px; }
.steps .bar { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.steps .bar i { display: block; height: 100%; background: var(--g); border-radius: 4px; transition: width .3s; }
.steps .labels { display: flex; gap: 16px; margin-top: 8px; font-size: 14px; color: var(--ink-3); font-weight: 600; }
.steps .labels .on { color: var(--g); }

/* 입력 */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.field .hint { font-size: 13px; color: var(--ink-3); margin-top: 5px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid transparent; background: #F6F2E8; border-radius: 12px; padding: 13px 14px; font-size: 16px; outline: none; transition: border-color .15s, background .15s; }
.input:focus { border-color: var(--g-2); background: #fff; }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.55; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.seg { display: flex; background: #F4EFE3; border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 9px 4px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--g); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 문항 편집 */
.item-ed { border-top: 1px solid var(--line); padding: 16px 0 6px; }
.item-ed:first-child { border-top: 0; padding-top: 0; }
.item-ed .head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.no-badge { width: 32px; height: 32px; border-radius: 50%; background: var(--g-tint); color: var(--g); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.no-badge.ok { background: var(--ok-bg); color: var(--ok); }
.no-badge.no { background: var(--no-bg); color: var(--no); }
.no-badge.part { background: var(--part-bg); color: var(--part); }
.no-badge.warn { background: #F2A516; color: #fff; }
.icon-btn { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 10px; color: var(--ink-3); display: grid; place-items: center; }
.icon-btn:hover { background: rgba(0,0,0,.05); color: var(--ink); }

/* 점수 고리 */
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .val { position: absolute; text-align: center; line-height: 1.05; }
.ring .val b { display: block; font-weight: 800; letter-spacing: -0.03em; }
.ring .val span { color: var(--ink-3); font-weight: 600; }

/* 검토 표 */
.rv-row { border-bottom: 1px solid var(--line); }
.rv-row:last-child { border-bottom: 0; }
.rv-line { display: grid; grid-template-columns: 34px 1fr 1fr auto 52px; gap: 10px; align-items: center; padding: 14px 18px; width: 100%; border: 0; background: transparent; text-align: left; }
.rv-line .ans { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-line .key { color: var(--ink-3); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-line .pts { text-align: right; font-weight: 700; font-size: 15px; }
.rv-row.flag { background: var(--warn-bg); }
.rv-why { padding: 0 18px 12px 62px; font-size: 14px; color: var(--ink-2); margin-top: -6px; }
.rv-edit { margin: 0 14px 14px; background: #F6F2E8; border-radius: 14px; padding: 16px; }
.rv-edit .q { font-size: 14px; color: var(--ink-2); margin-bottom: 10px; }
.verdict-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.verdict-btns button { border: 1px solid var(--line-strong); background: #fff; border-radius: 12px; padding: 12px 4px; font-weight: 700; font-size: 16px; }
.verdict-btns button.on.v-O { background: var(--ok); border-color: var(--ok); color: #fff; }
.verdict-btns button.on.v-X { background: var(--no); border-color: var(--no); color: #fff; }
.verdict-btns button.on.v-P { background: var(--part); border-color: var(--part); color: #fff; }
.rv-head { display: grid; grid-template-columns: 34px 1fr 1fr auto 52px; gap: 10px; padding: 12px 18px 8px; font-size: 12px; color: var(--ink-3); font-weight: 600; }

/* 사진 */
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { width: 96px; height: 124px; border-radius: 12px; overflow: hidden; position: relative; background: #EEE8DA; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(28,36,32,.7); color: #fff; font-size: 15px; line-height: 1; }

/* 결과 */
.result { text-align: center; padding: 30px 22px 24px; }
.result .caption { color: var(--ink-3); font-size: 14px; margin: 16px 0 14px; }

/* 판독 중 */
.reading { text-align: center; padding: 50px 20px 30px; }
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 4px solid var(--g-tint); border-top-color: var(--g); animation: spin 1s linear infinite; margin: 0 auto 22px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 학생 풀기 */
.solve-q { padding: 22px 20px; }
.solve-q .qno { font-weight: 800; color: var(--g); margin-bottom: 6px; font-size: 15px; }
.solve-q .qtext { font-size: 17px; line-height: 1.6; margin-bottom: 14px; white-space: pre-wrap; }
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line-strong); background: #fff; border-radius: 14px; padding: 13px 14px; text-align: left; font-size: 16px; }
.choice .n { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-size: 14px; font-weight: 700; flex: none; color: var(--ink-2); }
.choice.on { border-color: var(--g); background: var(--g-tint); }
.choice.on .n { background: var(--g); border-color: var(--g); color: #fff; }
.choice-row { display: flex; gap: 8px; }
.choice-row .choice { flex: 1; justify-content: center; padding: 14px 0; }
.choice-row .choice .n { border: 0; width: auto; height: auto; font-size: 17px; }

/* 아래 메뉴 */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 560px; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; z-index: 10; }
.shell.no-tabs .tabbar { display: none; }
.tab { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 12px; font-weight: 600; color: var(--ink-3); text-decoration: none; }
.tab.on { color: var(--g); }
.tab svg { width: 24px; height: 24px; }

/* 알림 */
.toast { position: fixed; left: 50%; bottom: 100px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 15px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; max-width: calc(100% - 40px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 덮개 창 */
.sheet-back { position: fixed; inset: 0; background: rgba(28,36,32,.35); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 560px; border-radius: 24px 24px 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; }
.sheet h3 { margin: 0 0 6px; font-size: 19px; }
.sheet p { margin: 0 0 18px; color: var(--ink-2); font-size: 15px; }
.sheet .btn + .btn { margin-top: 8px; }

details.fold { border-radius: 14px; background: #F6F2E8; padding: 0 16px; margin: 6px 0 14px; }
details.fold summary { padding: 14px 0; font-weight: 600; cursor: pointer; color: var(--ink-2); list-style: none; display: flex; justify-content: space-between; }
details.fold summary::after { content: "+"; font-weight: 400; }
details.fold[open] summary::after { content: "−"; }
details.fold .inner { padding-bottom: 14px; font-size: 14px; color: var(--ink-2); }
details.fold ol { padding-left: 18px; margin: 0 0 10px; }

.muted { color: var(--ink-3); }
.mt { margin-top: 14px; }
.center { text-align: center; }
.big-num { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.flex { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }
.hidden { display: none !important; }

@media (min-width: 700px) {
  .view { padding-top: 32px; }
}
