/* =================================================================================================
   Efron Grading – the look of the Thomson apps (Efron Grading for Windows, Eye Dynamix, LogMAR Scorer):
   navigation rail with the Thomson logo, top bar, dark blue title band, near-white cards.
   Three colour schemes: Light, Dark and Blue. The grading pictures and their traffic-light colours
   are the same in every scheme. On a phone the rail goes, the list of scales becomes a bottom sheet.
   ================================================================================================= */
:root, html[data-theme="light"] {
  --canvas: #eef2f6; --surface: #ffffff; --surface-alt: #f6f8fa; --input: #ffffff;
  --ink: #1b2733; --muted: #5b6b7b; --border: #d5dde5; --grid: #e8edf2;
  --primary: #095595; --primary-hover: #0e67b2; --primary-soft: #dce9f6; --on-primary: #fff;
  --nav: #0c2e52; --nav-fore: #ffffff; --nav-muted: #a5bdd6; --nav-selected: #095595;
  --header: #ffffff; --header-fore: #1b2733; --header-muted: #5b6b7b;
  --danger: #b42318; --danger-soft: #fdeceb; --success: #16803d; --success-soft: #e1f5e8;
  --warning: #b06a00; --warning-soft: #fff3dc; --band: #1b4884; --select: #dce9f6;
  --cell: #ffffff; --cell-ink: #111820; --cross: #d12a1f; --near: #c0261b;
  color-scheme: light;
}
html[data-theme="dark"] {
  --canvas: #17191c; --surface: #212428; --surface-alt: #2a2e33; --input: #1c1f23;
  --ink: #e8eaed; --muted: #9aa3ad; --border: #3a3f46; --grid: #30343a;
  --primary: #3d8bda; --primary-hover: #569ee6; --primary-soft: #1e3a56; --on-primary: #fff;
  --nav: #111316; --nav-fore: #e8eaed; --nav-muted: #828c96; --nav-selected: #284668;
  --header: #1c1f23; --header-fore: #e8eaed; --header-muted: #9aa3ad;
  --danger: #ef6155; --danger-soft: #46201e; --success: #57c878; --success-soft: #1c3c28;
  --warning: #f0b446; --warning-soft: #463719; --band: #1b3a63; --select: #284668;
  --cell: #f4f5f7; --cell-ink: #111820; --cross: #e0362b; --near: #ff7a70;
  color-scheme: dark;
}
html[data-theme="blue"] {
  --canvas: #bfcddb; --surface: #fbfcfe; --surface-alt: #ecf2f8; --input: #f4f8fc;
  --ink: #102136; --muted: #364e69; --border: #96aeca; --grid: #c9d6e4;
  --primary: #1f4e79; --primary-hover: #2a6194; --primary-soft: #b0c7e0; --on-primary: #fff;
  --nav: #1f4e79; --nav-fore: #ffffff; --nav-muted: #bed2e6; --nav-selected: #5b80a8;
  --header: #99b4d1; --header-fore: #102136; --header-muted: #364e69;
  --danger: #aa1e14; --danger-soft: #f6dedc; --success: #147337; --success-soft: #d6eede;
  --warning: #a05f00; --warning-soft: #f6e9cd; --band: #1b4884; --select: #b0c7e0;
  --cell: #ffffff; --cell-ink: #102136; --cross: #c8231a; --near: #b3170e;
  color-scheme: light;
}


* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 14px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); font-size: 12.5px; margin: 0 0 4px; }

.app { display: flex; height: 100vh; height: 100dvh; }

