/* Conlang Forge: white pages, pale lavender for highlights, black text, purple for actions, header and hero (white text there,
   yellow for emphasis on purple). The token names --indigo and --saffron are historical: they now hold the purple and the yellow.
   Words of the invented languages are set in Gentium Plus (made for linguistics: handles IPA and diacritics). */
:root {
  --frost: #ffffff; --sheet: #ffffff; --sunk: #f1ebfb; --ink: #000000; --muted: #4a4260; --line: #ddd3ef;
  --indigo: #6a3fc8; --indigo-hover: #5630a8; --on-indigo: #ffffff; --link: #6a3fc8; --saffron: #ffd23f; --saffron-soft: #fff0b3;
  --purple: #6a3fc8; --on-purple: #ffffff;
  --moss: #2b6a50; --moss-soft: #d6eadf; --rust: #b0382a; --rust-soft: #f6d9d4;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #7a5fd6; --s-other: #8a93a3;
  --font-ui: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-word: "Gentium Plus", "Gentium Book Plus", Georgia, "Times New Roman", serif;
  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --frost: #120c20; --sheet: #1a1230; --sunk: #261a44; --ink: #f4effc; --muted: #b3a8cc; --line: #352857;
    --indigo: #8d63ec; --indigo-hover: #a07af2; --on-indigo: #ffffff; --link: #bfa8f8; --saffron: #ffd23f; --saffron-soft: #3d3412;
    --purple: #4d2a9e; --on-purple: #ffffff;
    --moss: #62c29b; --moss-soft: #1b3329; --rust: #f0816f; --rust-soft: #3c1f1b;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #8a6fe0; --s-other: #7d879a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--frost); color: var(--ink); font: 16px/1.5 var(--font-ui); }
h1, h2, h3, h4 { font-weight: 650; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--indigo-hover); }
:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--saffron); color: #000; padding: .5rem 1rem; z-index: 99; }
.skip:focus { left: 8px; top: 8px; }
.word { font-family: var(--font-word); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.stack > * + * { margin-top: 1rem; }
.hidden { display: none !important; }

/* ---------- shell */
.top { background: var(--purple); color: var(--on-purple); border-bottom: 1px solid rgba(0,0,0,.2); position: sticky; top: 0; z-index: 20; }
.top .in { max-width: 1120px; margin: 0 auto; padding: .6rem 16px; display: flex; align-items: center; gap: 1.25rem; }
.brand { white-space: nowrap; display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.1rem; color: var(--on-purple); text-decoration: none; }
.brand > span { display: flex; align-items: center; }
.brand img { display: block; height: 36px; width: auto; }
.nav { display: flex; gap: .25rem; flex: 1; }
.nav a { color: var(--on-purple); opacity: .85; text-decoration: none; padding: .4rem .7rem; border-radius: var(--radius); font-weight: 550; }
.nav a:hover { background: rgba(255,255,255,.16); opacity: 1; }
.nav a[aria-current="page"] { color: var(--on-purple); opacity: 1; box-shadow: inset 0 -3px 0 var(--saffron); border-radius: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 16px 80px; }
.wrap.narrow { max-width: 460px; }
.top .acct { color: var(--on-purple); text-decoration: none; font-weight: 550; padding: .4rem .5rem; }
.top .acct:hover { text-decoration: underline; }
.meter-chip { font-size: .8rem; color: var(--on-purple); display: flex; flex-direction: column; gap: 3px; min-width: 120px; text-decoration: none; }
.meter-chip:hover { color: var(--saffron); }
.top .meter { background: rgba(255,255,255,.28); } .top .meter > i { background: var(--saffron); }
.top button.ghost { color: var(--on-purple); } .top button.ghost:hover { background: rgba(255,255,255,.16); color: var(--on-purple); }
.top :focus-visible { outline-color: var(--saffron); }

/* ---------- controls */
button, .btn { font: inherit; font-weight: 600; border-radius: var(--radius); border: 1px solid var(--line); background: var(--sheet); color: var(--ink);
  padding: .5rem .95rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; }
button:hover, .btn:hover { border-color: var(--muted); }
button.primary, .btn.primary { background: var(--indigo); border-color: var(--indigo); color: var(--on-indigo); }
button.primary:hover, .btn.primary:hover { background: var(--indigo-hover); border-color: var(--indigo-hover); }
button.danger { color: var(--rust); border-color: var(--rust); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--ink); background: var(--sunk); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.small, .btn.small { padding: .25rem .6rem; font-size: .85rem; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
input, select, textarea { font: inherit; width: 100%; padding: .55rem .7rem; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--sheet); color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--indigo); outline: 2px solid var(--saffron); outline-offset: 0; }
input[type=checkbox] { width: auto; }
.field { margin-bottom: 1rem; } .hint { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.err { color: var(--rust); background: var(--rust-soft); padding: .6rem .8rem; border-radius: var(--radius); margin: 0 0 1rem; }
.ok { color: var(--moss); background: var(--moss-soft); padding: .6rem .8rem; border-radius: var(--radius); margin: 0 0 1rem; }
.tag { display: inline-block; font-size: .8rem; padding: .1rem .55rem; border-radius: 99px; background: var(--sunk); color: var(--ink); margin: 0 .25rem .25rem 0; }
.tag.on { background: var(--moss-soft); color: var(--moss); } .tag.off { background: var(--rust-soft); color: var(--rust); }
.tag.admin { background: var(--saffron-soft); }

/* ---------- sign in */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: calc(100vh - 0px); }
.auth .pitch { padding: 12vh 6vw 6vh; background: var(--purple); color: var(--on-purple); display: flex; flex-direction: column; justify-content: center; }
.auth .pitch h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); letter-spacing: -.02em; margin-bottom: .4em; }
.auth .pitch p { font-size: 1.1rem; opacity: .9; }
.auth .sample { color: var(--saffron); font-family: var(--font-word); font-size: 1.5rem; margin: 1.5rem 0 .2rem; border-left: 4px solid var(--saffron); padding-left: 1rem; }
.auth .sample small { color: var(--on-purple); display: block; font-family: var(--font-ui); font-size: .9rem; opacity: .8; }
.auth .formside { padding: 12vh 6vw 6vh; display: flex; align-items: center; }
.auth .formside > div { width: 100%; max-width: 380px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.25rem; }
.seg button { border: 0; border-radius: 0; background: transparent; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--frost); }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .85rem; margin: 1rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
@media (max-width: 780px) { .auth { grid-template-columns: 1fr; } .auth .pitch { padding: 8vh 24px 4vh; } .auth .formside { padding: 4vh 24px 8vh; } }

