:root{
  --ink:#1e2a47; --muted:#6b7794; --line:#e6ebf5;
  --purple:#6d5ae6; --purple-soft:#f0edff;
  --amber:#f59e0b;  --amber-soft:#fff6e5;
  --green:#22a06b;  --green-soft:#eaf9f1;
  --blue:#3b82f6;   --blue-soft:#eaf2ff;
  --pink:#ec4899;   --pink-soft:#fdeef6;
  --teal:#0ea5a5;   --teal-soft:#e6f8f8;
  --sky1:#dff0fd; --sky2:#eef4ff;
  --shadow:0 6px 20px rgba(30,42,71,.07);
  --r:20px;
}
*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family:"Nunito",-apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif;
  color:var(--ink); background:#f7f9fd; font-size:16px; line-height:1.55;
}
.hidden{ display:none !important; }
button{ font-family:inherit; cursor:pointer; }
h1,h2,h3{ letter-spacing:-.6px; }

/* ---------- gate ---------- */
.gate{ position:fixed; inset:0; display:flex; align-items:center; justify-content:center; padding:20px;
  background:linear-gradient(170deg,var(--sky1),var(--purple-soft)); z-index:60; }
.gate-card{ background:#fff; border-radius:28px; box-shadow:var(--shadow); padding:40px 34px;
  text-align:center; max-width:380px; width:100%; }
.gate-emoji{ font-size:52px; }
.gate-card h1{ margin:6px 0 4px; font-size:30px; color:var(--purple); }
.gate-card p{ margin:0 0 18px; color:var(--muted); }
.gate-card input{ width:100%; padding:14px 16px; font-size:18px; border:2px solid var(--line);
  border-radius:14px; outline:none; text-align:center; }
