/* Dark, neutral grey with system blue, grouped rows and soft materials: the look of a Mac app. System fonts, so each platform
   shows its own (SF Pro on a Mac, Segoe UI on Windows). Colours come from the tokens below. */

:root {
  color-scheme: dark;
  --bg: #1e1e1f; --bar: #2a2a2c; --panel: #252527; --card: #2c2c2e; --stage: #141415;
  --fill: rgba(255,255,255,.08); --fill-hi: rgba(255,255,255,.14); --track: rgba(255,255,255,.08);
  --line: rgba(255,255,255,.10); --line2: rgba(255,255,255,.18);
  --ink: #f5f5f7; --muted: #a1a1a8; --faint: #8b8b92; --seg-on: #636366;
  --accent: #0a72e8; --accent-text: #4da3ff; --on-accent: #fff;
  --warn-bg: rgba(255,159,10,.16); --warn-fg: #ffb340; --ok-fg: #32d767; --ok-bg: rgba(50,215,103,.16);
  --error: #ff5f57; --error-bg: rgba(255,95,87,.16);
  --r-panel: 0; --r-card: 10px; --r-ctl: 8px; --r-chip: 8px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", "PingFang TC", "Microsoft JhengHei UI", "Microsoft JhengHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { height: 100%; }
body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); font: 13px/1.5 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
/* The page is laid out at a fixed reference size (1540 x 960, the desktop app's window) and scaled to the window by
   main.ts, so zooming the browser or resizing the window never changes its proportions. */
