:root {
  --accent: #6c7bff;
  --accent-2: #8a7bff;
  --swap-glow: rgba(108, 123, 255, 0.22);
  --good: #4fd6a6;
  --danger: #ff6b6b;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  /* per-category font sizes (configurable in Settings) */
  --fs-translate: 18px;
  --fs-dict: 13px;
  --fs-popover: 13px;
}

[data-theme="dark"] {
  color-scheme: dark;   /* native select popups, scrollbars etc. render dark */
  --bg: #0b0c11;
  --bg-2: #101119;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.08);
  --line-soft: rgba(255, 255, 255, 0.05);
  --text: #e6e7ee;
  --muted: rgba(255, 255, 255, 0.42);
  --surface: rgba(22, 23, 32, 0.92);
  --surface-2: rgba(18, 19, 27, 0.86);
  --backdrop: rgba(6, 7, 11, 0.5);
  --app-grad: radial-gradient(1200px 600px at 20% -10%, #181a27 0%, var(--bg) 55%);
  --output-bg: rgba(255, 255, 255, 0.05);
  --input-bg: rgba(255, 255, 255, 0.05);
  --topbar-bg: rgba(255, 255, 255, 0.02);
  --scroll: rgba(255, 255, 255, 0.14);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #e9ebf1;
  --bg-2: #ffffff;
  --panel: rgba(255, 255, 255, 0.66);
  --panel-2: rgba(0, 0, 0, 0.05);
  --line: rgba(0, 0, 0, 0.1);
  --line-soft: rgba(0, 0, 0, 0.06);
  --text: #191b22;
  --muted: rgba(0, 0, 0, 0.5);
  --surface: rgba(252, 252, 254, 0.97);
  --surface-2: rgba(248, 249, 252, 0.96);
  --backdrop: rgba(20, 22, 30, 0.22);
  --app-grad: radial-gradient(1200px 600px at 20% -10%, #ffffff 0%, var(--bg) 60%);
  --output-bg: rgba(0, 0, 0, 0.03);
  --input-bg: rgba(0, 0, 0, 0.045);
  --topbar-bg: rgba(255, 255, 255, 0.5);
  --scroll: rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; }

/* belt + suspenders: dropdown option lists always readable in either theme */
select option { background: var(--bg-2); color: var(--text); }

html, body {
  margin: 0;
  height: 100%;
  background: var(--app-grad);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body { display: flex; flex-direction: column; }
body.resizing { cursor: row-resize; user-select: none; }
body.resizing-x { cursor: col-resize; user-select: none; }

/* thin, quiet scrollbars */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- top bar (compact, glassy) ---------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 5px 10px;
  gap: 12px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(20px);
  flex: none;
  /* web: no draggable titlebar */
}
.topbar button, .topbar select, .lang-switch { -webkit-app-region: no-drag; }
.win-sep { display: none; }
.ghost.wctl { font-size: 13px; }
.ghost.close:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.brand { display: flex; align-items: center; gap: 7px; }
.logo {
  width: 19px; height: 19px;
  display: grid; place-items: center;
  border-radius: 6px;
  font-weight: 700; font-size: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}
.wordmark { font-weight: 500; letter-spacing: 0.3px; font-size: 12px; color: var(--muted); }
.app-version {
  font-size: 10px; font-weight: 500; font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  color: var(--muted); opacity: 0.75; margin-left: 6px; letter-spacing: 0.02em;
}
.cost {
  font-size: 11px; color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  padding: 1px 7px; border-radius: 6px; background: var(--panel-2);
  -webkit-app-region: no-drag;
}

.lang-switch {
  display: flex; align-items: center; gap: 3px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 2px;
  border-radius: 7px;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.lang-switch.lang-detected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--swap-glow);
}
.lang {
  appearance: none;
  background: transparent;
  color: var(--text);
  border: none;
  font: inherit;
  font-size: 11.5px; font-weight: 500;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
}
.lang:hover { background: var(--panel-2); }
.swap {
  background: transparent;
  border: none;
  color: var(--muted);
  width: 20px; height: 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  transition: transform .25s ease, color .15s ease;
}
.swap:hover { transform: rotate(180deg); color: var(--accent); }

.locale-switch {
  display: inline-flex; align-items: center; gap: 1px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 2px;
  border-radius: 7px;
}
.locale-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-width: 22px;
  height: 20px;
  padding: 0 4px;
  border-radius: 5px;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.locale-btn:hover { color: var(--text); background: var(--panel-2); }
.locale-btn.on { color: var(--accent); background: var(--swap-glow); }

.topbar-right { justify-self: end; display: flex; align-items: center; gap: 6px; }
.ghost {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  width: 24px; height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.ghost.wide { width: auto; padding: 0 10px; height: 24px; font-size: 11.5px; font-weight: 500; }
.ghost:hover { color: var(--text); border-color: var(--line); background: var(--panel-2); }
.ghost.on { color: var(--accent); border-color: var(--accent); background: rgba(108,123,255,.12); }

/* ---------- workspace ---------- */
.workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  padding: 6px 8px 8px;
}
.stage {
  display: flex;
  gap: 8px;
  flex: 1;
  min-height: 0;
}
.cols {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(20px);
}
.pane.output { background: var(--panel); }
.pane-label {
  padding: 7px 14px 0;
  font-size: 10px; font-weight: 600; letter-spacing: .6px;
  text-transform: uppercase; color: var(--muted);
}

/* draggable splitter between the two stacked boxes */
.splitter {
  flex: none; height: 8px; margin: -4px 0;
  cursor: row-resize; position: relative; z-index: 2;
}
.splitter::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 38px; height: 3px; border-radius: 3px;
  background: var(--line); transition: background .15s ease;
}
.splitter:hover::after { background: var(--accent); }

