/* HER2 Workshop: two slides side by side, a score below */
:root {
  --ground: #f4f3f1; --surface: #ffffff; --ink: #1d1d22; --muted: #66666e; --line: #e3e1dc;
  --brown: #8a4b1f; --brown-bg: #f6ece3; --teal: #2a6a72; --teal-bg: #e2efef;
  --good: #2f6b3d; --good-bg: #e7f2ea; --off: #a33b2f; --off-bg: #f9e7e4;
  --font: 'Anuphan', 'Noto Sans Thai', 'Leelawadee UI', 'Thonburi', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--ground); color: var(--ink); font-family: var(--font); font-size: 15px; overflow: hidden; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.app { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }

/* the bar on top */
.bar { display: flex; align-items: center; gap: 10px 16px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ttl { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1 1 200px; }
.ttl b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-btn { border: none; background: none; color: var(--teal); text-decoration: underline; padding: 0; font-size: 13px; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav select { height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--surface); max-width: 46vw; }
.ic { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 20px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.ic:disabled { opacity: .35; cursor: default; }
.tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mags { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.mags button { border: none; background: none; padding: 0 10px; height: 34px; font-size: 13px; font-variant-numeric: tabular-nums; }
.mags button + button { border-left: 1px solid var(--line); }
.mags button:hover { background: var(--ground); }
.tools > button { height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 0 12px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.toggle.on { background: var(--teal-bg); border-color: #b8d6d8; color: var(--teal); font-weight: 600; }

/* the two slides */
.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--line); min-height: 0; }
.pane { position: relative; background: #fff; min-height: 0; min-width: 0; }
.osd { position: absolute !important; inset: 0; width: 100%; height: 100%; }   /* the viewer would make it "relative" */
.tag { position: absolute; top: 10px; left: 10px; z-index: 5; font-weight: 700; font-size: 13px; letter-spacing: .04em;
  padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.92); border: 1px solid var(--line); pointer-events: none; }
.tag.her2 { color: var(--brown); border-color: #e3cdb9; background: rgba(246,236,227,.95); }
.mag { position: absolute; top: 12px; right: 12px; z-index: 5; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted);
  background: rgba(255,255,255,.85); border-radius: 8px; padding: 2px 8px; pointer-events: none; }
.scale { position: absolute; left: 12px; bottom: 12px; z-index: 5; display: flex; flex-direction: column; gap: 2px; pointer-events: none;
  font-size: 11px; font-variant-numeric: tabular-nums; color: var(--ink); background: rgba(255,255,255,.85); padding: 4px 6px; border-radius: 6px; }
.scale i { display: block; height: 4px; border: 1.5px solid var(--ink); border-top: none; }
.empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); background: #fafaf9; z-index: 6; }
.mark-label { font: 600 12px var(--font); color: #fff; padding: 2px 7px; border-radius: 6px; white-space: nowrap; transform: translateY(-120%); pointer-events: none; }

/* the score */
.scorebar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 10px 14px; background: var(--surface); border-top: 1px solid var(--line); }
.scorebar .q { font-weight: 600; }
.scores { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.scores button { min-width: 52px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 700; font-size: 16px; padding: 0 12px; }
.scores button small { font-weight: 500; font-size: 11px; color: var(--muted); }
.scores button:hover { border-color: #c9b5a4; }
.scores button[aria-checked="true"] { background: var(--brown); border-color: var(--brown); color: #fff; }
.scores button[aria-checked="true"] small { color: #f3e3d6; }
.scores button.key { box-shadow: 0 0 0 3px var(--good-bg), 0 0 0 4px var(--good); }
.reveal { height: 40px; border: 1px solid var(--teal); color: var(--teal); background: var(--surface); border-radius: 10px; padding: 0 16px; font-weight: 600; }
.reveal:disabled { opacity: .4; cursor: default; }
.result { font-size: 14px; flex: 1 1 260px; min-width: 0; }
.result .chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 700; margin-right: 6px; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.off { background: var(--off-bg); color: var(--off); }
.chip.key { background: var(--brown-bg); color: var(--brown); }

/* covers and dialogs */
.cover { position: fixed; inset: 0; background: var(--ground); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.cover-box { max-width: 420px; text-align: center; line-height: 1.6; }
.cover-box b { font-size: 20px; }
dialog { border: none; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--ink); }
dialog::backdrop { background: rgba(20,20,24,.4); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 18px; }
dialog p, .info-text { padding: 0 18px; line-height: 1.7; }
.info-text { white-space: pre-line; padding-top: 12px; }
.sum-scroll { overflow: auto; max-height: 55vh; padding: 0 18px; }
#sum-table { width: 100%; border-collapse: collapse; font-size: 14px; }
#sum-table th, #sum-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
#sum-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
#sum-table a { color: var(--teal); }
.dlg-foot { padding: 12px 18px; display: flex; justify-content: flex-end; }
.quiet { border: none; background: none; color: var(--off); font-size: 13px; text-decoration: underline; }

@media (max-width: 760px) {
  body { font-size: 14px; }
  .panes { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .bar { padding: 6px 10px; gap: 6px 10px; }
  .ttl { flex-basis: 100%; }
  .tools { width: 100%; justify-content: space-between; }
  .mags { overflow-x: auto; max-width: 100%; }
  .mags button { padding: 0 8px; }
  .tools > button span { display: none; }
  .scorebar { padding: 8px 10px; gap: 8px; }
  .scorebar .q { flex-basis: 100%; font-size: 13px; }
  .scores button { min-width: 44px; height: 38px; padding: 0 8px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.displayregion { border-color: #2a6a72 !important; }
.navigator { border-color: var(--line) !important; background: #fff !important; }
/* the note under the bar, and getting the cases ready */
.note { padding: 8px 14px; background: #fff6e0; color: #6b4a00; font-size: 13px; border-bottom: 1px solid #f0dca8; }
.app { grid-template-rows: auto auto minmax(0, 1fr) auto; }
.bar { grid-row: 1; } .note { grid-row: 2; } .panes { grid-row: 3; } .scorebar { grid-row: 4; }
.tip { margin: 6px 18px 0; padding: 10px 12px; background: var(--teal-bg); border-radius: 10px; font-size: 14px; line-height: 1.6; }
#prep-btn.done { background: var(--good-bg); border-color: #b9d7c0; color: var(--good); }
.prep-meta { line-height: 1.7; }
.prep-bar { margin: 0 18px; height: 10px; border-radius: 999px; background: var(--ground); overflow: hidden; }
.prep-bar i { display: block; height: 100%; width: 0; background: var(--teal); transition: width .2s; }
.primary-btn { height: 40px; border: none; border-radius: 10px; background: var(--teal); color: #fff; font-weight: 600; padding: 0 18px; }
/* rotate, flip, colour, full screen, shortcuts: as in Lumen */
.vtools button { display: inline-flex; align-items: center; gap: 5px; padding: 0 9px; color: var(--ink); }
.vtools button[aria-pressed="true"], .vtools button[aria-expanded="true"] { background: var(--teal-bg); color: var(--teal); }
.rot-txt { display: inline-flex; align-items: center; padding: 0 6px; min-width: 50px; justify-content: center; font-size: 12px;
  font-variant-numeric: tabular-nums; color: var(--muted); border-left: 1px solid var(--line); border-right: 1px solid var(--line); cursor: help; }
.vtools #flip-h { border-left: 1px solid var(--line); }
.tools > button.sq { width: 36px; padding: 0; justify-content: center; font-weight: 700; }
.rot-overlay { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
body.ctrl-pressed .rot-overlay { pointer-events: auto; cursor: ew-resize; touch-action: none; }
/* the pane the tools act on, when the two are not moving together */
body.unlinked .pane.active::after { content: ''; position: absolute; inset: 0; border: 2px solid var(--teal); pointer-events: none; z-index: 7; }

.adj { position: fixed; z-index: 40; width: 300px; max-width: calc(100vw - 20px); background: var(--surface); border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0,0,0,.22); border: 1px solid var(--line); padding: 10px 14px 8px; }
.adj-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.adj-head b { font-size: 15px; }
.adj-head .ic { margin-left: auto; width: 30px; height: 30px; font-size: 18px; }
.adj-row { display: grid; grid-template-columns: 30px 1fr 30px; gap: 4px 8px; align-items: center; padding: 6px 0; }
.adj-row label { grid-column: 1 / 3; grid-row: 1; font-size: 13px; font-weight: 600; }
.adj-val { grid-column: 3; grid-row: 1; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.step { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 16px; line-height: 1; padding: 0; }
.adj-row input[type=range] { width: 100%; margin: 0; accent-color: var(--teal); }
.adj-foot { display: flex; justify-content: flex-end; padding-top: 4px; }

.keys-grid { display: grid; grid-template-columns: 112px 1fr; gap: 9px 14px; padding: 14px 18px 4px; font-size: 14px; align-items: baseline; }
.keys-grid b { font-size: 12px; font-weight: 700; background: var(--ground); border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; text-align: center; white-space: nowrap; }
.fs-steps { margin: 0 18px 18px; padding-left: 20px; line-height: 1.8; }
@media (hover: none) { #keys-btn { display: none; } }
@media (max-width: 760px) {
  .vtools button { padding: 0 7px; }
  .vtools button span { display: none; }
  .rot-txt { min-width: 44px; padding: 0 4px; }
  .tools { justify-content: flex-start; }
}
