/* Shared styles for the three gesture experiences. The Solar page overrides its colours inline. */
* { box-sizing: border-box; }

:root{
  --accent:#34d1c3;
  --panel:rgba(10,20,26,.72); --line:rgba(255,255,255,.12);
  --text:#eaf6f4; --muted:#9fc2c0;
}
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  font-family: "Segoe UI", system-ui, Arial, Helvetica, sans-serif;
  /* clinical backdrop: a soft teal stage-light behind the skeleton, darkening
     to a vignette at the edges so the bone-coloured foreground stands out */
  background:
    radial-gradient(58% 62% at 50% 40%, rgba(60,150,160,.20), rgba(20,60,72,.10) 45%, transparent 72%),
    radial-gradient(120% 120% at 50% 50%, transparent 55%, rgba(0,0,0,.55) 100%),
    linear-gradient(180deg, #10222b 0%, #0a171d 55%, #050c10 100%);
}

/* ===== top header bar ===== */
#topbar{ position:fixed; top:0; left:0; right:0; height:calc(60px + env(safe-area-inset-top)); z-index:50;
  padding:env(safe-area-inset-top) calc(20px + env(safe-area-inset-right)) 0 calc(20px + env(safe-area-inset-left));
  display:flex; align-items:center; justify-content:space-between; pointer-events:none; }
#topbar .brand{ display:flex; align-items:center; gap:9px; font-weight:800; font-size:18px; letter-spacing:.2px; }
#topbar .brand .logo{ font-size:20px; }
#topbar .center{ position:absolute; left:50%; transform:translateX(-50%); text-align:center; }
#topbar .center .ttl{ font-size:12px; font-weight:700; letter-spacing:.22em; text-transform:uppercase; color:var(--muted); }
#topbar .center .sub{ font-size:19px; font-weight:800; margin-top:1px; }
#topbar .right{ display:flex; align-items:center; gap:10px; pointer-events:auto; }
.pill{ display:flex; align-items:center; gap:8px; padding:8px 14px; border-radius:999px;
  background:var(--panel); border:1px solid var(--line); font-size:13px; font-weight:600; backdrop-filter:blur(12px); }
.pill .dot{ width:9px; height:9px; border-radius:50%; background:#6b7690; transition:background .2s, box-shadow .2s; }
.pill.on .dot{ background:#5cff9d; box-shadow:0 0 9px #5cff9d; }
#cornerBar{ position:fixed; top:12px; left:232px; z-index:45; }
#menuWrap{ position:relative; }
.langPill{ cursor:pointer; font-weight:800; font-size:14px; padding:9px 15px; background:rgba(92,255,157,.14); border:1.5px solid #5cff9d; color:#eafff2; }
.langPill.hot{ background:#5cff9d; color:#06210f; border-color:#5cff9d; }
.langPill.active{ background:#2fae63; color:#04210f; border-color:#7dffb4; }
#menuToggle{ display:inline-flex; align-items:center; gap:7px; padding:8px 14px; border-radius:999px;
  font-size:13px; font-weight:700; color:var(--text); background:rgba(10,16,34,.72);
  border:1px solid rgba(255,255,255,.16); cursor:pointer; white-space:nowrap; }
#menuToggle.hot{ background:#5cff9d; color:#06210f; border-color:#5cff9d; }
#menuPanel{ position:absolute; top:44px; left:0; display:none; flex-direction:column; gap:8px;
  padding:10px; border-radius:14px; background:rgba(8,12,26,.96); border:1px solid rgba(255,255,255,.16);
  box-shadow:0 16px 40px rgba(0,0,0,.5); min-width:214px; }
#menuPanel.open{ display:flex; }
.menuItem{ display:flex; align-items:center; gap:9px; padding:11px 14px; border-radius:10px;
  font-size:14px; font-weight:700; color:var(--text); background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12); cursor:pointer; white-space:nowrap; text-align:left; }
.menuItem.hot{ background:#5cff9d; color:#06210f; border-color:#5cff9d; }

/* ===== hand-only preview panel (skeleton on a dark panel, no webcam video) ===== */
#handPanel{ position:fixed; left:18px; top:74px; width:212px; z-index:40; padding:10px;
  background:var(--panel); border:1px solid var(--line); border-radius:18px;
  box-shadow:0 12px 30px rgba(0,0,0,.45); backdrop-filter:blur(12px); }
#handPanel .hlabel{ font-size:10.5px; letter-spacing:.14em; text-transform:uppercase; color:var(--muted); text-align:center; margin-bottom:7px; }
#handPanel .hframe{ position:relative; width:192px; height:150px; border-radius:12px; overflow:hidden;
  background:radial-gradient(circle at 50% 42%, rgba(40,66,120,.35), rgba(6,10,22,.92));
  border:1px solid rgba(120,180,255,.22); }
#handPanel .hframe canvas{ position:absolute; inset:0; width:100%; height:100%; transform:scaleX(-1); }
#handPanel .hstate{ margin-top:8px; display:flex; align-items:center; justify-content:center; gap:8px; font-size:12.5px; font-weight:600; color:var(--muted); }
#handPanel .hstate .dot{ width:9px; height:9px; border-radius:50%; background:#6b7690; }
#handPanel.on .hstate{ color:#bff0d2; } #handPanel.on .hstate .dot{ background:#5cff9d; box-shadow:0 0 9px #5cff9d; }

/* ===== on-planet feedback (Phase 1) ===== */
#planetLabel{ position:fixed; z-index:36; transform:translate(-50%,-120%); padding:6px 14px; border-radius:999px;
  font-weight:800; font-size:15px; color:#fff; white-space:nowrap; opacity:0; transition:opacity .12s; pointer-events:none;
  background:color-mix(in srgb, var(--accent) 32%, rgba(6,11,26,.9)); border:1px solid color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow:0 4px 16px rgba(0,0,0,.55); }