/* ---------- languages list + forge */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
@media (max-width: 900px) { .home { grid-template-columns: 1fr; } }
.langlist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.langlist li { border-bottom: 1px solid var(--line); }
.langlist a { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; padding: 1rem .25rem; text-decoration: none; color: var(--ink); }
.langlist a:hover { background: var(--sunk); }
.langlist .nm { font-family: var(--font-word); font-size: 1.7rem; line-height: 1.15; }
.langlist .meta { color: var(--muted); font-size: .9rem; grid-column: 1; }
.langlist .when { color: var(--muted); font-size: .85rem; grid-row: 1; grid-column: 2; }
.langlist .line { grid-column: 1 / -1; display: block; color: var(--ink); min-height: 2rem; }
.langlist .line:empty { display: none; }
.langlist .line svg { height: 2.1rem; width: auto; max-width: 100%; display: block; }
.forge { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; position: sticky; top: 76px; }
.forge h2 { margin-bottom: .2em; }
.seedrow { display: flex; gap: .5rem; } .seedrow input { flex: 1; font-variant-numeric: tabular-nums; }
details.dials { margin: .5rem 0 1rem; } details.dials summary { cursor: pointer; font-weight: 600; margin-bottom: .75rem; }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 36px 24px; text-align: center; color: var(--muted); }
.empty .word { font-size: 1.5rem; color: var(--ink); display: block; margin-bottom: .3rem; }

