* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body { width:100%; height:100%; overflow:hidden; background:#000; font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif; color:#fff; user-select:none; -webkit-user-select:none; }
#app { position:relative; width:100vw; height:100vh; overflow:hidden; }

/* ============ 加载页 ============ */
#loading { position:absolute; inset:0; z-index:100; background:radial-gradient(ellipse at center,#0a0a2a 0%,#000 70%); display:flex; flex-direction:column; align-items:center; justify-content:center; transition:opacity .8s ease; }
#loading.hide { opacity:0; pointer-events:none; }
.loader-star { width:60px; height:60px; border-radius:50%; background:radial-gradient(circle,#fff 0%,#aaf 40%,transparent 70%); box-shadow:0 0 40px #6af,0 0 80px #4af; animation:pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100%{transform:scale(.8);opacity:.7} 50%{transform:scale(1.2);opacity:1} }
#loading p { margin-top:24px; font-size:14px; color:#8af; letter-spacing:2px; }

/* ============ 地球页 ============ */
#earth-view { position:absolute; inset:0; z-index:50; background:radial-gradient(ellipse at center,#020822 0%,#000 80%); display:none; flex-direction:column; }
#earth-view.show { display:flex; }
#earth-canvas { position:absolute; inset:0; width:100%; height:100%; }
#earth-info { position:absolute; top:calc(env(safe-area-inset-top) + 20px); left:20px; right:20px; text-align:center; z-index:2; pointer-events:none; }
#earth-info .title { font-size:13px; color:#6af; letter-spacing:6px; margin-bottom:8px; }
#earth-info .loc { font-size:18px; font-weight:600; color:#fff; text-shadow:0 0 12px #06f; }
#earth-info .coords { font-size:12px; color:#7af; margin-top:6px; font-family:monospace; }
#start-btn { position:absolute; bottom:calc(env(safe-area-inset-bottom) + 50px); left:50%; transform:translateX(-50%); z-index:3; padding:16px 42px; border:none; border-radius:40px; background:linear-gradient(135deg,#1a4fa0,#0a2a60); color:#fff; font-size:16px; font-weight:600; letter-spacing:3px; cursor:pointer; box-shadow:0 0 30px rgba(50,120,255,.6); transition:transform .2s; }
#start-btn:active { transform:translateX(-50%) scale(.95); }
#earth-hint { position:absolute; bottom:calc(env(safe-area-inset-bottom) + 16px); left:0; right:0; text-align:center; font-size:11px; color:#579; }

/* ============ 天空页 ============ */
#sky-view { position:absolute; inset:0; z-index:10; display:none; background:#000; }
#sky-view.show { display:block; }
#camera-video { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; z-index:1; }
#sky-canvas { position:absolute; inset:0; width:100%; height:100%; z-index:2; }

#constellation-info { position:absolute; top:calc(env(safe-area-inset-top) + 16px); left:50%; transform:translateX(-50%); z-index:5; text-align:center; pointer-events:none; opacity:0; transition:opacity .5s; max-width:90%; }
#constellation-info.show { opacity:1; }
#constellation-info .cn-name { font-size:28px; font-weight:700; letter-spacing:6px; text-shadow:0 0 20px #0af,0 2px 6px #000; }
#constellation-info .latin-name { font-size:13px; color:#7cf; letter-spacing:3px; margin-top:4px; text-shadow:0 0 8px #000; }
#constellation-info .sub { font-size:11px; color:#9bd; margin-top:6px; font-family:monospace; }

#horizon-warning { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); z-index:6; text-align:center; display:none; }
#horizon-warning.show { display:block; }
#horizon-warning .icon { font-size:64px; animation:bob 2s ease-in-out infinite; }
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-12px)} }
#horizon-warning .text { font-size:18px; color:#fff; margin-top:16px; letter-spacing:4px; text-shadow:0 0 16px #06f; }
#horizon-warning .sub { font-size:12px; color:#7af; margin-top:8px; }