#planetGlow{ position:fixed; z-index:3; border-radius:50%; transform:translate(-50%,-50%); opacity:0; transition:opacity .15s; pointer-events:none;
  box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 75%, transparent), 0 0 46px 6px color-mix(in srgb, var(--accent) 55%, transparent); }

/* ===== detail-view "More facts" (key facts first) ===== */
#planetCard #pcFun, #planetCard #pcStructHead, #planetCard #structure{ display:none; }
#planetCard.more #pcFun, #planetCard.more #pcStructHead, #planetCard.more #structure{ display:block; }

/* webcam kept off-screen (real size so it decodes promptly) — used only for
   tracking; we show the hand skeleton on the panel instead of the video */
#cam { position: fixed; left: -10000px; top: 0; width: 320px; height: 240px; opacity: 0; pointer-events: none; }

#threeCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;   /* phones: the visible height, without the browser bars */
  pointer-events: auto;
  z-index: 2;
}

#pointer {
  position: fixed;
  width: 36px;
  height: 36px;
  margin-left: -18px;
  margin-top: -18px;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255,255,255,.8), 0 0 25px rgba(80,200,255,.5);
  opacity: 0;
  pointer-events: none;
  z-index: 100;   /* always on top so it never hides behind the card/buttons */
  transition: width .15s ease, height .15s ease, margin .15s ease, opacity .12s ease;
}
#pointer.active { width: 56px; height: 56px; margin-left: -28px; margin-top: -28px; }

