/* 教师看板。和学生创作页（student.css）用同一套色板、字体和顶栏，
   老师在两个页面之间来回切不会像换了个产品。
   看板信息密：卡片只分区块，不再层层套边框；主按钮是墨黑实心，和创作页的发送键一致。 */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --sunk: #f1f2f5;
  --line: #e7e9ee;
  --ink: #15171c;
  --muted: #868b96;
  --accent: #2f6bff;
  --ok: #1f9d63;
  --danger: #d1453b;
  --warn: #b26a00;
  --shadow: 0 1px 2px rgba(20, 24, 36, .04), 0 8px 28px rgba(20, 24, 36, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111216;
    --surface: #1b1d22;
    --sunk: #24262c;
    --line: #2d3037;
    --ink: #eceef2;
    --muted: #8e939e;
    --accent: #6d95ff;
    --ok: #4cc38a;
    --danger: #f07a70;
    --warn: #f0a640;
    --shadow: 0 8px 28px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
/* 作者样式里的 display（.stats 是 grid、.card 是 block）会盖过浏览器默认的
   [hidden]，所以这条必须显式写出来，否则 el.hidden = true 藏不住东西。 */
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
code { font-size: 13px; padding: 1px 6px; border-radius: 6px; background: var(--sunk); }

/* ------------------------------------------------------------ 顶栏（照抄创作页） */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; letter-spacing: .02em; }
.brand small { font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.mark {
  width: 22px; height: 22px; border-radius: 7px;
  background: conic-gradient(from 210deg, #2f6bff, #62d0ff, #8b7bff, #2f6bff);
}
.who {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px 6px 16px;
  font-size: 14px;
}
.who .muted { font-variant-numeric: tabular-nums; }
.backlink {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  text-decoration: none;
  font-weight: 600;
}
.backlink:hover { opacity: .88; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 8px 24px 96px; }

.pagehead { margin: 28px 0 24px; }
h1 { font-size: clamp(24px, 3vw, 30px); font-weight: 700; letter-spacing: .01em; margin: 0; }
.pagehead p { margin: 4px 0 0; color: var(--muted); }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 14px; }

/* ------------------------------------------------------------ 区块 */

.card {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.card > .muted, .split .muted { line-height: 1.7; margin: 0 0 14px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.hint { margin: 6px 0 0; }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cardhead h2 { margin: 0; }
button.small { width: auto; min-height: 34px; padding: 5px 14px; font-size: 14px; }

/* 一行里「控件 + 按钮」：控件撑开，按钮按字宽 */
.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.inline > input, .inline > select { flex: 1 1 200px; width: auto; }
.inline > button { width: auto; flex: none; padding-inline: 18px; }
/* 筛选行里的按钮组按字宽，放不下就整组折到下一行，不许被挤出卡片 */
.row > .filters-actions { flex: 0 0 auto; min-width: auto; display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.filters-actions button { width: auto; }
/* 输入框下面还挂着一行提示时，按钮不贴底，而是垫一个空标签和输入框对齐 */
.row > .filters-actions.beside-inputs { display: block; }

/* 表格紧跟在搜索框下面时留出空，表里的按钮按字宽靠右，不撑满一格 */
.inline + .tablewrap, .row + .tablewrap { margin-top: 16px; }
td button { width: auto; min-height: 32px; padding: 4px 14px; font-size: 14px; }
td:last-child:has(> button) { text-align: right; }

/* 投到大屏：口令和抽画左右并排，窄屏上下叠 */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.split > div + div { border-left: 1px solid var(--line); padding-left: 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { font-size: 16px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* ------------------------------------------------------------ 上课状态条
   整页只有这一处用颜色大面积表达状态：绿 = 课表开着，琥珀 = 老师临时开的（会到期），
   灰 = 关着。老师扫一眼就知道学生此刻进不进得来，不用读字。 */

.classbar {
  --state: var(--muted);
  display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  padding: 20px 24px;
  margin: 4px 0 14px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--state) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--state) 28%, transparent);
}
.classbar[data-state="schedule"] { --state: var(--ok); }
.classbar[data-state="override"] { --state: var(--warn); }
.classbar-text { min-width: 0; flex: 1 1 320px; }
.classbar-head {
  display: flex; align-items: center; gap: 12px;
  margin: 0; font-size: clamp(20px, 2.6vw, 26px); font-weight: 700; line-height: 1.3;
  color: color-mix(in srgb, var(--state) 70%, var(--ink));
}
.classbar[data-state="closed"] .classbar-head { color: var(--ink); }
.classbar-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--state); }
.classbar:not([data-state="closed"]) .classbar-dot { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--state) 45%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--state) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .classbar-dot { animation: none !important; } }
.classbar-sub { margin: 4px 0 0 24px; color: var(--muted); font-size: 14px; }
.classbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.classbar-actions button { width: auto; }

