:root {
  --ink: #17324D;
  --red: #D94A3A;
  --blue: #2F6F91;
  --gray-blue: #66717B;
  --pale-blue: #EEF2F4;
  --pale-blue-strong: #E3EAED;
  --paper: #FAFAFA;
  --white: #FFFFFF;
  --line: #D4DDE2;
  --focus: #F0C94B;
  --ok: #2F7A5E;
  --ok-pale: #E8F5EF;
  --warn: #C88A1A;
  --warn-pale: #FDF6DD;
  --danger-pale: #FDF1EF;
  --display: "BIZ UDPGothic", "Yu Gothic", "Hiragino Sans", sans-serif;
  --body: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.75;
}

a { color: var(--blue); text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -5rem;
  z-index: 100;
  background: var(--ink);
  color: var(--white);
  padding: .7rem 1rem;
  text-decoration: none;
  font-weight: 800;
}
.skip-link:focus { top: 1rem; }

.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1140px;
  margin: auto;
  min-height: 64px;
  padding: .7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.05rem;
}
.brand-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 40px;
  border: 2px solid var(--ink);
  border-radius: 0 0 4px 4px;
  border-top: 0;
  background: var(--pale-blue);
  position: relative;
}
.brand-mark::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 6px;
  background: var(--red);
  border-radius: 2px 2px 0 0;
}
.brand-mark span {
  font-family: var(--mono);
  font-size: .6rem;
  font-weight: 900;
  line-height: 1;
}

.site-nav {
  display: flex;
  gap: .7rem 1.2rem;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}
.site-nav a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  padding: .3rem .1rem;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--blue); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--red); }

.container { max-width: 1140px; margin: auto; padding: 0 1.25rem; }

.hero {
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.hero-inner {
  min-height: 420px;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
  padding-top: 3.5rem;
  padding-bottom: 3.5rem;
}

.eyebrow {
  margin: 0 0 .6rem;
  color: var(--red);
  font-family: var(--mono);
  font-weight: 800;
  letter-spacing: .04em;
  font-size: .85rem;
}
h1, h2, h3, h4, h5 { font-family: var(--display); line-height: 1.4; margin: 0 0 .6rem; }
h1 { max-width: 14ch; font-size: clamp(2.2rem, 5.5vw, 4.6rem); letter-spacing: -.04em; }
.page-title { max-width: 18ch; font-size: clamp(2rem, 4.5vw, 3.6rem); }
.lead { max-width: 42rem; font-size: clamp(1.05rem, 2vw, 1.25rem); margin: 0 0 1rem; }

.actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.6rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .55rem 1.1rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--white);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: #0f2438; }
.button.secondary {
  background: var(--white);
  color: var(--ink);
}
.button.secondary:hover { background: var(--pale-blue); }
.button.danger {
  background: var(--white);
  color: var(--red);
  border-color: var(--red);
}
.button.danger:hover { background: var(--danger-pale); }
.button:disabled { opacity: .55; cursor: not-allowed; }

.section { padding: clamp(3rem, 7vw, 6rem) 0; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.section-head h2, .section-head .page-title { margin: 0; font-size: clamp(1.8rem, 3.5vw, 3rem); }
.section-kicker { font-family: var(--mono); color: var(--red); font-weight: 800; font-size: .85rem; }

.desk-note {
  padding: 1.5rem 1.5rem 1.5rem 1.75rem;
  border: 1px solid var(--line);
  border-left: 6px solid var(--red);
  background: var(--white);
  position: relative;
}
.desk-note h2 { margin-top: 0; font-size: 1.25rem; }
.checklist { padding: 0; list-style: none; margin: .8rem 0 0; }
.checklist li {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: .5rem;
  margin: .5rem 0;
}
.checklist li::before { content: "□"; font-weight: 900; color: var(--gray-blue); }

.material-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.material-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  background: var(--white);
}
.material-card h3 { margin: .7rem 0 .4rem; font-size: 1.2rem; }
.material-card p { margin: .3rem 0 1rem; color: var(--gray-blue); }
.material-card .card-link { margin-top: auto; font-weight: 800; }

.meta-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag {
  display: inline-block;
  padding: .12rem .5rem;
  border: 1px solid var(--line);
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.5;
  color: var(--ink);
}
.tag.time { background: var(--pale-blue); font-family: var(--mono); border-color: var(--line); }

