/* Zine look: pastel pink, black, deep blue. Paper-cut panels, square corners. */
:root {
  --pink: #f6c6d6;
  --ink: #111111;
  --blue: #1d3fd1;
  color-scheme: light;
}

* { box-sizing: border-box; border-radius: 0; }
html { font: 13px/1.45 Inter, "Noto Sans Hebrew", system-ui, "Segoe UI", Arial, sans-serif; font-feature-settings: "tnum" 1, "cv11" 1; }
body { margin: 0; background: var(--pink); color: var(--ink); font-variant-numeric: tabular-nums; }
button, input, select, textarea, pre, table { font-family: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--blue); color: var(--pink); }

/* ---- header ---- */
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 10px 16px; background: var(--pink); border-bottom: 2px solid var(--ink); position: sticky; top: 0; z-index: 5; }
.titlebox { display: flex; align-items: center; gap: 10px; justify-self: start; min-width: 0; }
.project { border: 2px solid var(--ink); background: var(--pink); padding: 3px 8px; width: 170px; min-width: 0; font-weight: 500; }
.project::placeholder { color: var(--ink); opacity: 0.6; }
.project:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.top h1 { font-size: 16px; margin: 0; font-weight: 700; white-space: nowrap; justify-self: start; background: var(--pink); color: var(--ink); padding: 3px 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.switch { display: inline-flex; gap: 8px; }
.switch button { border: 2px solid var(--ink); background: var(--pink); color: var(--ink); padding: 6px 18px; font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; }
.switch button:hover:not([aria-selected="true"]):not([aria-pressed="true"]) { border-color: var(--ink); color: var(--ink); background: color-mix(in srgb, var(--ink) 10%, var(--pink)); }
/* the selected tab stays black with pink text, hovered or not (no blue on black) */
.switch button[aria-selected="true"], .switch button[aria-selected="true"]:hover { background: var(--ink); color: var(--pink); border-color: var(--ink); cursor: default; }
.switch button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch button[aria-pressed="true"] { background: var(--ink); color: var(--pink); cursor: default; }
.switch button[aria-pressed="true"]:hover { border-color: var(--ink); color: var(--pink); }
.langswitch { justify-self: end; gap: 4px; }
.langswitch button { padding: 3px 9px; font-size: 12px; letter-spacing: 0; }
@media (max-width: 600px) {
  .top { grid-template-columns: 1fr; justify-items: center; gap: 8px; }
  .top h1 { justify-self: center; }
  .titlebox { justify-self: center; }
  .switch { width: 100%; }
  .langswitch { width: auto; justify-self: center; }
  .switch button { flex: 1 1 0; padding: 6px 6px; }
  .langswitch button { flex: none; padding: 3px 9px; }
}

/* ---- layout ---- */
html, body { height: 100%; }
body { display: flex; flex-direction: column; overflow: hidden; }
main { flex: 1 1 auto; min-height: 0; padding: 14px 16px; }
.cols { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: 20px; height: 100%; }
.cols[hidden] { display: none; }
.side { overflow-y: auto; min-height: 0; padding-block: 12px 6px; padding-inline: 2px 8px; scrollbar-width: thin; scrollbar-color: var(--ink) var(--pink); }
.main { min-height: 0; min-width: 0; display: flex; flex-direction: column; }
@media (max-width: 900px) {
  body { height: auto; overflow: auto; }
  main { overflow: visible; }
  .cols { grid-template-columns: 1fr; height: auto; }
  .side { overflow: visible; padding-inline-end: 4px; }
  .main { min-height: 70vh; }
  .top { position: static; }
}
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--pink); border-inline-start: 2px solid var(--ink); }
::-webkit-scrollbar-thumb { background: var(--ink); border: 2px solid var(--pink); }

/* ---- sheets (panels) with cut-paper labels ---- */
fieldset { background: var(--pink); border: 2px solid var(--ink); margin-block: 0 22px; margin-inline: 0 4px; padding: 18px 12px 12px; min-width: 0; }
legend { font-weight: 700; padding: 1px 10px; margin-inline-start: 6px; background: var(--pink); color: var(--ink); text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px; }

