/* Imlo — light theme: Samarkand blue + turquoise on warm paper */
:root {
  --bg: #f5f2ea;
  --card: #ffffff;
  --ink: #172033;
  --ink-2: #3b4559;
  --muted: #6b7489;
  --line: #e7e2d6;
  --soft: #f3f0e8;
  --blue: #1d4ed8;
  --blue-soft: #e8eefc;
  --teal: #0d9488;
  --teal-soft: #e3f4f2;
  --gold: #f2b84b;
  --c-spelling: #e11d48;
  --c-grammar: #7c3aed;
  --c-punctuation: #d97706;
  --c-typography: #0284c7;
  --c-style: #0d9488;
  --r-ega: #1d4ed8;
  --r-kesim: #e11d48;
  --r-told: #059669;
  --r-aniq: #d97706;
  --r-hol: #7c3aed;
  --shadow-1: 0 1px 2px rgba(23, 32, 51, .05), 0 6px 18px rgba(23, 32, 51, .06);
  --shadow-2: 0 2px 6px rgba(23, 32, 51, .06), 0 18px 40px rgba(23, 32, 51, .10);
  --ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --text: "Charter", "Georgia", "Cambria", "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(29, 78, 216, .07) 1px, transparent 0),
    linear-gradient(180deg, #f8f5ee 0, var(--bg) 320px);
  background-size: 22px 22px, 100% 100%;
  color: var(--ink); font: 15px/1.5 var(--ui); min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { flex: none; }

/* ------------------------------------------------------------------ top bar */
.top {
  position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 12px 28px; background: rgba(245, 242, 234, .86); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid rgba(231, 226, 214, .8);
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; justify-self: start; }
.mark svg { width: 40px; height: 40px; display: block; filter: drop-shadow(0 3px 8px rgba(29, 78, 216, .25)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 20px; letter-spacing: -.02em; }
.brand-text small { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.modes { display: flex; gap: 4px; padding: 4px; background: #ebe6da; border-radius: 14px; box-shadow: inset 0 1px 2px rgba(0,0,0,.05); }
.mode {
  display: flex; align-items: center; gap: 7px; border: 0; background: transparent; padding: 8px 15px; border-radius: 10px;
  color: var(--ink-2); font-weight: 600; font-size: 14px; transition: background .2s, color .2s, box-shadow .2s;
}
.mode svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mode:hover { color: var(--ink); }
.mode.on { background: var(--card); color: var(--blue); box-shadow: var(--shadow-1); }
.mode .count { min-width: 22px; padding: 0 7px; border-radius: 20px; background: var(--c-spelling); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.mode .count.zero { background: var(--teal); }

.tools { display: flex; gap: 4px; justify-self: end; }
.tool {
  display: flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 8px 11px; border-radius: 10px;
  color: var(--ink-2); font-size: 13.5px; transition: background .15s;
}
.tool svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { background: rgba(29, 78, 216, .08); color: var(--blue); }
a.tool { text-decoration: none; }
.tool { white-space: nowrap; }
@media (max-width: 1320px) { .tool:not(.win) span { display: none; } }
.tool.win { color: var(--blue); font-weight: 600; background: var(--blue-soft); }
.thes { margin-top: 12px; display: grid; gap: 10px; }
.thes .sense { display: grid; gap: 6px; padding-top: 8px; border-top: 1px dashed rgba(23, 32, 51, .12); }
.thes .def { font-size: 13px; opacity: .8; line-height: 1.4; }
.thes .rel { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.thes .rel > span { font-size: 12px; font-weight: 600; opacity: .65; margin-right: 2px; min-width: 76px; }
.thes .chip { border: 0; border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer;
  background: var(--blue-soft); color: var(--blue); }
.thes .chip.ant { background: rgba(220, 38, 38, .09); color: #b91c1c; }
.thes .chip:hover, .thes .chip:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.thes .muted { opacity: .6; font-size: 12px; }
.thes .credit { margin-top: 2px; }
.scriptpick { position: relative; }
.scriptpick .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px; padding: 6px;
  background: var(--card); border-radius: 12px; box-shadow: 0 16px 40px rgba(23, 32, 51, .18); display: grid; gap: 2px; }
.scriptpick .menu[hidden] { display: none; }
.scriptpick .menu button { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 12px;
  border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.scriptpick .menu button:hover:not(:disabled), .scriptpick .menu button:focus-visible { background: rgba(29, 78, 216, .08); color: var(--blue); outline: none; }
.scriptpick .menu button:disabled { cursor: default; opacity: .55; }
.scriptpick .menu button[aria-checked="true"] b::after { content: " ✓"; }
.scriptpick .menu small { opacity: .7; font-size: 12px; white-space: nowrap; }
.tool.win svg { fill: currentColor; stroke: none; width: 15px; height: 15px; }

/* ------------------------------------------------------------------ stage */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 26px; max-width: 1380px; margin: 0 auto; padding: 26px 28px 40px; }
.sheet { background: var(--card); border-radius: 22px; box-shadow: var(--shadow-2); display: flex; flex-direction: column; min-height: 76vh; min-width: 0; }
.sheet-head { display: flex; align-items: center; gap: 18px; padding: 18px 26px 14px; border-bottom: 1px solid var(--line); }
.health { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.health-bar { display: flex; gap: 3px; height: 10px; flex: 1; max-width: 340px; border-radius: 10px; overflow: hidden; background: var(--soft); }
.health-bar i { display: block; border-radius: 3px; transition: flex .5s; }
.health-bar i.ok { background: linear-gradient(90deg, var(--teal), #34d399); }
.health-bar i.spelling { background: var(--c-spelling); } .health-bar i.grammar { background: var(--c-grammar); }
.health-bar i.punctuation { background: var(--c-punctuation); } .health-bar i.typography { background: var(--c-typography); }
.health-bar i.style { background: var(--c-style); opacity: .7; }
.health-text { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.health-text b { font-size: 22px; letter-spacing: -.02em; }
.health-text span { color: var(--muted); font-size: 13.5px; }
.sheet-actions { display: flex; gap: 4px; }
.ghost { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 6px 12px; font-size: 13.5px; color: var(--ink-2); }
.ghost:hover { border-color: var(--blue); color: var(--blue); }
.ghost.small { padding: 3px 10px; font-size: 12.5px; }
.ghost:disabled { opacity: .55; cursor: default; border-color: var(--line); color: var(--ink-2); }

/* editor: textarea over a backdrop that draws marks */
.editor-wrap { position: relative; flex: 1; margin: 26px 44px 18px; }
.backdrop, #editor {
  font: 19px/1.8 var(--text); letter-spacing: 0; word-spacing: 0; tab-size: 4;
  white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; margin: 0; padding: 0; border: 0; width: 100%;
}
.backdrop { position: absolute; inset: 0; color: transparent; pointer-events: none; }
#editor { position: relative; display: block; resize: none; overflow: hidden; background: transparent; color: var(--ink);
  outline: none; min-height: 58vh; caret-color: var(--blue); }
#editor::placeholder { color: #a3a9b6; }
#editor::selection { background: rgba(29, 78, 216, .18); }

.backdrop mark { color: transparent; border-radius: 3px; background-repeat: repeat-x; background-position: 0 100%; padding-bottom: 1px; }
.backdrop mark.cat-spelling { background-color: rgba(225, 29, 72, .07);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='4'%3E%3Cpath d='M0 3 Q2 0 4 3 T8 3' stroke='%23e11d48' stroke-width='1.4' fill='none'/%3E%3C/svg%3E"); background-size: 8px 4px; }
.backdrop mark.cat-grammar { background-color: rgba(124, 58, 237, .07); box-shadow: inset 0 -2px 0 var(--c-grammar); }
.backdrop mark.cat-punctuation { box-shadow: inset 0 -2px 0 var(--c-punctuation); background-color: rgba(217, 119, 6, .07); }
.backdrop mark.cat-typography { background-image: radial-gradient(circle, var(--c-typography) 1.1px, transparent 1.4px); background-size: 5px 3px; }
.backdrop mark.cat-style { background-image: radial-gradient(circle, var(--c-style) 1.1px, transparent 1.4px); background-size: 6px 3px; }
.backdrop mark.sev-info { background-color: transparent; }
.backdrop mark.cat-grammar.sev-info { box-shadow: inset 0 -1px 0 var(--c-grammar); }
.backdrop mark.active { background-color: rgba(29, 78, 216, .16); box-shadow: 0 0 0 2px rgba(29, 78, 216, .25); }
.backdrop mark.sel { background: rgba(13, 148, 136, .18); box-shadow: 0 0 0 2px rgba(13, 148, 136, .3); }
/* sentence members drawn in the text (Gap tuzilishi mode) */
.backdrop mark.role { background: none; box-shadow: none; padding-bottom: 3px; border-radius: 0; }
.backdrop mark.role.Ega { box-shadow: inset 0 -2px 0 var(--r-ega); }
.backdrop mark.role.Kesim { box-shadow: inset 0 -2px 0 var(--r-kesim), inset 0 -5px 0 #fff, inset 0 -7px 0 var(--r-kesim); }
.backdrop mark.role.Toldiruvchi { background-image: linear-gradient(90deg, var(--r-told) 0 6px, transparent 6px 10px); background-size: 10px 2px; background-repeat: repeat-x; background-position: 0 100%; }
.backdrop mark.role.Aniqlovchi { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='4'%3E%3Cpath d='M0 3 Q2 0 4 3 T8 3' stroke='%23d97706' stroke-width='1.4' fill='none'/%3E%3C/svg%3E"); background-size: 8px 4px; background-repeat: repeat-x; background-position: 0 100%; }
.backdrop mark.role.Hol { background-image: linear-gradient(90deg, var(--r-hol) 0 8px, transparent 8px 11px, var(--r-hol) 11px 13px, transparent 13px 16px); background-size: 16px 2px; background-repeat: repeat-x; background-position: 0 100%; }
.backdrop mark mark { padding-bottom: 0; }   /* an issue nested inside a longer one */
.backdrop mark.sentence-on { background-color: rgba(29, 78, 216, .07); border-radius: 4px; }

.sheet-foot { display: flex; gap: 18px; padding: 12px 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.sheet-foot .grow { flex: 1; }
.state { display: inline-flex; align-items: center; gap: 7px; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.state.busy::before { background: var(--gold); animation: blink 1s infinite; }
.state.error::before { background: var(--c-spelling); }
#stChars.over { color: var(--c-spelling); font-weight: 650; }
@keyframes blink { 50% { opacity: .25; } }

/* ------------------------------------------------------------------ inspector */
.inspector { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 112px); overflow-y: auto; padding: 2px 4px 20px 2px;
  scrollbar-width: thin; }
.pane { display: none; animation: rise .25s ease; }
.pane.on { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* focus card: one issue at a time */
.review { background: var(--card); border-radius: 20px; box-shadow: var(--shadow-2); padding: 18px 20px 16px; position: relative; overflow: hidden; }
.review::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c, var(--teal)); }
.review .nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.review .tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--c); }
.review .tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.review .pager { display: flex; align-items: center; gap: 2px; color: var(--muted); font-size: 13px; }
.review .pager button { border: 0; background: var(--soft); width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.review .pager button:hover { background: var(--blue-soft); color: var(--blue); }
.review .pager span { min-width: 54px; text-align: center; font-variant-numeric: tabular-nums; }
.review h3 { margin: 0 0 12px; font-size: 16px; line-height: 1.35; }
.review .change { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font: 22px/1.3 var(--text); margin-bottom: 12px; }
.review .change .old { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--c); text-decoration-thickness: 2px; }
.review .change .arrow { color: var(--muted); font-family: var(--ui); font-size: 18px; }
.review .change .new { color: var(--ink); font-weight: 600; }
.review .why { color: var(--ink-2); font-size: 13.5px; background: var(--soft); border-radius: 12px; padding: 10px 12px; margin: 0 0 14px; }
.review .alts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.review .alts button { border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 4px 11px; font-size: 14px; }
.review .alts button:hover { border-color: var(--teal); color: var(--teal); }
.review .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-main { border: 0; background: linear-gradient(135deg, var(--blue), #2563eb); color: #fff; font-weight: 650; border-radius: 12px; padding: 9px 18px;
  box-shadow: 0 6px 14px rgba(29, 78, 216, .28); display: inline-flex; align-items: center; gap: 8px; }
.btn-main:hover { filter: brightness(1.07); }
.btn-main kbd { background: rgba(255,255,255,.18); color: #fff; border: 0; }
.btn-sub { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 14px; color: var(--ink-2); }
.btn-sub:hover { border-color: var(--ink-2); }
.linkish { border: 0; background: none; color: var(--muted); padding: 8px 6px; font-size: 13px; }
.linkish:hover { color: var(--blue); }
kbd { font: 11px var(--ui); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: var(--card); color: var(--ink-2); }

.review.done { text-align: center; padding: 26px 20px; --c: var(--teal); }
.review.done .big { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--teal-soft); }
.review.done .big svg { width: 32px; height: 32px; fill: none; stroke: var(--teal); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.review.done p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.review.done h3 { margin: 0; }
.review.done .ghost { margin-top: 14px; }

.cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 10px; }
.cats:empty { display: none; }
.cat-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 4px 11px; font-size: 12.5px; }
.cat-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.cat-chip b { font-variant-numeric: tabular-nums; }
.cat-chip.off { opacity: .45; text-decoration: line-through; }
.cat-chip.bulk { border-color: transparent; background: var(--teal-soft); color: var(--teal); font-weight: 600; }

.list { display: flex; flex-direction: column; background: var(--card); border-radius: 16px; box-shadow: var(--shadow-1); overflow: hidden; }
.list:empty { display: none; }
.row { display: grid; grid-template-columns: 10px 1fr; gap: 10px; align-items: start; padding: 10px 14px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; width: 100%; }
.row:first-child { border-top: 0; }
.row:hover { background: #faf8f3; }
.row.on { background: var(--blue-soft); }
.row > i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-top: 7px; }
.row .t { font-size: 14px; overflow-wrap: anywhere; }
.row .t s { color: var(--muted); }
.row .t b { font-weight: 600; }
.row .m { font-size: 12.5px; color: var(--muted); }
.row.group .t { font-weight: 600; }
.row.sent { --c: var(--blue); background: var(--blue-soft); }
.row.sent .t { font-weight: 600; color: var(--blue); }
.row.sent .fixed { font-size: 14px; color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.row.sent .fixed b { color: var(--blue); font-weight: 600; }
.row.group .m span { display: inline-block; background: var(--soft); border-radius: 6px; padding: 0 6px; margin: 3px 4px 0 0; color: var(--ink-2); }

.cat-spelling { --c: var(--c-spelling); } .cat-grammar { --c: var(--c-grammar); } .cat-punctuation { --c: var(--c-punctuation); }
.cat-typography { --c: var(--c-typography); } .cat-style { --c: var(--c-style); }

/* morphology */
.hint-card { display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: 18px; padding: 18px; box-shadow: var(--shadow-1); color: var(--ink-2); }
.hint-card svg { width: 34px; height: 34px; fill: none; stroke: var(--teal); stroke-width: 1.8; stroke-linejoin: round; padding: 6px; background: var(--teal-soft); border-radius: 12px; }
.hint-card p { margin: 0; font-size: 14px; }
.word-card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow-2); padding: 18px 20px; }
.word-card .w { font: 600 28px/1.15 var(--text); overflow-wrap: anywhere; }
.word-card .pos { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.train { display: flex; flex-wrap: wrap; align-items: stretch; gap: 3px 0; margin: 16px 0 12px; }
.train .seg { position: relative; padding: 8px 12px 7px; text-align: center; background: var(--soft); margin-right: 3px; }
.train .seg:first-child { border-radius: 12px 4px 4px 12px; }
.train .seg:last-child { border-radius: 4px 12px 12px 4px; margin-right: 0; }
.train .seg:only-child { border-radius: 12px; }
.train .seg b { display: block; font: 600 18px/1.2 var(--text); }
.train .seg small { display: block; font-size: 10.5px; line-height: 1.25; color: var(--muted); max-width: 118px; margin-top: 3px; }
.train .seg.root { background: linear-gradient(135deg, var(--blue), var(--teal)); color: #fff; }
.train .seg.root small { color: rgba(255,255,255,.85); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 550; }
.word-card .note { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.pane-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 20px 2px 8px; }
.pane-title h3 { margin: 0; font-size: 14px; }
.pane-title input { border: 1px solid var(--line); border-radius: 10px; padding: 5px 10px; background: var(--card); width: 160px; }
.words { background: var(--card); border-radius: 16px; box-shadow: var(--shadow-1); overflow: hidden; font-size: 13.5px; }
.words:empty { display: none; }
.wrow { display: grid; grid-template-columns: 1fr 1fr 74px; gap: 8px; padding: 7px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.wrow:first-child { border-top: 0; }
.wrow:hover, .wrow:focus-visible { background: #faf8f3; }
.wrow:focus-visible, .sent:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.wrow .a { font-weight: 600; overflow-wrap: anywhere; }
.wrow .b { color: var(--ink-2); overflow-wrap: anywhere; }
.wrow .b em { font-style: normal; color: var(--teal); }
.wrow .c { color: var(--muted); font-size: 12px; text-align: right; }
.wrow.unknown .a { color: var(--c-spelling); }

/* syntax */
.engine-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.engine { font-size: 12.5px; padding: 4px 11px; border-radius: 20px; background: var(--card); color: var(--muted); box-shadow: var(--shadow-1); }
.engine.neural { color: var(--teal); font-weight: 650; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin: 4px 2px 14px; }
.lg { padding-bottom: 4px; }
.lg.Ega, .sx .Ega { box-shadow: inset 0 -2px 0 var(--r-ega); }
.lg.Kesim, .sx .Kesim { box-shadow: inset 0 -2px 0 var(--r-kesim), inset 0 -5px 0 #fff, inset 0 -7px 0 var(--r-kesim); padding-bottom: 6px; }
.lg.Toldiruvchi, .sx .Toldiruvchi { background: linear-gradient(90deg, var(--r-told) 0 6px, transparent 6px 10px) repeat-x 0 100% / 10px 2px; }
.lg.Aniqlovchi, .sx .Aniqlovchi { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='4'%3E%3Cpath d='M0 3 Q2 0 4 3 T8 3' stroke='%23d97706' stroke-width='1.4' fill='none'/%3E%3C/svg%3E") repeat-x 0 100% / 8px 4px; }
.lg.Hol, .sx .Hol { background: linear-gradient(90deg, var(--r-hol) 0 8px, transparent 8px 11px, var(--r-hol) 11px 13px, transparent 13px 16px) repeat-x 0 100% / 16px 2px; }
.sent { background: var(--card); border-radius: 18px; box-shadow: var(--shadow-1); padding: 14px 16px; margin-bottom: 12px; cursor: pointer; border: 2px solid transparent; transition: border-color .2s; }
.sent:hover, .sent.on { border-color: rgba(29, 78, 216, .25); }
.sent .badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 20px; background: var(--teal-soft); color: var(--teal); }
.badge.complex { background: #f1eafe; color: var(--c-grammar); }
.sent .sx { font: 16.5px/2.2 var(--text); }
.sent .sx span { padding-bottom: 3px; }
.members { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; margin: 10px 0 0; }
.members dt { color: var(--muted); }
.members dd { margin: 0; }
.clauses { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.clause { display: grid; grid-template-columns: 24px 1fr; gap: 8px; font-size: 13px; }
.clause .n { width: 24px; height: 24px; border-radius: 8px; background: var(--blue-soft); color: var(--blue); font-weight: 700; display: grid; place-items: center; font-size: 12px; }
.clause .r { color: var(--muted); font-size: 12px; }
.links { margin-top: 8px; font-size: 12.5px; color: var(--ink-2); background: var(--soft); border-radius: 10px; padding: 7px 10px; }
details.tree, details.pairs { margin-top: 8px; font-size: 13px; }
details.tree summary, details.pairs summary { cursor: pointer; color: var(--blue); font-weight: 600; font-size: 12.5px; }
details.pairs .r { color: var(--muted); }
.tree-svg { overflow-x: auto; padding-top: 6px; }
.tree-svg text { font: 12px var(--ui); fill: var(--ink); }
.tree-svg .rel { font-size: 10px; fill: var(--muted); }
.tree-svg path { fill: none; stroke: #9aa3b5; stroke-width: 1.2; }

/* hover tip over the editor */
.tip { position: absolute; z-index: 40; width: 320px; background: var(--card); border-radius: 16px; box-shadow: 0 16px 40px rgba(23,32,51,.18);
  padding: 12px 14px; border: 1px solid var(--line); }
.tip .tag { font-size: 11.5px; font-weight: 700; color: var(--c); text-transform: uppercase; letter-spacing: .04em; }
.tip h4 { margin: 2px 0 8px; font-size: 14.5px; }
.tip .alts { display: flex; flex-wrap: wrap; gap: 6px; }
.tip .alts button { border: 0; border-radius: 9px; padding: 5px 12px; background: var(--blue); color: #fff; font-weight: 600; }
.tip .alts button + button { background: var(--blue-soft); color: var(--blue); }
.tip .more { display: flex; gap: 4px; margin-top: 6px; }
.tip.cat-word { --c: var(--blue); }
.tip .secs { max-height: 300px; overflow-y: auto; }
.tip .sec { margin-top: 8px; }
.tip .sec .st { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.tip .alts button.alt { background: var(--blue-soft); color: var(--blue); }
.tip .alts .wait { color: var(--muted); font-size: 13px; }
.backdrop mark.sel { background-color: rgba(29, 78, 216, .14); border-radius: 3px; }

/* dialog, toast */
.dialog { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(23, 32, 51, .28); backdrop-filter: blur(3px); }
.dialog-box { width: min(480px, 100%); max-height: 90vh; overflow-y: auto; background: var(--card); border-radius: 22px; box-shadow: var(--shadow-2); padding: 20px 22px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.dialog-head h2 { margin: 0; font-size: 19px; }
.x { border: 0; background: var(--soft); width: 32px; height: 32px; border-radius: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; font-size: 14px; }
.field > span { font-weight: 650; }
.field select, .field input { border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px; background: var(--card); }
.switch { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-size: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px rgba(29, 78, 216, .35); }
.switch i { width: 38px; height: 22px; border-radius: 22px; background: #d6d1c4; position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--teal); }
.switch input:checked + i::after { transform: translateX(16px); }
.dict { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.dict span { background: var(--soft); border-radius: 8px; padding: 3px 4px 3px 9px; }
.dict button { border: 0; background: none; color: var(--muted); }
.dict em { color: var(--muted); font-style: normal; }
.keys { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--ink-2); background: var(--soft); border-radius: 14px; padding: 12px 14px; }
.keys b { width: 100%; }
.about { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 70; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-2); }

/* ------------------------------------------------------------------ small screens */
@media (max-width: 1080px) {
  .top { grid-template-columns: auto 1fr; }
  .modes { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .mode { flex: 1; justify-content: center; }
  .tool span { display: none; }
  .stage { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .inspector { position: static; max-height: none; }
}
@media (max-width: 600px) {
  .top { padding: 10px 12px; gap: 10px; }
  .brand-text small { display: none; }
  .mode { padding: 8px 6px; font-size: 13px; gap: 5px; }
  .mode svg { display: none; }
  .tool { padding: 7px 8px; }
  .editor-wrap { margin: 18px 18px 12px; }
  .backdrop, #editor { font-size: 17.5px; }
  .sheet-head { padding: 14px 16px 12px; flex-wrap: wrap; }
  .sheet-foot { padding: 10px 16px; gap: 12px; }
  .tip { width: calc(100vw - 24px); }
}

/* auto-correct: the switch in the sheet head, the bar with the undo, the corrected words (green) */
.sheet-actions { align-items: center; }
.switch.auto-switch { margin: 0 8px 0 0; font-size: 13px; gap: 7px; white-space: nowrap; }
.switch.auto-switch i { width: 32px; height: 18px; }
.switch.auto-switch i::after { width: 12px; height: 12px; }
.switch.auto-switch input:checked + i::after { transform: translateX(14px); }
.autobar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; padding: 6px 10px;
  border-radius: 8px; background: rgba(13, 148, 136, .10); color: var(--teal); font-size: 13px; }
.autobar[hidden] { display: none; }
.autobar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.backdrop mark.auto { background: rgba(22, 163, 74, .16); box-shadow: inset 0 -2px 0 rgba(22, 163, 74, .7); }
@media (max-width: 560px) { .switch.auto-switch { font-size: 12px; } }
