/* =================================================================================================
   LogMAR Scorer – the look of the Thomson apps (Eye Dynamix / Virtual Synoptophore / clinic portal):
   navigation rail on the left with the Thomson logo at the foot, top bar, a dark blue title band,
   near-white cards on the canvas. Three colour sets: White (light), Black (dark) and Blue.
   On a phone the rail goes, the top bar turns navy, the options become a bottom sheet and the
   scores (or, when editing, the letter keypad) are docked at the bottom of the screen.
   ================================================================================================= */
: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;
}

@font-face { font-family: "Sloan"; src: url("../fonts/Sloan.otf") format("opentype"); font-display: block; }

* { 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; }
.bandchk { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid rgba(255,255,255,.45); border-radius: 6px; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; white-space: nowrap; }
.bandchk input { width: 16px; height: 16px; margin: 0; accent-color: #f5a623; cursor: pointer; }
.bandchk:has(input:checked) { background: rgba(245,166,35,.22); border-color: #f5a623; }
.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; }

.content { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; }
.chartcol { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; align-items: center; padding-bottom: 4px; }
.side { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding-right: 2px; }
.sheethead { display: none; }

/* ---------- 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); }
.row { display: grid; grid-template-columns: 60px 1fr; align-items: center; gap: 8px; margin: 6px 0; }
.row > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.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); }

/* ---------- Scores ---------- */
.scores { display: flex; flex-direction: column; gap: 8px; }
.score { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-alt); }
.score .k { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.score .v { grid-column: 1; font-size: 28px; font-weight: 700; color: var(--primary); line-height: 1.1; font-variant-numeric: tabular-nums; }
.score .btn { grid-column: 2; grid-row: 1 / span 2; min-width: 74px; }
.score .btn.done { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.scores .empty, .scorebar .empty { color: var(--muted); font-size: 13px; padding: 6px 2px; }

/* ---------- The chart ---------- */
.chartcard { width: 100%; max-width: 640px; padding: 12px 14px 14px; }
.sethead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.setpick { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.setpick span { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.setpick select { font-weight: 600; }
.note { padding: 9px 12px; border-radius: 6px; background: var(--warning-soft); color: var(--ink); font-size: 13px; margin-bottom: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.note .btn { padding: 5px 12px; }

.chart { --lab: 46px; --btn: 40px; --cellmax: 54px; --gap: 5px; display: flex; flex-direction: column; gap: var(--gap); user-select: none; -webkit-user-select: none; }
.crow { display: grid; gap: var(--gap); align-items: center; justify-content: center;
  grid-template-columns: var(--lab) var(--btn) var(--btn) repeat(5, minmax(0, var(--cellmax))) var(--lab); }
.chart.m-edit .crow { grid-template-columns: var(--lab) var(--btn) var(--btn) var(--btn) repeat(5, minmax(0, var(--cellmax))) var(--lab); }
.lab { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; overflow: hidden; }
.chart.near .lab { color: var(--near); }

.cell, .rb { position: relative; display: grid; place-items: center; padding: 0; border-radius: 6px; touch-action: manipulation; }
.cell { aspect-ratio: 1; width: 100%; border: 1px solid #9aa7b4; background: var(--cell); color: var(--cell-ink); container-type: inline-size; }
.cell .ch { font-family: "Sloan", "Segoe UI", sans-serif; font-size: 24px; font-size: 56cqi; line-height: 1; transform: translateY(3%); }
.cell .ch.pre { color: #9aa3ad; }
.cell.fade .ch { opacity: .3; }
.cell.empty { background: var(--surface-alt); border-style: dashed; }
.chart.m-edit .cell { cursor: text; }
.chart.m-edit .cell.sel { outline: 3px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.chart.locked .cell { cursor: default; }

.rb { height: var(--btn); width: var(--btn); border: 1px solid var(--border); background: var(--surface-alt); color: var(--primary); }
.rb:hover { border-color: var(--primary); }
.rb svg.i { width: 22px; height: 22px; }
.rb:disabled { opacity: .35; cursor: default; }
.rb .ico-clear { display: none; } .rb.clear .ico-rand { display: none; } .rb.clear .ico-clear { display: block; }
.rb.clear { color: var(--danger); }

/* the red cross over a missed letter (or a crossed row button) */
.xo { position: absolute; inset: 6%; width: 88%; height: 88%; opacity: 0; pointer-events: none; transition: opacity .08s; }
.xo path { stroke: var(--cross); stroke-width: 3.2; stroke-linecap: round; }
.x > .xo { opacity: 1; }
.pv > .xo { opacity: .4; }
.rb.x { background: var(--danger-soft); border-color: var(--cross); }
.rb.pv { border-color: var(--cross); }

/* ---------- Letter keypad (edit mode) ---------- */
.keypad { width: 100%; max-width: 640px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.keypad button { height: 48px; border: 1px solid var(--border); border-radius: 6px; background: var(--cell); color: var(--cell-ink); font-family: "Sloan", sans-serif; font-size: 26px; touch-action: manipulation; }
.keypad button:hover { border-color: var(--primary); }
.keypad button.fn { font: 600 13px "Segoe UI", system-ui, sans-serif; background: var(--surface-alt); color: var(--ink); }
.keypad .hint { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); text-align: center; }

body.editing .scorescard { display: none; }

/* ---------- Score bar (phone) ---------- */
.scorebar { display: none; }

/* ---------- 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; }

/* =================================================================================================
   Tablet: narrower rail
   ================================================================================================= */
@media (max-width: 1100px) {
  .rail { width: 64px; }
  .rail .logo { padding: 14px 14px; justify-content: center; }
  .rail .logo > span { display: none; }
  .rail .item { font-size: 0; gap: 0; justify-content: center; padding: 0; }
  .rail .item svg.i { width: 22px; height: 22px; }
  .rail .thomson { padding: 6px; }
  .content { grid-template-columns: minmax(0, 1fr) 300px; }
}

/* =================================================================================================
   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) 6px 0 12px; gap: 6px; background: var(--nav); color: var(--nav-fore); border-bottom: 0; }
  .topbar .mlogo { display: block; }
  .topbar .ttl small { color: var(--nav-muted); }
  .iconbtn:hover { background: rgba(255,255,255,.12); }
  .monly { display: grid; }
  #nearChip { display: none !important; }
  body.editing #editBtn { display: none; }

  main { padding: 0; gap: 0; }
  .band { border-radius: 0; padding: 8px 6px 8px 12px; }
  .band h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .band p { font-size: 11.5px; }
  .bandbtn, .bandchk { padding: 7px 9px; }
  .bandchk { font-size: 12.5px; }

  .content { display: block; overflow-y: auto; padding: 10px 8px calc(96px + env(safe-area-inset-bottom)); }
  body.editing .content { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
  .chartcol { overflow: visible; }
  .chartcard { padding: 10px 8px 12px; border-radius: 10px; }
  .chart { --lab: 40px; --btn: 34px; --gap: 4px; }
  .lab { font-size: 11.5px; }
  .chart.m-edit { --btn: 30px; --lab: 34px; }
  .chart.m-edit .rb svg.i { width: 19px; height: 19px; }

  /* options as a bottom sheet */
  .side { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; max-height: 82vh; max-height: 82dvh; padding: 0 12px calc(16px + env(safe-area-inset-bottom)); background: var(--canvas); border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25); transform: translateY(105%); transition: transform .22s ease; gap: 10px; }
  body.sheet .side { transform: none; }
  .sheethead { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1; background: var(--canvas); padding: 12px 2px 6px; font-size: 16px; }
  .sheethead::before { content: ""; position: absolute; left: 50%; top: 5px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--border); }
  .scorescard { display: none; }

  /* scores docked at the bottom */
  .scorebar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0,0,0,.08); }
  body.editing .scorebar { display: none; }
  .scorebar button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px 5px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-alt); }
  .scorebar .k { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
  .scorebar .v { font-size: 22px; font-weight: 700; color: var(--primary); line-height: 1.15; font-variant-numeric: tabular-nums; }
  .scorebar .c { font-size: 10.5px; color: var(--muted); }
  .scorebar button.done { border-color: var(--success); background: var(--success-soft); }
  .scorebar button.done .c { color: var(--success); font-weight: 700; }

  /* keypad docked at the bottom when editing */
  .keypad { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-width: none; border-radius: 14px 14px 0 0; border-width: 1px 0 0; padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0,0,0,.12); }
  .keypad button { height: 46px; }

  .toast { bottom: calc(100px + env(safe-area-inset-bottom)); }
  body.editing .toast { bottom: calc(180px + env(safe-area-inset-bottom)); }
  body.editing.locked .content { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  body.editing.locked .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
  .menu { top: calc(50px + env(safe-area-inset-top)); right: 8px; }
}

/* most phones: the top bar already names the app, so the band just holds its buttons */
@media (max-width: 440px) {
  .band .grow { display: none; }
  .bandtools { flex: 1; justify-content: flex-start; flex-wrap: nowrap; }
  .band { padding-left: 8px; }
}

/* very narrow phones: drop the right-hand labels while editing */
@media (max-width: 400px) {
  .chart { --lab: 36px; --btn: 32px; --gap: 3px; }
  .lab { font-size: 10.5px; }
  .chart.m-edit .crow { grid-template-columns: var(--lab) var(--btn) var(--btn) var(--btn) repeat(5, minmax(0, var(--cellmax))); }
  .chart.m-edit .lab.r { display: none; }
  .topbar .ttl small { max-width: 38vw; }
}

@media (hover: none) { .rb:hover, .keypad button:hover, .btn:hover { border-color: var(--border); } }

/* a phone on its side: keep the headers and the score bar slim so more of the chart shows */
@media (max-height: 520px) {
  .topbar { height: calc(44px + env(safe-area-inset-top)); }
  .topbar .mlogo { width: 26px; height: 26px; }
  .topbar .ttl small { display: none; }
  .band { padding: 5px 8px; }
  .band .grow { display: none; }
  .bandtools { flex: 1; justify-content: flex-start; }
  .bandbtn, .bandchk { padding: 5px 10px; }
  .content { padding-bottom: calc(64px + env(safe-area-inset-bottom)); padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .scorebar { padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .scorebar button { flex-direction: row; justify-content: center; gap: 10px; padding: 6px 8px; }
  .scorebar .v { font-size: 19px; }
  .scorebar .c { display: none; }
  .scorebar button.done .c { display: inline; }
  .toast { bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.editing .content { padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
  .keypad { grid-template-columns: repeat(12, 1fr); }
  .keypad button { height: 40px; font-size: 22px; }
  .keypad .hint { display: none; }
}
