/* RustCode Arena v3 — GitHub-Primer-inspired dark theme with a LeetCode-style workspace. */
:root {
  --bg0: #010409; --bg: #0d1117; --bg2: #161b22; --bg3: #21262d; --bg4: #30363d; --line: #30363d; --line2: #21262d;
  --fg: #e6edf3; --mut: #8b949e; --acc: #2f81f7; --acc2: #58a6ff;
  --ok: #3fb950; --okbtn: #238636; --okbtn2: #2ea043; --bad: #f85149; --warn: #d29922;
  --easy: #00b8a3; --med: #ffc01e; --hard: #ff375f; --rust: #dea584;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --kb: 0px; --lh: 24px; --r: 6px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overscroll-behavior: none;
  font: 14px/1.5 var(--sans); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: 16px; } /* no zoom-on-focus on iOS */
a { color: inherit; text-decoration: none; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: rgba(110,118,129,.4); padding: .15em .4em; border-radius: var(--r); word-break: break-word; }
.muted { color: var(--mut); } .small { font-size: 12px; } .hidden { display: none !important; } .spacer, .grow { flex: 1; }
.okc { color: var(--ok); } .bad { color: var(--bad); }
.oc { display: inline-flex; vertical-align: text-bottom; line-height: 0; }
.oc svg, .ci svg, .big-ic svg { display: block; }
.row-gap { display: flex; gap: 6px; align-items: center; }

/* buttons (Primer) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid rgba(240,246,252,.1); background: var(--bg3); border-radius: var(--r);
  padding: 5px 16px; min-height: 32px; cursor: pointer; font-weight: 500; font-size: 14px; touch-action: manipulation; white-space: nowrap; color: #c9d1d9; }
.btn:hover { background: var(--bg4); border-color: #8b949e; }
.btn:active { background: #282e33; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.green, .btn.primary { background: var(--okbtn); border-color: rgba(240,246,252,.1); color: #fff; }
.btn.green:hover { background: var(--okbtn2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--acc2); }
.btn.small { min-height: 28px; padding: 3px 12px; font-size: 12px; }
.iconbtn { background: none; border: 0; color: var(--mut); min-width: 32px; min-height: 32px; border-radius: var(--r); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; }
.iconbtn:hover { color: var(--fg); background: var(--bg3); }
.tool { background: transparent; border: 1px solid transparent; border-radius: var(--r); padding: 3px 8px; min-height: 28px; font-size: 12px; font-weight: 500; cursor: pointer; list-style: none; display: inline-flex; align-items: center; color: var(--mut); }
.tool:hover { background: var(--bg3); color: var(--fg); }
.tool::-webkit-details-marker { display: none; }

/* labels (GitHub issue-label style) */
.lbl { display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; line-height: 18px; padding: 0 7px; border-radius: 2em; border: 1px solid var(--line); color: var(--mut); white-space: nowrap; }
.lbl-green { color: #3fb950; border-color: rgba(63,185,80,.4); background: rgba(46,160,67,.15); }
.lbl-red { color: #ff7b72; border-color: rgba(248,81,73,.4); background: rgba(248,81,73,.1); }
.lbl-blue { color: var(--acc2); border-color: rgba(56,139,253,.4); background: rgba(56,139,253,.1); }
.lbl-easy { color: var(--easy); border-color: rgba(0,184,163,.4); background: rgba(0,184,163,.12); }
.lbl-medium { color: var(--med); border-color: rgba(255,192,30,.4); background: rgba(255,192,30,.12); }
.lbl-hard { color: var(--hard); border-color: rgba(255,55,95,.4); background: rgba(255,55,95,.12); }
.tag { color: #a5d6ff; border-color: rgba(56,139,253,.25); background: rgba(56,139,253,.08); }
.d-easy { color: var(--easy); } .d-medium { color: var(--med); } .d-hard { color: var(--hard); }
.diff { font-size: 13px; font-weight: 500; flex: none; }
.box { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); }
.pbar { display: block; width: 70px; height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; flex: none; }
.pbar > span { display: block; height: 100%; background: var(--ok); border-radius: 4px; }
.pbar.wide { width: 100%; margin: 8px 0 4px; }

/* login */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 14px; background: var(--bg); }
.login h1 { margin: 0; font-size: 24px; font-weight: 300; letter-spacing: -.5px; }
.login-card { width: 100%; max-width: 340px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.login-card label { font-weight: 500; }
.login-card input { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 12px; min-height: 40px; }
.login-card input:focus { border-color: var(--acc); outline: none; box-shadow: 0 0 0 3px rgba(47,129,247,.3); }
.login-card .btn { min-height: 40px; }
.error { color: var(--bad); min-height: 1.2em; margin: 0; font-size: 13px; }
.logo-mark { width: 32px; height: 32px; border-radius: 50%; background: var(--fg); color: var(--bg); display: inline-grid; place-items: center; flex: none; }
.logo-mark svg { width: 18px; height: 18px; stroke-width: 2; }
.logo-mark.big { width: 48px; height: 48px; } .logo-mark.big svg { width: 26px; height: 26px; }

/* app shell */
.page { height: 100dvh; display: flex; flex-direction: column; padding-left: var(--sal); padding-right: var(--sar); }
.gh-top { display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--sat)) 16px 10px; background: var(--bg0); border-bottom: 1px solid var(--line); flex: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #dea584, #b7410e); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; border: 1px solid var(--line); }
.appnav { display: flex; gap: 4px; }
.navlink { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--r); color: var(--fg); font-weight: 500; position: relative; }
@media (hover: hover) { .navlink:hover { background: var(--bg3); } }
.navlink .oc { color: var(--mut); }
.shell-main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 16px 40px; }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--sab)); transform: translate(-50%, 20px); background: var(--bg3); border: 1px solid var(--line); padding: 8px 14px; border-radius: var(--r); opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.narrow { max-width: 900px; margin: 0 auto; }
.page-h { font-size: 20px; font-weight: 600; margin: 4px 0 12px; display: flex; align-items: center; gap: 8px; }
.sec-h { font-size: 16px; font-weight: 400; margin: 22px 0 8px; }