/* ---------- Navigation rail ---------- */
.rail { width: 208px; flex: none; background: var(--nav); color: var(--nav-fore); display: flex; flex-direction: column; padding: 0 0 10px; overflow-y: auto; }
.rail .logo { display: flex; align-items: center; gap: 10px; min-height: 74px; padding: 12px 16px; font-size: 15px; font-weight: 600; line-height: 1.15; }
.rail .logo img { width: 36px; height: 36px; flex: none; }
.rail .logo .sub { display: block; font-size: 11.5px; font-weight: 400; color: var(--nav-muted); margin-top: 2px; }
.rail .item { position: relative; display: flex; align-items: center; gap: 14px; height: 42px; margin: 2px 8px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--nav-muted); font-weight: 600; font-size: 13.5px; cursor: pointer; text-align: left; text-decoration: none; }
.rail .item:hover { background: rgba(255,255,255,.11); color: var(--nav-fore); }
.rail .item.on { background: var(--nav-selected); color: var(--nav-fore); }
.rail .item.on::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--nav-fore); }
.rail .grow { flex: 1; }
.rail .thomson { display: block; margin: 10px 8px 0; background: #fff; border-radius: 8px; padding: 10px 12px; }
.rail .thomson img { display: block; width: 100%; }

/* ---------- Top bar ---------- */
.body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: relative; display: flex; align-items: center; gap: 10px; height: 60px; flex: none; padding: 0 22px; background: var(--header); color: var(--header-fore); border-bottom: 1px solid var(--border); }
.topbar .mlogo { display: none; width: 30px; height: 30px; }
.topbar .ttl b { display: block; font-size: 15px; }
.topbar .ttl small { display: block; font-size: 12px; color: var(--header-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 14px; background: var(--surface-alt); color: var(--ink); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chip.warn { background: var(--warning-soft); } .chip.warn .dot { background: var(--warning); }
.iconbtn { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: inherit; }
.iconbtn:hover { background: var(--surface-alt); }
.iconbtn svg.i { width: 20px; height: 20px; }
.monly { display: none; }
.menu { position: absolute; right: 14px; top: 54px; z-index: 60; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 6px; min-width: 210px; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; text-align: left; text-decoration: none; font-size: 14px; }
.menu button:hover, .menu a:hover { background: var(--surface-alt); }
.menu button.on { font-weight: 700; color: var(--primary); }
.menu .sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu .note { padding: 4px 10px 2px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--border); }

/* ---------- Main area and title band ---------- */
main { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 18px 22px 20px; gap: 14px; }
.band { flex: none; display: flex; align-items: center; gap: 8px; background: var(--band); color: #fff; border-radius: 4px; padding: 12px 14px 11px 20px; }
.band h1 { font-size: 21px; margin: 0; font-weight: 600; line-height: 1.2; }
.band p { margin: 3px 0 0; font-size: 12.5px; opacity: .85; }
.band .grow { flex: 1; min-width: 0; }
.bandtools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.bandbtn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid rgba(255,255,255,.45); border-radius: 6px; background: transparent; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; }
.bandbtn:hover { background: rgba(255,255,255,.15); }
.bandbtn:disabled { opacity: .4; cursor: default; background: transparent; }
.bandbtn.solid { background: #fff; color: var(--band); border-color: #fff; }
.bandbtn.solid:hover { background: #e8eef6; }
.band .help { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #fff; font-size: 16px; font-weight: 600; opacity: .8; }
.band .help:hover { background: rgba(255,255,255,.15); opacity: 1; }


/* ---------- Cards and controls ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.card h2 { position: relative; font-size: 15px; margin: 0 0 12px; padding-left: 12px; color: var(--primary); font-weight: 600; }
.card h2::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 3px; border-radius: 2px; background: var(--primary); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 14px; font-weight: 600; font-size: 13px; }
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.flat { border-color: transparent; background: transparent; }
.btn.flat:hover { background: var(--surface-alt); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
select, input[type=text] { width: 100%; background: var(--input); border: 1px solid var(--border); border-radius: 4px; padding: 7px 9px; min-height: 36px; }
select:focus, input:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.switch { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; user-select: none; }
.switch input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); flex: none; }
.switch small { color: var(--muted); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11.5px; font-weight: 600; background: var(--surface-alt); color: var(--muted); white-space: nowrap; }
.tag.good { background: var(--success-soft); color: var(--success); }


/* ---------- Dialog and toast ---------- */
dialog { border: 1px solid var(--border); border-radius: 10px; padding: 0; background: var(--surface); color: var(--ink); width: min(460px, calc(100vw - 28px)); box-shadow: 0 18px 50px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10,20,35,.45); }
dialog .dh { background: var(--band); color: #fff; padding: 13px 18px; font-size: 17px; font-weight: 600; }
dialog .db { padding: 16px 18px; max-height: 64vh; overflow-y: auto; }
dialog .db p { margin: 0 0 10px; }
dialog .db h3 { font-size: 14px; color: var(--primary); margin: 14px 0 6px; }
dialog .db ul { margin: 0 0 8px; padding-left: 20px; } dialog .db li { margin: 4px 0; }
dialog .df { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }
dialog .err { color: var(--danger); font-size: 12.5px; min-height: 18px; margin-top: 6px; }
dialog .radio { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.ic { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 5px; vertical-align: middle; color: var(--primary); background: var(--surface-alt); }
.ic svg.i { width: 18px; height: 18px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--success); color: #fff; padding: 9px 18px; border-radius: 6px; z-index: 90; font-weight: 600; box-shadow: 0 6px 18px rgba(0,0,0,.2); white-space: nowrap; }
.backdrop { position: fixed; inset: 0; background: rgba(10,20,35,.45); z-index: 70; }




/* =================================================================================================
   Efron Grading
   ================================================================================================= */
.rail .item span { white-space: nowrap; }
main { overflow: hidden; }
.page { display: none; flex: 1; min-height: 0; }
body[data-page="scales"] #page-scales, body[data-page="info"] #page-info, body[data-page="settings"] #page-settings { display: flex; }
body:not([data-page="scales"]) #bandFull { display: none; }
body[data-page="scales"] #bandBack, body[data-page="settings"] #bandBack { display: none; }
body[data-page="info"] #bandHelp { display: none; }

/* top bar: the scale and grade on show */
.now { display: flex; align-items: center; gap: 10px; min-width: 0; }
.now .ttl { min-width: 0; }
.now .ttl b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.gbadge { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--g); color: var(--gfore, #fff); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.gbadge.big { width: 38px; height: 38px; font-size: 18px; }
.schemes { display: flex; gap: 6px; align-items: center; }
.sch { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); background: var(--c); padding: 0; }
.sch.on { outline: 2px solid var(--primary); outline-offset: 2px; }
.langsel { width: auto; min-height: 32px; padding: 4px 8px; font-size: 13px; }
.menulang { padding: 4px 6px 6px; }

/* ---------- Grading scales page ---------- */
#page-scales { flex-direction: column; }
.grading { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; }
.listcard { display: flex; flex-direction: column; min-height: 0; padding: 12px 10px 10px; }
.listcard h2 { margin-left: 6px; margin-bottom: 8px; }
.scalelist { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; flex: 1; }
.scalelist li { position: relative; display: flex; align-items: center; gap: 12px; min-height: 36px; padding: 4px 8px 4px 6px; border-radius: 6px; cursor: pointer; user-select: none; }
.scalelist li .n { width: 26px; text-align: right; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.scalelist li:hover { background: var(--canvas); }
.scalelist li.on { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.scalelist li.on .n { color: var(--primary); }
.scalelist li.on::before { content: ""; position: absolute; left: 2px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--primary); }
.scalepick { display: none; }

.viewer { min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.piccard { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.picarea { flex: 1; min-height: 0; position: relative; padding: 16px 16px 0; display: grid; place-items: center; cursor: zoom-in; touch-action: pan-y pinch-zoom; }
.picframe { position: relative; display: inline-block; line-height: 0; }
.picframe img, .fullframe img, .thumb img { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; pointer-events: none; }
.picframe img { display: block; object-fit: contain; }
.picband { height: 6px; background: var(--g); }
.nopic { color: var(--muted); }
.caption { flex: none; display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 18px; border-top: 1px solid var(--border); margin-top: 16px; }
.caption b { display: block; font-size: 16px; font-weight: 600; }
.caption small { display: block; color: var(--muted); font-size: 13.5px; }

.strip { flex: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; height: 162px; }
body.nostrip .strip { display: none; }
.thumb { position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 0; overflow: hidden; min-width: 0; }
.thumb:hover { border-color: var(--muted); }
.thumb.on { border: 3px solid var(--primary); }
.thumb .tp { flex: 1; min-height: 0; min-width: 0; display: block; padding: 6px; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb .tb { flex: none; height: 30px; display: grid; place-items: center; background: var(--g); color: var(--gfore, #fff); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.thumb.on .tb { font-weight: 700; }

/* ---------- About the scales and Settings: a column of cards ---------- */
#page-info, #page-settings { overflow-y: auto; }
.cards { width: 100%; max-width: 780px; display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; }
.cards .card p { margin: 0 0 10px; line-height: 1.5; }
.cards .card a.btn { text-decoration: none; }
.gradekey { display: grid; grid-template-columns: 44px 1fr; gap: 6px 12px; align-items: center; }
.gradekey .gs { height: 30px; border-radius: 6px; display: grid; place-items: center; background: var(--g); color: var(--gfore, #fff); font-weight: 700; }
.infolist { columns: 2; column-gap: 24px; margin: 0; padding-left: 26px; }
.infolist li { padding: 3px 0; break-inside: avoid; }
.infolist a { color: var(--primary); text-decoration: none; cursor: pointer; }
.infolist a:hover { text-decoration: underline; }
.lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 10px 0 6px; }
.card h2 + .lbl { margin-top: 0; }
select.narrow { max-width: 260px; }
.tiles { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-weight: 600; font-size: 13px; width: 116px; }
.tile.on { border: 2px solid var(--primary); color: var(--primary); }
.mini { position: relative; width: 96px; height: 60px; border-radius: 5px; overflow: hidden; border: 1px solid rgba(0,0,0,.15); }
.mini i { position: absolute; left: 0; top: 0; bottom: 0; width: 22px; }
.mini b { position: absolute; left: 30px; right: 8px; top: 10px; height: 14px; border-radius: 3px; }
.mini.light { background: #eef2f6; } .mini.light i { background: #0c2e52; } .mini.light b { background: #1b4884; }
.mini.dark { background: #17191c; } .mini.dark i { background: #111316; } .mini.dark b { background: #1b3a63; }
.mini.blue { background: #bfcddb; } .mini.blue i { background: #1f4e79; } .mini.blue b { background: #1b4884; }
.switch span { line-height: 1.35; }

/* ---------- Full screen ---------- */
.full { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; touch-action: pan-y pinch-zoom; user-select: none; }
.fullframe { flex: 1; min-height: 0; width: 100%; overflow: hidden; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px 0; }
.fullframe img { display: block; border-bottom: 10px solid var(--g); box-sizing: content-box; }
.fullcap { flex: none; display: flex; align-items: center; gap: 14px; padding: 14px 20px calc(10px + env(safe-area-inset-bottom)); }
.fullcap b { display: block; font-size: 22px; font-weight: 600; }
.fullcap small { display: block; font-size: 17px; color: var(--g); }
.fullhint { position: absolute; left: 16px; bottom: calc(14px + env(safe-area-inset-bottom)); font-size: 12px; color: rgba(255,255,255,.55); transition: opacity .4s; }
.fullbar { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); display: flex; gap: 6px; transition: opacity .4s; }
.pbtn { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 10px; background: rgba(40,48,60,.75); color: #fff; }
.pbtn:hover { background: rgba(60,70,85,.95); }
.pbtn svg.i { width: 20px; height: 20px; }
.full.idle .fullbar, .full.idle .fullhint { opacity: 0; pointer-events: none; }
.full.idle { cursor: none; }

/* ---------- Rail folded to icons (the arrow at the bottom, as the Windows program) ---------- */
.rail .fold { height: 34px; color: var(--nav-muted); }
.rail .fold svg.i { transition: transform .2s; }
.app.mini .rail { width: 64px; }
.app.mini .rail .logo { padding: 14px; justify-content: center; }
.app.mini .rail .logo > span, .app.mini .rail .item span { display: none; }
.app.mini .rail .item { gap: 0; justify-content: center; padding: 0; }
.app.mini .rail .item svg.i { width: 22px; height: 22px; }
.app.mini .rail .fold svg.i { transform: rotate(180deg); }
.app.mini .rail .thomson { padding: 6px; }

/* ---------- About and the licence agreement ---------- */
.aboutart { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; padding: 16px; border-radius: 8px; background: var(--nav); color: #fff; }
.aboutart img { width: 64px; height: 64px; }
.aboutart b { display: block; font-size: 18px; }
.aboutart span { color: var(--nav-muted); }
dialog .db a { color: var(--primary); }
dialog.wide { width: min(760px, calc(100vw - 28px)); }
dialog.wide .db { max-height: 72vh; background: #fff; color: #111; }
.eula h3 { color: #111 !important; font-size: 17px !important; margin: 4px 0 8px !important; }
.eula h4 { font-size: 13.5px; margin: 14px 0 4px; }
.eula p { font-size: 13px; line-height: 1.5; }

/* ---------- Bottom sheet (phone list of scales) ---------- */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; max-height: 82vh; max-height: 82dvh; display: flex; flex-direction: column; padding: 0 10px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25); }
.sheet .scalelist li { min-height: 46px; }
.sheethead { display: flex; align-items: center; justify-content: space-between; position: relative; padding: 16px 4px 8px; font-size: 16px; }
.sheethead::before { content: ""; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--border); }
.backdrop { z-index: 75; }

/* =================================================================================================
   Tablet: narrower rail
   ================================================================================================= */
@media (max-width: 1100px) {
  .rail { width: 64px; }
  .rail .logo { padding: 14px; justify-content: center; }
  .rail .logo > span { display: none; }
  .rail .item { gap: 0; justify-content: center; padding: 0; }
  .rail .item span { display: none; }
  .rail .item svg.i { width: 22px; height: 22px; }
  .rail .thomson { padding: 6px; }
  .rail .fold { display: none; }
  .grading { grid-template-columns: 250px minmax(0, 1fr); }
  .strip { height: 132px; gap: 8px; }
  .thumb .tb { font-size: 12px; }
}
@media (max-width: 900px) and (min-width: 761px) { .donly { display: none; } }

/* =================================================================================================
   Phone (and a phone on its side)
   ================================================================================================= */
@media (max-width: 760px), (max-height: 520px) {
  .rail { display: none; }
  .topbar { height: calc(54px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 4px 0 12px; gap: 6px; background: var(--nav); color: var(--nav-fore); border-bottom: 0; }
  .topbar .mlogo { display: none; }
  .topbar .ttl small { color: var(--nav-muted); }
  .now .ttl b { max-width: 60vw; }
  .schemes, .langsel, .donly { display: none; }
  .iconbtn:hover { background: rgba(255,255,255,.12); }
  .monly { display: grid; }
  main { padding: 0; gap: 0; }
  .band { display: none; }
  #page-scales { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  #page-info, #page-settings { padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  .grading { display: flex; flex-direction: column; gap: 8px; }
  .listcard { display: none; }
  .scalepick { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
  .scalepick .iconbtn { width: 42px; height: 42px; color: var(--primary); }
  .scalepick .iconbtn:hover { background: var(--surface-alt); }
  .pickbtn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 42px; border: 0; background: transparent; padding: 0 6px; font-weight: 600; font-size: 15px; color: var(--ink); }
  .pickbtn .pnum { color: var(--muted); font-size: 13px; flex: none; }
  .pickbtn .pname { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pickbtn svg.i { color: var(--muted); }
  .viewer { flex: 1; gap: 8px; }
  .picarea { padding: 10px 10px 0; cursor: default; }
  .caption { display: none; }   /* the top bar already shows the scale and grade */
  .picarea { padding-bottom: 10px; }
  .strip { height: auto; gap: 5px; }
  .thumb { height: 92px; }
  .thumb .tp { padding: 3px; }
  .thumb .tb { height: 26px; font-size: 0; }
  .thumb .tb::before { content: attr(data-n); font-size: 14px; font-weight: 700; }
  .infolist { columns: 1; }
  .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
  .menu { top: calc(50px + env(safe-area-inset-top)); right: 8px; max-height: calc(100dvh - 70px); overflow-y: auto; }
  .fullcap b { font-size: 18px; } .fullcap small { font-size: 15px; }
  .fullhint { display: none; }
}
@media (max-height: 520px) {
  .topbar { height: calc(44px + env(safe-area-inset-top)); }
  .grading { display: grid; grid-template-columns: minmax(0, 1fr) 150px; grid-template-rows: auto minmax(0, 1fr); }
  .scalepick { grid-column: 1 / -1; }
  .viewer { display: contents; }
  .strip { grid-template-columns: 1fr; grid-template-rows: repeat(5, minmax(0, 1fr)); height: auto; min-height: 0; }
  .thumb { height: auto; flex-direction: row; }
  .thumb .tb { height: auto; width: 30px; }
}
