/* ============================================================
 * 教学复盘工作台 · 样式
 * 色值全部来自 /shared/tokens.css（引入顺序在本文件之前），不自建 :root
 * 零外部依赖：不引 CDN、不引字体
 * ============================================================ */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background .22s ease, color .22s ease;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.hide { display: none !important; }

/* ============================================================ 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 18px; height: 60px; }

.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; flex: 0 0 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--p-600) 0%, var(--p-500) 100%);
  color: #fff; font-weight: 700; font-size: 12.5px; letter-spacing: .5px;
  font-family: var(--mono);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.24; }
.brand-text strong { font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.brand-text em {
  font-style: normal; font-size: 11.5px; color: var(--text-3);
  letter-spacing: .2px; margin-top: 1px;
}

.tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.who {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 11px 5px 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--card);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .16s, background .16s;
}
.who:hover, .who:focus-visible { border-color: var(--p-500); background: var(--p-050); outline: none; }
.who i {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--p-100); color: var(--p-700);
  font-style: normal; font-weight: 700; font-size: 11.5px;
}
.who b { font-weight: 600; }
.who em { font-style: normal; color: var(--text-3); font-size: 11.5px; }

.icon-btn {
  width: 34px; height: 34px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  transition: background .16s, border-color .16s, color .16s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }

.link-btn {
  border: 0; background: none; padding: 6px 8px;
  color: var(--text-3); font-size: 13px; cursor: pointer; border-radius: 7px;
}
.link-btn:hover { color: var(--text); background: var(--bg-soft); }

/* ============================================================ 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 14px; font-weight: 550;
  cursor: pointer;
  transition: background .16s, border-color .16s, transform .06s, box-shadow .16s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn.primary {
  background: var(--p-btn); border-color: var(--p-btn); color: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.10);
}
.btn.primary:hover:not(:disabled) { background: var(--p-btn-h); border-color: var(--p-btn-h); }
.btn.primary:disabled { box-shadow: none; }

.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--no-700); border-color: var(--no-line); }
.btn.danger:hover { background: var(--no-100); }

.btn .spin {
  width: 13px; height: 13px; flex: 0 0 13px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================ 登录页 */
.gate {
  min-height: calc(100vh - 60px);
  display: grid; place-items: center;
  padding: 40px 20px 64px;
}
.gate-card {
  width: 100%; max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: 30px 28px 26px;
}
.gate-card h1 {
  margin: 0 0 6px; font-size: 20px; font-weight: 680; letter-spacing: -.2px;
}
.gate-card .sub { margin: 0 0 22px; color: var(--text-3); font-size: 13px; }

.field { margin-bottom: 14px; }
.field label {
  display: block; margin-bottom: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); letter-spacing: .2px;
}
.input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  transition: border-color .16s, background .16s, box-shadow .16s;
}
.input:focus {
  outline: none; border-color: var(--p-500);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--p-050);
}
.input::placeholder { color: var(--text-3); }

.gate-card .btn.primary { width: 100%; padding: 11px; margin-top: 6px; }

.msg {
  margin: 12px 0 0; padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid transparent;
  white-space: pre-wrap;
}
.msg.err { background: var(--no-100); border-color: var(--no-line); color: var(--no-700); }
.msg.ok  { background: var(--ok-100); border-color: var(--ok-line); color: var(--ok-700); }
.msg.info{ background: var(--p-050);  border-color: var(--p-100);  color: var(--p-700); }

.gate-foot {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px; color: var(--text-3);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.gate-foot button {
  border: 0; background: none; padding: 0;
  color: var(--brand); font-size: 12.5px; cursor: pointer;
}
.gate-foot button:hover { text-decoration: underline; }

.tip {
  margin-top: 14px;
  font-size: 12px; color: var(--text-3); line-height: 1.6;
}

/* ============================================================ 工作台布局 */
.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px;
  gap: 22px;
  align-items: start;
  padding: 24px 0 60px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: 16px; }
