/*
  Yozuv — palette taken from Samarkand tilework: glazed turquoise on cool porcelain,
  lapis-blue ink, saffron for words that need a human look.
*/
:root {
  --bg: #e8eef1;
  --surface: #ffffff;
  --ink: #13294b;
  --muted: #586a7e;
  --line: #c6d3db;
  --tile: #0e7c86;
  --tile-ink: #ffffff;
  --tile-soft: #d7eef0;
  --saffron: #f6d27a;
  --saffron-ink: #6b4a00;
  --focus: #1b55c9;
  --warn-bg: #fff4d6;
  --warn-line: #e8b93e;
  --warn-ink: #5c3d00;
  --info-bg: #e3f1f3;
  --info-line: #8cc7cd;
  --err-bg: #fde8e6;
  --err-line: #e39a92;
  --err-ink: #7a1d12;
  --radius-s: 6px;
  --radius-l: 14px;
  --serif: "PT Serif", "Noto Serif", Georgia, serif;
  --sans: "PT Sans", "Noto Sans", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1a26;
    --surface: #172433;
    --ink: #e6eef6;
    --muted: #9fb0c2;
    --line: #2b3d50;
    --tile: #2fb3bd;
    --tile-ink: #08202a;
    --tile-soft: #173b44;
    --saffron: #8a6a1c;
    --saffron-ink: #fff3cf;
    --focus: #7fb0ff;
    --warn-bg: #3a2e10;
    --warn-line: #8a6a1c;
    --warn-ink: #ffe7a8;
    --info-bg: #13323a;
    --info-line: #2b6b74;
    --err-bg: #3d1a17;
    --err-line: #8c3b32;
    --err-ink: #ffd5cf;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}

button, select, textarea, input { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 0.8125rem; color: var(--muted); }

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 18px;
}
.logo { display: flex; align-items: center; gap: 14px; margin: 0; }
.logo-mark { width: 48px; height: 48px; flex: none; }
.wordmark {
  margin: 0;
  font: 700 2.25rem/1 var(--serif);
  letter-spacing: -0.01em;
}
.tagline { margin: 6px 0 0; color: var(--muted); max-width: 60ch; }
.top-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lang {
  position: relative; display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.lang .ico { position: absolute; left: 12px; pointer-events: none; color: var(--muted); }
.lang select {
  appearance: none; -webkit-appearance: none;
  min-height: 40px; padding: 0 34px 0 38px; border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 16px center, right 11px center; background-size: 5px 5px; background-repeat: no-repeat;
}
.lang:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.lang select:focus { outline: none; }

/* ---------- icons ---------- */
.ico {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.btn .ico { margin-right: 7px; }
.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border: 1px solid transparent; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { border-color: var(--line); color: var(--ink); background: var(--surface); }

/* ---------- workspace ---------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}
.pane { min-width: 0; }
.pane-label { margin: 0 0 8px; font-size: 0.875rem; font-weight: 400; color: var(--muted); }

/* The signature element: each script is a glazed tile showing the same word in that script */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.tiles-3 { grid-template-columns: repeat(3, 1fr); }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-width: 0;
  padding: 10px 12px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: background-color .15s, border-color .15s, color .15s;
}
.tile:hover { border-color: var(--tile); }
.tile-word {
  font: 700 1.375rem/1.1 var(--serif);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.tile-auto .tile-word { font: 700 1rem/1.5 var(--sans); }
.tile-note {
  font-size: 0.75rem; line-height: 1.3; color: var(--muted);
  max-width: 100%;
  min-height: 1.3em;
}
.tile[aria-checked="true"] {
  background: var(--tile);
  border-color: var(--tile);
  color: var(--tile-ink);
}
.tile[aria-checked="true"] .tile-note { color: inherit; opacity: 0.85; }
.tile.is-wrong[aria-checked="true"] { background: var(--warn-line); border-color: var(--warn-line); color: #241800; }

.box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  overflow: hidden;
}
.box:focus-within { border-color: var(--tile); }
#input, .output {
  display: block;
  width: 100%;
  height: clamp(320px, 52vh, 640px);
  margin: 0;
  padding: 18px 20px;
  border: 0;
  background: transparent;
  font: 1.0625rem/1.65 var(--serif);
  overflow: auto;
}
#input { resize: vertical; }
#input:focus, .output:focus { outline: none; }
.output { white-space: pre-wrap; overflow-wrap: anywhere; }
.output.is-empty { color: var(--muted); }
.output.is-busy { opacity: 0.55; }
.cut {
  margin: 0; padding: 8px 20px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem; color: var(--muted);
}
mark {
  background: var(--saffron);
  color: var(--saffron-ink);
  border-radius: 3px;
  padding: 0 1px;
}

.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  min-height: 44px;
  padding-top: 8px;
}
.spacer { flex: 1; }
.stats { font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.stats b { font-weight: 700; color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer;
  font-size: 0.9375rem;
}
.btn:hover { border-color: var(--ink); }
a.btn { text-decoration: none; }
a.btn:not(.btn-primary) { color: inherit; }
.btn-primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn-primary:hover { background: var(--tile); border-color: var(--tile); color: var(--tile-ink); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-s { min-height: 34px; padding: 0 12px; font-size: 0.875rem; }
.btn-warn { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn-warn:hover { background: var(--tile); border-color: var(--tile); color: var(--tile-ink); }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover { border-color: var(--line); background: var(--surface); }
.file-btn { position: relative; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-btn:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.apos { display: inline-flex; align-items: center; gap: 6px; }
.apos select {
  min-height: 32px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); padding: 0 6px; font-family: var(--serif);
}

.swap {
  align-self: center;
  margin-top: 70px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); cursor: pointer;
}
.swap:hover { border-color: var(--tile); color: var(--tile); }
.swap .ico { width: 22px; height: 22px; }

/* ---------- review list ---------- */
.review {
  max-width: 1280px;
  margin: 20px auto 0;
  padding: 0 24px;
}
.review h2 { margin: 0; font: 700 1.125rem/1.4 var(--serif); }
.review .count {
  display: inline-block; min-width: 1.6em; padding: 0 6px; margin-left: 4px;
  border-radius: 999px; background: var(--saffron); color: var(--saffron-ink);
  font: 700 0.8125rem/1.6 var(--sans); text-align: center;
}
.review p { margin: 4px 0 10px; max-width: 70ch; }
.review ul {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 24px;
}
.review li {
  display: grid; grid-template-columns: auto 1fr; gap: 0 10px;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.review .pair { font-family: var(--serif); }
.review .pair span { color: var(--muted); }
.review .why { grid-column: 1 / -1; font-size: 0.8125rem; color: var(--muted); }
.review .times { font-size: 0.8125rem; color: var(--muted); text-align: right; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px);
  padding: 8px 16px; border-radius: 999px;
  background: var(--ink); color: var(--surface);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.foot {
  max-width: 1280px; margin: 32px auto 0; padding: 18px 24px 32px;
  color: var(--muted); font-size: 0.8125rem;
}
.foot p { margin: 0; max-width: 80ch; }

/* ---------- notices (wrong script, same script, file errors) ---------- */
.notice {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 0 10px; padding: 12px 8px 12px 14px;
  border: 1px solid; border-left-width: 4px; border-radius: var(--radius-s);
}
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.notice-info { background: var(--info-bg); border-color: var(--info-line); }
.notice-error { background: var(--err-bg); border-color: var(--err-line); color: var(--err-ink); }
.notice-ico { width: 20px; height: 20px; margin-top: 1px; }
.notice-body { flex: 1; min-width: 0; }
.notice p { margin: 0; }
.notice-title { font-weight: 700; }
.notice-text { margin-top: 2px !important; font-size: 0.9375rem; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.notice .icon-btn { color: inherit; margin: -6px 0; }

/* ---------- uploaded file ---------- */
.filecard {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 0 0 10px; padding: 12px 8px 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface);
}
.filecard-ico { width: 28px; height: 28px; color: var(--tile); }
.filecard-body { flex: 1; min-width: 0; }
.filecard p { margin: 0; }
.filecard-name { font-weight: 700; overflow-wrap: anywhere; }
.filecard-meta { font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.filecard-note { margin-top: 4px !important; font-size: 0.8125rem; }

.drop { position: relative; }
.drop-veil {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: color-mix(in srgb, var(--tile-soft) 92%, transparent);
  border: 2px dashed var(--tile); border-radius: var(--radius-l);
  color: var(--ink); font-weight: 700; pointer-events: none;
}
.drop-veil .ico { width: 32px; height: 32px; }
.drop.is-over .drop-veil { display: flex; }
.hint { margin: 2px 0 0; font-size: 0.8125rem; color: var(--muted); text-align: right; }

/* ---------- output extras ---------- */
.flagchip {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 8px; padding: 4px 12px 4px 8px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 0.875rem; cursor: pointer; color: var(--ink);
}
.flagchip:hover { border-color: var(--saffron-ink); }
.flagchip .swatch { width: 14px; height: 14px; border-radius: 3px; background: var(--saffron); }
.bar-actions { justify-content: flex-end; padding-top: 0; }
.dl { display: inline-flex; align-items: stretch; }
.dl-format select {
  height: 100%; min-height: 36px; padding: 0 8px 0 12px;
  border: 1px solid var(--line); border-right: 0; border-radius: 999px 0 0 999px;
  background: var(--surface); cursor: pointer;
}
.dl-btn { border-radius: 0 999px 999px 0; }

/* ---------- review: why yellow, fixing a word, my words ---------- */
.explain {
  margin: 0 0 12px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface);
  max-width: 80ch;
}
.explain summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; }
.explain summary .ico { color: var(--tile); }
.explain p { margin: 8px 0 0; }
.review li .side { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; }
.review .pair b, .mywords .pair b { font-weight: 700; }
.fix { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fix-label { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 220px; font-family: var(--serif); }
.fix input {
  flex: 1; min-width: 0; min-height: 36px; padding: 0 10px;
  border: 1px solid var(--tile); border-radius: var(--radius-s); background: var(--surface);
  font: 1rem var(--serif);
}
.mywords { max-width: 1280px; margin: 24px auto 0; padding: 0 24px; }
.mywords h2 { margin: 0; font: 700 1.125rem/1.4 var(--serif); }
.mywords p { margin: 4px 0 10px; }
.mywords ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 24px; }
.mywords li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); font-family: var(--serif); }
.count-quiet { background: var(--line) !important; color: var(--ink) !important; }

