:root {
  color-scheme: light;
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #1e2540;
  background: #f5f6fb;
  --ink: #1e2540;
  --muted: #59617a;
  --brand: #353eaa;
  --brand-light: #eef0ff;
  --border: #dfe3ef;
  --surface: #fff;
  --student-width: 500px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #616de0; outline-offset: 3px; }
main:focus { outline: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.22; word-break: keep-all; overflow-wrap: anywhere; }
.message:empty { display: none; }
.message { color: #a12f38; font-size: .9rem; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  width: fit-content;
}

.brand strong { display: block; font-size: 1.15rem; letter-spacing: -.05em; }
.brand small { display: block; color: var(--muted); font-size: .8rem; }

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
}

.gate {
  display: grid;
  min-height: 100svh;
  place-content: center;
  justify-items: center;
  gap: 16px;
  padding: 24px;
}

.gate-card {
  width: min(100%, 410px);
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.gate-card h1 { margin: 22px 0 8px; font-size: 1.85rem; }
.gate-card > p { color: var(--muted); }
.gate-card form { display: grid; gap: 10px; margin-top: 24px; }
.gate-card label { font-weight: 700; font-size: .9rem; }
.gate-card .message { margin-top: 14px; color: #a12f38; }
.gate-card input, .gate-card select {
  min-width: 0;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid #a9b0c7;
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface);
}

.button {
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.button:hover { background: #2a3293; }
.teacher-shell { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-self: start;
  gap: 35px;
  height: 100dvh;
  min-height: 440px;
  padding: 27px 22px 24px;
  border-right: 1px solid var(--border);
  background: #fbfcff;
}

.sidebar-menu { display: grid; gap: 5px; }
.menu-link { display: flex; align-items: center; min-height: 47px; color: var(--muted); }
.sidebar-menu .menu-link { gap: 12px; padding: 8px 13px; border-radius: 10px; font-weight: 700; }
.menu-link:hover { color: var(--brand); background: #f3f4ff; }
.menu-link[aria-current="page"] { color: var(--brand); background: var(--brand-light); }
.menu-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  font-family: sans-serif;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1;
}

.demo-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: auto 0 0 12px;
  color: var(--muted);
  font-size: .82rem;
}

.demo-label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #666fc6;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 8px clamp(20px, 4vw, 50px);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.school-name { font-size: .92rem; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.role-tag {
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
}

.quiet-button {
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: .85rem;
}

.quiet-button:hover { color: var(--brand); background: var(--brand-light); }
.app-message { padding: 10px 20px 0; }
.teacher-content { max-width: 1170px; margin: 0 auto; padding: 34px clamp(20px, 4vw, 50px) 42px; }
.teacher-content > * + * { margin-top: 26px; }
.page-heading h1 { font-size: clamp(1.9rem, 4vw, 2.65rem); letter-spacing: -.055em; }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 18px;
  background: #252d68;
  color: #fff;
}

.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 0 42%;
  background:
    linear-gradient(90deg, transparent 96%, rgba(194, 203, 255, .16) 96%),
    linear-gradient(0deg, transparent 96%, rgba(194, 203, 255, .16) 96%);
  background-size: 28px 28px;
  mask-image: linear-gradient(90deg, transparent, #000 80%);
  pointer-events: none;
}

