/* Autonomous-Driving Learning Atlas — single static stylesheet */

:root {
  --bg:        #0b1020;
  --bg-2:      #131a30;
  --panel:     #1b2444;
  --panel-2:   #243056;
  --line:      #38446b;
  --text:      #e6ecff;
  --text-dim:  #93a3cc;
  --accent:    #ff8a3d;
  --warn:      #ff6363;
  --good:      #4ade80;
  --link:      #90caf9;
  --kbd:       #2d3970;
  --shadow:    0 6px 30px rgba(0,0,0,0.45);
  --leftw:     280px;
  --rightw:    520px;
  --cmpw:      720px;
  --r:         8px;
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; height:100%; background:var(--bg); color:var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif; overflow:hidden; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
kbd { background:var(--kbd); border-radius:4px; padding:1px 6px; font-size:.85em; border:1px solid #4453a3; }

/* topbar ----------------------------------------------------------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display:flex; justify-content:space-between; align-items:center;
  padding: 8px 16px; background:linear-gradient(180deg,#161e3a, #0e1530);
  border-bottom: 1px solid var(--line); height: 50px;
}
.brand { display:flex; align-items:center; gap: 10px; }
.logo  { font-size: 22px; color: var(--accent); }
.title { font-weight: 700; font-size: 16px; }
.subtitle { font-size: 12px; color: var(--text-dim); margin-left: 4px; }
.topbar-actions { display:flex; gap: 8px; align-items:center; }
.topbar-actions input, .topbar-actions select, .topbar-actions button {
  background: var(--panel); color: var(--text); border:1px solid var(--line);
  border-radius: var(--r); padding: 6px 10px; font: inherit; cursor:pointer;
}
.topbar-actions input { width: 220px; }
.topbar-actions input::placeholder { color: var(--text-dim); }
.topbar-actions button:hover, .topbar-actions select:hover { background: var(--panel-2); }
.ghlink { padding: 6px 10px; border:1px solid var(--line); border-radius: var(--r); }

/* leftbar ---------------------------------------------------------- */
.leftbar {
  position: fixed; top: 50px; left: 0; bottom: 0; width: var(--leftw);
  background: var(--bg-2); border-right: 1px solid var(--line); padding: 10px 12px;
  overflow-y: auto; z-index: 20;
}
.leftbar h3 { font-size: 12px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: .08em; margin: 14px 4px 6px; }
.pb { width: 100%; text-align:left; padding: 8px 10px; margin: 3px 0;
  background: var(--panel); color: var(--text); border:1px solid var(--line);
  border-radius: var(--r); cursor: pointer; }
.pb:hover { background: var(--panel-2); }
.pb.active { background: var(--accent); color: #1a1a1a; border-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { background: var(--panel); color: var(--text); border:1px solid var(--line);
  border-radius: 20px; padding: 3px 9px; font-size: 12px; cursor: pointer; }
.chip.active { color:#1a1a1a; }
.chip[data-topic].active            { background: var(--chip-color, var(--accent)); border-color: transparent; }
.chip[data-phase].active            { background: #ffd166; border-color: transparent; color:#1a1a1a; }
.chip[data-tier].active             { background: #cbd5e1; border-color: transparent; color:#1a1a1a; }

.legend { list-style:none; padding:0; margin: 4px 0; font-size: 12px; color: var(--text-dim); }
.legend li { display:flex; align-items:center; gap: 6px; margin: 4px 0; }
.legend .ed { display:inline-block; width: 28px; height: 0; border-top: 2px solid #888; }
.legend .ed.prereq    { border-top-style: solid;  border-top-color:#9aa6c8; }
.legend .ed.covers    { border-top-style: dotted; border-top-color:#9aa6c8; }
.legend .ed.extends   { border-top-style: solid;  border-top-color:#90caf9; }
.legend .ed.parallel  { border-top-style: double; border-top-color:#4ade80; height: 4px; border-bottom: 2px solid #4ade80; border-top-width: 2px; }
.legend .ed.contrasts { border-top-style: dashed; border-top-color:#ff6363; }
.legend .ed.feeds     { border-top-style: dashed; border-top-color:#ffb74d; }
.legend .ed.implements{ border-top-style: dotted; border-top-color:#c084fc; }

#timeline { background: var(--panel); padding: 8px; border-radius: var(--r); }
#yearSlider { width: 100%; }
.yearrow { display:flex; justify-content:space-between; align-items:center; margin-top: 4px; }
.yearrow #yearLabel { font-weight: 700; color: var(--accent); }
.yearrow button { padding: 2px 8px; font-size: 12px; background: var(--panel-2); border:1px solid var(--line); color: var(--text); border-radius: 4px; cursor: pointer; }

.hint { font-size: 11.5px; color: var(--text-dim); margin-top: 18px; line-height: 1.6; }

/* main canvas ------------------------------------------------------ */
#cy {
  position: fixed; top: 50px; left: var(--leftw); right: 0; bottom: 0;
  background: radial-gradient(1200px 700px at 60% 30%, #18213f 0%, var(--bg) 80%);
}

/* rightbar (card detail) ------------------------------------------ */
.rightbar {
  position: fixed; top: 50px; right: 0; bottom: 0; width: var(--rightw); max-width: 90vw;
  background: var(--bg-2); border-left: 1px solid var(--line); z-index: 25;
  transform: translateX(100%); transition: transform .25s ease; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.rightbar.open { transform: translateX(0); }
.rightbar header { display:flex; align-items:center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); background: linear-gradient(180deg,#1c2547,#161e3a); }
.rightbar header #closeRight { background:transparent; border:0; color:var(--text-dim); font-size:22px; cursor:pointer; }
.rightbar header #cardTitle { font-weight: 700; font-size: 15px; }
.tabs { display:flex; border-bottom: 1px solid var(--line); }
.tab { background: transparent; border: 0; color: var(--text-dim); padding: 8px 14px; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); }
#cardBody { padding: 14px 18px 22px; overflow-y: auto; flex: 1; }
#cardBody h1, #cardBody h2, #cardBody h3 { color: var(--accent); }
#cardBody h2 { margin-top: 1.4em; font-size: 16px; }
#cardBody pre { background: #0a0e1d; color: #d6deff; padding: 10px; border-radius: 6px; overflow-x:auto; }
#cardBody code { background: #20284b; color: #d6deff; padding: 1px 4px; border-radius: 3px; }
#cardBody table { border-collapse: collapse; }
#cardBody th, #cardBody td { border: 1px solid var(--line); padding: 4px 8px; }
#cardBody blockquote { border-left: 4px solid var(--accent); margin: 1em 0; padding: 6px 14px;
  background: rgba(255,138,61,.07); color: #f1d8c2; }

#cardBody .meta { color: var(--text-dim); font-size: 12.5px; margin: 4px 0 10px; }
#cardBody .badge { display:inline-block; font-size:11px; padding:2px 6px; border-radius:10px;
  margin-right:4px; background: var(--panel-2); border:1px solid var(--line); color:var(--text); }
#cardBody .badge.spine { background: #2b6cb0; }
#cardBody .badge.S { background: #2c5282; }
#cardBody .badge.A { background: #38a169; }
#cardBody .badge.B { background: #4a5568; }

#cardBody .copybtn { float:right; background:var(--panel-2); color:var(--text);
  border:1px solid var(--line); padding:2px 8px; border-radius:4px; font-size:11px; cursor:pointer; }

/* compare pane ----------------------------------------------------- */
.comparepane {
  position: fixed; top: 50px; left: 50%; transform: translateX(-50%) translateY(-200%);
  width: var(--cmpw); max-width: 95vw; max-height: 80vh; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  z-index: 26; transition: transform .25s ease; display:flex; flex-direction:column;
}
.comparepane.open { transform: translateX(-50%) translateY(0); }
.comparepane header { display:flex; align-items:center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg,#1c2547,#161e3a); }
.comparepane header button { background:transparent; border:0; color:var(--text-dim); font-size:22px; cursor:pointer; }
.cmpgrid { display:grid; grid-template-columns: 1fr 1fr; gap: 0; flex: 1; overflow: hidden; }
.cmpcell { padding: 12px 16px; overflow-y: auto; border-right: 1px solid var(--line); }
.cmpcell:last-child { border-right: 0; }
.cmpcell em { color: var(--text-dim); }
.cmpcell h3 { color: var(--accent); margin: 0 0 8px; }