/* ---------- footer ---------- */
.foot-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px 48px; align-items: start; }
.foot-line { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 8px !important; }
.foot-line .ico { margin-top: 2px; }
.contact h2 { margin: 0 0 4px; font: 700 1rem/1.4 var(--serif); color: var(--ink); }
.contact p { margin: 0 0 8px; }
.contact ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.contact a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px;
  color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
}
.contact a:hover { color: var(--tile); text-decoration: underline; }
.copyright { margin: 20px 0 0 !important; }
.copyright a { color: inherit; }

/* ---------- Pro ---------- */
.pro-btn { border-color: var(--saffron); }
.pro-btn .ico { color: var(--saffron-ink); }
.pro-btn.is-active { background: var(--saffron); color: var(--saffron-ink); border-color: var(--saffron); }
.dlg {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-l);
  background: var(--surface); color: var(--ink);
}
.dlg::backdrop { background: rgba(10, 20, 30, .45); }
.dlg h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 700 1.375rem/1.3 var(--serif); }
.dlg h2 .ico { width: 22px; height: 22px; color: var(--saffron-ink); }
.dlg p { margin: 8px 0; }
.dlg-close { float: right; margin: -10px -10px 0 0; }
.plans { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.9375rem; }
.plans th, .plans td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.plans thead th { font-size: 0.8125rem; color: var(--muted); }
.plans thead th:last-child, .plans td:last-child { font-weight: 700; }
.plans tbody th { font-weight: 400; }
.pro-status { padding: 8px 12px; border-radius: var(--radius-s); background: var(--saffron); color: var(--saffron-ink); font-weight: 700; }
.pro-status.is-off { background: var(--err-bg); color: var(--err-ink); }
.pro-key { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.pro-key label { font-weight: 700; }
.pro-key-row { display: flex; gap: 8px; margin-top: 6px; }
.pro-key input {
  flex: 1; min-width: 0; min-height: 40px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--bg); font-family: ui-monospace, monospace; font-size: 0.8125rem;
}
.pro-msg { min-height: 1.4em; font-size: 0.875rem; }