/* problems page (LeetCode-like) */
.lc-layout { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.lc-side { display: flex; flex-direction: column; gap: 14px; }
.today { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card:hover { border-color: #8b949e; }
.card small { color: var(--mut); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.card b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.daily { border-color: rgba(47,129,247,.5); background: linear-gradient(135deg, rgba(47,129,247,.12), var(--bg2) 60%); }
.daily small { color: var(--acc2); }
.review { grid-column: 1 / -1; }
.rv { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line2); font-size: 13px; }
.plans { display: flex; gap: 10px; overflow-x: auto; margin-top: 14px; scrollbar-width: none; padding-bottom: 2px; }
.plans::-webkit-scrollbar { display: none; }
.plan { flex: 0 0 168px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
.plan:hover { border-color: var(--acc); }
.plan-n { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--acc2); font-weight: 600; }
.plan b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan .pbar { width: 100%; height: 6px; }
.tchips { display: flex; gap: 6px; overflow-x: auto; margin: 14px 0 10px; scrollbar-width: none; padding-bottom: 2px; }
.tchips::-webkit-scrollbar { display: none; }
.tchip { flex: none; border: 0; background: transparent; padding: 4px 8px; border-radius: 2em; font-size: 13px; color: var(--fg); cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 6px; min-height: 30px; }
.tchip:hover { background: var(--bg3); }
.tchip .cnt { background: var(--bg3); color: var(--mut); border-radius: 2em; padding: 0 6px; font-size: 11px; line-height: 18px; }
.tchip.on { background: var(--acc); color: #fff; } .tchip.on .cnt { background: rgba(255,255,255,.2); color: #fff; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.search-wrap { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 0 10px; color: var(--mut); min-height: 36px; }
.search-wrap:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(47,129,247,.3); }
.search { flex: 1; min-width: 0; background: none; border: 0; outline: none; padding: 6px 0; -webkit-appearance: none; color: var(--fg); }
.sel { background: var(--bg3); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 8px; min-height: 36px; font-size: 14px; }
.pick { min-height: 36px; color: var(--fg); }
.pick .oc { color: var(--ok); }
.ptable { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.pthead { display: none; }
.prow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 52px; background: var(--bg); }
.prow:nth-child(odd of .prow) { background: rgba(110,118,129,.07); }
.prow:hover { background: rgba(110,118,129,.15); }
.prow + .prow { border-top: 1px solid var(--line2); }
.mark { width: 20px; height: 20px; flex: none; display: grid; place-items: center; color: var(--mut); }
.mark.solved { color: var(--ok); }
.mark.tried:not(.solved) { color: var(--warn); }
.ptitle { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 500; }
.pt1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow:hover .pt1 { color: var(--acc2); }
.lcnum { color: var(--fg); }
.ptopics { font-size: 12px; color: var(--mut); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pacc { width: 52px; text-align: right; color: var(--mut); font-size: 13px; flex: none; font-variant-numeric: tabular-nums; }
.prow .diff { width: 58px; text-align: right; }
.count { font-size: 12px; margin: 8px 2px; }
.stats { display: flex; align-items: center; gap: 16px; padding: 14px; }
.ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; flex: none; display: grid; place-items: center; background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--bg3) 0); }
.ring span { width: 72px; height: 72px; border-radius: 50%; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 600; font-size: 20px; line-height: 1.1; }
.ring small { font-size: 10px; color: var(--mut); font-weight: 400; }
.stat-rows { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 13px; min-width: 0; }
.pr-row { display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 0 8px; }
.pr-row b { text-align: right; font-weight: 600; }
.pr-row .pbar { grid-column: 1 / -1; width: 100%; height: 4px; }
.pb-easy > span { background: var(--easy); } .pb-medium > span { background: var(--med); } .pb-hard > span { background: var(--hard); }
.streak { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--mut); }
.streak .oc { color: #f0883e; } .streak .oc svg { width: 22px; height: 22px; }
.streak b { font-size: 20px; color: var(--fg); line-height: 1.1; }
/* calendar */
.cal { padding: 12px; }
.cal-h { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cal-m { min-width: 100px; text-align: center; }
.cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cw { font-size: 11px; color: var(--mut); }
.cal-legend { margin-top: 8px; }
.daily-grid { display: grid; gap: 14px; margin-top: 14px; }

/* roadmap (study plan) */
.plan-hero { display: flex; gap: 16px; padding: 16px; align-items: flex-start; margin-bottom: 14px; background: linear-gradient(135deg, rgba(47,129,247,.1), var(--bg) 70%); }
.plan-hero h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.plan-hero p { margin: 0; }
.roadmap { display: flex; flex-direction: column; gap: 8px; }
.stage { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.stage[open] { border-color: #484f58; }
.stage summary { display: flex; align-items: center; gap: 10px; padding: 12px; cursor: pointer; list-style: none; background: var(--bg2); }
.stage summary::-webkit-details-marker { display: none; }
.sn { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; color: var(--mut); }
.sn.complete { background: var(--okbtn); border-color: var(--okbtn); color: #fff; }
.stitle { font-weight: 600; flex: 1; }
.srow { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line2); }
.srow:hover { background: rgba(110,118,129,.1); }
.srow .pt1 { flex: 1; }

/* profile (GitHub-like) */
.profile { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.pf-side { display: grid; grid-template-columns: 72px 1fr; gap: 4px 14px; align-items: center; }
.pf-avatar { grid-row: span 2; width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, #dea584, #b7410e); display: grid; place-items: center; font-size: 30px; font-weight: 700; color: #fff; border: 1px solid var(--line); }
.pf-name { margin: 0; font-size: 22px; font-weight: 600; display: flex; flex-direction: column; line-height: 1.25; }
.pf-handle { font-size: 16px; font-weight: 300; }
.pf-lang { display: flex; align-items: center; gap: 6px; color: var(--mut); }
.lang-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--rust); display: inline-block; border: 1px solid rgba(255,255,255,.15); }
.pf-stats { grid-column: 1 / -1; list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--mut); }
.pf-stats li { display: flex; align-items: center; gap: 4px; }
.pf-stats b { color: var(--fg); font-weight: 600; }
.streaks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sbox { padding: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.sbox .oc { color: #f0883e; }
.sbox b { font-size: 24px; font-weight: 600; line-height: 1.1; }
.sbox small { color: var(--mut); font-size: 12px; }
.pins { display: grid; grid-template-columns: 1fr; gap: 12px; }
.pin { padding: 14px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.pin:hover { border-color: #8b949e; }
.pin-h { display: flex; align-items: center; gap: 8px; color: var(--mut); }
.pin-t { color: var(--acc2); font-weight: 600; flex: 1; }
.pin:hover .pin-t { text-decoration: underline; }
.pin p { margin: 0; }
.pin .pbar { width: 100%; height: 6px; }
.pin-f { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.pin-f > span:last-child { margin-left: 12px; display: flex; align-items: center; gap: 3px; }
.heat { padding: 14px 16px; margin-top: 18px; }
.heat-h { font-size: 15px; font-weight: 400; margin: 0 0 10px; }
.heat-scroll { overflow-x: auto; scrollbar-width: thin; }
.heat-in { width: max-content; }
.heat-months { display: grid; margin-left: 32px; font-size: 11px; color: var(--mut); height: 16px; }
.heat-months span { white-space: nowrap; }
.heat-body { display: flex; gap: 4px; }
.heat-days { display: grid; grid-template-rows: repeat(7, 10px); gap: 3px; font-size: 10px; width: 28px; line-height: 10px; }
.heat-grid { display: grid; grid-template-rows: repeat(7, 10px); grid-auto-flow: column; grid-auto-columns: 10px; gap: 3px; }
.hc { width: 10px; height: 10px; border-radius: 2px; background: #161b22; outline: 1px solid rgba(27,31,35,.06); outline-offset: -1px; display: inline-block; }
.hc.l1 { background: #0e4429; } .hc.l2 { background: #006d32; } .hc.l3 { background: #26a641; } .hc.l4 { background: #39d353; }
.heat-grid .hc.l0 { background: #161b22; box-shadow: inset 0 0 0 1px rgba(240,246,252,.05); }
.heat-legend { display: flex; align-items: center; gap: 3px; justify-content: flex-end; margin-top: 8px; }
.commits { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.commit { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg); }
.commit + .commit { border-top: 1px solid var(--line2); }
.commit:hover { background: rgba(110,118,129,.08); }
.ci { flex: none; } .ci.st-accepted { color: var(--ok); }
.ci.st-wrong_answer, .ci.st-runtime_error, .ci.st-time_limit, .ci.st-error { color: var(--bad); } .ci.st-compile_error { color: var(--warn); }
.cmain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ctitle { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctitle:hover { color: var(--acc2); text-decoration: underline; }
.cmeta { font-size: 12px; color: var(--mut); }
.sha { background: none; color: var(--mut); font-size: 12px; border: 1px solid var(--line); padding: 1px 6px; }
.st { font-weight: 600; } .st-accepted { color: var(--ok); } .st-wrong_answer, .st-runtime_error, .st-time_limit, .st-error { color: var(--bad); } .st-compile_error { color: var(--warn); }
.blank { padding: 28px 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.big-ic { color: var(--mut); } .big-ic svg { width: 32px; height: 32px; }

/* problem page */
.prob-page { overflow: hidden; background: var(--bg0); }
.topbar { display: flex; align-items: center; gap: 8px; padding: calc(6px + var(--sat)) 10px 6px; background: var(--bg0); border-bottom: 1px solid var(--line); flex: none; min-height: 48px; }
.brand.mini, .crumb { display: none; }
.crumb { color: var(--fg); font-weight: 600; padding: 4px 8px; border-radius: var(--r); }
.crumb:hover { background: var(--bg3); }
.ptitle-top { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ptitle-top .tname { overflow: hidden; text-overflow: ellipsis; }
.tnum { color: var(--mut); flex: none; }
.solved-badge { color: var(--ok); flex: none; display: inline-flex; }
.timer { font-family: var(--mono); background: var(--bg3); border: 1px solid var(--line); border-radius: var(--r); padding: 3px 10px; min-height: 30px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; color: var(--mut); cursor: pointer; }
.timer.on { border-color: var(--acc); color: var(--acc2); }
/* phone: segmented control Description / Code / Result */
.tabs { display: flex; margin: 8px 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; flex: none; }
.tabs button { flex: 1; background: none; border: 0; border-radius: 6px; padding: 6px 4px; min-height: 34px; color: var(--mut); font-weight: 500; position: relative; display: flex; align-items: center; justify-content: center; }
.tabs button.on { color: var(--fg); background: var(--bg4); box-shadow: 0 1px 0 rgba(0,0,0,.3); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 6px; background: currentColor; }
.dot.st-accepted { background: var(--ok); } .dot.st-compile_error { background: var(--warn); }
.dot.st-wrong_answer, .dot.st-runtime_error, .dot.st-time_limit, .dot.st-error { background: var(--bad); }
.workspace { flex: 1; min-height: 0; display: flex; position: relative; }
.pane { display: none; flex: 1; min-width: 0; min-height: 0; background: var(--bg); }
.workspace[data-tab="desc"] .p-desc, .workspace[data-tab="code"] .p-code, .workspace[data-tab="results"] .p-results { display: flex; flex-direction: column; }
/* underline tabs (GitHub) */
.utabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); background: var(--bg2); flex: none; overflow-x: auto; scrollbar-width: none; }
.utabs::-webkit-scrollbar { display: none; }
.utabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 8px; min-height: 40px; color: var(--mut); font-weight: 500; font-size: 13px; display: flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.utabs button:hover { color: var(--fg); }
.utabs button.on { color: var(--fg); border-bottom-color: #f78166; font-weight: 600; }
.lbody, .pbody { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 16px 24px; }
.desc { width: 100%; }
.desc h2 { font-size: 20px; font-weight: 600; margin: 0 0 10px; }
.desc h3 { font-size: 16px; margin: 0 0 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.lc-link { font-size: 12px; color: var(--acc2); margin-left: auto; display: inline-flex; gap: 4px; align-items: center; }
.md { font-size: 14px; line-height: 1.6; }
.md p { margin: 0 0 12px; }
.ex-h { font-weight: 600; margin: 14px 0 6px; }
.example { border-left: 2px solid var(--line); padding: 2px 0 2px 12px; margin: 0 0 10px; font-size: 13.5px; display: flex; flex-direction: column; gap: 3px; color: #c9d1d9; }
.example .mono { color: var(--fg); }
h4 { margin: 18px 0 8px; font-size: 14px; }
.cons { margin: 0; padding-left: 20px; font-size: 13px; }
.cons li { margin-bottom: 4px; }
.desc-foot { margin-top: 18px; display: flex; gap: 8px; }
.notes-d { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; }
.notes-d summary, .hint-d summary { cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: 6px; list-style: none; }
.notes-d summary::-webkit-details-marker, .hint-d summary::-webkit-details-marker { display: none; }
.notes { width: 100%; min-height: 110px; margin-top: 8px; background: var(--bg0); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; resize: vertical; }
.cx { display: inline-flex; gap: 8px; align-items: baseline; border: 1px solid var(--line); border-radius: var(--r); padding: 6px 12px; font: 13px var(--mono); background: var(--bg2); }
.cx span { color: var(--mut); text-transform: uppercase; font: 600 11px var(--sans); letter-spacing: .05em; }
.hints { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.hint-d { padding: 10px 12px; } .hint-d + .hint-d { border-top: 1px solid var(--line2); }
.hint-d[open] summary { color: var(--warn); }
.hint { padding: 8px 0 0 22px; font-size: 13.5px; }
.tips { padding-left: 20px; font-size: 13.5px; } .tips li { margin-bottom: 6px; }
.sol-h { display: flex; gap: 8px; align-items: center; }
.code-block { background: var(--bg0); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; overflow-x: auto; font: 13px/1.5 var(--mono); margin-top: 10px; }

/* editor */
.p-code { background: var(--bg); }
.code-head { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-bottom: 1px solid var(--line); background: var(--bg2); font-size: 12px; flex: none; min-height: 40px; }
.lang { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; padding: 0 6px; }
.lang .oc { color: var(--rust); }
.code-head .sync { flex: 1; text-align: right; padding-right: 6px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more { position: relative; }
.more .menu { position: absolute; right: 0; top: 34px; z-index: 30; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; width: 260px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 8px 24px rgba(1,4,9,.85); font-size: 13px; }
.mrow { display: flex; align-items: center; gap: 8px; }
.mrow > span { flex: 1; }
.ed-wrap { --fs: 14px; --lh: calc(var(--fs) * 1.6); flex: 1; min-height: 0; display: flex; position: relative; background: var(--bg); }
.gutter { margin: 0; padding: 10px 10px 40px 6px; text-align: right; color: #6e7681; font: var(--fs)/var(--lh) var(--mono); user-select: none; -webkit-user-select: none; background: var(--bg); min-width: 42px; overflow: hidden; flex: none; }
.gn.err { color: var(--bad); font-weight: 700; }
.ed-scroll { flex: 1; min-width: 0; overflow: auto; -webkit-overflow-scrolling: touch; position: relative; }
.prob-page:has(.keybar.show) .ed-scroll, .prob-page:has(.keybar.show) .gutter { padding-bottom: calc(var(--kb) + 210px); }
.ed-area { position: relative; min-width: 100%; width: max-content; min-height: 100%; }
.hl, .ta { margin: 0; padding: 10px 40px 40px 10px; font: var(--fs)/var(--lh) var(--mono); tab-size: 4; white-space: pre; letter-spacing: 0; word-spacing: 0; font-variant-ligatures: none; }
.hl { pointer-events: none; min-height: 100%; color: #e6edf3; }
.ta { position: absolute; inset: 0; width: 100%; height: 100%; resize: none; border: 0; outline: none; background: transparent; color: transparent; -webkit-text-fill-color: transparent; caret-color: #58a6ff; overflow: hidden; }
@supports (-webkit-touch-callout: none) { .ta, .hl, .gutter { font-size: max(16px, var(--fs)) !important; line-height: calc(max(16px, var(--fs)) * 1.6) !important; } }
.ed-wrap.wrap .gutter { display: none; }
.ed-wrap.wrap .ed-area { width: 100%; }
.ed-wrap.wrap .hl, .ed-wrap.wrap .ta { white-space: pre-wrap; word-break: break-all; padding-right: 10px; }
.ta::selection { background: rgba(56,139,253,.4); -webkit-text-fill-color: transparent; }
.l.err { background: rgba(248,81,73,.15); text-decoration: underline wavy rgba(248,81,73,.9); text-underline-offset: 4px; }
/* GitHub-dark-like syntax colors */
.tk { color: #ff7b72; } .tt { color: #ffa657; } .tf { color: #d2a8ff; } .ts { color: #a5d6ff; } .tn { color: #79c0ff; }
.tc { color: #8b949e; font-style: italic; } .tm { color: #d2a8ff; } .tl { color: #ffa657; }
.sugg { display: none; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 6px 8px; }
.sugg::-webkit-scrollbar { display: none; }
.sugg.show { display: flex; }
.sugg-desk { position: absolute; left: 54px; right: 12px; bottom: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); z-index: 5; box-shadow: 0 8px 24px rgba(1,4,9,.85); }
.sugg-kb { padding: 0 2px 5px; }
@media (hover: none) and (max-width: 899px) { .sugg-desk { display: none !important; } }
.sg { flex: none; border: 1px solid var(--line); background: var(--bg3); border-radius: var(--r); padding: 0 10px; height: 34px; font: 500 14px var(--mono); color: var(--fg); touch-action: manipulation; cursor: pointer; }
.sg-fn { color: #d2a8ff; } .sg-ty { color: #ffa657; } .sg-kw { color: #ff7b72; } .sg-snip { color: #7ee787; } .sg-var { color: var(--fg); }
.sg small { margin-left: 4px; opacity: .6; }

/* testcase / result panel */
.p-results { background: var(--bg); }
.casetabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.ctab { border: 0; background: transparent; color: var(--mut); border-radius: var(--r); padding: 4px 12px; min-height: 30px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.ctab:hover { background: var(--bg3); color: var(--fg); }
.ctab.on { background: var(--bg3); color: var(--fg); }
.ctab .cdot { width: 6px; height: 6px; }
.hp { margin-left: 4px; }
.tcase { display: flex; flex-direction: column; gap: 6px; }
.tc-l { font-size: 12px; color: var(--mut); }
.tc-v { background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 12px; white-space: pre-wrap; word-break: break-all; }
.tcase .btn { align-self: flex-start; margin-top: 4px; padding-left: 0; }
.custom { display: flex; flex-direction: column; gap: 8px; }
.carg { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--mut); }
.carg-in { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-family: var(--mono); color: var(--fg); }
.carg-in:focus { border-color: var(--acc); outline: none; }
.custom .btn { align-self: flex-start; }
.results { width: 100%; }
.empty, .judging { padding: 30px 6px; text-align: center; }
.judging { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--mut); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--acc); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 13px; margin-bottom: 12px; }
.banner b { font-size: 20px; font-weight: 600; }
.cerr { background: rgba(248,81,73,.06); border: 1px solid rgba(248,81,73,.35); border-radius: var(--r); margin-bottom: 10px; overflow: hidden; }
.cerr-h { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.err-msg { flex: 1; font-weight: 600; color: #ffa198; }
.goto { background: var(--bg3); color: var(--fg); }
.explain { background: rgba(56,139,253,.08); border-top: 1px solid rgba(56,139,253,.25); padding: 8px 10px; font-size: 13px; }
.explain b { color: var(--acc2); display: flex; align-items: center; gap: 4px; }
.explain p { margin: 4px 0 0; }
.raw summary { padding: 6px 10px; font-size: 12px; color: var(--mut); cursor: pointer; }
.rendered { margin: 0; padding: 10px; background: var(--bg0); font: 12px/1.45 var(--mono); overflow-x: auto; white-space: pre; }
.warns { margin-bottom: 10px; font-size: 13px; color: var(--mut); }
.cerr.lint { background: rgba(56,139,253,.05); border-color: rgba(56,139,253,.3); }
.st-lint b { color: var(--acc2); }
.cases { display: flex; flex-direction: column; gap: 8px; }
.case { font-size: 13px; }
.case-h { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.case-h .us { margin-left: auto; font-size: 12px; }
.cdot { width: 8px; height: 8px; border-radius: 50%; background: var(--mut); flex: none; display: inline-block; }
.cs-pass .cdot { background: var(--ok); } .cs-fail .cdot, .cs-panic .cdot { background: var(--bad); }
.io { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.io > span { color: var(--mut); font-size: 12px; }
.io code { display: block; white-space: pre-wrap; background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.io.panic code { color: #ffa198; }
mark { background: transparent; color: inherit; }
mark.bad { background: rgba(248,81,73,.3); color: #ffdcd7; border-radius: 3px; }
.ac-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 12px; }
.acs { padding: 12px; background: var(--bg2); }
.acs-h { color: var(--mut); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.acs-v { font-size: 22px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 40px; margin-top: 8px; }
.spark span { flex: 1; background: var(--acc); border-radius: 2px 2px 0 0; min-width: 2px; opacity: .85; }
.after-ac { display: flex; gap: 8px; margin-bottom: 10px; }
.st-accepted b, .banner.st-accepted b { color: var(--ok); }

/* bottom dock: Run / Submit bar + extra keys */
.dock { flex: none; display: flex; flex-direction: column; z-index: 40; }
.actionbar { display: flex; gap: 8px; align-items: center; padding: 8px 12px calc(8px + var(--sab)); background: var(--bg2); border-top: 1px solid var(--line); }
.ab-info { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actionbar .btn { min-height: 40px; padding: 5px 18px; }
.dock.kbd .actionbar { padding-bottom: 8px; }
.keybar { display: none; flex-direction: column; align-items: stretch; background: #1c2128; border-top: 1px solid var(--line); padding: 5px 4px; gap: 4px; }
.keybar.show { display: flex; }
.kb-fixed { display: flex; gap: 4px; flex: none; }
.kb-scroll { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.kb-scroll::-webkit-scrollbar { display: none; }
.kb-row { display: flex; gap: 4px; align-items: center; }
.kb-nav { margin-top: 1px; justify-content: space-between; }
.kb-nav .k { flex: 1; min-width: 0; }
.k { min-width: 40px; height: 40px; padding: 0 8px; border: 1px solid rgba(240,246,252,.08); border-radius: var(--r); background: var(--bg3); font: 500 16px var(--mono); color: var(--fg); flex: none; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.k:active { background: var(--acc); }
.kf { background: #262c36; color: var(--mut); font-size: 13px; }
.done { margin-left: 2px; }
@media (max-width: 899px) {
  .dock.kbd { position: fixed; left: 0; right: 0; bottom: var(--kb); }
  .ab-info { display: none; }
  .actionbar .btn { flex: 1; }
  /* bottom tab bar */
  .shell .appnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(1,4,9,.94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 4px 6px calc(4px + var(--sab)); gap: 0; }
  .shell .navlink { flex: 1; flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 0; color: var(--mut); min-height: 50px; justify-content: center; }
  .shell .navlink .oc svg { width: 20px; height: 20px; }
  .shell .navlink.on, .shell .navlink.on .oc { color: var(--fg); }
  .shell .navlink.on::before { content: ""; position: absolute; top: -5px; left: 30%; right: 30%; height: 2px; background: #f78166; border-radius: 2px; }
  .shell-main { padding-bottom: calc(80px + var(--sab)); }
  .lc-side { order: -1; } .lc-side .cal { display: none; }
  .lc-layout { gap: 12px; }
}
.pane { animation: fadein .14s ease-out; }
@keyframes fadein { from { opacity: .5; } to { opacity: 1; } }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }

/* desktop */
@media (min-width: 900px) {
  .gh-top { padding-left: 24px; padding-right: 24px; }
  .navlink.on { font-weight: 600; }
  .navlink.on::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -11px; height: 2px; background: #f78166; border-radius: 2px; }
  .shell-main { padding: 24px; }
  .lc-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .today { grid-template-columns: 1fr 1fr 1.4fr; } .review { grid-column: auto; }
  .pthead { display: flex; gap: 12px; padding: 8px 12px; color: var(--mut); font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--line); background: var(--bg2); }
  .c-st { width: 48px; } .c-title { flex: 1; } .c-acc { width: 64px; text-align: right; } .c-diff { width: 70px; text-align: right; }
  .prow .mark { width: 48px; justify-items: start; }
  .ptopics { display: none; }
  .ptitle { flex-direction: row; }
  .prow { min-height: 44px; }
  .pacc { width: 64px; } .prow .diff { width: 70px; }
  .daily-grid { grid-template-columns: 1fr 1fr; }
  .profile { grid-template-columns: 260px minmax(0, 1fr); gap: 28px; }
  .pf-side { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
  .pf-avatar { width: 240px; height: 240px; font-size: 96px; }
  .pf-stats { flex-direction: column; }
  .pins { grid-template-columns: 1fr 1fr; }
  .heat-in { width: auto; }
  /* problem workspace: description left, editor top-right, testcase/result bottom-right */
  .brand.mini, .crumb { display: inline-flex; }
  .brand.mini .logo-mark { width: 26px; height: 26px; }
  .topbar .back { display: none; }
  .ptitle-top { justify-content: center; }
  .tabs { display: none; }
  .workspace { display: grid; grid-template-columns: minmax(380px, 44%) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(200px, 38%); gap: 8px; padding: 8px; }
  .pane { display: flex !important; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; animation: none; }
  .workspace .p-desc { grid-column: 1; grid-row: 1 / 3; }
  .workspace .p-code { grid-column: 2; grid-row: 1; }
  .workspace .p-results { grid-column: 2; grid-row: 2; }
  .dock { background: var(--bg0); }
  .actionbar { background: var(--bg0); border-top: 0; padding: 0 8px 8px; justify-content: flex-end; }
  .ab-info { text-align: left; }
  .keybar { display: none !important; }
}
.today { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
@media (max-width: 899px) { .search-wrap { flex-basis: 100%; } .filters .sel { flex: 1; } }

/* ——— v4 polish: identity, motion, XP, palette, terminal ——— */
:root {
  --rust: #f97316; --rust2: #fb923c; --claw: #c2410c;
}
.logo-mark { background: transparent !important; color: inherit; width: 32px; height: 32px; border-radius: 6px; overflow: hidden; }
.logo-mark svg { width: 100%; height: 100%; }
.logo-mark.big { width: 48px; height: 48px; }
.brand-t { font-weight: 600; letter-spacing: -.02em; display: inline-flex; gap: 0; }
.brand-a { font-weight: 400; color: var(--mut); margin-left: 1px; }
.btn.green, .btn.primary { background: var(--rust); border-color: rgba(240,246,252,.12); }
.btn.green:hover { background: #ea580c; }
#submit-btn.btn.green { background: var(--okbtn); }
#submit-btn.btn.green:hover { background: var(--okbtn2); }
.lang .oc { color: var(--rust); }
.tchip.on { background: var(--rust); }
.navlink.on::after, .shell .navlink.on::before, .utabs button.on { border-bottom-color: var(--rust); }
.utabs button.on { border-bottom-color: var(--rust); color: var(--fg); }
.daily { border-color: rgba(249,115,22,.45); background: linear-gradient(135deg, rgba(249,115,22,.1), var(--bg2) 60%); }
.daily small { color: var(--rust2); }
.kbtn { display: none; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; min-height: 32px; color: var(--mut); font-size: 13px; cursor: pointer; margin-right: 4px; }
.kbtn kbd { background: var(--bg3); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font: 11px var(--mono); margin-left: 12px; color: var(--mut); }
.lvl-chip { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid rgba(249,115,22,.4); color: var(--rust2); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (min-width: 900px) { .kbtn { display: inline-flex; } }

/* skeletons */
.skel { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.sk { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.sk-h { height: 22px; width: 55%; } .sk-lbl { width: 30%; height: 18px; border-radius: 999px; } .sk-s { width: 70%; } .sk-box { height: 72px; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* empty states */
.empty, .blank { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 16px; text-align: center; }
.empty-ic { color: var(--mut); opacity: .7; }
.empty-ic svg { width: 28px; height: 28px; }
.empty b, .blank b { font-weight: 600; }

/* cargo terminal */
.term { background: #0a0c10; border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; font: 12.5px/1.55 var(--mono); margin-bottom: 14px; overflow-x: auto; }
.term .tl { white-space: pre; opacity: 0; animation: typein .25s ease forwards; }
.term.running .tl { opacity: 1; animation: none; }
.tok { color: #3fb950; font-weight: 600; } .tbad { color: #f85149; font-weight: 600; } .twarn { color: #d29922; }
.cg { color: #58a6ff; } .dim { color: #6e7681; }
.caret { display: inline-block; width: .6ch; background: var(--rust); margin-left: 2px; animation: blink 1s step-end infinite; vertical-align: -1px; height: 1em; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes typein { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.tprog { display: flex; gap: 3px; margin-top: 10px; height: 4px; }
.tprog span { flex: 1; border-radius: 2px; background: var(--bg3); animation: fillin .5s ease forwards; opacity: .35; }
@keyframes fillin { to { background: var(--rust); opacity: 1; } }
.tsum { margin-top: 6px; padding-top: 6px; border-top: 1px solid #21262d; }

/* accepted celebration — abstract, no mascot */
.ac-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; position: relative; overflow: hidden; border: 1px solid rgba(63,185,80,.35); background: rgba(46,160,67,.08); border-radius: 6px; padding: 14px 16px; }
.ac-hero b { font-size: 18px; color: var(--ok); display: block; }
.ac-flash { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(63,185,80,.6); animation: pulse 1.4s ease-out 2; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63,185,80,.55); } 70% { box-shadow: 0 0 0 14px rgba(63,185,80,0); } 100% { box-shadow: 0 0 0 0 rgba(63,185,80,0); } }
.confetti { pointer-events: none; position: absolute; inset: 0; overflow: hidden; z-index: 5; }
.confetti span { position: absolute; top: -8px; width: 6px; height: 10px; border-radius: 1px; opacity: .9; animation: fall 1.1s ease-in forwards; }
@keyframes fall {
  to { transform: translate3d(var(--dx), 110%, 0) rotate(var(--rot)); opacity: 0; }
}
.p-results { position: relative; }

/* XP + badges */
.xp { display: flex; gap: 14px; align-items: center; padding: 14px; margin-bottom: 18px; }
.xp-lv { width: 56px; height: 56px; border-radius: 12px; background: linear-gradient(145deg, var(--rust), #c2410c); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; flex: none; }
.xp-n { font-size: 22px; font-weight: 700; line-height: 1; } .xp-lv small { font-size: 10px; opacity: .85; text-transform: uppercase; letter-spacing: .06em; }
.xp-t { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.xpbar > span { background: linear-gradient(90deg, var(--rust), var(--rust2)); }
.tnum { font-variant-numeric: tabular-nums; font-family: var(--mono); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.badge { border: 1px solid var(--line); border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 4px; background: var(--bg); opacity: .4; filter: grayscale(1); }
.badge.got { opacity: 1; filter: none; border-color: rgba(249,115,22,.35); }
.badge b { font-size: 13px; } .badge small { font-size: 11px; line-height: 1.3; }
.bhex { width: 32px; height: 32px; border-radius: 8px; background: var(--bg3); display: grid; place-items: center; color: var(--rust2); }
.badge.got .bhex { background: rgba(249,115,22,.15); }

/* skill-path roadmap */
.roadmap.path { position: relative; padding-left: 8px; }
.roadmap.path::before { content: ""; position: absolute; left: 23px; top: 20px; bottom: 20px; width: 2px; background: linear-gradient(var(--rust), var(--line)); opacity: .35; }
.roadmap.path .stage { position: relative; margin-left: 20px; transition: border-color .2s ease, transform .2s ease; }
.roadmap.path .stage .sn { position: absolute; left: -32px; top: 12px; z-index: 1; background: var(--bg); box-shadow: 0 0 0 4px var(--bg); transition: transform .25s ease, background .25s ease; }
.roadmap.path .stage.complete .sn { background: var(--okbtn); border-color: var(--okbtn); color: #fff; }
.roadmap.path .stage.current .sn { border-color: var(--rust); color: var(--rust2); animation: nod 2.4s ease-in-out infinite; }
@keyframes nod { 50% { transform: scale(1.08); } }

/* command palette */
.pal-back { position: fixed; inset: 0; z-index: 80; background: rgba(1,4,9,.65); backdrop-filter: blur(4px); display: flex; justify-content: center; padding: 12vh 16px 16px; }
.palette { width: 100%; max-width: 560px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 48px rgba(0,0,0,.55); overflow: hidden; height: fit-content; max-height: 70vh; display: flex; flex-direction: column; animation: pop .16s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--mut); }
.pal-in input { flex: 1; background: none; border: 0; outline: none; font-size: 16px; color: var(--fg); }
.pal-in kbd { font: 11px var(--mono); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.pal-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; cursor: pointer; color: var(--fg); }
.pal-item.on, .pal-item:hover { background: rgba(47,129,247,.15); }
.pal-item .oc { color: var(--mut); }
.pal-foot { padding: 8px 14px 10px; border-top: 1px solid var(--line); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pal-foot kbd { font: 11px var(--mono); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; margin-right: 2px; }

/* micro tab / pane motion */
.pane { animation: fadein .16s ease; }
.utabs button { transition: color .15s ease, border-color .15s ease; }
.btn, .tool, .chip, .tchip, .ctab, .prow, .card, .plan, .pin { transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease; }
.btn:active:not(:disabled), .k:active { transform: scale(.97); }
.prow:hover .mark.solved { transform: scale(1.1); }
.mark { transition: transform .15s ease; }

/* skip link + a11y */
.skip { position: absolute; left: -9999px; top: 0; background: var(--acc); color: #fff; padding: 8px 14px; z-index: 100; border-radius: 0 0 6px 0; }
.skip:focus { left: 0; }
:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .confetti, .caret, .tprog span { display: none !important; }
  .term .tl { opacity: 1; animation: none; }
}
.brand-a { margin-left: 4px; }
.streaks { margin-bottom: 12px; }
.ac-hero b { font-size: 16px; }

/* ═══════════ v5: desktop layout + sleek motion ═══════════ */
:root { --ease: cubic-bezier(.2,.8,.2,1); --g1: 16px; --g2: 24px; --maxw: 1320px; }
@property --pp { syntax: "<number>"; inherits: false; initial-value: 0; }

.container { max-width: var(--maxw); margin: 0 auto; width: 100%; }
.shell-main { padding: 24px clamp(16px, 3vw, 32px) 48px; }

/* hero row: 12-col grid */
.hero-row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--g1); align-items: stretch; }
.hero-row > * { min-width: 0; }
.hero-row .daily-hero { grid-column: span 12; }
.hero-row #progress-card, .hero-row .cont { grid-column: span 12; }
.plans-row { margin-top: var(--g2); }
.plans-row .plans { margin-top: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--g1); overflow: visible; }
.plans-row .plan { flex: none; min-height: 112px; }
.desk-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--g2); margin-top: var(--g2); align-items: start; }
.lc-main > .tchips:first-child { margin-top: 0; }
.sticky-side { display: flex; flex-direction: column; gap: var(--g1); }

/* daily hero card */
.daily-hero { padding: 20px 22px; gap: 12px; position: relative; isolation: isolate; border-radius: 10px; }
.daily-hero:hover { transform: translateY(-2px); }
.dh-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dh-kicker { display: inline-flex; align-items: center; gap: 6px; color: var(--rust2); font-weight: 600; font-size: 13px; }
.dh-title { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -.015em; color: var(--fg); white-space: normal; }
.dh-title.sm { font-size: 16px; font-weight: 600; }
.dh-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dh-foot { display: flex; align-items: center; gap: 16px; margin-top: auto; padding-top: 4px; }
.dh-cd { display: inline-flex; align-items: center; gap: 6px; font: 500 13px var(--mono); color: var(--mut); font-variant-numeric: tabular-nums; }
.dh-streak { display: inline-flex; align-items: center; gap: 4px; }
.dh-streak .oc { color: #f0883e; } .dh-streak b { font-variant-numeric: tabular-nums; }
.dh-cta { margin-left: auto; min-width: 88px; }
.cont { padding: 18px; gap: 8px; border-radius: 10px; }
.cont small { color: var(--mut); }
.cont-cta { align-self: flex-start; margin-top: auto; padding-left: 0; }
.empty-cont .dh-title { color: var(--mut); }
#progress-card { border-radius: 10px; }
.review-box { padding: 14px; }
.review-box .rv:first-of-type { border-top: 0; }
.empty-mini { margin: 4px 0 0; }

/* animated gradient border on daily */
.glow-border::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; z-index: -1;
  background: conic-gradient(from var(--ang, 0deg), rgba(249,115,22,.0), rgba(249,115,22,.7), rgba(47,129,247,.55), rgba(249,115,22,.0) 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spinb 8s linear infinite; opacity: .8; pointer-events: none; }
@property --ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes spinb { to { --ang: 360deg; } }
.daily-hero { border-color: rgba(249,115,22,.25); }

/* card hover lift + glow (transform/opacity only for motion; border-color is paint-only) */
.card, .plan, .pin, .box.stats, .review-box, .cal, .badge.got { transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease); will-change: transform; }
@media (hover: hover) {
  .card:hover, .plan:hover, .pin:hover { transform: translateY(-2px); border-color: rgba(249,115,22,.45); box-shadow: 0 0 0 1px rgba(249,115,22,.12), 0 8px 24px rgba(1,4,9,.45); }
}

/* staggered entrance */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.route-anim { animation: rise .24s var(--ease) both; }
.anim-page .hero-row > *, .anim-page .plans .plan, .anim-page .sticky-side > *, .anim-page .daily-left > * { animation: rise .28s var(--ease) both; }
.hero-row > *:nth-child(2) { animation-delay: 40ms !important; } .hero-row > *:nth-child(3) { animation-delay: 80ms !important; }
.plans .plan:nth-child(1) { animation-delay: 100ms; } .plans .plan:nth-child(2) { animation-delay: 130ms; }
.plans .plan:nth-child(3) { animation-delay: 160ms; } .plans .plan:nth-child(4) { animation-delay: 190ms; }
.sticky-side > *:nth-child(1) { animation-delay: 120ms; } .sticky-side > *:nth-child(2) { animation-delay: 170ms; } .sticky-side > *:nth-child(3) { animation-delay: 220ms; }
.ptable .prow { animation: rise .22s var(--ease) both; }
.ptable .prow:nth-child(2) { animation-delay: 140ms; } .ptable .prow:nth-child(3) { animation-delay: 155ms; } .ptable .prow:nth-child(4) { animation-delay: 170ms; }
.ptable .prow:nth-child(5) { animation-delay: 185ms; } .ptable .prow:nth-child(6) { animation-delay: 200ms; } .ptable .prow:nth-child(7) { animation-delay: 215ms; }
.ptable .prow:nth-child(8) { animation-delay: 230ms; } .ptable .prow:nth-child(9) { animation-delay: 245ms; } .ptable .prow:nth-child(10) { animation-delay: 260ms; }
.ptable .prow:nth-child(n+11) { animation-delay: 275ms; }

/* animated ring + bars on mount */
.ring { --pp: 0; background: conic-gradient(var(--ok) calc(var(--pp) * 1%), var(--bg3) 0); animation: ringin .7s var(--ease) .1s both; }
@keyframes ringin { from { --pp: 0; } to { --pp: var(--p); } }
.pbar > span, .xpbar > span { transform-origin: left center; animation: barin .6s var(--ease) .15s both; }
@keyframes barin { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* sliding tab underline */
.utabs button { position: relative; border-bottom-color: transparent !important; }
.utabs button::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--rust); transform: scaleX(0); transition: transform .22s var(--ease); }
.utabs button.on::after { transform: scaleX(1); }
.navlink.on::after { animation: slidein .22s var(--ease) both; transform-origin: center; }
@keyframes slidein { from { transform: scaleX(.3); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }

/* toast slide */
.toast { transition: opacity .2s var(--ease), transform .24s var(--ease); transform: translate(-50%, 16px); }
.toast.show { transform: translate(-50%, 0); }

/* button press */
.btn, .tool, .iconbtn, .tchip, .ctab, .kbtn { transition: transform .12s var(--ease), background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease); }
.btn:active:not(:disabled), .tool:active, .iconbtn:active, .tchip:active, .ctab:active, .kbtn:active { transform: scale(.96); }

/* typography + alignment polish */
.page-h { font-size: 22px; letter-spacing: -.015em; margin: 0 0 var(--g1); }
.sec-h { font-weight: 600; font-size: 15px; }
.plan b { font-size: 15px; }
.plan-n { text-transform: none; letter-spacing: 0; font-size: 12px; }
.ptable { border-radius: 10px; }
.pthead { letter-spacing: .01em; }
.filters { gap: 8px; margin-bottom: 12px; }
.tchips { margin: 0 0 12px; }
.cal { padding: 16px; border-radius: 10px; }
.cal-h b { font-size: 14px; }
.cal .cal-h { flex-wrap: wrap; }

/* daily page */
.daily-desk { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--g2); }
.daily-left { display: flex; flex-direction: column; gap: var(--g1); }
.daily-left .daily-hero { min-height: 220px; }
.daily-left .daily-hero .dh-title { font-size: 28px; }
.phone-today-wrap { display: none; }

@media (min-width: 900px) {
  .hero-row .daily-hero { grid-column: span 6; min-height: 196px; }
  .hero-row #progress-card { grid-column: span 3; flex-direction: column; align-items: stretch; text-align: left; }
  .hero-row #progress-card .ring { align-self: center; }
  .hero-row #progress-card .streak { flex-direction: row; gap: 6px; justify-content: center; }
  .hero-row .cont { grid-column: span 3; }
  .desk-body { grid-template-columns: minmax(0, 1fr) 320px; }
  .sticky-side { position: sticky; top: 0; }
  .lc-side .cal { display: block; }
  .daily-desk { grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); align-items: start; }
  .daily-right { position: sticky; top: 0; }
}
@media (min-width: 900px) and (max-width: 1180px) {
  .hero-row .daily-hero { grid-column: span 12; }
  .hero-row #progress-card { grid-column: span 6; }
  .hero-row .cont { grid-column: span 6; }
  .plans-row .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .desk-body { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (min-width: 1600px) { :root { --maxw: 1360px; } }
@media (max-width: 899px) {
  .hero-row { gap: 12px; }
  .plans-row .plans { display: flex; overflow-x: auto; }
  .plans-row .plan { flex: 0 0 168px; }
  .sticky-side .cal { display: none; }
  .lc-side.sticky-side { order: 0; }
  .daily-hero .dh-title { font-size: 19px; }
  .dh-foot { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .glow-border::before { animation: none; }
  .ring { animation: none; --pp: var(--p); }
  .pbar > span, .xpbar > span { animation: none; transform: none; }
  .card:hover, .plan:hover, .pin:hover, .daily-hero:hover { transform: none; }
}
@media (max-width: 899px) {
  .daily-desk { display: grid; gap: 12px; }
  .daily-right { gap: 12px; }
  .phone-today { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .phone-today .daily-hero { min-height: 0; }
}
@media (min-width: 900px) {
  .phone-today-wrap { display: none !important; }
}
@media (max-width: 899px) { .daily-right .cal { display: block; } .sticky-side.daily-right .cal { display: block; } }
/* v5.1 calendar + daily alignment fixes */
.cal-g { overflow: hidden; }
.daily-left > * { width: 100%; }
.daily-left .cont { min-height: 140px; }
.desk-body .sticky-side { top: 16px; }
.daily-right { top: 16px; }
.hero-row #progress-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.hero-row #progress-card .stat-rows { width: 100%; }
.hero-row #progress-card .streak { margin-top: auto; }


/* ═══════════ v6 calendar (strict 7-col) + Daily HUD ═══════════ */
.cal { padding: 16px; border-radius: 10px; }
.cal-week, .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; width: 100%; }
.cal-week { margin: 4px 0 6px; }
.cal-week span { text-align: center; font-size: 11px; color: var(--mut); font-weight: 500; }
.cday { position: relative; min-width: 0; isolation: isolate; aspect-ratio: 1; width: 100%; max-width: none; display: grid; place-items: center; border-radius: 50%; box-sizing: border-box; margin: 0; padding: 0; font-size: 12px; line-height: 1; color: var(--fg); background: transparent; transform: none !important; }
.cday.blank { visibility: hidden; pointer-events: none; }
.cnum { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; color: inherit; text-decoration: none; font-variant-numeric: tabular-nums; z-index: 1; position: absolute; inset: 0; }
.cday.future { color: var(--mut); opacity: .45; }
.cday.future .cnum { pointer-events: none; cursor: default; }
/* decorations are absolute inside the cell — never affect grid flow */
.cday.today .cnum { background: var(--acc); color: #fff; font-weight: 600; }
.cday.solved:not(.today):not(.future)::before { content: ""; position: absolute; inset: 10%; border-radius: 50%; border: 2px solid var(--ok); pointer-events: none; z-index: 0; }
.cday.active:not(.today):not(.solved):not(.future)::after { content: ""; position: absolute; bottom: 14%; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--ok); pointer-events: none; z-index: 0; }
.cday.solved.today .cnum { box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
@media (hover: hover) {
  .cday:not(.blank):not(.future) .cnum:hover { background: var(--bg3); }
  .cday.today:not(.blank):not(.future) .cnum:hover { background: var(--acc); }
}
.cal-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; align-items: center; }
.lg { display: inline-flex; align-items: center; gap: 5px; }
.lg i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box; }
.lg-today { background: var(--acc); }
.lg-solved { border: 2px solid var(--ok); }
.lg-active { background: var(--ok); width: 6px !important; height: 6px !important; margin: 0 3px; }


/* Daily HUD */
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--g1); margin-bottom: var(--g2); }
.stile { min-width: 0; overflow-wrap: anywhere; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 10px; min-height: 88px; }
.stile .st-ic { color: var(--rust2); flex: none; margin-top: 2px; }
.stile .st-ic svg { width: 18px; height: 18px; }
.st-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-v { font-size: 22px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; }
.st-l { font-size: 13px; font-weight: 500; color: var(--fg); }
.daily-desk { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--g2); align-items: start; }
.daily-left { display: flex; flex-direction: column; gap: var(--g1); min-width: 0; }
.daily-big { position: relative; isolation: isolate; overflow-wrap: anywhere; padding: 22px 24px; gap: 12px; min-height: 280px; border-radius: 10px; }
.daily-big .dh-title { font-size: 28px; }
.dh-desc { margin: 0; color: #c9d1d9; font-size: 14px; line-height: 1.55; max-width: 62ch; }
.daily-big .dh-foot { flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.daily-big .dh-cta { margin-left: auto; min-height: 40px; padding: 0 18px; }
.past { padding: 14px 16px; border-radius: 10px; }
.past-list { list-style: none; margin: 0; padding: 0; }
.past-row { display: grid; grid-template-columns: 18px 48px minmax(0, 1fr) 64px auto; gap: 10px; align-items: center; padding: 10px 4px; border-top: 1px solid var(--line2); font-size: 13px; }
.past-list li:first-child .past-row { border-top: 0; }
.past-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.past-st { color: var(--mut); display: grid; place-items: center; }
.past-st.ok { color: var(--ok); }
.past-row:hover .past-t { color: var(--acc2); }
.daily-right { min-width: 0; display: flex; flex-direction: column; gap: var(--g1); }

@media (min-width: 900px) {
  .daily-desk { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 360px); }
  .daily-right { position: sticky; top: 16px; }
}
@media (max-width: 899px) {
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .daily-big { padding: 18px 16px; }
  .daily-big .dh-top { flex-wrap: wrap; }
  .daily-big .dh-title { font-size: 20px; }
  .past-row { grid-template-columns: 18px 40px minmax(0, 1fr) auto; }
  .past-row .diff { display: none; }
  .stile { min-height: 76px; padding: 12px; }
  .st-v { font-size: 18px; }
}
@media (max-width: 520px) {
  .stat-strip { grid-template-columns: 1fr 1fr; }
}
