/* v2 dashboard = the template DESIGN, driven by our REAL roadmap + features.
 * Scoped under #v2Home so it can't affect the rest of the app. Markup: renderV2TemplateDataVersion(). */

/* ============================================================================
   v2 HOME = the WHOLE page. The OLD app chrome (top header + left icon rail) is
   the "old dashboard" that was bleeding through behind/around the template. Force
   it OUT with display:none — NOT z-index (z-index "covering" is what bled). Scoped
   to the home screen via <html data-screen="home">, so sub-screens (stages/search/
   saved/profile) KEEP the rail+header and navigation still works.
   ============================================================================ */
/* Pure CSS, no JS timing: when the HOME screen is the visible one (its inline display is not
   "none"), the template owns the page → hide the old header + rail. On any sub-screen #screen-home
   gets inline display:none, the :has() stops matching, and the chrome returns. */
html[data-ui="v2"]:has(#screen-home:not([style*="none"])) .container > header,
html[data-ui="v2"]:has(#screen-home:not([style*="none"])) .container > .lrail { display: none !important; }
html[data-ui="v2"]:has(#screen-home:not([style*="none"])) .container { max-width: none !important; padding: 0 !important; margin: 0 !important; }

#v2Home{
  --bg:#060a14; --panel:rgba(13,20,36,.74); --panel2:rgba(17,26,46,.94);
  --bd:rgba(70,100,150,.28); --bd2:rgba(34,211,238,.45);
  --text:#eef4fb; --muted:#8593ab;
  --cyan:#28d4ee; --blue:#3b82f6; --green:#2bd66f; --amber:#f5a623; --purple:#a855f7; --red:#ef4d6a;
  --font:'Inter',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  /* fixed = full-bleed; lives inside #rbHome so it auto-hides with #screen-home (rail returns on
     sub-screens). z-index 60 covers the old header + left rail (z45) on the home screen. */
  position:fixed; inset:0; overflow-y:auto; z-index:60; color:var(--text); font-family:var(--font);
  background:
    radial-gradient(1100px 540px at 12% -8%, rgba(34,211,238,.10), transparent 60%),
    radial-gradient(1100px 600px at 88% -4%, rgba(168,85,247,.10), transparent 55%),
    linear-gradient(180deg,#0a1326 0%, #060a14 70%);
}
#v2Home *{box-sizing:border-box;}
#v2Home svg{display:block;}
#v2Home::-webkit-scrollbar{width:10px;}#v2Home::-webkit-scrollbar-thumb{background:#1b2738;border-radius:6px;}
#v2Home .shell{display:grid;grid-template-columns:240px 1fr 322px;grid-template-rows:auto auto;
  grid-template-areas:"head head head" "left main right";gap:14px;padding:14px;max-width:1580px;margin:0 auto;}
#v2Home .head{grid-area:head;}#v2Home .left{grid-area:left;}#v2Home .main{grid-area:main;}#v2Home .right{grid-area:right;}
#v2Home .panel{background:var(--panel);backdrop-filter:blur(12px);border:1px solid var(--bd);border-radius:14px;box-shadow:0 12px 34px rgba(0,0,0,.45);}
#v2Home .ph{font-size:11px;font-weight:800;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);margin-bottom:12px;}
#v2Home .btn{display:inline-flex;align-items:center;gap:7px;padding:9px 13px;border-radius:10px;border:1px solid var(--bd);background:rgba(34,211,238,.06);color:var(--text);font-size:13px;font-weight:600;cursor:pointer;}
#v2Home .btn:hover{border-color:var(--bd2);box-shadow:0 0 16px rgba(34,211,238,.15);}
#v2Home .ico{width:20px;height:20px;stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round;}

#v2Home .head{display:flex;align-items:center;gap:14px;flex-wrap:wrap;padding:12px 16px;}
#v2Home .burger{display:flex;flex-direction:column;gap:4px;cursor:pointer;}#v2Home .burger span{width:20px;height:2px;background:var(--muted);border-radius:2px;}
#v2Home .logo{width:48px;height:54px;position:relative;display:flex;align-items:center;justify-content:center;}
#v2Home .logo svg{position:absolute;inset:0;width:100%;height:100%;filter:drop-shadow(0 0 8px rgba(34,211,238,.5));}
#v2Home .logo b{position:relative;z-index:1;color:var(--cyan);font-weight:900;font-size:16px;}
#v2Home .title{font-weight:800;font-size:22px;letter-spacing:.3px;}
#v2Home .sub{font-size:11px;color:var(--cyan);letter-spacing:.16em;font-weight:700;}
#v2Home .stat{display:flex;align-items:center;gap:11px;padding:9px 14px;background:var(--panel2);border:1px solid var(--bd);border-radius:12px;min-width:108px;}
#v2Home .sic{width:34px;height:38px;position:relative;display:flex;align-items:center;justify-content:center;flex:none;}
#v2Home .sic svg.hexbg{position:absolute;inset:0;width:100%;height:100%;}
#v2Home .sic .ico{position:relative;width:17px;height:17px;}
#v2Home .lbl{font-size:10px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);}
#v2Home .val{font-size:18px;font-weight:800;line-height:1.05;}
#v2Home .vsub{font-size:10px;color:var(--muted);}
#v2Home .avatar{width:42px;height:42px;border-radius:50%;overflow:hidden;box-shadow:0 0 0 2px rgba(34,211,238,.5);background:linear-gradient(135deg,#26344a,#101a2e);display:block;cursor:pointer;}
#v2Home .avatar img,#v2Home .avatar svg{width:100%;height:100%;object-fit:cover;display:block;}

#v2Home .nav{display:flex;align-items:center;gap:11px;width:100%;padding:9px 11px;margin:3px 0;border-radius:10px;border:1px solid transparent;background:transparent;color:var(--text);font-size:13.5px;font-weight:600;cursor:pointer;text-align:left;}
#v2Home .nav:hover{background:rgba(255,255,255,.04);}
#v2Home .nav .nic{width:24px;height:24px;color:var(--muted);flex:none;}
#v2Home .nav.on{background:linear-gradient(135deg,rgba(34,211,238,.18),rgba(59,130,246,.08));border-color:var(--bd2);box-shadow:0 0 16px rgba(34,211,238,.15);}
#v2Home .nav.on .nic{color:var(--cyan);}
#v2Home .trow{display:flex;align-items:center;justify-content:space-between;padding:8px 0;font-size:13px;}
#v2Home .tog{width:38px;height:21px;border-radius:12px;background:#26344a;position:relative;border:none;cursor:pointer;flex:none;}
#v2Home .tog::after{content:'';position:absolute;top:2px;left:2px;width:17px;height:17px;border-radius:50%;background:#fff;}
#v2Home .tog.on{background:var(--cyan);box-shadow:0 0 10px rgba(34,211,238,.5);}#v2Home .tog.on::after{left:19px;}
#v2Home .reddot{width:9px;height:9px;border-radius:50%;background:var(--red);box-shadow:0 0 8px var(--red);}
#v2Home .sel{width:100%;padding:8px 10px;border-radius:9px;background:var(--panel2);border:1px solid var(--bd);color:var(--text);font-size:13px;}
#v2Home .ringwrap{position:relative;width:132px;height:132px;margin:0 auto;}
#v2Home .ringtxt{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;}
#v2Home .ringtxt .pct{font-size:27px;font-weight:800;}#v2Home .ringtxt .l{font-size:10px;color:var(--muted);}

#v2Home .legend{display:flex;gap:13px;flex-wrap:wrap;font-size:12px;color:var(--muted);align-items:center;}
#v2Home .dot{width:9px;height:9px;border-radius:50%;display:inline-block;margin-right:5px;}
#v2Home .dot.green{background:var(--green);}#v2Home .dot.blue{background:var(--blue);}#v2Home .dot.amber{background:var(--amber);}#v2Home .dot.grey{background:#3a4760;}
#v2Home .journey{position:relative;margin-top:18px;}
#v2Home .row{position:relative;z-index:1;display:flex;justify-content:space-between;margin-bottom:44px;}
#v2Home .row:last-child{margin-bottom:0;}
#v2Home .rowwire{position:absolute;left:8%;right:8%;top:74px;height:4px;border-radius:3px;background:linear-gradient(90deg,rgba(34,211,238,0) 0%,rgba(34,211,238,.95) 25%,rgba(59,130,246,.8) 50%,rgba(34,211,238,.95) 75%,rgba(34,211,238,0) 100%);background-size:230% 100%;animation:v2flow 2.6s linear infinite;box-shadow:0 0 22px rgba(34,211,238,.8);z-index:0;}
@keyframes v2flow{from{background-position:230% 0}to{background-position:-230% 0}}
@media (prefers-reduced-motion:reduce){#v2Home .rowwire{animation:none;}}
#v2Home .vwire{position:absolute;width:4px;height:44px;bottom:-44px;border-radius:3px;background:linear-gradient(180deg,rgba(34,211,238,.65),rgba(34,211,238,.2));box-shadow:0 0 14px rgba(34,211,238,.5);z-index:0;}
#v2Home .node{flex:1;display:flex;flex-direction:column;align-items:center;gap:7px;min-width:0;}
#v2Home .hexwrap{position:relative;width:138px;height:152px;cursor:pointer;transition:transform .15s,filter .15s;}
#v2Home .hexwrap:hover{transform:translateY(-4px);filter:brightness(1.15);}
#v2Home .hexwrap svg.hx{position:absolute;inset:0;width:100%;height:100%;}
#v2Home .hexin{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;}
#v2Home .hexin .ico{width:44px;height:44px;}
#v2Home .hnum{position:absolute;top:2px;left:50%;transform:translateX(-50%);min-width:24px;height:24px;padding:0 5px;border-radius:12px;background:#091222;border:2px solid currentColor;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:800;z-index:4;box-shadow:0 0 10px rgba(0,0,0,.6);}
#v2Home .badge{position:absolute;top:14px;right:26px;z-index:3;width:24px;height:24px;border-radius:50%;display:flex;align-items:center;justify-content:center;box-shadow:0 0 10px rgba(0,0,0,.4);}
#v2Home .badge svg{width:13px;height:13px;stroke:#04141a;stroke-width:3;fill:none;}
#v2Home .nt{font-weight:700;font-size:13px;text-align:center;line-height:1.2;}#v2Home .ns{font-size:10px;color:var(--muted);text-align:center;}
#v2Home .np{font-size:19px;font-weight:800;}
#v2Home .stars{display:flex;gap:2px;}#v2Home .stars svg{width:11px;height:11px;}
#v2Home .focus{background:var(--panel2);border:1px solid var(--bd);border-radius:13px;padding:15px;position:relative;overflow:hidden;}
#v2Home .focus .illus{position:absolute;right:8px;bottom:8px;opacity:.9;}
#v2Home .chip{font-size:11px;color:var(--muted);border:1px solid var(--bd);border-radius:8px;padding:6px 10px;text-align:center;}

#v2Home .bot{width:44px;height:44px;border-radius:12px;background:linear-gradient(135deg,#6d4bd0,#3b82f6);display:flex;align-items:center;justify-content:center;box-shadow:0 0 16px rgba(168,85,247,.45);}
#v2Home .bot svg{width:26px;height:26px;stroke:#fff;stroke-width:1.6;fill:none;}
#v2Home .msg{background:rgba(34,211,238,.07);border:1px solid var(--bd);border-radius:11px;padding:11px 13px;font-size:12.5px;line-height:1.5;color:#d6e2f2;}
#v2Home .act{display:flex;align-items:center;gap:11px;width:100%;padding:11px 12px;margin:7px 0;border-radius:10px;border:1px solid var(--bd);background:rgba(255,255,255,.02);color:var(--text);font-size:13px;font-weight:600;cursor:pointer;text-align:left;}
#v2Home .act:hover{border-color:var(--bd2);background:rgba(34,211,238,.06);}
#v2Home .act .aic{width:30px;height:30px;border-radius:8px;display:flex;align-items:center;justify-content:center;flex:none;}
#v2Home .act .aic svg{width:16px;height:16px;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round;}
#v2Home .searchwrap{position:relative;}#v2Home .searchwrap svg{position:absolute;left:10px;top:9px;width:16px;height:16px;stroke:var(--muted);stroke-width:2;fill:none;}
#v2Home .search{width:100%;padding:9px 12px 9px 34px;border-radius:10px;background:#0b1424;border:1px solid var(--bd);color:var(--text);font-size:13px;}
#v2Home .tabs{display:flex;gap:6px;flex-wrap:wrap;margin:10px 0;}
#v2Home .tab{padding:5px 12px;border-radius:18px;border:1px solid var(--bd);background:transparent;color:var(--muted);font-size:11px;font-weight:700;cursor:pointer;}
#v2Home .tab.on{background:rgba(34,211,238,.16);border-color:var(--bd2);color:var(--cyan);}
#v2Home .note{display:flex;align-items:center;gap:10px;padding:9px 0;border-top:1px solid var(--bd);cursor:pointer;}
#v2Home .nb{width:28px;height:28px;border-radius:7px;display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:800;flex:none;}
#v2Home .nt2{font-size:12.5px;font-weight:600;}#v2Home .ns2{font-size:10px;color:var(--muted);}

#v2Home .play{width:54px;height:54px;border-radius:50%;border:2px solid var(--cyan);cursor:pointer;background:rgba(34,211,238,.12);display:flex;align-items:center;justify-content:center;box-shadow:0 0 18px rgba(34,211,238,.4);}
#v2Home .play svg{width:20px;height:20px;fill:var(--cyan);}
#v2Home .bar{height:6px;border-radius:4px;background:#16233c;overflow:hidden;}
#v2Home .bar i{display:block;height:100%;background:linear-gradient(90deg,var(--cyan),var(--green));}
#v2Home .acard .ah{display:flex;align-items:center;gap:6px;font-size:10px;font-weight:700;letter-spacing:.05em;}
#v2Home .acard .ah svg{width:14px;height:14px;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round;}
/* The template is a WIDE 3-column design. Adapt it to fit narrower browser windows at FULL text size
   (NOT shrunk-to-tiny): tighten the side columns + hex sizes so the 3-column dashboard still fits and
   stays crisp/readable. Only stack on very narrow phones. (At a maximized/wide window it renders at
   full size, matching the template 1:1.) */
@media (max-width:1180px){
  #v2Home .shell{ grid-template-columns:158px 1fr 206px; gap:9px; padding:9px; max-width:none; }
  #v2Home .hexwrap{ width:118px; height:130px; }
  #v2Home .hexin .ico{ width:36px; height:36px; }
  #v2Home .hnum{ top:0; }
  #v2Home .badge{ width:20px; height:20px; top:24px; right:14px; }
  #v2Home .badge svg{ width:11px; height:11px; }
  #v2Home .np{ font-size:16px; }
  #v2Home .nt{ font-size:11px; }
  #v2Home .ns{ font-size:9px; }
  #v2Home .stars svg{ width:10px; height:10px; }
  #v2Home .row{ margin-bottom:30px; }
  #v2Home .rowwire{ top:64px; height:4px; }
  #v2Home .vwire{ bottom:-30px; height:30px; }
  #v2Home .stat{ min-width:0; padding:7px 9px; gap:7px; }
  #v2Home .sic{ width:30px; height:34px; }
  #v2Home .val{ font-size:15px; }
  #v2Home .lbl{ font-size:9px; }
  #v2Home .vsub{ font-size:9px; }
  #v2Home .title{ font-size:18px; }
  #v2Home .head{ padding:10px 12px; gap:10px; }
  #v2Home .focus .illus{ display:none; }
}
@media (max-width:680px){
  #v2Home .shell{ grid-template-columns:1fr; grid-template-areas:"head" "left" "main" "right"; }
}

/* avatar picker modal */
.avm{position:fixed;inset:0;background:rgba(4,8,16,.72);backdrop-filter:blur(4px);display:flex;align-items:center;justify-content:center;z-index:200;}
.avm-card{background:#111a2e;border:1px solid rgba(34,211,238,.45);border-radius:16px;padding:22px;width:380px;max-width:92vw;color:#eef4fb;font-family:'Inter',system-ui,sans-serif;box-shadow:0 24px 70px rgba(0,0,0,.6);}
.avm-up{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:12px;border:1px dashed rgba(34,211,238,.45);border-radius:11px;color:#28d4ee;cursor:pointer;font-weight:700;font-size:13px;background:rgba(34,211,238,.05);}
.avm-up:hover{background:rgba(34,211,238,.1);}
.avm-up svg{width:16px;height:16px;stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round;}
.avm-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:12px;}
.avm-grid .p{width:100%;aspect-ratio:1;border-radius:50%;overflow:hidden;cursor:pointer;border:2px solid transparent;transition:border-color .12s,transform .12s;}
.avm-grid .p:hover{border-color:#28d4ee;transform:scale(1.06);}
.avm-grid .p.sel{border-color:#28d4ee;box-shadow:0 0 12px rgba(34,211,238,.5);}
.avm-grid .p svg{width:100%;height:100%;display:block;}
.avm-btn{width:100%;margin-top:16px;padding:10px;border-radius:10px;border:1px solid rgba(70,100,150,.3);background:rgba(34,211,238,.06);color:#eef4fb;font-weight:600;cursor:pointer;}
