/* COM v3 — o oxígrafo */
/* correção local: html/body com height:100% em app.css impedem os elementos sticky de acompanhar a rolagem */
html, body.app { height: auto; min-height: 100%; }
.com { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }

/* ---------- aparelho ---------- */
.oxigrafo { padding: 16px; background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%); }
.ox-topo { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: stretch; }
.cela-wrap { display: grid; gap: 6px; }
.cela { width: 100%; height: auto; display: block; }
.svg-lbl { font: 600 9px var(--font); fill: var(--ink-3); }
.seringa-lbl { font-size: 10px; fill: var(--ink); }
.cela-leg { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .72rem; color: var(--ink-3); justify-content: center; }
.cela-leg b { color: var(--prog); }

.agitador { transform-origin: 110px 179.5px; }
.gravando .agitador { animation: gira .7s linear infinite; }
@keyframes gira { to { transform: rotateY(360deg); } }
.suspensao circle { fill: #b7793a; opacity: .75; }
.gravando .suspensao circle { animation: flutua 3s ease-in-out infinite; }
.suspensao circle:nth-child(odd) { animation-direction: reverse; }
@keyframes flutua { 50% { transform: translate(3px, -5px); } }

.seringa { transition: transform .45s cubic-bezier(.3, 1.2, .5, 1); transform: translateY(0); }
.seringa.injeta { transform: translateY(78px); }
.gotas circle { fill: var(--prog); opacity: 0; }
.gotas.ativa circle { animation: gota 1s ease-out forwards; }
@keyframes gota { 0% { opacity: .9; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(70px) scale(2.2); } }

/* painel */
.painel { display: grid; gap: 12px; align-content: start;
  padding: 14px; border-radius: var(--radius-sm); background: var(--ink); color: #e9eef5;
  background: linear-gradient(160deg, #2a3442, #171e29); box-shadow: inset 0 1px 0 rgba(255,255,255,.08), var(--shadow); }
.displays { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.disp { background: #0b1118; border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px;
  box-shadow: inset 0 0 0 1px #2b3745, inset 0 2px 6px rgba(0,0,0,.6); }
.disp-lbl { font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: #8fa0b5; }
.disp-val { font-family: var(--mono); font-size: 1.45rem; font-weight: 700; color: #7be0a6; font-variant-numeric: tabular-nums; line-height: 1.1; text-shadow: 0 0 10px rgba(123,224,166,.45); }
.disp-val small { font-size: .7rem; font-weight: 500; margin-left: .25em; color: #5fb88a; }
.disp-val.txt { font-size: .9rem; color: #ffd27a; text-shadow: 0 0 8px rgba(255,210,122,.4); font-family: var(--font); font-weight: 600; }
.status-disp.on .disp-val.txt { color: #ff6b5e; text-shadow: 0 0 8px rgba(255,107,94,.6); animation: rec 1.2s infinite; }
@keyframes rec { 50% { opacity: .45; } }

.controles { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fbtn { position: relative; border: 0; border-radius: 10px; padding: 9px 16px 8px; font: 700 .85rem var(--font); letter-spacing: .02em;
  color: #e9eef5; background: linear-gradient(#4b5868, #2f3947); box-shadow: 0 3px 0 #141a22, 0 4px 8px rgba(0,0,0,.4); cursor: pointer;
  transition: transform .06s, box-shadow .06s; text-transform: uppercase; }
.fbtn .cap { position: absolute; top: 5px; left: 8px; width: 6px; height: 6px; border-radius: 50%; background: #4a5566; }
.fbtn.go { background: linear-gradient(#e36256, #c23a2e); }
.fbtn.go .cap { background: #ffd0ca; box-shadow: 0 0 6px #ffb3ab; }
.fbtn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #141a22, 0 2px 4px rgba(0,0,0,.4); }
.fbtn:disabled { opacity: .45; cursor: not-allowed; }
.knob { font-size: .78rem; color: #b9c3d1; display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.knob select { font: inherit; padding: 4px 8px; border-radius: 8px; border: 1px solid #3a4756; background: #0b1118; color: #e9eef5; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: .82rem; color: #b9c3d1; cursor: pointer; }
.check input { accent-color: #ff6b5e; }

.btn.mito { justify-content: flex-start; background: #1d2633; border-color: #3a4756; color: #e9eef5; }
.btn.mito:hover { border-color: #ff8a7f; }
.btn.mito svg { width: 34px; height: 20px; color: #ff8a7f; }
.btn.mito.added { border-color: #7be0a6; color: #7be0a6; }
.btn.mito.added svg { color: #7be0a6; }
.hint { font-size: .78rem; margin: 0; color: #8fa0b5; }

/* registrador */
.registrador { margin-top: 16px; }
.reg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.reg-head h2 { font-size: 1rem; margin: 0; }
.papel { display: grid; grid-template-columns: 14px minmax(0, 1fr) 14px; gap: 0; align-items: stretch; }
.rolo { background: linear-gradient(90deg, #6d7684, #b8c0cc 40%, #6d7684); border-radius: 7px; box-shadow: var(--shadow); }
.folha { background: #fffdf5; border: 1px solid #e6dcc2; border-radius: 6px; padding: 8px; display: grid; gap: 6px;
  box-shadow: inset 0 0 30px rgba(120, 90, 20, .06); }
:root[data-theme="dark"] .folha { background: #f4efe0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .folha { background: #f4efe0; } }
.o2-plot { aspect-ratio: 4 / 1.7; }
.psi-plot { aspect-ratio: 4 / .65; }
.o2-plot canvas, .psi-plot canvas { display: block; width: 100%; height: 100%; }
.reg-nota { font-size: .76rem; margin: 8px 0 0; }

.exp-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.exp-tabs button { min-width: 34px; }
.exp-tabs button[aria-selected="true"] { background: var(--prog); color: #fff; border-color: var(--prog); }

/* ---------- estante ---------- */
.side { display: grid; gap: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.estante { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 8px 6px;
  background: linear-gradient(180deg, transparent 0 calc(100% - 6px), var(--line-2) calc(100% - 6px)); border-radius: 6px; }
.frasco { border: 0; background: transparent; padding: 0; cursor: pointer; display: grid; justify-items: center; gap: 4px; font: inherit; color: var(--ink);
  transition: transform .12s; }
.frasco:hover:not(:disabled) { transform: translateY(-3px); }
.frasco:disabled { cursor: not-allowed; opacity: .4; filter: grayscale(.6); }
.frasco svg { width: 44px; height: 58px; display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.18)); }
.frasco .nome { font-size: .7rem; line-height: 1.15; text-align: center; font-weight: 600; max-width: 96px; }
.frasco.used .nome::after { content: " ✓"; color: var(--ok); }
.frasco.used svg { filter: drop-shadow(0 0 4px var(--prog)); }

.historico { margin: 0 0 10px; padding-left: 1.6em; font-size: .88rem; max-height: 220px; overflow: auto; }
.historico:empty::before { content: attr(data-vazio); color: var(--ink-3); margin-left: -1.6em; }
.historico li { padding: 2px 0; }
.historico .t { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: .8rem; margin-left: .4em; }

.oxigrafo-foto img { border-radius: var(--radius-sm); display: block; }

/* ---------- responsivo ---------- */
@media (max-width: 1080px) { .com { grid-template-columns: minmax(0, 1fr) 280px; } .ox-topo { grid-template-columns: 200px minmax(0,1fr); } .displays { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .com { grid-template-columns: 1fr; }
  .estante { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 640px) {
  /* no celular o registrador vai para o topo e fica fixo enquanto se escolhem os frascos */
  .oxigrafo { display: contents; }
  .registrador { order: -1; position: sticky; top: 64px; z-index: 5; margin: 0; padding: 8px 10px 10px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
  .ox-topo { grid-template-columns: 1fr; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
  .cela { max-width: 200px; margin: 0 auto; }
  .displays { grid-template-columns: repeat(2, 1fr); }
  .disp-val { font-size: 1.2rem; }
  .knob { margin-left: 0; }
  .estante { grid-template-columns: repeat(3, 1fr); }
  .o2-plot { aspect-ratio: 4 / 2; }
  .psi-plot { aspect-ratio: 4 / .75; }
  .reg-nota { display: none; }
}