.card-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.card-hd h2 {
  margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: .1px;
}
.card-hd .hd-note { margin-left: auto; font-size: 12px; color: var(--text-3); }
.card-bd { padding: 16px 18px 18px; }
.card-bd.tight { padding: 12px 18px 16px; }

/* ---------- 课程信息条 ---------- */
.meta-row {
  display: grid;
  grid-template-columns: 150px 104px 104px minmax(0,1fr);
  gap: 12px;
}
.meta-row .field { margin-bottom: 0; }

/* 下拉：自绘箭头（select 的原生箭头各端长得不一样） */
select.input {
  appearance: none; -webkit-appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23636B7A' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  cursor: pointer;
}
select.input:focus { background-color: var(--card); }

/* ---------- 课堂照片 ---------- */
.ph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}
.ph-grid:empty { display: none; }
.ph-tile {
  position: relative;
  padding-top: 75%;
  border-radius: 9px;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.ph-tile img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  cursor: zoom-in;
}
.ph-x {
  position: absolute; top: 5px; right: 5px;
  width: 23px; height: 23px; padding: 0;
  border: 0; border-radius: 50%;
  background: rgba(15, 18, 24, .58);
  color: #fff; font-size: 15px; line-height: 1;
  display: grid; place-items: center;
  cursor: pointer;
}
.ph-x:hover { background: var(--no-600); }
.ph-up {
  display: grid; place-items: center;
  color: var(--text-3);
  font-size: 11.5px;
}
.ph-up .spin { width: 16px; height: 16px; margin-bottom: 6px; }
.ph-foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px;
}
.ph-foot .hint { margin: 0; }
.ph-add input { display: none; }
.ph-add.off { opacity: .5; pointer-events: none; }

.lightbox {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(10, 12, 16, .84);
  display: grid; place-items: center;
  padding: 24px; cursor: zoom-out;
}
.lightbox img {
  max-width: 100%; max-height: 100%;
  border-radius: 10px;
  box-shadow: var(--shadow-3);
}

/* ---------- 五项评分 ---------- */
.score-item {
  display: grid;
  grid-template-columns: 76px minmax(0,1fr) 46px;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
}
.score-item + .score-item { border-top: 1px dashed var(--line-soft); }
.score-item > .nm { font-size: 13.5px; color: var(--text-2); font-weight: 550; }

.bar { display: flex; gap: 4px; }
.bar button {
  flex: 1 1 0; min-width: 0;
  height: 30px; padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-3);
  font-size: 12px; font-style: normal;
  cursor: pointer;
  transition: background .13s, border-color .13s, color .13s, transform .06s;
}
.bar button:hover { border-color: var(--p-500); color: var(--p-700); }
.bar button:active { transform: translateY(1px); }
.bar button.fill {
  background: var(--p-100); border-color: color-mix(in srgb, var(--p-500) 45%, var(--line));
  color: var(--p-700);
}
.bar button.on {
  background: var(--p-btn); border-color: var(--p-btn); color: #fff; font-weight: 650;
  box-shadow: 0 1px 3px rgba(16,24,40,.14);
}

.score-val {
  text-align: right; font-family: var(--mono);
  font-size: 13px; color: var(--text-3);
}
.score-val b { color: var(--text); font-size: 15px; }
.score-val.low b { color: var(--no-700); }
.score-val.mid b { color: var(--warn-700); }
.score-val.high b { color: var(--ok-700); }

/* ---------- 文本区 ---------- */
.ta-wrap { position: relative; }
textarea.input {
  resize: vertical; min-height: 106px; line-height: 1.7;
  padding-bottom: 26px;
}
.counter {
  position: absolute; right: 18px; bottom: 6px;
  font-size: 11.5px; color: var(--text-3);
  font-family: var(--mono);
  pointer-events: none;
  background: linear-gradient(to right, transparent, var(--bg) 14px);
  padding-left: 14px;
}
textarea.input:focus + .counter { background: linear-gradient(to right, transparent, var(--card) 14px); }

