﻿/* Shared by React and the recovery page. Matrix sizing remains the original sizing. */
body.editing .app{padding:max(2px,env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) max(2px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left));min-height:100dvh}
body.editing header{height:28px;gap:4px;margin:0}
body.editing header>div{min-width:0;flex:1}
body.editing header h1{font-size:14px;white-space:nowrap;margin:0}
body.editing header h1 .pill,body.editing header small,body.editing .nav,body.editing .footer{display:none}
body.editing header>#saveStatus{font-size:10px;padding:2px 5px;max-width:75px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.editing #editor>.editor-card:first-child{padding:0 8px;margin:0;border-radius:0;border:1px solid transparent;background:transparent}
.set-toolbar{display:flex;align-items:center;gap:6px;height:42px;min-width:0}
.set-toolbar>select{flex:1;min-width:0;width:0;height:36px;padding:4px;font-size:16px}
.set-actions{display:flex;gap:4px;flex-shrink:0}
.set-actions .set-icon{width:40px;height:40px;min-width:40px;padding:8px;border-radius:7px;display:grid;place-items:center}
.set-actions .danger{color:#fca5a5;border-color:#874347;background:#41272f}
body.editing .editor-config{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:4px;margin:0;height:30px;align-items:center}
body.editing .editor-config .field{display:flex;align-items:center;gap:3px;min-width:0}
body.editing .editor-config label,body.editing .editor-config .field>span{font-size:10px;white-space:nowrap;margin:0}
body.editing .editor-config select{font-size:16px;height:28px;padding:1px 3px;width:100%;min-width:0}
body.editing .clear-range{font-size:10px;height:28px;padding:2px 5px;white-space:nowrap}
body.editing .editor-workspace{margin:0 auto;scroll-margin:0}
body.editing .matrix{margin:0}
body.editing .frequency-panel{padding:2px 0 0;gap:2px}
body.editing .frequency-panel>.row{height:16px;min-width:0;font-size:11px;line-height:16px}
body.editing .frequency-panel>.row strong{font-size:11px;white-space:nowrap}
body.editing .frequency-panel>.row small{font-size:10px;white-space:nowrap}
body.editing .frequency-numbers{height:28px;gap:8px;align-items:center}
body.editing .percent-field{font-size:11px;gap:3px}
body.editing .percent-field input{height:28px;width:65px;padding:2px 3px;font-size:16px}
body.editing .boundary-slider{height:56px;margin:0 16px}
body.editing .boundary-slider.single{height:32px}
body.editing .boundary-track{top:21px}
body.editing .boundary-slider.single .boundary-track{top:9px}
body.editing .handle-0{top:0}
body.editing .handle-1{top:28px}
body.editing .single .handle-0{top:2px}
body.editing .frequency-panel .bar{height:6px;margin:0}
body.editing .freqedit{display:grid;gap:0;margin:0}
body.editing .freqrow{display:grid;grid-template-columns:42px minmax(0,1fr) 60px;gap:4px;align-items:center;min-height:30px}
body.editing .freqrow label{font-size:11px;margin:0;color:var(--text)}
body.editing .freqrow input[type=range]{min-height:30px;height:30px;margin:0;width:100%}
body.editing .freqrow input[type=number]{height:28px;padding:2px 3px;font-size:16px;width:60px}
.name-dialog input{display:block;width:100%;padding:10px;margin:8px 0 16px;font-size:16px;color:#e8edf5;background:#0f192b;border:1px solid #52627b;border-radius:8px}
.name-dialog label{font-size:12px;color:#aab8cc}
.name-dialog .actions{justify-content:flex-end}
@media(min-width:601px){body.editing .app{padding-left:14px;padding-right:14px}body.editing header{height:32px}body.editing .editor-card{max-width:940px;margin:auto!important}}

/* One persistent navigation bar, with content space reserved on every screen. */
:root{--editor-safe-top:env(safe-area-inset-top,0px);--editor-safe-bottom:env(safe-area-inset-bottom,0px);--tabbar-height:52px;--tabbar-total:calc(var(--tabbar-height) + var(--editor-safe-bottom));--editor-top-clearance:clamp(2px,calc((100dvh - var(--editor-safe-top) - var(--editor-safe-bottom) - 568px) / 5),20px);--editor-room:clamp(0px,calc((100dvh - var(--editor-safe-top) - var(--editor-safe-bottom) - min(calc(100vw - 30px),600px) - 330px) / 8),12px)}
.app{padding-bottom:calc(var(--tabbar-total) + 16px)}
.bottom-tabs{position:fixed;z-index:20;left:0;right:0;bottom:0;height:var(--tabbar-total);padding:0 max(6px,env(safe-area-inset-right)) var(--editor-safe-bottom) max(6px,env(safe-area-inset-left));display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:2px;background:#111c2e;border-top:1px solid #344969}
.bottom-tabs button{border:0;background:transparent;color:#aab8cc;min-width:0;min-height:44px;height:calc(var(--tabbar-height) - 1px);padding:3px 2px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:10px;line-height:12px;touch-action:manipulation;border-radius:8px}
.bottom-tabs button[aria-current=page]{color:#c4b5fd;background:#302750;font-weight:700}
.bottom-tabs button:focus-visible{outline:2px solid #e8edf5;outline-offset:-3px}
.screen-content{min-width:0}
body.editing .app{padding-bottom:calc(var(--tabbar-total) + 2px)}
body.editing .editor-config{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
body.editing .set-toolbar{height:calc(42px + var(--editor-room))}
body.editing .set-actions .set-icon{height:clamp(40px,calc(38px + var(--editor-room)),44px);width:clamp(40px,calc(38px + var(--editor-room)),44px)}
body.editing .frequency-panel{padding-top:calc(2px + var(--editor-room));gap:calc(2px + var(--editor-room) / 2)}
body.editing .frequency-panel>.frequency-heading{height:24px;line-height:24px;gap:4px}
body.editing .frequency-heading .clear-range{height:24px;padding:0 4px;font-size:10px}
body.editing .frequency-heading strong{flex:1;min-width:0}
body.editing .freqrow,body.editing .freqrow input[type=range]{min-height:calc(30px + var(--editor-room))}
body.editing .freqrow input[type=range]{height:calc(30px + var(--editor-room))}
body.editing .boundary-slider{height:calc(56px + var(--editor-room))}
body.editing .handle-1{top:calc(28px + var(--editor-room))}
body.editing .boundary-slider.single{height:calc(32px + var(--editor-room))}
/* A short viewport uses two columns around the matrix, never smaller cells. */
@media(max-height:680px){
    body.editing .set-toolbar{height:clamp(40px,calc(38px + var(--editor-room)),44px)}
  body.editing #editor[data-spot="3BET"] .frequency-panel>.frequency-heading{height:20px;line-height:20px}
  body.editing #editor[data-spot="3BET"] .frequency-heading .clear-range{height:20px}
}
/* A phone viewport can lose 81px to safe areas. Reuse the compact React row
   through 761px so numeric fields remain above the fixed tabs. */
@media (max-height:680px), (max-width:600px) and (max-height:761px) {
  body.editing #editor[data-spot="3BET"] .frequency-panel:has(.frequency-numbers){display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:4px}
  body.editing #editor[data-spot="3BET"] .frequency-panel:has(.frequency-numbers)>.frequency-heading{grid-column:1;grid-row:1;height:28px;gap:2px}
  body.editing #editor[data-spot="3BET"] .frequency-panel:has(.frequency-numbers) .brush-label{display:none}
  body.editing #editor[data-spot="3BET"] .frequency-numbers{grid-column:2;grid-row:1;gap:4px}
  body.editing #editor[data-spot="3BET"] .percent-field{gap:2px;font-size:9px}
  body.editing #editor[data-spot="3BET"] .percent-field input{width:48px}
  body.editing #editor[data-spot="3BET"] .percent-field>span:last-child{display:none}
  body.editing #editor[data-spot="3BET"] .boundary-slider{grid-column:1/-1;grid-row:2}
}
@media(min-width:601px){body.editing .editor-workspace{width:min(100%,560px)}body.editing #editor.view .editor-workspace{width:min(100%,600px)}}
/* RFI needs one position row and can use more of the available height. */
body.editing #editor[data-spot="RFI"]{--editor-room:clamp(0px,calc((100dvh - var(--editor-safe-top) - var(--editor-safe-bottom) - min(calc(100vw - 30px),600px) - 240px) / 10),18px)}
body.editing #editor{--frequency-handle:clamp(28px,calc(26px + var(--editor-room)),40px)}
body.editing .boundary-handle{width:var(--frequency-handle);height:var(--frequency-handle)}
body.editing .boundary-slider{height:calc(28px + var(--editor-room) + var(--frequency-handle))}
body.editing .boundary-slider.single{height:calc(32px + var(--editor-room))}
body.editing .single .boundary-track{top:calc(9px + var(--editor-room) / 2)}


/* Position rows occupy their real height and full width; no scroll or overhanging targets. */
#editorHeaderControls{display:none}
body.editing #editorHeaderControls{display:block;flex:0 0 142px;min-width:0}
body.editing header #editorHeaderControls .editor-config{display:grid;grid-template-columns:70px 68px;gap:4px;width:142px;height:28px;margin:0}
body.editing header .editor-config .field{display:block;min-width:0}
body.editing header .editor-config .field>span,body.editing header .editor-config .field>label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;clip-path:inset(50%);white-space:nowrap}
body.editing header .editor-config select{width:100%;height:28px;font-size:16px;padding:0 1px}
body.editing .position-field{position:static;display:flex;align-items:stretch;padding:0;margin:0;gap:4px;height:calc(30px + var(--editor-room));min-width:0}
body.editing .position-field+.position-field{margin-top:2px}
body.editing .position-field .field-label{display:flex;align-items:center;flex:0 0 22px;font-size:10px;line-height:1;margin:0}
body.editing .position-tabs{display:grid;flex:1;min-width:0;height:100%;gap:2px;overflow:visible;align-items:stretch}
body.editing .position-tabs button{position:static;min-width:0;width:100%;height:100%;min-height:0;margin:0;padding:0 1px;font-size:clamp(11px,2.8vw,12px);line-height:1;white-space:nowrap;overflow:visible;text-overflow:clip;box-shadow:none;transform:none}
body.editing .position-tabs button[aria-pressed=true],body.editing .position-tabs button[aria-selected=true]{background:#395789;border-color:#9cbcf1;color:#fff}
body.editing .position-tabs button:focus-visible{outline:2px solid #e8edf5;outline-offset:-3px}
body.editing .editor-workspace{margin:6px auto 0}
@media(max-height:680px){body.editing header{height:22px}body.editing header #editorHeaderControls .editor-config,body.editing header .editor-config select{height:22px}}
@media(max-height:680px){
  body.editing header{height:21px}
  body.editing header #editorHeaderControls .editor-config,body.editing header .editor-config select{height:21px;line-height:1.1}
  body.editing .app{padding-bottom:var(--tabbar-total)}
}

/* Keep the browser's edge-sampling area solid; the header remains in normal flow. */
html,body{background-color:var(--bg,#0b1220)}
body.editing .app{padding-top:max(var(--editor-safe-top),var(--editor-top-clearance))}
body.editing header{background-color:var(--bg,#0b1220);position:static}

.full-frequency-form{display:grid;gap:6px;padding:8px 0;color:var(--text)}
.full-frequency-values{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.full-frequency-values input{display:block;width:100%;min-width:0;font-size:16px;padding:4px}
.full-frequency-form button{justify-self:start}