.teacher-hero { display: grid; align-content: center; min-height: 153px; padding: 26px 32px; }
.hero-date { margin-bottom: 9px; color: #d7ddff; font-size: .88rem; font-weight: 700; }
.teacher-hero h2 { font-size: clamp(1.65rem, 3vw, 2.2rem); letter-spacing: -.04em; }
.section-title { margin: 0 0 12px; font-size: 1.15rem; letter-spacing: -.02em; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.stat-card {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 17px 20px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.stat-card:hover, .shortcut:hover { border-color: #a9b3eb; }
.stat-label, .shortcut-label { font-weight: 700; }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.stat-label .menu-icon { color: var(--brand); background: var(--brand-light); border-radius: 7px; }
.stat-card > strong { font-size: 1.7rem; letter-spacing: -.04em; }
.arrow { color: #697395; font-size: 1.4rem; line-height: 1; }
.stat-card .arrow { position: absolute; top: 22px; right: 16px; }

.teacher-updates { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; }
.panel {
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel h2 { font-size: 1.12rem; letter-spacing: -.025em; }
.view-all, .back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--brand);
  font-size: .86rem;
  font-weight: 700;
  white-space: nowrap;
}

.view-all:hover, .back-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.items { margin: 4px 0 0; padding: 0; list-style: none; }
.item { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.item:last-child { padding-bottom: 5px; }
.item h3 { font-size: .97rem; }
.item p { margin-top: 4px; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.item-tag {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f0f2fa;
  color: #484f70;
  font-size: .76rem;
  font-weight: 700;
  white-space: nowrap;
}

.item-tag[data-tone="good"] { color: #1e624d; background: #e7f5ef; }
.item-tag[data-tone="pending"] { color: #855721; background: #fcf2e0; }
.section-panel { max-width: 800px; padding: 23px 22px; }
.section-panel .items { margin-top: 16px; }
.section-description { margin-top: 7px; color: var(--muted); font-size: .92rem; }

.poll-panel { max-width: 790px; padding: 24px; }
.poll-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.poll-heading h2 { font-size: clamp(1.35rem, 4.6vw, 1.85rem); line-height: 1.32; }
.poll-heading .item-tag { margin-top: 2px; }
.poll-body { margin-top: 20px; }
.poll-body:empty { display: none; }
.poll-results { display: grid; gap: 17px; padding-top: 18px; border-top: 1px solid var(--border); }
.poll-results .section-title { margin: 0; }
.poll-result { display: grid; gap: 6px; }
.poll-result-label { display: flex; justify-content: space-between; gap: 12px; font-size: .94rem; }
.poll-result-label span { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.poll-bar { display: block; width: 100%; height: 9px; border: 0; border-radius: 100px; background: var(--brand-light); accent-color: var(--brand); }
.poll-bar::-webkit-progress-bar { border-radius: 100px; background: var(--brand-light); }
.poll-bar::-webkit-progress-value { border-radius: 100px; background: var(--brand); }
.poll-bar::-moz-progress-bar { border-radius: 100px; background: var(--brand); }
.poll-manage { min-width: 130px; margin-top: 24px; }
.poll-message { margin-top: 10px; }
.poll-form, .poll-choices { display: grid; gap: 10px; }
.poll-choices { min-width: 0; margin: 0; padding: 0; border: 0; }
.poll-choices legend { margin-bottom: 8px; padding: 0; color: var(--muted); font-size: .9rem; }
.poll-option { display: flex; align-items: center; gap: 11px; min-height: 54px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.poll-option:has(input:checked) { border-color: var(--brand); background: var(--brand-light); }
.poll-option:has(input:focus-visible) { outline: 3px solid #616de0; outline-offset: 2px; }
.poll-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.poll-form > .button { margin-top: 6px; }
.poll-receipt { padding: 13px 14px; border-radius: 10px; background: #edf8f3; color: #1e624d; }
.poll-receipt p { margin-top: 3px; }

.question-panel { max-width: 790px; padding: 24px; }
.question-form { display: grid; gap: 9px; margin-top: 16px; }
.question-form label, .notice-form label { font-size: .9rem; font-weight: 700; }
.question-form textarea, .notice-form textarea, .notice-form input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #a9b0c7;
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
}
.question-form textarea, .notice-form textarea { min-height: 128px; resize: vertical; }
.question-form .button { justify-self: start; margin-top: 3px; }
.question-feedback { margin-top: 8px; }
.question-feedback[data-tone="good"] { color: #1e624d; }
.question-list { margin: 14px 0 0; padding: 0; list-style: none; }
.question-entry { display: grid; gap: 5px; padding: 13px 0; border-top: 1px solid var(--border); }
.question-entry:last-child { padding-bottom: 0; }
.question-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.question-time { color: var(--muted); font-size: .84rem; }

.notice-manager { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; gap: 16px; }
.notice-panel { padding: 21px; }
.notice-form { display: grid; gap: 9px; margin-top: 16px; }
.notice-form label:not(:first-child) { margin-top: 4px; }
.notice-actions { display: flex; flex: 0 0 auto; align-items: center; flex-wrap: wrap; gap: 4px; }
.notice-form .notice-actions { margin-top: 4px; }
.notice-feedback { margin-top: 8px; }
.notice-feedback[data-tone="good"] { color: #1e624d; }
.notice-list { margin: 14px 0 0; padding: 0; list-style: none; }
.notice-entry { display: grid; gap: 4px; padding: 13px 0; border-top: 1px solid var(--border); }
.notice-entry:last-child { padding-bottom: 2px; }
.notice-entry-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.notice-entry-heading h3 { font-size: 1rem; }
.notice-delete { color: #a12f38; }
.notice-time { color: var(--muted); font-size: .82rem; }
.notice-text { margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.student-notices { display: grid; gap: 14px; }
.notice-push { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notice-push .button { flex: 0 0 auto; padding: 8px 12px; font-size: .86rem; }

.attendance-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; gap: 16px; }
.attendance-sidebar, .attendance-detail, .student-attendance { display: grid; gap: 14px; min-width: 0; }
.attendance-form { display: grid; gap: 14px; margin-top: 16px; }
.attendance-field { display: grid; gap: 5px; min-width: 0; font-size: .88rem; font-weight: 700; }
.attendance-field input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #a9b0c7;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 400;
}
.attendance-field small { color: var(--muted); font-size: .79rem; font-weight: 400; }
.attendance-panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.lesson-links { margin: 12px 0 0; padding: 0; list-style: none; }
.lesson-links li + li { border-top: 1px solid var(--border); }
.lesson-link { display: grid; gap: 2px; min-height: 48px; padding: 8px 10px; border-radius: 7px; }
.lesson-link:hover, .lesson-link[aria-current="true"] { background: var(--brand-light); }
.lesson-link span { color: var(--muted); font-size: .82rem; }
.lesson-link strong { overflow-wrap: anywhere; }
.qr-slot { margin-top: 15px; }
.attendance-qr { display: block; width: min(100%, 248px); height: auto; margin: 0 auto; image-rendering: pixelated; }
.qr-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 16px; }
.qr-countdown { color: var(--muted); font-size: .88rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.scan-result h2 + p { margin-top: 6px; word-break: keep-all; }
.scan-result[data-tone="good"] { border-color: #95c4b2; background: #edf8f3; }
.scan-result[data-tone="good"] h2 { color: #1e624d; }
.scan-result[data-tone="rejected"] { border-color: #e3b0b5; background: #fff3f4; }
.scan-result[data-tone="rejected"] h2 { color: #9a2436; }
.student-attendance-list .items { margin-top: 14px; }

.student-shell { max-width: var(--student-width); min-height: 100dvh; margin: 0 auto; background: #f8f9fe; }
.student-topbar { min-height: 64px; padding: 8px 19px; }
.student-topbar .brand { gap: 9px; }
.student-topbar .brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: .98rem; }
.student-content { padding: 18px 16px calc(90px + env(safe-area-inset-bottom)); }
.student-content > * + * { margin-top: 21px; }
.student-hero { min-height: 162px; padding: 25px 22px 21px; }
.student-hero h1 { font-size: clamp(1.7rem, 7vw, 2rem); letter-spacing: -.05em; }
.hero-topic { margin-top: 6px; color: #e6e9ff; font-size: .94rem; }
.student-content .page-heading h1 { font-size: 2rem; }
.student-content .panel { padding: 14px 16px 17px; }
.student-content .section-panel { padding-top: 20px; }
.student-content .poll-panel { padding: 20px 16px; }
.student-content .question-panel { padding: 20px 16px; }
.student-content .question-form .button { justify-self: stretch; }

.shortcuts {
  overflow: clip;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.shortcut {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 14px;
}

.shortcut + .shortcut { border-top: 1px solid var(--border); }
.shortcut:hover { background: #f6f7ff; }
.shortcut .menu-icon { color: var(--brand); background: var(--brand-light); border-radius: 7px; }
.shortcut-status { margin-left: auto; color: var(--muted); font-size: .88rem; font-weight: 700; }
.demo-note { color: var(--muted); text-align: center; font-size: .8rem; }

.student-menu {
  position: fixed;
  z-index: 1;
  bottom: 0;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, var(--student-width));
  padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  transform: translateX(-50%);
}

.student-menu .menu-link {
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  min-height: 54px;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 700;
}

@media (max-width: 760px) {
  .teacher-shell { display: block; }
  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    height: auto;
    min-height: 0;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-menu { grid-row: 2; grid-column: 1 / -1; display: flex; flex-wrap: wrap; }
  .sidebar-menu .menu-link { gap: 5px; min-height: 44px; padding: 6px 9px; font-size: .85rem; }
  .demo-label { margin: 0; justify-self: end; }
  .teacher-updates { grid-template-columns: 1fr; }
  .attendance-layout { grid-template-columns: 1fr; }
  .notice-manager { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
  .teacher-hero { padding-left: 22px; }
  .stats { grid-template-columns: 1fr; gap: 8px; }
  .stat-card { grid-template-columns: 1fr auto; align-items: center; padding-right: 35px; }
  .stat-card > strong { font-size: 1.2rem; }
  .stat-card .arrow { top: 50%; transform: translateY(-50%); }
  .gate-card { padding: 25px; }
}
