:root{
  --bg:#0b1020;
  --panel:#0f1730;
  --text:#eaf0ff;
  --muted:#9fb0d0;
  --accent:#7c5cff;
  --accent2:#35d0ba;
  --danger:#ff5c7a;
  --ok:#42e38b;
  --shadow: 0 14px 40px rgba(0,0,0,.35);
  --radius: 18px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background:
    radial-gradient(1100px 800px at 15% 10%, rgba(124,92,255,.18), transparent 55%),
    radial-gradient(900px 700px at 85% 15%, rgba(53,208,186,.14), transparent 55%),
    var(--bg);
  color:var(--text);
}

/* ================= TOP BAR (CLEANED & CONSOLIDATED) ================= */

.topbar{
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:16px;
  padding:10px 18px;
  border-bottom:1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(10px);
  position: sticky;
  top:0;
  z-index:10;
}

.topbar-stats{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  flex-wrap:nowrap;
  overflow:hidden;
}

.stat-inline{
  display:flex;
  align-items:center;
  gap:10px;
}

.stat-label{
  font-size:11px;
  color:var(--muted);
}

.stat-value{
  font-size:18px;
  font-weight:900;
}

.progressbar{
  width:90px;
  height:6px;
  border-radius:999px;
  background: rgba(255,255,255,.08);
  overflow:hidden;
}

.progressfill{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.chip{
  padding:6px 10px;
  border-radius:999px;
  background: rgba(0,0,0,.18);
  border:1px solid rgba(255,255,255,.08);
  font-size:12px;
  white-space:nowrap;
}

.topbar-actions{
  display:flex;
  gap:10px;
  align-items:center;
}

.brand{display:flex; gap:12px; align-items:center}
.logo{
  width:40px;height:40px;border-radius:12px;
  display:grid;place-items:center;
  background: linear-gradient(135deg, rgba(124,92,255,.9), rgba(53,208,186,.7));
  box-shadow: 0 10px 25px rgba(124,92,255,.25);
  font-weight:800;
}
.brand-title{font-weight:800; letter-spacing:.2px}
.brand-sub{font-size:12px;color:var(--muted); margin-top:2px}

.topbar-actions{display:flex; gap:10px; align-items:center; flex-wrap:wrap}

.btn{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.08);
  color:var(--text);
  padding:10px 12px;
  border-radius: 12px;
  cursor:pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover{transform: translateY(-1px); background: rgba(255,255,255,.11); border-color: rgba(255,255,255,.18)}
.btn:active{transform: translateY(0)}
.btn-ghost{background: transparent}
.filelike{
  border:1px dashed rgba(255,255,255,.16);
  padding:10px 12px;
  border-radius: 12px;
  cursor:pointer;
  color:var(--muted);
}
.filelike input{display:none}

.layout{
  display:grid;
  grid-template-columns: 1.25fr 2.5fr;
  gap:14px;
  padding:14px;
}
.panel{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
  min-height: calc(100vh - 86px);
}
.panel-head{
  padding:14px 16px;
  border-bottom:1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.15);
}
.panel-head h2{margin:0;font-size:16px}
.hint{margin-top:6px;color:var(--muted); font-size:12px}

.treewrap{padding:14px 10px 20px 12px; overflow:auto; height: calc(100vh - 150px)}
.video-card{padding:14px}
video{
  width:100%;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background:#000;
}
.video-tools{
  display:flex;
  gap:10px;
  align-items:center;
  margin-top:12px;
  flex-wrap: wrap;
}
.mini{flex:1; min-width: 160px; padding:10px 12px; border-radius: 14px;
  background: rgba(0,0,0,.18); border:1px solid rgba(255,255,255,.08)}
.mini-label{font-size:11px; color:var(--muted)}
.mini-value{font-size:13px; margin-top:4px; font-weight:700}


.chip-k{font-size:18px;font-weight:900}
.chip-v{font-size:12px;color:var(--muted)}

.card{
  margin:0 16px 14px;
  padding:12px;
  border-radius: 16px;
  background: rgba(0,0,0,.18);
  border:1px solid rgba(255,255,255,.08)
}
.card-head{display:flex;justify-content:space-between;gap:10px;align-items:flex-end}
.card h3{margin:0;font-size:14px}
.muted{color:var(--muted); font-size:11px}
.steps{margin:10px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px}
code{font-family: var(--mono); font-size: 11px; padding:2px 6px; border-radius: 10px; background: rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.10)}

/* Word cloud */
.wordcloud{display:flex; flex-wrap:wrap; gap:8px; margin-top:10px}
.wordcloud .w{
  padding:6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: var(--text);
  user-select:none;
}

/* Tree connectors */
.treeview ul{list-style:none; padding-left: 26px; margin:0}
.treeview li{position:relative; padding: 18px 0 0 22px}
.treeview li:before{
  content:"";
  position:absolute;
  top:-8px;
  left:4px;
  width:1px;
  height:100%;
  border-left: 2px dashed rgba(159,176,208,.45);
}
.treeview li:after{
  content:"";
  position:absolute;
  top:33px;
  left:4px;
  width:18px;
  border-top: 2px dashed rgba(159,176,208,.45);
}
.treeview li:last-child:before{height: 44px}

.node{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius: 14px;
  background: rgba(0,0,0,.18);
  border:1px solid rgba(255,255,255,.08);
  cursor:pointer;
  user-select:none;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.node:hover{transform: translateY(-1px); border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.06)}
