@media (max-width: 1150px) {
  .hud-top, .hud-bottom { gap: 8px; }
  .mouse-keys { margin-inline-start: 1px; gap: 3px; }
  .footer-right { gap: 5px; padding-inline-start: 9px; }
  .footer-right button { padding-inline: 7px; }
  .hud-bottom .ui-icon { width: 17px; height: 17px; }
}

@media (max-width: 1030px) {
  .view-label, .mouse-keys:not(.wheel-keys) { display: none; }
  .brand small { font-size: 11px; padding-inline-start: 8px; }
}

@media (max-width: 900px) {
  .scene-state { padding-inline-end: 8px; }
  .brand small { display: none; }
  .wheel-keys { display: none; }
}

@media (max-width: 830px) {
  :root { --side-gap: 8px; }
  .compact { display: block; }
  .header-actions { gap: 6px; }
  .experiment-title { gap: 8px; }
  .experiment-title h1 { font-size: 18px; }
  #help span { display: none; }
  .guide, .readings { display: none; }
  .show-guide .guide { display: flex; }
  .show-readings .readings { display: block; }
  .bench-sidebar {
    left: var(--margin);
    bottom: var(--side-bottom);
    width: auto;
    align-items: flex-end;
  }
  .readings { width: min(190px, 100%); }
  .titration-controls {
    width: min(350px, 100%);
    margin-top: auto;
  }
  body:has(#titrationControls:not([hidden])) #objectMenu {
    top: var(--side-top);
    right: var(--margin);
    bottom: auto;
    max-height: calc(100dvh - var(--side-top) - var(--side-bottom) - 146px);
  }
  body:has(#objectMenu:not([hidden])) .readings { visibility: hidden; }
  #objectMenu.measurement-console {
    top: auto;
    bottom: var(--side-bottom);
    width: min(350px, calc(100vw - 2 * var(--margin)));
    padding: 9px;
  }
  .measurement-console #contextControls {
    grid-template-areas: "tools tools" "status fine" "height confirm";
    gap: 4px 8px;
  }
  #objectMenu.measurement-console .reading-height { gap: 7px; min-height: 34px; margin: 0; }
  .measurement-console .reading-height input { min-height: 34px; }
  .measurement-console #contextControls .wide { min-height: 34px; margin: 0; padding-inline: 7px; font-size: 12px; }
}

@media (max-width: 780px) {
  :root { --top: 76px; --bottom: 48px; --margin: 8px; }
  .hud-top {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 42px 29px;
    align-content: center;
    row-gap: 0;
  }

  .experiment-title {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
    padding-top: 5px;
    border-top: 1px solid #69839a;
  }

  .experiment-title::before { display: none; }
  .experiment-title h1 { font-size: 15px; }
  .experiment-title span { font-size: 10px; }
  .brand { gap: 6px; }
  .brand-mark { width: 28px; }
  .brand strong { font-size: 14px; }
  .brand small { display: none; }
  .header-actions, .footer-right { gap: 3px; }
  .header-actions { font-size: 11px; }
  .hud-top :is(button, select) { min-height: 31px; }
  .header-actions button { padding-inline: 6px; }
  .view-control select { padding-inline: 7px 21px; }
  .select-frame::after { inset-inline-end: 7px; width: 6px; height: 6px; }
  #help { border: 0; padding-inline: 4px; }
  #help .ui-icon { width: 17px; height: 17px; }
  #help span { display: inline; }
  .hud-bottom { grid-template-columns: auto 1fr; }
  .scene-state { display: none; }
  .camera-tools { justify-self: start; gap: 3px; }
  .camera-tools .walk-help { display: none; }
  .hud-bottom button { padding-inline: 6px; min-height: 32px; }
  .footer-right { justify-self: end; padding-inline-start: 7px; }
  .guide { width: min(260px, calc(100vw - 2 * var(--margin))); }
  .readings { width: min(190px, calc(100vw - 2 * var(--margin))); }

  #objectMenu {
    top: auto;
    bottom: calc(var(--bottom) + var(--side-gap));
    max-height: calc(100dvh - var(--side-top) - var(--side-bottom));
  }

  #objectMenu.reading-console { max-height: min(40dvh, calc(100dvh - var(--side-top) - var(--side-bottom))); }

  body:has(#objectMenu:not([hidden])) #toast { bottom: auto; top: var(--side-top); }
}

@media (max-width: 830px) and (max-height: 535px) {
  #objectMenu.measurement-console { padding: 7px 9px; }
  #objectMenu.measurement-console #objectDesc { display: none; }
  #objectMenu.measurement-console .object-head { margin-bottom: 4px; padding-bottom: 3px; }
  .measurement-console .measurement-toolbar button { min-height: 32px; padding-block: 3px; }
  .measurement-console [data-action="manual-fine"] { min-height: 24px; padding-block: 2px; }
}

@media (max-width: 570px) {
  .setup-layout { grid-template-columns: 1fr; }
  #characterPreview { height: max(182px, min(30dvh, 230px)); border-inline-end: 0; border-bottom: 1px solid #c6d5e3; }
  .setup-content { padding: 15px 18px 19px; }
  #characterSetupTitle { font-size: 22px; }
  .character-options { margin-top: 14px; }
  .camera-tools button > span { display: none; }
  .hud-bottom button .ui-icon { width: 17px; height: 17px; }
}

@media (max-width: 440px) {
  .record-count { display: none; }
  .footer-right button .ui-icon { display: none; }
}

@media (hover: none) and (pointer: coarse) {
  #shakeFlask kbd { display: none; }
}

@media (max-width: 375px) {
  .brand { gap: 4px; }
  .brand-mark { width: 25px; }
  .brand strong { font-size: 12px; }
  .header-actions { gap: 2px; font-size: 10px; }
  .header-actions button { padding-inline: 4px; }
  #help span { display: none; }
}
.hud-top .website-home{display:inline-flex;align-items:center;justify-content:center;color:#fff;text-decoration:none;border:1px solid #9ebbd4;border-radius:8px;padding:8px 11px;font-size:13px;white-space:nowrap;background:#17436b}.hud-top .website-home:hover{color:#fff;background:#075ac7;border-color:#b3dcff}.website-home:focus-visible{outline:3px solid #3498ef;outline-offset:2px}@media(max-width:700px){.hud-top .website-home{padding:7px;font-size:12px}}
