/* Translit: an editor's desk. Paper for the text, index cards for the terms, red pencil for the marks. */

:root {
  --desk: #e8e3d6;
  --desk-2: #ddd6c6;
  --paper: #fffdf7;
  --card: #fffef9;
  --ink: #1f2233;
  --ink-2: #4a4e63;
  --ink-3: #74788b;
  --indigo: #3a4a8c;
  --indigo-ink: #2e3b73;
  --indigo-soft: #e4e8f6;
  --on-indigo: #fffdf7;
  --red: #c0392b;
  --red-soft: #f7e1dd;
  --rule: #cfd8ef;
  --rule-red: #e39a90;
  --line: #d6cfbf;
  --ok: #2f7a55;
  --shadow: 0 1px 1px rgba(60, 50, 20, 0.06), 0 4px 14px rgba(60, 50, 20, 0.09);
  --shadow-lift: 0 2px 3px rgba(60, 50, 20, 0.08), 0 12px 28px rgba(60, 50, 20, 0.14);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --type: "Courier Prime", "Courier New", ui-monospace, monospace;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --hebrew: "Frank Ruhl Libre", "Source Serif 4", "Times New Roman", serif;
  --radius: 4px;
  --gutter: 28px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --desk: #13151d;
    --desk-2: #1a1d28;
    --paper: #1e2130;
    --card: #222638;
    --ink: #ebe7dc;
    --ink-2: #bdbab2;
    --ink-3: #8d8f99;
    --indigo: #a3b0ee;
    --indigo-ink: #c3cbf5;
    --indigo-soft: #2b3253;
    --on-indigo: #14161f;
    --red: #f0806f;
    --red-soft: #3d2627;
    --rule: #30374f;
    --rule-red: #8a4038;
    --line: #353a4c;
    --ok: #7fcfa4;
    --shadow: 0 1px 1px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.35);
    --shadow-lift: 0 2px 3px rgba(0, 0, 0, 0.4), 0 14px 30px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font: 400 17px/1.55 var(--serif);
  font-optical-sizing: auto;
  min-height: 100vh;
  overflow-x: hidden;
}
@media (prefers-color-scheme: light) {
  body { background: radial-gradient(1200px 600px at 70% -10%, #efebe1 0%, transparent 60%), var(--desk); }
}
h1, h2, h3 { font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -0.005em; }
a { color: var(--indigo); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--indigo); outline-offset: 2px; border-radius: 3px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.faint { color: var(--ink-3); }
.small { font-size: 0.85em; }
.red { color: var(--red); }
.he { font-family: var(--hebrew); font-size: 1.12em; font-weight: 500; unicode-bidi: isolate; line-height: 1.35; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic.big { width: 44px; height: 44px; stroke-width: 1.3; color: var(--red); }
.hand { font-family: var(--hand); font-weight: 600; font-size: 1.35rem; line-height: 1; }
.hand.red { color: var(--red); }
.hand.ok { color: var(--ok); display: inline-flex; align-items: center; gap: 2px; }
.hand.ok .ic { width: 18px; height: 18px; stroke-width: 2.4; }

/* ------------------------------------------------------------------ buttons and fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 15px; border-radius: var(--radius);
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
  font-weight: 550; font-size: 0.95rem; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, transform 0.08s;
}
.btn:hover { border-color: var(--indigo); color: var(--indigo-ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.primary { background: var(--indigo); border-color: var(--indigo); color: var(--on-indigo); }
.btn.primary:hover { background: var(--indigo-ink); border-color: var(--indigo-ink); color: var(--on-indigo); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); padding-inline: 10px; }
.btn.ghost:hover { background: var(--indigo-soft); color: var(--indigo-ink); }
.btn.danger:hover { border-color: var(--red); color: var(--red); }
.btn.big { min-height: 52px; font-size: 1.05rem; width: 100%; }
.link { background: none; border: 0; color: var(--indigo); font-weight: 650; cursor: pointer; padding: 8px 6px; min-height: 40px; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 0; background: none; border-radius: 50%; cursor: pointer; color: var(--ink-3); flex: none; }
.icon-btn:hover { background: var(--red-soft); color: var(--red); }
select, input[type="search"], input:not([type]), .grid-form input {
  min-height: 42px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--paper);
  padding: 6px 10px; max-width: 100%;
}
select { padding-right: 28px; cursor: pointer; }
input:focus, select:focus, textarea:focus { border-color: var(--indigo); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--indigo) 22%, transparent); }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); flex-wrap: wrap; }
.seg button { min-height: 40px; padding: 6px 13px; border: 0; background: none; cursor: pointer; font-size: 0.93rem; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--indigo); color: var(--on-indigo); }
.seg .n { font-family: var(--type); font-size: 0.85em; opacity: 0.8; margin-left: 2px; }
.inline { display: inline-flex; align-items: center; gap: 8px; font-size: 0.93rem; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); cursor: pointer; font-size: 0.93rem; }
.chip .ic { width: 17px; height: 17px; color: var(--ink-3); }
.chip.on { border-color: var(--indigo); background: var(--indigo-soft); color: var(--indigo-ink); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag { display: inline-block; font-family: var(--type); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--indigo); border: 1px solid color-mix(in srgb, var(--indigo) 45%, transparent); border-radius: 3px; padding: 0 5px; line-height: 1.6; vertical-align: 1px; }

/* ------------------------------------------------------------------ header */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1380px; margin: 0 auto; padding: 8px var(--gutter); display: flex; align-items: center; gap: 22px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); min-height: 44px; flex: none; }
.brand-name { font-size: 1.32rem; font-weight: 650; letter-spacing: -0.01em; }
.logo { width: 38px; height: 38px; flex: none; }
.logo-card { fill: var(--card); stroke: var(--indigo); stroke-width: 2; }
.logo-red { stroke: var(--red); stroke-width: 1.6; }
.logo-he { font-family: var(--hebrew); font-size: 20px; font-weight: 700; fill: var(--ink); }
.logo-pencil { stroke: var(--red); stroke-width: 4; stroke-linecap: round; }
.tabs { display: flex; gap: 2px; flex: 1; min-width: 0; }
.tabs a {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 13px;
  color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 0.98rem; border-radius: var(--radius);
}
.tabs a:hover { color: var(--indigo-ink); background: var(--indigo-soft); }
.tabs a[aria-current="page"] { color: var(--indigo-ink); }
.tabs a[aria-current="page"]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 4px; height: 3px; border-radius: 2px;
  background: var(--red); transform: rotate(-0.6deg);
}
.tabs .short { display: none; }
.style-pick { display: flex; align-items: center; gap: 8px; flex: none; }
.style-pick .label { font-size: 0.85rem; color: var(--ink-3); }
.client-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 11px; border-radius: 999px; background: var(--indigo-soft); color: var(--indigo-ink); text-decoration: none; font-size: 0.9rem; font-weight: 600; max-width: 180px; }
.client-chip[hidden] { display: none; }
.client-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-chip .ic { width: 17px; height: 17px; }

