*{box-sizing:border-box}html{color-scheme:dark}body{margin:0;background:#0b0e18;color:#f3f3fa;font-family:"Segoe UI","Microsoft YaHei",system-ui,sans-serif;font-size:16px}button,select,input{font:inherit}button,select{cursor:pointer;color:inherit}button{border:0;background:none}button:focus-visible,select:focus-visible,input:focus-visible{outline:2px solid #d1b3ff;outline-offset:2px}button:hover{filter:brightness(1.22)}button:disabled{opacity:.48;cursor:default}i,[data-icon]{display:inline-flex;align-items:center;justify-content:center;font-style:normal}svg{width:1.15em;height:1.15em;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}header{background:#10131f;border-bottom:1px solid #282c3a;display:flex;align-items:center;justify-content:space-between;gap:20px;padding:0 clamp(18px,3.5vw,70px);height:74px}.brand{display:flex;align-items:center;gap:10px;white-space:nowrap}.brand strong{font-size:21px;letter-spacing:1px}.brand small{font-size:13px;color:#afb0c2;border-left:1px solid #383949;padding-left:13px;margin-left:3px}.brandmark{color:#c4a0ff;font-size:34px;transform:rotate(-8deg)}nav,.seg{display:flex;gap:4px}nav button,.quiet,.seg button{display:flex;align-items:center;justify-content:center;gap:8px;font-size:14px;color:#adafc1;border-radius:8px;padding:10px 16px;font-weight:600}nav button.active{color:#d5c0ff;background:#2a233d}.quiet{border:1px solid #343748;padding:7px 12px}main{max-width:1800px;margin:auto;padding:28px clamp(18px,3.5vw,70px) 0}.heading h1{font-size:clamp(29px,2.5vw,42px);line-height:1.22;margin:0;font-weight:750;letter-spacing:1px}.heading p{color:#a5a8bb;margin:9px 0 23px;font-size:15px}.workspace{display:grid;grid-template-columns:minmax(0,1fr) clamp(260px,22vw,340px);gap:17px}.viewer,aside,.cards button{border:1px solid #2d3041;border-radius:14px;background:#141824;overflow:hidden}.viewer{display:flex;flex-direction:column}.maphead{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:12px 18px;border-bottom:1px solid #2b2e40;min-height:58px}.paneltitle,h2{display:flex;align-items:center;gap:9px}.paneltitle i,h2 i{color:#b6a1e6}.paneltitle{font-size:16px}.seg{background:#0c101c;border:1px solid #282c3c;padding:3px;border-radius:8px}.seg button{font-size:13px;padding:5px 11px;border-radius:5px}.seg button.on{background:#353044;color:#e6d9ff}#space{position:relative;overflow:hidden;isolation:isolate;min-height:325px;height:clamp(340px,41vh,540px);flex:1;background:radial-gradient(ellipse at 48% 75%,#261c4270,transparent 65%),radial-gradient(ellipse at 55% 47%,#24274980,transparent 78%),#090d1a}canvas,#labels{position:absolute;width:100%;height:100%;inset:0}canvas{touch-action:none}#labels{pointer-events:none;overflow:hidden}.tag{position:absolute;pointer-events:auto;white-space:nowrap;color:#e7e6f0;font-size:14px;text-shadow:0 1px 5px black;padding:3px 6px;border:1px solid transparent;border-radius:5px;background:#0c10224d}.tag.selected{background:#2d2546;border-color:#9277c5;color:#e9daff}.chartlabel,#scale{position:absolute;pointer-events:none;left:18px;color:#a4a4b9;font-size:12px}.chartlabel{top:16px;display:flex;gap:8px;align-items:center}.dot{width:6px;height:6px;border-radius:50%;background:#b296eb}#scale{bottom:15px}#viewtools{position:absolute;right:14px;bottom:12px;display:flex;gap:5px}#viewtools button{background:#151a29e8;border:1px solid #373b4d;border-radius:6px;width:29px;height:29px;display:grid;place-content:center}#transport{border-top:1px solid #2d3041;padding:13px 17px;display:flex;gap:13px;align-items:center;flex-wrap:wrap;min-height:59px;color:#bdbece;font-size:13px}#transport button,.outline,.primary{border:1px solid #383d51;border-radius:7px;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:7px 10px;background:#1c2030}#transport select{background:#202436;border:1px solid #363a4e;border-radius:5px;padding:4px 6px;color:#e2e1ed;font-size:13px}.rate{display:flex;gap:8px;align-items:center;margin-left:auto}.rate input{width:clamp(45px,7vw,120px);accent-color:#bc9be9}.rate output{min-width:44px;color:#d7c5f5;font-family:monospace}aside{display:flex;flex-direction:column}aside>.paneltitle{padding:17px 19px 0}#profile{padding:0 19px 18px;display:flex;flex-direction:column;flex:1}.portrait{height:clamp(115px,16vh,170px);position:relative;display:grid;place-items:center;background:radial-gradient(ellipse at center,#3a375359,transparent 67%)}.portrait:before,.portrait:after{content:"";position:absolute;width:65%;height:28%;border:1px solid #8d8ca028;transform:rotate(-16deg);border-radius:50%;pointer-events:none}.portrait:after{width:84%;height:43%;border-style:dashed}.portrait img{position:relative;z-index:1;height:83%;max-width:90%;object-fit:contain}.identity{display:flex;align-items:baseline;gap:9px}.identity h2{font-size:27px;margin:0}.en{font-family:Consolas,monospace;font-size:12px;color:#9e9bb2;letter-spacing:1.5px}.desc{font-size:14px;color:#bec0cf;line-height:1.65;margin:8px 0 12px}.stats{border-top:1px solid #303342;padding:8px 0;display:grid;gap:5px}.stats div{display:flex;justify-content:space-between;gap:8px;font-size:13px;line-height:1.6}.stats span{color:#a5a8bb}.actions{display:flex;gap:7px;margin-top:auto;padding-top:9px}.actions button{flex:1;font-size:14px}.primary,#transport .primary{background:#c3a4f4;color:#221a33;border:1px solid #c3a4f4;font-weight:650}.lessons{margin-top:21px}h2{margin:0 0 13px;font-size:18px}.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.cards button{display:flex;align-items:center;padding:16px;text-align:left;gap:13px}.cards b,.cards small{display:block}.cards b{font-size:15px}.cards small{color:#9ea1b4;font-size:13px;margin-top:4px}.cards em{font:25px sans-serif;color:#787b90;margin-left:auto}.lIcon{width:41px;height:41px;border-radius:12px;font-size:22px;flex:none}.mint{background:#1c3234;color:#8fd4bf}.peach{background:#352b29;color:#e7b38e}.lilac{background:#30273e;color:#c6a5f0}footer{display:flex;justify-content:space-between;margin:21px 0;padding:14px 0;border-top:1px solid #242837;color:#878b9d;font-size:12px}footer span{display:flex;align-items:center;gap:7px}footer button{font-size:12px;color:#a3a4b4}dialog{background:#181c2b;color:#f3efff;border:1px solid #45405b;border-radius:16px;padding:30px;max-width:min(470px,90vw);line-height:1.75}dialog::backdrop{background:#060812c9}dialog h2{font-size:23px;padding-right:26px}#close{position:absolute;right:12px;top:8px;font-size:25px}dialog a{color:#dac4ff}.note{background:#211e32;border-left:2px solid #ac8bdb;padding:10px 12px;line-height:1.6;font-size:14px;margin:8px 0}.note b{color:#d4b8ff}.sidepic{font-size:64px;height:130px;color:#c8acf9;display:grid;place-items:center}.detail #space{min-height:420px}@media(max-width:1020px){.brand small{display:none}header{gap:8px}nav button{padding:10px}.maphead{padding:10px}.seg button{padding:5px 7px}.workspace{gap:10px;grid-template-columns:minmax(0,1fr) 245px}.cards button{padding:11px;gap:8px}}@media(max-width:750px){header{flex-wrap:wrap;height:auto;padding:12px 16px 7px}.brand{flex:1}nav{order:3;width:100%;justify-content:center}.workspace{grid-template-columns:1fr}.heading p{margin-bottom:16px}main{padding-top:20px}#space{height:340px;flex:none}.cards{grid-template-columns:1fr}.maphead{flex-wrap:wrap}.rate{margin-left:0}aside .portrait{float:left;height:118px;width:118px}#profile{display:block}.actions{clear:both}.identity{padding-top:10px}.tag{font-size:12px}.stats{clear:both}.cards button{padding:13px}.lessons{margin-top:17px}}

/* Let the observing area absorb the height left by the classroom controls. */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
header { flex-shrink: 0; }
main { width: 100%; flex: 1; display: flex; flex-direction: column; }
.workspace { flex: 1; }
@media (min-width: 751px) {
  #space { height: auto; min-height: clamp(225px, 32dvh, 340px); }
}
@media (max-width: 750px) {
  #space { height: clamp(270px, 51dvh, 580px); }
}
#transport #orbit { gap: 7px; padding: 6px 2px; background: transparent; border-color: transparent; }
#orbit .full-label, #orbit .tail-label { color: #9699ae; }
#orbit[aria-checked="false"] .full-label, #orbit[aria-checked="true"] .tail-label { color: #ece1ff; }
.switch-track { width: 30px; height: 17px; border-radius: 12px; background: #45465b; position: relative; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 11px; height: 11px; border-radius: 50%; background: #ebe8f5; transition: transform .15s ease; }
#orbit[aria-checked="true"] .switch-track { background: #8b69bb; }
#orbit[aria-checked="true"] .switch-track::after { transform: translateX(13px); }
@media (prefers-reduced-motion: reduce) { .switch-track::after { transition: none; } }

#mapOptions { position: absolute; top: 11px; right: 12px; display: flex; gap: 5px; }
#mapOptions[hidden] { display: none; }
#mapOptions button { border: 1px solid #404258; background: #171b2be8; color: #d7cce7; border-radius: 6px; font-size: 13px; padding: 5px 9px; }
.tag { padding: 1px 4px; line-height: 1.35; }
.tag.selected { z-index: 1; }
.lessons > details > summary { display: flex; align-items: center; gap: 9px; padding: 10px 0; font-size: 18px; font-weight: 650; }
summary { cursor: pointer; }
.lessons > details > summary i { color: #b6a1e6; }
.lessons > details > summary::after { content: ''; width: 7px; height: 7px; border-bottom: 2px solid #b6a1e6; border-right: 2px solid #b6a1e6; transform: rotate(45deg); transition: transform .2s; margin-left: 4px; }
.lessons > details[open] > summary::after { transform: rotate(225deg); }
.lessons .cards { padding-top: 6px; }
dialog { width: min(500px,92vw); max-height: 85dvh; overflow-y: auto; }
.planet-answers { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; padding: 12px 0; }
.planet-answers figure { margin: 0; padding: 8px 2px; border-radius: 8px; background: #222738; text-align: center; }
.planet-answers img { width: 90%; height: 48px; object-fit: contain; display: block; margin: auto; }
.planet-answers figcaption { margin-top: 5px; font-size: 15px; }
.planet-answers small { display: block; color: #c1b0d7; font-size: 12px; }

/* Reserve a separate image row even when the viewport is short. */
#profile .portrait { flex: none; float: none; width: 100%; height: clamp(94px,16dvh,170px); overflow: hidden; margin-bottom: 6px; }
#profile .portrait img { position: absolute; inset: 7% 5%; width: 90%; height: 86%; max-width: 90%; object-fit: contain; }
#profile .identity { flex-wrap: wrap; }
#transport #highlight[aria-pressed="true"] { background: #3b2c46; border-color: #bea0cb; color: #ffe0be; }
#transport button[hidden], #mapOptions button[hidden] { display: none; }
.empty-profile { flex: 1; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #afb0c4; }
.empty-profile svg { width: 32px; height: 32px; color: #aa90d1; }
.empty-profile p { margin: 0; }
#nameStory { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 5px 8px; text-align: left; padding: 0; font: inherit; }
.story-image { width: 100%; height: 120px; object-fit: contain; }
/* Keep the native dialog in the top layer until the exit transition finishes. */
#dialog {
  opacity: 0;
  transform: translateY(9px) scale(.985);
  transition: opacity .18s ease, transform .2s ease, display .2s allow-discrete, overlay .2s allow-discrete;
}
#dialog[open] { opacity: 1; transform: translateY(0) scale(1); }
#dialog::backdrop {
  opacity: 0;
  transition: opacity .18s ease, display .2s allow-discrete, overlay .2s allow-discrete;
}
#dialog[open]::backdrop { opacity: 1; }
@starting-style {
  #dialog[open] { opacity: 0; transform: translateY(9px) scale(.985); }
  #dialog[open]::backdrop { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #dialog, #dialog::backdrop { transition: none; }
}
