:root {
  --bg: #0a0a0a;
  --card-metallic: linear-gradient(145deg, #d0d0d0 0%, #b0b0b0 20%, #9a9a9a 40%, #a8a8a8 60%, #c0c0c0 80%, #b8b8b8 100%);
  --card-metallic-light: linear-gradient(145deg, #d8d8d8 0%, #c0c0c0 30%, #a8a8a8 60%, #b8b8b8 100%);
  --card-dark: linear-gradient(145deg, #2a2a2a 0%, #1f1f1f 100%);
  --card-dark-event: #1e1e1e;
  --gap: 10px;
  --radius: 18px;
}
* { box-sizing: border-box; margin:0; padding:0; -webkit-tap-highlight-color: transparent; }
html, body { height:100%; background: var(--bg); color:#f0f0f0; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; overflow-x:hidden; }
#app { max-width: 430px; margin:0 auto; min-height:100vh; padding:0 12px 40px; }
.header-card { border-radius: var(--radius); padding: 28px 16px 22px; text-align:center; margin: 12px 0 10px; position:relative; overflow:hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.6); background: linear-gradient(160deg, #0a1628 0%, #1a2a4a 40%, #0d1b2a 100%); min-height: 90px; display:flex; align-items:center; justify-content:center; }
.header-card h1 { position:relative; font-size:1.7rem; font-weight:700; letter-spacing:0.5px; color:#fff; text-shadow:0 2px 8px rgba(0,0,0,0.7); z-index:1; }
.section-bar { background: var(--card-metallic); color:#1a1a1a; font-weight:700; font-size:0.95rem; text-align:center; padding: 14px 8px; border-radius: 14px; margin: 14px 0 10px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 2px 8px rgba(0,0,0,0.5); }
.status-bar { text-align:center; font-size:0.7rem; padding:6px; opacity:0.8; border-radius:8px; margin-bottom:6px; }
.status-bar.offline { color:#ff9500; background: rgba(255,149,0,0.1); }
.status-bar.online { color:#30d158; background: rgba(48,209,88,0.1); }
.metrics-grid, .sky-grid { display:grid; grid-template-columns:1fr 1fr; gap: var(--gap); margin-bottom: 6px; }
.metric-card, .sky-card { background: var(--card-metallic-light); color:#1a1a1a; border-radius: var(--radius); padding: 16px 14px; min-height: 88px; display:flex; flex-direction:column; justify-content:center; position:relative; box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 3px 10px rgba(0,0,0,0.5); overflow:hidden; cursor:pointer; }
.metric-card.full, .sky-card.full { grid-column: 1 / -1; }
.metric-card .label, .sky-card .label { font-size:0.82rem; font-weight:500; opacity:0.75; color:#2a2a2a; margin-bottom:6px; }
.metric-card .value, .sky-card .value { font-size:1.45rem; font-weight:700; line-height:1.2; color:#111; letter-spacing:-0.3px; }
.digipin-card .value { font-size:1.05rem; letter-spacing:2px; font-family:"SF Mono", Menlo, monospace; }
.heading-card { background: linear-gradient(145deg, #2e3d2e 0%, #1a2a1a 100%); color:#e8ffe8; }
.heading-card .label { color:#a8c5a8; }
.heading-card .value { color:#fff; }
.heading-card .arrow-wrap { position:absolute; right:14px; top:50%; transform:translateY(-50%); width:48px; height:20px; display:flex; align-items:center; justify-content:center; }
.heading-arrow { width:36px; height:6px; background:#00ff88; border-radius:3px; position:relative; box-shadow:0 0 6px #00ff88, 0 0 12px #00ff88; transform-origin:left center; transition:transform 0.15s ease-out; }
.heading-arrow::after { content:""; position:absolute; right:-2px; top:50%; transform:translateY(-50%); width:0; height:0; border-left:10px solid #00ff88; border-top:6px solid transparent; border-bottom:6px solid transparent; filter:drop-shadow(0 0 4px #00ff88); }
.map-card { background:#050510; border-radius: var(--radius); overflow:hidden; margin: 10px 0 12px; height: 320px; position:relative; box-shadow:0 4px 16px rgba(0,0,0,0.6); }
#chartdiv { width:100%; height:100%; display:block; background:#0b1a2a; }
.map-overlay-desc { position:absolute; bottom:0; left:0; right:0; background: linear-gradient(180deg, transparent, rgba(0,0,0,0.7)); color:rgba(255,255,255,0.7); font-size:0.62rem; padding:8px 10px; pointer-events:none; line-height:1.3; }
.moon-big-card { min-height: 220px !important; background: var(--card-metallic-light) !important; padding: 18px !important; display:flex !important; flex-direction:column !important; align-items:center !important; justify-content:center !important; grid-column: 1 / -1; }
.moon-big-card .label { font-size:0.85rem; font-weight:600; opacity:0.8; margin-bottom:10px; text-align:center; width:100%; }
.moon-big-card .value { width:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; white-space:normal !important; overflow:visible !important; }
#moon-container { width:160px; height:160px; display:flex; justify-content:center; align-items:center; filter: drop-shadow(0 6px 16px rgba(0,0,0,0.5)); }
.events-scroll { display:flex; gap:12px; overflow-x:auto; padding: 10px 0 18px; scrollbar-width:none; -webkit-overflow-scrolling:touch; scroll-snap-type:x mandatory; }
.events-scroll::-webkit-scrollbar { display:none; }
.event-card { flex:0 0 72%; min-width: 260px; max-width: 300px; background: #1e1e1e; border-radius: 18px; padding: 18px 16px; color:#eee; box-shadow:0 2px 10px rgba(0,0,0,0.5); scroll-snap-align:start; border:1px solid #2a2a2a; }
.event-card .title { font-weight:700; font-size:1.05rem; margin-bottom:6px; color:#fff; line-height:1.3; }
.event-card .date { font-size:0.85rem; color:#9a9a9a; margin-bottom:4px; }
.event-card .desc { font-size:0.9rem; color:#d0d0d0; line-height:1.3; }
.clear-data-btn { display:block; width:100%; margin: 26px 0 14px; padding: 18px; background: #1e1e1e; color:#ff5a5a; border:1px solid #3a3a3a; border-radius: 18px; font-size:1.0rem; font-weight:500; text-align:center; cursor:pointer; }
.detail-sheet { position:fixed; left:0; right:0; bottom:0; max-height:70vh; background:#1c1c1e; border-radius:16px 16px 0 0; padding:20px 18px 40px; z-index:1000; transform:translateY(110%); transition:transform 0.28s cubic-bezier(0.32,0.72,0,1); box-shadow:0 -8px 30px rgba(0,0,0,0.5); overflow-y:auto; }
.detail-sheet.open { transform:translateY(0); }
.detail-sheet .handle { width:36px; height:4px; background:#555; border-radius:2px; margin:0 auto 16px; }
.detail-sheet h3 { font-size:1.1rem; margin-bottom:8px; color:#fff; }
.detail-sheet .big-value { font-size:1.6rem; font-weight:700; color:#00ff88; margin:12px 0; word-break:break-all; }
.detail-sheet .desc { font-size:0.9rem; color:#aaa; line-height:1.45; margin-bottom:18px; }
.detail-actions { display:flex; gap:10px; margin-top:12px; }
.detail-actions button { flex:1; padding:12px; border:none; border-radius:10px; font-size:0.95rem; font-weight:600; cursor:pointer; }
.btn-copy { background:#00ff88; color:#000; }
.btn-close { background:#333; color:#fff; }
.sheet-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.55); z-index:999; opacity:0; pointer-events:none; transition:opacity 0.25s; }
.sheet-overlay.open { opacity:1; pointer-events:auto; }
.toast { position:fixed; bottom:30px; left:50%; transform:translateX(-50%) translateY(80px); background:#00ff88; color:#000; padding:10px 20px; border-radius:20px; font-weight:600; font-size:0.9rem; z-index:2000; transition:transform 0.3s; pointer-events:none; }
.toast.show { transform:translateX(-50%) translateY(0); }