/* ------------------------------------------------------------------ screens */
main { max-width: 1380px; margin: 0 auto; padding: 26px var(--gutter) 80px; }
.screen[hidden] { display: none !important; }
body:not(.ready) main { visibility: hidden; }
.paper {
  background: var(--paper); border-radius: 3px; box-shadow: var(--shadow); position: relative;
}
.bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 22px; }
.bar[hidden] { display: none; }
.bar h1 { font-size: 2rem; letter-spacing: -0.015em; }
.bar-main { min-width: 0; flex: 1 1 340px; }
.bar-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.summary { margin: 6px 0 0; color: var(--ink-2); }
.summary b { color: var(--ink); font-weight: 650; }
.summary b.red { color: var(--red); }
.note-bar { background: var(--red-soft); border-left: 3px solid var(--red); padding: 10px 14px; border-radius: 3px; margin: -8px 0 20px; }

/* ------------------------------------------------------------------ Text */
.text-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.manuscript { display: flex; flex-direction: column; min-height: calc(100vh - 150px); }
.paper-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 14px 18px 10px 24px; border-bottom: 1px solid var(--line); }
.label { font-family: var(--type); font-size: 0.9rem; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.tools { display: flex; flex-wrap: wrap; gap: 2px; }
#docText {
  flex: 1; width: 100%; min-height: 420px; resize: vertical; border: 0; outline: none; background: transparent;
  padding: 26px 32px 26px 72px; font: 400 1.08rem/2 var(--serif); color: var(--ink);
  background-image: linear-gradient(to right, transparent 54px, var(--rule-red) 54px, var(--rule-red) 55.5px, transparent 55.5px);
}
#docText:focus { box-shadow: none; }
#docText::placeholder { color: var(--ink-3); font-style: italic; }
#docText.drop { background-color: var(--indigo-soft); }
.paper-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px 14px 72px; font-family: var(--type); font-size: 0.85rem; color: var(--ink-3); border-top: 1px solid var(--line); }
.foot-check { display: none; }
.side { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 12px; }
.side-title { font-size: 1.2rem; }
.side-sub { font-size: 0.95rem; color: var(--ink-2); margin-top: 6px; }
.side .faint { margin: 0; font-size: 0.92rem; }
.stamps { display: grid; gap: 10px; }
.stamp {
  position: relative; display: grid; gap: 4px; text-align: left; padding: 12px 14px 12px 16px; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 3px; box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.stamp:hover { border-color: var(--indigo); }
.stamp[aria-checked="true"] { border-color: var(--indigo); box-shadow: var(--shadow-lift), inset 4px 0 0 var(--indigo); }
.stamp[aria-checked="true"]::after {
  content: "in use"; position: absolute; top: 9px; right: 12px; font: 700 0.75rem/1 var(--type); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--red); border: 2px solid var(--red); border-radius: 3px; padding: 3px 6px 2px; transform: rotate(-6deg); opacity: 0.85;
}
.stamp-name { font-weight: 650; font-size: 1.04rem; }
.rules { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 0.9rem; color: var(--ink-2); }
.rule { display: inline-flex; align-items: center; gap: 4px; }
.rule .he { font-size: 1.3rem; line-height: 1; }
.rule b { font-family: var(--type); font-weight: 400; color: var(--indigo-ink); font-size: 1rem; }
.rule i { color: var(--ink-3); font-size: 0.85em; }
.arrow { width: 14px; height: 14px; color: var(--ink-3); stroke-width: 2; }
.examples { font-size: 0.88rem; color: var(--ink-3); font-style: italic; }

