/* ========================================================================== 
   Mobile · < 768px · Touch-first, portrait-first, browser-bar safe
   ========================================================================== */
:root { --header-h: 54px; --radius: 14px; }
.desktop-only, .tablet-only { display: none !important; }
.mobile-only, .mobile-tablet-only { display: initial; }

.topbar { top: max(6px, var(--safe-top)); left: max(6px, var(--safe-left)); right: max(6px, var(--safe-right)); height: var(--header-h); padding: 0 8px 0 10px; gap: 7px; }
.brand { gap: 8px; }
.brand-orbit { width: 33px; height: 33px; }
.brand-orbit span { width: 9px; height: 9px; left: 11px; top: 11px; }
.brand-copy strong { font-size: .7rem; letter-spacing: .055em; }
.brand-copy small { font-size: .52rem; letter-spacing: .035em; }
.live-strip { margin-left: auto; }
.status-pill { min-height: 28px; padding: 0 8px; font-size: .55rem; }
.status-pill b { font-size: .52rem; }
.top-actions { gap: 4px; }
.icon-button { min-width: 31px; width: 31px; height: 31px; border-radius: 9px; }
.icon-button .button-label { display: none; }
#open-help { display: none; }

.globe-stage { inset: 0; }
.search-panel { top: calc(var(--safe-top) + 67px); left: max(8px, var(--safe-left)); right: max(8px, var(--safe-right)); padding: 9px; border-radius: 13px; }
.search-panel .compact-heading, .quick-cities, .search-actions, .privacy-note { display: none; }
.search-form { margin: 0; grid-template-columns: minmax(0,1fr) 72px; gap: 6px; }
.search-input-wrap { height: 38px; border-radius: 10px; padding: 0 8px; }
.search-input-wrap input { font-size: .74rem; }
.search-submit { min-width: 0; padding: 0 8px; font-size: .66rem; }
.search-results { top: 54px; left: 0; right: 0; max-height: 44dvh; }