#app { position: absolute; left: 0; top: 0; transform-origin: 0 0; display: flex; flex-direction: column; overflow: hidden; }
button { font: inherit; font-weight: 500; color: var(--ink); background: var(--fill); border: 0; border-radius: var(--r-ctl); padding: 6px 12px; cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled) { background: var(--fill-hi); }
button:disabled { color: var(--faint); background: transparent; cursor: default; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover:not(:disabled) { background: #2582f0; }
button.primary:disabled { background: var(--fill); color: var(--faint); }
button.danger { color: var(--error); }
button.danger:disabled { color: var(--faint); }
button.quiet { color: var(--muted); }
kbd { font: 600 11px var(--font); color: var(--muted); background: var(--fill-hi); border-radius: 5px; padding: 0 6px; margin-left: 4px; }
button.primary kbd { color: #fff; background: rgba(255,255,255,.22); }
button:disabled kbd { background: var(--fill); }
.muted { color: var(--muted); } .small { font-size: 12px; } .grow { flex: 1; }
h2 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }

/* the toolbar */
#top { flex: 0 0 auto; display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; height: 56px; padding: 0 16px; background: var(--bar); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.brand .version { color: var(--faint); font-weight: 500; }
.brand svg { display: block; flex: 0 0 auto; }
#folder { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 24vw; min-width: 0; flex: 0 1 auto; }
#top > button, .actions-top { flex: 0 0 auto; }
.vsep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; flex: 0 0 auto; }
.chip-quiet { font-size: 12px; color: var(--muted); }

/* the three areas: photos, the crop, the panel; they touch, with hairlines between */
main { flex: 1 1 0; min-height: 0; display: flex; gap: 0; padding: 0; }
#stage-col { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 0; }
#stage-wrap { position: relative; flex: 1 1 0; min-height: 200px; overflow: hidden; background: var(--stage); container-type: inline-size; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#chips { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.chip { background: rgba(44,44,46,.82); color: var(--ink); font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: var(--r-chip); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.warn { background: var(--warn-bg); color: var(--warn-fg); flex: 0 0 auto; }

#toolbar { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px);
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 6px;
  background: rgba(44,44,46,.88); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
#toolbar[hidden] { display: none; }
#toolbar button { background: transparent; padding: 4px 10px; font-size: 16px; color: var(--muted); }
#toolbar button:hover:not(:disabled) { background: var(--fill); color: var(--ink); }
#toolbar button#turn-180 { font-size: 13px; font-weight: 600; color: var(--ink); }
#toolbar button.reset { font-size: 13px; background: var(--fill); color: var(--ink); padding: 4px 12px; }
#toolbar button.reset:hover:not(:disabled) { background: var(--fill-hi); }
#toolbar button.reset:disabled { background: transparent; color: var(--faint); }
#toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.seg { display: flex; background: var(--track); border-radius: var(--r-ctl); padding: 2px; gap: 2px; }
.seg button { background: transparent; border-radius: 6px; font-size: 13px; padding: 3px 12px; color: var(--muted); font-weight: 400; }
.seg button:hover:not(:disabled) { background: transparent; color: var(--ink); }
.seg button.on, #toolbar .seg button.on { background: var(--seg-on); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.35); }
.fine { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.fine input { width: 150px; accent-color: var(--accent); }
.fine output { color: var(--ink); width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
@container (max-width: 720px) {
  #toolbar .sep { display: none; }
  .fine input { width: 100px; }
}
@container (max-width: 460px) {
  .fine .lbl { display: none; }
  .fine input { width: 70px; }
}

/* the photos */
#strip { flex: 0 0 auto; display: flex; gap: 12px; overflow-x: auto; padding: 5px 12px; background: var(--panel); align-items: center; min-height: 80px; }
#strip:empty::after { content: var(--t-strip-empty, "匯入資料夾開始"); color: var(--faint); padding: 0 8px; }
.thumb { flex: 0 0 auto; position: relative; width: 98px; height: 68px; border-radius: 8px; border: 0; background: var(--track); cursor: pointer; overflow: visible; padding: 0; }
.thumb:hover:not(:disabled) { background: var(--track); }
.thumb[hidden] { display: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 8px; }
.thumb.current { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.thumb .num { position: absolute; left: 5px; bottom: 5px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 600; border-radius: 8px; padding: 0 7px; }
.thumb .dot { position: absolute; right: 5px; top: 5px; width: 16px; height: 16px; border-radius: 8px; font-size: 10px; line-height: 16px; text-align: center; font-weight: 700; }
.thumb .dot.warn { background: var(--warn-fg); color: #1e1e1f; }
.thumb .dot.saved { background: var(--ok-fg); color: #1e1e1f; }
.thumb .dot.error { background: var(--error); color: #1e1e1f; }
.thumb.pending img, .thumb.analysing img { opacity: .35; }

/* the panel */
#side { flex: 0 0 372px; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.card { flex: 0 0 auto; background: var(--card); border-radius: var(--r-card); padding: 12px; }
.card.actions { display: flex; flex-direction: column; gap: 8px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.name { font-weight: 600; font-size: 14px; word-break: break-all; }
.meta { margin-top: 6px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 14px; font-size: 13px; }
.meta .k { color: var(--muted); }
.meta span:nth-child(even) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#classes { display: flex; flex-direction: column; gap: 6px; }
.class-row { display: grid; grid-template-columns: 34px minmax(0, .9fr) minmax(0, 1.9fr) minmax(0, 1.1fr) minmax(0, .9fr); gap: 5px; align-items: center; }
.class-row .region { color: var(--muted); font-size: 12px; }
.class-row button, #classes .wide button { padding: 5px 2px; font-size: 12.5px; white-space: nowrap; }
.class-row button.on, #classes button.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
#classes .wide { display: flex; gap: 5px; flex-wrap: wrap; }
#classes .wide button { flex: 1 1 auto; }
.actions.row { display: flex; flex-direction: row; justify-content: flex-end; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.check input { accent-color: var(--accent); }
details { margin-top: 8px; color: var(--muted); font-size: 12px; }
summary { cursor: pointer; }
details p { margin: 8px 0 0; }

/* header actions, footer */
.actions-top { display: flex; gap: 8px; align-items: center; }
.check.inline { margin: 0; white-space: nowrap; }
#status-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 28px; background: var(--bar); border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
#status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#help { position: relative; margin: 0; }
#help summary { cursor: pointer; list-style: none; border-radius: var(--r-chip); padding: 0 8px; background: var(--fill); }
#help .pop { position: absolute; right: 0; bottom: 30px; width: 340px; background: var(--card); border: 1px solid var(--line2); border-radius: var(--r-card); padding: 4px 14px; z-index: 5; box-shadow: 0 10px 30px rgba(0,0,0,.5); }

/* side panel: tabs and pages */
.tabs { display: flex; gap: 2px; background: var(--track); border-radius: var(--r-ctl); padding: 2px; flex: 0 0 auto; }
.tabs button { flex: 1; background: transparent; border-radius: 6px; color: var(--muted); padding: 5px 10px; font-weight: 400; }
.tabs button:hover:not(:disabled) { background: transparent; color: var(--ink); }
.tabs button.on { background: var(--seg-on); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.35); }
.page { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.page[hidden] { display: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.mini { padding: 3px 10px; font-size: 12px; }
.batch-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.batch-top .tags { flex: 1; min-width: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; align-items: center; margin: 0; font-size: 13px; color: var(--muted); }
.tag { background: var(--fill-hi); border-radius: 12px; padding: 1px 10px; color: var(--ink); font-variant-numeric: tabular-nums; }
.seg.block { width: 100%; }
.seg.block button { flex: 1; }
.quadrants { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.quadrants button { padding: 6px 4px; font-size: 12.5px; background: var(--fill); color: var(--ink); position: relative; }
.quadrants button.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.quadrants button.auto::after { content: var(--t-auto, "自動"); position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--faint); }
.quadrants button.on.auto::after { color: rgba(255,255,255,.75); }
.quadrants[hidden] { display: none; }
#batch-site { margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* dialogs: sheets with a soft shadow */
dialog { background: var(--bar); color: var(--ink); border: 1px solid var(--line2); border-radius: 14px; padding: 22px; max-width: 460px; box-shadow: 0 24px 60px rgba(0,0,0,.6); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
dialog p { margin: 0 0 10px; }
dialog#batch-dialog { width: 560px; max-width: 96vw; padding: 22px; }
.dialog-card { background: var(--card); border-radius: var(--r-card); padding: 12px 14px; margin: 12px 0; }
.dialog-card[hidden] { display: none; }
.sides { display: flex; justify-content: space-between; color: var(--faint); font-size: 12px; margin-bottom: 4px; }
.jaw-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 8px 0 4px; }
.chart { display: grid; grid-template-columns: repeat(8, 1fr) 10px repeat(8, 1fr); gap: 3px; }
.chart .gap { width: 10px; }
.chart button, .points button { padding: 5px 0; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chart button.on, .points button.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.points { display: flex; gap: 8px; margin-bottom: 8px; }
.points button { padding: 6px 18px; }
.note { background: var(--card); border-radius: var(--r-card); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.note strong { color: var(--ink); }
.note.ready { box-shadow: inset 0 0 0 1.5px var(--accent); }

/* the colour tab */
.tone-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0; }
.tone-head span { color: var(--faint); font-size: 12px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.switch input { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: var(--fill-hi); position: relative; cursor: pointer; flex: 0 0 auto; margin: 0; }
.switch input::after { content: ""; position: absolute; left: 2px; top: 2px; width: 20px; height: 20px; border-radius: 10px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .12s; }
.switch input:checked { background: var(--ok-fg); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:disabled { opacity: .4; cursor: default; }
.ref-card { display: flex; flex-direction: column; gap: 8px; }
.ref-card .name { font-weight: 600; font-size: 13px; }
.ref-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ref-head .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row2 button { padding: 6px 4px; }
.sliders h3 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 6px 0 6px; }
.slider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.slider .top { display: flex; justify-content: space-between; font-size: 12.5px; }
.slider .top span:first-child { color: var(--muted); }
.slider .top .zero { color: var(--faint); }
.slider input[type=range] { width: 100%; margin: 0; height: 18px; accent-color: var(--accent); background: transparent; }
.status-chip { font-size: 12px; color: var(--muted); }
#load { width: 140px; height: 6px; flex: 0 0 auto; appearance: none; border: 0; border-radius: 3px; background: var(--fill-hi); overflow: hidden; }
#load::-webkit-progress-bar { background: var(--fill-hi); }
#load::-webkit-progress-value { background: var(--accent); }
#load[hidden] { display: none; }

/* the first screens: drop a folder, then wait for the analysis (main[data-mode] is welcome, loading or crop) */
main[data-mode="welcome"] #side { display: none; }
main:not([data-mode="crop"]) #stage-wrap, main:not([data-mode="crop"]) #strip { display: none; }
main:not([data-mode="crop"]) { padding: 16px 20px; }
.screen { flex: 1 1 0; min-height: 0; display: flex; }
.screen[hidden] { display: none; }
.drop { margin: auto; width: min(680px, 100%); box-sizing: border-box; padding: 34px 40px; text-align: center; background: var(--card); border: 1.5px dashed var(--line2); border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; transition: border-color .12s, background .12s; }
body.dragging .drop { border-color: var(--accent-text); background: var(--fill-hi); }
.drop-icon { color: var(--accent-text); }
.drop h1 { margin: 6px 0 2px; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.drop p { margin: 0; color: var(--muted); }
.drop button.primary { margin: 8px 0 2px; padding: 9px 26px; font-size: 15px; }
.model-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--fill); border-radius: 999px; padding: 3px 12px; font-size: 12.5px; color: var(--muted); }
.model-pill .live { width: 8px; height: 8px; border-radius: 4px; background: var(--faint); }
.model-pill.ready .live { background: var(--ok-fg); }
.model-pill.failed .live { background: var(--error); }
.warn-text { color: var(--warn-fg); }
button.link { background: transparent; padding: 2px 4px; color: var(--muted); text-decoration: underline; }
button.link:hover:not(:disabled) { background: transparent; color: var(--ink); }
.loading-card { margin: auto; width: min(900px, 100%); max-height: 100%; box-sizing: border-box; padding: 28px 32px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.loading-card h2 { margin: 0; font-size: 22px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; border-radius: 4px; background: var(--fill-hi); overflow: hidden; margin: 4px 0 6px; }
#loading-fill { height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .2s; }
.loading-thumbs { display: flex; flex-wrap: wrap; gap: 8px; overflow-y: auto; min-height: 0; padding: 2px; align-content: flex-start; }
.loading-thumbs .t { width: 92px; height: 64px; border-radius: 8px; background: var(--track); overflow: hidden; flex: 0 0 auto; }
.loading-thumbs .t img { width: 100%; height: 100%; object-fit: cover; display: block; }
.loading-thumbs .t.error { outline: 2px solid var(--error); }
.loading-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 6px; }

dialog#guide { width: 640px; max-width: 96vw; padding: 22px 26px; }
dialog#guide .guide-body { max-height: 62vh; overflow-y: auto; margin: 10px 0 14px; padding-right: 8px; font-size: 13.5px; }
dialog#guide h4 { margin: 14px 0 4px; font-size: 14px; color: var(--accent-text); }
dialog#guide h4:first-child { margin-top: 0; }
dialog#guide p, dialog#guide ol, dialog#guide ul { margin: 0 0 4px; color: var(--muted); }
dialog#guide ol, dialog#guide ul { padding-left: 20px; }
dialog#guide li { margin: 2px 0; }
dialog#guide b { color: var(--ink); }
main[data-mode="loading"] .tabs, main[data-mode="loading"] #page-crop > :not(#batch-card) { display: none; }

/* the photos as a column beside the editing area: the editing area is wide, so the height is what to save */
main[data-mode="crop"] #stage-col { flex-direction: row; }
main[data-mode="crop"] #strip { order: -1; flex: 0 0 112px; flex-direction: column; align-items: stretch; box-sizing: border-box; width: 112px; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 14px; gap: 14px; border-right: 1px solid var(--line); }
main[data-mode="crop"] #strip:empty::after { content: ""; }
main[data-mode="crop"] .thumb { width: 100%; height: 66px; flex: 0 0 auto; }
@container (max-width: 600px) {
  #toolbar { padding: 6px 8px; gap: 4px; }
  #toolbar button { padding: 4px 7px; }
  .seg button { padding: 3px 8px; }
  .fine .lbl { display: none; }
  .fine input { width: 84px; }
  .fine output { width: 40px; }
}
#xray-override { margin: 6px 0 2px; }

/* the personal-training window: grouped sections like a Mac settings pane */
dialog#settings-dialog, dialog#personal-dialog { width: 560px; max-width: 96vw; padding: 22px; max-height: 94vh; overflow-y: auto; }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.sheet-head h3 { margin: 0 0 2px; font-size: 17px; }
.sheet-head p { margin: 0; }
.sheet-badge { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.block { margin: 0 0 14px; }
.block > h2 { padding: 0 4px; margin: 0 0 6px; }
.group { background: var(--card); border-radius: var(--r-card); overflow: hidden; }
.group > * + *, .group > div > * + * { border-top: 1px solid var(--line); }
.g-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; font-size: 13px; }
.g-row .k { color: var(--muted); }
.g-row .v { text-align: right; min-width: 0; }
.g-row .big { font-size: 15px; font-weight: 600; }
.g-pad { padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.g-pad p { margin: 0; }
.g-pad .actions { margin: 0; }
.block > p { margin: 6px 4px 0; }
.block > p:empty { display: none; }
.g-file { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; }
.g-file .fname { font-weight: 500; word-break: break-all; }
.g-file .g-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.g-file .g-buttons button { padding: 4px 12px; font-size: 12.5px; }
#personal-progress { width: 100%; height: 6px; appearance: none; border: 0; border-radius: 3px; background: var(--fill-hi); overflow: hidden; accent-color: var(--accent); }
#personal-progress::-webkit-progress-bar { background: var(--fill-hi); }
#personal-progress::-webkit-progress-value { background: var(--accent); }
#personal-progress[hidden], #personal-result[hidden] { display: none; }

/* the two questions: a Mac alert with the app icon */
dialog.sheet[open] { display: flex; gap: 16px; width: 520px; max-width: 96vw; padding: 22px; }
.sheet .sheet-icon { flex: 0 0 auto; width: 56px; height: 56px; }
.sheet-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.sheet-body h3 { margin: 0; font-size: 15px; }
.sheet-body p { margin: 0; font-size: 13px; }
.path-box { background: var(--bg); border-radius: 8px; padding: 8px 12px; font-size: 12px; }
.sheet-body .actions { margin-top: 4px; }

/* the settings window */
.g-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.g-inline { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.g-inline[hidden] { display: none; }
.g-inline input { flex: 1; min-width: 0; background: var(--track); color: var(--ink); border: 1px solid var(--line2); border-radius: var(--r-ctl); padding: 4px 8px; font: inherit; }
.seg button:disabled { opacity: .45; }
#settings-distal { display: flex; flex-direction: column; gap: 6px; }
#settings-distal .g-inline > span { flex: 0 0 11.5em; }
#settings-distal .seg { flex: 1; }
#settings-distal .seg button { flex: 1; }

/* a top bar that does not fit (a long language, a narrow window): closer together, without the folder's name */
#top.tight { gap: 6px; padding: 0 10px; }
#top.tight #folder { display: none; }
#top.tight button { padding: 6px 8px; }
#top.tight .vsep { margin: 0; }

/* the full-mouth views in the user's layout: three rows of three, a gap, and a column of their own */
.fm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 8px minmax(0, 1fr); gap: 5px; }
.fm-grid button { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 40px; padding: 4px 2px; line-height: 1.15; font-weight: 600; }
.fm-grid button .a { font-size: 10.5px; font-weight: 500; opacity: .7; }
.fm-grid button .b { font-size: 12.5px; }
.fm-grid button.on .a { opacity: .85; }
.fm-grid button.on { background: var(--accent); color: var(--on-accent); }