/* ------------------------------------------------------------ 分区标签 */

.tabs {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 4px;
  margin: 22px 0 16px;
  padding: 8px 0 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs button {
  width: auto; flex: none;
  min-height: 0; padding: 10px 16px 12px;
  border: 0; border-radius: 0;
  background: none; color: var(--muted);
  font-weight: 500; font-size: 15px;
  box-shadow: inset 0 -2px 0 transparent;
}
.tabs button:hover:not(:disabled) { opacity: 1; color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink); }

/* ------------------------------------------------------------ 开关
   按钮只表状态（圆点在左 = 关，在右 = 开），名字和「开了会怎样」写在旁边，
   不再把状态和操作挤进同一句「已开放（点此收回）」里。 */

.switches { display: flex; flex-direction: column; }
.switchrow { display: flex; align-items: flex-start; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.switchrow:first-child { border-top: 0; padding-top: 0; }
.switchrow p { margin: 2px 0 0; }
.switchname { display: inline; margin: 0 10px 0 0; font-size: 15px; font-weight: 600; color: var(--ink); cursor: pointer; }
a.switchname { color: var(--accent); }
.switchstate { font-size: 13px; color: var(--muted); }
.switch {
  flex: none; position: relative;
  width: 46px; min-height: 0; height: 26px; padding: 0; margin-top: 1px;
  border-radius: 999px; border: 0;
  background: var(--line);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .15s ease;
}
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch:hover:not(:disabled) { opacity: .85; }
@media (prefers-reduced-motion: reduce) { .switch::after { transition: none; } }

/* 时段那一行：选择框自己撑开，「到」和「删掉」不跟着抻 */
.slotrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.slotrow select { flex: 1 1 110px; width: auto; }
.slotrow > span { flex: 0 0 auto; color: var(--muted); }
.slotrow .slot-del { flex: 0 0 auto; }

/* 班级口令编辑行；要删的先划掉，保存前还能撤销 */
.coderow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.coderow input { flex: 1; min-width: 160px; width: auto; font-size: 17px; }
.coderow .muted { font-size: 13px; }
.coderow.removing input { text-decoration: line-through; opacity: .55; }
.coderow.removing .muted { color: var(--danger); }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

input, select, textarea, button {
  font: inherit;
  color: inherit;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--sunk);
  padding: 9px 12px;
  width: 100%;
  min-height: 42px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); background: var(--surface); }
textarea { resize: vertical; min-height: 92px; }

.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > * { flex: 1 1 140px; min-width: 0; }

button {
  background: var(--ink);
  color: var(--surface);
  border-color: transparent;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
button:hover:not(:disabled) { opacity: .88; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); font-weight: 400; }
button.ghost:hover:not(:disabled) { opacity: 1; border-color: var(--ink); }

.notice {
  margin: 12px 0;
  padding: 10px 16px;
  border-radius: 12px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 9%, transparent);
  font-size: 14px;
}

/* 登录卡：和学生登录一样居中窄栏 */
#loginCard { max-width: 440px; margin: 10vh auto 0; }

/* ------------------------------------------------------------ 数字条 */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.stat { background: var(--surface); padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; order: 1; }
.stat span:first-child { font-size: 13px; color: var(--muted); order: 0; }
.stat span:last-child { font-size: 12px; color: var(--muted); order: 2; }

/* ------------------------------------------------------------ 表格 */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: var(--sunk); }
th:first-child { border-radius: 10px 0 0 10px; }
th:last-child { border-radius: 0 10px 10px 0; }
th { border-bottom: 0; }
tr:last-child td { border-bottom: 0; }
td { font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }

