/* 한 화면에 할 일 하나. 색은 하나만 강조하고, 설명은 줄이고, 여백으로 나눈다. */
:root {
  --bg: #f6f6f8; --panel: #fff; --ink: #14151a; --muted: #6c7280; --line: #e7e8ec; --soft: #f1f2f5;
  --accent-base: #4f46e5; --accent: var(--accent-base); --accent-ink: #fff; --accent-soft: color-mix(in srgb, var(--accent) 9%, transparent);
  --ok: #15803d; --no: #c62828; --warn: #b45309;
  --radius: 16px; --r-sm: 10px; --tap: 44px;
  --shadow: 0 1px 2px rgba(16, 18, 27, .04), 0 6px 20px rgba(16, 18, 27, .04);
}
/* 어두운 화면: 기기 설정을 따르되, 설정에서 밝게·어둡게를 고르면 그쪽이 이긴다. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) { --bg: #0e0f13; --panel: #17181d; --ink: #eef0f4; --muted: #9aa1ae; --line: #282b33; --soft: #1f2127;
    --accent: color-mix(in srgb, var(--accent-base) 62%, #fff); --accent-ink: #0e0f13; --ok: #4ade80; --no: #f87171; --warn: #fbbf24; --shadow: none; color-scheme: dark; }
}
:root[data-theme=dark] { --bg: #0e0f13; --panel: #17181d; --ink: #eef0f4; --muted: #9aa1ae; --line: #282b33; --soft: #1f2127;
    --accent: color-mix(in srgb, var(--accent-base) 62%, #fff); --accent-ink: #0e0f13; --ok: #4ade80; --no: #f87171; --warn: #fbbf24; --shadow: none; color-scheme: dark; }
:root[data-accent=blue] { --accent-base: #2563eb; } :root[data-accent=teal] { --accent-base: #0d9488; } :root[data-accent=green] { --accent-base: #16a34a; }
:root[data-accent=orange] { --accent-base: #ea580c; } :root[data-accent=rose] { --accent-base: #e11d48; } :root[data-accent=gray] { --accent-base: #3f4654; }
:root[data-font=s] { font-size: 15px; } :root[data-font=l] { font-size: 18px; } :root[data-font=xl] { font-size: 20px; }
:root[data-corners=square] { --radius: 6px; --r-sm: 4px; }
:root[data-density=compact] { --tap: 38px; } :root[data-density=compact] .panel { padding: .85rem 1rem; margin-bottom: .6rem; } :root[data-density=compact] .list li { padding: .45rem 0; } :root[data-density=compact] body { line-height: 1.45; }
:root[data-motion=reduce] *, :root[data-motion=reduce] *::before, :root[data-motion=reduce] *::after { animation: none !important; transition: none !important; }
:root[data-center=on] .pane.question, :root[data-center=on] .self-ans { text-align: center; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.55 system-ui, -apple-system, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  overscroll-behavior-y: none; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { letter-spacing: -.015em; line-height: 1.3; }
h1 { font-size: 1.4rem; margin: 0 0 .5rem; } h2 { font-size: 1.1rem; margin: 0 0 .5rem; } h3 { font-size: .95rem; margin: 1.25rem 0 .4rem; }
h4 { margin: .6rem 0 .3rem; font-size: .8rem; color: var(--muted); font-weight: 600; }
p { margin: .4rem 0; }
.boot, .muted { color: var(--muted); } .muted { font-size: .875rem; } .error { color: var(--no); } .boot { text-align: center; padding: 20vh 0; }
[hidden] { display: none !important; }

/* ----- 위 띠 ----- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .6rem; min-height: 52px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top) max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left)); }
.top .brand { display: inline-flex; align-items: center; gap: .45rem; color: var(--ink); font-weight: 700; letter-spacing: -.02em; white-space: nowrap; } .top .brand:hover { text-decoration: none; }
.top .brand::before { content: ""; width: 18px; height: 18px; border-radius: 6px; background: var(--accent); }
.top .crumb { flex: 1; color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .crumb:not(:empty)::before { content: "/"; margin-right: .6rem; opacity: .5; }
.top .link { color: var(--muted); font-size: .9rem; } .top .link:hover { color: var(--ink); }
.sync { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); border-radius: 99px; padding: .1rem .6rem; font-size: .78rem; font-weight: 600; white-space: nowrap; }
main { max-width: 880px; margin: 0 auto; padding: 1.25rem max(1rem, env(safe-area-inset-right)) calc(3rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }

/* ----- 판 ----- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.panel > :first-child { margin-top: 0; } .panel > :last-child { margin-bottom: 0; }
.panel.narrow { max-width: 400px; margin: 9vh auto 0; padding: 1.75rem; }
.panel.narrow h1 { font-size: 1.6rem; margin-bottom: .2rem; } .panel.narrow .primary { width: 100%; margin: .9rem 0 .6rem; } .panel.narrow > p:last-child { text-align: center; }
details.panel > summary, details > summary { cursor: pointer; font-weight: 600; }
details > summary { color: var(--muted); font-size: .9rem; min-height: 32px; } details.panel > summary { color: var(--ink); font-size: 1rem; }
details.panel[open] > summary { margin-bottom: .75rem; }

/* ----- 누르는 것·쓰는 것 ----- */
button, input, select, textarea { font: inherit; color: inherit; }
button { min-height: var(--tap); padding: 0 1rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); cursor: pointer; font-weight: 500; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s; }
button:hover:not(:disabled) { border-color: color-mix(in srgb, var(--ink) 28%, var(--line)); } button:active:not(:disabled) { transform: scale(.98); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
button.primary:hover:not(:disabled) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
button.link { border: 0; background: none; color: var(--accent); padding: 0 .3rem; min-height: var(--tap); font-weight: 500; }
button.danger { color: var(--no); border-color: color-mix(in srgb, var(--no) 40%, var(--line)); background: none; }
input[type=text], input[type=email], input[type=password], input[type=number], input:not([type]), select, textarea {
  width: 100%; min-height: var(--tap); padding: .55rem .8rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
textarea { resize: vertical; line-height: 1.5; display: block; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
select { appearance: none; -webkit-appearance: none; padding-right: 2.1rem; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236c7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center; }
.field { display: block; margin: .6rem 0; flex: 1; min-width: 140px; } .field > span { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem; }
.row { display: flex; gap: .6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; } .row.left { justify-content: flex-start; }
.row > input { flex: 1; min-width: 160px; } .row > select { width: auto; flex: 0 1 auto; } .row > h1, .row > h2 { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: .7rem 0; border-top: 1px solid var(--line); } .list li:first-child { border-top: 0; }
.list li.col { display: block; } .list li > a { font-weight: 600; color: var(--ink); flex: 1; min-width: 40%; } .list li > a:hover { color: var(--accent); text-decoration: none; }
.badge { font-size: .74rem; font-weight: 600; border-radius: 99px; padding: .12rem .55rem; color: var(--muted); background: var(--soft); white-space: nowrap; }
.badge.approved { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); } .badge.warn { color: var(--no); background: color-mix(in srgb, var(--no) 12%, transparent); }
.code { font-family: ui-monospace, monospace; font-size: 1.1rem; letter-spacing: .05em; color: var(--ink); user-select: all; }
.summary { background: var(--accent-soft); border-radius: var(--r-sm); padding: .6rem .8rem; font-size: .92rem; }
.feedback { background: color-mix(in srgb, var(--ok) 10%, transparent); border-radius: var(--r-sm); padding: .6rem .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.chip { min-height: 32px; padding: 0 .75rem; border-radius: 99px; font-size: .85rem; background: var(--soft); border-color: transparent; color: var(--ink); }

/* ----- 탭 ----- */
.tabs { display: flex; align-items: stretch; gap: .25rem; margin: -.25rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.tabs > button { border: 0; background: none; border-radius: 0; padding: 0 .85rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs > button:hover { color: var(--ink); } .tabs > button.on { color: var(--ink); border-bottom-color: var(--accent); background: none; }
.collaboration-menu { margin-left: auto; position: relative; }
.collaboration-menu > summary { list-style: none; display: flex; align-items: center; min-height: var(--tap); padding: 0 .5rem; font-size: .9rem; white-space: nowrap; } .collaboration-menu > summary::-webkit-details-marker { display: none; }
.collaboration-menu > summary::after { content: "▾"; margin-left: .3rem; font-size: .8em; } .collaboration-menu.on > summary { color: var(--ink); }
.collaboration-menu .row { position: absolute; right: 0; top: calc(100% + .25rem); z-index: 15; flex-direction: column; align-items: stretch; gap: .15rem; min-width: 9rem; padding: .35rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 18, 27, .12); }
.collaboration-menu .row button { border: 0; text-align: left; } .collaboration-menu .row button:hover { background: var(--soft); }
body.in-session .tabs { display: none; }

/* ----- 오늘의 학습 ----- */
.today-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; } .today-head h1 { margin: 0; }
.today-head select { width: auto; max-width: 100%; min-height: 36px; padding-top: .3rem; padding-bottom: .3rem; font-size: .9rem; background-color: var(--soft); border-color: transparent; border-radius: 99px; }
.counts { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1rem; }
.count { background: var(--soft); border-radius: 14px; padding: .9rem 1rem; } .count b { display: block; font-size: 2.1rem; line-height: 1.1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.count span { font-size: .85rem; color: var(--muted); } .count.zero b { color: var(--muted); opacity: .6; }
.go { display: flex; gap: .6rem; flex-wrap: wrap; } .go button { flex: 0 1 auto; min-width: 13rem; min-height: 50px; font-size: 1.02rem; }
@media (max-width: 520px) { .go button { flex: 1 1 10rem; min-width: 0; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem 1rem; margin: .5rem 0 1rem; }
.stats > div:not(.stat) { padding: .2rem 0; } .stats b { display: block; font-size: 1.5rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; } .stats span { font-size: .8rem; }
.inline-field { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .6rem 0; border-top: 1px solid var(--line); } .inline-field > span { font-size: .9rem; } .inline-field select { width: auto; }
.forecast { display: flex; gap: .35rem; align-items: flex-end; margin: .5rem 0 .25rem; }
.fc-col { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: .75rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.fc-col i { display: block; background: var(--accent); opacity: .85; border-radius: 5px; width: 100%; max-width: 44px; margin-top: 3px; } .fc-col small { margin-top: 4px; }

/* ----- 학습 한 장 ----- */
.session-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.session-head .progress { flex: 1; display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.session-head .bar { flex: 1; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; min-width: 0; } .session-head .bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .25s; }
.session-head button.ai { min-height: 36px; padding: 0 .8rem; border-color: transparent; background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.session-note { font-size: .8rem; text-align: center; margin: .75rem 0 0; min-height: 1.2em; }
.keys-hint { display: none; font-size: .78rem; text-align: center; margin: .2rem 0 0; }
@media (hover: hover) and (pointer: fine) { .keys-hint { display: block; } }
.card { position: relative; font-size: calc(1rem * var(--fs, 1)); }
.card .work { display: grid; gap: .6rem; grid-template-columns: 1fr; }
@media (min-width: 820px) { .card.arrange-side .work:has(.scratch) { grid-template-columns: 1fr 1fr; } .card.arrange-side.media-right .question { order: 2; } }
.pane { position: relative; background: #fff; color: #14151a; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; overflow: hidden; min-width: 0; box-shadow: var(--shadow); }
.card.flash .pane.question { padding: 1.75rem 1.5rem; }
.card.wb .pane { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.card.wb.tool-pen .pane, .card.wb.tool-eraser .pane { touch-action: none; cursor: crosshair; }
.pane.scratch { min-height: 40vh; border-style: dashed; box-shadow: none; } .pane.scratch.size-s { min-height: 24vh; } .pane.scratch.size-l { min-height: 68vh; }
.pane.scratch.grid { background-image: linear-gradient(#eceef2 1px, transparent 1px), linear-gradient(90deg, #eceef2 1px, transparent 1px); background-size: 24px 24px; }
.pane-label { position: absolute; top: .4rem; right: .7rem; font-size: .72rem; color: #a3a9b5; pointer-events: none; }
svg.ink { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; overflow: visible; }
.q-title { font-size: .8em; color: #6c7280; margin: 0 0 .6rem; font-weight: 600; letter-spacing: 0; }
.blk-text { white-space: pre-wrap; margin: .4rem 0; overflow-wrap: anywhere; } .pane.question > .blk-text { font-size: 1.15em; line-height: 1.6; }
.blk-img { display: block; max-width: 100%; height: auto; margin: .5rem 0; border-radius: 8px; -webkit-touch-callout: none; pointer-events: none; }
.choices { display: grid; gap: .5rem; margin-top: 1rem; }
.choice { text-align: left; white-space: normal; background: #fff; color: #14151a; border-color: #e1e3e8; padding: .7rem .9rem; height: auto; font-weight: 400; } .choice b { color: #6c7280; margin-right: .35rem; }
.choice.picked { border-color: #4f46e5; box-shadow: inset 0 0 0 1px #4f46e5; background: #f3f2ff; } .choice.right { border-color: #15803d; box-shadow: inset 0 0 0 1px #15803d; background: #effaf2; }
.choice.wrong { border-color: #c62828; box-shadow: inset 0 0 0 1px #c62828; background: #fdf1f1; } .choice:disabled { opacity: 1; }
.short { margin-top: 1rem; background: #fff !important; color: #14151a !important; border-color: #e1e3e8 !important; }
.toolbar { position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 10; display: flex; align-items: center; gap: .25rem; margin-bottom: .5rem; width: fit-content; max-width: 100%;
  background: color-mix(in srgb, var(--panel) 90%, transparent); border: 1px solid var(--line); border-radius: 12px; padding: .2rem; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tb-inner { display: flex; gap: .15rem; flex-wrap: wrap; align-items: center; } .toolbar.folded .tb-inner { display: none; }
.tb { min-height: 34px; min-width: 34px; padding: 0 .5rem; border-color: transparent; background: none; font-size: .85rem; color: var(--muted); } .tb:hover:not(:disabled) { background: var(--soft); border-color: transparent; color: var(--ink); }
.tb.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tb.swatch { min-width: 22px; width: 22px; min-height: 22px; height: 22px; border-radius: 50%; padding: 0; margin: 0 .2rem; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); }
.tb-more { position: relative; } .tb-menu { position: absolute; left: 0; top: calc(100% + .35rem); z-index: 12; display: flex; flex-direction: column; min-width: 10rem; padding: .3rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 18, 27, .14); } .tb-menu .tb { text-align: left; min-height: 40px; color: var(--ink); }
/* 접기 버튼: 보이는 크기는 작게, 누르는 영역만 넓게 */
.tb-fold { position: relative; min-height: 16px; height: 16px; width: 28px; padding: 0; line-height: 12px; font-size: 11px; border: 0; background: none; color: var(--muted); }
.tb-fold::after { content: ""; position: absolute; inset: -14px -10px; } .toolbar.folded .tb-fold { transform: rotate(-90deg); }
.actions { display: flex; gap: .6rem; justify-content: flex-end; align-items: center; margin-top: .9rem; flex-wrap: wrap; }
.actions > button.primary { min-height: 50px; min-width: 8rem; font-size: 1.02rem; } .card.flash .actions > button.primary:only-child { flex: 1; }
.actions.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; } .actions.rate button { min-height: 54px; padding: 0 .3rem; font-weight: 650; border-color: transparent; background: var(--soft); white-space: normal; line-height: 1.2; }
.actions.rate small { font-weight: 500; font-size: .72em; }
.rate-1 { color: var(--no); background: color-mix(in srgb, var(--no) 10%, var(--panel)) !important; } .rate-2 { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--panel)) !important; }
.rate-3 { color: var(--accent); background: var(--accent-soft) !important; } .rate-4 { color: var(--ok); background: color-mix(in srgb, var(--ok) 11%, var(--panel)) !important; }
.rate button.suggested { outline: 2px solid var(--accent); outline-offset: 2px; }
.rating-pick { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .85rem; margin-right: auto; } .rating-pick select { width: auto; min-height: 36px; padding-top: .25rem; padding-bottom: .25rem; }
.due { color: var(--muted); font-size: .9rem; margin-right: auto; }
.self-try { display: block; } .my-answer { margin-bottom: .6rem; } .self-try .row button { flex: 1; min-height: 50px; }
.back { margin-top: .75rem; } .verdict { font-weight: 700; padding: .6rem .9rem; border-radius: var(--r-sm); margin-bottom: .6rem; }
.verdict.ok { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); } .verdict.no { background: color-mix(in srgb, var(--no) 12%, transparent); color: var(--no); }
.ans { font-weight: 600; }
.self-ans { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; } .self-ans > b { font-size: .78rem; color: var(--muted); font-weight: 600; } .self-ans .blk-text { font-size: 1.1em; }
details.expl { border-top: 1px solid var(--line); padding: .6rem .25rem 0; margin-top: .75rem; } details.expl > summary { color: var(--ink); font-size: .92rem; } .src { color: var(--muted); font-size: .82rem; }
.ai-grade { border-radius: var(--r-sm); padding: .6rem .9rem; margin-bottom: .6rem; background: var(--accent-soft); } .ai-grade p { margin: .25rem 0 0; }
.ai-grade.correct { background: color-mix(in srgb, var(--ok) 12%, transparent); } .ai-grade.wrong { background: color-mix(in srgb, var(--no) 11%, transparent); }
.listen { display: inline-block; margin: .2rem 0 0; font-size: .82rem; min-height: 30px; padding: 0; color: #6c7280 !important; }
.card-info { position: fixed; top: calc(64px + env(safe-area-inset-top)); right: 1rem; max-width: 60vw; z-index: 15; background: rgba(20, 21, 26, .6); color: #fff; font-size: .78rem; padding: .25rem .6rem; border-radius: 8px; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) { .card-info { animation: fade .4s ease-out; } @keyframes fade { from { opacity: 0; } } }

/* ----- AI ----- */
.panel.ai h2::before, .panel.ai h3::before { content: "✦ "; color: var(--accent); }
.panel.ai textarea { margin: .6rem 0; } .panel.ai > button.primary, .ai-go { margin-top: .6rem; } .ai-go button.primary, .panel.ai > button.primary { min-width: 10rem; }
.ai-go select { width: auto; max-width: 100%; background-color: var(--soft); border-color: transparent; }
.ai-status { font-size: .78rem; margin-top: .6rem; }
.plan-op details { margin-top: .3rem; } .plan-head { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; cursor: pointer; min-height: var(--tap); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); } .plan-head input { flex: none; width: 1.15rem; height: 1.15rem; }
.badge.op-create { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); } .badge.op-delete { color: var(--no); background: color-mix(in srgb, var(--no) 12%, transparent); }
.chat { display: flex; flex-direction: column; gap: .5rem; max-height: 45vh; overflow: auto; margin: .75rem 0; }
.msg { margin: 0; padding: .55rem .8rem; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 88%; font-size: .95rem; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; } .msg.ai { align-self: flex-start; background: var(--soft); border-bottom-left-radius: 4px; }
.quick { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }

/* ----- 편집·함께 학습 ----- */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 .8rem; }
.blocks .block-row { display: flex; gap: .5rem; align-items: flex-start; margin: .4rem 0; } .blocks textarea { flex: 1; } .thumb { max-width: 160px; max-height: 120px; border: 1px solid var(--line); border-radius: 8px; }
.expl-edit { background: var(--soft); border-radius: 12px; padding: .75rem; margin: .5rem 0; } .choice-row input[type=radio] { width: 22px; height: 22px; flex: none; min-width: 0; }
.picks { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); padding: .4rem .8rem; margin: .5rem 0; } .picks label { display: block; padding: .45rem 0; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; } @media (max-width: 760px) { .compare { grid-template-columns: 1fr; } }
.deck-list li { padding: .5rem 0; } .tpl-pick { margin: .6rem 0; }
.scroll-x { overflow-x: auto; } table.results { border-collapse: collapse; font-size: .9rem; } .results th, .results td { border-bottom: 1px solid var(--line); padding: .4rem .6rem; text-align: center; white-space: nowrap; }
.results thead th { color: var(--muted); font-weight: 600; font-size: .8rem; } .results tbody th { text-align: left; font-weight: 600; }
.cell { min-height: 34px; min-width: 40px; padding: 0 .4rem; font-weight: 700; border-color: transparent; background: var(--soft); } .cell.ok { color: var(--ok); } .cell.no { color: var(--no); } td.none { color: var(--muted); }
dialog.sheet { width: min(720px, 94vw); max-height: 88vh; border: 0; border-radius: 20px; background: var(--panel); color: var(--ink); padding: 1.25rem; box-shadow: 0 24px 80px rgba(0, 0, 0, .3); }
dialog.sheet .panel { border: 0; box-shadow: none; padding: 0; margin: 0; } dialog::backdrop { background: rgba(10, 11, 15, .5); backdrop-filter: blur(2px); }
#toasts { position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; display: grid; gap: .4rem; width: min(92vw, 440px); pointer-events: none; }
.toast { background: #1b1c22; color: #fff; padding: .65rem 1rem; border-radius: 12px; text-align: center; font-size: .92rem; box-shadow: 0 8px 28px rgba(0, 0, 0, .28); } .toast.error { background: #a11d1d; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise .18s ease-out; } @keyframes rise { from { opacity: 0; transform: translateY(6px); } } }

/* ----- 마스터 관리자 ----- */
.stat { background: var(--soft); border-radius: 12px; padding: .7rem .9rem; display: flex; flex-direction: column; gap: .1rem; } .stat strong { font-size: 1.5rem; letter-spacing: -.02em; } .stat-label { font-size: .82rem; color: var(--muted); }
table.admin { width: 100%; } table.admin th, table.admin td { text-align: left; } table.admin td.left { white-space: normal; min-width: 12rem; }
.bar-cell { min-width: 120px; } .bar-cell .bar { display: block; height: .5rem; min-width: 2px; background: var(--accent); border-radius: 4px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .9rem; margin: .5rem 0; } dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }

@media (max-width: 520px) {
  main { padding-top: 1rem; } .panel { padding: 1rem; border-radius: 14px; } .tabs > button { padding: 0 .7rem; }
  .list li > .muted { flex-basis: 100%; order: 3; margin-top: -.5rem; }
}
@media (max-width: 520px) { .tb-inner { flex-wrap: nowrap; } .tb { min-width: 30px; padding: 0 .3rem; } .tb.swatch { margin: 0 .1rem; } }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; } .switch-row > span { display: flex; flex-direction: column; gap: .15rem; }
.switch-row input { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch-row input:checked { background: var(--accent); } .switch-row input:checked::after { transform: translateX(18px); }
/* ----- 옵션 ----- */
details.opts > summary { display: flex; align-items: baseline; gap: .6rem; list-style: none; } details.opts > summary::-webkit-details-marker { display: none; }
details.opts > summary::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 1.2rem; line-height: 1; transition: transform .15s; } details.opts[open] > summary::after { transform: rotate(90deg); }
details.opts > summary .muted { font-weight: 400; } details.opts[open] > summary { margin-bottom: .25rem; }
.opt { padding: .7rem 0; border-top: 1px solid var(--line); cursor: default; } .opt b { font-weight: 500; } .opt .muted { font-size: .8rem; } label.opt { cursor: pointer; }
.opt select { width: auto; max-width: 55%; min-height: 38px; padding-top: .3rem; padding-bottom: .3rem; font-size: .92rem; }
.swatches { display: flex; gap: .45rem; flex-wrap: wrap; justify-content: flex-end; } .sw { min-height: 0; width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); }
.sw.on { box-shadow: 0 0 0 2px var(--ink); } .sw-indigo { background: #4f46e5; } .sw-blue { background: #2563eb; } .sw-teal { background: #0d9488; } .sw-green { background: #16a34a; } .sw-orange { background: #ea580c; } .sw-rose { background: #e11d48; } .sw-gray { background: #3f4654; }
.opts-foot { text-align: center; margin: 0 0 1rem; } .opts-foot .link { color: var(--muted); font-size: .88rem; }
.actions.rate.n2 { grid-template-columns: repeat(2, 1fr); } .actions.rate.n3 { grid-template-columns: repeat(3, 1fr); }
.toolbar.mini { position: static; border: 0; background: none; padding: 0; margin: -.25rem 0 .25rem auto; backdrop-filter: none; -webkit-backdrop-filter: none; } .toolbar.mini .tb-menu { left: auto; right: 0; }
.card-info { top: auto; right: auto; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: 90vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.opts > summary h2 { margin: 0; font-size: 1rem; } .screen-edit .panel { border: 0; box-shadow: none; padding: 0; margin: 1rem 0 0; background: none; } .screen-edit > .panel { border-top: 1px solid var(--line); padding-top: 1rem; border-radius: 0; }
.cloze-text { line-height: 2.1; } input.cloze { display: inline-block; width: auto; min-width: 4.5em; max-width: 100%; min-height: 34px; padding: .1rem .5rem; margin: 0 .15rem; text-align: center; background: #fff !important; color: #14151a !important; border-color: #cfd3da !important; border-style: dashed !important; }
.cloze-gap { display: inline-block; min-width: 3em; padding: 0 .5rem; margin: 0 .15rem; border-radius: 8px; text-align: center; font-weight: 650; background: #eef0f4; } .cloze-gap.ok { background: #e3f6e9; color: #15803d; } .cloze-gap.no { background: #fde9e9; color: #15803d; } .cloze-gap.no s { color: #c62828; font-weight: 400; } .cloze-gap.key { color: #4f46e5; background: #efeeff; }
.changes li { padding: .45rem 0; } .panel.talk .row { flex-wrap: nowrap; } .panel.talk h2 { margin-bottom: .6rem; } .panel.talk .list { margin-top: .75rem; }
@media (max-width: 520px) { .panel.talk .row { flex-wrap: wrap; } }
.pick-note { margin: 0 0 .1rem; font-size: .8em; color: #6c7280; }
.order { display: grid; gap: .45rem; } .order-row { display: flex; align-items: center; gap: .6rem; background: #fff; color: #14151a; border: 1px solid #e1e3e8; border-radius: var(--r-sm); padding: .45rem .5rem .45rem .8rem; }
.order-row > b { color: #6c7280; min-width: 1.2em; } .order-row > span { flex: 1; min-width: 0; overflow-wrap: anywhere; } .order-row.ok { border-color: #15803d; background: #effaf2; } .order-row.no { border-color: #c62828; background: #fdf1f1; }
.order-row .mv { min-height: 36px; min-width: 40px; padding: 0; background: #f1f2f5; border-color: transparent; color: #14151a; font-size: .8rem; }
.choice-row input[type=checkbox] { width: 22px; height: 22px; flex: none; min-width: 0; }