/* vertical splitter between the boxes and the dictionary rail */
.vsplit {
  flex: none; width: 8px; margin: 0 -4px;
  cursor: col-resize; position: relative; z-index: 2;
}
.vsplit::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 3px; height: 38px; border-radius: 3px;
  background: var(--line); transition: background .15s ease;
}
.vsplit:hover::after { background: var(--accent); }

/* zoom control in settings */
.zoom-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.zoom-btn {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); font-size: 16px; cursor: pointer;
}
.zoom-btn:hover { border-color: var(--accent); }
.zoom-val { font-size: 13px; color: var(--muted); min-width: 44px; text-align: center; }

/* system toggles */
.toggle-row {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--text); margin-bottom: 8px; cursor: pointer;
}
.toggle-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.vsel {
  background: var(--input-bg); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 12px; padding: 4px 8px; border-radius: 7px; cursor: pointer;
}

/* per-category font steppers */
.fs-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.fs-name { flex: 1; font-size: 13px; color: var(--text); }
.fs-row .zoom-val { min-width: 26px; }

textarea#source {
  flex: 1;
  resize: none;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-translate);
  line-height: 1.55;
  padding: 6px 14px 12px;
}
textarea#source::placeholder { color: var(--muted); }

.pane-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
}

.chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip:disabled { opacity: .45; cursor: default; }
.chip.done { color: var(--good); border-color: var(--good); }
.chip.on { color: var(--accent); border-color: var(--accent); background: rgba(108,123,255,.12); }
.chip svg { vertical-align: -2px; }
.foot-left { display: flex; align-items: center; gap: 8px; }
.foot-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* format + compose — grouped like the lang switcher */
.compose-tools {
  display: inline-flex;
  align-items: stretch;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .compose-tools { box-shadow: none; }

.format-sel {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  border-right: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  padding: 7px 26px 7px 10px;
  cursor: pointer;
  line-height: 1.2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236c7bff' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 10px 6px;
}
.format-sel:hover { background-color: var(--panel); }
.format-sel:focus { outline: none; box-shadow: inset 0 0 0 2px var(--swap-glow); }

.compose-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.compose-btn:hover { background: var(--swap-glow); color: var(--accent); }
.compose-btn:active { background: rgba(108, 123, 255, 0.16); }
.compose-btn:disabled { opacity: .5; cursor: progress; }

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--swap-glow);
  transition: transform .1s ease, opacity .2s ease;
}
.primary:hover { transform: translateY(-1px); }
.primary:active { transform: translateY(0); }
.primary:disabled { opacity: .5; cursor: progress; transform: none; }