label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; margin-top: 8px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; margin: 0; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; }
.exgrid { grid-template-columns: 1.6fr 1fr 1fr; }
.exgrid label span { white-space: nowrap; }
.dpirow { max-width: 50%; }
.saved { margin: 10px 0 0; font-size: 12px; }
.saved ul { list-style: none; margin: 6px 0 0; padding: 0; max-height: 150px; overflow: auto; }
.saved li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px dashed var(--ink); }
.saved li button { padding: 0 8px; font-size: 12px; }
.saved .inlist { font-weight: 700; color: var(--blue); }

/* ---- controls ---- */
input, select, button { font: inherit; color: var(--ink); }
input[type="number"], input[type="file"], select {
  background: var(--pink); border: 2px solid var(--ink); padding: 3px 6px; width: 100%; min-width: 0; font-weight: 500;
}
input[type="file"] { padding: 3px; font-size: 12px; }
select { appearance: none; -webkit-appearance: none; padding-inline-end: 22px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 12px) 55%, calc(100% - 7px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
[dir="rtl"] select { background-position: 12px 55%, 7px 55%; }
input[type="number"].invalid { border-color: var(--blue); outline: 2px dashed var(--blue); outline-offset: 1px; }
input[type="number"]::placeholder { color: var(--ink); opacity: 1; font-style: italic; }
input[type="number"]:disabled, select:disabled { opacity: 0.45; cursor: not-allowed; }
input:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex: none; width: 16px; height: 16px; margin: 0; border: 2px solid var(--ink); background: var(--pink); display: inline-grid; place-content: center; cursor: pointer;
}
input[type="checkbox"]::after, input[type="radio"]::after { content: ''; width: 8px; height: 8px; background: var(--blue); transform: scale(0); }
input[type="checkbox"]:checked::after, input[type="radio"]:checked::after { transform: scale(1); }
input[type="checkbox"]:checked, input[type="radio"]:checked { border-color: var(--blue); }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: 0.45; cursor: not-allowed; }

input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; height: 18px; background: transparent; margin: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--ink); }
input[type="range"]::-moz-range-track { height: 4px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 18px; margin-top: -7px; background: var(--blue); border: 2px solid var(--ink); border-radius: 0; }
input[type="range"]::-moz-range-thumb { width: 8px; height: 14px; background: var(--blue); border: 2px solid var(--ink); border-radius: 0; }

button { background: var(--pink); border: 2px solid var(--ink); padding: 4px 12px; cursor: pointer; font-weight: 500; }
button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
button:active:not(:disabled) {  }
button.primary { background: var(--blue); color: var(--pink); border-color: var(--ink); font-weight: 700; }
button.primary:hover:not(:disabled) { border-color: var(--ink); color: var(--pink); background: var(--ink); }
button.primary:active:not(:disabled) {  }
button[aria-pressed="true"] { background: var(--ink); color: var(--pink); }
/* unavailable: simply greyed out (no strike-through, no dashed border) */
button:disabled { opacity: 0.45; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.vh { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.note { font-size: 12px; margin: 8px 0 0; }
.status { margin: 6px 0 0; font-size: 12px; min-height: 1em; }
.status.err { color: var(--blue); font-weight: 700; text-decoration: underline wavy var(--blue); text-underline-offset: 3px; }
.status.err::before { content: "!"; display: inline-block; background: var(--blue); color: var(--pink); padding: 0 6px; margin-inline-end: 6px; text-decoration: none; }
.status.ok { color: var(--ink); }

/* drop zones: cut here */
.drop { display: block; border: 2px dashed var(--ink); padding: 16px 10px 14px; text-align: center; cursor: pointer; font-size: 13px; margin: 12px 0 0; position: relative; }
.drop::before { content: "\2702"; position: absolute; inset-inline-start: 10px; top: -11px; background: var(--pink); padding: 0 4px; font-size: 16px; line-height: 1; }
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--blue); color: var(--blue); }
progress { width: 100%; height: 12px; margin-top: 10px; appearance: none; -webkit-appearance: none; border: 2px solid var(--ink); background: var(--pink); display: block; }
progress::-webkit-progress-bar { background: var(--pink); }
progress::-webkit-progress-value { background: var(--blue); }
progress::-moz-progress-bar { background: var(--blue); }

