/* Pai Digital Universe v5 — chrome for the one-viewport universe.
   There is no page: the universe IS the page. Everything below floats
   inside it (KengAI-style minimal chrome) and nothing scrolls.
   v4: grabbing cursor while a drag is live; the rest is v3's chrome.
   v5: every body is named, always — label states for filter-dimmed,
   hovered and selected bodies (the JS scales and places the pills).
   v6: CSS unchanged from v5 — the safe-area fix lives in the JS. */
*{box-sizing:border-box}
html,body{height:100%}
html{overflow:hidden}
body{
  position:fixed;inset:0;overflow:hidden;overscroll-behavior:none;
  margin:0;background:#04070d;color:#e8eefc;
  font:400 15px/1.45 system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  -webkit-user-select:none;user-select:none;
  -webkit-tap-highlight-color:transparent;
}
#u-stage{position:fixed;inset:0;z-index:0}
#u-stage canvas{display:block;cursor:grab}
#u-stage canvas:active{cursor:grabbing !important}
#u-labels{position:fixed;inset:0;z-index:3;pointer-events:none;overflow:hidden}
.u-label{
  position:absolute;top:0;left:0;display:none;white-space:nowrap;pointer-events:none;
  font:600 12px/1.2 system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;letter-spacing:.02em;
  color:#eef3ff;background:rgba(4,10,20,.55);border:1px solid rgba(255,255,255,.16);
  padding:3px 9px;border-radius:999px;text-shadow:0 1px 6px rgba(0,0,0,.8);
  will-change:transform;
}
.u-label-core{color:#ffe9a8;border-color:rgba(242,193,78,.65)}
.u-label-ship{color:#ffe9a8;border-color:rgba(242,193,78,.5)}
.u-label-star{font-size:11px;color:#c9d8f2;background:rgba(4,10,20,.42)}
/* v5 label states: a filter-dimmed body keeps its name (dimmed with
   it); the hovered and selected bodies' names step forward — the
   selected one in the house gold. */
.u-label-dim{opacity:.42}
.u-label-hov{border-color:rgba(255,255,255,.6);background:rgba(6,14,24,.8)}
.u-label-sel{border-color:rgba(242,193,78,.95);background:rgba(26,19,4,.9);color:#ffe9a8;
  box-shadow:0 0 0 1px rgba(242,193,78,.4),0 6px 18px rgba(0,0,0,.55)}

/* ---- top chrome ---- */
#u-top{
  position:fixed;top:0;left:0;right:0;z-index:10;pointer-events:none;
  display:flex;align-items:flex-start;gap:10px;
  padding:calc(10px + env(safe-area-inset-top)) 12px 0;
}
#u-top>*{pointer-events:auto}
.u-brand{flex:0 1 auto;min-width:0}
.u-brand h1{margin:0;font:700 17px/1.15 Georgia,'Times New Roman',serif;color:#f5edd8;letter-spacing:.01em}
.u-brand p{margin:2px 0 0;font-size:11.5px;color:#9db4d4;white-space:nowrap}
.u-search{position:relative;flex:0 1 230px;margin-left:auto}
.u-search input{
  width:100%;padding:9px 13px;border-radius:999px;border:1px solid rgba(233,210,159,.4);
  background:rgba(6,14,24,.82);color:#eef3ff;font:500 13.5px system-ui,sans-serif;outline:none;
}
.u-search input::placeholder{color:#7e93b5}
.u-search input:focus{border-color:rgba(242,193,78,.85)}
#u-search-list{
  position:absolute;top:calc(100% + 6px);left:0;right:0;display:none;flex-direction:column;
  background:rgba(6,14,24,.96);border:1px solid rgba(233,210,159,.35);border-radius:14px;overflow:hidden;z-index:20;
}
#u-search-list.show{display:flex}
#u-search-list button{
  padding:10px 13px;background:none;border:none;border-bottom:1px solid rgba(255,255,255,.06);
  color:#e8eefc;font:500 13.5px system-ui,sans-serif;text-align:left;cursor:pointer;
}
#u-search-list button:last-child{border-bottom:none}
.view-switch{
  flex:0 0 auto;display:flex;gap:2px;padding:3px;border-radius:999px;
  background:rgba(6,16,12,.88);border:1px solid rgba(233,210,159,.55);
  font:600 .8rem/1 system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
}
.view-switch a{padding:8px 13px;border-radius:999px;color:#C9D2C6;text-decoration:none;white-space:nowrap}
.view-switch a.on{background:linear-gradient(135deg,#E9D29F,#C9AA6D);color:#231a05}

/* ---- category chips ---- */
#u-chips{
  position:fixed;left:0;right:0;z-index:9;display:flex;gap:6px;
  top:calc(64px + env(safe-area-inset-top));
  padding:4px 12px;overflow-x:auto;scrollbar-width:none;pointer-events:none;
}
#u-chips::-webkit-scrollbar{display:none}
.u-chip{
  pointer-events:auto;flex:0 0 auto;padding:7px 13px;border-radius:999px;cursor:pointer;
  border:1px solid rgba(255,255,255,.18);background:rgba(6,14,24,.72);color:#c9d8f2;
  font:600 12.5px system-ui,sans-serif;
}
.u-chip.on{background:linear-gradient(135deg,#E9D29F,#C9AA6D);color:#231a05;border-color:transparent}

/* ---- bottom chrome ---- */
#u-controls{
  position:fixed;left:50%;transform:translateX(-50%);z-index:10;
  bottom:calc(14px + env(safe-area-inset-bottom));
  display:flex;gap:8px;transition:opacity .3s ease;
}
body:has(#u-panel.show) #u-controls{opacity:0;pointer-events:none}
.u-ctl{
  padding:9px 15px;border-radius:999px;cursor:pointer;white-space:nowrap;
  border:1px solid rgba(233,210,159,.45);background:rgba(6,14,24,.85);color:#e8eefc;
  font:600 13px system-ui,sans-serif;box-shadow:0 10px 30px rgba(0,0,0,.5);
}
#u-legend-wrap{position:fixed;left:12px;bottom:calc(14px + env(safe-area-inset-bottom));z-index:11}
#u-legend{
  display:none;position:absolute;left:0;bottom:calc(100% + 8px);width:230px;
  background:rgba(6,14,24,.95);border:1px solid rgba(255,255,255,.14);border-radius:14px;
  padding:11px 13px;font-size:12.5px;color:#c9d8f2;
}
#u-legend.show{display:block}
#u-legend b{color:#f5edd8}
#u-legend i{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:7px}
#u-lina{
  position:fixed;right:12px;bottom:calc(14px + env(safe-area-inset-bottom));z-index:11;
  display:flex;align-items:center;gap:9px;padding:6px 14px 6px 6px;border-radius:999px;cursor:pointer;
  background:rgba(6,14,24,.88);border:1px solid rgba(233,210,159,.55);color:#e8eefc;
  font:600 13px system-ui,sans-serif;box-shadow:0 10px 30px rgba(0,0,0,.5);
}
#u-lina img{width:38px;height:38px;border-radius:50%;object-fit:cover;border:1px solid rgba(233,210,159,.6)}
#u-lina small{display:block;font:500 10.5px system-ui,sans-serif;color:#3ddc84}

/* ---- info panel (bottom sheet) ---- */
#u-panel{
  position:fixed;left:50%;z-index:30;width:min(540px,calc(100vw - 20px));
  bottom:calc(10px + env(safe-area-inset-bottom));
  transform:translate(-50%,130%);transition:transform .45s cubic-bezier(.22,.9,.3,1);
  background:rgba(8,15,26,.96);border:1px solid rgba(233,210,159,.5);border-radius:20px;
  padding:16px 18px 15px;box-shadow:0 24px 70px rgba(0,0,0,.65);
  -webkit-user-select:text;user-select:text;
}
#u-panel.show{transform:translate(-50%,0)}
#u-panel-kind{font:700 10.5px system-ui,sans-serif;letter-spacing:.14em;color:#f2c14e;margin:0 26px 3px 0}
#u-panel-name{font:700 20px/1.2 Georgia,'Times New Roman',serif;color:#f5edd8;margin:0 26px 6px 0}
#u-panel-text{margin:0 0 13px;font-size:14px;color:#d5e0f2;max-height:30vh;overflow-y:auto}
#u-panel-close{
  position:absolute;top:10px;right:10px;width:34px;height:34px;border-radius:50%;cursor:pointer;
  border:1px solid rgba(255,255,255,.2);background:rgba(255,255,255,.06);color:#e8eefc;font-size:15px;line-height:1;
}
.u-panel-actions{display:flex;gap:9px;flex-wrap:wrap}
#u-panel-open{
  flex:1 1 auto;text-align:center;padding:12px 16px;border-radius:999px;text-decoration:none;
  background:linear-gradient(135deg,#E9D29F,#C9AA6D);color:#231a05;font:700 14.5px system-ui,sans-serif;
}
#u-panel-audio{
  flex:0 1 auto;padding:12px 16px;border-radius:999px;cursor:pointer;
  border:1px solid rgba(233,210,159,.55);background:rgba(255,255,255,.05);color:#f5edd8;
  font:600 13.5px system-ui,sans-serif;
}
.u-panel-hint{margin:9px 0 0;font-size:11.5px;color:#7e93b5;text-align:center}

/* ---- loading + fallback ---- */
#u-loading{
  position:fixed;inset:0;z-index:40;display:flex;flex-direction:column;gap:12px;
  align-items:center;justify-content:center;background:#04070d;
  transition:opacity .7s ease;font:600 14px system-ui,sans-serif;color:#c9d8f2;
}
#u-loading.hide{opacity:0;pointer-events:none}
#u-loading .u-spin{font-size:30px;color:#f2c14e;animation:u-pulse 1.6s ease-in-out infinite}
@keyframes u-pulse{0%,100%{transform:scale(1);opacity:.65}50%{transform:scale(1.25);opacity:1}}
#u-fallback{
  display:none;position:fixed;inset:0;z-index:50;overflow-y:auto;
  background:#04070d;padding:26px 18px 40px;-webkit-user-select:text;user-select:text;
}
#u-fallback h2{font:700 22px Georgia,serif;color:#f5edd8;margin:0 0 6px}
#u-fallback p{color:#9db4d4;margin:0 0 16px}
#u-fallback-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:9px}
#u-fallback-list a{
  padding:12px 13px;border-radius:13px;text-decoration:none;color:#e8eefc;
  background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.13);font:600 13.5px system-ui,sans-serif;
}
@media (max-width:640px){
  .u-brand p{display:none}
  .u-brand h1{font-size:15px}
  .u-search{flex-basis:132px}
  /* the bottom row belongs to Legend (left) + Lina (right); the flight
     controls ride one row up so nothing overlaps on a narrow phone */
  #u-controls{bottom:calc(74px + env(safe-area-inset-bottom))}
  #u-lina small{display:none}
  #u-chips{top:calc(56px + env(safe-area-inset-top))}
  #u-legend{width:min(230px,calc(100vw - 24px))}
}
@media (prefers-reduced-motion: reduce){
  #u-panel{transition:none}
  #u-loading .u-spin{animation:none}
}