.target.previewing {
  opacity: 0.72;
  font-style: italic;
}
.popover .generic-words .word-chip {
  border-style: dashed;
  opacity: 0.88;
}

.target {
  flex: 1;
  padding: 6px 14px 12px;
  font-size: var(--fs-translate);
  line-height: 1.75;
  white-space: pre-wrap;   /* preserve the source's line breaks & paragraphs */
  overflow-y: auto;
}
.placeholder { color: var(--muted); font-size: 0.83em; line-height: 1.7; }

/* clickable tokens */
.tok {
  border-radius: 6px;
  padding: 1px 2px;
  cursor: default;
  transition: background .12s ease, color .12s ease;
}
.tok.swappable {
  cursor: pointer;
  border-bottom: 1.5px dotted rgba(138, 141, 160, 0.5);
}
.tok.swappable:hover {
  background: rgba(108, 123, 255, 0.18);
  border-bottom-color: var(--accent);
}
.tok.changed {
  animation: flash 1.1s ease;
}
@keyframes flash {
  0% { background: rgba(79, 214, 166, 0.45); }
  100% { background: transparent; }
}

.status {
  flex: 1;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status.error { color: var(--danger); }
.status.working { color: var(--accent); }

/* ---------- history rail ---------- */
.rail {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.rail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--muted);
}
.rail-clear {
  background: transparent; border: none; color: var(--muted);
  font: inherit; font-size: 11px; cursor: pointer; text-transform: none;
}
.rail-clear:hover { color: var(--danger); }
.history { padding: 6px; }
.hist-search {
  width: 100%; box-sizing: border-box; margin-bottom: 6px;
  background: var(--input-bg); border: 1px solid var(--line);
  border-radius: 7px; color: var(--text); font: inherit; font-size: 12px; padding: 6px 9px;
  outline: none;
}
.hist-search::placeholder { color: var(--muted); }
.hist-list:empty::after {
  content: "No matching history.";
  display: block; padding: 10px 4px; color: var(--muted); font-size: 12px; line-height: 1.6;
}
.hist-item {
  display: flex; align-items: flex-start; gap: 4px;
  padding: 8px 8px 8px 10px; border-radius: 9px;
  border: 1px solid transparent; margin-bottom: 4px;
}
.hist-item:hover { background: var(--panel-2); border-color: var(--line); }
.hist-item.pinned { border-left: 2px solid var(--accent); }
.hist-main { flex: 1; min-width: 0; cursor: pointer; }
.hist-pin {
  flex: none; background: transparent; border: none; color: var(--muted);
  padding: 2px; border-radius: 5px; cursor: pointer; line-height: 0;
  opacity: 0; transition: opacity .15s ease, color .15s ease;
}
.hist-item:hover .hist-pin { opacity: .7; }
.hist-pin:hover { color: var(--accent); opacity: 1; }
.hist-item.pinned .hist-pin { opacity: 1; color: var(--accent); }
.hist-langs { font-size: 10px; font-weight: 700; letter-spacing: .4px; color: var(--accent); text-transform: uppercase; }
.hist-src { font-size: 12.5px; color: var(--text); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-tgt { font-size: 12px; color: var(--muted); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- dictionary rail (slim, right side) ---------- */
.rightcol { width: 258px; flex: none; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.dict {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(20px);
}

/* tabbed info panel under the dictionary */
.info {
  flex: none; height: 220px;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(20px);
}
.rightcol.collapsed .info { height: auto; }
.rightcol.collapsed .info-body { display: none; }
.rightcol.collapsed .hsplit { display: none; }
.info-tabs {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 8px; border-bottom: 1px solid var(--line);
}
.info-tab {
  background: transparent; border: none; color: var(--muted);
  font: inherit; font-size: 10px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; padding: 4px 8px; border-radius: 6px; cursor: pointer;
}
.info-tab:hover { color: var(--text); }
.info-tab.active { color: var(--text); background: var(--panel-2); }
.info-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.info-body { flex: 1; overflow-y: auto; min-height: 0; }
.tabpane { padding: 10px 12px; }
.tabpane.hidden { display: none; }

/* horizontal splitter between dictionary and info panel */
.hsplit { flex: none; height: 8px; margin: -3px 0; cursor: row-resize; position: relative; z-index: 2; }
.hsplit::after {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 38px; height: 3px; border-radius: 3px; background: var(--line); transition: background .15s ease;
}
.hsplit:hover::after { background: var(--accent); }

/* grammar table */
.gram-kind { font-size: 0.9em; color: var(--muted); font-style: italic; margin-bottom: 6px; }
.gram-note { font-size: 12px; color: var(--text); line-height: 1.5; margin-bottom: 4px; }
.gram-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.gram-table th {
  text-align: left; color: var(--muted); font-weight: 700; font-size: 9.5px;
  text-transform: uppercase; letter-spacing: .4px; padding: 3px 6px; border-bottom: 1px solid var(--line);
}
.gram-table td { padding: 3px 6px; border-bottom: 1px solid var(--line-soft); color: var(--text); }
.gram-table tr:last-child td { border-bottom: none; }
.dict-body {
  flex: 1; overflow-y: auto; padding: 12px 14px;
  font-size: var(--fs-dict);
  transition: opacity .15s ease;   /* calm cross-fade between entries */
}
.dict-empty { color: var(--muted); font-size: 0.96em; line-height: 1.65; }

.dict-wordhead {
  display: flex; align-items: baseline; gap: 8px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.dict-word { font-size: 1.46em; font-weight: 700; letter-spacing: .2px; }
.word-speak {
  background: transparent; border: none; color: var(--muted);
  padding: 2px; border-radius: 5px; cursor: pointer; line-height: 0; align-self: center;
  transition: color .15s ease;
}
.word-speak:hover { color: var(--accent); }

/* one block per reading (POS / gender), divided */
.dict-entry { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.dict-entry:last-child { border-bottom: none; padding-bottom: 2px; }
.dict-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dict-gender {
  font-size: 0.85em; font-weight: 700; color: var(--accent);
  background: rgba(108,123,255,.14); padding: 2px 7px; border-radius: 6px;
}
.dict-pos { font-style: italic; color: var(--muted); font-size: 0.92em; }
.dict-ipa { color: var(--muted); font-size: 0.92em; }
.dict-src { margin-left: auto; font-size: 0.77em; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; padding: 2px 7px; border-radius: 6px; }
.dict-src-local { color: var(--good); background: rgba(79,214,166,.14); }
.dict-src-online { color: var(--muted); background: rgba(138,141,160,.12); }
.dict-trans { margin: 6px 0 2px; font-size: 1.04em; }
.dict-trans b { color: var(--good); font-weight: 600; }
.dict-sense { margin-top: 8px; font-size: 0.96em; line-height: 1.55; }
.dict-sense .def { color: var(--text); }
.dict-sense .ex { display: block; color: var(--muted); font-style: italic; margin-top: 2px; }
.dict-loading { color: var(--accent); font-size: 0.96em; padding: 4px 0; }

/* skeleton shimmer while a lookup is in flight */
.sk-bar {
  height: 11px; border-radius: 6px; margin: 10px 0;
  background: linear-gradient(90deg, var(--panel-2) 0%, var(--line) 50%, var(--panel-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.1s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- history overlay ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; }
.overlay-backdrop { position: absolute; inset: 0; background: var(--backdrop); }
.overlay-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: 330px;
  background: var(--surface-2);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  backdrop-filter: blur(24px);
  animation: slideIn .18s ease;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.rail-actions { display: flex; gap: 10px; }

/* ---------- popover ---------- */
.popover {
  position: fixed;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 5px;
  min-width: 150px;
  overflow-y: auto;
  font-size: var(--fs-popover);
  box-shadow: 0 18px 50px rgba(0,0,0,.5);
  backdrop-filter: blur(20px);
}
.popover .opt {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  font: inherit; font-size: 0.96em;
  padding: 7px 11px;
  border-radius: 7px;
  cursor: pointer;
}
.popover .opt:hover { background: var(--accent); color: white; }
.popover .opt.current { color: var(--muted); font-style: italic; }
.popover .label {
  font-size: 0.73em; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); padding: 5px 11px 3px;
}
.popover .custom {
  display: flex; gap: 6px; padding: 6px;
  border-top: 1px solid var(--line); margin-top: 4px;
}
.popover .custom input {
  flex: 1; min-width: 0;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 7px; color: var(--text); font: inherit;
  padding: 7px 9px;
}
.popover .custom button {
  background: var(--accent); border: none; color: white;
  border-radius: 7px; font: inherit; font-weight: 700;
  padding: 0 12px; cursor: pointer;
}
.popover .loading { padding: 7px 11px; color: var(--accent); font-size: 0.92em; }
.popover.wide { min-width: 250px; max-width: 320px; }
.popover .words { display: flex; flex-wrap: wrap; gap: 5px; padding: 5px 7px; }
.popover .word-chip {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 0.92em; padding: 4px 9px; border-radius: 999px; cursor: pointer;
}
.popover .word-chip:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.popover .phrase {
  display: block; width: 100%; text-align: left; background: transparent;
  border: none; border-radius: 7px; color: var(--text); font: inherit;
  padding: 7px 11px; cursor: pointer;
}
.popover .phrase:hover { background: var(--panel); }
.popover .phrase .ph { font-weight: 600; font-size: 0.96em; }
.popover .phrase .pv {
  display: block; font-size: 0.88em; color: var(--muted); margin-top: 2px; line-height: 1.4;
}
.popover .phrase:hover .pv { color: var(--text); }
.hidden { display: none !important; }

/* ---------- settings sheet ---------- */
.sheet {
  position: fixed; inset: 0;
  background: var(--backdrop);
  display: grid; place-items: center;
  z-index: 40;
}
.sheet-card {
  width: 400px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  backdrop-filter: blur(24px);
}
.sheet-card h2 { margin: 0 0 16px; font-size: 16px; font-weight: 600; }
.sheet-card label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.sheet-card input[type="password"], .sheet-card input[type="text"] {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}
.sheet-card input[type="range"] { width: 100%; accent-color: var(--accent); margin-bottom: 16px; }
.sheet-card textarea.style-notes {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 12px;
  resize: vertical;
  min-height: 88px;
  margin-bottom: 4px;
}
.hint { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 12px 0 18px; }

/* about */
.about-card { width: 340px; text-align: center; }
.about-logo {
  width: 44px; height: 44px; margin: 2px auto 12px;
  border-radius: 12px; display: grid; place-items: center;
  font-weight: 700; font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.about-card h2 { margin: 0 0 4px; }
.about-tag { font-size: 13px; color: var(--text); margin: 0 0 12px; }
.about-ver { font-size: 12px; color: var(--muted); margin-top: 14px; }
.about-card .sheet-actions { justify-content: center; }
.about-tech {
  text-align: left; margin: 14px 0 4px;
  border-top: 1px solid var(--line); padding-top: 12px;
}
.about-tech-h {
  font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.about-tech ul { margin: 0; padding-left: 16px; }
.about-tech li { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.hint code { background: var(--bg-2); padding: 1px 5px; border-radius: 4px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 10px; align-items: center; }
.sheet-actions .ghost {
  width: auto; height: auto;
  padding: 6px 16px; font-size: 13px; font-weight: 500; border-radius: 8px;
}

/* ---------- web edition ---------- */
.web-badge {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); background: var(--swap-glow); padding: 2px 7px; border-radius: 6px;
  margin-left: 8px; vertical-align: middle;
}
body.web .topbar { cursor: default; }
body.web .ghost.wctl { display: none; }