/* ---------- 右栏 ---------- */
.rail { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 10px; }
.rail .btn { width: 100%; }
.rail .btn.primary { padding: 12px 14px; font-size: 14.5px; }
.rail-sep { height: 1px; background: var(--line); margin: 4px 0; }
.rail-mini {
  font-size: 11.5px; color: var(--text-3); line-height: 1.55;
  padding: 0 4px;
}

/* 五项均分小条 */
.mini-avg { padding: 12px 14px; }
.mini-avg h3 {
  margin: 0 0 10px; font-size: 12px; font-weight: 650;
  color: var(--text-3); letter-spacing: .4px;
}
.mini-avg .row {
  display: grid; grid-template-columns: 52px minmax(0,1fr) 30px;
  align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--text-3);
  margin-bottom: 6px;
}
.mini-avg .row:last-child { margin-bottom: 0; }
.mini-avg .track {
  height: 5px; border-radius: 3px; background: var(--bg-soft); overflow: hidden;
}
.mini-avg .track i {
  display: block; height: 100%; border-radius: 3px;
  background: var(--p-500);
  transition: width .4s cubic-bezier(.4,0,.2,1);
}
.mini-avg .row b { font-family: var(--mono); font-weight: 600; color: var(--text-2); text-align: right; }

/* ============================================================ AI 点评 */
.ai-card { border-color: color-mix(in srgb, var(--p-500) 32%, var(--line)); }
.ai-card .card-hd { background: var(--p-050); border-radius: var(--r-md) var(--r-md) 0 0; }
.ai-card .card-hd h2 { color: var(--p-700); }
.ai-tag {
  font-size: 11px; font-weight: 650; letter-spacing: .3px;
  padding: 2px 7px; border-radius: var(--r-pill);
  background: var(--p-100); color: var(--p-700);
}

.ai-summary {
  margin: 0 0 18px;
  font-size: 14.5px; line-height: 1.85; color: var(--text);
  padding-left: 13px;
  border-left: 3px solid var(--p-500);
}

.ai-dims { display: grid; gap: 2px; margin-bottom: 20px; }
.ai-dim {
  display: grid; grid-template-columns: 76px 62px minmax(0,1fr);
  gap: 12px; align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 13px;
}
.ai-dim:last-child { border-bottom: 0; }
.ai-dim .nm { color: var(--text-2); font-weight: 600; }
.ai-dim .sc {
  font-family: var(--mono); font-size: 12.5px; font-weight: 650;
  padding: 1px 0;
}
.ai-dim .sc.low { color: var(--no-700); }
.ai-dim .sc.mid { color: var(--warn-700); }
.ai-dim .sc.high { color: var(--ok-700); }
.ai-dim .rd { color: var(--text-2); line-height: 1.7; }

.ai-block { margin-bottom: 20px; }
.ai-block:last-child { margin-bottom: 0; }
.ai-block h4 {
  margin: 0 0 9px; font-size: 12px; font-weight: 700;
  letter-spacing: .6px; color: var(--text-3); text-transform: uppercase;
}
.ai-block ul { margin: 0; padding: 0; list-style: none; }
.ai-block li {
  position: relative; padding-left: 18px; margin-bottom: 8px;
  font-size: 13.5px; line-height: 1.8; color: var(--text-2);
}
.ai-block li:last-child { margin-bottom: 0; }
.ai-block li::before {
  content: ''; position: absolute; left: 4px; top: .72em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--p-500);
}
.ai-block.gaps li::before { background: var(--warn-600); }

.act {
  display: grid; grid-template-columns: 26px minmax(0,1fr);
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line-soft);
}
.act:first-of-type { border-top: 0; padding-top: 2px; }
.act .no {
  width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--p-100); color: var(--p-700);
  font-family: var(--mono); font-size: 12px; font-weight: 700;
}
.act h5 { margin: 1px 0 5px; font-size: 13.5px; font-weight: 650; }
.act p { margin: 0 0 5px; font-size: 13.5px; line-height: 1.8; color: var(--text-2); }
.act .chk {
  display: inline-block; margin-top: 3px;
  font-size: 12.5px; line-height: 1.7; color: var(--ok-700);
  background: var(--ok-100); border: 1px solid var(--ok-line);
  border-radius: 7px; padding: 4px 9px;
}
.act .chk b { font-weight: 650; }