.lesson-clock {
  display: flex;
  height: 10px;
  margin: .6rem 0 .8rem;
  border: 1px solid var(--ink);
}
.lesson-clock span:nth-child(1) { flex: 5; background: var(--pale-blue); }
.lesson-clock span:nth-child(2) { flex: 18; background: var(--blue); }
.lesson-clock span:nth-child(3) { flex: 12; background: #86b8a5; }
.lesson-clock span:nth-child(4) { flex: 10; background: var(--red); }
.clock-key { margin: -.3rem 0 .5rem; color: var(--gray-blue); font-family: var(--mono); font-size: .7rem; }

.page-hero { padding: 2.8rem 0 2.2rem; border-bottom: 1px solid var(--line); background: var(--white); }
.breadcrumb { margin-bottom: 1rem; color: var(--gray-blue); font-size: .9rem; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 0; }
.breadcrumb li + li::before { content: "/ai-materials/"; margin-right: .4rem; }

.catalog-layout { display: grid; grid-template-columns: 260px 1fr; gap: 2rem; padding-top: 2.5rem; padding-bottom: 5rem; }
.filters { align-self: start; position: sticky; top: 1rem; padding: 1.25rem; border: 1px solid var(--line); background: var(--white); }
.filters h2 { margin-top: 0; font-size: 1.1rem; }
.field { display: grid; gap: .3rem; margin: 1rem 0 0; }
.field label, .field legend { font-weight: 800; font-size: .95rem; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  padding: .5rem .6rem;
  border: 1px solid var(--gray-blue);
  background: var(--white);
  color: var(--ink);
  border-radius: 0;
}
.field input::placeholder { color: var(--gray-blue); }
.result-status { margin: 0 0 1rem; font-weight: 800; font-size: .95rem; }
.empty-state { display: none; padding: 2rem; border: 1px dashed var(--line); background: var(--white); text-align: center; }

.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 2.5rem; padding-top: 2.5rem; padding-bottom: 5rem; }
.lesson-content h2 { margin-top: 2.5rem; padding-bottom: .4rem; border-bottom: 2px solid var(--ink); }
.lesson-content h3 { margin-top: 1.8rem; }
.lesson-aside { align-self: start; position: sticky; top: 1rem; padding: 1rem; border: 1px solid var(--line); background: var(--white); }
.lesson-aside ul { padding-left: 1.3rem; margin: .5rem 0 1rem; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin: 1.25rem 0; }
.fact { padding: .75rem; border-left: 4px solid var(--blue); background: var(--white); }
.fact dt { color: var(--gray-blue); font-size: .75rem; font-weight: 800; }
.fact dd { margin: .2rem 0 0; font-weight: 800; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 5rem 1fr; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.timeline time { font-family: var(--mono); font-weight: 900; color: var(--red); }
.callout { padding: 1rem 1.2rem; border-left: 5px solid var(--red); background: var(--danger-pale); }
.source-box { padding: 1rem 1.2rem; border: 1px solid var(--line); background: var(--pale-blue); }
.resource-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.resource-item { display: block; padding: 1rem; border: 1px solid var(--ink); background: var(--white); color: var(--ink); text-decoration: none; }
.resource-item:hover { background: var(--pale-blue); }
.resource-item strong { display: block; margin-bottom: .2rem; }
table { width: 100%; border-collapse: collapse; background: var(--white); }
th, td { padding: .75rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--pale-blue); }

.print-sheet { max-width: 920px; margin: 2rem auto; padding: 2rem; border: 1px solid var(--line); background: var(--white); }
.print-toolbar { position: sticky; top: 0; z-index: 3; display: flex; justify-content: center; gap: 1rem; padding: .7rem; background: rgba(250, 250, 250, .95); }
.answer-lines { min-height: 7rem; background: repeating-linear-gradient(transparent, transparent 2rem, var(--line) 2rem, var(--line) calc(2rem + 1px)); }
.slide { min-height: 620px; display: grid; align-content: center; padding: 4rem; border-bottom: 8px solid var(--blue); page-break-after: always; }
.slide h2 { font-size: clamp(2rem, 6vw, 4.2rem); }
.card-cut-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.cut-card { min-height: 170px; padding: 1rem; border: 1px dashed var(--ink); page-break-inside: avoid; }