.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12px; background: var(--sunk); }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pill.bad { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* ------------------------------------------------------------ 作品墙审核 */

.wallgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.wallgroup { margin: 18px 0 0; font-size: 15px; }
.wallgroup + .wallgrid { margin-top: 8px; }
.linkish { background: none; border: 0; padding: 0; min-height: 0; width: auto; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }

.wallcard {
  margin: 0;
  border: 2px solid transparent;
  border-radius: 16px;
  overflow: hidden;
  background: var(--sunk);
  display: flex;
  flex-direction: column;
}
.wallcard.up { border-color: var(--accent); }
.wallcard img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--sunk); }
.wallcard figcaption {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.wallcard img { cursor: zoom-in; }
.wallcard figcaption b { color: var(--ink); font-weight: 600; }
.wallcard button { border-radius: 0; border: 0; min-height: 40px; }
.wallcard.up button { background: var(--accent); color: #fff; }
.wallcard:not(.up) button { background: transparent; color: var(--muted); font-weight: 400; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------ 作品详情 */

.detail:not([hidden]) {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(10, 11, 14, .82);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.detail-panel {
  display: flex;
  width: min(1180px, 100%);
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
}
.detail-image {
  flex: 1; min-width: 0;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background: #0d0e11;
}
/* 固定撑满框：先顶上的缩略图只有 480 宽，不撑满的话换成原图时画面会猛地跳大 */
.detail-image img { width: 100%; height: calc(100vh - 48px); object-fit: contain; display: block; }
.imgloading {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  padding: 4px 12px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: rgba(255, 255, 255, .85);
  font-size: 13px; pointer-events: none;
}
.detail-image .detail-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; min-height: 48px; height: 48px; padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16); color: #fff;
  font-size: 30px; line-height: 1; font-weight: 400;
}
.detail-image .detail-nav:hover:not(:disabled) { background: rgba(255, 255, 255, .3); opacity: 1; }
#detailPrev { left: 12px; }
#detailNext { right: 12px; }
.detail-info {
  flex: 0 0 360px;
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px 20px;
  overflow-y: auto;
}
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.detail-head .detail-close { width: auto; min-height: 34px; padding: 4px 14px; }
.detail-info dl { margin: 0; display: grid; grid-template-columns: 5em 1fr; gap: 8px 12px; font-size: 14px; }
.detail-info dt { color: var(--muted); }
.detail-info dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.detail-info dd.prompt { white-space: pre-wrap; line-height: 1.7; }
.detail-info dd .muted { font-size: 12px; }
.detail-refs { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-refs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: var(--sunk); display: block; }
#detailWall.on { background: var(--accent); color: #fff; }

@media (max-width: 820px) {
  .detail:not([hidden]) { padding: 0; }
  .detail-panel { flex-direction: column; max-height: 100vh; height: 100%; border-radius: 0; overflow-y: auto; }
  .detail-image { flex: none; }
  .detail-image img { height: 55vh; }
  .detail-info { flex: none; overflow: visible; }
}

@media (max-width: 720px) {
  .split { grid-template-columns: 1fr; gap: 20px; }
  .split > div + div { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 20px; }
}

@media (max-width: 560px) {
  .classbar { padding: 16px 18px; }
  .classbar-sub { margin-left: 0; }
  .classbar-actions, .classbar-actions button { width: 100%; }
  .topbar { padding: 12px 16px; }
  .wrap { padding-inline: 16px; }
  .card { padding: 18px; }
}

/* 全屏展示口令：投影仪上要从教室最后一排看得清，固定白底黑字，不跟深色主题走 */
.present:not([hidden]) {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3vh;
  background: #fff; color: #000; cursor: pointer; text-align: center; padding: 4vw;
}
.present-label { font-size: 4vw; color: #555; }
.present-code {
  font-size: min(16vw, 30vh); font-weight: 700; letter-spacing: .06em; line-height: 1.1;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; word-break: break-all;
}
.present-url { font-size: 3vw; color: #333; }
.present-tip { position: absolute; bottom: 3vh; font-size: 14px; color: #999; }

/* ------------------------------------------------------------ 随机抽一张（全屏讲评） */

.draw:not([hidden]) {
  position: fixed; inset: 0; z-index: 100;
  background: #0b0c0f;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 24px;
}
.draw-stage { position: relative; flex: 1; min-height: 0; width: 100%; }
.draw-stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.draw-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.draw .draw-tool {
  display: inline-flex; align-items: center; gap: 7px;
  width: auto; min-height: 0; height: 42px; padding: 0 18px;
  border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .12); color: #fff;
  font-size: 15px; font-weight: 400;
}
.draw .draw-tool:hover:not(:disabled) { background: rgba(255, 255, 255, .22); opacity: 1; }
.draw .draw-tool[aria-pressed="true"] { background: #fff; color: #15171c; }
.draw-count { color: rgba(255, 255, 255, .55); font-size: 14px; }
.draw-info {
  margin: 0;
  max-width: min(900px, 100%);
  padding: 10px 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  text-align: center;
  font-size: 20px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  max-height: 20vh;
  overflow-y: auto;
}
.draw-info[hidden] { display: none; }
.draw-who { font-weight: 600; }
.draw .draw-close {
  position: absolute; top: 18px; right: 18px;
  width: 44px; min-height: 0; height: 44px; padding: 0;
  border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .12); color: #fff;
}
.draw .draw-close:hover { background: rgba(255, 255, 255, .22); opacity: 1; }

@media (max-width: 560px) {
  .draw:not([hidden]) { padding: 64px 12px 20px; }
  .draw-info { font-size: 16px; }
}