#controls { position:absolute; bottom:calc(env(safe-area-inset-bottom) + 20px); left:20px; right:20px; z-index:6; display:flex; justify-content:space-between; align-items:flex-end; pointer-events:none; }
.ctrl-group { display:flex; gap:14px; pointer-events:auto; }
.ctrl-btn { width:58px; height:58px; border-radius:50%; border:1.5px solid rgba(120,180,255,.4); background:rgba(10,20,50,.55); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); color:#cdf; font-size:22px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:transform .15s,background .2s,border-color .2s; position:relative; }
.ctrl-btn:active { transform:scale(.9); }
.ctrl-btn:hover { background:rgba(30,60,120,.65); border-color:rgba(150,200,255,.7); }
.ctrl-btn .label { position:absolute; bottom:-18px; left:50%; transform:translateX(-50%); font-size:10px; color:#7af; white-space:nowrap; letter-spacing:1px; }
.ctrl-btn svg { width:24px; height:24px; fill:#cdf; }

#orient-indicator { position:absolute; top:calc(env(safe-area-inset-top) + 80px); left:50%; transform:translateX(-50%); z-index:5; font-size:11px; color:#6af; font-family:monospace; text-align:center; pointer-events:none; text-shadow:0 0 6px #000; }

#flash { position:absolute; inset:0; background:#fff; z-index:20; opacity:0; pointer-events:none; }
#flash.flash { animation:flash .4s ease-out; }
@keyframes flash { 0%{opacity:0} 20%{opacity:.9} 100%{opacity:0} }

#toast { position:absolute; bottom:calc(env(safe-area-inset-bottom) + 100px); left:50%; transform:translateX(-50%); z-index:30; padding:10px 20px; background:rgba(0,30,60,.85); border:1px solid rgba(120,180,255,.4); border-radius:20px; font-size:13px; color:#cdf; opacity:0; transition:opacity .3s; pointer-events:none; backdrop-filter:blur(10px); }
#toast.show { opacity:1; }

/* ============ 了解面板(磁贴) ============ */
#learn-panel { position:absolute; inset:0; z-index:40; background:rgba(0,2,12,.4); backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px); display:none; opacity:0; transition:opacity .35s; }
#learn-panel.show { display:block; opacity:1; }
#learn-sheet { position:absolute; bottom:0; left:0; right:0; height:88%; background:linear-gradient(180deg,#0a1428 0%,#050a18 100%); border-radius:28px 28px 0 0; border-top:1px solid rgba(120,180,255,.3); transform:translateY(100%); transition:transform .4s cubic-bezier(.32,.72,0,1); overflow:hidden; display:flex; flex-direction:column; box-shadow:0 -10px 50px rgba(0,40,100,.5); }
#learn-panel.show #learn-sheet { transform:translateY(0); }
#learn-handle { width:40px; height:4px; background:rgba(150,200,255,.4); border-radius:2px; margin:12px auto 6px; flex-shrink:0; }
#learn-header { padding:6px 24px 14px; flex-shrink:0; border-bottom:1px solid rgba(80,140,200,.2); position:relative; }
#learn-header .title { font-size:22px; font-weight:700; letter-spacing:3px; padding-right:40px; }
#learn-header .sub { font-size:12px; color:#6af; margin-top:4px; letter-spacing:2px; }
#learn-close { position:absolute; top:14px; right:18px; width:32px; height:32px; border-radius:50%; background:rgba(120,180,255,.15); border:none; color:#cdf; font-size:18px; cursor:pointer; display:flex; align-items:center; justify-content:center; }
#learn-scroll { flex:1; overflow-y:auto; overflow-x:hidden; padding:16px; -webkit-overflow-scrolling:touch; }
#learn-scroll::-webkit-scrollbar { width:4px; }
#learn-scroll::-webkit-scrollbar-thumb { background:rgba(120,180,255,.3); border-radius:2px; }

.tile { background:rgba(15,30,60,.6); border:1px solid rgba(80,140,200,.25); border-radius:16px; margin-bottom:14px; overflow:hidden; transition:transform .2s; }
.tile:active { transform:scale(.98); }
.tile-img-wrap { width:100%; aspect-ratio:16/10; background:#000; overflow:hidden; position:relative; }
.tile-img-wrap img { width:100%; height:100%; object-fit:cover; display:block; }
.tile-img-wrap .img-source { position:absolute; bottom:6px; right:8px; font-size:9px; color:rgba(200,220,255,.7); background:rgba(0,0,0,.5); padding:2px 6px; border-radius:3px; }
.tile-body { padding:14px 16px; }
.tile-body h3 { font-size:15px; color:#cdf; margin-bottom:8px; letter-spacing:1px; }
.tile-body p { font-size:13px; line-height:1.7; color:#9bd; }
.tile-body .meta { font-size:11px; color:#579; margin-top:8px; }

.learn-loading { text-align:center; padding:60px 20px; color:#579; font-size:13px; }
.learn-loading .spin { width:32px; height:32px; border:2px solid rgba(120,180,255,.2); border-top-color:#6af; border-radius:50%; animation:spin .8s linear infinite; margin:0 auto 16px; }
@keyframes spin { to { transform:rotate(360deg) } }

#desktop-hint { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); z-index:7; text-align:center; display:none; padding:20px; max-width:320px; }
#desktop-hint.show { display:block; }
#desktop-hint .icon { font-size:48px; }
#desktop-hint .text { font-size:14px; color:#cdf; margin-top:14px; line-height:1.8; }
#desktop-hint .small { font-size:11px; color:#6af; margin-top:10px; }

a { color:#7cf; text-decoration:none; }
