/* OMR 답안지: 분홍 인쇄선과 사인펜 남색 */
:root {
  --bg: #f3f5f7; --paper: #fff; --ink: #172536; --muted: #596776; --line: #d5dce3;
  --accent: #bd2f61; --on-accent: #fff; --tint: #fbe9ef; --warn: #fff1c9; --warn-ink: #5a4100; --good: #17714b; --bad: #b42318;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101820; --paper: #18232e; --ink: #e8eef4; --muted: #9dacba; --line: #32414f;
    --accent: #f283a9; --on-accent: #2b0d19; --tint: #40212e; --warn: #493b16; --warn-ink: #ffe7a3; --good: #72d3a6; --bad: #ff8f84;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink); overflow-wrap: anywhere; word-break: keep-all;
  font: 16px/1.5 "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", system-ui, sans-serif;
  padding-top: env(safe-area-inset-top);
}
h1 { font-size: 26px; line-height: 1.25; margin: 0 0 16px; }
h2 { font-size: 18px; line-height: 1.35; margin: 0 0 10px; }
p { margin: 0 0 12px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, input, select { min-height: 44px; }
button { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; padding: 8px 4px; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input, select, textarea { width: 100%; min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; }
.wide { width: 100%; margin: 6px 0 12px; }
.field { display: block; min-width: 0; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.field input, .field select { display: block; margin-top: 4px; font-size: 16px; font-weight: 400; }
.suffix { display: flex; align-items: center; gap: 8px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.muted, .fine { color: var(--muted); font-size: 14px; }
.error { color: var(--bad); font-size: 14px; }
.error:empty { display: none; }
.notice { background: var(--warn); color: var(--warn-ink); padding: 12px; border-radius: 6px; margin-bottom: 14px; }
.notice button { color: var(--ink); }
.ok { color: var(--good); font-size: 14px; }
.sheet { background: var(--paper); padding: 18px; border-top: 3px solid var(--accent); margin-bottom: 16px; }
.empty { padding: 28px 0; color: var(--muted); }
.loading { padding: 80px 20px; text-align: center; }

/* 로그인 */
.auth { max-width: 460px; margin: auto; padding: 32px 16px calc(32px + env(safe-area-inset-bottom)); }
.brand h1 { margin: 10px 0 4px; }
.brand p { color: var(--muted); }
.omr { display: flex; gap: 6px; }
.omr i { width: 15px; height: 26px; border: 2px solid var(--accent); border-radius: 50%; }
.omr .on { background: var(--ink); }
.social { width: 100%; margin-bottom: 8px; font-weight: 600; }
.google { background: #fff; color: #1f1f1f; border-color: #747775; }
.kakao { background: #fee500; color: #191919; border-color: #fee500; }
.fine .link { min-height: 0; padding: 0; }
.or { text-align: center; color: var(--muted); font-size: 13px; }
.agree { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 14px; }
.agree input { width: 20px; min-height: 20px; flex: none; }
.links { display: flex; justify-content: space-between; flex-wrap: wrap; }
.guest { display: block; margin: auto; }
.code { padding: 14px 4px; border: 2px dashed var(--accent); text-align: center; font: 700 19px/1.4 ui-monospace, Consolas, monospace; user-select: all; -webkit-user-select: all; }
.policy dt { font-weight: 700; }
.policy dd { margin: 0 0 12px; color: var(--muted); }
.stepper { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stepper output { font-size: 22px; font-weight: 700; }
.names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px; }

/* 뼈대 */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px max(16px, env(safe-area-inset-left)); border-bottom: 2px solid var(--accent); background: var(--paper); }
.top span { color: var(--muted); font-size: 12px; }
.page-body { max-width: 760px; margin: auto; padding: 22px 16px calc(92px + env(safe-area-inset-bottom)); }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 2; display: flex; background: var(--paper); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; min-height: 58px; border: 0; border-radius: 0; background: none; color: var(--muted); }
.tabs [aria-current] { color: var(--accent); font-weight: 800; box-shadow: inset 0 3px var(--accent); }

/* 오늘 */
.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: var(--tint); padding: 16px; margin-bottom: 14px; }
.summary span { display: block; font-size: 13px; color: var(--muted); }
.summary strong { font-size: 22px; }
.summary progress, .summary .buttons { grid-column: 1 / -1; }
.summary .buttons { margin: 0; }
progress { width: 100%; height: 8px; accent-color: var(--accent); }
.task { background: var(--paper); border: 1px solid var(--line); margin-bottom: 12px; }
.task header { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px 8px; }
.task header div { min-width: 0; }
.task h2 { margin: 0; font-size: 16px; }
.subject { margin: 0; color: var(--accent); font-weight: 800; }
.time { flex: none; text-align: right; }
.time strong, .time span { display: block; }
.time span { color: var(--muted); font-size: 13px; }
.short { color: var(--bad); font-size: 13px; padding: 0 14px; margin: 0; }
.checks { list-style: none; margin: 0; padding: 0 14px; }
.checks label { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 6px 0; border-top: 1px dashed var(--line); cursor: pointer; }
.checks input { appearance: none; -webkit-appearance: none; flex: none; width: 21px; min-height: 34px; height: 34px; padding: 0; border: 2px solid var(--accent); border-radius: 50%; background: transparent; cursor: pointer; }
.checks input:checked { background: var(--ink); }
.checks input:checked + span, .struck { color: var(--muted); text-decoration: line-through; }
.page { color: var(--muted); font-size: 13px; white-space: nowrap; }
.task footer { display: flex; gap: 6px; padding: 8px 14px 12px; }
.task footer button { flex: 1; padding: 6px; font-size: 14px; }
.spare { display: flex; justify-content: space-between; padding: 12px 14px; border: 1px dashed var(--line); }
.slots { list-style: none; padding: 0; margin: 0; font-variant-numeric: tabular-nums; }
.slots li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.slots span { flex: 1; min-width: 0; }
.slots time { flex: none; width: 110px; }
.slots em { font-style: normal; color: var(--muted); }
.slots .rest { color: var(--muted); font-size: 13px; }

/* 달력 */
.month { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 22px; }
.dow { text-align: center; color: var(--muted); font-size: 12px; }
.day { min-height: 56px; padding: 4px 0; }
.day b, .day small { display: block; font-variant-numeric: tabular-nums; }
.day small { min-height: 16px; color: var(--muted); font-size: 11px; }
.day.done { background: var(--tint); }
.day.now b { color: var(--accent); }
.day.sel { border: 2px solid var(--accent); }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line > span { flex: none; color: var(--muted); }
.line ul { margin: 4px 0 0; padding-left: 18px; font-size: 14px; }

/* 교재·설정 */
.subject-block { padding: 14px 0; border-bottom: 1px solid var(--line); }
.subject-block header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.subject-block h2 { margin: 0; }
.book { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; margin-top: 8px; text-align: left; }
.book span { min-width: 0; }
.book strong, .book small { display: block; }
.book small { color: var(--muted); }
.page-body > .primary.wide { margin-top: 18px; }
.week { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 8px; }
.subject-row { display: flex; gap: 8px; margin-bottom: 8px; }
.subject-row button { flex: none; }

/* 창 */
dialog { width: min(600px, 100vw - 20px); max-width: none; max-height: 90vh; max-height: 90dvh; margin: auto; padding: 18px; overflow: auto; background: var(--paper); color: var(--ink); border: 0; border-top: 4px solid var(--accent); }
dialog::backdrop { background: rgb(0 0 0 / .5); }
.capture { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 10px; }
.file { position: relative; display: grid; place-items: center; min-height: 90px; border: 2px dashed var(--accent); color: var(--accent); font-weight: 700; text-align: center; }
.file input { position: absolute; inset: 0; height: 100%; opacity: 0; cursor: pointer; }
details { border-top: 1px solid var(--line); padding-bottom: 8px; }
summary { padding: 12px 0; cursor: pointer; }
textarea { margin-bottom: 8px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { margin-bottom: 8px; }
.row { display: flex; gap: 6px; }
.row [data-page] { flex: 0 0 76px; }
.row button { flex: none; padding: 4px 12px; }
.rows small { color: var(--muted); }
.rows .bad { color: var(--bad); }
.total { font-weight: 700; }
#toast { position: fixed; left: 16px; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 3; max-width: 460px; margin: auto; padding: 12px 16px; background: var(--ink); color: var(--bg); border-radius: 6px; }

@media (min-width: 760px) {
  .tabs { top: calc(62px + env(safe-area-inset-top)); bottom: auto; right: auto; width: 150px; flex-direction: column; border: 0; background: none; padding: 0 0 0 env(safe-area-inset-left); }
  .tabs [aria-current] { box-shadow: inset 4px 0 var(--accent); }
  .top { position: sticky; top: 0; z-index: 1; height: 58px; }
  .page-body { margin-left: max(150px, calc((100% - 760px) / 2)); margin-right: auto; padding: 28px 24px 48px; }
}