/* ------------------------------------------------------------------ Findings cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; align-items: start; }
.card {
  background: var(--card); border-radius: 3px; box-shadow: var(--shadow); padding: 0 0 10px; position: relative;
  border-top: 3px solid transparent;
}
.card.mixed { box-shadow: var(--shadow), inset 3px 0 0 var(--red); }
.card-head { padding: 14px 18px 10px; border-bottom: 1.5px solid var(--rule-red); position: relative; }
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-right: 84px; }
.card-title h3 { font-size: 1.32rem; font-weight: 650; overflow-wrap: anywhere; }
.card-title .he { font-size: 1.32rem; color: var(--ink-2); white-space: nowrap; }
.card-note { position: absolute; top: 12px; right: 14px; transform: rotate(-4deg); }
.style-card .card-title { padding-right: 0; }
.gloss { margin: 4px 0 0; font-size: 0.92rem; color: var(--ink-2); font-style: italic; line-height: 1.4; }
.opts { border: 0; margin: 0; padding: 4px 18px 0; min-width: 0; }
.opts legend { font-family: var(--type); font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); padding: 8px 0 0; float: left; width: 100%; }
.opt {
  display: flex; align-items: center; gap: 9px; min-height: 42px; border-bottom: 1px solid var(--rule); cursor: pointer;
  clear: both;
}
.opt input[type="radio"] { accent-color: var(--indigo); width: 18px; height: 18px; margin: 0; flex: none; }
.opt .spell { font-size: 1.04rem; overflow-wrap: anywhere; }
.opt.on .spell { font-weight: 650; color: var(--indigo-ink); }
.opt.struck .spell { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.opt .n { font-family: var(--type); font-size: 0.9rem; color: var(--ink-3); }
.opt .tag { margin-left: auto; }
.opt.other .own { flex: 1; min-width: 0; min-height: 34px; border: 0; border-bottom: 1px dashed var(--line); border-radius: 0; background: transparent; padding: 2px 2px; }
.opt.other .own:focus { box-shadow: none; border-bottom-color: var(--indigo); }
.english { padding: 10px 18px 2px; font-size: 0.9rem; color: var(--ink-2); display: grid; gap: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; color: var(--ink); }
.check input { width: 18px; height: 18px; accent-color: var(--indigo); margin: 0; }
.empty-card { max-width: 560px; margin: 40px auto; text-align: center; background: var(--card); box-shadow: var(--shadow); padding: 34px 30px 30px; border-radius: 3px; border-top: 1.5px solid var(--rule-red); }
.empty-card h2 { font-size: 1.4rem; margin: 10px 0 8px; }
.empty-card p { color: var(--ink-2); margin: 0 0 18px; }
.empty-card .row { justify-content: center; }

/* ------------------------------------------------------------------ Proof */
.legend { margin: 8px 0 0; font-size: 0.9rem; color: var(--ink-3); }
.lg-chg del { text-decoration: line-through var(--red) 2px; }
.lg-chg ins { text-decoration: none; font-family: var(--hand); color: var(--red); font-size: 1.25em; font-weight: 600; margin-left: 4px; }
.lg-stet { border-bottom: 2.5px dotted var(--red); }
.proof-paper { display: grid; grid-template-columns: minmax(0, 1fr) 210px; }
.proof-text {
  padding: 40px 34px 44px 72px; font-size: 1.08rem; line-height: 2.75; white-space: pre-wrap; overflow-wrap: anywhere;
  position: relative; min-height: 200px;
  background-image: linear-gradient(to right, transparent 54px, var(--rule-red) 54px, var(--rule-red) 55.5px, transparent 55.5px);
}
.margin { position: relative; border-left: 1px dashed var(--line); padding: 40px 0; }
.margin .note { position: absolute; left: 14px; right: 10px; font-family: var(--hand); font-weight: 600; font-size: 1.32rem; line-height: 1.1; color: var(--red); margin-top: 0.55em; }
.margin .slash { margin: 0 3px 0 1px; }
.stet-mark { display: inline-block; border: 1.8px solid var(--red); border-radius: 50%; padding: 0 6px; font-size: 1.05rem; }
.chg {
  /* a button is always laid out inline-block, so the marks hang off the word (.w), not the button */
  position: relative; display: inline; border: 0; background: none; padding: 0.6em 0; margin: 0; cursor: pointer;
  text-align: inherit; font: inherit; line-height: inherit; color: inherit; white-space: pre-wrap;
}
.chg .w { position: relative; }
.chg del { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.chg ins {
  position: absolute; left: -2px; bottom: 88%; text-decoration: none; white-space: nowrap; pointer-events: none;
  font: 600 1.32rem/1 var(--hand); color: var(--red);
}
.chg .w::after { /* the caret under the word */
  content: ""; position: absolute; left: 50%; top: 100%; width: 7px; height: 7px; margin: 3px 0 0 -3.5px;
  border: solid var(--red); border-width: 2px 0 0 2px; transform: rotate(45deg); opacity: 0.85;
}
.chg:hover del { background: var(--red-soft); }
.chg.stet del { text-decoration: none; border-bottom: 2.5px dotted var(--red); }
.chg.stet ins, .chg.stet .w::after { display: none; }
.change-table { margin-top: 22px; padding: 0 20px; }
.change-table summary { cursor: pointer; padding: 14px 0; font-weight: 600; min-height: 44px; }
.table-wrap { overflow-x: auto; padding-bottom: 16px; }
.change-table table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.change-table th, .change-table td { text-align: left; padding: 7px 12px 7px 0; border-bottom: 1px solid var(--rule); }
.change-table th { font-family: var(--type); font-weight: 400; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.change-table td:first-child { font-family: var(--type); color: var(--ink-3); width: 4em; }
.change-table del { text-decoration: line-through var(--red) 1.5px; }
.change-table tr.stet td { color: var(--ink-3); }
.change-table tr.stet del { text-decoration: none; border-bottom: 2px dotted var(--red); }

/* ------------------------------------------------------------------ Style sheet */
.stylesheet { padding: 34px 38px 40px; }
.ss-head { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 6px 24px; padding-bottom: 16px; border-bottom: 2px solid var(--ink); margin-bottom: 22px; }
.ss-head h2 { font-size: 1.9rem; font-family: var(--type); font-weight: 400; text-transform: uppercase; letter-spacing: 0.06em; }
.ss-for { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.ss-for span { font-family: var(--type); color: var(--ink-3); }
.ss-for input { flex: 1; min-width: 0; border: 0; border-bottom: 1.5px dashed var(--line); border-radius: 0; background: transparent; font-size: 1.3rem; font-family: var(--hand); font-weight: 600; color: var(--indigo-ink); padding: 0 4px; }
.ss-meta { grid-column: 1 / -1; margin: 0; font-size: 0.93rem; color: var(--ink-2); }
.ss-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); border-top: 1.5px solid var(--ink-3); border-left: 1.5px solid var(--ink-3); }
.box { border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); padding: 10px 16px 14px; break-inside: avoid; }
.box h3 { font-family: var(--type); font-weight: 400; font-size: 1.5rem; color: var(--red); margin-bottom: 4px; }
.box dl { margin: 0; }
.entry { padding: 5px 0; border-bottom: 1px dotted var(--line); }
.entry:last-child { border-bottom: 0; }
.entry dt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.entry dt b { font-size: 1.05rem; font-weight: 650; }
.entry .pl { font-size: 0.9rem; color: var(--ink-2); font-style: italic; }
.entry dt .he { margin-left: auto; font-size: 1.08rem; color: var(--ink-2); }
.entry dd { margin: 1px 0 0; font-size: 0.9rem; color: var(--ink-2); line-height: 1.4; }
.entry .not { color: var(--ink-3); font-style: italic; }
.entry .not s { text-decoration-color: var(--red); text-decoration-thickness: 1.5px; }
.sheet-empty { padding: 30px; color: var(--ink-2); text-align: center; grid-column: 1 / -1; }