.thumbs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; max-height: 180px; overflow: auto; }
.thumb { padding: 0; border: 2px solid var(--ink); background: var(--pink); position: relative; line-height: 0; }
.thumb canvas { display: block; }
.thumb span { position: absolute; inset-inline-start: 0; bottom: 0; font-size: 9px; line-height: 1.2; background: var(--pink); color: var(--ink); padding: 0 3px; }

.sum { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 4px 0; font-size: 13px; }
.sum dt { font-weight: 400; }
.sum dd { margin: 0; text-align: end; font-weight: 700; }

.bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; background: var(--pink); padding: 4px 6px; }
.bar input[type="number"] { width: 64px; }
.warn { list-style: none; margin: 0 0 10px; padding: 0; }
.warn li { border: 2px dashed var(--blue); padding: 4px 10px; margin-bottom: 4px; font-size: 13px; }
.warn li::before, .warnnote::before { content: "!"; background: var(--blue); color: var(--pink); font-weight: 700; padding: 0 6px; margin-inline-end: 8px; }
.warnnote { border: 2px dashed var(--blue); padding: 4px 8px; }

/* ---- stages ---- */
.stage { position: relative; background: var(--pink); border: 2px solid var(--ink); overflow: hidden; min-height: 120px; }
.stage.fill { flex: 1 1 0; min-height: 0; margin-block: 0 4px; margin-inline: 0 4px; }
.stage canvas { position: absolute; inset: 0; margin: auto; display: block; direction: ltr; }
#preview { direction: ltr; cursor: default; background: #fff; border: 2px solid var(--ink); }
.hint { font-size: 12px; margin-inline-start: auto; }
.timeline { direction: ltr; display: block; width: 100%; height: 130px; border: 2px solid var(--ink); background: var(--pink); cursor: crosshair; margin-top: 4px; }
.tlfields { align-items: end; }
.tlbtns { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.tlbtns button { padding: 2px 6px; font-size: 12px; }
.tlzoom { display: flex; gap: 4px; margin-top: 4px; direction: ltr; }
.tlzoom button { padding: 0 10px; min-width: 30px; font-size: 13px; line-height: 1.5; }
.tlconfirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; padding: 5px 8px; border: 2px dashed var(--blue); font-weight: 700; }
.tlconfirm button { padding: 2px 10px; font-size: 12px; }
.tlconfirm button:first-of-type { background: var(--blue); color: var(--pink); }
.seg { display: inline-flex; margin-top: 12px; }
.seg button { padding: 3px 14px; font-size: 12px; font-weight: 700; }
.seg button + button { margin-inline-start: -2px; }
.seg button[aria-pressed="true"]:hover { border-color: var(--ink); color: var(--pink); }

