/* 上海中考物理复习站 —— 纯静态样式（无外部依赖，离线可用） */
:root {
  --bg: #f6f8fd;
  --card: #ffffff;
  --ink: #1e293b;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-weak: #eff6ff;
  --green: #16a34a;
  --green-weak: #f0fdf4;
  --red: #dc2626;
  --red-weak: #fef2f2;
  --amber: #d97706;
  --amber-weak: #fffbeb;
  --violet: #7c3aed;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .07), 0 4px 14px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.65; font-size: 15.5px;
}
button { font-family: inherit; }

/* ---------- 全站一级入口与科目内二级导航 ---------- */
[hidden] { display: none !important; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar-inner { max-width: 1020px; margin: 0 auto; padding: 12px 16px 0; }
.brand-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { font-weight: 700; font-size: 17px; }
.global-utilities { display: flex; flex-shrink: 0; }
.utility-btn { border: 1px solid transparent; border-radius: 7px; background: none; color: var(--ink-2); font: inherit; font-size: 12px; padding: 7px 9px; cursor: pointer; }
.utility-btn:hover, .utility-btn[aria-current="page"] { color: var(--brand); background: var(--brand-weak); }
.global-controls { display: grid; grid-template-columns: minmax(220px, .9fr) minmax(0, 1.5fr); align-items: start; gap: 20px; padding: 10px 0 12px; }
.subject-control label { display: block; font-size: 11px; font-weight: 700; color: var(--ink-2); margin-bottom: 3px; }
.subject-picker-row { display: flex; align-items: center; gap: 4px; }
.subject-picker-row select { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; border-color: #cbd5e1; background: #f8fafc; min-height: 42px; }
.subject-picker-row .utility-btn { flex-shrink: 0; }
.subject-navigation { display: flex; align-items: center; gap: 14px; border-top: 1px solid var(--line); padding: 9px 0; }
.subject-nav-label { font-size: 12px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
#mainNav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-btn { border: 1px solid transparent; background: transparent; color: var(--ink-2); padding: 7px 10px; border-radius: 7px; font-size: 14px; cursor: pointer; }
.nav-btn:hover { background: var(--brand-weak); color: var(--brand); }
.nav-btn.active { background: var(--brand); color: #fff; font-weight: 600; }
:where(button, a, summary, select, input):focus-visible { outline: 3px solid #60a5fa; outline-offset: 3px; }
.skip-link { position: fixed; top: -80px; left: 12px; padding: 10px 16px; background: var(--ink); color: #fff; z-index: 100; border-radius: 8px; }
.skip-link:focus { top: 8px; }
#app:focus { outline: none; }
.subject-intro { padding: 16px 0 22px; }
.section-kicker { color: var(--brand); font-size: 12px; font-weight: 700; }
.subject-intro h1 { font-size: clamp(23px, 4vw, 30px); margin: 4px 0; }
.subject-intro p { color: var(--ink-2); font-size: 14px; }
.subject-card { border-top: 4px solid var(--subject-color); }
.subject-card .row:first-child { align-content: start; }
.subject-card .row:first-child > div { width: 100%; }
.subject-card h2 .muted { display: block; font-weight: 400; margin-top: 2px; }

main { max-width: 1020px; margin: 0 auto; padding: 18px 16px 60px; }
.site-footer { max-width: 1020px; margin: 0 auto; padding: 18px 16px 40px; color: var(--ink-3); font-size: 12.5px; }

/* ---------- 通用 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 17px; margin-bottom: 10px; }
.card h3 { font-size: 15.5px; margin: 12px 0 6px; }
.muted { color: var(--ink-3); font-size: 13px; }
.small { font-size: 13.5px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }

.btn {
  display: inline-block; border: 1px solid var(--brand); background: var(--brand); color: #fff;
  padding: 8px 18px; border-radius: 9px; font-size: 14.5px; cursor: pointer; line-height: 1.4;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: #fff; color: var(--brand); }
.btn.green { border-color: var(--green); background: var(--green); }
.btn.green.ghost { background: #fff; color: var(--green); }
.btn.red { border-color: var(--red); background: var(--red); }
.btn.red.ghost { background: #fff; color: var(--red); }
.btn.sm { padding: 4px 12px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.tag { display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--line); background: #f8fafc; color: var(--ink-2); white-space: nowrap; }
.tag.d1 { background: var(--green-weak); color: var(--green); border-color: #bbf7d0; }
.tag.d2 { background: var(--amber-weak); color: var(--amber); border-color: #fde68a; }
.tag.d3 { background: var(--red-weak); color: var(--red); border-color: #fecaca; }
.tag.mod { font-weight: 600; }
input[type="text"], input[type="number"], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 14.5px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--brand); }
textarea { width: 100%; resize: vertical; }
hr.sep { border: none; border-top: 1px dashed var(--line); margin: 14px 0; }

/* ---------- 首页 ---------- */
.hero { background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 55%, #3b82f6 100%); color: #fff; border: none; }
.hero h1 { font-size: 21px; margin-bottom: 6px; }
.hero p { color: #dbeafe; font-size: 13.5px; }
.stat-num { font-size: 26px; font-weight: 700; }
.stat-card { text-align: center; padding: 14px 8px; }
.stat-card .label { color: var(--ink-3); font-size: 13px; }

.scorebar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; font-size: 12px; color: #fff; margin: 8px 0 6px; }
.scorebar div { display: flex; align-items: center; justify-content: center; min-width: 30px; white-space: nowrap; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 13px; color: var(--ink-2); }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

table.exam-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.exam-table th, table.exam-table td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
table.exam-table th { background: #f8fafc; font-weight: 600; }

/* ---------- 知识点 ---------- */
.mod-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.mod-tab {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 16px;
  cursor: pointer; font-size: 14.5px; color: var(--ink-2);
}
.mod-tab.active { color: #fff; font-weight: 600; }
.kp-card { margin-bottom: 12px; overflow: hidden; }
.kp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer; }
.kp-head h3 { font-size: 16px; margin: 0; }
.kp-score { text-align: right; white-space: nowrap; }
.kp-score b { font-size: 18px; }
.kp-body { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 12px; }
.kp-body ul { padding-left: 20px; }
.kp-body li { margin: 3px 0; }
.mis-item { background: var(--red-weak); border: 1px solid #fecaca; border-radius: 9px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }
.mis-item b.fix { color: var(--green); }
.ways-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 6px; }
.way { border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; font-size: 14px; background: #fafbfd; }
.way .w-tag { font-weight: 700; margin-right: 8px; }
.way.b .w-tag { color: var(--green); } .way.m .w-tag { color: var(--amber); } .way.h .w-tag { color: var(--red); }
.formula-chip { display: inline-block; background: #f1f5f9; border: 1px solid var(--line); border-radius: 7px; padding: 2px 10px; margin: 2px 6px 2px 0; font-family: Cambria, "Times New Roman", serif; font-size: 15px; }
.linklike { color: var(--brand); cursor: pointer; text-decoration: underline; background: none; border: none; font-size: inherit; padding: 0; }

/* ---------- 练习 ---------- */
.quiz-head { position: sticky; top: var(--qh-top, 54px); z-index: 40; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 16px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.q-block { margin-bottom: 16px; padding: 18px; }
.q-block .q-no { font-weight: 700; margin-right: 6px; }
.q-stem { margin-bottom: 10px; }
.q-stem-text { white-space: pre-line; }
.q-figure { margin: 10px 0; text-align: center; }
.q-figure svg { max-width: 100%; height: auto; }
.opt { display: flex; gap: 9px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 12px; margin: 7px 0; cursor: pointer; }
.opt:hover { border-color: var(--brand); background: var(--brand-weak); }
.opt.sel { border-color: var(--brand); background: var(--brand-weak); }
.opt input { margin-top: 4px; }
.blank-input { display: inline-block; width: 130px; text-align: center; margin: 0 4px; padding: 4px 8px; border: none; border-bottom: 1.5px solid var(--ink-3); border-radius: 0; font-size: 16px; }
.blank-input:focus { outline: none; border-bottom-color: var(--brand); }
.part-q { margin: 8px 0; }
.sub-res { border-radius: 6px; padding: 0 4px; }
.sub-ok { background: var(--green-weak); box-shadow: 0 0 0 1px #bbf7d0 inset; }
.sub-bad { background: var(--red-weak); box-shadow: 0 0 0 1px #fecaca inset; }
.explain { background: var(--brand-weak); border: 1px solid #bfdbfe; border-radius: 9px; padding: 10px 14px; margin-top: 10px; font-size: 14px; }
.explain b { color: var(--brand); }
.ans-ok { color: var(--green); font-weight: 600; }
.ans-bad { color: var(--red); font-weight: 600; }
.result-banner { text-align: center; padding: 18px; }
.result-banner .big { font-size: 34px; font-weight: 800; }
.fig-toggle { background: none; border: none; color: var(--brand); cursor: pointer; text-decoration: underline; font-size: 13.5px; }

/* ---------- 错题本 ---------- */
.wrong-item { border-left: 4px solid var(--red); }
.wrong-item.mastered { border-left-color: var(--green); opacity: .82; }
.wrong-meta { color: var(--ink-3); font-size: 12.5px; margin-top: 6px; }
.manual-card { border-left: 4px solid var(--violet); }
details.reveal { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
details.reveal summary { cursor: pointer; color: var(--brand); font-size: 13.5px; }

/* ---------- toast ---------- */
#toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; padding: 9px 20px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 99; max-width: 86vw; }
#toast.show { opacity: .95; }

/* ---------- 答题进度条与题号跳转 ---------- */
.quiz-head { flex-wrap: wrap; top: var(--qh-top, 54px); }
.prog-wrap { flex-basis: 100%; height: 6px; border-radius: 4px; background: #e2e8f0; overflow: hidden; margin-top: 4px; }
.prog-bar { height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); border-radius: 4px; transition: width .3s; }
.q-chips { flex-basis: 100%; display: flex; gap: 5px; flex-wrap: nowrap; overflow-x: auto; padding: 4px 0 2px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.q-chip { min-width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 12.5px; cursor: pointer; flex: 0 0 auto; }
.q-chip.done { background: var(--green-weak); border-color: #bbf7d0; color: var(--green); font-weight: 700; }
.q-chip.bad { background: var(--red-weak); border-color: #fecaca; color: var(--red); }

/* ---------- 模块掌握度 ---------- */
.m-bar { display: inline-block; width: 64px; height: 8px; border-radius: 5px; background: #e2e8f0; overflow: hidden; vertical-align: middle; }
.m-bar > span { display: block; height: 100%; border-radius: 5px; }

/* ---------- 专项背记（闪卡） ---------- */
.flash-card {
  margin: 14px 0; min-height: 170px; border-radius: var(--radius); cursor: pointer;
  border: 2px solid var(--line); background: #fff; display: flex; align-items: center; justify-content: center;
  padding: 22px 18px; text-align: center; font-size: 17.5px; line-height: 1.7; transition: border-color .2s, box-shadow .2s;
}
.flash-card:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.flash-card.flipped { background: var(--brand-weak); border-color: #bfdbfe; cursor: default; }
.flash-card .flash-front, .flash-card .flash-back { max-width: 640px; white-space: pre-wrap; }
.flash-card .flash-back { color: var(--ink); font-weight: 500; }
.flash-card:not(.flipped) .flash-back { display: none; }
.flash-card.flipped .flash-front { display: none; }
.opt[role="button"]:focus-visible, .kp-head:focus-visible, .flash-card:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
.opt[aria-disabled="true"] { cursor: default; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* 首页倒计时：大号日数、分段时钟、铜色时间线。 */
/* A quiet, global timer. Editing expands only when explicitly opened. */
.countdown { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 8px; border-left: 1px solid var(--line); padding: 4px 0 4px 20px; color: var(--ink-2); }
.cd-summary { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
#countdown-title { font-size: 12px; white-space: nowrap; }
.cd-display { display: inline-flex; gap: 4px; align-items: baseline; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.cd-display strong { font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--brand); }
.cd-clock { font-size: 11px; margin-left: 4px; }
.cd-clock b { font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 600; }
.cd-note { color: var(--ink-2); font-size: 11px; line-height: 1.6; }
.cd-target { grid-column: 1/-1; }
.cd-phase { color: var(--green); font-size: 11px; }
.cd-phase:empty { display: none; }
.cd-settings { font-size: 12px; }
.cd-settings summary { color: var(--brand); cursor: pointer; padding: 4px; }
.cd-settings[open] { grid-column: 1/-1; grid-row: 3; margin-top: 5px; }
.cd-settings form { padding: 8px 0; }
.cd-settings label { color: var(--ink-2); font-size: 13px; }
.cd-settings input { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 6px; max-width: 170px; }
.cd-error { color: var(--red); font-size: 12px; }
.review-guide ol { padding-left: 22px; }
.review-guide li { margin: 7px 0; }
.coverage-note { background: #fffbeb; border: 1px solid #fde68a; padding: 12px 14px; border-radius: 9px; font-size: 13px; margin-bottom: 14px; color: #713f12; }
.writing-ref { margin-top: 8px; padding: 10px 12px; background: #fafbfd; border-radius: 8px; font-size: 14px; line-height: 1.8; }

/* ---------- 回到顶部 ---------- */
.to-top { position: fixed; right: 18px; bottom: 22px; width: 40px; height: 40px; border-radius: 50%; border: none; background: #1e293b; color: #fff; font-size: 18px; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 90; box-shadow: var(--shadow); }
.to-top.show { opacity: .88; pointer-events: auto; }
.to-top:hover { background: var(--brand); }

/* ---------- 面包屑导航 ---------- */
.crumb { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0 0; color: var(--ink-3); font-size: 13px; }
.crumb-link { color: var(--brand); border: none; background: none; font: inherit; cursor: pointer; padding: 2px 0; }
.crumb-path .crumb-sep { margin: 0 4px; color: var(--ink-3); }

/* ---------- 手机竖屏适配 ---------- */
@media (max-width: 760px) {
  .topbar { position: static; }
  .topbar-inner { padding: 8px 10px 0; }
  .global-controls { grid-template-columns: 1fr; gap: 8px; padding: 8px 0; }
  .subject-control { display: flex; align-items: center; gap: 8px; }
  .subject-control label { margin: 0; flex-shrink: 0; }
  .subject-picker-row { flex: 1; min-width: 0; }
  .subject-picker-row select { font-size: 15px; min-height: 40px; }
  .countdown { padding: 6px 0 0; border-left: none; border-top: 1px dashed var(--line); }
  .cd-display strong { font-size: 18px; }
  .subject-navigation { display: block; padding: 7px 0; }
  .subject-nav-label { margin-bottom: 4px; }
  .nav-btn { min-height: 38px; }
  .utility-btn { min-height: 36px; }
  .subject-intro { padding: 8px 0 16px; }
  .brand { font-size: 15px; }
  .nav-btn { padding: 5px 10px; font-size: 13.5px; }
  main { padding: 12px 10px 44px; }
  .card { padding: 14px; }
  .card h2 { font-size: 16px; }
  table.exam-table { font-size: 13px; }
  table.exam-table th, table.exam-table td { padding: 5px 7px; }
  .quiz-head { padding: 8px 10px; }
  .btn { padding: 7px 14px; font-size: 14px; }
  .flash-card { font-size: 16px; min-height: 150px; }
  .stat-num { font-size: 22px; }
}

/* ---------- 打印 ---------- */
@media print {
  .topbar, .site-footer, .btn, #toast, .no-print { display: none !important; }
  body { background: #fff; }
  main { max-width: 100%; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* ---------- 趣味闯关（游戏） ---------- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.game-card h2 { margin-bottom: 2px; }
.game-stars { color: #f59e0b; font-weight: 700; letter-spacing: 1px; white-space: nowrap; }
.g-hearts { font-size: 17px; letter-spacing: 2px; }

.game-lv-list { display: flex; flex-direction: column; gap: 10px; }
.game-lv {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 12px 14px;
  cursor: pointer; font-size: 15px; color: var(--ink); text-align: left; transition: border-color .15s;
}
.game-lv:not(:disabled):hover { border-color: var(--brand); background: var(--brand-weak); }
.game-lv:disabled { cursor: not-allowed; color: var(--ink-3); background: var(--bg); }
.game-lv-name { font-weight: 600; }

.match-wrap { display: flex; gap: 10px; align-items: flex-start; }
.match-col { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.match-item {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px;
  cursor: pointer; font-size: 14.5px; line-height: 1.5; color: var(--ink); text-align: left;
  transition: border-color .15s, background .15s; width: 100%;
}
.match-item:not(:disabled):hover { border-color: var(--brand); }
.match-item.sel { border-color: var(--brand); background: var(--brand-weak); font-weight: 600; }
.match-item.ok { border-color: #bbf7d0; background: var(--green-weak); color: var(--green); cursor: default; opacity: .7; }
.match-item.bad { border-color: var(--red); background: var(--red-weak); }
.gram-opt b { color: var(--ink-2); margin-right: 4px; }
.shake { animation: gshake .45s; }
@keyframes gshake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

.gram-sent { font-size: 16.5px; line-height: 1.8; }
.gram-blank { display: inline-block; min-width: 84px; border-bottom: 2px solid var(--ink-2); color: var(--brand); font-weight: 700; text-align: center; }
.gram-opts { display: grid; gap: 10px; }

.spell-clue { font-size: 18px; font-weight: 600; margin-top: 14px; color: var(--ink); }
.spell-input {
  flex: 1; min-width: 160px; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 17px; font-family: inherit;
}
.spell-input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }

.tile-area {
  min-height: 56px; border: 2px dashed var(--line); border-radius: 10px; padding: 8px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.tile-area.filled { border-style: solid; border-color: var(--brand); background: var(--brand-weak); }
.tile-pool { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tile {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 11px;
  cursor: pointer; font-size: 15px; color: var(--ink); transition: transform .1s, border-color .15s;
}
.tile:hover { border-color: var(--brand); }
.tile:active { transform: scale(.95); }

/* Persistent storage warning; independent of focused lesson/quiz input. */
.storage-status { position: sticky; top: var(--qh-top, 80px); z-index: 45; max-height: 55vh; overflow-y: auto; margin: 12px 0; padding: 14px; border: 2px solid #b45309; border-radius: 12px; color: #78350f; background: #fffbeb; }
.storage-status[hidden], .storage-status [hidden] { display: none !important; }
.storage-status p { margin: 8px 0; }
.lesson-draft-list { list-style: none; padding: 0; }
.lesson-draft-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line, #ddd); padding: 12px 0; overflow-wrap: anywhere; }
@media (max-width: 500px) { .lesson-draft-list li { align-items: flex-start; flex-direction: column; } }

/* Model and text production games: keyboard/touch equivalents, no drag-only input. */
.sg-model { border:1px solid var(--line); border-radius:14px; padding:16px; margin:14px 0; }
.sg-model-controls { display:flex; flex-wrap:wrap; align-items:end; gap:12px; }
.sg-field { display:flex; flex-direction:column; gap:6px; margin:12px 0; flex:1 1 200px; }
.sg-model input,.sg-model select,.sg-model textarea,.sg-text-workbench input,.sg-text-workbench textarea { box-sizing:border-box; max-width:100%; min-height:44px; padding:10px; font:inherit; color:var(--ink); background:var(--card); border:1px solid var(--line); border-radius:8px; }
.sg-model textarea,.sg-text-workbench textarea { width:100%; min-height:140px; line-height:1.7; }
.sg-expression { overflow-wrap:anywhere; padding:14px; background:var(--bg); border-radius:8px; font-size:1.15rem; }
.sg-expression-chain li { margin:10px 0; overflow-wrap:anywhere; }
.sg-checks { padding-left:22px; line-height:1.8; }
.sg-model table { border-collapse:collapse; width:100%; margin:12px 0; }
.sg-model th,.sg-model td { border:1px solid var(--line); padding:8px; text-align:left; }
.sg-model svg { display:block; max-width:100%; height:auto; }
.sg-model button:focus-visible,.sg-model input:focus-visible,.sg-model select:focus-visible,.sg-model textarea:focus-visible { outline:3px solid var(--brand); outline-offset:3px; }
@media(max-width:600px){.sg-model{padding:12px}.sg-model-controls{display:block}.sg-model-controls>.btn{margin:6px 6px 6px 0}.sg-field{min-width:0}.sg-model table{font-size:.85rem}}
