/* ZEN-TECH™ v3.7.2 — mobile session readability + safe viewing area.
   Scoped to the active 11-minute engine. No checkout/audio entitlement changes.
   Loaded last so these rules intentionally supersede earlier mobile HUD styles. */
@media (max-width: 900px), (orientation: landscape) and (max-height: 600px) {
  #engine-container {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
    overscroll-behavior: none;
  }
  #engine-container #three-canvas-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
  }
  #engine-container .hud-overlay.tl,
  #engine-container .hud-overlay.tr {
    top: max(10px, env(safe-area-inset-top, 0px)) !important;
    font-size: 9px !important;
    line-height: 1.3 !important;
    letter-spacing: .13em !important;
    max-width: 42%;
  }
  #engine-container .hud-overlay.tl {
    left: max(12px, env(safe-area-inset-left, 0px)) !important;
  }
  #engine-container .hud-overlay.tr {
    right: max(12px, env(safe-area-inset-right, 0px)) !important;
  }
  #engine-container .hud-overlay.tc {
    top: max(38px, calc(env(safe-area-inset-top, 0px) + 38px)) !important;
    font-size: 9px !important;
    letter-spacing: .12em !important;
    white-space: nowrap;
  }
  #engine-container .abort-btn {
    top: max(61px, calc(env(safe-area-inset-top, 0px) + 61px)) !important;
    right: max(12px, env(safe-area-inset-right, 0px)) !important;
    width: 54px;
    min-width: 54px;
    min-height: 44px;
    padding: 8px;
  }
  /* Replace the phone-size paragraph card with a small, legible color badge. */
  #engine-container .nos-live-selection {
    position: absolute !important;
    top: max(70px, calc(env(safe-area-inset-top, 0px) + 70px)) !important;
    bottom: auto !important;
    left: max(12px, env(safe-area-inset-left, 0px)) !important;
    width: min(184px, 45vw) !important;
    max-width: calc(100vw - 96px);
    margin: 0 !important;
    padding: 7px 9px !important;
    border-left-width: 3px;
    background: rgba(5, 11, 22, .82);
    line-height: 1.25;
    pointer-events: none;
  }
  #engine-container .nos-live-selection .nos-live-eyebrow,
  #engine-container .nos-live-selection #nos-live-explanation,
  #engine-container .nos-live-selection #zen-live-sound-name {
    display: none !important;
  }
  #engine-container .nos-live-selection #nos-live-name {
    display: block;
    font-size: clamp(12px, 3vw, 15px) !important;
    line-height: 1.25;
  }
  #engine-container .nos-live-selection #nos-live-intention {
    display: block;
    margin-top: 3px;
    font-size: clamp(10px, 2.55vw, 12px) !important;
    line-height: 1.25;
    font-weight: 600;
  }
  /* Preserve breathing room for the visual sphere and the session timer. */
  body > #timer,
  #timer {
    top: clamp(145px, 22dvh, 225px) !important;
    font-size: clamp(31px, 8.7vw, 56px) !important;
    line-height: 1 !important;
    letter-spacing: .05em !important;
    white-space: nowrap;
  }
  #engine-container .hud-overlay.bl,
  #engine-container .hud-overlay.br {
    display: none !important;
  }
  #engine-container .mantra-display {
    top: auto !important;
    bottom: calc(132px + env(safe-area-inset-bottom, 0px)) !important;
    left: 50% !important;
    transform: translateX(-50%);
    width: min(90vw, 470px) !important;
    max-width: calc(100vw - 24px);
    margin: 0 !important;
    padding: 4px 8px !important;
    font-size: 12px !important;
    line-height: 1.35;
    text-align: center;
    pointer-events: none;
  }
  /* Two generously sized actions, with a full-width volume row on phones. */
  #zen-session-controls {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    transform: translateX(-50%) !important;
    width: min(calc(100vw - 20px), 490px) !important;
    max-width: calc(100vw - 20px);
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px 10px !important;
    align-items: center;
    justify-items: stretch;
    padding: 8px 10px !important;
    border-radius: 14px !important;
    font-size: 12px;
  }
  #zen-session-controls button {
    min-width: 0;
    width: 100%;
    min-height: 44px !important;
    padding: 8px 9px !important;
    font-size: 13px;
    text-align: center;
  }
  #zen-session-controls label {
    grid-column: 1;
    margin: 0;
    text-align: right;
    font-size: 11px;
  }
  #zen-session-volume {
    grid-column: 2;
    min-width: 0;
    width: 100% !important;
    max-width: none !important;
    min-height: 28px;
    margin: 0;
  }
}

/* Short landscape screens: one slim control bar low on the screen, and
   a compact color badge in the far-left margin. Works on Android and iOS. */
@media (orientation: landscape) and (max-height: 600px) {
  #engine-container .hud-overlay.tc {top: max(10px, env(safe-area-inset-top, 0px)) !important;}
  #engine-container .abort-btn {
    top: max(46px, calc(env(safe-area-inset-top, 0px) + 46px)) !important;
  }
  #engine-container .nos-live-selection {
    top: max(55px, calc(env(safe-area-inset-top, 0px) + 55px)) !important;
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    width: min(170px, 27vw) !important;
    padding: 6px 8px !important;
  }
  #engine-container .nos-live-selection #nos-live-name {font-size: 12px !important;}
  #engine-container .nos-live-selection #nos-live-intention {font-size: 10px !important;}
  body > #timer, #timer {
    top: clamp(48px, 14dvh, 78px) !important;
    font-size: clamp(26px, 5vw, 44px) !important;
  }
  #zen-session-controls {
    width: min(calc(100vw - 24px), 600px) !important;
    max-width: calc(100vw - 24px);
    bottom: calc(6px + env(safe-area-inset-bottom, 0px)) !important;
    grid-template-columns: minmax(68px, auto) minmax(90px, auto) auto minmax(80px, 150px) !important;
    gap: 8px !important;
    padding: 6px 10px !important;
    border-radius: 12px !important;
  }
  #zen-session-controls button {
    min-height: 42px !important;
    padding: 6px 10px !important;
    font-size: 12px;
  }
  #zen-session-controls label {
    grid-column: 3;
    text-align: right;
    white-space: nowrap;
  }
  #zen-session-volume {
    grid-column: 4;
    min-height: 26px;
  }
  #engine-container .mantra-display {
    top: auto !important;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    width: min(370px, 56vw) !important;
    font-size: 11px !important;
    padding: 3px 7px !important;
  }
}
/* Tiny landscape viewports: prioritize control usability over decorative copy. */
@media (orientation: landscape) and (max-height: 330px) {
  #engine-container .nos-live-selection #nos-live-intention {display:none !important;}
  #engine-container .mantra-display {display:none !important;}
  body > #timer, #timer {top: max(45px, 13dvh) !important;}
}
/* Very narrow phones: preserve hit targets without sideways scrolling. */
@media (max-width: 360px) and (orientation: portrait) {
  #engine-container .nos-live-selection {width: 166px !important;}
  #zen-session-controls {gap: 5px 7px !important;padding: 7px 8px !important;}
  #zen-session-controls button {font-size: 12px;}
}