/* layout slot: a strip of paper laid over a line */
.layoutslot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 6px; margin-top: 12px; padding: 5px 8px; border: 2px solid var(--ink); font-size: 12px; background: var(--pink); }
/* the layout name gets its own line, so the Change / remove buttons never cut it off */
.layoutslot span { flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; }
.layoutslot.need { background: var(--pink); color: var(--blue); border-color: var(--blue); font-weight: 700; }
.layoutslot.need button { background: var(--pink); color: var(--ink); }
.layoutslot.have { font-weight: 500; }
.layoutslot button { padding: 1px 8px; font-size: 12px; }
button.x { padding: 0 7px; line-height: 1.4; font-size: 15px; }
.simbox { background: var(--pink); border: 2px solid var(--ink); margin: 0 0 18px; padding: 8px 12px; }
.simbox summary { font-weight: 700; cursor: pointer; }
.views { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.playerhost { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; margin-block: 0 4px; margin-inline: 0 4px; }
@media (max-width: 1100px) { .views { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 900px) { .views { grid-template-rows: 60vh 60vh; flex: none; } .stage.fill { min-height: 240px; } }
.stage #scanEmpty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; }

details { margin-top: 10px; font-size: 12px; }
summary { cursor: pointer; font-weight: 700; }

h3.sub { font-size: 12px; margin: 10px 0 4px; font-weight: 700; text-transform: uppercase; }
.player { outline-offset: 2px; display: flex; flex-direction: column; min-height: 0; flex: 1 1 0; border: 2px solid var(--ink); padding: 8px; }
.pl-stage { direction: ltr; position: relative; flex: 1 1 0; min-height: 80px; background: var(--ink); overflow: hidden; }
.pl-canvas { position: absolute; inset: 0; margin: auto; display: block; background: var(--ink); cursor: pointer; }
.pl-bar { direction: ltr; display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.pl-bar .pl-slider { flex: 1; }
.pl-play { min-width: 64px; }
.pl-info { font-size: 12px; margin-top: 4px; }
.pl-opts { display: flex; gap: 14px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.pl-opts input[type="number"] { width: 64px; }

.scanrows { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.scanrow { position: relative; display: grid; grid-template-columns: 84px minmax(0, 1fr) auto auto auto; gap: 4px 6px; align-items: center; border: 2px solid var(--ink); padding: 3px 4px 3px 12px; background: var(--pink); }
[dir="rtl"] .scanrow { padding: 3px 12px 3px 4px; }
/* the selected scan: a solid ink strip on its start edge and a bold name; nothing changes size */
.scanrow::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 6px; background: transparent; }
.scanrow.sel::before { background: var(--ink); }
.scanrow.sel .nm { font-weight: 700; }
.scanrow .nm { grid-column: 1 / -1; border: 0; background: none; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 4px; }
.scanrow .prob { grid-column: 1 / -1; font-size: 12px; font-weight: 700; padding: 0 4px 2px; }
.scanrow .prob::before { content: "! "; }
.scanrow select { padding: 1px 4px; }
.scanrow .st { font-size: 12px; white-space: nowrap; }
.scanrow .st.error { font-weight: 700; text-decoration: underline wavy; text-underline-offset: 3px; }
.scanrow .st.error::before { content: "! "; }
.scanrow button.ic { padding: 0 6px; line-height: 1.5; font-size: 14px; }
.scanrow button.ic[hidden] { display: none; }

#scannerBox { margin-bottom: 10px; }
#scannerBox .grid3 { align-items: end; }
.openrow { margin: 4px 0 6px; }
.openrow .note { margin: 0; }
.stage.over { outline: 2px dashed var(--blue); outline-offset: -6px; }

/* ---- corner handles: always there, quiet until hovered; pressing one shows all four (class .on) ---- */
.adjlayer { direction: ltr; position: absolute; inset: 0; pointer-events: none; }
.adjhandle { position: absolute; width: 0; height: 0; pointer-events: auto; touch-action: none; cursor: pointer; }
.adjlayer.on .adjhandle { cursor: grab; }
.adjlayer.on .adjhandle:active { cursor: grabbing; }
.adjhandle i { position: absolute; left: -14px; top: -14px; width: 28px; height: 28px; border: 2px solid transparent; }
.adjhandle:hover i, .adjhandle:focus-visible i { border-color: var(--blue); }
.adjlayer:not(.on) .adjhandle b, .adjlayer:not(.on) .adjhandle i::before, .adjlayer:not(.on) .adjhandle i::after { display: none; }
.adjlayer.on .adjhandle i { border-color: var(--blue); }
.adjhandle i::before, .adjhandle i::after { content: ""; position: absolute; background: var(--blue); }
.adjhandle i::before { left: 50%; top: 4px; bottom: 4px; width: 2px; margin-left: -1px; }
.adjhandle i::after { top: 50%; left: 4px; right: 4px; height: 2px; margin-top: -1px; }
.adjhandle b { pointer-events: none; position: absolute; left: 18px; top: -28px; white-space: nowrap; font: 700 13px/1.2 Inter, "Noto Sans Hebrew", system-ui, "Segoe UI", Arial, sans-serif; background: var(--pink); color: var(--ink); border: 2px solid var(--ink); padding: 2px 6px; }
.adjhandle.below b { top: 16px; }
.adjhandle.flip b { left: auto; right: 18px; }
.adjhandle.hollow i { border-width: 4px; }
.adjhandle.hollow b { background: var(--blue); color: var(--pink); }
.adjhandle:focus-visible { outline: none; }
.adjhandle:focus-visible i { outline: 2px solid var(--ink); outline-offset: 3px; }
.adjmag { position: absolute; z-index: 5; pointer-events: none; width: 140px; height: 140px; border: 2px solid var(--ink); background: #fff; }
/* Mark-as-hollow: a solid blue block with pink text, tied to the chosen handle by a leader line */
.adjmenu { direction: ltr; position: absolute; z-index: 6; width: 0; height: 0; }
.adjlead { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.adjlead line { stroke: var(--blue); stroke-width: 3; }
.adjhollowbtn, .adjtag { position: absolute; white-space: nowrap; background: var(--blue); color: var(--pink); border: 2px solid var(--ink); padding: 6px 14px; font: 700 14px/1.2 Inter, "Noto Sans Hebrew", system-ui, "Segoe UI", Arial, sans-serif; }
.adjhollowbtn { cursor: pointer; }
.adjhollowbtn:hover:not(:disabled) { background: var(--ink); color: var(--pink); border-color: var(--ink); }
.adjtag { padding: 3px 8px; font-size: 12px; }
.zoombar { position: absolute; z-index: 6; inset-block-end: 8px; inset-inline-end: 8px; display: flex; align-items: center; gap: 8px; direction: ltr; pointer-events: none; }
.zoombar span { background: var(--pink); border: 2px solid var(--ink); padding: 3px 8px; font-size: 12px; font-weight: 700; }
.zoombar button { pointer-events: auto; font-weight: 700; }
.stage.pan, .stage.pan canvas, .stage.pan .adjhandle, .stage.pan .adjhandle * { cursor: grab !important; }
.stage.panning, .stage.panning canvas, .stage.panning .adjhandle { cursor: grabbing !important; }
.adjchip { position: absolute; z-index: 6; inset-block-end: 8px; inset-inline-start: 8px; background: var(--pink); color: var(--ink); border: 2px solid var(--ink); padding: 3px 10px; font-size: 12px; font-weight: 700; pointer-events: none; }
.radios { display: flex; gap: 18px; }
.autorow { margin-top: 10px; }
.dlgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.dlgrid button { width: 100%; }

/* ---- print: only #printRoot, images at exact page size (unchanged) ---- */
#printRoot { display: none; }
@media print {
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; height: auto !important; overflow: visible !important; }
  body > *:not(#printRoot) { display: none !important; }
  #printRoot { display: block !important; margin: 0; padding: 0; }
  #printRoot img { display: block; margin: 0; padding: 0; border: 0; max-width: none !important; max-height: none !important; break-after: page; page-break-after: always; image-rendering: pixelated; }
  #printRoot img:last-child { break-after: auto; page-break-after: auto; }
}

/* ---- Hebrew / RTL ---- */
input[type="number"], input[type="range"] { direction: ltr; text-align: start; }
html[lang="he"] .top h1, html[lang="he"] legend, html[lang="he"] h3.sub { letter-spacing: 0; }
html[lang="he"] .top h1 { text-transform: none; }
[dir="rtl"] .switch button, [dir="rtl"] button { letter-spacing: 0; }
[dir="rtl"] .stage #scanEmpty { direction: rtl; }
[dir="rtl"] #pagePrev, [dir="rtl"] #pageNext { scale: -1 1; }

/* ---- colour ---- */
.inklist { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.inklist li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.inksw { width: 36px; height: 28px; padding: 0; border: 2px solid var(--ink); background: none; cursor: pointer; }
.inkname { min-width: 0; }
.inklist button.x { padding: 0 7px; }
.dotsw { display: inline-block; width: 11px; height: 11px; border: 1.5px solid var(--ink); margin-inline-end: 6px; vertical-align: -1px; }
.pvinks { display: contents; }
.pvinks label { margin-top: 0; }
.pageinfo { font-weight: 700; font-size: 12px; }
#colorBox .row { margin-top: 8px; }
#colorBox label { margin-top: 8px; }
.scanrow { grid-template-columns: minmax(84px, 1fr) auto auto auto; }
.scanrow .st { grid-column: 1 / -1; order: 1; }
.scanrow .prob { order: 2; }
.topend { justify-self: end; display: flex; align-items: center; gap: 12px; }
.reportbtn { border: 0; background: none; padding: 2px 0; font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; color: var(--ink); }
.reportbtn:hover { color: var(--blue); }
.reportbtn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (max-width: 600px) { .topend { justify-self: center; } }
.top { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.reportbtn { white-space: nowrap; }
.project { width: min(170px, 100%); }
@media (max-width: 1100px) and (min-width: 601px) { .top h1 { display: none; } }

/* ---- cache note, name-before-saving popover ---- */
.linkbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--blue); text-decoration: underline; cursor: pointer; }
.linkbtn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.exrow { position: relative; }
.namepop { position: absolute; inset-inline-start: 0; top: 100%; margin-top: 6px; z-index: 20; width: 260px; max-width: 100%; background: var(--pink); border: 2px solid var(--ink); padding: 10px; }
.namepop label { display: block; font-weight: 700; margin-bottom: 6px; }
.namepop input { width: 100%; border: 2px solid var(--ink); background: var(--pink); padding: 4px 8px; }
.namepop input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.namepop .row { margin-top: 8px; }

/* ---- help mode ---- */
.helpbtn { width: 28px; height: 28px; padding: 0; font-weight: 700; font-size: 14px; line-height: 1; }
body.helpmode, body.helpmode * { cursor: help !important; }
body.helpmode #btnHelp { cursor: pointer !important; }
.helppop { position: fixed; z-index: 100; max-width: 280px; padding: 9px 12px; background: var(--pink); border: 2px solid var(--ink); font-size: 13px; line-height: 1.45; color: var(--ink); cursor: default !important; }
.helphint { position: fixed; inset-inline-end: 16px; top: 54px; z-index: 90; max-width: 320px; padding: 6px 10px; background: var(--ink); color: var(--pink); font-size: 12px; font-weight: 600; pointer-events: none; }

/* ---- options laid over the picture, inside the preview / player (nothing sits above the panes) ---- */
.pane, .stage { position: relative; }
.overbar { position: absolute; z-index: 4; inset-inline-start: 8px; top: 8px; max-width: calc(100% - 16px); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; direction: inherit; }
.overbar label { margin: 0; font-size: 12px; white-space: nowrap; }
.pvover { top: 16px; inset-inline-start: 16px; max-width: calc(100% - 36px); padding: 4px 8px; background: color-mix(in srgb, var(--pink) 88%, transparent); border: 2px solid var(--ink); }
.viewseg.overbar { margin: 0; gap: 0; }
.viewseg.overbar button { padding: 2px 10px; }
.zoombar span { white-space: nowrap; }
.stage.pan #preview, .stage.pan #preview:hover { cursor: grab; }

/* header: never let the end group slide over the tabs — when space runs out it wraps to its own line */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.top > .titlebox { flex: 1 1 0; min-width: max-content; }
.top > .switch { flex: 0 0 auto; }
.top > .topend { flex: 1 1 0; min-width: max-content; justify-content: flex-end; }

/* the Copyxat mark next to the name */
.brand { display: inline-flex; align-items: center; gap: 4px; }
.brand h1 { padding-inline-start: 0; }
.brand .mark { height: 24px; width: auto; color: var(--ink); flex: none; }
