/* HuLaHo OS v15 — mobile-first sovereign glass UI (no external libs) */

:root{
  --ui: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;

  --r12:12px; --r16:16px; --r20:20px; --r24:24px; --r28:28px;
  --shadow: 0 18px 44px rgba(0,0,0,0.22);
  --ease: 180ms cubic-bezier(.2,.9,.2,1);
}

html[data-theme="dark"]{
  --bg:#05070a;
  --text:#f8fafc;
  --muted:rgba(248,250,252,0.62);
  --muted2:rgba(248,250,252,0.45);

  --glass:rgba(15,23,42,0.58);
  --border:rgba(255,255,255,0.08);

  --eu-blue:#003399;
  --eu-gold:#ffcc00;

  --blue:#3b82f6;
  --good:#22c55e;
  --warn:#ef4444;

  --chip:rgba(0,0,0,0.22);
}

html[data-theme="light"]{
  --bg:#f1f5f9;
  --text:#0f172a;
  --muted:rgba(15,23,42,0.62);
  --muted2:rgba(15,23,42,0.45);

  --glass:rgba(255,255,255,0.72);
  --border:rgba(0,0,0,0.10);

  --eu-blue:#003399;
  --eu-gold:#b8860b;

  --blue:#1f4cff;
  --good:#16a34a;
  --warn:#c62828;

  --chip:rgba(255,255,255,0.50);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--ui);
  overflow-x:hidden;
  min-height:100vh;
}

.mono{ font-family: var(--mono); }

#canvas-container{
  position:fixed; inset:0;
  z-index:-1;
  opacity:0.42;
  pointer-events:none;
}

.glass{
  background:var(--glass);
  border:1px solid var(--border);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--shadow);
}

.topbar{
  height:auto;
  margin:12px;
  padding:10px;
  border-radius: 999px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}

.navLeft{ display:flex; align-items:center; gap:10px; }
.navRight{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end; }

.pill{
  display:flex; align-items:center; gap:10px;
  padding:10px 14px;
  border-radius:999px;
}

.statusDot{
  width:10px; height:10px;
  border-radius:999px;
  background:var(--good);
  box-shadow: 0 0 18px rgba(34,197,94,0.35);
}

.pillText{
  font-weight:800;
  letter-spacing:-0.2px;
  font-size:13px;
  text-transform:uppercase;
}