/* ------------------------------------------------------------------ My styles */
.styles-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.current-style { padding: 24px 28px 28px; }
.current-style h2, .saved h2 { font-size: 1.3rem; }
.current-style h3 { font-family: var(--type); font-weight: 400; font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin: 24px 0 4px; }
.lead { margin: 6px 0 12px; color: var(--ink-2); }
.row-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.row-form label { font-weight: 600; }
.row-form input { flex: 1 1 200px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; border-bottom: 1px solid var(--rule); }
.plain-list li.faint { font-size: 0.93rem; }
.plain-list li > span { min-width: 0; overflow-wrap: anywhere; }
.plain-list s { text-decoration-color: var(--red); text-decoration-thickness: 1.5px; color: var(--ink-3); }
.plain-list .arrow { vertical-align: -2px; }
.add-term { margin-top: 22px; border-top: 1.5px solid var(--rule-red); padding-top: 6px; }
.add-term summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; min-height: 44px; color: var(--indigo-ink); }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-top: 8px; }
.grid-form label { display: grid; gap: 4px; font-size: 0.9rem; color: var(--ink-2); }
.grid-form input { width: 100%; }
.grid-form .btn { grid-column: 1 / -1; justify-self: start; }
.saved { display: grid; gap: 14px; }
.saved-list { display: grid; gap: 16px; }
.style-card { padding-bottom: 14px; }
.style-card .row { padding: 12px 18px 0; }
.style-card input.rename { font-size: 1.2rem; font-weight: 650; width: 100%; }
.style-card.active { box-shadow: var(--shadow-lift), inset 4px 0 0 var(--indigo); }