/* ---------- letter helper ---------- */
.letters { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.letters button {
  min-width: 36px; height: 34px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface);
  font: 1rem var(--serif); cursor: pointer;
}
.letters button:hover { border-color: var(--tile); color: var(--tile); }

/* ---------- several files ---------- */
.batch { margin: 0 0 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }
.batch-head { display: flex; align-items: center; justify-content: space-between; }
.batch-title { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 700; }
.batch-title .ico { color: var(--tile); }
.batch .small { margin: 2px 0 8px; }
.batch ul { list-style: none; margin: 0 0 10px; padding: 0; }
.batch li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); }
.b-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.b-status { font-size: 0.8125rem; color: var(--muted); white-space: nowrap; }
.b-ready .b-status { color: var(--tile); font-weight: 700; }
.b-failed .b-status { color: var(--err-ink); }

/* ---------- result view, paste note, tools ---------- */
.viewseg { display: inline-flex; margin: -2px 0 8px; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--surface); }
.viewseg button { border: 0; background: transparent; padding: 3px 12px; border-radius: 999px; cursor: pointer; font-size: 0.875rem; }
.viewseg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.outbox { position: relative; }
.pairs { white-space: normal; }
.pair-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.pair-row p { margin: 0; }
.pair-src { color: var(--muted); font-size: 0.9375rem; }
.pair-dst { margin-top: 2px !important; }
.pasted {
  position: absolute; top: 10px; right: 12px; padding: 2px 10px; border-radius: 999px;
  background: var(--tile); color: var(--tile-ink); font-size: 0.8125rem; font-weight: 700;
  opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s; pointer-events: none;
}
.pasted.show { opacity: 1; transform: none; }
.out-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.out-tools .flagchip { margin-top: 0; }
.hint-kbd { text-align: right; }
@media (pointer: coarse) { .hint-kbd { display: none; } }