.ai-next {
  margin-top: 16px; padding: 13px 15px;
  background: var(--p-050); border: 1px solid var(--p-100);
  border-radius: 10px;
  font-size: 13.5px; line-height: 1.8; color: var(--p-900);
}
.ai-next b { display: block; font-size: 11.5px; letter-spacing: .5px; color: var(--p-700); margin-bottom: 4px; }

.ai-rewrite { display: grid; gap: 10px; }
.rw {
  padding: 11px 13px; border-radius: 9px;
  background: var(--bg-soft);
  font-size: 13px; line-height: 1.8; color: var(--text-2);
}
.rw b { display: block; font-size: 11.5px; letter-spacing: .4px; color: var(--text-3); margin-bottom: 4px; }

.ai-empty {
  padding: 26px 18px; text-align: center;
  color: var(--text-3); font-size: 13.5px; line-height: 1.9;
}

.ai-loading {
  padding: 34px 18px; text-align: center; color: var(--text-3); font-size: 13.5px;
}
.ai-loading .dots { display: inline-flex; gap: 5px; margin-bottom: 12px; }
.ai-loading .dots i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--p-500);
  animation: bounce 1.1s ease-in-out infinite;
}
.ai-loading .dots i:nth-child(2) { animation-delay: .16s; }
.ai-loading .dots i:nth-child(3) { animation-delay: .32s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .45; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* ============================================================ 历史 */
.hist-list { display: flex; flex-direction: column; }
.hist-item {
  display: grid; grid-template-columns: 84px minmax(0,1fr) auto;
  gap: 14px; align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .14s;
  text-align: left; width: 100%;
  border-left: 0; border-right: 0; border-bottom: 0;
  background: none;
}
.hist-item:first-child { border-top: 0; }
.hist-item:hover { background: var(--bg-soft); }
.hist-item .d {
  font-family: var(--mono); font-size: 12px; color: var(--text-3);
}
.hist-item .t { min-width: 0; }
.hist-item .t strong {
  display: block; font-size: 13.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hist-item .t span { font-size: 12px; color: var(--text-3); }
.hist-item .s {
  font-family: var(--mono); font-size: 12px; font-weight: 650;
  padding: 3px 8px; border-radius: var(--r-pill);
  background: var(--bg-soft); color: var(--text-2);
}
.hist-item .s.has { background: var(--p-100); color: var(--p-700); }

.empty {
  padding: 46px 20px; text-align: center; color: var(--text-3); font-size: 13.5px; line-height: 1.9;
}
.empty b { display: block; font-size: 14.5px; color: var(--text-2); margin-bottom: 4px; }

/* ============================================================ 个人资料 / 教研组 */
.pf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin-bottom: 4px;
}
.pf-grid .field { margin-bottom: 0; }
.pf-grid .full { grid-column: 1 / -1; }
.pf-grid .input[disabled] { color: var(--text-3); background: var(--bg-soft); cursor: not-allowed; }

.pf-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; height: 36px; }
.switch { position: relative; width: 40px; height: 22px; flex: 0 0 40px; }
.switch input {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: pointer;
}
.switch i {
  position: absolute; inset: 0;
  border-radius: var(--r-pill);
  background: var(--line);
  transition: background .18s;
}
.switch i::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .18s;
}
.switch input:checked + i { background: var(--p-600); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--p-500); outline-offset: 2px; }
.sw-txt { font-size: 13.5px; color: var(--text-2); }

