:root {
  color-scheme: light;
  --ink: #172f2b;
  --muted: #556b63;
  --pine: #174a3e;
  --pine-deep: #123b33;
  --mint: #e7f0e8;
  --canvas: #f5f5ef;
  --paper: #fffefa;
  --line: #d8dfd5;
  --gold: #ccaa61;
  --shadow: 0 12px 32px #173a2520;
  --sans: "Inter", "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --serif: "STIX Two Text", Georgia, "Noto Serif CJK SC", "Songti SC", SimSun, serif;
  font: 15px/1.55 var(--sans);
  color: var(--ink);
  background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
body:has(dialog[open]) { overflow: hidden; }
a { color: var(--pine); text-underline-offset: .22em; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, summary, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:where(button, a, input, textarea, select, summary, [contenteditable]):focus-visible {
  outline: 3px solid #818c41;
  outline-offset: 3px;
}
button:disabled { cursor: not-allowed; opacity: .48; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.28; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 38px; padding: .43rem .93rem; border: 1px solid #cdd7cd;
  border-radius: 7px; background: var(--paper); color: var(--ink);
  font-weight: 550; font-size: .91rem; line-height: 1.3; cursor: pointer;
  white-space: nowrap; text-decoration: none; transition: background .13s, border-color .13s;
}
.btn:hover:not(:disabled) { background: #edf1e9; border-color: #a6b8a7; }
.btn.primary, .btn.chosen, .btn[aria-pressed="true"] { color: white; background: var(--pine); border-color: var(--pine); }
.btn.primary:hover:not(:disabled), .btn.chosen:hover:not(:disabled) { background: #205f4e; border-color: #205f4e; }
.btn.outline { color: var(--pine); border-color: #8aa899; background: #f7faf4; }
.btn.small { min-height: 31px; font-size: .81rem; padding: .3rem .66rem; }
.btn.plain { background: transparent; border-color: transparent; color: var(--muted); }
.btn.plain:hover:not(:disabled) { background: var(--mint); border-color: transparent; }
input:not([type=checkbox]):not([type=radio]), textarea, select {
  min-width: 0; width: 100%; padding: .62rem .75rem; border: 1px solid #bac8bb;
  border-radius: 6px; background: #fff; color: var(--ink); line-height: 1.45;
}
textarea { resize: vertical; min-height: 70px; }
input::placeholder, textarea::placeholder { color: #78867c; }
input[type=file] { line-height: 1.8; overflow: hidden; }
input[type=file]::file-selector-button { color: var(--pine); background: var(--mint); border: 0; border-radius: 4px; padding: .3rem .65rem; margin-right: .6rem; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--pine); }
label { display: grid; gap: .33rem; font-weight: 560; font-size: .88rem; }
label.check { display: flex; align-items: center; gap: .55rem; cursor: pointer; font-weight: 450; }
:where(.formgrid, .modalbody form, .loginform form) > * { min-width: 0; }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.formhint { font-size: .86rem; line-height: 1.65; color: #745117; background: #fcf6e5; padding: .65rem .85rem; border-left: 2px solid var(--gold); }
.formerror, #exportStatus { font-size: .86rem; color: #963f2e; }
.formerror:empty, #exportStatus:empty { display: none; }
details > summary { cursor: pointer; color: var(--pine); font-weight: 600; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; white-space: nowrap; }
.brand b { font-size: 1.13rem; letter-spacing: .04em; }
.brandlight { font-weight: 450; opacity: .83; font-size: .88em; }
.brandmark { display: inline-flex; align-items: flex-end; gap: 3px; width: 34px; height: 34px; padding: 7px; background: #d8e9c8; border-radius: 7px; transform: rotate(-1deg); }
.brandmark i { width: 5px; background: var(--pine-deep); height: 80%; border-radius: 1px; }
.brandmark i:first-child { height: 62%; }
.brandmark i:last-child { height: 100%; transform: rotate(-12deg); transform-origin: bottom center; }
.icon { display: inline-grid; width: 1.3em; place-items: center; font: 1.24rem/1 Georgia, "Segoe UI Symbol", sans-serif; }

/* 登录页的纸张与图线是轻量 CSS 插画。 */
.login { min-height: 100svh; display: grid; grid-template-columns: minmax(340px, 1.12fr) minmax(330px, .88fr); }
.logincover { isolation: isolate; position: relative; overflow: hidden; display: grid; grid-template-rows: auto 1fr auto; min-height: 630px; padding: clamp(34px, 5.4vw, 88px); background: #153f35; color: #fcfaeb; }
.logincover::before { content: ""; position: absolute; z-index: -2; inset: 0; background: radial-gradient(ellipse at 25% 40%, #41634a88, transparent 72%), repeating-linear-gradient(0deg, #daecc508 0 1px, transparent 1px 32px), repeating-linear-gradient(90deg, #daecc508 0 1px, transparent 1px 32px); }
.logincover h1 { font: 650 clamp(39px, 4.3vw, 67px)/1.2 var(--serif); letter-spacing: .08em; }
.logincover p { margin-top: .75rem; color: #ceddca; font-size: 1.03rem; letter-spacing: .07em; }
.deskgraphic { width: clamp(230px, 29vw, 415px); aspect-ratio: 1.25; margin: 32px auto; align-self: center; position: relative; }
.sheetback, .sheetfront { position: absolute; width: 62%; height: 92%; border-radius: 2px; }
.sheetback { left: 13%; top: 9%; background: #b8c1a2; transform: rotate(-15deg) skewY(1deg); box-shadow: 7px 18px 22px #001e1b38; }
.sheetfront { left: 25%; top: 1%; overflow: hidden; transform: rotate(8deg) skewY(-1deg); background: #f2edda; color: #385348; padding: 10% 6% 6%; border-top: 5px solid #d4be86; box-shadow: 9px 21px 20px #001e1b42; }
.sheetfront::before { content: ""; display: block; position: absolute; top: -1%; right: 13%; width: 9%; height: 23%; background: #bd9f61; clip-path: polygon(0 0,100% 0,100% 100%,50% 81%,0 100%); }
.minititle { border-bottom: 1px solid #64735b; padding-bottom: 6%; font: 700 clamp(16px, 2.3vw, 32px)/1.2 var(--serif); letter-spacing: .13em; }
.rules { height: 15%; margin-top: 8%; background: repeating-linear-gradient(0deg, #899780 0 1px, transparent 1px 6px); opacity: .54; }
.rules.short { width: 64%; height: 8%; }
.equation { width: fit-content; font: italic clamp(24px,3.2vw,49px)/1.25 Georgia,serif; margin: 7% auto 0; }
.loginform { align-self: center; width: min(74%, 380px); margin: 45px auto; }
.loginform h2 { font: 650 clamp(26px, 3vw, 40px)/1.3 var(--serif); margin-bottom: 32px; }
.loginform form { display: grid; gap: 20px; }
.loginform .btn { margin-top: 4px; min-height: 46px; }
.loginform input:not([type=checkbox]) { min-height: 46px; }

/* 应用导航、讲义库与选题面板。 */
.layout { width: 100%; min-height: 100svh; display: grid; grid-template-columns: 208px minmax(0,1fr); }
.rail { position: sticky; top: 0; height: 100svh; min-height: 0; display: flex; flex-direction: column; padding: 29px 16px 15px; background: var(--pine-deep); color: #eff4e8; }
.rail .brand { padding: 0 8px; }
.rail nav { display: grid; gap: 4px; margin: 34px 0 20px; overflow-y: auto; }
.rail nav a { display: flex; align-items: center; gap: 12px; padding: 10px 13px; min-height: 42px; border-radius: 7px; color: #cadad0; text-decoration: none; font-weight: 500; font-size: .92rem; }
.rail nav a:hover { color: white; background: #ffffff0e; }
.rail nav a.active { background: #dbeaD5; color: #183f32; font-weight: 650; }
.identity { display: flex; align-items: center; gap: 9px; border-top: 1px solid #f0f6e12b; padding: 14px 3px 0; margin-top: auto; }
.avatar { display: inline-grid; place-items: center; background: #cbdbb5; color: #24533a; width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.identity > span:nth-child(2) { min-width: 0; }
.identity b, .identity small { display: block; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; line-height: 1.45; }
.identity b { font-size: .89rem; }
.identity small { font-size: .73rem; color: #c2d2c4; }
.identity .btn { margin-left: auto; color: #d7e5d7; padding: .25rem; }
.identity .btn:hover:not(:disabled) { background: #31584e; }
.desk { min-width: 0; width: min(100%, 1510px); padding: 27px clamp(22px, 4vw, 76px) 70px; margin-inline: auto; }
.breadcrumb { color: var(--muted); font-size: .79rem; margin: 0 0 24px; }
.breadcrumb span { opacity: .5; padding-inline: .25rem; }
.pagehead, .sectionhead, .qfooter, .historyrow { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.pagehead { margin-bottom: 26px; align-items: end; flex-wrap: wrap; }
.pagehead h1 { font: 650 clamp(28px, 3.1vw, 44px)/1.2 var(--serif); letter-spacing: .02em; }
.pagehead p { color: var(--muted); margin-top: .47rem; font-size: .96rem; }
.sectionhead { margin: 32px 0 13px; }
.sectionhead h2, .feature h2 { font-size: 1.25rem; }
.sectionhead a, .sectionhead > span { font-size: .88rem; color: var(--muted); }
.homegrid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; }
.feature { isolation: isolate; overflow: hidden; position: relative; min-height: 193px; display: grid; align-content: start; padding: 23px 26px; border-radius: 12px; background: #255142; color: #fffdf1; }
.feature::after { content: ""; pointer-events: none; z-index: -1; position: absolute; top: -35px; right: -28px; width: 166px; height: 240px; transform: rotate(24deg); border: 1px solid #d8e3b62a; box-shadow: -10px 0 0 -1px #255142,-10px 0 0 0 #d8e3b62a,-20px 0 0 -1px #255142,-20px 0 0 0 #d8e3b62a; }
.feature.light { color: #254431; background: #e9e9d7; border: 1px solid #d9dcc9; }
.feature.light::after { border-color: #6a795629; box-shadow: none; }
.featureicon { width: fit-content; font: 24px/1 Georgia,serif; color: #d6dfb4; }
.feature.light .featureicon { color: #567456; }
.feature h2 { margin: 15px 0 5px; }
.feature p { font-size: .89rem; color: #deeadc; }
.feature.light p { color: #4e6454; }
.feature a { justify-self: start; margin-top: 17px; color: inherit; font-weight: 600; font-size: .86rem; text-decoration: none; }
.feature a:hover, .doclink:hover { text-decoration: underline; }
.tablewrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
.tablewrap table { border-collapse: collapse; width: 100%; text-align: left; font-size: .9rem; }
.tablewrap :is(th,td) { padding: 12px 15px; border-bottom: 1px solid #e5e9e1; }
.tablewrap th { font-size: .78rem; color: var(--muted); font-weight: 600; background: #edf0e7; white-space: nowrap; }
.tablewrap tr:last-child td { border-bottom: 0; }
.doclink { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 600; overflow-wrap: anywhere; }
.fileicon { color: #537456; padding: .1em .3em; background: var(--mint); }
.empty { border: 1px dashed #b7c6b7; border-radius: 8px; color: var(--muted); text-align: center; background: #fcfcf7; padding: 36px 18px; }
.bankfilters, .qcard, .draftlist, .desk > form, .intakepanel { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 19px 21px; }
.bankfilters { display: grid; gap: 13px; }
.resourceactions, .fieldactions, .qmeta, .downloads, .slidecontrols, .nodechosen { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.resourceactions input[type=search] { flex: 1 1 210px; width: auto; }
.resourceactions label { flex: 1 1 115px; }
.bankfilters .nodechoose { border-top: 1px solid var(--line); padding-top: 11px; }
.nodechoose[open] > summary { margin-bottom: 9px; }
.nodechosen:not(:empty), .noderesults:not(:empty) { margin-top: 9px; }
.noderesults { max-height: 260px; overflow-y: auto; }
.noderow { display: flex; align-items: center; gap: 7px; padding: 7px 1px; border-bottom: 1px solid var(--line); font-size: .82rem; }
.noderow span { flex: 1; overflow-wrap: anywhere; }
.nodepill { display: inline-flex; align-items: center; max-width: 100%; gap: 3px; padding: 2px 4px 2px 8px; border-radius: 5px; color: var(--pine); background: var(--mint); font-size: .8rem; overflow-wrap: anywhere; }
.nodepill .btn { min-height: 26px; padding: 1px 5px; }
.qcard { margin-block: 10px; }
.qmeta { margin-bottom: 10px; }
.qmeta > span, .issue { background: #edf1e8; color: #435e48; font-size: .76rem; padding: 2px 7px; border-radius: 3px; font-style: normal; }
.qmeta > .issue, .issue { color: #79530f; background: #faf0d0; }
.qfooter { flex-wrap: wrap; margin-top: 13px; border-top: 1px solid #e1e7dc; padding-top: 11px; }
.qfooter > small, .qfooter > span { color: var(--muted); overflow-wrap: anywhere; }
.draftlist > :first-child { margin-top: 0; }
.pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 13px; margin-top: 17px; font-size: .85rem; color: var(--muted); }
.draftlist, .subrow { margin: 12px 0; }
.subrow { display: grid; padding: 12px; gap: 9px; border: 1px solid var(--line); border-radius: 6px; }
.subrow > .btn { justify-self: start; }

/* 编辑器仅让画布滚动，两层工具栏始终可用。 */
.studio { height: 100vh; height: 100dvh; display: flex; flex-direction: column; min-height: 0; background: #e5e9e3; }
.studiohead, .studiotools { display: flex; align-items: center; flex: 0 0 auto; position: relative; z-index: 2; }
.studiohead { min-height: 63px; padding: 9px clamp(13px, 2.1vw, 34px); gap: 17px; background: var(--pine-deep); color: white; }
.back { display: grid; place-items: center; padding-bottom: 2px; width: 35px; height: 35px; flex: 0 0 auto; font-size: 18px; text-decoration: none; color: #eaf0e4; border: 1px solid #c2d2c240; border-radius: 6px; }
.back:hover { background: #ffffff12; }
.studiotitle { min-width: 0; max-width: min(35vw,440px); }
.studiotitle > * { display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.studiotitle small { font-size: .71rem; line-height: 1.3; color: #c4d8c7; }
.studiotitle b { font-size: 1rem; }
.studiotabs, .modes { display: inline-flex; align-items: center; gap: 3px; border-radius: 7px; }
.studiotabs { margin-left: auto; padding: 3px; background: #082b26; }
.studiotabs .btn, .studioactions .btn:not(.primary) { min-height: 31px; border: 0; background: none; color: #d9e8d8; font-size: .85rem; }
.studiotabs .btn.chosen { color: #1b4539; background: #e5efdb; }
.studiotabs .btn:hover:not(.chosen), .studioactions .btn:not(.primary):hover { color: white; background: #2f584b; }
.studioactions { display: flex; align-items: center; gap: 8px; }
.studioactions .primary { color: #193c30; background: #dce7bf; border-color: #dce7bf; }
.studioactions .primary:hover:not(:disabled) { background: #eef3d6; border-color: #eef3d6; }
#savestate { color: #cad9c9; font-size: .76rem; white-space: nowrap; }
.studiotools { min-height: 55px; gap: 6px; padding: 8px clamp(12px, 3.8vw, 65px); background: #fcfcf7; border-bottom: 1px solid #c7d2c6; overflow-x: auto; }
.studiotools > * { flex-shrink: 0; }
.studiotools .btn { min-height: 32px; font-size: .85rem; }
.studiotools > .btn:not(.primary):not(.outline):not(.plain) { background: transparent; border-color: transparent; }
.studiotools > .btn:not(.primary):not(.outline):not(.plain):hover { background: var(--mint); }
.studiotools .modes .btn { border-radius: 5px; }
.modes { background: #eaf0e6; padding: 3px; }
.modes .btn { border-color: transparent; background: transparent; color: #4d6152; }
.modes .btn.chosen { color: var(--pine); background: white; box-shadow: 0 1px 4px #2c493322; }
.canvas { flex: 1 1 0; min-height: 0; overflow: auto; padding: clamp(17px, 3vw, 42px) 16px 55px; scrollbar-gutter: stable both-edges; }
.paper { width: min(100%,210mm); min-height: 297mm; margin: 0 auto 24px; padding: 14mm 17mm 11mm; display: flex; flex-direction: column; background: var(--paper); box-shadow: 0 2px 4px #27402b13,0 9px 28px #28463314; border: 1px solid #d2d8cd; color: #162621; }
.paperflag, .paperfoot { display: flex; justify-content: space-between; gap: 12px; color: #62725f; font-size: .74rem; letter-spacing: .08em; font-family: var(--sans); }
.paperflag { border-top: 2px solid #395941; padding: 9px 0 10px; border-bottom: 1px solid #d0d9cb; }
.papertitle { margin: 20px 0 18px; text-align: center; font: 700 clamp(24px, 2.6vw, 34px)/1.45 var(--serif); overflow-wrap: anywhere; }
.paperblock { position: relative; flex: 0 0 auto; min-width: 0; margin: 0 0 5px; padding: 7px 4px; line-height: 1.77; }
.editblock { border: 1px solid transparent; border-radius: 4px; }
.editblock:is(:hover,:focus-within) { border-color: #97b39d; background: #f8faf3; }
.blocktools { position: absolute; z-index: 1; bottom: calc(100% - 4px); right: -1px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; max-width: 100%; padding: 2px 4px; border: 1px solid #b1c1ad; border-radius: 5px; background: #fffefa; box-shadow: 0 1px 6px #243b2420; opacity: 0; pointer-events: none; }
.editblock:is(:hover,:focus-within) .blocktools { opacity: 1; pointer-events: auto; }
.blocktools .btn { min-height: 25px; border-color: transparent; background: transparent; padding: 2px 5px; }
.blocktools span[draggable] { color: #64755f; padding-inline: 4px; cursor: grab; user-select: none; }
.blocktools span[draggable]:active { cursor: grabbing; }
.paperq { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 10px; align-items: start; }
.qno { font: 700 1.04rem/1.72 var(--serif); color: var(--pine); }
.qno::after { content: "."; }
.stem, .qoptions > div, .solution, .editable, .slidebody, .papertable td { white-space: pre-wrap; overflow-wrap: anywhere; }
.qoptions { display: grid; gap: 3px; margin: .48em 0 .15em; }
.qoptions b { margin-right: .25em; }
.solution { color: #344d3a; padding: 6px 9px; margin-top: 6px; background: #f0f3ea; border-inline-start: 2px solid #a8bd9b; }
.solution > b { margin-right: .4em; color: #31523c; font-size: .87em; }
.qimg { display: block; max-width: 100%; height: auto; max-height: 320px; object-fit: contain; object-position: left center; margin: 7px 0; }
.qcard .qimg { max-height: 200px; }
.paperblock .editable { min-height: 1.45em; }
.paperblock h3 { color: #264935; font: 700 1.33rem/1.5 var(--serif); }
[contenteditable]:empty::before { content: attr(data-placeholder); color: #91a08e; pointer-events: none; font: inherit; }
.paper [contenteditable]:focus { outline: 1px solid #7ca389; outline-offset: 1px; border-radius: 2px; }
.formula { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 4px 0; text-align: center; }
.formula .katex-display { margin: .35em 0; }
.katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding-block: .14em; }
.papertable { width: 100%; table-layout: fixed; border-collapse: collapse; }
.papertable td { padding: 7px 10px; border: 1px solid #abbba7; vertical-align: top; }
.papertable tr:first-child { background: #eff2eb; }
.pagebreak { display: flex; align-items: center; justify-content: center; color: #6c7e69; gap: 9px; font-size: .74rem; }
.pagebreak::before, .pagebreak::after { content: ""; flex: 1; border-top: 1px dashed #aebfab; }
.editblock .answerSpace { border-bottom: 1px dotted #c3ccbb; }
.paperfoot { padding-top: 8px; margin-top: auto; border-top: 1px solid #d5dcce; }
.paperfoot span { font-variant-numeric: tabular-nums; }
.paperblock:last-of-type { margin-bottom: 24px; }
.blankpaper { margin: 30px auto; text-align: center; color: #5f735f; font-size: .88rem; }
.blankpaper p { margin-top: 12px; }

/* 课件屏幕和投屏。 */
.deckarea { display: grid; grid-template-columns: minmax(145px,210px) minmax(0,1fr); gap: clamp(12px,2.2vw,34px); padding: clamp(12px,2vw,30px); flex: 1; min-height: 0; overflow: auto; }
.slideindex { display: flex; flex-direction: column; gap: 6px; overflow: auto; align-self: start; max-height: 100%; padding: 2px; }
.slideindex .btn { justify-content: start; text-align: left; white-space: normal; overflow-wrap: anywhere; min-height: 43px; flex: none; }
.slideindex small { font-variant-numeric: tabular-nums; opacity: .75; }
.deckmain { min-width: 0; align-self: start; }
.slide { display: flex; flex-direction: column; width: 100%; max-height: calc(100dvh - 215px); min-height: 260px; aspect-ratio: 16/9; padding: clamp(14px,2.5vw,42px); gap: 11px; background: var(--paper); border: 1px solid #c9d3c5; box-shadow: var(--shadow); }
.slide .paperflag { padding: 6px 0; }
.slide h2 { font: 650 clamp(23px,2.7vw,43px)/1.24 var(--serif); overflow-wrap: anywhere; }
.slidebody { flex: 1; min-height: 0; overflow: auto; line-height: 1.53; }
.slide .qimg { max-height: 40vh; }
.slide footer { margin-top: auto; font-size: .76rem; font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; }
.slidecontrols { justify-content: flex-end; margin-top: 14px; }
html:fullscreen .studiohead, html:fullscreen .studiotools, html:fullscreen .slideindex,
.deckarea:fullscreen .slideindex { display: none; }
html:fullscreen .deckarea, .deckarea:fullscreen { display: grid; grid-template-columns: minmax(0,1fr); padding: clamp(8px,2vh,24px); background: #10241e; width: 100vw; height: 100dvh; }
html:fullscreen .deckmain, .deckarea:fullscreen .deckmain { width: min(100%, calc((100dvh - 82px)*16/9)); margin: auto; }
html:fullscreen .slide, .deckarea:fullscreen .slide { max-height: calc(100dvh - 80px); }
html:fullscreen .slidecontrols, .deckarea:fullscreen .slidecontrols { margin-top: 8px; justify-content: center; }

/* 对话框与操作反馈。 */
dialog { width: min(495px,calc(100% - 26px)); max-width: none; max-height: min(86dvh,960px); padding: 0; border: 1px solid #becbbd; border-radius: 12px; color: var(--ink); background: var(--paper); box-shadow: 0 22px 85px #07171145; overflow: hidden; }
dialog[open] { display: flex; flex-direction: column; }
dialog.wide { width: min(840px,calc(100% - 26px)); }
dialog::backdrop { background: #172e2659; backdrop-filter: blur(2px); }
.modalhead { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 15px; padding: 12px 19px; border-bottom: 1px solid var(--line); }
.modalhead h2 { font: 650 1.23rem/1.4 var(--serif); }
.modalhead .plain { padding: 0; width: 30px; min-height: 30px; font-size: 24px; line-height: 1; }
.modalbody { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 20px; overflow-wrap: anywhere; }
.modalbody form, .desk > form { display: grid; gap: 13px; }
.modalbody p + p, .modalbody .downloads { margin-top: 12px; }
.modalbody footer { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
.modalbody > footer, .modalbody form > footer, .picker > footer { border-top: 1px solid var(--line); margin-top: 7px; }
.picker > footer { position: sticky; bottom: -20px; background: var(--paper); padding: 11px 3px; }
.historyrow { padding: 10px 0; border-bottom: 1px solid var(--line); }
.historyrow small { display: block; color: var(--muted); }
#notice { position: fixed; z-index: 40; right: 18px; bottom: 18px; max-width: min(90vw,470px); padding: 10px 16px; border-radius: 7px; background: #153b32; color: #fff; box-shadow: var(--shadow); pointer-events: none; opacity: 0; transform: translateY(8px); transition: opacity .16s, transform .16s; }
#notice.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 174px minmax(0,1fr); }
  .rail { padding-inline: 10px; }
  .desk { padding-inline: 22px; }
  .feature { padding: 18px; }
  .paper { padding-inline: clamp(20px, 5.8vw, 60px); }
  .deckarea { grid-template-columns: 140px minmax(0,1fr); }
}
@media (max-width: 700px) {
  :root { font-size: 14px; }
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .logincover { min-height: 205px; padding: 25px; grid-template-columns: 1fr 140px; grid-template-rows: auto 1fr; }
  .logincover .brand { align-self: start; }
  .logincover > div:last-child { grid-column: 1; grid-row: 2; align-self: end; }
  .logincover h1 { font-size: 32px; }
  .deskgraphic { grid-column: 2; grid-row: 1/3; width: 145px; margin: 0; }
  .minititle { font-size: 13px; } .equation { font-size: 21px; }
  .loginform { width: min(88%, 370px); margin: 40px auto; align-self: start; }
  .layout { display: block; }
  .rail { height: auto; z-index: 4; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 4px 8px; padding: 8px 12px; }
  .rail .brand { grid-row: 1; grid-column: 1; padding: 0; gap: 6px; }
  .rail .brandmark { width: 27px; height: 27px; padding: 5px; }
  .rail .identity { grid-row: 1; grid-column: 2; padding: 0; margin: 0; border: 0; gap: 7px; }
  .identity .avatar, .identity small { display: none; }
  .rail nav { grid-row: 2; grid-column: 1/-1; display: flex; margin: 0; padding: 1px; gap: 3px; overflow-x: auto; }
  .rail nav a { flex: none; min-height: 32px; padding: 5px 8px; gap: 4px; font-size: .83rem; }
  .rail nav .icon { display: none; }
  .desk { padding: 17px 14px 42px; }
  .breadcrumb { margin-bottom: 14px; }
  .pagehead { margin-bottom: 18px; }
  .homegrid { gap: 9px; }
  .feature { min-height: 150px; padding: 14px; }
  .feature h2 { margin-top: 8px; }
  .feature a { margin-top: 10px; }
  .tablewrap :is(td,th) { padding: 9px; min-width: 65px; }
  .tablewrap td:first-child { min-width: 135px; }
  .studiohead { flex-wrap: wrap; gap: 5px 8px; padding: 6px 9px; min-height: auto; }
  .studiotitle { flex: 1 1 auto; max-width: calc(100% - 170px); }
  .studiotabs { order: 4; width: 100%; justify-content: center; margin: 1px 0 0; }
  .studiotabs .btn { flex: 1; }
  #savestate { font-size: .7rem; }
  .studioactions { gap: 2px; }
  .studioactions .btn { padding: 3px 7px; min-height: 30px; }
  .studiotools { min-height: 42px; padding: 5px 9px; }
  .canvas { padding: 10px 6px 25px; scrollbar-gutter: auto; }
  .paper { min-height: min(134vw,297mm); padding: 16px clamp(10px,3.5vw,24px) 12px; }
  .paperfoot { margin-top: auto; }
  .qcard,.bankfilters,.draftlist,.desk > form { padding: 12px; }
  .qfooter > small { flex: 1 1 100%; }
  .modalbody { padding: 14px; }
  .picker > footer { bottom: -14px; }
  .deckarea { display: flex; flex-direction: column; gap: 8px; padding: 8px; }
  .slideindex { display: flex; flex-direction: row; align-self: stretch; flex: none; max-height: none; }
  .slideindex .btn { max-width: 170px; min-height: 32px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .deckmain { width: 100%; }
  .slide { min-height: min(350px,51dvh); max-height: 61dvh; padding: 11px; gap: 7px; }
  .slidecontrols { justify-content: center; gap: 5px; }
}
@media (hover:none) {
  .editblock { border-color: #dfe5d9; }
  .blocktools { position: static; width: fit-content; margin: -2px 0 4px auto; opacity: 1; pointer-events: auto; background: #f4f6ef; box-shadow: none; border-color: transparent; }
}
@media (max-width: 400px) {
  .formgrid { grid-template-columns: 1fr; gap: 8px; }
  .logincover { grid-template-columns: 1fr 105px; }
  .deskgraphic { width: 115px; }
  .bankfilters .resourceactions label { flex-basis: 90px; }
  .homegrid { grid-template-columns: 1fr; }
  .feature { min-height: auto; }
}
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
@page { size: A4 portrait; margin: 13mm 15mm; }
@media print {
  :root, body, #app, .studio, .canvas, .paper { height: auto; min-height: 0; background: white; color: black; }
  .studio, .canvas, .paper { display: block; overflow: visible; }
  .studiohead, .studiotools, .blocktools, .blankpaper, .rail, dialog, #notice, .slidecontrols, .slideindex { display: none !important; }
  .canvas { padding: 0; }
  .paper { width: 100%; max-width: none; padding: 0; margin: 0; border: 0; box-shadow: none; break-after: page; font-size: 11pt; }
  .paper:last-child { break-after: auto; }
  .paperblock { margin: 0 0 2mm; padding: 1mm 0; border: 0; background: none; }
  .paperblock:has(> .pagebreak) { break-after: page; margin: 0; padding: 0; }
  .pagebreak, [contenteditable]:empty::before { display: none; }
  .papertitle, .paperblock h3 { break-after: avoid; }
  .paperflag, .paperfoot, .qno { color: black; }
  .qimg { max-height: 115mm; break-inside: avoid; }
  .paperfoot { margin-top: 6mm; }
  .paperq { display: block; }
  .qno { float: left; margin-right: 2mm; }
  .qoptions > div, .papertable tr { break-inside: avoid; }
  .answerSpace { border: 0 !important; }
  .solution { background: none; color: black; }
  .slide { box-shadow: none; max-height: none; }
}