/* dropdown menu (share) */
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 5; min-width: 230px;
  display: grid; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); box-shadow: 0 8px 24px rgba(10, 20, 30, .15);
}
.menu-list button {
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px;
  border: 0; border-radius: var(--radius-s); background: transparent; text-align: left; cursor: pointer;
}
.menu-list button:hover { background: var(--bg); }

/* ---------- history ---------- */
.history { max-width: 1280px; margin: 24px auto 0; padding: 0 24px; }
.history summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font: 700 1.125rem/1.4 var(--serif); }
.history summary .ico { color: var(--tile); }
.history p { margin: 4px 0 10px; }
.history ul { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.h-body { flex: 1; min-width: 0; display: grid; }
.h-meta { font-size: 0.8125rem; color: var(--muted); }
.h-text { font-family: var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--tile); }

/* ---------- status rows under the tiles (same height in both panes, so the boxes line up) ---------- */
.pane-status { display: flex; align-items: center; gap: 8px; min-height: 34px; margin-bottom: 8px; min-width: 0; }
.pane-status .viewseg { margin: 0; flex: none; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%;
  padding: 4px 10px; border-radius: 999px; font-size: 0.8125rem; line-height: 1.3;
  border: 1px solid; white-space: nowrap;
}
.status-pill .msg { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.status-pill .ico { width: 16px; height: 16px; flex: none; }
.status-info { background: var(--info-bg); border-color: var(--info-line); color: var(--ink); }
.status-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.link-btn {
  flex: none; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 700;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.tile.flash { animation: tileflash 1.2s ease-out; }
@keyframes tileflash { 0% { box-shadow: 0 0 0 0 var(--saffron); } 30% { box-shadow: 0 0 0 5px var(--saffron); } 100% { box-shadow: 0 0 0 0 transparent; } }
.letters-label { flex-basis: 100%; font-size: 0.75rem; color: var(--muted); }
.limitchip .ico { width: 15px; height: 15px; color: var(--saffron-ink); }
.drop + .letters + .filecard, .letters + .filecard, .letters + .batch, .letters + .notice { margin-top: 10px; }
.box + .filecard, .box + .batch, .box + .notice { margin-top: 10px; }
#histdlg { width: min(640px, calc(100vw - 32px)); }
#histdlg ul { list-style: none; margin: 0; padding: 0; }
#histdlg li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
#history-open .count { margin-left: 6px; }

/* ---------- tablets and phones ---------- */
@media (max-width: 1024px) {
  .top { padding: 22px 20px 14px; }
  .workspace { gap: 12px; padding: 0 20px; }
  .review, .mywords, .foot, .history { padding-left: 20px; padding-right: 20px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tiles-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 880px) {
  .top { flex-direction: column; align-items: stretch; gap: 14px; padding: 18px 16px 12px; }
  .top-tools { justify-content: space-between; }
  .workspace { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .tiles-3 { grid-template-columns: repeat(3, 1fr); }
  .swap { margin: 0 auto; transform: rotate(90deg); }
  .review, .mywords, .foot, .history { padding-left: 16px; padding-right: 16px; }
  #input, .output { height: 36vh; min-height: 200px; }
  .foot-grid { grid-template-columns: minmax(0, 1fr); }
  .pane-status:empty { display: none; }
}
@media (max-width: 600px) {
  body { font-size: 15px; }
  .wordmark { font-size: 1.875rem; }
  .logo-mark { width: 38px; height: 38px; }
  .logo { gap: 10px; }
  .tagline { font-size: 0.9375rem; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tiles-3 { grid-template-columns: repeat(3, 1fr); }
  .tiles-3 .tile-note { display: none; }
  .tile { padding: 8px 10px 7px; }
  .tile-word { font-size: 1.125rem; }
  #input, .output { padding: 14px; font-size: 1rem; }
  /* thumb-sized controls */
  .btn { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .dl-format select { min-height: 44px; }
  .bar { gap: 6px; }
  .bar .stats { flex-basis: 100%; }
  .bar .spacer { display: none; }
  .bar > .btn, .bar > .file-btn { flex: 1 1 auto; }
  .bar-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .menu summary { width: 100%; }
  .menu-list { left: 0; right: 0; }
  .letters button { min-width: 40px; height: 40px; }
  .status-pill { white-space: normal; border-radius: var(--radius-s); }
  .pane-status:empty { display: none; }
  .pane-status { flex-wrap: wrap; }
  .top-tools { gap: 6px; }
  .top-tools .btn { padding: 0 12px; }
  .dl { width: 100%; }
  .dl-format { flex: 0 0 auto; }
  .dl-btn { flex: 1; }
  .bar-actions .btn-primary { width: 100%; }
  .hint { text-align: left; }
  .apos { width: 100%; justify-content: space-between; }
  .review ul, .mywords ul { grid-template-columns: minmax(0, 1fr); }
  .toast { left: 16px; right: 16px; transform: translate(0, 12px); text-align: center; border-radius: var(--radius-l); }
  .toast.show { transform: translate(0, 0); }
}
@media (max-width: 360px) {
  .tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tile-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
