:root {
  --bg: #F4F5F8; --card: #FFFFFF; --line: #E3E5EA; --line2: #EEF0F3;
  --ink: #1C1F26; --ink2: #3A3F4B; --muted: #5B6170;
  --blue: #2452C7; --blue-d: #1A3D96; --blue-l: #E8EEFC; --red: #D93036;
  --green: #1A6B47; --green-l: #E6F4EC; --yellow-l: #FFF1C9;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Noto Sans KR', system-ui, -apple-system, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--blue); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #8FB1FF; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 틀 */
.shell { min-height: 100vh; display: flex; }
.side { position: sticky; top: 0; height: 100vh; width: 210px; flex: none; padding: 22px 12px; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.brand { font-weight: 700; font-size: 17px; padding: 0 12px 18px; }
.tab { position: relative; display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px; border-radius: 10px; color: var(--ink2); text-decoration: none; font-size: 15px; border: 0; background: transparent; text-align: left; }
.tab[aria-current="page"] { background: var(--blue-l); color: var(--blue-d); font-weight: 700; }
.tab[aria-disabled="true"] { color: #9AA0AC; cursor: default; }
.tab .soon { margin-left: auto; font-size: 11px; color: #8A909C; }
.tab .badge { margin-left: auto; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.tier { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: #F7F8FA; font-size: 13px; line-height: 1.35; }
.hex { width: 26px; height: 29px; flex: none; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); display: flex; align-items: center; justify-content: center; }
.hex > i { width: 70%; height: 70%; clip-path: inherit; }
.page { flex: 1; min-width: 0; padding: clamp(14px, 3vw, 28px) clamp(12px, 3vw, 36px) 40px; display: flex; flex-direction: column; gap: 14px; max-width: 980px; }
h1 { margin: 0; font-size: 24px; }
.sub { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }

/* 과목 막대 */
.strip { padding: 8px 0 4px; }
.strip-scroll { overflow-x: auto; padding: 0 8px; scrollbar-width: thin; }
.strip-row { position: relative; display: flex; min-width: max-content; }
.strip-line { position: absolute; top: 35px; height: 4px; border-radius: 2px; }
.subj { position: relative; flex: none; width: 64px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 2px 6px; border: 0; border-radius: 10px; background: transparent; }
.subj.all { width: 88px; margin-right: 8px; border-right: 1px solid var(--line2); border-radius: 10px 0 0 10px; }
.subj[aria-pressed="true"] { background: #F0F4FE; }
.subj .num { font-size: 12px; line-height: 16px; font-weight: 700; color: var(--muted); }
.subj .node { position: relative; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.subj .dot { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid #D5D9E1; }
.subj.done .dot { background: #A9BDEB; border-color: #A9BDEB; }
.subj.now .dot { width: 22px; height: 22px; background: var(--blue); border: 0; box-shadow: 0 0 0 4px #DCE6FF; }
.subj.now .num, .subj[aria-pressed="true"] .num { color: var(--blue-d); }
.subj[aria-pressed="true"]:not(.now) .dot { outline: 3px solid var(--ink); outline-offset: 2px; }
.subj.all .dot { width: 22px; height: 22px; border-radius: 6px; border: 0; background: #E3E6EC; }
.subj.all[aria-pressed="true"] .dot { background: var(--ink); }
.subj .name { font-size: 11px; line-height: 1.3; text-align: center; word-break: keep-all; min-height: 28px; color: var(--muted); }
.subj[aria-pressed="true"] .name { color: var(--ink); font-weight: 700; }
.subj .badge { position: absolute; top: -6px; right: -12px; min-width: 18px; height: 18px; font-size: 11px; border: 2px solid #fff; }

/* 말머리 */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid #CBD0DA; background: #fff; color: var(--ink2); font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.chip[aria-pressed="true"], .chip[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: #fff; font-weight: 700; }
.tag { font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 8px; background: #EEF0F3; color: var(--ink2); }
.tag.c-질문 { background: var(--blue-l); color: var(--blue-d); }
.tag.c-잡담 { background: var(--yellow-l); color: #7A4B00; }
.tag.c-건의 { background: var(--green-l); color: var(--green); }

/* 글쓰기 */
.composer { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.radios { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.radio { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid #CBD0DA; font-size: 13px; background: #fff; }
.radio input { margin: 0; }
.radio:has(input:checked) { border-color: var(--blue); background: var(--blue-l); color: var(--blue-d); font-weight: 700; }
.plain { border: 0; padding: 0; outline-offset: 4px; background: transparent; width: 100%; }
.title-in { font-size: 16px; font-weight: 700; min-height: 32px; }
.body-in { font-size: 15px; line-height: 1.6; resize: vertical; min-height: 64px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { position: relative; width: 96px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid #D5D9E1; background: #fff; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(20, 24, 33, .7); color: #fff; display: flex; align-items: center; justify-content: center; }
.add-img { width: 72px; height: 72px; border: 2px dashed #CBD0DA; border-radius: 8px; background: #F7F8FA; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; }
.comp-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hint { flex: 1 1 180px; font-size: 12px; color: var(--muted); }
.btn { min-height: 42px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--blue); color: #fff; font-weight: 700; }
.btn:disabled { background: #C9CED8; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink2); border: 1px solid #CBD0DA; font-weight: 500; }
.composer.drag { outline: 3px dashed var(--blue); outline-offset: -6px; }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item { padding: 14px 16px; display: flex; gap: 12px; }
.unread-dot { width: 8px; height: 8px; margin-top: 8px; border-radius: 50%; flex: none; }
.unread-dot.on { background: var(--red); }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.item-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.item-title { font-size: 16px; font-weight: 700; color: var(--ink); text-decoration: none; }
.item-title:hover { text-decoration: underline; }
.item-ex { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.help { margin-left: auto; min-height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink2); font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.help[aria-pressed="true"] { border-color: var(--blue); background: var(--blue); color: #fff; }
.help:disabled { opacity: .55; cursor: default; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* 글 보기 */
.back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 10px 0 4px; border-radius: 8px; color: var(--ink2); text-decoration: none; font-size: 14px; }
.post { padding: clamp(14px, 2.5vw, 22px); display: flex; flex-direction: column; gap: 12px; }
.post h2 { margin: 0; font-size: 21px; line-height: 1.4; }
.post .body { margin: 0; font-size: 16px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.pics { display: flex; flex-direction: column; gap: 8px; }
.pics img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }
.answers { list-style: none; margin: 0; padding: 0; }
.answer { padding: 14px 0; border-top: 1px solid var(--line2); display: flex; flex-direction: column; gap: 6px; }
.who { font-size: 13px; font-weight: 700; }
.who.op { color: #1B9AD6; }
.answer .body { font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; margin: 0; }
.link-btn { border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; padding: 4px; }

/* 입장 / 설정 */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.join { width: min(420px, 100%); padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select { min-height: 46px; border: 1px solid #CBD0DA; border-radius: 10px; padding: 0 12px; font-size: 16px; color: var(--ink); background: #fff; }
.err { color: #B42318; font-size: 14px; min-height: 20px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 15px; background: #9AA2B1; pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.switch input:checked + i { background: var(--blue); }
.switch input:checked + i::after { left: 26px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 20; max-width: 90vw; }
.lightbox { position: fixed; inset: 0; background: rgba(10, 12, 18, .85); display: flex; align-items: center; justify-content: center; z-index: 30; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* 폰 */
@media (max-width: 700px) {
  .side { position: fixed; top: auto; left: 0; right: 0; bottom: 0; height: auto; width: auto; z-index: 10; flex-direction: row; justify-content: space-around; padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .side .brand, .side-foot { display: none; }
  .tab { flex: 1; flex-direction: column; gap: 2px; font-size: 11px; min-height: 52px; justify-content: center; padding: 0; background: transparent !important; }
  .tab[aria-current="page"] { color: var(--blue-d); }
  .tab .badge { position: absolute; top: 2px; left: 56%; margin: 0; }
  .tab .soon { display: none; }
  .page { padding-bottom: 96px; }
  .edge { margin-left: -12px; margin-right: -12px; border-radius: 0; border-left: 0; border-right: 0; }
  .topbar-tier { display: inline-flex !important; }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
.topbar-tier { display: none; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
