/* Foam⁴ — a lab, not a cabinet: deep blue, glass, a panel of controls. */
:root { --bg: #05080d; --panel: rgba(10, 16, 26, 0.92); --border: #1d2c40; --text: #e6eef8; --dim: #8ea2b8; --accent: #7fd6ff; --gold: #ffd36b;
  --mono: ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace; --sans: -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); overflow: hidden; overscroll-behavior: none; }
/* nothing over the foam: it has its own part of the window, and everything else is in the panel */
#gl, #over { position: fixed; left: 0; top: 0; bottom: 0; right: 360px; width: calc(100% - 360px); height: 100%; display: block; }
#gl { touch-action: none; cursor: grab; }
#over { pointer-events: none; }
#title { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; margin: 8px 0 6px; }
#title b { font-size: 17px; letter-spacing: 0.2em; color: var(--accent); }
#title span { color: var(--dim); margin-left: 6px; }
#readout { font-size: 12.5px; line-height: 1.55; color: #cfdbe8; background: rgba(5, 8, 13, 0.5); border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; }
#readout b { color: var(--text); font-variant-numeric: tabular-nums; }
#readout .dim { color: var(--dim); }
#log { font-family: var(--mono); font-size: 11px; line-height: 1.55; color: var(--dim); margin-top: 6px; min-height: 1.55em; }
#log div:first-child { color: var(--gold); }
button.tiny { font: inherit; font-size: 11px; background: none; color: var(--dim); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; cursor: pointer; margin-left: 4px; }
#panel { position: fixed; right: 0; top: 0; bottom: 0; width: 360px; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--border); padding: 4px 16px 14px;
  font-size: 13px; transition: transform .2s; }
#panel h3 { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); margin: 14px 0 7px; font-weight: 600; }
.seg { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.seg button, #panel > .seg button { font-family: var(--mono); font-size: 12px; background: #0e1726; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; cursor: pointer; }
.seg button.on, #panel .seg button.on { background: var(--accent); color: #04121c; border-color: var(--accent); font-weight: 700; }
.row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-family: var(--mono); font-size: 12px; color: var(--dim); }
.row input[type=range] { flex: 1; accent-color: var(--accent); min-width: 0; }
.row output { width: 3.6em; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.row.small { flex: 1; margin: 0 0 0 6px; }
.row.check { color: var(--text); }
.about { color: var(--dim); font-size: 12.5px; line-height: 1.55; margin: 8px 0; }
.about b { color: var(--text); }
details { margin-top: 14px; color: var(--dim); font-size: 12.5px; line-height: 1.6; }
details summary { cursor: pointer; color: var(--accent); font-family: var(--mono); font-size: 12px; }
details b { color: var(--text); }
details ul { padding-left: 18px; }
.foot { font-family: var(--mono); font-size: 11px; margin-top: 14px; }
.foot a { color: var(--dim); }
/* a phone: the foam in the top two thirds, the controls in the bottom third, the most used first */
/* a phone: the foam in the top two thirds, everything else in the bottom third, the readout and the most-used controls first */
@media (max-width: 760px) {
  #gl, #over { right: 0; width: 100%; bottom: auto; height: 66.6vh; height: 66.6dvh; }
  #panel { left: 0; right: 0; bottom: 0; top: auto; width: auto; height: 33.4vh; height: 33.4dvh; border-left: 0; border-top: 1px solid var(--border);
    padding: 0 12px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; }
  #panel > * { flex: none; }
  #panel #title, #panel #readout, #panel #log { order: -3; }
  #panel .k-first { order: -2; }
  #panel h3 { margin: 10px 0 5px; }
  #panel .about { display: none; }
  #panel .species { display: grid; grid-template-columns: repeat(4, 1fr); }
  #panel .species button { padding: 8px 2px; font-size: 11px; }
  .seg button { padding: 8px 9px; }
  .row { margin: 4px 0; }
  .row input[type=range] { height: 28px; }
  #title { margin: 6px 0 4px; }
  #title span { display: none; }
  #readout { font-size: 11.5px; line-height: 1.45; padding: 5px 8px; }
  #readout .dim { display: none; }
  #log { margin-top: 3px; height: 1.55em; overflow: hidden; }
}
[hidden] { display: none !important; }
