/* =========================================================
   짝꿍 플래너 — Design System
   ========================================================= */
@font-face {
  font-family: "Pretendard Variable";
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/PretendardVariable.woff2") format("woff2-variations");
}

:root {
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f3f4fa;
  --surface-3: #eceef7;
  --line: #e3e6f0;
  --line-strong: #cfd4e3;
  --text: #191d2c;
  --text-2: #444b61;
  --muted: #7a8199;
  --primary: #5b5bf0;
  --primary-2: #4747d6;
  --primary-weak: #eef0ff;
  --primary-ink: #3a3ab8;
  --boy: #2f7cf6;
  --boy-bg: #e9f2ff;
  --boy-line: #bcd5ff;
  --girl: #ec4d8b;
  --girl-bg: #ffedf4;
  --girl-line: #ffc6dc;
  --any-bg: #f4f5f9;
  --leader: #f59f0b;
  --leader-bg: #fff6e0;
  --ok: #16a34a;
  --ok-bg: #e8f8ee;
  --warn: #d97706;
  --warn-bg: #fff5e1;
  --danger: #e5484d;
  --danger-bg: #ffecec;
  --shadow-sm: 0 1px 2px rgba(20, 24, 48, .06);
  --shadow: 0 1px 2px rgba(20, 24, 48, .05), 0 4px 14px rgba(20, 24, 48, .06);
  --shadow-lg: 0 12px 40px rgba(20, 24, 48, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: 248px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f1220;
  --surface: #171b2c;
  --surface-2: #1d2236;
  --surface-3: #252b42;
  --line: #2a3049;
  --line-strong: #39405e;
  --text: #eceef8;
  --text-2: #c3c8dc;
  --muted: #8b92ad;
  --primary: #7b7bff;
  --primary-2: #9494ff;
  --primary-weak: #26285a;
  --primary-ink: #c4c4ff;
  --boy: #5d9bff;
  --boy-bg: #1a2a4a;
  --boy-line: #2c4677;
  --girl: #ff73a8;
  --girl-bg: #3d1c2e;
  --girl-line: #6a2c4a;
  --any-bg: #1f2438;
  --leader: #fbbf24;
  --leader-bg: #3a2e10;
  --ok: #34d17a;
  --ok-bg: #12301f;
  --warn: #fbbf24;
  --warn-bg: #352a10;
  --danger: #ff6b70;
  --danger-bg: #3a1618;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--primary); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.fill { fill: currentColor; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- App shell ---------- */
#app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
#sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 14px 14px;
  gap: 14px;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 4px; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6d6dff 0%, #a35cff 55%, #ff6fa6 100%); box-shadow: 0 6px 16px rgba(91, 91, 240, .35); }
.brand-logo svg { width: 22px; height: 22px; }
.brand b { display: block; font-size: 16px; font-weight: 800; letter-spacing: -0.03em; }
.brand small { display: block; color: var(--muted); font-size: 11.5px; margin-top: -2px; }

.class-switch { position: relative; }
.class-switch select {
  width: 100%; appearance: none; -webkit-appearance: none;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 10px; padding: 9px 34px 9px 12px; font-weight: 700; cursor: pointer;
}
.class-switch .i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
.nav-label { font-size: 11px; font-weight: 700; color: var(--muted); padding: 12px 10px 4px; letter-spacing: .02em; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: transparent; padding: 9px 10px; border-radius: 10px;
  color: var(--text-2); font-weight: 600; cursor: pointer; text-align: left;
  transition: background .15s, color .15s;
}
.nav button:hover { background: var(--surface-2); color: var(--text); }
.nav button.on { background: var(--primary-weak); color: var(--primary-ink); }
.nav button.on .i { color: var(--primary); }
.nav button .tag { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface-3); border-radius: 99px; padding: 1px 7px; }
.nav button.on .tag { background: var(--surface); color: var(--primary-ink); }

.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.save-state { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 0 6px; }
.save-state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.save-state.saving .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.side-tools { display: flex; gap: 6px; }
.side-tools .btn { flex: 1; }

#main { min-width: 0; }
#page { max-width: 1440px; margin: 0 auto; padding: 28px 32px 60px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.035em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 650; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .i { width: 17px; height: 17px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(91, 91, 240, .28); }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn-soft { background: var(--primary-weak); border-color: transparent; color: var(--primary-ink); box-shadow: none; }
.btn-soft:hover { background: var(--primary-weak); filter: brightness(.97); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger-bg); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 4px; }
.btn-xs .i { width: 14px; height: 14px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15.5px; border-radius: 12px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-xs.btn-icon { width: 26px; }
.btn-block { width: 100%; }

/* ---------- Cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.card-head h3 { margin: 0; font-size: 15.5px; font-weight: 750; display: flex; align-items: center; gap: 8px; }
.card-head h3 .i { color: var(--primary); }
.card-head .sub { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.card-body { padding: 16px 18px 18px; }
.card-head:last-child { padding-bottom: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.split.left { grid-template-columns: 360px minmax(0, 1fr); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 750; }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.sticky { position: sticky; top: 20px; }
.hide { display: none !important; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.input, .select, textarea.input {
  height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  padding: 0 12px; outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }
.select { appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237a8199' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.input-sm, .select.input-sm { height: 32px; font-size: 13px; border-radius: 8px; }
.num { width: 76px; text-align: center; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper button { width: 32px; height: 34px; border: 0; background: var(--surface-2); cursor: pointer; font-size: 16px; font-weight: 700; color: var(--text-2); }
.stepper button:hover { background: var(--surface-3); }
.stepper span { min-width: 40px; text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; padding: 8px 0; }
.switch .txt b { display: block; font-weight: 650; font-size: 13.5px; }
.switch .txt small { display: block; color: var(--muted); font-size: 12px; }
.switch input { display: none; }
.switch .tg { width: 40px; height: 23px; border-radius: 99px; background: var(--line-strong); position: relative; flex: none; transition: background .2s; }
.switch .tg::after { content: ""; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + .tg { background: var(--primary); }
.switch input:checked + .tg::after { transform: translateX(17px); }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: nowrap; }
.seg.wrap { flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; white-space: nowrap; border-radius: 8px; font-weight: 650; color: var(--muted); cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg.block { display: flex; }
.seg.block button { flex: 1; justify-content: center; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs button.on { color: var(--primary-ink); border-bottom-color: var(--primary); }
.tabs button:hover { color: var(--text); }

/* ---------- Chips & badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.boy { background: var(--boy-bg); color: var(--boy); }
.badge.girl { background: var(--girl-bg); color: var(--girl); }
.badge.leader { background: var(--leader-bg); color: var(--leader); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.primary { background: var(--primary-weak); color: var(--primary-ink); }
.badge .i { width: 12px; height: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 6px;
  border-radius: 9px; background: var(--surface); border: 1px solid var(--line);
  font-weight: 650; font-size: 13px; cursor: grab; user-select: none; touch-action: none;
  box-shadow: var(--shadow-sm); transition: transform .1s, box-shadow .15s;
}
.chip:hover { box-shadow: var(--shadow); }
.chip .no { min-width: 22px; height: 20px; border-radius: 6px; font-size: 11px; display: grid; place-items: center; font-weight: 800; padding: 0 4px; }
.chip.M .no { background: var(--boy-bg); color: var(--boy); }
.chip.F .no { background: var(--girl-bg); color: var(--girl); }
.chip .star { color: var(--leader); }
.chip .star .i { width: 13px; height: 13px; fill: currentColor; }
.chip.sel { outline: 2px solid var(--primary); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.gender-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.gender-dot.M { background: var(--boy); }
.gender-dot.F { background: var(--girl); }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }
.table .input { height: 32px; border-color: transparent; background: transparent; padding: 0 8px; }
.table .input:hover { border-color: var(--line); }
.table .input:focus { background: var(--surface); }
.table td.c, .table th.c { text-align: center; }

/* ---------- Stats ---------- */
.stat { padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 12.5px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ill { width: 64px; height: 64px; border-radius: 18px; background: var(--primary-weak); color: var(--primary); display: grid; place-items: center; margin: 0 auto 14px; }
.empty .ill .i { width: 30px; height: 30px; }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 17px; }
.empty p { margin: 0 0 16px; }

/* ---------- Home ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 28px 30px; color: #fff;
  background: radial-gradient(1200px 300px at 100% 0%, rgba(255, 140, 190, .55), transparent 60%), linear-gradient(120deg, #5b5bf0 0%, #8a5cf6 60%, #c063e6 100%);
  box-shadow: 0 18px 40px rgba(91, 91, 240, .28);
}
.hero h2 { margin: 0; font-size: 25px; font-weight: 800; letter-spacing: -0.03em; }
.hero p { margin: 6px 0 0; opacity: .9; }
.hero .actions { margin-top: 18px; }
.hero .btn { border-color: rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .16); color: #fff; box-shadow: none; backdrop-filter: blur(4px); }
.hero .btn:hover { background: rgba(255, 255, 255, .26); }
.hero .btn.white { background: #fff; color: #3a3ab8; border-color: #fff; }
.hero-deco { position: absolute; right: 26px; bottom: -14px; display: grid; grid-template-columns: repeat(4, 34px); gap: 7px; opacity: .3; transform: rotate(-8deg); }
.hero-deco i { height: 26px; border-radius: 7px; background: #fff; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.step { padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; text-align: left; }
.step:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.step .n { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; background: var(--primary-weak); color: var(--primary-ink); margin-bottom: 10px; }
.step.done .n { background: var(--ok-bg); color: var(--ok); }
.step b { display: block; font-size: 14px; }
.step small { color: var(--muted); }

/* ---------- Classroom ---------- */
.room { --seat-max: 118px; --seat-min: 62px; --grp-pad: 0px; --seat-w: 108px; --seat-h: 62px; --aisle: 26px; --rowgap: 12px; container-type: inline-size; display: flex; flex-direction: column; align-items: stretch; gap: 18px; padding: 22px 14px 26px; overflow-x: auto; }
.room > * { margin-inline: auto; }
.room.has-grp { --grp-pad: 18px; }
.room-grid { --seat-w: clamp(var(--seat-min), calc((100cqw - 4px - (var(--segs, 3) - 1) * var(--aisle) - var(--segs, 3) * var(--grp-pad)) / var(--cols, 6) - 4px), var(--seat-max)); width: max-content; }
.room .board { width: min(520px, 80%); height: 34px; border-radius: 9px; background: linear-gradient(180deg, #2e5e4e, #23493c); color: #d9efe5; display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: .3em; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.room .teacher-desk { width: 120px; height: 26px; border-radius: 8px; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; margin-top: -8px; }
.room-grid { display: flex; gap: var(--aisle); align-items: flex-start; }
.room .seg-col { display: flex; flex-direction: column; gap: var(--rowgap); }
.room .grp { display: flex; flex-direction: column; gap: 6px; padding: 7px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--line-strong); position: relative; }
.room .grp-tag { position: absolute; top: -9px; left: 10px; font-size: 10.5px; font-weight: 800; color: var(--muted); background: var(--surface); padding: 0 6px; border-radius: 6px; border: 1px solid var(--line); }
.room .desk { display: flex; gap: 4px; }
.room.flip { flex-direction: column-reverse; }
.room.flip .room-grid { flex-direction: row-reverse; }
.room.flip .seg-col, .room.flip .grp { flex-direction: column-reverse; }
.room.flip .desk { flex-direction: row-reverse; }
.room.flip .teacher-desk { margin-top: 0; margin-bottom: -8px; }
.room-legend { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.room-legend span { display: inline-flex; align-items: center; gap: 6px; }

.seat {
  width: var(--seat-w); height: var(--seat-h); border-radius: 12px; position: relative;
  background: var(--surface); border: 1.5px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  user-select: none; touch-action: none; cursor: pointer;
  transition: transform .12s, box-shadow .15s, border-color .15s, background .2s;
  box-shadow: 0 1px 0 var(--line), var(--shadow-sm);
}
.seat:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.seat .nm { font-weight: 750; font-size: 15px; letter-spacing: -0.02em; line-height: 1.15; max-width: 94%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .no { font-size: 11px; font-weight: 800; color: var(--muted); }
.seat.M { background: var(--boy-bg); border-color: var(--boy-line); }
.seat.M .no { color: var(--boy); }
.seat.F { background: var(--girl-bg); border-color: var(--girl-line); }
.seat.F .no { color: var(--girl); }
.seat.vacant { background: transparent; border-style: dashed; box-shadow: none; color: var(--muted); }
.seat.vacant .nm { font-weight: 600; font-size: 12px; color: var(--muted); }
.seat.off { visibility: hidden; }
.seat .marks { position: absolute; top: 4px; right: 5px; display: flex; gap: 2px; }
.seat .marks .i { width: 12px; height: 12px; }
.seat .marks .star { color: var(--leader); fill: var(--leader); }
.seat .marks .pin { color: var(--primary); }
.seat .req { position: absolute; top: 4px; left: 6px; font-size: 10px; font-weight: 800; opacity: .75; }
.seat .req.M { color: var(--boy); }
.seat .req.F { color: var(--girl); }
.seat.sel { outline: 3px solid var(--primary); outline-offset: 2px; z-index: 2; }
.seat.warn { box-shadow: 0 0 0 2px var(--danger); }
.seat.reveal { animation: pop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.seat.shuffling .nm { filter: blur(.6px); opacity: .7; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Layout editor seats */
.room.edit .seat { cursor: crosshair; }
.room.edit .seat .nm { font-size: 13px; color: var(--text-2); }
.room.edit .seat.need-M { background: var(--boy-bg); border-color: var(--boy); border-style: solid; }
.room.edit .seat.need-F { background: var(--girl-bg); border-color: var(--girl); border-style: solid; }
.room.edit .seat.off { visibility: visible; background: repeating-linear-gradient(45deg, transparent 0 6px, var(--surface-3) 6px 12px); border-style: dashed; box-shadow: none; opacity: .7; }
.room.edit .seat.off .nm { color: var(--muted); }
.room.pick .seat { cursor: pointer; }
.room.pick .seat.picked { outline: 3px solid var(--primary); outline-offset: 2px; background: var(--primary-weak); }

/* Size variants */
.room.compact { --seat-max: 92px; --seat-min: 52px; --seat-h: 50px; --aisle: 18px; --rowgap: 8px; padding: 14px 10px 18px; gap: 12px; }
.room.compact .seat .nm { font-size: 13px; }
.room.mini { --seat-max: 54px; --seat-min: 34px; --seat-h: 28px; --aisle: 9px; --rowgap: 4px; padding: 8px 4px 10px; gap: 8px; }
.room.mini.has-grp { --grp-pad: 8px; }
.room.mini .seat { border-radius: 6px; border-width: 1px; }
.room.mini .seat .nm { font-size: 10.5px; font-weight: 700; }
.room.mini .seat .no, .room.mini .seat .marks, .room.mini .seat .req { display: none; }
.room.mini .board { height: 14px; font-size: 8px; letter-spacing: .2em; border-radius: 4px; }
.room.mini .teacher-desk, .room.mini .grp-tag { display: none; }
.room.mini .grp { padding: 3px; gap: 3px; border-radius: 7px; }
.room.mini .desk { gap: 2px; }
.room.big { --seat-max: 150px; --seat-h: 78px; --aisle: 34px; --rowgap: 16px; }
.room.big .seat .nm { font-size: 20px; }

/* ---------- Bus ---------- */
.bus-list { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.bus { --bs-w: 70px; --bs-h: 44px; width: max-content; max-width: 100%; overflow-x: auto; background: var(--surface); border: 2px solid var(--line-strong); border-radius: 30px 30px 16px 16px; padding: 16px 14px 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: var(--shadow); }
.bus-front { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 0 6px 8px; border-bottom: 2px dashed var(--line); margin-bottom: 6px; font-size: 12px; color: var(--muted); font-weight: 700; }
.bus-front .wheel { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line-strong); display: grid; place-items: center; font-size: 10px; }
.bus-row { display: flex; gap: 4px; align-items: center; }
.bus-row .aisle { width: 18px; text-align: center; font-size: 10px; color: var(--muted); }
.bus-row .rn { width: 16px; font-size: 10px; color: var(--muted); text-align: right; margin-right: 2px; }
.bus .seat { width: var(--bs-w); height: var(--bs-h); border-radius: 10px; }
.bus .seat .nm { font-size: 13px; }
.bus .seat.reserved { background: var(--surface-3); border-style: solid; color: var(--muted); }
.bus .seat.reserved .nm { font-size: 11px; color: var(--muted); }
.bus-title { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; margin-bottom: 4px; }
.bus-title b { font-size: 16px; }

/* ---------- Teams / Boards ---------- */
.board-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; align-items: start; }
.team { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 120px; transition: border-color .15s, box-shadow .15s; }
.team-head { display: flex; align-items: center; gap: 8px; padding: 11px 12px 9px; border-bottom: 1px solid var(--line); }
.team-head .dot { width: 10px; height: 10px; border-radius: 4px; flex: none; }
.team-head input { border: 0; background: transparent; font-weight: 800; font-size: 14.5px; width: 100%; outline: none; padding: 2px 4px; border-radius: 6px; }
.team-head input:focus { background: var(--surface-2); }
.team-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.team-body .chip { width: 100%; justify-content: flex-start; }
.team-body .chip .lead-btn { margin-left: auto; border: 0; background: transparent; color: var(--line-strong); cursor: pointer; padding: 2px; display: grid; }
.team-body .chip .lead-btn.on { color: var(--leader); }
.team-body .chip .lead-btn .i { width: 15px; height: 15px; }
.team-body .chip .lead-btn.on .i { fill: currentColor; }
.team-foot { padding: 8px 12px; border-top: 1px solid var(--line); display: flex; gap: 6px; flex-wrap: wrap; }
.pool { background: var(--surface-2); border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 12px; min-height: 64px; }
.drop-on { outline: 2.5px solid var(--primary) !important; outline-offset: 2px; background-color: var(--primary-weak) !important; }

/* Roles */
.role-card .team-head .emo { font-size: 20px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); flex: none; }
.role-card .cap { margin-left: auto; font-size: 12px; font-weight: 750; color: var(--muted); white-space: nowrap; }
.role-card .cap.full { color: var(--ok); }
.role-card .cap.over { color: var(--danger); }
.role-card .slot-empty { height: 32px; border: 1.5px dashed var(--line); border-radius: 9px; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.emoji-input { width: 44px; text-align: center; font-size: 18px; padding: 0; }

/* ---------- Plan ---------- */
.month-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.month-picker button { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 750; cursor: pointer; color: var(--muted); }
.month-picker button.on { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(91, 91, 240, .3); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.month-card { overflow: hidden; }
.month-card .card-head { padding-bottom: 6px; }
.month-card .mh { display: flex; align-items: center; gap: 8px; }
.month-card .mh .mn { width: 36px; height: 36px; border-radius: 11px; background: var(--primary-weak); color: var(--primary-ink); font-weight: 850; display: grid; place-items: center; font-size: 15px; }
.month-card.locked .mh .mn { background: var(--leader-bg); color: var(--leader); }
.month-card .room { cursor: zoom-in; }
.progress { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), #b25cf6); transition: width .2s; border-radius: 99px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 650; }
.kpi .v { font-size: 22px; font-weight: 850; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi .v.good { color: var(--ok); }
.kpi .v.bad { color: var(--danger); }
.kpi .d { font-size: 11.5px; color: var(--muted); }
.bands { display: flex; gap: 2px; }
.bands i { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-style: normal; font-size: 10.5px; font-weight: 800; }
.heat { display: grid; gap: 1px; font-size: 9px; }
.heat .hc { width: 15px; height: 15px; border-radius: 3px; background: var(--surface-3); }
.heat .hl { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; display: flex; align-items: center; justify-content: flex-end; padding-right: 4px; }
.heat .hl.top { writing-mode: vertical-rl; transform: rotate(180deg); justify-content: flex-start; padding: 0 0 4px; height: 52px; }

/* ---------- Teacher ---------- */
.lock-screen { max-width: 420px; margin: 60px auto; text-align: center; }
.lock-screen .ill { width: 72px; height: 72px; border-radius: 22px; background: var(--primary-weak); color: var(--primary); display: grid; place-items: center; margin: 0 auto 16px; }
.lock-screen .ill .i { width: 34px; height: 34px; }
.pin-input { font-size: 26px; letter-spacing: .5em; text-align: center; height: 56px; width: 220px; font-weight: 800; }
.rule-list { display: flex; flex-direction: column; gap: 8px; }
.rule { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.rule .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.rule .ico.sep { background: var(--danger-bg); color: var(--danger); }
.rule .ico.tog { background: var(--ok-bg); color: var(--ok); }
.rule .ico.fix { background: var(--primary-weak); color: var(--primary); }
.rule .ico.zone { background: var(--warn-bg); color: var(--warn); }
.rule .ico .i { width: 16px; height: 16px; }
.rule .txt { flex: 1; min-width: 0; }
.rule .txt b { font-weight: 700; }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--primary-weak); color: var(--primary-ink); font-size: 13px; }
.callout .i { flex: none; margin-top: 1px; }
.callout.warn { background: var(--warn-bg); color: var(--warn); }
.callout.ok { background: var(--ok-bg); color: var(--ok); }
.callout.danger { background: var(--danger-bg); color: var(--danger); }

/* ---------- Modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 18, 32, .45); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: rise .2s cubic-bezier(.2, .9, .3, 1.1); border: 1px solid var(--line); }
.modal.wide { width: min(980px, 100%); }
.modal.mid { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 800; }
.modal-body { padding: 10px 20px 16px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; pointer-events: none; }
.toast { background: #1d2135; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; display: flex; gap: 8px; align-items: center; animation: rise .2s ease; font-size: 13.5px; }
.toast.ok .i { color: #4ade80; }
.toast.err .i { color: #ff8a8a; }

/* ---------- Drag & drop ---------- */
.dnd-ghost { position: fixed; pointer-events: none; z-index: 300; opacity: .92; transform: rotate(-3deg) scale(1.04); box-shadow: var(--shadow-lg) !important; }
.dnd-src { opacity: .35; }
body.dragging, body.dragging * { cursor: grabbing !important; }

/* ---------- Presentation mode ---------- */
body.present #sidebar { display: none; }
body.present #app { grid-template-columns: 1fr; }
body.present .no-present { display: none !important; }
body.present #page { max-width: none; padding: 18px; }
body.present .present-only { display: flex !important; }
body.present .split { grid-template-columns: minmax(0, 1fr); }
body.present .room-legend { display: none; }
.present-only { display: none !important; }
.present-bar { position: fixed; top: 14px; right: 16px; z-index: 50; gap: 8px; }
body.present .room { --seat-max: 190px; --seat-min: 70px; --seat-h: clamp(56px, 8vh, 100px); --aisle: clamp(20px, 2.6vw, 46px); --rowgap: clamp(8px, 1.6vh, 18px); }
body.present .room .seat .nm { font-size: clamp(15px, 1.7vw, 26px); }
body.present .room .board { height: 46px; font-size: 18px; }
.present-title { text-align: center; font-size: 28px; font-weight: 850; letter-spacing: -0.03em; margin: 4px 0 0; }

/* ---------- Misc ---------- */
.kbd { font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface-2); }
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); }
.list-item + .list-item { margin-top: 8px; }
.list-item .meta { flex: 1; min-width: 0; }
.list-item .meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta small { color: var(--muted); }
.scroll-y { max-height: 420px; overflow-y: auto; }
.result-summary { display: flex; gap: 6px; flex-wrap: wrap; }
.help { color: var(--muted); font-size: 12px; margin: 2px 0 0; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: 14px; padding: 22px; text-align: center; color: var(--muted); }
.legend-sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1.5px solid; }
.legend-sw.M { background: var(--boy-bg); border-color: var(--boy); }
.legend-sw.F { background: var(--girl-bg); border-color: var(--girl); }
.legend-sw.A { background: var(--surface); border-color: var(--line-strong); }
.legend-sw.X { background: repeating-linear-gradient(45deg, transparent 0 3px, var(--line-strong) 3px 5px); border-color: var(--line-strong); border-style: dashed; }
.brush { display: flex; gap: 6px; flex-wrap: wrap; }
.brush button { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; font-size: 13px; }
.brush button.on { border-color: var(--primary); background: var(--primary-weak); color: var(--primary-ink); }
.color-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .split, .split.left { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  #sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 8px; border-right: 0; border-top: 1px solid var(--line); }
  #sidebar .brand, #sidebar .class-switch, #sidebar .side-foot, .nav-label { display: none; }
  .nav { flex-direction: row; overflow-x: auto; margin: 0; }
  .nav button { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 6px 8px; min-width: 62px; align-items: center; }
  .nav button .tag { display: none; }
  #page { padding: 18px 14px 96px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 22px; }
  .room { --seat-min: 52px; --seat-h: 48px; --aisle: 12px; }
  .room .seat .nm { font-size: 12.5px; }
}

/* ---------- Print ---------- */
#print-root { display: none; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff !important; color: #000; }
  :root { --bg: #fff; --surface: #fff; --surface-2: #f4f4f6; --surface-3: #ececf0; --line: #cfd2da; --line-strong: #b8bcc8; --text: #000; --muted: #555; --boy-bg: #eaf2ff; --girl-bg: #ffeef4; }
  #app, #modal-root, #toast-root { display: none !important; }
  #print-root { display: block; }
  .print-page { page-break-after: always; break-after: page; }
  .print-page:last-child { page-break-after: auto; break-after: auto; }
  .print-page h1 { font-size: 22px; margin: 0 0 4px; text-align: center; }
  .print-page .pmeta { text-align: center; color: #555; font-size: 12px; margin-bottom: 8px; }
  .seat, .chip, .team, .card, .bus { box-shadow: none !important; }
  .seat.M, .seat.F, .chip, .bands i, .heat .hc, .badge, .team-head .dot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .room .board { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .room { overflow: visible; }
  .print-fit .room { --seat-max: 140px; --seat-h: 66px; }
  .print-fit .room .seat .nm { font-size: 17px; }
  .print-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6mm; }
  .print-months .pm { border: 1px solid #ccc; border-radius: 8px; padding: 2mm; break-inside: avoid; }
  .print-months .pm h4 { margin: 0; text-align: center; font-size: 13px; }
  .table th { position: static; }
  .board-cols { grid-template-columns: repeat(4, 1fr); }
  .team { break-inside: avoid; }
  .bus { break-inside: avoid; }
}

/* ---------- 학생용 출력물 (안내문 · 게시용 자리표 · 개인 카드) ---------- */
.kid, .kid * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.kid { color: #1b1f2e; font-family: var(--font); }
.kid h1, .kid h2, .kid h3 { margin: 0; letter-spacing: -0.03em; }
/* 안내문 */
.ho { height: 188mm; display: flex; flex-direction: column; gap: 4mm; }
.ho-head { border-radius: 5mm; padding: 5mm 7mm; color: #fff; background: linear-gradient(120deg, #5b5bf0, #8a5cf6 60%, #c063e6); position: relative; }
.ho-head h1 { font-size: 24pt; font-weight: 850; text-align: left; }
.ho-head p { margin: 1mm 0 0; font-size: 11pt; opacity: .92; }
.ho-badge { position: absolute; right: 7mm; top: 6mm; background: #fff; color: #4747d6; font-weight: 800; border-radius: 99px; padding: 1.5mm 4mm; font-size: 11pt; }
.ho-body { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; min-height: 0; }
.ho-col { display: flex; flex-direction: column; gap: 3.5mm; min-height: 0; }
.ho-box { border: 0.4mm solid #e3e6f0; border-radius: 4mm; padding: 3.5mm 4.5mm; background: #fff; }
.ho-box h2 { font-size: 13pt; font-weight: 800; margin-bottom: 2mm; }
.ho-box p { margin: 0; font-size: 10.5pt; line-height: 1.6; color: #333a4d; }
.ho-rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2mm; }
.ho-rules li { display: flex; gap: 3mm; align-items: flex-start; font-size: 10.5pt; line-height: 1.45; }
.ho-rules li i { font-style: normal; flex: none; width: 7mm; height: 7mm; border-radius: 2mm; display: grid; place-items: center; background: #eef0ff; font-size: 12pt; }
.ho-rules li b { display: block; font-size: 11pt; }
.ho-rules li span { color: #4b5268; }
.ho-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2.5mm; }
.ho-stat { border-radius: 3mm; background: #f3f4fa; padding: 2.5mm; text-align: center; }
.ho-stat b { display: block; font-size: 17pt; font-weight: 850; color: #4747d6; letter-spacing: -0.03em; }
.ho-stat span { font-size: 8.5pt; color: #5b6178; line-height: 1.3; display: block; }
.ho-note { margin-top: 2mm !important; font-size: 9.5pt !important; color: #5b6178 !important; }
.ho-promise { background: #fff8e6; border-color: #ffe2a3; }
.ho-promise ul { margin: 0; padding-left: 5mm; font-size: 10.5pt; line-height: 1.6; }
.ho-msg { border: 0.5mm dashed #b9b3ff; border-radius: 4mm; padding: 3.5mm 4.5mm; background: #f7f6ff; flex: 1; min-height: 0; }
.ho-msg b { font-size: 11pt; color: #4747d6; }
.ho-msg p { margin: 1.5mm 0 0; font-size: 11.5pt; line-height: 1.6; white-space: pre-line; }
.ho-foot { text-align: center; font-size: 10.5pt; color: #4b5268; background: #f3f4fa; border-radius: 3mm; padding: 2.5mm; }
/* 게시용 자리표 */
.post { height: 188mm; display: flex; flex-direction: column; gap: 3mm; }
.post-head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 0.6mm solid #5b5bf0; padding-bottom: 2mm; }
.post-head h1 { font-size: 22pt; font-weight: 850; text-align: left; }
.post-head h1 em { font-style: normal; color: #5b5bf0; }
.post-head span { font-size: 11pt; color: #5b6178; }
.post-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 72mm; gap: 4mm; min-height: 0; }
.post-map .room { padding: 2mm 0; --seat-h: 15mm; --seat-max: 34mm; }
.post-map .room .seat .nm { font-size: 13pt; }
.find { border: 0.4mm solid #e3e6f0; border-radius: 3mm; padding: 2.5mm 3mm; font-size: 8.8pt; line-height: 1.25; overflow: hidden; }
.find h3 { font-size: 11pt; margin-bottom: 1.5mm; }
.find-list.two { columns: 2; column-gap: 3mm; }
.fr { display: flex; gap: 1.5mm; padding: 0.45mm 0; border-bottom: 0.2mm solid #eceef5; break-inside: avoid; }
.fr .n { width: 6mm; text-align: right; color: #7a8199; font-weight: 700; }
.fr .nm { width: 15mm; font-weight: 750; white-space: nowrap; }
.fr .st { flex: 1; color: #333a4d; white-space: nowrap; }
.fr .mt { color: #7a8199; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22mm; }
/* 개인 카드 */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 5mm; }
.cards-2 .scard { height: 186mm; }
.cards-4 .scard { height: 90mm; }
.scard { border: 0.4mm dashed #9aa0b8; border-radius: 4mm; padding: 4mm; display: flex; flex-direction: column; gap: 2.5mm; overflow: hidden; break-inside: avoid; }
.sc-head { display: flex; align-items: center; gap: 3mm; }
.sc-no { width: 10mm; height: 10mm; border-radius: 3mm; display: grid; place-items: center; font-weight: 850; font-size: 13pt; color: #fff; background: #5b5bf0; flex: none; }
.sc-no.F { background: #ec4d8b; }
.sc-head .t { flex: 1; font-size: 13pt; }
.sc-head .t b { font-size: 16pt; font-weight: 850; }
.sc-head .cls { font-size: 9pt; color: #7a8199; text-align: right; }
.sc-tiles { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5mm; min-height: 0; }
.mt-tile { border: 0.3mm solid #e3e6f0; border-radius: 3mm; padding: 2mm; display: flex; flex-direction: column; gap: 1.2mm; min-height: 0; }
.mt-top { display: flex; justify-content: space-between; align-items: baseline; }
.mt-top b { font-size: 12pt; font-weight: 850; color: #4747d6; }
.mt-top span { font-size: 8.5pt; color: #5b6178; }
.mt-mate { font-size: 10pt; }
.mt-mate b { font-weight: 800; }
.micro { flex: 1; display: flex; flex-direction: column; gap: 0.8mm; min-height: 0; justify-content: center; }
.micro .mboard { height: 1.6mm; width: 55%; margin: 0 auto; border-radius: 0.6mm; background: #2e5e4e; }
.micro .mgrid { display: grid; gap: 0.5mm; }
.micro .mgrid i { height: var(--mh, 3mm); border-radius: 0.6mm; background: #e9ebf3; font-style: normal; font-size: 6.5pt; font-weight: 800; color: #fff; display: grid; place-items: center; line-height: 1; }
.micro .mgrid i.v { background: #f6f7fb; outline: 0.2mm dashed #d3d7e3; }
.micro .mgrid i.x { background: transparent; }
.micro .mgrid i.me { background: #5b5bf0; }
.micro .mgrid i.mate { background: #f59f0b; }
.micro .mgrid b { display: block; }
.sc-legend { font-size: 8.5pt; color: #5b6178; display: flex; gap: 3mm; align-items: center; flex-wrap: wrap; }
.sc-legend i { display: inline-block; width: 3.5mm; height: 2.5mm; border-radius: 0.6mm; vertical-align: middle; margin-right: 1mm; }
.sc-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.sc-table th { text-align: left; font-size: 8.5pt; color: #7a8199; border-bottom: 0.3mm solid #d3d7e3; padding: 0.8mm 1.5mm; }
.sc-table td { border-bottom: 0.2mm solid #eceef5; padding: 0.9mm 1.5mm; }
.sc-table td:first-child { font-weight: 850; color: #4747d6; width: 10mm; }
.sc-table td b { font-weight: 800; }

/* ---------- 자료 잠금 화면 ---------- */
.lockscreen { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 500px at 85% -10%, rgba(255, 140, 190, .35), transparent 60%), radial-gradient(800px 500px at -10% 110%, rgba(123, 123, 255, .35), transparent 60%), var(--bg); }
.lock-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 34px 30px 22px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.lock-card .brand-logo { width: 64px; height: 64px; border-radius: 18px; }
.lock-card .brand-logo svg { width: 36px; height: 36px; }
.lock-card h1 { margin: 4px 0 0; font-size: 22px; font-weight: 850; letter-spacing: -0.03em; }
.lock-card p { margin: 0 0 6px; color: var(--muted); }
.lock-card .input { width: 100%; height: 50px; text-align: center; font-size: 18px; letter-spacing: .12em; }
.lk-msg { min-height: 20px; font-size: 13px; color: var(--danger); font-weight: 650; }
.lk-msg.info { color: var(--muted); }
.enc-state { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.enc-state .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.enc-state .ico.on { background: var(--ok-bg); color: var(--ok); }
.enc-state .ico.off { background: var(--warn-bg); color: var(--warn); }

/* ---------- 조건 보고 · 편집기 · 우선순위 ---------- */
.issues { border: 1px solid var(--danger-bg); background: color-mix(in srgb, var(--danger-bg) 55%, transparent); border-radius: 12px; padding: 10px 12px; }
.issue { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; padding: 2px 0; }
.issue .pr { flex: none; width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; background: var(--surface); color: var(--danger); border: 1px solid var(--danger-bg); }
.ed-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.ed-bar .select { width: 150px; }
.prio { display: flex; flex-direction: column; gap: 6px; }
.prio-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); }
.prio-item .n { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 12px; background: var(--primary-weak); color: var(--primary-ink); flex: none; }
.prio-item.lock .n { background: var(--danger-bg); color: var(--danger); }
.prio-item .t { flex: 1; font-weight: 650; font-size: 13.5px; }
.prio-item .t small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.sched td.date { white-space: nowrap; font-weight: 700; }
.rot-table td, .rot-table th { white-space: nowrap; }
.rot-table td.p { font-size: 12px; }
.sc-table td.dt { color: #5b6178; font-size: 8.5pt; white-space: nowrap; }
.sc-table td:first-child { white-space: nowrap; width: 11mm; }
.sc-table.dense { font-size: 8.6pt; line-height: 1.25; }
.sc-table.dense td { padding: 0.5mm 1.2mm; }
.sc-table.dense2 { font-size: 7.4pt; line-height: 1.2; }
.sc-table.dense2 td, .sc-table.dense2 th { padding: 0.25mm 1mm; }
@media print { .rot-print .table { font-size: 7.5pt; } .rot-print .table th, .rot-print .table td { padding: 1mm 0.8mm; } .rot-print .table-wrap { border: 0; overflow: visible; } }

/* ---------- 자리 뽑기 게임 ---------- */
.game { position: fixed; inset: 0; z-index: 180; background: #151a45; color: #fff; font-family: var(--font); user-select: none; }
.game canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.game-bar { position: absolute; top: 0; left: 0; right: 0; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 16px; background: linear-gradient(180deg, rgba(10, 12, 34, .9), rgba(10, 12, 34, 0)); z-index: 2; }
.gb-title { display: flex; align-items: center; gap: 10px; font-size: 18px; min-width: 0; white-space: nowrap; }
.gb-title svg { width: 30px; height: 30px; flex: none; padding: 4px; border-radius: 9px; background: linear-gradient(135deg, #6d6dff, #a35cff 55%, #ff6fa6); }
#g-count { font-size: 14px; opacity: .8; font-variant-numeric: tabular-nums; }
.gb-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.gbtn { height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-weight: 750; cursor: pointer; white-space: nowrap; }
.gbtn:hover { background: rgba(255, 255, 255, .16); }
.gbtn.primary { background: linear-gradient(120deg, #6d6dff, #c063e6); border-color: transparent; box-shadow: 0 6px 20px rgba(140, 100, 255, .45); }
.gbtn.ok { background: #16a34a; border-color: transparent; box-shadow: 0 6px 20px rgba(22, 163, 74, .4); }
.gbtn.big { height: 54px; font-size: 19px; padding: 0 30px; border-radius: 14px; }
.seg.dark { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .15); }
.seg.dark button { color: rgba(255, 255, 255, .7); }
.seg.dark button.on { background: rgba(255, 255, 255, .22); color: #fff; box-shadow: none; }
.game-center { position: absolute; inset: 0; display: grid; place-items: center; z-index: 3; pointer-events: none; }
.game-center[hidden] { display: none; }
.gc-card { pointer-events: auto; background: rgba(22, 26, 70, .78); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, .16); border-radius: 26px; padding: 32px 44px; text-align: center; box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }
.gc-emoji { font-size: 52px; }
.gc-card h2 { margin: 6px 0 8px; font-size: 32px; font-weight: 850; letter-spacing: -0.03em; }
.gc-card p { margin: 0 0 6px; opacity: .9; font-size: 16px; line-height: 1.6; }
.gc-card .gc-sub { opacity: .65; font-size: 13.5px; margin-bottom: 18px; }
.btn-game { background: linear-gradient(120deg, #ff9f43, #ff6fa6 55%, #a35cff); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(255, 111, 166, .35); }
.btn-game:hover { filter: brightness(1.05); background: linear-gradient(120deg, #ff9f43, #ff6fa6 55%, #a35cff); border-color: transparent; }
@media (max-width: 760px) { .game-bar { height: auto; padding: 8px 10px; flex-wrap: wrap; } .gb-title b { font-size: 15px; } #g-speed { display: none; } }
.room-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
body.present .room-actions { border-top: 0; margin-top: 6px; padding-top: 4px; }
body.present .room-actions .btn-lg { height: 56px; font-size: 18px; padding: 0 28px; }

/* ---------- 교실 설계: 도구 막대 + 자리표 한 화면 ---------- */
.card.design { overflow: visible; }
.design-bar { position: sticky; top: 0; z-index: 6; background: var(--surface); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; padding: 12px 16px 10px; display: flex; flex-direction: column; gap: 9px; box-shadow: 0 6px 12px -10px rgba(20, 24, 48, .25); }
.ds-row { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.ds-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; color: var(--primary-ink); min-width: 62px; }
.ds-label .i { width: 16px; height: 16px; color: var(--primary); }
.ds-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-2); flex-wrap: wrap; }
.ds-item .stepper button { width: 28px; height: 30px; }
.ds-item .stepper span { min-width: 30px; }
.ds-item .seg button { padding: 5px 10px; font-size: 12.5px; }
.ds-sep { width: 1px; height: 24px; background: var(--line); }
.ds-status { padding-top: 9px; border-top: 1px dashed var(--line); gap: 6px 8px; }
.ds-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 99px; background: var(--surface-2); font-size: 12px; font-weight: 650; color: var(--text-2); white-space: nowrap; }
.ds-chip b { color: var(--text); font-weight: 800; }
.ds-chip.M b { color: var(--boy); }
.ds-chip.F b { color: var(--girl); }
.ds-chip.good { background: var(--ok-bg); color: var(--ok); }
.ds-chip.bad { background: var(--warn-bg); color: var(--warn); }
.ds-chip .i { width: 13px; height: 13px; }
.brush.compact button { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; }
.mini-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; font-size: 13px; }
.mini-switch input { display: none; }
.mini-switch .tg { width: 36px; height: 21px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .2s; flex: none; }
.mini-switch .tg::after { content: ""; position: absolute; left: 3px; top: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.mini-switch input:checked + .tg { background: var(--primary); }
.mini-switch input:checked + .tg::after { transform: translateX(15px); }
@media (max-width: 860px) { .ds-sep { display: none; } .design-bar { padding: 10px 12px; } }

/* ---------- 도움말 ---------- */
.help-author { display: flex; align-items: center; gap: 16px; padding: 18px 20px; flex-wrap: wrap; background: linear-gradient(120deg, var(--primary-weak), var(--surface) 70%); }
.ha-logo { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, #6d6dff, #a35cff 55%, #ff6fa6); box-shadow: 0 8px 20px rgba(91, 91, 240, .3); flex: none; }
.ha-logo svg { width: 30px; height: 30px; }
.ha-name { font-size: 19px; font-weight: 850; letter-spacing: -0.03em; display: flex; align-items: center; gap: 8px; }
.ha-by { font-size: 14px; color: var(--text-2); margin: 2px 0; }
.help-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; color: var(--text-2); }
.chip-btn:hover { border-color: var(--primary); color: var(--primary-ink); }
.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.help-sec { scroll-margin-top: 16px; }
.hs-emo { font-size: 18px; }
.help-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; line-height: 1.6; color: var(--text-2); }
.help-steps b { color: var(--text); }
.faq { border: 1px solid var(--line); border-radius: 11px; padding: 10px 14px; background: var(--surface); }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { margin: 8px 0 2px; color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
#help-faq { scroll-margin-top: 16px; }
@media (max-width: 1180px) { .help-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- 도움말: 내려받기 · 따라 해 보기 · 화면 캡처 ---------- */
.help-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: stretch; }
.help-top .help-author { align-items: flex-start; }
.dl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dl-btn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .15s, transform .1s, box-shadow .15s; }
.dl-btn:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.dl-btn .dl-e { font-size: 22px; }
.dl-btn b { display: block; font-size: 13.5px; }
.dl-btn small { display: block; font-size: 11.5px; color: var(--muted); }
.dl-btn > .i { margin-left: auto; color: var(--primary); }
.help-toc .label { margin-right: 4px; align-self: center; }
.help-h2 { font-size: 19px; font-weight: 850; letter-spacing: -0.03em; margin: 26px 0 12px; }
.guide { scroll-margin-top: 16px; }
.guide-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.guide-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.guide-steps li { display: flex; gap: 10px; font-size: 13.8px; line-height: 1.65; color: var(--text-2); }
.guide-steps li b { color: var(--text); }
.gs-n { flex: none; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-weight: 850; font-size: 12.5px; background: var(--primary); color: #fff; margin-top: 1px; }
.gs-see { border: 0; background: var(--primary-weak); color: var(--primary-ink); border-radius: 99px; padding: 1px 9px; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; vertical-align: 1px; }
.gs-see .i { width: 12px; height: 12px; }
.shot { margin: 0; cursor: zoom-in; }
.shot.big { cursor: default; }
.shot-img { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--surface-2); }
.shot-img img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.shot .pin { position: absolute; transform: translate(-50%, -50%); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 850; color: #fff; background: #ef4444; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.shot.big .pin { width: 30px; height: 30px; font-size: 15px; }
.shot figcaption { font-size: 11.5px; color: var(--muted); margin-top: 5px; display: flex; align-items: center; gap: 4px; }
.shot figcaption .i { width: 13px; height: 13px; }
.shot-row { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(220px, 1fr); gap: 18px; align-items: start; }
.shot-row.zoom { grid-template-columns: minmax(0, 2.4fr) minmax(220px, 1fr); }
.pin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pin-list li { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; }
.pin-n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 850; color: #fff; background: #ef4444; margin-top: 1px; }
.help-sec { scroll-margin-top: 16px; }
@media (max-width: 1180px) { .help-top, .guide-body, .shot-row, .shot-row.zoom { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .dl-grid { grid-template-columns: minmax(0, 1fr); } }