/* ------------------------------------------------------------------ Terms */
.search { position: relative; display: inline-flex; align-items: center; }
.search .ic { position: absolute; left: 10px; color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 38px; width: 320px; }
.qy { display: inline-grid; place-items: center; font: 700 0.95rem/1 var(--hand); color: var(--red); border: 1.6px solid var(--red); border-radius: 50%; width: 28px; height: 28px; transform: rotate(-8deg); flex: none; vertical-align: middle; }
.terms-paper { padding: 0 0 8px; }
.trow { display: grid; grid-template-columns: 170px repeat(4, minmax(0, 1fr)); gap: 0 14px; align-items: baseline; }
.term-head { position: sticky; top: 61px; z-index: 2; background: var(--paper); padding: 16px 22px 10px; border-bottom: 2px solid var(--ink); }
.term-head .col { display: grid; gap: 2px; font-size: 0.95rem; }
.term-head .col span { font-family: var(--type); font-size: 0.78rem; color: var(--ink-3); }
.term-head .col span .he { font-size: 1rem; }
.term-head .col.current b { color: var(--indigo-ink); text-decoration: underline 3px var(--red); text-underline-offset: 5px; }
.term { padding: 12px 22px 12px; border-bottom: 1px solid var(--rule); }
.term:nth-child(even) { background: color-mix(in srgb, var(--desk) 22%, var(--paper)); }
.term .trow .col { font-size: 1.04rem; overflow-wrap: anywhere; }
.term .trow .col.current { font-weight: 650; color: var(--indigo-ink); }
.term .trow.pl .col { font-size: 0.95rem; color: var(--ink-2); }
.term .trow.pl .col.current { color: var(--indigo-ink); }
.hecol { display: flex; align-items: baseline; gap: 8px; }
.hecol .he { font-size: 1.24rem; }
.term .trow.pl .hecol .he { font-size: 1.06rem; }
.tmeta { margin-top: 4px; padding-left: 184px; }
.tmeta p { margin: 2px 0 0; font-size: 0.9rem; }
.tmeta .also { color: var(--ink-3); }
.tnote { display: flex; align-items: flex-start; gap: 8px; color: var(--ink-2); font-size: 0.88rem !important; margin-top: 6px !important; }
.term.query .tnote { color: var(--ink); }

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, calc(100% + 40px)); z-index: 50; visibility: hidden;
  display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100vw - 32px));
  background: var(--ink); color: var(--paper); border-radius: 6px; padding: 8px 10px 8px 18px; box-shadow: var(--shadow-lift);
  transition: transform 0.25s ease, visibility 0.25s; font-size: 0.95rem;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast .link { color: var(--paper); }
