/* ============================================================
   Homework Board — Apple 风格轻量样式（展示端 + 布置端）
   ============================================================ */
:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --sub: #86868b;
  --sub2: #6e6e73;
  --line: rgba(60, 60, 67, 0.09);
  --accent: #007aff;
  --danger: #ff3b30;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 12px 32px rgba(0, 0, 0, 0.06);
  --r: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro SC",
    "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC",
    "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; }
input, textarea { font-family: inherit; }
h1, h2, h3 { letter-spacing: -0.01em; }
.app { max-width: 1180px; margin: 0 auto; padding: 8px 20px 30px; }

/* ---------------- 通用组件 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.ghost {
  border: 0; background: transparent; color: var(--accent);
  font-size: 14px; padding: 7px 11px; border-radius: 9px; cursor: pointer;
}
.ghost:hover { background: rgba(0, 122, 255, 0.07); }
.ghost.danger { color: var(--danger); }
.ghost.danger:hover { background: rgba(255, 59, 48, 0.07); }
.ghost.on { background: rgba(0, 122, 255, 0.1); font-weight: 600; }
.iconbtn {
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: rgba(120, 120, 128, 0.1); color: var(--text);
  font-size: 20px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease, background 0.2s;
  padding: 0 0 2px 0;
}
.iconbtn:hover { background: rgba(120, 120, 128, 0.18); }
.iconbtn:active { transform: scale(0.92); }
.iconbtn.xs { width: 26px; height: 26px; font-size: 14px; padding: 0; }
.iconbtn.del { color: var(--danger); }
.iconbtn.off { opacity: 0.25; pointer-events: none; }
.btn {
  border: 0; border-radius: 12px; padding: 10px 18px; font-size: 15px;
  cursor: pointer; background: rgba(120, 120, 128, 0.1); color: var(--text);
  transition: filter 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: #fff; font-weight: 500; }
.btn.danger { background: var(--danger); color: #fff; font-weight: 500; }
.btn.big { width: 100%; padding: 13px; font-size: 16px; font-weight: 600; border-radius: 14px; }
.hint, .tip { color: var(--sub); font-size: 12.5px; }
.pad { padding: 8px 2px; }
.cnt { color: var(--sub); font-size: 12px; }

/* chips */
.chip {
  border: 0; cursor: pointer; border-radius: 999px; padding: 7px 15px;
  font-size: 14px; background: rgba(120, 120, 128, 0.09); color: var(--text);
  display: inline-flex; align-items: center; gap: 4px;
  transition: background 0.15s, transform 0.1s;
}
.chip:hover { background: rgba(120, 120, 128, 0.16); }
.chip:active { transform: scale(0.96); }
.chip.on { background: var(--accent); color: #fff; font-weight: 500; }
.chip.mini { padding: 5px 13px; font-size: 13px; }
.chip.s { padding: 4px 12px; font-size: 13px; }
.chip .badge {
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 10.5px; min-width: 17px; height: 17px; line-height: 17px;
  padding: 0 4px; text-align: center; font-weight: 600;
}
.chip.on .badge { background: rgba(255, 255, 255, 0.25); }

/* 科目色块 */
.tile {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 600;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.12);
}
.c0  { background: #0a84ff; }
.c1  { background: #ff9500; }
.c2  { background: #00c7be; }
.c3  { background: #34c759; }
.c4  { background: #af52de; }
.c5  { background: #d70015; }
.c6  { background: #5856d6; }
.c7  { background: #ffd60a; color: #1d1d1f; }
.c8  { background: #5ac8fa; color: #0b3d5c; }
.c9  { background: #ff375f; }
.c10 { background: #8e8e93; }

/* 输入 */
.in {
  border: 1px solid rgba(60, 60, 67, 0.16); background: #fff;
  border-radius: 10px; padding: 9px 12px; font-size: 15px; width: 100%;
  color: var(--text); outline: none;
}
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.18); }
.in.sm { width: 170px; padding: 6px 10px; font-size: 13px; }
.ta { min-height: 76px; resize: vertical; }

/* 条目行（两端共用） */
.rows { list-style: none; margin: 0; padding: 0; }
.rows .row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 0.5px solid var(--line);
}
.rows .row:last-child { border-bottom: 0; }
.kchip {
  flex: 0 0 auto; font-size: 11.5px; color: var(--sub2);
  background: rgba(120, 120, 128, 0.1); padding: 2px 9px; border-radius: 7px;
  white-space: nowrap;
}
.entx { flex: 1 1 auto; min-width: 0; }
.ttl { font-weight: 600; }
.tx { line-height: 1.55; word-break: break-word; white-space: pre-wrap; }
.rmk { color: var(--sub); font-size: 12.5px; margin-top: 3px; }
.rmkin {
  width: 100%; border: 0; border-radius: 8px; background: rgba(120, 120, 128, 0.08);
  padding: 6px 10px; font-size: 12.5px; color: var(--text); outline: none; margin-top: 6px;
}
.rmkin:focus { background: rgba(0, 122, 255, 0.1); }
.acts { display: inline-flex; gap: 4px; }

/* 弹层 */
.mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, 0.38);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.pinbox { width: min(430px, 92vw); padding: 24px; border-radius: 22px; }
.pinbox.wide { width: min(560px, 94vw); }
.dialog {
  width: min(420px, 92vw); padding: 22px; border-radius: 22px;
  background: var(--card); text-align: center;
}
.dialog .ptitle { text-align: center; }
.dialog .prow { display: flex; gap: 10px; margin-top: 18px; }
.dialog .prow .btn { flex: 1; }
.ptitle { font-size: 19px; font-weight: 700; text-align: center; }
.perr { color: var(--danger); font-size: 13px; margin-top: 8px; text-align: center; }
.pinbox .in { margin-top: 14px; }
.pinbox .btn { margin-top: 14px; width: 100%; }
.crow.center { justify-content: center; }
#toasts {
  position: fixed; bottom: 26px; left: 0; right: 0; z-index: 120;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(28, 28, 30, 0.92); color: #fff; font-size: 13.5px;
  padding: 9px 16px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  transition: opacity 0.4s; max-width: 86vw;
}
.toast.err { background: var(--danger); }

/* ============================================================
   展示端（大屏）
   ============================================================ */
.page-display { min-height: 100vh; }
.topbar {
  max-width: 1180px; margin: 0 auto; padding: 18px 22px 6px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.logo {
  height: 58px; width: auto; max-width: 46vw; object-fit: contain;
}
.logo.sm { height: 38px; max-width: 38vw; }
.brandtx .sc { font-size: 13px; color: var(--sub2); letter-spacing: 0.05em; }
.brandtx .cl { font-size: 21px; font-weight: 700; margin-top: 1px; }

.seg {
  display: inline-flex; background: rgba(120, 120, 128, 0.12);
  border-radius: 12px; padding: 3px; gap: 2px;
}
.segbtn {
  border: 0; background: transparent; padding: 7px 20px; border-radius: 9px;
  font-size: 14.5px; color: var(--text); cursor: pointer;
}
.segbtn.on { background: #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.14); font-weight: 600; }

.clockbox { margin-left: auto; }
.ck {
  font-size: 30px; font-weight: 600; line-height: 1.05;
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em; text-align: right;
}
.ckd { font-size: 12px; color: var(--sub); text-align: right; margin-top: 2px; }

.hwtop {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 16px 2px 14px;
}
.dtitle { font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; margin: 0; }
.dnav, .kbctrls { display: flex; gap: 6px; align-items: center; }

/* 日期切换：中间显示当前查看日期（可点开日历），今天按钮在最右 */
.ddate {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: rgba(120, 120, 128, 0.1); color: var(--text);
  font-size: 15px; font-weight: 600; padding: 6px 16px; border-radius: 999px;
  cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums;
  min-width: 92px; user-select: none; text-align: center;
}
.ddate:hover { background: rgba(120, 120, 128, 0.18); }
.ddate input {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  opacity: 0; pointer-events: none; border: 0; margin: 0; padding: 0;
}

.subgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px; align-items: start;
}
.card.subj { overflow: hidden; }
.subjhead { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; }
.subjtx h2 { margin: 0; font-size: 20px; font-weight: 700; }
.subjtx .cnt { margin-top: 1px; display: inline-block; }
.card.subj .rows { border-top: 0.5px solid var(--line); padding-top: 2px; }
.card.subj .rows .row { padding: 11px 16px; align-items: flex-start; }
.card.subj .kchip { margin-top: 3px; }

/* 布置批次分组标签 */
.gcap {
  display: flex; align-items: baseline; gap: 6px;
  padding: 10px 16px 0; font-size: 11.5px; color: var(--sub2);
  letter-spacing: 0.03em; font-variant-numeric: tabular-nums;
}
.gcap:first-child { padding-top: 8px; }

.emptycard { text-align: center; padding: 80px 20px 60px; }
.emoj { color: #c7c7cc; margin-bottom: 6px; }
.et1 { font-size: 20px; font-weight: 700; margin-top: 14px; }
.et2 { color: var(--sub); margin-top: 8px; font-size: 14px; }

.foot {
  max-width: 900px; margin: 30px auto 6px; padding: 0 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 4px 8px; color: var(--sub); font-size: 13px; text-align: center;
}
.foot .sep { opacity: 0.6; }
.assignlink {
  margin-left: auto; color: var(--accent); text-decoration: none;
  font-weight: 500; background: rgba(0, 122, 255, 0.08);
  padding: 7px 14px; border-radius: 999px; font-size: 13px;
}

.kbstage {
  max-width: 1120px; margin: 0 auto 26px; background: #fff;
  border-radius: 22px; box-shadow: var(--shadow); overflow: auto;
  height: calc(100vh - 255px); min-height: 320px;
  display: flex; justify-content: center; align-items: flex-start;
}
.kbstage.big { justify-content: flex-start; }
.kbstage img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* ============================================================
   布置端
   ============================================================ */
.page-admin { padding-bottom: 40px; }
.atop {
  position: sticky; top: 0; z-index: 50;
  background: rgba(242, 242, 247, 0.82);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.12);
  padding: 10px 18px; display: flex; align-items: center; gap: 12px;
}
.abrand { display: flex; align-items: center; gap: 10px; }
.atitle { font-size: 17px; font-weight: 700; }
.asub { font-size: 12px; color: var(--sub2); margin-top: 1px; }
.aright { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.awrap { max-width: 880px; margin: 0 auto; padding: 16px 16px 80px; }

.datebar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 6px;
}
.datebar input[type="date"] {
  border: 0; background: transparent; font-size: 18px; font-weight: 700;
  color: var(--text); outline: none; padding: 4px 0; flex: 0 1 auto;
  min-width: 0; cursor: pointer;
}
.dmid { display: flex; align-items: baseline; gap: 10px; flex: 1 1 auto; min-width: 200px; }
.dmid .hint { white-space: nowrap; }

.subrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }

.panel { margin-top: 8px; }
.phead { display: flex; align-items: center; gap: 12px; padding: 6px 2px 4px; }
.phead h2 { margin: 0; font-size: 21px; font-weight: 700; }
.phead .cnt { margin-left: 2px; }
.phead .ghost.danger { margin-left: auto; }

.kindrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }

.builder {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 14px 14px 18px; margin-bottom: 22px;
}
.fields { display: grid; gap: 10px; }
.fcard { background: rgba(120, 120, 128, 0.055); border-radius: 13px; padding: 11px 12px 12px; }
.fcard.free { display: flex; flex-direction: column; gap: 9px; }
.flabel { font-size: 12px; color: var(--sub2); font-weight: 500; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.crow { display: flex; gap: 6px; margin-top: 9px; align-items: center; flex-wrap: wrap; }
.builder .btn.big { margin-top: 12px; }
.builder .tip { padding: 10px 4px 0; text-align: center; }

.lhead {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin: 2px 4px 8px; font-size: 14px; font-weight: 600; color: var(--sub2);
}
#savehint { font-weight: 400; font-size: 12px; color: var(--sub); white-space: nowrap; }
.rows.wide {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 4px 0;
}
#entempty { color: var(--sub); }

.olist { max-height: 58vh; overflow: auto; }

/* 窄屏适配 */
@media (max-width: 720px) {
  .topbar { padding: 14px 14px 4px; gap: 10px; }
  .brand { margin-right: 0; }
  .seg { width: 100%; justify-content: center; margin-top: 4px; order: 3; }
  .clockbox { margin-left: auto; }
  .ck { font-size: 22px; }
  .app { padding: 4px 12px 24px; }
  .subgrid { grid-template-columns: 1fr; gap: 12px; }
  .assignlink { margin-left: 0; }
  .foot { justify-content: flex-start; }
  .kbstage { height: calc(100vh - 300px); min-height: 260px; }
  .atop { padding: 9px 12px; }
  .awrap { padding: 12px 10px 70px; }
  .rows .row { padding: 10px 12px; }
  .iconbtn { width: 32px; height: 32px; }
}

/* ============================================================
   页脚备案 + 新作业全屏播报
   ============================================================ */
a.icp { color: #86868b; text-decoration: none; font-size: 12px; white-space: nowrap; }
a.icp:hover { color: var(--accent); }
.afoot { text-align: center; padding: 14px 0 2px; }
.foot a.icp { order: 2; }

.hwnmask {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(12, 12, 16, 0.55);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 18px; animation: hwmaskin 0.25s ease;
}
@keyframes hwmaskin { from { opacity: 0; } to { opacity: 1; } }
.hwnmask.fade { opacity: 0; transition: opacity 0.5s; }
.hwn {
  width: min(640px, 96vw); max-height: 88vh; overflow: auto;
  background: #fff; border-radius: 30px; padding: 24px 22px 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  animation: hwpop 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes hwpop {
  from { transform: scale(0.92) translateY(12px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.hwn-top { display: flex; align-items: center; justify-content: center; gap: 10px; }
.hwn-ico {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0, 122, 255, 0.12); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
}
.hwn-title { font-size: 20px; font-weight: 700; }
.hwn-sub { text-align: center; color: var(--sub); font-size: 12.5px; margin-top: 4px; }
.hwn-block {
  margin-top: 16px; background: #f7f7fa;
  border-radius: 16px; padding: 12px 14px;
}
.hwn-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.hwn-name { font-size: 17px; font-weight: 700; }
.hwn-meta {
  margin-left: auto; font-size: 11.5px; color: #a0a0a6;
  display: flex; gap: 8px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.hwn-row {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 7px 0; border-top: 0.5px solid rgba(60, 60, 67, 0.06);
}
.hwn-row:first-of-type { border-top: 0; }
.hwn-dot { width: 6px; height: 6px; border-radius: 50%; background: #c7c7cc; flex: 0 0 auto; margin-top: 8px; }
.hwn-tx { flex: 1; min-width: 0; }
.hwn-t { font-weight: 600; font-size: 14px; }
.hwn-x { font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: #333; }
.hwn-r { display: inline-block; margin-top: 3px; font-size: 12px; color: var(--sub); }
.hwn-delrow { font-size: 13px; color: var(--sub); padding: 4px 0; }
.hwn-cap {
  display: block; font-size: 11.5px; color: var(--sub2);
  margin: 12px 0 2px; letter-spacing: 0.03em; font-variant-numeric: tabular-nums;
}
.hwn-block > .hwn-cap:first-child { margin-top: 6px; }
.hwn-ok { width: 100%; margin-top: 18px; padding: 13px; font-size: 16px; font-weight: 600; border-radius: 14px; }
.hwn-auto { text-align: center; font-size: 11px; color: #b9b9c0; margin-top: 9px; }

@media (max-width: 720px) {
  .hwn { padding: 20px 16px 14px; }
  .hwn-title { font-size: 18px; }
}