.footer { border-top: 1px solid var(--line); background: var(--white); }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 2rem; padding-top: 1.75rem; padding-bottom: 1.75rem; }
.small { color: var(--gray-blue); font-size: .85rem; }

/* 非公開認証・ダッシュボード画面 */
.auth-body, .dashboard-body, .student-auth-body, .student-dashboard-body { min-height: 100vh; background: var(--paper); color: var(--ink); }
.auth-body .site-header, .dashboard-body .site-header, .student-auth-body .site-header, .student-dashboard-body .site-header { border-bottom: 1px solid var(--line); }
.auth-shell { width: min(100% - 2rem, 720px); margin: 0 auto; padding: clamp(2.5rem, 7vw, 5rem) 0; }
.auth-intro { max-width: 720px; margin-bottom: 1.75rem; }
.auth-intro h1 { max-width: 16ch; font-size: clamp(2rem, 5vw, 3.4rem); }
.auth-intro > p:last-child { max-width: 44rem; font-size: 1.05rem; }

.auth-card {
  width: min(100%, 560px);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  border: 1px solid var(--line);
  background: var(--white);
}
.auth-card h2 { margin-top: 0; font-size: 1.4rem; }
.auth-card .field input { border-width: 1px; }
.auth-card .button { width: 100%; }
.form-status { min-height: 1.75rem; font-weight: 800; color: var(--red); }
.form-status:empty::before { content: "\200b"; }
.auth-note, .privacy-slip { margin-top: 1.5rem; padding: 1rem; border-left: 4px solid var(--blue); background: var(--pale-blue); }
.setup-list { display: grid; gap: .6rem; padding-left: 1.4rem; margin: .5rem 0 1.25rem; }
.setup-list li { padding-left: .25rem; }
.student-card { border-left: 5px solid var(--blue); }

.teacher-login-body { min-height: 100vh; background: var(--paper); color: var(--ink); }
.simple-auth-shell { display: grid; place-items: start center; width: min(100% - 2rem, 480px); min-height: calc(100vh - 65px); margin: 0 auto; padding: clamp(3rem, 10vh, 6rem) 0; }
.teacher-login-card { width: 100%; padding: 1.75rem; border: 1px solid var(--line); background: var(--white); }
.teacher-login-card h1 { max-width: none; margin: 0 0 1.25rem; font-size: 1.5rem; letter-spacing: -.02em; }
.teacher-login-card .button { width: 100%; min-height: 46px; }
.teacher-login-card .button.secondary { margin-top: .75rem; }

.dashboard-shell { width: min(100% - 2rem, 1120px); margin: 0 auto; padding: 1.75rem 0 4rem; }
.teacher-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.dashboard-title h1 { max-width: none; margin: 0; font-size: clamp(1.5rem, 4vw, 2rem); letter-spacing: -.02em; }
.dashboard-title p, .dashboard-heading p, .setting-title-row p { margin: .25rem 0 0; color: var(--gray-blue); font-size: .9rem; }
.teacher-account { display: flex; align-items: center; gap: .75rem; }
.teacher-account > span:not(.status-dot) { display: grid; line-height: 1.45; }
.teacher-account small { color: var(--gray-blue); }

.new-class-panel { margin-bottom: 2rem; padding: 1.25rem; border: 1px solid var(--line); background: var(--white); }
.new-class-panel h2 { margin: 0; font-size: 1.15rem; }
.new-class-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: .75rem; margin-top: .75rem; }
.new-class-form .field { margin: 0; }
.new-class-form .form-status { grid-column: 1 / -1; margin: 0; }

.dashboard-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.dashboard-heading h2 { margin: 0; font-size: 1.25rem; }
.classroom-list { display: grid; gap: 1.25rem; }
.classroom-card { border: 1px solid var(--line); background: var(--white); }
.classroom-card > header { display: flex; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--pale-blue); }
.classroom-card h3 { margin: 0; font-size: 1.25rem; }
.classroom-card header p { margin: 0; color: var(--gray-blue); font-size: .9rem; }
.access-lamp {
  align-self: start;
  min-width: 72px;
  padding: .2rem .55rem;
  border: 1px solid var(--gray-blue);
  background: var(--white);
  color: var(--gray-blue);
  font-size: .75rem;
  font-weight: 800;
  text-align: center;
}
.access-lamp.open { background: var(--ok-pale); color: var(--ok); border-color: var(--ok); }
.classroom-head-actions { display: flex; align-items: center; gap: .75rem; }
.classroom-head-actions button { border: 0; background: transparent; color: var(--red); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; font-size: .9rem; }