.toast:empty { display: none; }

/* ------------------------------------------------------------------ narrower screens */
@media (max-width: 1180px) {
  .top-in { flex-wrap: wrap; gap: 0 16px; padding-bottom: 0; }
  .tabs { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
  .style-pick { margin-left: auto; }
  .term-head { top: 105px; }
  .side { top: 128px; }
}
@media (max-width: 980px) {
  .text-layout, .styles-layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .foot-check { display: inline-flex; font-family: var(--serif); }
  .paper-foot { flex-wrap: wrap; }
  .stamps { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
  .manuscript { min-height: 0; }
  #docText { min-height: 46vh; }
  .proof-paper { grid-template-columns: 1fr; }
  .margin { display: none; }
  .trow { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 14px; }
  .trow .hecol { grid-column: 1 / -1; }
  .term-head { display: none; }
  .term .trow .col:not(.hecol)::before { content: attr(data-label); display: block; font-family: var(--type); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
  .term .trow.pl .col:not(.hecol)::before { content: attr(data-label) " plural"; }
  .term .trow.pl { margin-top: 6px; }
  .tmeta { padding-left: 0; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  main { padding-top: 18px; }
  .top-in { gap: 0 10px; }
  .brand-name { font-size: 1.15rem; }
  .logo { width: 32px; height: 32px; }
  .style-pick .label { display: none; }
  .style-pick select { max-width: 150px; font-size: 0.92rem; }
  .client-chip { display: none; }
  .tabs { gap: 0; justify-content: space-between; }
  .tabs a { padding: 0 7px; font-size: 0.92rem; }
  .tabs .long { display: none; }
  .tabs .short { display: inline; }
  .bar h1 { font-size: 1.6rem; }
  .bar-tools { width: 100%; }
  .bar-tools .btn { flex: 1 1 auto; }
  .seg { width: 100%; }
  .seg button { flex: 1 1 auto; padding: 6px 8px; }
  .paper-head { padding: 8px 8px 6px; }
  .paper-head .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tools { width: 100%; justify-content: space-between; }
  .tools .btn { padding-inline: 8px; font-size: 0.9rem; }
  #docText { padding: 18px 16px 18px 40px; background-image: linear-gradient(to right, transparent 28px, var(--rule-red) 28px, var(--rule-red) 29.5px, transparent 29.5px); font-size: 1.02rem; }
  .paper-foot { padding-left: 40px; }
  .proof-text { padding: 30px 16px 30px 40px; background-image: linear-gradient(to right, transparent 28px, var(--rule-red) 28px, var(--rule-red) 29.5px, transparent 29.5px); font-size: 1.02rem; }
  .stylesheet { padding: 22px 16px 26px; }
  .ss-head { grid-template-columns: 1fr; }
  .ss-head h2 { font-size: 1.5rem; }
  .current-style { padding: 20px 18px 22px; }
  .grid-form { grid-template-columns: 1fr; }
  .search, .search input { width: 100%; }
  .bar-tools .inline, .bar-tools .inline select { width: 100%; }
  .bar-tools .inline > span:not(.visually-hidden) { flex: none; }
  .term { padding: 12px 16px; }
  .card-title { padding-right: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------ print: the style sheet only */
@media print {
  @page { margin: 16mm; }
  :root { --paper: #fff; --card: #fff; --ink: #000; --ink-2: #222; --ink-3: #555; --red: #b03024; --line: #bbb; --rule: #ccc; --indigo: #3a4a8c; --indigo-ink: #2e3b73; }
  body { background: #fff; font-size: 11pt; }
  .top, .bar, .toast, .screen:not(#screen-sheet) { display: none !important; }
  #screen-sheet { display: block !important; }
  main { padding: 0; max-width: none; }
  .paper { box-shadow: none; }
  .stylesheet { padding: 0; }
  .ss-for input { border: 0; }
  .ss-grid { grid-template-columns: 1fr 1fr; }
}