.node:active{transform: translateY(0)}
.badge{
  width:30px;height:30px;border-radius: 999px;
  display:grid;place-items:center;
  font-weight:900;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}
.badge.locked{background: rgba(255,92,122,.18); border-color: rgba(255,92,122,.35)}
.badge.unlocked{background: rgba(255,204,102,.16); border-color: rgba(255,204,102,.35)}
.badge.mastered{background: rgba(66,227,139,.16); border-color: rgba(66,227,139,.35)}
.ntitle{font-weight:800; font-size:13px}
.nmeta{font-size:11px; color: var(--muted); margin-top:2px}
.ntext{display:flex; flex-direction:column; gap:2px}
.lockrow{display:flex; align-items:center; gap:8px; margin-left:auto}
.smallpill{
  padding:4px 8px;
  border-radius:999px;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  font-size:11px;
  color: var(--muted);
}

/* Watch button within tree nodes */
.watchbtn{
  padding:4px 8px;
  border-radius:8px;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  font-size:11px;
  color: var(--accent);
  cursor:pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.watchbtn:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.18);
}
.watchbtn:active{
  transform: translateY(0);
}

/* Modal sticky note */
.modal{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.6);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 100;
}
.hidden{display:none}
.sticky{
  width:min(520px, 92vw);
  background: linear-gradient(180deg, #fff7b0, #fff3a0);
  color:#1b1b1b;
  border-radius: 18px;
  box-shadow: 0 30px 70px rgba(0,0,0,.55);
  padding: 14px 14px 12px;
  border: 1px solid rgba(0,0,0,.12);
}
.sticky-top{display:flex; justify-content:space-between; align-items:center; gap:10px}
.sticky-title{display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-weight:900}
.pill{
  font-size:11px;
  padding:4px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.08);
  border: 1px solid rgba(0,0,0,.10);
}
.iconbtn{
  border:none;
  background: rgba(0,0,0,.08);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 12px;
  width:34px;
  height:34px;
  cursor:pointer;
}
.qtext{font-size:14px; margin:12px 0 10px; line-height:1.35}
.options{display:flex; flex-direction:column; gap:8px; margin:8px 0 12px}
.opt{
  display:flex; gap:10px; align-items:flex-start;
  padding:10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.55);
  cursor:pointer;
}
.opt input{margin-top:3px}
.sticky-actions{display:flex; gap:10px; justify-content:flex-end; align-items:center}
.feedback{margin-top:10px; font-size:12px}
.feedback.good{color:#0b6b34}
.feedback.bad{color:#9a1a2c}

/* Darker style for the quiz submit button on yellow sticky notes */
#submitAnswer{
  /* Dark base to contrast with the light sticky note background */
  background: rgba(0,0,0,0.75);
  color: var(--text);
  border: 1px solid rgba(0,0,0,0.25);
}
#submitAnswer:hover{
  background: rgba(0,0,0,0.85);
}

/* Style overrides for the topic cloud modal to improve readability */
#topicModal .modal-card{
  background: rgba(0,0,0,0.85);
  color: var(--text);
  padding: 20px;
  border-radius: 20px;
  max-width: 600px;
  width: 92vw;
  box-shadow: 0 20px 50px rgba(0,0,0,.6);
  border: 1px solid rgba(255,255,255,.12);
}
#topicModal .modal-head,
#topicModal .modal-body,
#topicModal .modal-foot{
  margin-bottom: 12px;
}
#topicModal .modal-title{
  font-size: 18px;
  font-weight: 900;
}
#topicModal .btn{
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  color: var(--text);
}
#topicModal .btn:hover{
  background: rgba(255,255,255,.18);
}

/*
  Standardize all buttons within pop‑ups (quiz sticky, wrong answer, resume, and topic
  modals) to use a dark background.  This improves contrast against the light
  sticky note backgrounds and aligns with the request for black buttons.
*/
#wrongModal .btn,
#resumeModal .btn,
#topicModal .btn,
.modal .sticky .btn{
  background: rgba(0,0,0,0.75) !important;
  color: var(--text) !important;
  border: 1px solid rgba(0,0,0,0.25) !important;
}
#wrongModal .btn:hover,
#resumeModal .btn:hover,
#topicModal .btn:hover,
.modal .sticky .btn:hover{
  background: rgba(0,0,0,0.85) !important;
}

/* Position the topic modal close button in the top‑right corner */
#topicModal .modal-head{
  position: relative;
  padding-right: 48px;
}
#topicModal #closeTopic{
  position: absolute;
  top: 10px;
  right: 10px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.6);
  color: var(--text);
  border-radius: 12px;
  padding: 6px 8px;
  cursor: pointer;
}

@media (max-width: 1100px){
  .layout{grid-template-columns: 1fr; }
  .panel{min-height:auto}
  .treewrap{height:auto; max-height: 420px}
}


/* Topic.Cloud modal */
.topic-nodes .tn{padding:10px;border:1px solid rgba(255,255,255,.12);border-radius:12px;margin:8px 0;cursor:pointer;background:rgba(255,255,255,.04)}
.topic-nodes .tn:hover{background:rgba(255,255,255,.07)}
.note{white-space:pre-wrap;line-height:1.4}
.divider{height:1px;background:rgba(255,255,255,.12);margin:12px 0}

/* Style equations (rendered as code elements) inside notes for better readability */
.note code{
  display:block;
  margin:4px 0;
  padding:4px 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.4;
}
