:root {
  color-scheme: light;
  --ink: #1c2836;
  --navy: #17293f;
  --navy-mid: #26445f;
  --paper: #f3f5f8;
  --surface: #fff;
  --line: #dfe5eb;
  --muted: #536475;
  --hint: #eaf0f5;
  --amber: #edbc66;
  --amber-soft: #fff1d9;
  --amber-ink: #70470f;
  --green: #22624b;
  --green-soft: #e7f4ec;
  --red: #9a373b;
  --red-soft: #f9e9ea;
  --backdrop: rgb(12 24 38 / 49%);
  --chalk: #d6e9df;
  --blackboard: #183830;
  --chalk-line: #718e80;
  --font: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.55 var(--font); }
[hidden] { display: none !important; }
a { color: var(--navy-mid); text-underline-offset: .2em; }
button, input, select { font: inherit; }
button, .button, .link-button { cursor: pointer; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 41px; padding: .5rem .9rem; color: var(--ink); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-weight: 650; }
button.primary, .button.primary { color: var(--surface); background: var(--navy); border-color: var(--navy); }
button.warm, .button.warm { color: var(--navy); background: var(--amber); border-color: var(--amber); }
button.danger { color: var(--surface); background: var(--red); border-color: var(--red); }
button.text-button { border-color: transparent; background: transparent; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid var(--navy-mid); outline-offset: 3px; }
button.primary:focus-visible { outline-color: var(--amber-ink); }
small, .quiet { color: var(--muted); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.04em; line-height: 1.15; }
h2 { font-size: 1.3rem; line-height: 1.3; }
p + p { margin-top: .65rem; }
.mark { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 7px; background: var(--amber); color: var(--navy); font-weight: 800; font-size: .85rem; }
.brand { display: flex; align-items: center; gap: .7rem; font-weight: 750; }
.brand small { display: block; font-weight: 500; }
.fields { display: grid; gap: .9rem; }
label.field { display: grid; gap: .35rem; min-width: 0; font-weight: 650; }
input:not([type=checkbox]), select { min-height: 41px; max-width: 100%; width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: .5rem .65rem; color: var(--ink); background: var(--surface); }
input::placeholder { color: var(--muted); }
.form-hint { font-size: .85rem; font-weight: 500; color: var(--muted); }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-photo { display: flex; flex-direction: column; justify-content: space-between; min-height: 34rem; padding: clamp(1.25rem, 4vw, 3.5rem); color: var(--surface); background: var(--navy) url("./classroom.png") center / cover; }
.auth-photo small { color: var(--surface); }
.auth-photo .auth-caption { background: var(--navy); width: fit-content; padding: .55rem .8rem; }
.auth-panel { display: grid; place-items: center; padding: 1.5rem; background: var(--surface); }
.auth-panel .auth-form { width: min(100%, 360px); display: grid; gap: 1rem; }
.auth-panel .auth-form > .quiet { margin-top: -.3rem; }
.admin-auth .auth-photo { background-position: center 58%; }
.admin-shell { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--navy); color: var(--surface); display: flex; flex-direction: column; gap: 2rem; padding: 1.45rem .85rem; }
.sidebar .brand { margin-left: .45rem; }
.sidebar small { color: var(--line); }
.sidebar nav { display: grid; gap: .3rem; }
.sidebar nav a { display: flex; align-items: center; gap: .7rem; min-height: 43px; padding: .5rem .7rem; color: var(--surface); text-decoration: none; border-radius: 6px; }
.sidebar nav a.current { background: var(--navy-mid); box-shadow: inset 3px 0 var(--amber); font-weight: 700; }
.sidebar nav a:focus-visible { outline-color: var(--amber); }
.nav-icon { display: grid; place-items: center; width: 1.3rem; color: var(--amber); }
.sidebar footer { margin-top: auto; padding: .75rem .5rem 0; border-top: 1px solid var(--navy-mid); }
.sidebar footer .quiet { color: var(--line); font-size: .83rem; }
.admin-main { min-width: 0; }
.top { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: 0 clamp(1rem, 3vw, 2.1rem); border-bottom: 1px solid var(--line); background: var(--surface); }
.top > span { color: var(--muted); }
.user { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 100%; background: var(--hint); color: var(--navy); font-weight: 700; }
.workspace { padding: clamp(1rem, 3vw, 2.1rem); }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: .65rem; margin-bottom: 1.15rem; }
.page-head p { margin-top: .45rem; }
.data-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; overflow: hidden; }
.toolbar { display: flex; flex-wrap: wrap; gap: .55rem; padding: .85rem; border-bottom: 1px solid var(--line); }
.toolbar input { width: min(100%, 18rem); }
.toolbar select { width: auto; }
.table-flow { overflow-x: auto; }
table { width: 100%; min-width: 530px; border-collapse: collapse; text-align: left; }
th, td { padding: .85rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--paper); color: var(--muted); font-size: .85rem; font-weight: 670; }
td strong { display: block; }
td a + a { margin-left: .75rem; }
td small { display: block; }
.status { display: inline-flex; align-items: center; gap: .35rem; font-weight: 650; font-size: .82rem; white-space: nowrap; padding: .19rem .53rem; border-radius: 4px; color: var(--muted); background: var(--hint); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 100%; background: currentColor; }
.status.ok { color: var(--green); background: var(--green-soft); }
.status.warn { color: var(--amber-ink); background: var(--amber-soft); }
.status.error { color: var(--red); background: var(--red-soft); }
.list-footer { display: flex; justify-content: space-between; padding: .65rem .85rem; font-size: .85rem; color: var(--muted); }
.drawer, .modal { display: flex; flex-direction: column; width: min(100%, 514px); min-width: 0; background: var(--surface); }
.drawer { height: 100%; }
.drawer-head { display: flex; justify-content: space-between; align-items: start; gap: .7rem; padding: 1.25rem; border-bottom: 1px solid var(--line); }
.drawer-head p { margin-top: .35rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1.25rem; display: grid; align-content: start; gap: 1rem; }
.drawer-actions { display: flex; align-items: center; justify-content: end; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--line); }
.modal { width: min(100%, 570px); border-radius: 9px; overflow: hidden; max-height: 90vh; }
.file-area { display: grid; justify-items: center; padding: 1.35rem 1rem; text-align: center; border: 1px dashed var(--navy-mid); border-radius: 7px; background: var(--paper); gap: .4rem; }
.file-row, .check-row { display: flex; justify-content: space-between; gap: .4rem; align-items: center; padding: .7rem; border-bottom: 1px solid var(--line); }
.file-row:last-child, .check-row:last-child { border: 0; }
.alert { border-radius: 6px; padding: .7rem .85rem; color: var(--amber-ink); background: var(--amber-soft); }
.alert.error { color: var(--red); background: var(--red-soft); }
.credential { background: var(--hint); border-radius: 6px; padding: .8rem; font: 670 1.2rem var(--font); letter-spacing: .12em; }
.teacher-shell { min-height: 100vh; }
.teacher-top { padding-inline: max(1rem, calc((100vw - 1100px) / 2)); }
.teacher-main { width: min(1100px, calc(100% - 2rem)); margin: auto; padding-block: 2.2rem; }
.teacher-main .page-head { margin-bottom: 1.5rem; }
.lesson-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.lesson { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.cover { min-height: 140px; display: grid; align-content: space-between; gap: .5rem; padding: 1.05rem; background: var(--navy); color: var(--surface); border-bottom: 4px solid var(--amber); }
.cover small { color: var(--line); }
.cover strong { font-size: clamp(1rem, 3vw, 1.6rem); line-height: 1.2; }
.lesson-info { padding: .85rem; display: grid; gap: .6rem; }
.lesson-info button { justify-self: start; }
.empty { display: grid; min-height: 290px; place-content: center; text-align: center; gap: .45rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; }

dialog { padding: 0; border: 0; color: var(--ink); }
dialog::backdrop { background: var(--backdrop); }
dialog.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; max-height: 100%; max-width: 100%; }
dialog:not([open]) { display: none; }
.form-error { color: var(--red); overflow-wrap: anywhere; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.link-button { min-height: auto; padding: 0; color: var(--navy-mid); background: transparent; border: 0; text-decoration: underline; text-underline-offset: .2em; }
.list-footer button { min-height: 29px; padding: .15rem .5rem; font-size: .85rem; }
#management .workspace section > .page-head { margin-bottom: 1.15rem; }
.data-panel td { overflow-wrap: anywhere; }
input[type=checkbox] { accent-color: var(--navy-mid); }
.head-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.upload-progress { display: grid; gap: .3rem; }
.upload-progress progress { width: 100%; accent-color: var(--navy-mid); }
.game-frame { width: 100%; height: 260px; border: 0; }
.operation-form { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.operation-form .drawer-body { flex: 1; }
.operation-form .drawer-actions { flex: 0 0 auto; }
#notice:not([hidden]) { padding: .65rem .8rem; margin-bottom: .9rem; background: var(--hint); border-radius: 6px; }
.empty-row { padding-block: 1.5rem; text-align: center; color: var(--muted); }
.file-area.is-dragging { background: var(--hint); }
.credential { user-select: all; overflow-wrap: anywhere; }

.game-frame.compact-game { height: 136px; }

/* 投屏游戏优先留给 iframe，分数配对沿用紧凑弹窗。 */
#classroom-game:not(:has(.compact-game)) {
  width: calc(100vw - 24px);
  height: calc(100vh - 24px);
  max-width: none;
  max-height: none;
}
#classroom-game .drawer-head { justify-content: flex-end; }
#classroom-game:not(:has(.compact-game)) .drawer-head {
  flex: 0 0 auto;
  padding: .4rem .8rem;
  align-items: center;
}
#classroom-game:not(:has(.compact-game)) #game-content {
  display: flex;
  flex: 1;
  min-height: 0;
  padding: 0;
}
#classroom-game .game-frame:not(.compact-game) { flex: 1; height: auto; }

#classroom-game:has(.has-toolbar-close) .drawer-head { display: none; }

/* 游戏工具栏接管关闭后，iframe 覆盖整个课件视口。 */
#classroom-game:has(.has-toolbar-close) {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
}