/* ---------- language page */
.lhead { margin-bottom: 1.25rem; }
.lhead h1.word { font-size: clamp(2.6rem, 7vw, 4.4rem); font-weight: 400; margin: .1em 0 .15em; letter-spacing: 0;
  background: linear-gradient(transparent 82%, var(--saffron) 82%, var(--saffron) 90%, transparent 90%); display: inline-block; line-height: 1.15; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: 1rem 0 1.5rem; overflow-x: auto; }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--saffron); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 40px; }
dl.facts { display: grid; grid-template-columns: 9.5rem 1fr; gap: .45rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); } dl.facts dd { margin: 0; }
.letters { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .75rem; }
.letters span { font-family: var(--font-word); font-size: 1.25rem; min-width: 2.1rem; text-align: center; padding: .1rem .4rem; background: var(--sheet); border: 1px solid var(--line); border-radius: 4px; }
.letters.v span { border-color: var(--saffron); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; background: transparent; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--sunk); }

/* ---------- dictionary */
.dicttools { display: grid; grid-template-columns: 1fr auto; gap: .75rem; margin-bottom: .75rem; align-items: center; }
.dicttools .opts { display: flex; gap: .5rem; flex-wrap: wrap; }
.dicttools select { width: auto; }
.jump { display: flex; flex-wrap: wrap; gap: .15rem; margin-bottom: 1rem; }
.jump button { padding: .1rem .5rem; font-size: .9rem; border: 0; background: transparent; color: var(--indigo); }
.jump button:hover { background: var(--sunk); }
.entries { list-style: none; margin: 0; padding: 0; }
.entries li { display: grid; grid-template-columns: minmax(7rem, 30%) 1fr; gap: .25rem 1.25rem; padding: .6rem .25rem; border-bottom: 1px solid var(--line); }
.entries .head { font-size: 1.15rem; font-weight: 650; }
.entries .head.word { font-weight: 400; font-size: 1.4rem; }
.entries .ipa { font-family: var(--font-word); color: var(--muted); }
.entries .pos { color: var(--muted); font-style: italic; font-size: .9rem; }
.entries .more { color: var(--muted); font-size: .9rem; }
.entries .letterhead { display: block; grid-column: 1 / -1; font-family: var(--font-word); font-size: 1.6rem; padding-top: 1rem; border-bottom: 2px solid var(--saffron); }
@media (max-width: 600px) { .entries li { grid-template-columns: 1fr; } }

/* ---------- reading (grammar book) */
.book { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 40px; align-items: start; }
.toc { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow: auto; font-size: .9rem; }
.toc a { display: block; padding: .2rem .5rem; color: var(--muted); text-decoration: none; border-left: 2px solid var(--line); }
.toc a:hover { color: var(--ink); border-left-color: var(--saffron); }
.toc a.l3 { padding-left: 1.2rem; font-size: .85rem; }
.prose { max-width: 72ch; }
.prose h1 { font-size: 2rem; } .prose h2 { margin-top: 2.2em; padding-top: .6em; border-top: 1px solid var(--line); }
.prose h3 { margin-top: 1.6em; }
.prose pre { background: var(--sheet); border: 1px solid var(--line); border-left: 4px solid var(--saffron); padding: .7rem 1rem; overflow-x: auto;
  font-family: var(--font-word); font-size: 1.1rem; line-height: 1.55; margin: 1em 0; border-radius: 0 var(--radius) var(--radius) 0; white-space: pre-wrap; }
.prose code { font-family: var(--font-word); background: var(--sunk); padding: 0 .3em; border-radius: 3px; }
.prose table { margin: 1em 0; font-size: .95rem; } .prose td, .prose th { padding: .35rem .6rem; }
.prose details { border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .9rem; margin: 1em 0; background: var(--sheet); }
.prose summary { cursor: pointer; font-weight: 600; }
.prose blockquote { margin: 1em 0; padding: .1em 1em; border-left: 4px solid var(--line); color: var(--muted); }
@media (max-width: 860px) { .book { grid-template-columns: 1fr; } .toc { position: static; max-height: none; } }