.weather-panel { left: max(6px, var(--safe-left)); right: max(6px, var(--safe-right)); bottom: calc(var(--safe-bottom) + 66px); padding: 6px 10px 10px; max-height: min(46dvh, 390px); overflow: hidden; border-radius: 16px 16px 12px 12px; transition: max-height .28s ease, padding .28s ease, border-color .28s ease; }
.weather-panel-toggle { position: relative; width: 100%; min-height: 38px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 2px 2px; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.panel-grip { position: absolute; top: 2px; left: 50%; width: 44px; height: 4px; transform: translateX(-50%); border-radius: 99px; background: rgba(139, 207, 228, .38); transition: background .25s ease, width .25s ease; }
.weather-toggle-summary { min-width: 0; display: grid; gap: 1px; }
.weather-toggle-summary b { overflow: hidden; color: var(--text); font-size: .69rem; text-overflow: ellipsis; white-space: nowrap; }
.weather-toggle-summary small { overflow: hidden; color: var(--muted); font-size: .52rem; text-overflow: ellipsis; white-space: nowrap; }
.weather-toggle-value { display: flex; align-items: center; gap: 8px; }
.weather-toggle-value strong { color: var(--cyan); font-size: .82rem; font-weight: 700; }
.weather-toggle-value i { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid rgba(101, 220, 255, .2); border-radius: 50%; color: var(--cyan); font-size: .82rem; font-style: normal; transition: transform .28s ease, background .28s ease; }
.weather-panel-content { max-height: calc(min(46dvh, 390px) - 44px); overflow: auto; overscroll-behavior: contain; opacity: 1; transition: max-height .28s ease, opacity .2s ease; scrollbar-width: thin; scrollbar-color: rgba(101, 220, 255, .25) transparent; }
.weather-panel:not(.is-collapsed) .weather-toggle-summary,
.weather-panel:not(.is-collapsed) .weather-toggle-value strong { display: none; }
.weather-panel:not(.is-collapsed) .weather-toggle-value { grid-column: 2; justify-self: end; }
.weather-panel .panel-heading { align-items: center; }
.weather-panel .eyebrow { font-size: .52rem; }
.weather-panel .panel-heading h2 { margin-top: 2px; font-size: .95rem; }
.weather-panel .panel-heading p { margin-top: 2px; font-size: .57rem; }
.weather-symbol { width: 37px; height: 37px; border-radius: 11px; font-size: 1.05rem; }
.weather-primary { margin: 7px 0; gap: 10px; }
.temperature strong { font-size: 2.25rem; }
.temperature span { font-size: .72rem; }
.weather-primary > div:last-child { gap: 2px; }
.weather-primary > div:last-child strong { font-size: .69rem; }
.weather-primary > div:last-child span { font-size: .57rem; }
.metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.metric-grid article { min-height: 48px; padding: 6px 5px; text-align: center; justify-items: center; }
.metric-grid span { font-size: .49rem; }
.metric-grid strong { width: 100%; font-size: .6rem; }
.metric-grid small { display: none; }
.weather-alert { margin-top: 6px; padding: 6px 7px; gap: 6px; }
.weather-alert .alert-icon { width: 24px; height: 24px; }
.weather-alert b { font-size: .59rem; }
.weather-alert p { font-size: .51rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.forecast-block { margin-top: 7px; }
.subheading { margin-bottom: 4px; }
.subheading span { font-size: .5rem; }
.subheading small { font-size: .49rem; }
.hourly-forecast { grid-auto-columns: 48px; gap: 4px; }
.hour-card { padding: 5px 3px; gap: 3px; }
.jarvis-line { margin-top: 6px; padding-top: 6px; }
.jarvis-line p { font-size: .53rem; }

.globe-controls { left: 50%; transform: translateX(-50%); bottom: max(7px, var(--safe-bottom)); width: min(calc(100% - 12px), 430px); justify-content: space-around; padding: 4px; border-radius: 14px; }
.globe-controls button { min-width: 46px; min-height: 46px; padding: 2px 5px; }
.globe-controls button span { font-size: .9rem; }
.globe-controls button b { font-size: .48rem; }

.layer-drawer { z-index: 40; left: max(8px, var(--safe-left)); right: max(8px, var(--safe-right)); bottom: calc(var(--safe-bottom) + 62px); padding: 11px; background: rgba(3, 14, 24, .96); }
.drawer-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid rgba(101, 194, 225, .16); }
.drawer-heading b { font-size: .73rem; }
.drawer-heading button { width: 30px; height: 30px; border: 1px solid rgba(255, 100, 120, .25); border-radius: 50%; background: rgba(84, 13, 25, .28); color: #ff9ba7; }
.layer-drawer label { display: flex; align-items: center; gap: 9px; padding: 8px 2px; color: var(--muted); font-size: .68rem; }
.layer-drawer input { accent-color: #48c9ef; }

.focus-reticle { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
.focus-reticle::before { left: 27px; height: 70px; top: -7px; }
.focus-reticle::after { top: 27px; width: 70px; left: -7px; }
.toast { bottom: calc(126px + var(--safe-bottom)); font-size: .62rem; }
.info-dialog form { padding: 18px; }
.info-grid { grid-template-columns: 1fr; }

@media (orientation: landscape) and (max-height: 540px) {
  :root { --header-h: 46px; }
  .topbar { top: max(4px, var(--safe-top)); height: 46px; }
  .brand-orbit { width: 29px; height: 29px; }
  .brand-copy small { display: none; }
  .status-pill { min-height: 25px; }
  .search-panel { top: calc(var(--safe-top) + 55px); left: max(6px, var(--safe-left)); right: auto; width: min(250px, 31vw); }
  .weather-panel { left: auto; top: calc(var(--safe-top) + 55px); right: max(6px, var(--safe-right)); bottom: auto; width: min(285px, 36vw); max-height: calc(100dvh - 112px); padding: 5px 9px 7px; }
  .weather-panel-content { max-height: calc(100dvh - 168px); }
  .weather-panel.is-collapsed { max-height: 54px; }
  .weather-panel .panel-heading p, .weather-alert, .forecast-block, .jarvis-line { display: none; }
  .weather-symbol { width: 34px; height: 34px; font-size: 1rem; }
  .weather-primary { margin: 5px 0; gap: 8px; }
  .temperature strong { font-size: 2rem; }
  .metric-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .metric-grid article { min-height: 39px; padding: 5px 3px; }
  .globe-controls { bottom: max(4px, var(--safe-bottom)); width: min(420px, 58vw); }
  .globe-controls button { min-height: 40px; }
}

/* Compact bottom-sheet state; all data remains available after reopening. */
.weather-panel.is-collapsed { max-height: 56px; padding-bottom: 4px; border-color: rgba(101, 220, 255, .38); }
.weather-panel.is-collapsed .weather-panel-toggle { min-height: 46px; padding-top: 10px; }
.weather-panel.is-collapsed .weather-panel-content { max-height: 0; opacity: 0; pointer-events: none; }
.weather-panel.is-collapsed .panel-grip { width: 54px; background: rgba(101, 220, 255, .78); }
.weather-panel.is-collapsed .weather-toggle-value i { transform: rotate(180deg); background: rgba(42, 160, 194, .12); }

.scan-card {
  top: calc(var(--safe-top) + 112px);
  bottom: auto;
  width: min(430px, calc(100% - 14px));
  padding: 9px 10px 9px 12px;
}
.scan-card-heading { gap: 5px; }
.scan-card-heading .eyebrow { font-size: .46rem; }
.scan-card-heading strong { max-width: 42%; font-size: .65rem; }
.scan-badge { padding: 2px 5px; font-size: .43rem; }
.scan-card > p { margin: 5px 0 6px; font-size: .57rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-metrics { gap: 4px; }
.scan-metrics span { padding: 5px 4px; text-align: center; }
.scan-metrics small { font-size: .42rem; }
.scan-metrics b { font-size: .53rem; }
.scan-note { margin-top: 5px; font-size: .44rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-card-close { top: 5px; right: 5px; width: 24px; height: 24px; }

@media (orientation: landscape) and (max-height: 540px) {
  .scan-card { top: calc(var(--safe-top) + 54px); width: min(360px, 46vw); }
  .scan-note { display: none; }
}
