/* Emotion Atlas: deep navy with soft ML accents.
   Built by Dr. Safeer Ali Mirani · safeer.ali.mirani@gmail.com */
:root {
  --ink: #05070e;
  --gold: #B08D57;
  --gold-2: #e0b872;
  --accent: #7c9cff;
  --text: #e9edf6;
  --muted: #9aa8c6;
  --panel: rgba(10, 15, 28, 0.76);
  --border: rgba(124, 156, 255, 0.24);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--font); color: var(--text); background: radial-gradient(1200px 900px at 60% 15%, #0b1428 0%, var(--ink) 62%); }
#gpu { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: grab; touch-action: none; }
#gpu:active { cursor: grabbing; }

#hud { position: fixed; top: 18px; left: 20px; z-index: 6; display: flex; flex-direction: column; gap: 14px; pointer-events: none; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; line-height: 1; color: var(--accent); filter: drop-shadow(0 0 12px rgba(124, 156, 255, 0.6)); }
.title { font-size: 22px; font-weight: 700; letter-spacing: 0.3px; }
.subtitle { font-size: 11px; color: var(--muted); letter-spacing: 0.6px; text-transform: uppercase; }
.stats { display: flex; gap: 18px; }
.stats dt { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
.stats dd { font-size: 18px; font-weight: 600; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.stats dd.mini { font-size: 12px; font-weight: 500; color: var(--text); }

#panel { position: fixed; top: 18px; right: 18px; z-index: 6; width: 288px; max-height: calc(100vh - 36px); overflow-y: auto;
  background: var(--panel); backdrop-filter: blur(14px); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 16px; }
#panel section { padding: 11px 0; border-top: 1px solid rgba(255, 255, 255, 0.06); }
#panel section:first-child { padding-top: 2px; border-top: none; }
#panel h2 { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.9px; margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; }
.hint-mini { font-size: 9.5px; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 400; }
.row { display: flex; gap: 8px; align-items: center; }

input#query { width: 100%; padding: 9px 11px; border-radius: 9px; background: rgba(0, 0, 0, 0.34); border: 1px solid var(--border); color: var(--text); font-size: 13px; font-family: var(--font); }
input#query::placeholder { color: var(--muted); }
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 8px; padding: 8px 13px; font-size: 12.5px; cursor: pointer; transition: transform 0.08s, color 0.15s, border-color 0.15s; white-space: nowrap; }
button.ghost:hover { color: var(--text); border-color: var(--accent); }
button.ghost:active { transform: scale(0.97); }
button.ghost:disabled { opacity: 0.5; cursor: default; }
button.ghost.tiny { padding: 2px 8px; font-size: 10px; }

#result { margin-top: 11px; font-size: 12px; }
#result.hidden { display: none; }
.pred { color: var(--muted); margin-bottom: 8px; }
.pred b { text-transform: capitalize; }
.nn-title { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; margin: 8px 0 5px; }
.nn { display: flex; align-items: center; gap: 7px; padding: 3px 0; line-height: 1.35; }
.nn-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.nn-txt { color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nn-sim { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }

#legend { display: flex; flex-direction: column; gap: 2px; }
.legend-row { display: flex; align-items: center; gap: 8px; width: 100%; background: transparent; border: none; color: var(--text); cursor: pointer; padding: 5px 4px; border-radius: 7px; font-size: 12.5px; text-align: left; }
.legend-row:hover { background: rgba(255, 255, 255, 0.05); }
.legend-row.off { opacity: 0.35; }
.legend-row .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend-row .lname { flex: 1; text-transform: capitalize; }
.legend-row .lcount { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }

.panel-credit { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.06); font-size: 10.5px; color: var(--muted); line-height: 1.6; text-align: center; }
.panel-credit b { color: var(--gold-2); font-weight: 600; }
.panel-credit a { color: var(--gold-2); text-decoration: none; }
.panel-credit a:hover { text-decoration: underline; }

#hint { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 6; font-size: 12px; color: var(--muted); background: rgba(5, 7, 14, 0.5); padding: 7px 16px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, 0.06); backdrop-filter: blur(8px); pointer-events: none; max-width: 92vw; text-align: center; }
#hint span { color: var(--accent); font-weight: 600; }

.overlay { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: radial-gradient(800px 600px at 50% 40%, rgba(14, 24, 46, 0.6), rgba(5, 7, 14, 0.94)); }
.overlay.hidden, .hidden { display: none !important; }
#loading-text { color: var(--text); font-size: 14px; letter-spacing: 0.2px; max-width: 380px; text-align: center; }
.load-note { color: var(--muted); font-size: 11.5px; max-width: 340px; text-align: center; }
.track { width: 260px; height: 5px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden; }
#bar { width: 2%; height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.25s ease; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid rgba(124, 156, 255, 0.2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.about-card, .nogpu-card { max-width: 460px; max-height: 82vh; overflow-y: auto; text-align: left; padding: 24px 26px; background: rgba(10, 15, 28, 0.95); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 11px; }
.nogpu-card { text-align: center; }
.about-card > button.ghost.tiny { align-self: flex-end; }
.about-card h1, .nogpu-card h1 { color: var(--accent); font-size: 19px; }
.about-card p { color: var(--text); font-size: 13px; line-height: 1.55; }
.about-card p.muted, .nogpu-card .muted { color: var(--muted); font-size: 11.5px; }
.about-card b { color: var(--gold-2); font-weight: 600; }
.about-credit { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); line-height: 1.7; display: flex; flex-direction: column; gap: 4px; }
.about-credit b { color: var(--gold-2); }
.about-credit a { color: var(--gold-2); text-decoration: none; }
.about-credit a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } button.ghost { transition: none; } }
@media (max-width: 640px) { #panel { width: 232px; max-height: 60vh; } }