.grp-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.grp-item:last-of-type { border-bottom: 0; }
.grp-ava {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--p-100); color: var(--p-700);
  font-size: 13px; font-weight: 700;
}
.grp-name { font-size: 14px; font-weight: 600; }
.grp-meta { margin-left: auto; font-size: 12px; color: var(--text-3); }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 650;
  background: var(--warn-100); color: var(--warn-700);
  border: 1px solid var(--warn-line);
}
.badge.ok { background: var(--p-100); color: var(--p-700); border-color: transparent; }

/* ============================================================ 杂项 */
.skeleton {
  height: 14px; border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--line) 50%, var(--bg-soft) 75%);
  background-size: 200% 100%;
  animation: sk 1.3s linear infinite;
}
@keyframes sk { to { background-position: -200% 0; } }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(14px);
  z-index: 200;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: #1B1F29; color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-3);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 40px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-theme="dark"] .toast { background: #2B323D; }

.foot {
  padding: 26px 0 34px;
  border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--text-3);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.foot .dot { opacity: .5; }

/* ============================================================ 响应式 */
@media (max-width: 900px) {
  .studio { grid-template-columns: minmax(0,1fr); }
  /* 手机上动作条放到表单后面：先填再提交；主按钮单独吸在底部，随时能点 */
  .rail { position: static; order: 2; margin-top: 4px; }
  .rail .btn.primary {
    position: fixed; left: 14px; right: 14px; bottom: 14px; z-index: 60;
    width: auto; padding: 14px; border-radius: 12px;
    box-shadow: 0 6px 22px rgba(16,24,40,.24);
  }
  body { padding-bottom: 74px; }
  .toast { bottom: 86px; }
  .meta-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .meta-row .field:nth-child(4) { grid-column: 1 / -1; }
  .cls-x-row { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .wrap { padding: 0 14px; }
  .brand-text em { display: none; }
  .who em { display: none; }
  .pf-grid { grid-template-columns: minmax(0,1fr); }
  .grp-meta { margin-left: 8px; text-align: right; flex: 1 1 auto; }
  /* 窄屏：标签和分数占一行，10 个格子铺满整行（5+5），每个约 60px 好点 */
  .score-item {
    grid-template-columns: minmax(0,1fr) auto;
    grid-template-areas: "nm val" "bar bar";
    row-gap: 7px; column-gap: 9px;
    padding: 11px 0;
  }
  .score-item > .nm { grid-area: nm; }
  .score-item > .bar { grid-area: bar; }
  .score-item > .score-val { grid-area: val; }
  .bar { flex-wrap: wrap; gap: 4px; }
  .bar button { flex: 0 0 calc(20% - 3.2px); height: 34px; font-size: 12.5px; }
  .ai-dim { grid-template-columns: 72px 54px minmax(0,1fr); gap: 8px; }
  .hist-item { grid-template-columns: 70px minmax(0,1fr) auto; gap: 9px; padding: 11px 14px; }
  .card-bd { padding: 14px; }
  .card-hd { padding: 12px 14px; }
}

/* ============================================================ 打印 / 导出 PDF */
@media print {
  :root {
    --bg: #fff; --card: #fff; --bg-soft: #F7F8FA;
    --text: #000; --text-2: #222; --text-3: #555;
    --line: #ccc; --line-soft: #e2e2e2;
    --p-050: #F4F7FF; --p-100: #E8EFFF; --p-700: #1747B8; --p-900: #0B2C6B;
    --ok-100: #EAF7EF; --ok-line: #BCE7CE; --ok-700: #0E7A3D;
  }
  .topbar, .rail, .foot, .no-print, .toast, .lightbox, .ph-x, .ph-foot { display: none !important; }
  .studio { display: block; padding: 0; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .card + .card { margin-top: 12px; }
  .ph-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .ph-tile { border-color: #ccc; }
  textarea.input {
    border: 0; padding: 0; min-height: 0; height: auto;
    background: none; font-size: 13px;
  }
  .counter, .bar button { display: none; }
  .score-item { grid-template-columns: 76px auto; }
  .ai-card .card-hd { background: none; }
  body { font-size: 12.5px; }
  @page { margin: 16mm 14mm; }
}