.gate-card input:focus{ border-color:var(--purple); }
.gate-card button{ width:100%; margin-top:12px; padding:14px; font-size:17px; font-weight:800;
  color:#fff; background:var(--purple); border:none; border-radius:14px; }
.gate-err{ color:#dc2626; font-weight:700; font-size:15px; min-height:22px; margin:10px 0 0 !important; }

/* ---------- shell ---------- */
.shell{ display:grid; grid-template-columns:210px 1fr; min-height:100vh; }

.sidebar{ background:#fff; border-right:1px solid var(--line); padding:24px 16px;
  display:flex; flex-direction:column; gap:8px; position:sticky; top:0; height:100vh; overflow-y:auto; }
.logo{ text-align:center; margin-bottom:14px; }
.logo-mark{ font-size:25px; font-weight:900; color:var(--purple); line-height:1.05; }
.logo-mark span{ display:block; color:var(--teal); }
.logo-tag{ font-size:12px; color:var(--muted); margin:8px 0 0; line-height:1.35; }

.side-nav{ display:flex; flex-direction:column; gap:3px; }
.nav-item{ display:flex; align-items:center; gap:11px; width:100%; text-align:left;
  background:none; border:none; border-radius:12px; padding:10px 12px;
  font-size:15px; font-weight:700; color:var(--ink); }
.nav-item span{ font-size:17px; width:20px; text-align:center; }
.nav-item:hover{ background:var(--purple-soft); }
.nav-item.active{ background:var(--purple); color:#fff; }
.side-sep{ height:1px; background:var(--line); margin:10px 4px; }

.safe-badge{ margin-top:auto; background:var(--blue-soft); border-radius:16px; padding:14px; }
.safe-title{ font-weight:800; font-size:13px; margin-bottom:5px; }
.safe-badge p{ margin:0; font-size:12px; color:var(--muted); line-height:1.4; }

@media (max-width:820px){
  .shell{ grid-template-columns:1fr; }
  .sidebar{ position:static; height:auto; flex-direction:row; flex-wrap:wrap; align-items:center; }
  .logo{ margin:0 auto 0 0; text-align:left; }
  .logo-tag, .safe-badge, .side-sep{ display:none; }
  .side-nav{ flex-direction:row; flex-wrap:wrap; }
}

/* ---------- main ---------- */
.main{ background:linear-gradient(180deg,var(--sky1) 0%, #f7f9fd 380px); padding:0 26px 40px; min-width:0; }
.topbar{ display:flex; justify-content:space-between; align-items:center; gap:14px;
  padding:16px 0; flex-wrap:wrap; min-height:56px; }
.trail{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; font-size:13px; color:var(--muted); }
.trail .crumb{ background:#fff; border:1px solid var(--line); border-radius:999px; padding:5px 12px;
  cursor:pointer; max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; }
.trail .crumb:hover{ border-color:var(--purple); color:var(--purple); }
.trail .arrow{ opacity:.45; }
.counter{ background:#fff; border-radius:999px; padding:7px 16px; font-weight:800; font-size:14px;
  box-shadow:var(--shadow); white-space:nowrap; }

/* hero */
.hero{ text-align:center; padding:26px 0 34px; position:relative; }
.mascot{ font-size:56px; line-height:1; }
.prompt{ font-size:clamp(24px,3.4vw,34px); color:var(--purple); margin:10px 0 22px; }
.askbar{ display:flex; align-items:center; gap:10px; background:#fff; border:3px solid var(--purple);
  border-radius:999px; padding:8px 8px 8px 20px; max-width:720px; margin:0 auto; box-shadow:var(--shadow); }
.askbar-ico{ font-size:19px; opacity:.6; }
.askbar input{ flex:1; border:none; outline:none; font-size:18px; font-family:inherit;
  color:var(--ink); background:none; min-width:0; padding:10px 0; }
.askbar button{ width:48px; height:48px; border-radius:50%; border:none; background:var(--purple);
  color:#fff; font-size:19px; flex-shrink:0; }
.try{ margin-top:18px; display:flex; align-items:center; gap:10px; justify-content:center; flex-wrap:wrap; }
.try-label{ font-size:14px; font-weight:700; color:var(--muted); }
.chips{ display:flex; gap:8px; flex-wrap:wrap; justify-content:center; }
.chip{ background:#fff; border:1.5px solid var(--line); border-radius:999px; padding:7px 15px;
  font-size:14px; font-weight:700; color:var(--purple); }
.chip:hover{ border-color:var(--purple); background:var(--purple-soft); }

/* ---------- cards ---------- */
#results, #log-view{ max-width:1180px; }
.asked{ font-size:clamp(21px,2.8vw,29px); margin:6px 0 18px; }
.row{ display:grid; gap:18px; margin-bottom:18px; align-items:start; }
.row-2{ grid-template-columns:1fr 1fr; }
.row-1{ grid-template-columns:1fr; }
@media (max-width:980px){ .row-2{ grid-template-columns:1fr; } }

.card{ background:#fff; border-radius:var(--r); box-shadow:var(--shadow); padding:22px; border:1px solid var(--line); }
.c-answer{ background:linear-gradient(160deg,#fffaf0,#fff); border-color:#fbe6bd; }
.c-research{ background:linear-gradient(160deg,#f2fbf6,#fff); border-color:#c8ecd9; }
.c-more{ background:linear-gradient(160deg,#f6f3ff,#fff); border-color:#ddd6fe; }
.c-deeper{ background:linear-gradient(160deg,#fff7ed,#fff); border-color:#fcd9b0; }

.card-head{ display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.card-head h3{ margin:0; font-size:20px; }
.badge{ width:32px; height:32px; border-radius:10px; display:flex; align-items:center;
  justify-content:center; font-size:16px; flex-shrink:0; color:#fff; }
.badge.amber{ background:var(--amber); } .badge.green{ background:var(--green); }
.badge.blue{ background:var(--blue); }   .badge.purple{ background:var(--purple); }
.card-sub{ margin:0 0 14px; color:var(--muted); font-size:14px; }

.answer-text{ font-size:17.5px; line-height:1.65; margin:0 0 14px; }
.inshort{ background:#fff; border:1px solid var(--line); border-radius:14px; padding:14px 16px; }
.inshort-title{ font-weight:800; color:var(--amber); margin-bottom:7px; font-size:14px; }
.inshort ul{ margin:0; padding:0; list-style:none; }
.inshort li{ display:flex; gap:9px; font-size:15px; margin-bottom:6px; }
.inshort li::before{ content:"✅"; flex-shrink:0; }
.hook{ margin:14px 0 0; color:var(--muted); font-style:italic; font-size:15.5px; }

/* article list */
.stack{ display:flex; flex-direction:column; gap:9px; }
.src{ display:flex; gap:11px; align-items:flex-start; text-align:left; width:100%;
  background:#fff; border:1.5px solid var(--line); border-radius:14px; padding:12px 14px; }
.src:hover{ border-color:var(--green); }
.src .ico{ font-size:18px; }
.src .t{ font-weight:800; font-size:15px; line-height:1.35; display:block; }
.src .m{ font-size:12.5px; color:var(--muted); margin-top:3px; display:block; }
.src .m b{ color:var(--green); font-weight:800; }
.src .arrow{ margin-left:auto; color:var(--muted); font-weight:900; }

/* videos */
.vid-row{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
@media (max-width:560px){ .vid-row{ grid-template-columns:1fr; } }
.vid{ text-align:left; background:none; border:none; padding:0; }
.embed{ position:relative; padding-bottom:56.25%; border-radius:14px; overflow:hidden; background:#000; }
.embed iframe{ position:absolute; inset:0; width:100%; height:100%; border:0; }
.vid .t{ font-weight:800; font-size:14.5px; margin-top:8px; line-height:1.3; }
.vid .m{ font-size:12.5px; color:var(--muted); }

/* learn more */
.more-item{ display:flex; gap:12px; align-items:flex-start; background:#fff; border:1px solid var(--line);
  border-radius:14px; padding:13px 15px; margin-bottom:10px; }
.mi-ico{ width:32px; height:32px; border-radius:10px; display:flex; align-items:center;
  justify-content:center; font-size:15px; flex-shrink:0; }
.mi-ico.pink{ background:var(--pink-soft); } .mi-ico.teal{ background:var(--teal-soft); }
.mi-ico.yellow{ background:var(--amber-soft); }
.more-item b{ font-size:15px; }
.more-item p{ margin:3px 0 0; font-size:14.5px; color:var(--muted); line-height:1.5; }
.mi-sub{ margin:2px 0 8px !important; font-size:13px !important; }
#words dl, #words{ margin:0; }
#words div{ margin-top:6px; font-size:14.5px; }
#words dt{ font-weight:800; color:var(--teal); display:inline; }
#words dd{ display:inline; margin:0; color:var(--muted); }
#words dt::after{ content:" — "; color:var(--muted); font-weight:400; }

/* quiz */
.qz{ margin-bottom:12px; }
.qz-q{ font-weight:700; font-size:14.5px; margin-bottom:6px; }
.qz-opts{ display:flex; flex-direction:column; gap:5px; }
.qz-opt{ text-align:left; background:#fff; border:1.5px solid var(--line); border-radius:10px;
  padding:8px 12px; font-size:14px; font-weight:600; color:var(--ink); }
.qz-opt:hover:not(:disabled){ border-color:var(--purple); }
.qz-opt:disabled{ cursor:default; opacity:.75; }
.qz-opt.right{ background:var(--green-soft); border-color:var(--green); color:#14663f; opacity:1; }
.qz-opt.wrong{ background:#fdecec; border-color:#ef4444; color:#9b1c1c; opacity:1; }

/* go deeper */
.deeper-list{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; }
@media (max-width:900px){ .deeper-list{ grid-template-columns:1fr; } }
.deeper-q{ text-align:left; background:#fff; border:1.5px solid var(--line); color:var(--ink);
  border-radius:14px; padding:14px 16px; font-size:15.5px; font-weight:700; line-height:1.35; }
.deeper-q:hover{ border-color:var(--amber); background:var(--amber-soft); }
.deeper-q::after{ content:" →"; color:var(--amber); font-weight:900; }

/* footer */
.curious{ display:flex; align-items:center; gap:14px; background:#fff; border:1px solid var(--line);
  border-radius:var(--r); padding:16px 22px; margin-top:22px; max-width:1180px; box-shadow:var(--shadow); }
.mascot-sm{ font-size:30px; }
.curious b{ color:var(--purple); }
.curious p{ margin:2px 0 0; color:var(--muted); font-size:14px; }

/* states */
.skel{ background:linear-gradient(90deg,#eef1f6,#f9fbfe,#eef1f6); background-size:200% 100%;
  animation:sh 1.2s infinite; border-radius:8px; height:15px; margin-bottom:9px; }
.skel.w70{ width:70%; } .skel.w40{ width:40%; }
@keyframes sh{ 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.empty{ color:var(--muted); font-size:14.5px; margin:0; }
.c-answer.gentle{ background:linear-gradient(160deg,#fdeef6,#fff); border-color:#f7c9e0; }

/* ---------- reader ---------- */
.reader{ position:fixed; inset:0; background:#fffdf8; z-index:50; overflow-y:auto; }
.reader-bar{ position:sticky; top:0; background:rgba(255,253,248,.95); backdrop-filter:blur(8px);
  border-bottom:1px solid var(--line); padding:13px 22px; display:flex; gap:16px;
  align-items:center; flex-wrap:wrap; justify-content:space-between; }
.reader-bar button{ background:#fff; border:1.5px solid var(--line); border-radius:999px;
  padding:9px 16px; font-weight:800; font-size:14.5px; color:var(--ink); }
.reader-bar button:hover{ border-color:var(--purple); color:var(--purple); }
.reader-meta{ display:flex; gap:14px; align-items:center; font-size:13.5px; color:var(--muted); flex-wrap:wrap; }
.reader-meta span:first-child{ font-weight:800; color:var(--green); }
.reader-meta a{ color:var(--blue); }
#reader-body{ max-width:660px; margin:0 auto; padding:34px 24px 100px; font-size:19.5px; line-height:1.75; }
#reader-body h1{ font-size:30px; line-height:1.25; margin-top:0; }
#reader-body h2{ font-size:22px; margin-top:32px; }
#reader-body p{ margin:0 0 20px; }