.iconBtn{
  width:44px; height:44px;
  border-radius:999px;
  cursor:pointer;
  position:relative;
  transition: var(--ease);
}
.iconBtn:hover{ transform: scale(1.06); }
.iconBtn .moon, .iconBtn .sun{ position:absolute; inset:0; display:grid; place-items:center; }
.iconBtn .moon::before{
  content:""; width:16px; height:16px; border-radius:999px;
  background: rgba(59,130,246,0.75);
  box-shadow: 0 0 22px rgba(59,130,246,0.35);
  mask: radial-gradient(circle at 35% 35%, transparent 40%, #000 42%);
}
.iconBtn .sun::before{
  content:""; width:16px; height:16px; border-radius:999px;
  background: rgba(255,204,0,0.75);
  box-shadow: 0 0 22px rgba(255,204,0,0.28);
}
html[data-theme="dark"] .iconBtn .sun{ opacity:0; transform: translateY(6px); transition: var(--ease); }
html[data-theme="dark"] .iconBtn .moon{ opacity:1; transform: translateY(0); transition: var(--ease); }
html[data-theme="light"] .iconBtn .sun{ opacity:1; transform: translateY(0); transition: var(--ease); }
html[data-theme="light"] .iconBtn .moon{ opacity:0; transform: translateY(-6px); transition: var(--ease); }

.btn{
  cursor:pointer;
  border-radius:999px;
  padding:10px 14px;
  font-weight:800;
  letter-spacing:0.2px;
  color:var(--text);
  transition: var(--ease);
  user-select:none;
}
.btn:hover{ transform: translateY(-1px); }
.btn.primary{
  background: linear-gradient(135deg, rgba(59,130,246,0.35), rgba(255,204,0,0.18));
  border:1px solid rgba(59,130,246,0.28);
}

.divider{ width:1px; height:30px; background: rgba(59,130,246,0.20); }

.navMetric{ display:flex; flex-direction:column; gap:2px; align-items:flex-end; }
.navMetric .k{
  font-size:10px;
  letter-spacing:2px;
  text-transform:uppercase;
  color:var(--muted2);
  font-weight:800;
}
.navMetric .v{
  font-size:12px;
  font-weight:800;
}

.hideSm{ display:none; }
@media (min-width: 640px){
  .hideSm{ display:flex; }
}

.gridRoot{
  max-width:1600px;
  margin:0 auto;
  padding: 10px 12px 16px;
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}

.panel{
  border-radius: 32px;
  padding: 14px;
}

.scrollY{
  overflow-y:auto;
  scrollbar-width: thin;
}
.scrollY::-webkit-scrollbar{ width:4px; }
.scrollY::-webkit-scrollbar-thumb{ background: rgba(59,130,246,0.30); border-radius: 10px; }

.panelHead{ display:flex; flex-direction:column; gap:4px; margin-bottom:10px; }
.panelHead .title{
  font-size:11px;
  letter-spacing:3px;
  text-transform:uppercase;
  font-weight:900;
  color: rgba(59,130,246,0.95);
}
.panelHead .sub{
  font-size:12px;
  color: var(--muted);
  line-height:1.3;
}

.quoteBlock{
  background: rgba(59,130,246,0.10);
  border:1px solid rgba(59,130,246,0.18);
  border-left: 4px solid rgba(255,204,0,0.75);
  border-radius: 24px;
  padding:14px;
}
.qMark{ font-size:18px; color: rgba(59,130,246,0.95); font-weight:900; }
.qText{
  margin-top:4px;
  font-size:13px;
  line-height:1.55;
  color: var(--text);
}
.qAttr{
  margin-top:8px;
  font-size:10px;
  letter-spacing:2px;
  text-transform:uppercase;
  color: var(--muted2);
  font-weight:900;
}
.hl{ color: rgba(59,130,246,0.95); font-weight:900; }
.hl2{ color: rgba(255,204,0,0.85); font-weight:900; }

.section{
  margin-top:12px;
  padding:14px;
  border-radius: 24px;
  background: rgba(255,255,255,0.03);
  border:1px solid var(--border);
}
.secTitle{
  font-size:10px;
  letter-spacing:3px;
  text-transform:uppercase;
  font-weight:900;
  color: rgba(255,204,0,0.85);
}
.secBody{
  margin-top:8px;
  font-size:12px;
  line-height:1.5;
  color: var(--muted);
}
.secBody.small{ font-size:11px; }

.tags{ margin-top:10px; display:flex; flex-wrap:wrap; gap:6px; }
.tag{
  padding:6px 8px;
  border-radius: 999px;
  border:1px solid rgba(59,130,246,0.20);
  background: rgba(59,130,246,0.08);
  font-size:10px;
  letter-spacing:1px;
  font-weight:800;
  color: rgba(248,250,252,0.85);
}

.center{ display:flex; flex-direction:column; gap:12px; }

.statsRow{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
}
.statCard{
  border-radius: 24px;
  padding:12px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
}
.statCard .k{
  font-size:10px;
  letter-spacing:2px;
  text-transform:uppercase;
  color: var(--muted2);
  font-weight:900;
}
.statCard .v{
  font-size:16px;
  font-weight:900;
}

.chatCard{
  border-radius: 48px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-height: 520px;
}
.chatHead{
  padding:14px 16px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chatTitle{
  font-size:10px;
  letter-spacing:3px;
  text-transform:uppercase;
  font-weight:900;
  color: rgba(59,130,246,0.95);
}
.modes{ display:flex; gap:8px; }
.modeBtn{
  border-radius:999px;
  padding:8px 12px;
  font-weight:900;
  font-size:11px;
  letter-spacing:1px;
  cursor:pointer;
  user-select:none;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.12);
  transition: var(--ease);
}
.modeBtn:hover{ transform: translateY(-1px); }
.modeBtn.on{
  border-color: rgba(59,130,246,0.30);
  background: rgba(59,130,246,0.14);
}
.modeBtn.ghost{ background: transparent; }

.chatFlow{
  flex:1;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.msg{
  display:flex;
  gap:12px;
  align-items:flex-start;
}
.msg.user{ flex-direction: row-reverse; }
.avatar{
  width:40px;
  height:40px;
  border-radius: 16px;
  border:1px solid var(--border);
  flex:0 0 auto;
  background: rgba(255,255,255,0.06);
}
.aiA{ background: rgba(59,130,246,0.14); border-color: rgba(59,130,246,0.24); }
.usA{ background: rgba(255,255,255,0.06); }

.bubble{
  max-width: 78%;
  border-radius: 24px;
  padding:12px 14px;
  border:1px solid var(--border);
  background: rgba(0,0,0,0.16);
}
html[data-theme="light"] .bubble{ background: rgba(255,255,255,0.55); }
.msg.user .bubble{
  background: rgba(59,130,246,0.10);
  border-color: rgba(59,130,246,0.18);
}
.who{
  font-size:10px;
  letter-spacing:2px;
  text-transform:uppercase;
  font-weight:900;
  color: var(--muted2);
}
.text{
  margin-top:6px;
  font-size:13px;
  line-height:1.55;
}

.chatInputWrap{
  position:relative;
  padding:14px 16px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.08);
}
html[data-theme="light"] .chatInputWrap{ background: rgba(255,255,255,0.25); }

.inputGlow{
  position:absolute;
  inset: 10px 16px 12px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(59,130,246,0.20), rgba(255,204,0,0.14));
  filter: blur(12px);
  opacity:0.55;
  pointer-events:none;
}
.chatInput{
  position:relative;
  width:100%;
  border-radius: 22px;
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.28);
  padding:16px 54px 16px 18px;
  font-size:14px;
  color: var(--text);
  outline:none;
}
html[data-theme="light"] .chatInput{
  background: rgba(255,255,255,0.68);
  border-color: rgba(0,0,0,0.10);
}
.chatInput:focus{
  border-color: rgba(59,130,246,0.35);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.sendBtn{
  position:absolute;
  right: 24px;
  top: 24px;
  width:44px;
  height:44px;
  border-radius: 16px;
  border:1px solid rgba(59,130,246,0.30);
  background: rgba(59,130,246,0.20);
  color: var(--text);
  font-weight:900;
  cursor:pointer;
  transition: var(--ease);
}
.sendBtn:hover{ transform: scale(1.03); }
.sendBtn:active{ transform: scale(0.98); }

.graphWrap{
  position:relative;
  height: 140px;
  border-radius: 24px;
  border:1px solid var(--border);
  background: rgba(59,130,246,0.06);
  overflow:hidden;
  margin-top:8px;
}
.graphSvg{
  width:100%;
  height:100%;
  color: rgba(59,130,246,0.85);
}
.graphOverlay{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  font-size:56px;
  font-weight:900;
  opacity:0.10;
}

.metricList{
  margin-top:12px;
  padding:12px;
  border-radius: 24px;
  border:1px solid var(--border);
  background: rgba(0,0,0,0.14);
}
html[data-theme="light"] .metricList{ background: rgba(255,255,255,0.55); }
.mRow{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:8px 4px;
  border-bottom: 1px dashed rgba(59,130,246,0.20);
}
.mRow:last-child{ border-bottom:none; }
.mk{
  font-size:11px;
  font-weight:900;
  letter-spacing:1px;
  text-transform:uppercase;
  color: var(--muted2);
}
.mv{
  font-size:12px;
  font-weight:900;
}

.skillList{ margin-top:10px; display:flex; flex-direction:column; gap:10px; }
.skillItem{
  border-radius: 18px;
  border:1px solid var(--border);
  background: rgba(255,255,255,0.03);
  padding:10px 10px;
}
.skillT{
  font-size:11px;
  font-weight:900;
  letter-spacing:1px;
  text-transform:uppercase;
  color: rgba(59,130,246,0.95);
}
.skillS{
  margin-top:6px;
  font-size:12px;
  line-height:1.45;
  color: var(--muted);
}

.modal{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,0.60);
  padding:14px;
  z-index:50;
}
.hidden{ display:none !important; }
.modalCard{
  width: min(920px, 96vw);
  max-height: min(86vh, 880px);
  border-radius: 28px;
  overflow:auto;
  padding:0;
}
.modalHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 16px;
  border-bottom:1px solid rgba(255,255,255,0.06);
}
.modalTitle{
  font-size:11px;
  letter-spacing:3px;
  text-transform:uppercase;
  font-weight:900;
  color: rgba(59,130,246,0.95);
}
.modalBody{
  padding:16px;
  color: var(--muted);
  font-size:13px;
  line-height:1.6;
}
.coreBadge{
  margin-left: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  border: 1px solid rgba(255,204,0,0.28);
  background: rgba(255,204,0,0.10);
  color: rgba(255,204,0,0.95);
}
.coreBadge.on{
  border-color: rgba(34,197,94,0.28);
  background: rgba(34,197,94,0.10);
  color: rgba(34,197,94,0.95);
}
.modalBody h3{
  margin:0 0 10px 0;
  font-size:11px;
  letter-spacing:3px;
  text-transform:uppercase;
  font-weight:900;
  color: rgba(255,204,0,0.85);
}
.modalBody a{ color: rgba(59,130,246,0.95); font-weight:900; }

@media (min-width: 1024px){
  .gridRoot{
    grid-template-columns: repeat(12, 1fr);
    gap:14px;
    height: calc(100vh - 96px);
  }
  .col{ grid-column: span 3; height:100%; }
  .center{ grid-column: span 6; height:100%; }
}

@media (max-width: 420px){
  .statsRow{ grid-template-columns: 1fr; }
  .chatCard{ min-height: 560px; }
}