/* dwell ring: fills up while you hold still (pick / put-back progress) */
/* corner controls for the whole solar system */
#corner {
  position: fixed; left: 18px; bottom: 92px; z-index: 30;   /* lifted off the bottom edge */
  padding: 12px 16px 14px; border-radius: 18px;
  background: rgba(6,11,26,.72); backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  color: #eaf2ff; user-select: none;
}
#corner .ctitle { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .55; margin-bottom: 9px; text-align: center; }
#corner .crow { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 12px; }
#corner .crow .clabel { font-size: 12px; opacity: .7; min-width: 40px; text-align: center; }
#corner .cpad {
  display: grid; width: 150px; height: 150px; margin: 0 auto;
  grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr;
  grid-template-areas: ".  up  ." "left mid right" ".  down  .";
  align-items: center; justify-items: center;
}
#corner .cpadlabel { grid-area: mid; font-size: 11px; opacity: .6; }
.cbtn {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #eaf2ff; cursor: pointer;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  transition: background .12s ease, transform .08s ease;
}
.cbtn:hover { background: rgba(90,160,255,.28); }
.cbtn.hot { background: #5cff9d; color: #06210f; transform: scale(.94); }

/* hand-draggable zoom slider: point along the track = zoom level */
/* zoom = horizontal row: label beside the track */
.zoomSlider { display:flex; flex-direction:row; align-items:center; justify-content:center; gap:10px; padding:4px 4px 8px; user-select:none; }
.zoomSlider .zsLabel { font-size:11px; letter-spacing:.08em; text-transform:uppercase; opacity:.6; white-space:nowrap; }
.zoomSlider .zsTrack {
  position:relative; width:150px; height:10px; border-radius:999px;
  background:rgba(255,255,255,.16); cursor:pointer;
}
/* vertical zoom slider (used by the corner and the planet panel) */
.zoomSlider.vert { flex-direction:column; align-items:center; gap:8px; }
.zoomSlider.vert .zsTrack { width:10px; height:110px; }
.zoomSlider.vert .zsFill { top:auto; bottom:0; left:0; width:100%; height:35%; }
.zoomSlider.vert .zsKnob { left:50%; }
#corner #sysZoom { border-bottom:1px solid var(--line); margin-bottom:8px; padding-bottom:12px; }
#corner .cpad { margin-top:2px; }
.zoomSlider .zsFill { position:absolute; left:0; top:0; height:100%; width:35%; border-radius:999px;
  background:linear-gradient(90deg,#4aa3ff,#8ad0ff); pointer-events:none; }
.zoomSlider .zsKnob { position:absolute; top:50%; left:35%; width:28px; height:28px;
  transform:translate(-50%,-50%); border-radius:50%; background:#eaf2ff; pointer-events:none;
  box-shadow:0 2px 8px rgba(0,0,0,.5), 0 0 0 3px rgba(90,160,255,.55); }
.zoomSlider.hot .zsKnob { background:#5cff9d; box-shadow:0 0 0 5px rgba(92,255,157,.5); }

#dwell {
  position: fixed; width: 84px; height: 84px; margin-left: -42px; margin-top: -42px;
  border-radius: 50%; opacity: 0; pointer-events: none; z-index: 99;
  transition: opacity .1s ease;
  background: conic-gradient(#5cff9d calc(var(--f,0) * 360deg), rgba(255,255,255,.14) 0);
  -webkit-mask: radial-gradient(circle 32px, transparent 96%, #000 100%);
          mask: radial-gradient(circle 32px, transparent 96%, #000 100%);
}

/* big friendly "put back" target — hover it and hold to return the planet */
/* control bar for the open planet */
/* planet controls: a bottom-left panel (like the Phase-1 corner, lifted up) */
#planetCtrl {
  position: fixed; left: 18px; bottom: 92px; z-index: 25;
  display: none; flex-direction: column; align-items: center; gap: 7px;
  padding: 12px 16px 14px; border-radius: 18px;
  background: rgba(6,11,26,.72); backdrop-filter: blur(14px);
  border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.45);
  color: var(--text); user-select: none;
}
#planetCtrl .ctitle { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .55; text-align: center; }
#planetCtrl #planetZoom { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 2px; }
#planetCtrl .prow { display: flex; align-items: center; justify-content: flex-end; gap: 6px; width: 100%; }
#planetCtrl .prow .pcgl { flex: 1; text-align: left; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; opacity: .6; color: #cfe0ff; }
.pcbtn {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #eaf2ff; cursor: pointer;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.18);
  transition: background .12s ease, transform .08s ease;
}
.pcbtn:hover { background: rgba(90,160,255,.28); }
.pcbtn.hot { background: #5cff9d; color: #06210f; transform: scale(.93); }
/* Put Planet Back — its own button at the bottom-right corner */
#backBtn {
  /* centred in the free space between the left controls (~200px) and the info card
     (right 22px + 340px), so a tall card (e.g. Hindi) can never cover it */
  position: fixed; left: calc(50vw - 81px); transform: translateX(-50%); bottom: 92px; z-index: 26; display: none;
  white-space: nowrap;
  align-items: center; justify-content: center;
  height: 62px; padding: 0 30px; border-radius: 999px;
  font-size: 20px; font-weight: 800; letter-spacing: .3px; color: var(--text); cursor: pointer;
  background: rgba(40,52,86,.95); border: 2px solid rgba(120,180,255,.75);
  box-shadow: 0 6px 20px rgba(80,140,255,.35);
}
#backBtn.hot { background: #5cff9d; color: #06210f; }
/* More facts + Listen buttons — inside the information card */
#pcBtnRow { display: flex; gap: 8px; margin: 2px 0 12px; flex-wrap: wrap; pointer-events: auto; }
#moreBtn, #playBtn, #pauseBtn, #stopBtn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 700; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
}
#pauseBtn, #stopBtn { padding: 8px 12px; }
#moreBtn.hot, #playBtn.hot, #pauseBtn.hot, #stopBtn.hot { background: #5cff9d; color: #06210f; border-color: #5cff9d; }
#playBtn.speaking { background: #5cff9d; color: #06210f; border-color: #5cff9d; }
/* live subtitles for the spoken tour */
#subtitle {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(6px);
  max-width: min(640px, 68vw); z-index: 36; pointer-events: none; text-align: center;
  padding: 11px 20px; border-radius: 14px;
  font-size: 16.5px; font-weight: 600; line-height: 1.45; color: #fff;
  background: rgba(6, 11, 26, .82); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  opacity: 0; transition: opacity .18s ease, transform .18s ease;
}
#subtitle.show { opacity: 1; transform: translateX(-50%) translateY(0); }


#planetCard {
  position: fixed;
  top: 72px; right: 22px;
  width: 340px;
  max-height: calc(100vh - 96px);
  overflow: hidden;
  padding: 20px 20px 22px;
  border-radius: 22px;
  /* --accent set per-planet from JS */
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--accent,#4aa3ff) 26%, transparent) 0%, transparent 60%),
    rgba(6,11,26,.9);
  backdrop-filter: blur(20px);
  border: 1px solid color-mix(in srgb, var(--accent,#4aa3ff) 45%, rgba(255,255,255,.18));
  box-shadow: 0 18px 50px rgba(0,0,0,.55), inset 0 0 0 1px rgba(255,255,255,.04);
  color: white;
  opacity: 0;
  transform: translateY(-14px) scale(.98);
  transition: opacity .3s ease, transform .3s ease;
  z-index: 30;
  pointer-events: none;
}
#planetCard.show { opacity: 1; transform: translateY(0) scale(1); }
#pcHead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#pcNav { display: flex; gap: 6px; pointer-events: auto; }
.pcnavbtn {
  width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1; color: #eaf2ff; cursor: pointer;
  background: color-mix(in srgb, var(--accent,#4aa3ff) 16%, rgba(255,255,255,.06));
  border: 1px solid color-mix(in srgb, var(--accent,#4aa3ff) 40%, rgba(255,255,255,.16));
  transition: background .12s ease, transform .08s ease;
}
.pcnavbtn:hover { background: color-mix(in srgb, var(--accent,#4aa3ff) 30%, transparent); }
.pcnavbtn.hot { background: #5cff9d; color: #06210f; transform: scale(.93); }
#pcBadge {
  display: inline-block; margin-bottom: 8px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent,#9fc4ff);
  background: color-mix(in srgb, var(--accent,#4aa3ff) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent,#4aa3ff) 55%, transparent);
}
#planetCard h2 {
  margin: 0 0 12px; font-size: 34px; font-weight: 800; letter-spacing: -.5px;
  color: #fff; text-shadow: 0 0 22px color-mix(in srgb, var(--accent,#4aa3ff) 60%, transparent);
}
#pcFacts { margin: 0 0 14px; }
#pcFacts .pcFact {
  position: relative; padding-left: 20px; margin: 8px 0;
  font-size: 14.5px; line-height: 1.45; color: #e4ecff;
}
#pcFacts .pcFact::before {
  content: ""; position: absolute; left: 2px; top: 7px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent,#4aa3ff);
  box-shadow: 0 0 8px var(--accent,#4aa3ff);
}
#pcStats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px;
}
#pcStats .chip {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: 12px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09);
}
#pcStats .chip .ic { font-size: 17px; line-height: 1; filter: saturate(1.2); }
#pcStats .chip .tx { display: flex; flex-direction: column; min-width: 0; }
#pcStats .chip .k { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; opacity: .55; }
#pcStats .chip .v { font-size: 14px; font-weight: 700; color: #fff; white-space: nowrap; }
#pcFun {
  margin: 0 0 14px; padding: 12px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--accent,#4aa3ff) 14%, rgba(255,255,255,.03));
  border: 1px solid color-mix(in srgb, var(--accent,#4aa3ff) 30%, transparent);
}
#pcFun .pcFunHead { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent,#9fc4ff); margin-bottom: 5px; }
#pcFun p { margin: 0; font-size: 13.5px; line-height: 1.5; color: #eaf1ff; }
#pcStructHead { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .5; margin-bottom: 4px; }
#planetCard #structure { margin: 0; font-size: 13px; line-height: 1.5; color: #b9c8ea; }
@media (max-height: 680px){
  #pcFun{ display:none; }
  #pcStats{ gap:6px; }
  #planetCard h2{ font-size:28px; margin-bottom:9px; }
  #pcStats .chip{ padding:7px 10px; }
}

#gestureHelp {
  position: fixed;
  right: 18px; bottom: 92px;      /* aligned with the bottom-left panel's baseline */
  max-width: 360px;
  padding: 10px 16px;
  border-radius: 16px;
  background: rgba(4,8,18,.68);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.12);
  color: white; font-size: 12px; text-align: center; line-height: 1.5;
  z-index: 30;
}

#modeToast {
  position: fixed;
  left: 50%; top: 182px;              /* below the camera preview */
  transform: translateX(-50%) translateY(-10px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(5,10,25,.7);
  border: 1px solid rgba(255,255,255,.14);
  color: white;
  opacity: 0;
  transition: .2s ease;
  z-index: 40;
  pointer-events: none;
  font-size: 13px;
}
#modeToast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#loading {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  color: #cfe0ff;
  font-size: 15px;
  letter-spacing: .05em;
  z-index: 45;
  text-align: center;
}
#loading .bar {
  margin-top: 10px;
  width: 220px; height: 6px;
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  overflow: hidden;
}
#loading .bar > i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg,#4aa3ff,#8ad0ff);
  transition: width .2s ease;
}

#camError {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
  background: rgba(2,4,12,.82); backdrop-filter: blur(8px);
}
#camError.show { display: flex; }
#camError .camError-box {
  max-width: 380px; margin: 0 20px; padding: 26px 28px;
  color: #fff; text-align: center;
  background: rgba(14,20,40,.9);
  border: 1px solid rgba(255,120,120,.35);
  border-radius: 18px;
}
#camError h3 { margin: 0 0 10px; color: #ff9a9a; font-size: 19px; }
#camError p { margin: 6px 0; font-size: 14px; line-height: 1.55; }
#camError .camError-hint { opacity: .7; font-size: 12.5px; }

@media (max-width: 760px) and (orientation: landscape) {
  #planetCard { width: 245px; }
  #backBtn { left: calc(50vw - 33px); }
}
#threeCanvas { cursor: grab; touch-action: none; }
#planetCard:not(.show) * { pointer-events: none !important; }   /* hidden card must not catch clicks */
#camErrorClose { margin-top: 14px; padding: 10px 18px; border-radius: 999px; border: 0;
  background: #fff; color: #10232f; font: 600 14px Arial, sans-serif; cursor: pointer; }

/* ===== link back to the website (bottom-left) ===== */
.homeLink{ position:fixed; z-index:60;
  left:calc(16px + env(safe-area-inset-left)); bottom:calc(16px + env(safe-area-inset-bottom));
  padding:12px 18px; border-radius:30px; background:#fff; color:#10232f; border:1px solid #a6bfc5;
  font:600 14px Arial, sans-serif; text-decoration:none; cursor:pointer; }
.homeLink:focus-visible, button:focus-visible{ outline:3px solid var(--accent); outline-offset:2px; }

/* ================= PHONES AND TABLETS =================
   Desktop and tablet-landscape keep the layout above. The three layouts below match the
   INSPECT_LAYOUTS queries in core.js, which frame the open item in the space each one leaves free.
   --badge-space keeps the bottom-right corner clear for Netlify's free-plan badge;
   set it to 0px if the site moves to a host without one. */
:root{ --badge-space:56px; }
html, body{ -webkit-tap-highlight-color:transparent; }

/* touch screens: finger-sized targets, no mouse cursor */
@media (pointer: coarse){
  .cbtn, .pcbtn{ width:46px; height:46px; }
  .pcnavbtn{ width:44px; height:44px; }
  #moreBtn, #playBtn, #pauseBtn, #stopBtn{ min-height:40px; }
  .zoomSlider .zsKnob{ width:32px; height:32px; }
  #threeCanvas{ cursor:auto; }
}

/* shared by both phone layouts: zoom becomes a slim pill; turning is by drag, zooming also by pinch */
@media (max-width: 600px) and (orientation: portrait), (max-height: 500px) and (orientation: landscape){
  #topbar .brand{ font-size:0; gap:0; }                         /* logo only */
  #cornerBar{ z-index:55; }                                      /* Menu above the top bar's fade */
  #menuToggle{ padding:7px 12px; font-size:12.5px; }
  .langPill{ padding:7px 12px; font-size:13px; }
  #corner, #planetCtrl{ padding:14px 9px; border-radius:999px; }
  #corner .ctitle, #corner .cpad, #planetCtrl .ctitle, #planetCtrl .prow, .zoomSlider .zsLabel{ display:none; }
  #corner #sysZoom, #planetCtrl #planetZoom{ border:0; margin:0; padding:0; }
  #backBtn{ transform:none; bottom:auto; right:auto; height:40px; padding:0 16px;
    font-size:14px; font-weight:700; border-width:1.5px; box-shadow:0 4px 14px rgba(0,0,0,.4); }
  #planetCard.show{ pointer-events:auto; }                       /* the card scrolls on small screens */
  #planetCard{ overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
  #pcFacts .pcFact{ font-size:14px; }
  #pcStats{ grid-template-columns:repeat(2, minmax(0,1fr)); }
  #pcStats .chip .v{ white-space:normal; overflow-wrap:anywhere; }   /* long values wrap instead of overflowing */
  .homeLink{ padding:9px 14px; font-size:13px; }
  body.inspecting .homeLink{ display:none; }                     /* the card needs the bottom edge; Back and Menu remain */
  #subtitle{ font-size:14.5px; padding:9px 14px; }
}

/* ---- phone, portrait ---- */
@media (max-width: 600px) and (orientation: portrait){
  #topbar{ height:calc(100px + env(safe-area-inset-top)); align-items:flex-start;
    padding-left:calc(12px + env(safe-area-inset-left)); padding-right:calc(12px + env(safe-area-inset-right));
    background:linear-gradient(180deg, rgba(5,12,16,.92) 0%, rgba(5,12,16,.6) 62%, transparent 100%); }
  #topbar .brand, #topbar .right{ height:56px; }
  #cornerBar{ top:calc(11px + env(safe-area-inset-top)); left:calc(56px + env(safe-area-inset-left)); }
  #topbar .center{ top:calc(54px + env(safe-area-inset-top)); left:12px; right:12px; transform:none; }
  #topbar .center .ttl{ font-size:10px; letter-spacing:.2em; }
  #topbar .center .sub{ font-size:16px; }
  #handPill{ display:none; }                                      /* the hand preview's green edge shows it instead */

  #handPanel{ display:none; left:auto; right:calc(12px + env(safe-area-inset-right)); top:calc(108px + env(safe-area-inset-top));
    width:auto; padding:5px; border-radius:14px; }
  body.cam-on #handPanel{ display:block; }                       /* only while the camera runs */
  #handPanel .hlabel, #handPanel .hstate{ display:none; }
  #handPanel .hframe{ width:84px; height:63px; border-radius:10px; }
  #handPanel.on{ border-color:#5cff9d; box-shadow:0 0 0 1px #5cff9d, 0 8px 24px rgba(0,0,0,.45); }

  #corner{ left:auto; right:calc(12px + env(safe-area-inset-right)); bottom:auto; top:50%; transform:translateY(-50%); }
  #planetCtrl{ left:auto; right:calc(12px + env(safe-area-inset-right)); bottom:auto; top:calc(190px + env(safe-area-inset-top)); }
  .zoomSlider.vert .zsTrack{ height:140px; }
  #planetCtrl .zoomSlider.vert .zsTrack{ height:112px; }

  #gestureHelp{ left:calc(12px + env(safe-area-inset-left)); right:calc(12px + env(safe-area-inset-right));
    bottom:calc(70px + env(safe-area-inset-bottom)); max-width:none; padding:9px 14px; font-size:12.5px; border-radius:14px; }

  /* open item: card becomes a bottom sheet, the item is framed above it */
  #backBtn{ top:calc(108px + env(safe-area-inset-top)); left:calc(12px + env(safe-area-inset-left)); }
  #planetCard{ top:auto; left:0; right:0; bottom:0; width:auto; max-height:46dvh;
    border-radius:22px 22px 0 0; border-bottom:0;
    padding:12px calc(18px + env(safe-area-inset-right)) calc(20px + var(--badge-space) + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left));
    transform:translateY(28px); }
  #planetCard.show{ transform:none; }
  #planetCard::before{ content:""; display:block; width:40px; height:4px; border-radius:2px;
    margin:0 auto 12px; background:rgba(255,255,255,.28); }   /* sheet handle */
  #planetCard h2{ font-size:26px; margin-bottom:8px; }
  #subtitle{ bottom:calc(46dvh + 12px); max-width:calc(100% - 24px); }
  #modeToast{ top:calc(196px + env(safe-area-inset-top)); }
}