.classroom-controls { position: relative; padding: 0 1.25rem; }
.classroom-controls::before {
  position: absolute;
  top: 2.2rem;
  bottom: 0;
  left: 2.5rem;
  width: 1px;
  background: var(--line);
  content: "";
}
.setting-section { position: relative; display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: 1rem; padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.setting-section:last-child { border-bottom: 0; }
.setting-number {
  z-index: 1;
  display: grid;
  place-items: center;
  align-self: start;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font-weight: 800;
  line-height: 1;
  font-family: var(--mono);
}
.setting-content { min-width: 0; }
.setting-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.setting-title-row h4, .setting-title-row h5 { margin: 0; font-size: 1.05rem; }
.help-button {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--gray-blue);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
.help-button[aria-expanded="true"] { background: var(--ink); color: var(--white); border-color: var(--ink); }
.setting-help[hidden] { display: none; }
.setting-help {
  margin: .9rem 0;
  padding: .9rem 1rem;
  border: 1px solid var(--pale-blue-strong);
  background: var(--pale-blue);
  color: var(--ink);
}
.setting-help h3, .setting-help h5 { margin: 0 0 .3rem; font-size: .95rem; }
.setting-help p { margin: .3rem 0; }
.help-example {
  display: grid;
  gap: .2rem;
  margin-top: .7rem;
  padding: .65rem .85rem;
  border-left: 3px solid var(--blue);
  background: var(--white);
}
.help-example strong { color: var(--ink); }
.help-example span::before { content: "・"; color: var(--gray-blue); }
.help-note { margin-top: .7rem !important; font-weight: 700; }
.help-flow {
  display: flex;
  align-items: stretch;
  gap: .5rem;
  margin: .8rem 0;
  flex-wrap: wrap;
}
.help-flow span {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 56px;
  padding: .5rem;
  border: 1px solid var(--line);
  background: var(--white);
  text-align: center;
  min-width: 120px;
}
.help-flow b { align-self: center; color: var(--gray-blue); }
.help-flow small { display: block; color: var(--gray-blue); font-weight: 400; }
.material-checks { display: grid; gap: 0; margin: .75rem 0; border-top: 1px solid var(--line); }
.material-checks label { display: grid; grid-template-columns: 1.25rem 1fr; gap: .55rem; padding: .55rem .2rem; border-bottom: 1px solid var(--line); font-size: .88rem; cursor: pointer; }
.material-checks input { width: 1.05rem; height: 1.05rem; margin-top: .25rem; }
.inline-form, .access-controls { display: flex; gap: .55rem; align-items: end; flex-wrap: wrap; }
.inline-form label { display: grid; gap: .2rem; font-weight: 800; }
.access-controls label { display: grid; gap: .2rem; color: var(--ink); font-size: .88rem; font-weight: 700; }
.inline-form input, .access-controls select, .credential-output input { min-height: 42px; padding: .4rem .55rem; border: 1px solid var(--gray-blue); background: var(--white); }
.student-table-wrap { max-height: 320px; overflow: auto; margin-top: .75rem; border: 1px solid var(--line); }
.student-table { font-size: .82rem; border: 0; }
.student-table th, .student-table td { padding: .5rem; }
.student-table button, .credential-output button { padding: .3rem .5rem; border: 1px solid var(--ink); background: var(--white); color: var(--ink); cursor: pointer; }
.empty-guidance { margin: .75rem 0 0; color: var(--gray-blue); }
.credential-output {
  margin: 0 1.25rem 1.25rem 4.5rem;
  padding: 1rem;
  border: 1px solid var(--red);
  background: var(--danger-pale);
}
.credential-output strong { display: block; font-family: var(--display); font-size: 1.1rem; margin-bottom: .5rem; }
.credential-output pre { overflow: auto; padding: .75rem; background: var(--white); border: 1px solid var(--line); font-size: .85rem; }
.credential-output input { width: min(100%, 560px); margin-right: .4rem; }
.card-status { min-height: 1.5rem; margin: 0 1.25rem 1rem 4.5rem; color: var(--red); font-weight: 800; }
.dashboard-empty { margin: 0; }

/* 生徒画面 */
.student-session-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; padding: .9rem 1.1rem; border: 1px solid var(--line); border-left: 6px solid var(--blue); background: var(--white); }
.student-session-bar > div { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.student-session-bar span { color: var(--gray-blue); }
.status-dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-pale); }
.student-material-zone { padding: clamp(1.25rem, 4vw, 2rem); border: 1px solid var(--line); background: var(--white); }
.student-material-zone > h2 { margin-top: 0; font-size: clamp(1.6rem, 4vw, 2.4rem); }
.student-zone-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.student-zone-heading h2 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.4rem); }
.student-zone-heading .eyebrow { margin-bottom: .2rem; font-size: .72rem; }
.student-live-lamp { padding: .2rem .55rem; border: 1px solid var(--gray-blue); background: var(--pale-blue); font-family: var(--mono); font-size: .7rem; font-weight: 900; }
.student-live-lamp.connected { background: var(--ok-pale); color: var(--ok); border-color: var(--ok); }
.student-live-lamp.connecting { background: var(--warn-pale); color: var(--warn); border-color: var(--warn); }
.student-live-lamp.disconnected { background: var(--danger-pale); color: var(--red); border-color: var(--red); }
.student-material-open { margin-top: auto; padding: 0; border: 0; background: transparent; color: var(--blue); font: inherit; font-weight: 800; text-align: left; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.student-viewer { margin-top: 1.25rem; border: 1px solid var(--line); background: var(--white); }
.student-viewer[hidden], .student-live-alert[hidden] { display: none; }
.student-viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem .9rem; border-bottom: 1px solid var(--line); background: var(--pale-blue); }
.student-viewer-toolbar > div { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.student-viewer iframe { display: block; width: 100%; height: min(72vh, 820px); border: 0; background: var(--white); }
.student-viewer:fullscreen { width: 100vw; height: 100vh; border: 0; }
.student-viewer:fullscreen iframe { height: calc(100vh - 56px); }
.student-live-alert { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; background: rgba(23, 50, 77, .78); }
.student-live-alert > div { width: min(480px, 100%); padding: 1.75rem; border: 1px solid var(--line); background: var(--white); }
.student-live-alert h2 { margin-top: .2rem; font-size: clamp(1.6rem, 5vw, 2.4rem); }

/* 授業ライブパネル */
.classroom-live-panel { padding: 1.25rem; background: var(--pale-blue); border-bottom: 0; }
.classroom-live-panel .setting-content { min-width: 0; width: 100%; }
.live-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.25rem; margin-bottom: 1rem; }
.live-panel-heading > div:first-child { flex: 1; min-width: 0; }
.live-panel-heading h4 { margin: 0; font-family: var(--display); font-size: 1.05rem; }
.live-connection { display: block; margin-bottom: .35rem; color: var(--gray-blue); font-family: var(--mono); font-size: .72rem; font-weight: 900; text-align: right; }
.live-connection[data-state="connected"] { color: var(--ok); }
.live-connection[data-state="disconnected"] { color: var(--red); }
.live-summary { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }
.live-summary span { min-width: 92px; padding: .3rem .5rem; border: 1px solid var(--line); background: var(--white); font-size: .75rem; text-align: center; }
.live-summary span.attention { border-color: var(--red); background: var(--danger-pale); color: var(--red); }
.live-summary strong { font-family: var(--mono); font-size: 1rem; }
.live-student-list { display: grid; gap: .5rem; }
.live-student-row {
  display: grid;
  grid-template-columns: minmax(200px, .8fr) minmax(320px, 1.2fr);
  align-items: center;
  gap: 1rem;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-left: 5px solid #aeb8bd;
  background: var(--white);
}
.live-student-row.active, .live-student-row.ready { border-left-color: var(--ok); }
.live-student-row.away { border-left-color: var(--red); background: var(--danger-pale); }
.live-student-row.idle { border-left-color: var(--warn); background: var(--warn-pale); }
.live-student-state { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.live-state-lamp { flex: 0 0 auto; width: 12px; height: 12px; border: 1px solid var(--ink); border-radius: 50%; background: #aeb8bd; }
.active .live-state-lamp, .ready .live-state-lamp { background: var(--ok); }
.away .live-state-lamp { background: var(--red); }
.idle .live-state-lamp { background: var(--warn); }
.live-student-state div { display: grid; min-width: 0; }
.live-student-state span { color: var(--red); font-size: .78rem; font-weight: 900; }
.live-student-state small { overflow: hidden; color: var(--gray-blue); text-overflow: ellipsis; white-space: nowrap; }
.live-student-actions { display: flex; align-items: center; justify-content: flex-end; gap: .4rem; flex-wrap: wrap; }
.live-student-actions button, .live-student-actions select, .student-viewer-toolbar button { min-height: 34px; padding: .3rem .5rem; border: 1px solid var(--ink); background: var(--white); color: var(--ink); font-size: .78rem; font-weight: 800; cursor: pointer; }
.live-student-actions button:last-child { border-color: var(--red); color: var(--red); }
.live-student-actions button:disabled, .live-student-actions select:disabled { cursor: not-allowed; opacity: .45; }
.live-empty { margin: 0; padding: .9rem; border: 1px dashed var(--line); background: var(--white); text-align: center; }
.status-guide { display: grid; gap: .45rem; margin: .7rem 0; padding: 0; list-style: none; }
.status-guide li { display: flex; align-items: center; gap: .6rem; }
.status-guide i { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; background: #aeb8bd; }
.status-guide .guide-green { background: var(--ok); }
.status-guide .guide-yellow { background: var(--warn); }
.status-guide .guide-red { background: var(--red); }
.status-guide .guide-gray { background: #aeb8bd; }

@media (max-width: 900px) {
  .hero-inner, .catalog-layout, .lesson-layout { grid-template-columns: 1fr; }
  .material-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-inner { min-height: auto; }
  .filters, .lesson-aside { position: static; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .live-student-row { grid-template-columns: 1fr; }
  .live-student-actions { justify-content: flex-start; }
  .header-inner { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .header-inner, .section-head, .footer-inner { align-items: flex-start; flex-direction: column; }
  .site-nav { gap: .6rem; }
  .material-grid, .resource-list, .card-cut-grid, .facts { grid-template-columns: 1fr; }
  .hero-inner { padding-top: 2.5rem; padding-bottom: 2.5rem; }
  h1 { font-size: 2.4rem; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
  .print-sheet { margin: 0; padding: 1rem; border: 0; }
  .teacher-toolbar, .student-session-bar, .dashboard-heading { align-items: stretch; flex-direction: column; }
  .teacher-account { align-items: flex-start; flex-wrap: wrap; }
  .teacher-account .button { width: 100%; }
  .new-class-form { grid-template-columns: 1fr; }
  .new-class-form .form-status { grid-column: auto; }
  .classroom-card > header, .classroom-head-actions { align-items: flex-start; flex-direction: column; }
  .classroom-controls { padding: 0 1rem; }
  .classroom-controls::before { left: 2.1rem; }
  .setting-section { grid-template-columns: 1.8rem minmax(0, 1fr); gap: .65rem; }
  .setting-number { width: 1.8rem; height: 1.8rem; }
  .setting-title-row { gap: .6rem; }
  .help-flow { display: grid; grid-template-columns: 1fr; }
  .help-flow b { justify-self: center; transform: rotate(90deg); }
  .credential-output, .card-status { margin-left: 1rem; margin-right: 1rem; }
  .auth-shell { width: min(100% - 1rem, 720px); }
  .live-panel-heading, .student-zone-heading, .student-viewer-toolbar { align-items: stretch; flex-direction: column; }
  .live-connection { text-align: left; }
  .live-summary { justify-content: flex-start; }
  .live-student-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .live-student-actions select { grid-column: 1 / -1; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  body { background: white; color: #111; font-size: 10.5pt; }
  .site-header, .footer, .print-toolbar, .lesson-aside, .no-print { display: none !important; }
  .print-sheet, .lesson-layout { max-width: none; margin: 0; padding: 0; border: 0; display: block; }
  a { color: inherit; text-decoration: none; }
  .slide { min-height: 0; height: 180mm; border: 1px solid #777; }
  .cut-card { min-height: 58mm; }
  .dashboard-body * { visibility: hidden; }
  .dashboard-body .credential-output:not([hidden]), .dashboard-body .credential-output:not([hidden]) * { visibility: visible; }
  .dashboard-body .credential-output:not([hidden]) { position: absolute; inset: 0; margin: 0; border: 0; background: white; }
}
