/* Python Study Cards — home + dashboard: console panels, rank ladder, roadmap, dock */
html.hubhtml { height: auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: auto; }
body.hub { height: auto; min-height: 100%; overflow: visible; overscroll-behavior: auto; position: relative; -webkit-font-smoothing: antialiased; }
body.hub .foot { position: static; margin: 26px 0 6px; pointer-events: auto; }

.app-main {
  position: relative; max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 22px) 16px calc(env(safe-area-inset-bottom) + 104px);
}
.has-navbar .app-main { padding-top: 10px; padding-bottom: calc(env(safe-area-inset-bottom) + 40px); }
.view[hidden] { display: none; }

.large { padding: 0 0 20px; }
.hero { font: 800 clamp(28px, 8vw, 42px)/1.06 var(--mono); letter-spacing: -.035em; }
.grad { background: linear-gradient(90deg, var(--gold), #f0883e 60%, var(--red)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { color: var(--muted); font: 500 14px var(--mono); margin-top: 10px; }
.sub::before { content: "// "; color: #4d5663; }
.hero.with-logo { display: flex; align-items: center; gap: .32em; }
.hero-logo { flex: none; display: block; width: 1.9em; height: 1.9em; border-radius: 22%; box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 0 1px var(--line); }
.hero-text { min-width: 0; }
.hero-py { width: .9em; height: .9em; vertical-align: -.08em; margin-right: 6px; }

/* ---------- navbar for pushed screens ---------- */
.navbar {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: calc(env(safe-area-inset-top) + 6px) 14px 6px; min-height: 54px;
  border-bottom: 1px solid transparent; transition: background .2s ease, border-color .2s ease;
}
.navbar.scrolled { background: rgba(13,17,23,.85); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom-color: var(--line); }
.nav-back { display: inline-grid; place-items: center; width: 38px; height: 38px; justify-self: start; border-radius: 10px; text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--line); }
.nav-back svg { width: 20px; height: 20px; color: var(--gold); }
.nav-back:active { transform: scale(.94); }
.nav-title { font: 700 13px var(--mono); opacity: 0; transition: opacity .2s ease; color: var(--gold); }
.navbar.scrolled .nav-title { opacity: 1; }

.gh { font: 700 12px var(--mono); letter-spacing: .02em; color: var(--muted); margin: 30px 2px 12px; text-transform: lowercase; }
.gh::before { content: "## "; color: #4d5663; }

/* ---------- console panel: rank + stats + start ---------- */
.summary { border-radius: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0,0,0,.45); overflow: hidden; }
.summary .winbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #1b2130; border-bottom: 1px solid var(--line); font: 600 11px var(--mono); color: var(--muted); }
.winbar .dots { display: flex; gap: 6px; }
.winbar .dots i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.winbar .dots i:nth-child(2) { background: #febc2e; }
.winbar .dots i:nth-child(3) { background: #28c840; }
.sum-in { padding: 18px 18px 20px; }

.xp-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.rank { font: 800 20px var(--mono); letter-spacing: -.02em; }
.rank small { display: block; font: 600 11px var(--mono); color: var(--muted); letter-spacing: 0; margin-bottom: 4px; text-transform: uppercase; }
.xp-top b { font: 800 26px var(--mono); color: var(--gold); font-variant-numeric: tabular-nums; }
.xp-bar { --p: 0%; --on: var(--gold); height: 12px; border-radius: 3px; overflow: hidden;
  background: repeating-linear-gradient(90deg, #262d38 0 9px, transparent 9px 12px); }
.xp-bar i { display: block; height: 100%; width: var(--p); background: var(--on); transition: width .5s ease;
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 9px, transparent 9px 12px); mask: repeating-linear-gradient(90deg, #000 0 9px, transparent 9px 12px); }
.ladder { display: flex; justify-content: space-between; margin-top: 7px; font: 600 9px var(--mono); color: #5b6573; text-transform: uppercase; letter-spacing: .04em; }
.ladder .on { color: var(--gold); }

.nums { margin: 16px 0 14px; padding: 12px 14px; border-radius: 10px; background: #0a0d13; border: 1px solid var(--line); font: 600 14px/1.9 var(--mono); }
.nums > div { display: flex; justify-content: space-between; }
.nums span { color: var(--muted); }
.nums span::after { content: " ="; color: #4d5663; }
.nums b { font-variant-numeric: tabular-nums; }
.nums .k b { color: var(--green); } .nums .r b { color: var(--red); } .nums .s b { color: var(--gold); }
.sum-line { color: var(--muted); font: 500 12px var(--mono); margin-bottom: 16px; }

/* key-cap primary button */
.primary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 8px 18px; border-radius: 12px;
  background: var(--gold); color: #0d1117; text-decoration: none; font: 800 15px var(--mono);
  box-shadow: 0 5px 0 #a8801f, 0 14px 30px rgba(227,179,65,.18);
  transition: transform .1s ease, box-shadow .1s ease;
}
.primary:active { transform: translateY(4px); box-shadow: 0 1px 0 #a8801f; }
.p-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.p-ico { display: none; }
.p-left::before { content: "▶"; font-size: 13px; }
.primary > span:last-child { font-size: 20px; }

/* ---------- tracks (home) ---------- */
.tracks { display: flex; flex-direction: column; gap: 14px; }
.track {
  --accent: var(--gold);
  position: relative; display: block; padding: 16px 16px 14px 20px; border-radius: 14px; text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); overflow: hidden; transition: transform .12s ease, border-color .15s;
}
.track::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--accent); }
.track:active { transform: scale(.985); border-color: var(--accent); }
.track.soon { opacity: .55; border-style: dashed; }
.t-head { display: flex; align-items: center; gap: 14px; }
.t-badge { flex: none; width: 50px; height: 50px; border-radius: 12px; display: grid; place-items: center; background: #0a0d13; border: 1px solid var(--line); font: 800 18px var(--mono); color: var(--accent); }
.t-badge img { width: 30px; height: 30px; display: block; }
.t-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.t-title b { font: 800 19px/1.15 var(--mono); letter-spacing: -.02em; }
.t-title small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.t-go { font: 800 18px var(--mono); color: var(--accent); }
.t-bar { height: 6px; border-radius: 2px; overflow: hidden; margin: 14px 0 12px; background: repeating-linear-gradient(90deg, #262d38 0 7px, transparent 7px 9px); }
.t-bar i { display: block; height: 100%; background: var(--accent); -webkit-mask: repeating-linear-gradient(90deg, #000 0 7px, transparent 7px 9px); mask: repeating-linear-gradient(90deg, #000 0 7px, transparent 7px 9px); }
.t-chips { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.t-chips span { font: 600 11px var(--mono); color: var(--cyan); }
.t-chips span::before { content: "#"; color: #4d5663; }
.t-meta { margin-top: 12px; font: 600 11px var(--mono); color: var(--muted); }
.sticker { position: absolute; top: 10px; right: 12px; font: 800 10px var(--mono); padding: 3px 8px; border-radius: 5px; background: var(--gold); color: #0d1117; }

/* ---------- key legend ---------- */
.keys { border-radius: 14px; background: var(--panel); border: 1px solid var(--line); padding: 6px 4px; }
.keys div { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px dashed var(--line); }
.keys div:last-child { border-bottom: 0; }
.keys kbd { flex: none; min-width: 72px; text-align: center; font: 700 12px var(--mono); padding: 5px 9px; border-radius: 7px; color: var(--text); background: #232a37; border: 1px solid #3a4352; border-bottom-width: 3px; }
.keys b { font: 700 14px var(--sans); }
.keys span { margin-left: auto; font: 600 12px var(--mono); color: var(--muted); }
.keys .g span { color: var(--green); } .keys .rr span { color: var(--red); } .keys .st span { color: var(--gold); }

/* ---------- panels + rows ---------- */
.group { border-radius: 14px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; color: var(--text); text-decoration: none; background: none; border: 0; border-bottom: 1px solid var(--line); font: inherit; text-align: left; cursor: pointer; }
.row:last-child { border-bottom: 0; }
a.row:active { background: rgba(88,166,255,.1); }
.tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tx b { font: 700 15px/1.3 var(--sans); }
.tx small { font: 500 12px var(--mono); color: var(--muted); }
.chev { color: var(--gold); font: 700 20px var(--mono); line-height: 1; }
.row.off { opacity: .35; pointer-events: none; }

/* ---------- command rows (dashboard study actions) ---------- */
.cmds { display: flex; flex-direction: column; gap: 10px; }
.cmd-row { --c: var(--blue); display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-radius: 12px; text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--c); transition: transform .1s ease; }
.cmd-row:active { transform: scale(.985); }
.cmd-ic { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; font: 800 17px var(--mono); color: var(--c); background: color-mix(in srgb, var(--c) 14%, #0a0d13); }
.cmd-n { font: 800 26px var(--mono); color: var(--c); font-variant-numeric: tabular-nums; }
.cmd-row .tx b { font-family: var(--mono); font-size: 14px; }
.cmd-row.off { opacity: .5; pointer-events: none; }
.cmd-row.off .cmd-n { color: var(--muted); }

/* ---------- learning roadmap ---------- */
.road { position: relative; padding-left: 4px; }
.road::before { content: ""; position: absolute; left: 17px; top: 18px; bottom: 18px; width: 2px; background: repeating-linear-gradient(var(--line) 0 6px, transparent 6px 10px); }
.node { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 8px 8px 8px 0; text-decoration: none; color: var(--text); }
.node .dot { flex: none; z-index: 1; width: 28px; height: 28px; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; font: 800 12px var(--mono); background: var(--bg); border: 2px solid #4d5663; color: var(--muted); }
.node.part .dot { border-color: var(--gold); color: var(--gold); background: linear-gradient(90deg, rgba(227,179,65,.4) 50%, var(--bg) 50%); }
.node.done .dot { border-color: var(--green); background: var(--green); color: #0d1117; }
.node .card-n { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); transition: border-color .15s; }
.node:active .card-n { border-color: var(--gold); }
.node.done .card-n { border-color: rgba(63,185,80,.35); }
.node .card-n b { display: block; font: 700 15px/1.3 var(--sans); }
.node .card-n small { display: block; margin-top: 3px; font: 500 12px var(--mono); color: var(--muted); }
.node .row-bar { display: block; height: 4px; margin-top: 9px; border-radius: 2px; background: #262d38; overflow: hidden; }
.node .row-bar i { display: block; height: 100%; background: var(--green); }
.node.part .row-bar i { background: var(--gold); }

/* ---------- misc ---------- */
.clear { display: block; margin: 34px auto 0; min-height: 42px; padding: 0 20px; border-radius: 10px; cursor: pointer; font: 700 12px var(--mono); color: var(--red); background: transparent; border: 1px solid rgba(248,81,73,.4); }
.clear:active { transform: scale(.96); }
.empty-state { text-align: center; color: var(--muted); padding: 60px 24px; font: 500 13px var(--mono); }
.empty-state i { display: block; font-style: normal; font-size: 40px; margin-bottom: 10px; }
.empty-state b { display: block; color: var(--text); font: 800 17px var(--mono); margin-bottom: 4px; }
.note { text-align: center; color: var(--muted); font: 500 11px var(--mono); margin-top: 16px; }

/* ---------- bottom tab bar (docked, edge to edge) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(13,17,23,.94); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar-in { display: flex; width: 100%; max-width: 560px; }
.tab {
  position: relative; flex: 1; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: none; border: 0; cursor: pointer; font: 700 10px var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  transition: color .15s;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab:active svg { transform: scale(.9); }
.tab.on { color: var(--gold); }
.tab.on svg.fillable { fill: currentColor; }
.tab.on::before { content: ""; position: absolute; top: -1px; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
.badge { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font: 800 10px var(--mono); display: grid; place-items: center; }
.badge[hidden] { display: none; }