/* ---- phone, landscape ---- */
@media (max-height: 500px) and (orientation: landscape){
  #topbar{ height:calc(50px + env(safe-area-inset-top));
    padding-left:calc(12px + env(safe-area-inset-left)); padding-right:calc(12px + env(safe-area-inset-right)); }
  #cornerBar{ top:calc(8px + env(safe-area-inset-top)); left:calc(56px + env(safe-area-inset-left)); }
  #topbar .center .ttl{ display:none; }
  #topbar .center .sub{ font-size:15px; }
  #handPill{ padding:7px 11px; font-size:12px; }
  #handPanel{ display:none; }                                    /* too little height; the hand pill shows tracking */

  #corner{ left:auto; right:calc(12px + env(safe-area-inset-right)); bottom:auto; top:50%; transform:translateY(-50%); }
  #planetCtrl{ left:calc(12px + env(safe-area-inset-left)); bottom:auto; top:50%; transform:translateY(-50%); }
  .zoomSlider.vert .zsTrack{ height:110px; }

  #gestureHelp{ top:calc(54px + env(safe-area-inset-top)); bottom:auto; left:50%; right:auto; transform:translateX(-50%);
    width:max-content; max-width:min(560px, calc(100% - 200px)); padding:6px 14px; font-size:12px; }

  /* open item: card becomes a side panel, the item is framed to its left */
  #backBtn{ top:calc(56px + env(safe-area-inset-top)); left:calc(12px + env(safe-area-inset-left)); }
  #planetCard{ top:calc(54px + env(safe-area-inset-top)); right:calc(8px + env(safe-area-inset-right)); bottom:8px;
    width:min(340px, 44vw); max-height:none; padding:14px 16px calc(14px + var(--badge-space)); }
  #planetCard h2{ font-size:24px; margin-bottom:8px; }
  #subtitle{ left:calc((100% - min(340px, 44vw)) / 2); bottom:calc(12px + env(safe-area-inset-bottom));
    max-width:calc(100% - min(340px, 44vw) - 48px); }
  #modeToast{ top:calc(58px + env(safe-area-inset-top)); }
}

/* ---- tablet, portrait ---- */
@media (min-width: 601px) and (max-width: 1024px) and (orientation: portrait){
  #handPanel{ width:176px; }
  #handPanel .hframe{ width:156px; height:117px; }
  /* open item: a floating bottom sheet; Back and the item controls move to the top-right */
  #backBtn{ left:auto; right:calc(18px + env(safe-area-inset-right)); top:calc(74px + env(safe-area-inset-top));
    bottom:auto; transform:none; height:48px; padding:0 22px; font-size:16px; }
  #planetCtrl{ left:auto; right:calc(18px + env(safe-area-inset-right)); top:calc(136px + env(safe-area-inset-top)); bottom:auto; }
  #planetCard{ top:auto; right:auto; left:50%; bottom:calc(16px + var(--badge-space) + env(safe-area-inset-bottom));
    width:min(620px, calc(100% - 40px)); max-height:36dvh; overflow-y:auto; overscroll-behavior:contain;
    transform:translate(-50%, 16px); }
  #planetCard.show{ transform:translate(-50%, 0); pointer-events:auto; }
  #subtitle{ bottom:calc(36dvh + var(--badge-space) + 30px); }
}