/* ---------- meters, charts, admin */
.meter { height: 8px; background: var(--sunk); border-radius: 99px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--indigo); border-radius: 99px; }
.meter.hot > i { background: var(--saffron); } .meter.full > i { background: var(--rust); }
.kpis { display: flex; flex-wrap: wrap; gap: 2.5rem; margin-bottom: 1.5rem; }
.kpi b { display: block; font-size: 1.9rem; font-variant-numeric: tabular-nums; line-height: 1.1; } .kpi span { color: var(--muted); font-size: .9rem; }
.chart { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 10px; margin-bottom: 1.5rem; position: relative; }
.chart h3 { margin-bottom: .15em; } .chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .85rem; margin: .5rem 0 .25rem; color: var(--muted); }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .35rem; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--frost); padding: .4rem .6rem; border-radius: var(--radius); font-size: .82rem; z-index: 5; white-space: nowrap; }
.drawer-back { position: fixed; inset: 0; background: rgba(8, 12, 24, .45); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { width: min(520px, 100%); background: var(--sheet); height: 100%; overflow-y: auto; padding: 22px; border-left: 1px solid var(--line); }
.modal-back { position: fixed; inset: 0; background: rgba(8, 12, 24, .45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--sheet); border-radius: var(--radius); padding: 22px; width: min(440px, 100%); border: 1px solid var(--line); }
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.toast { background: var(--ink); color: var(--frost); padding: .6rem 1rem; border-radius: var(--radius); font-weight: 550; }
.toast.bad { background: var(--rust); color: #fff; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--indigo); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.forging { padding: 3rem 1rem; text-align: center; }
.forging .word { font-size: 2rem; display: block; margin-bottom: .5rem; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
@media (max-width: 640px) { .meter-chip { display: none; } .top .in { gap: .5rem; } }

/* ---- translate tab */
.translate { max-width: 52rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: .8rem; background: var(--sheet); }
.seg button { border: 0; border-radius: 0; background: transparent; color: var(--muted); font-weight: 600; padding: .5rem 1rem; }
.seg button.on { background: var(--indigo); color: var(--on-indigo); }
.check { display: flex; align-items: center; gap: .4rem; cursor: pointer; }
.check input { width: auto; }
.tr-out { margin-top: .5rem; }
.tr-sentence { padding: .9rem 0 1rem; border-top: 1px solid var(--line); }
.tr-sentence:first-of-type { border-top: 0; }
.big { font-size: clamp(1.6rem, 4.5vw, 2.3rem); line-height: 1.25; margin-bottom: .55rem; }
.big-en { font-size: 1.35rem; line-height: 1.4; margin: .2rem 0 .6rem; }
.interlinear { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; margin: .4rem 0 .8rem; }
.il { display: flex; flex-direction: column; }
.il .form { font-size: 1.15rem; }
.il .gl { font-size: .8rem; color: var(--muted); }
.il.unk .gl { font-style: italic; }
.tr-edit { margin: 1rem 0; padding: 1rem 1.1rem; }
.tr-edit h3 { margin: 0 0 .15rem; font-size: 1.05rem; }
.notes { margin: .8rem 0; font-size: .92rem; color: var(--muted); }
.notes summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.error { color: var(--rust); }
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* settings editor */
.settings { max-width: 56rem; }
.sgroup { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: .25rem 1rem; margin-bottom: .75rem; }
.sgroup > summary { cursor: pointer; font-weight: 650; font-size: 1.1rem; padding: .6rem 0; }
.badge { margin-left: .6rem; font-size: .75rem; background: var(--saffron-soft); color: var(--ink); padding: .1rem .5rem; border-radius: 99px; font-weight: 600; }
.srow { padding: .8rem 0; border-top: 1px solid var(--line); }
.srow.edited { border-left: 3px solid var(--saffron); padding-left: .75rem; margin-left: -.75rem; }
.shead { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.slabel { font-weight: 600; }
.scontrol { margin-top: .5rem; }
.scontrol select, .scontrol input[type=text] { max-width: 28rem; }
button.lock { font-size: .78rem; padding: .1rem .6rem; border-radius: 99px; background: var(--sunk); color: var(--muted); border: 1px solid var(--line); }
button.lock.fixed { background: var(--saffron-soft); color: var(--ink); border-color: var(--saffron); }
.chipgroup { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-bottom: .4rem; }
.gname { font-size: .75rem; color: var(--muted); min-width: 5.5rem; }
.chip { display: inline-flex; align-items: center; padding: .15rem .55rem; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; font-size: 1.1rem; background: var(--frost); user-select: none; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip.on { background: var(--indigo); color: var(--on-indigo); border-color: var(--indigo); }
.chip:focus-within { outline: 3px solid var(--saffron); }
.slider { display: flex; gap: .6rem; align-items: center; }
.slider input[type=range] { flex: 1; max-width: 22rem; }
.slider input[type=number] { width: 5.5rem; }
.wrow { display: flex; align-items: center; gap: .6rem; margin-bottom: .2rem; }
.wl { min-width: 2.6rem; font-size: 1.1rem; }
.odds .orow { display: flex; gap: .6rem; align-items: center; margin-bottom: .25rem; }
.odds .orow span:first-child { flex: 1; max-width: 22rem; }
.odds .orow input { width: 5.5rem; } .odds .pc { min-width: 3rem; }
details.odds-box { margin-top: .5rem; font-size: .9rem; } details.odds-box summary { cursor: pointer; color: var(--muted); }
.savebar { position: sticky; bottom: 0; display: none; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 1rem; margin-top: 1rem; background: var(--ink); color: var(--frost); border-radius: var(--radius); }
.savebar.on { display: flex; }
.savebar button.ghost { color: var(--frost); }
table.diff td { padding: .3rem .6rem .3rem 0; vertical-align: top; }
button.ghost { background: transparent; border: 1px solid transparent; }
.exemplar { background: var(--sheet); border: 1px solid var(--saffron); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.exemplar textarea { width: 100%; }
.prop { padding: .6rem 0; border-top: 1px solid var(--line); }
.prop .conf { font-size: .75rem; padding: .05rem .45rem; border-radius: 99px; background: var(--sunk); }
.prop.conflict { border-left: 3px solid var(--rust); padding-left: .6rem; }
.modal { max-height: 92vh; overflow-y: auto; }
.modal > .row.end { position: sticky; bottom: -1px; background: var(--sheet); padding: .75rem 0 .1rem; border-top: 1px solid var(--line); }

.banner { background: var(--sunk); color: inherit; padding: .5rem 1rem; text-align: center; font-size: .92rem; border-bottom: 1px solid rgba(0,0,0,.08); }
.banner button { margin-left: .5rem; }

.debugbar { margin: 0 0 1rem; }
button.debug { background: #d6336c; color: #fff; border-color: #b02a58; font-weight: 600; }
button.debug:hover { background: #b02a58; }
.tag.debug { background: #d6336c; color: #fff; margin-left: .35rem; }
.debugjson { width: 100%; font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; }
.samplemeter { margin: .4rem 0 .8rem; }
.samplemeter progress { width: 100%; height: .5rem; accent-color: var(--moss, #3a7d44); }
.samplemeter[data-level="none"] progress { accent-color: var(--rust, #b4472f); }
.samplemeter[data-level="partial"] progress { accent-color: #c98b14; }

/* Writing systems */
.scr-bar { gap: .6rem; align-items: center; margin: .6rem 0 1rem; }
.scr-seed input { width: 9rem; }
.scr-layout { display: grid; grid-template-columns: minmax(16rem, 22rem) 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 800px) { .scr-layout { grid-template-columns: 1fr; } }
.scr-group { border: 1px solid var(--line, #ddd); border-radius: 8px; margin: 0 0 .8rem; padding: .4rem .8rem .6rem; }
.scr-dial { display: grid; grid-template-columns: 1fr auto; gap: .15rem .5rem; align-items: center; padding: .3rem 0; }
.scr-dial .scr-name { grid-column: 1 / -1; font-size: .85rem; }
.scr-dial input[type=range], .scr-dial select { width: 100%; }
.scr-dial output { grid-column: 1; font-size: .8rem; color: var(--muted, #666); }
.scr-dial:not(.pinned) .scr-name { color: var(--muted, #666); }
.scr-dial.pinned .scr-name { font-weight: 600; }
.scr-card { background: var(--sheet); border: 1px solid var(--line, #ddd); border-radius: 8px; padding: .6rem .9rem; margin-bottom: 1rem; }
.scr-card h3 { margin: 0 0 .4rem; font-size: .95rem; }
.scr-svg svg { max-width: 100%; height: auto; }
.scr-svg { background: #fff; color: #000; border-radius: 6px; }
.scr-out.loading { opacity: .55; }
.scr-lock { border: 0; padding: 0; margin: 0; min-width: 0; }
.scr-lock:disabled .scr-head, .scr-lock:disabled .scr-bar, .scr-lock:disabled .scr-layout > :first-child, .scr-lock:disabled > .scr-card { opacity: .55; cursor: progress; }
.scr-wait { position: sticky; top: 0; z-index: 5; background: var(--sheet); border: 1px solid var(--line, #ddd); border-radius: 8px; padding: .5rem .8rem; margin: .4rem 0; }

/* writing systems: list, editor header, written text */
.badge { font-size: .75rem; padding: .05rem .5rem; border-radius: 999px; background: var(--saffron, #ffd23f); color: #000; font-weight: 600; }
.scr-head { display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; align-items: end; margin: .6rem 0; }
.scr-head label { display: grid; gap: .2rem; font-size: .85rem; }
.scr-head input[type=text] { min-width: 15rem; }
.scr-sentence { padding: .3rem 0 .5rem; border-bottom: 1px solid var(--line, #eee); }
.scr-sentence:last-child { border-bottom: 0; }
.wr-box { margin: .4rem 0 1rem; }
.wr-line { padding: .2rem 0; border-bottom: 1px solid var(--line, #eee); }
.wr-map td { padding: .15rem .6rem .15rem 0; }
.writing textarea { width: 100%; font-size: 1.1rem; }
a.btn { text-decoration: none; display: inline-block; }
.tr-writing { padding: .8rem 1rem; margin: .6rem 0 1rem; }
.tr-writing label { font-weight: 600; }
.tr-image { background: #fff; border: 1px solid var(--line, #ddd); border-radius: 8px; padding: .3rem; margin-top: .6rem; overflow-x: auto; }
.tr-image svg { max-width: 100%; height: auto; display: block; }
.tr-download { margin-top: .5rem; }
.scr-card textarea { width: 100%; }
.scr-suggest { list-style: none; padding: 0; margin: .3rem 0 .6rem; display: grid; gap: .25rem; }
.scr-dial.pinned { border-left: 3px solid var(--saffron, #ffd23f); padding-left: .45rem; }
.scr-thumb { max-height: 3.5rem; border: 1px solid var(--line, #ddd); border-radius: 6px; background: #fff; }

/* versions (checkpoints) */
.ver .row { align-items: center; gap: .5rem; flex-wrap: wrap; }
.ver input[type=text] { flex: 1 1 14rem; min-width: 10rem; }
.ver-list { list-style: none; padding: 0; margin: .8rem 0; }
.ver-list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .5rem 0; border-top: 1px solid var(--line, #ddd); }
.ver-view .scr-svg svg { max-width: 100%; height: auto; }

/* the create-a-writing-system panel sits in the narrow column beside the list */
.forge .seg { display: flex; flex-wrap: wrap; } .forge .seg button { flex: 1 1 auto; padding: .45rem .7rem; }
.forge .scr-dial { display: grid; grid-template-columns: 1fr; gap: .2rem; margin-bottom: .7rem; }
.forge textarea, .forge input[type="file"] { width: 100%; }
.forge .seg button[aria-pressed="true"] { background: var(--indigo); color: var(--on-indigo); }
