*,*::before,*::after{box-sizing:border-box}

:root{
  --navy:#0B1F33;
  --navy-deep:#071628;
  --teal:#2FD4C4;
  --teal-soft:#7FE9DE;
  --ink:#F4F8FA;
  --muted:#8FA6B8;
  --copper:#D9B26A;
  --coral:#E8836F;
  --steel:#7E9FBE;
  --glass:rgba(255,255,255,.04);
  --glass-2:rgba(255,255,255,.065);
  --line:rgba(47,212,196,.18);
  --line-soft:rgba(143,166,184,.16);
  --radius:16px;
  --radius-sm:11px;
  --font:'IBM Plex Sans Arabic',system-ui,-apple-system,'Segoe UI',Tahoma,sans-serif;
  --ease:cubic-bezier(.22,.8,.3,1);
}

html,body{margin:0;padding:0}
body{
  font-family:var(--font);
  color:var(--ink);
  background:linear-gradient(180deg,#0B1F33 0%,#071628 100%);
  background-attachment:fixed;
  min-height:100vh;
  line-height:1.6;
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
  -webkit-user-select:none;
  user-select:none;
}
p,h1,h2,h3,h4,li,th,td,textarea,input,select,.selectable{-webkit-user-select:text;user-select:text}
h1,h2,h3,h4,p{margin:0}
button{font-family:inherit}
input,select,textarea{font-family:inherit}
svg{display:block}
.hidden{display:none !important}

/* ---------- background decor ---------- */
.bg-decor{position:fixed;inset:0;z-index:0;pointer-events:none;overflow:hidden}
.bg-decor::before{
  content:'';position:absolute;inset:0;
  background-image:radial-gradient(rgba(143,166,184,.18) 1px,transparent 1px);
  background-size:26px 26px;
  opacity:.5;
  -webkit-mask-image:radial-gradient(ellipse 90% 70% at 50% 0%,#000 0%,transparent 80%);
  mask-image:radial-gradient(ellipse 90% 70% at 50% 0%,#000 0%,transparent 80%);
}
.route-lines{position:absolute;inset:0;width:100%;height:100%;opacity:.45}
.route-lines path{fill:none;stroke:rgba(47,212,196,.14);stroke-width:1.1}
.route-lines circle{fill:rgba(47,212,196,.4)}

/* ---------- shell ---------- */
.wrap{width:100%;max-width:1120px;margin-inline:auto;padding-inline:16px}
.main{position:relative;z-index:1;padding-block:24px 72px}

/* ---------- topbar ---------- */
.topbar{
  position:sticky;top:0;z-index:40;
  background:rgba(7,22,40,.78);
  -webkit-backdrop-filter:blur(16px);
  backdrop-filter:blur(16px);
  border-bottom:1px solid var(--line-soft);
}
.topbar-inner{display:flex;align-items:center;justify-content:space-between;gap:10px;padding-block:10px}
.brand{display:flex;align-items:center;gap:10px;min-width:0}
.brand-name{
  font-size:22px;font-weight:700;color:var(--copper);line-height:1;
  text-shadow:0 0 22px rgba(217,178,106,.35);
}
.brand-sep{width:1px;height:18px;background:rgba(143,166,184,.28);flex:0 0 auto}
.brand-sub{font-size:11.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.service-chip{
  display:inline-flex;align-items:center;gap:6px;flex:0 0 auto;
  font-size:10.5px;color:var(--muted);
  border:1px solid var(--line-soft);border-radius:999px;
  padding:5px 10px;background:rgba(255,255,255,.03);white-space:nowrap;
}
.service-chip .dot{width:7px;height:7px;border-radius:50%;background:var(--muted);transition:background .3s,box-shadow .3s}
.service-chip.on{color:var(--teal-soft);border-color:var(--line)}
.service-chip.on .dot{background:var(--teal);box-shadow:0 0 9px var(--teal)}
.service-chip.off{color:#D8A49B;border-color:rgba(232,131,111,.3)}
.service-chip.off .dot{background:var(--coral)}
@media (max-width:420px){ .brand-sub{display:none} .brand-sep{display:none} }

.tabs{display:flex;gap:8px;overflow-x:auto;padding-block:6px 12px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.tabs::-webkit-scrollbar{display:none}
.tab{
  flex:0 0 auto;border:1px solid transparent;background:rgba(255,255,255,.035);
  color:var(--muted);font-size:13px;font-weight:500;
  padding:9px 15px;border-radius:999px;cursor:pointer;min-height:38px;
  transition:color .2s var(--ease),background .2s var(--ease),box-shadow .25s var(--ease),transform .16s var(--ease);
}
.tab:hover{color:var(--ink);background:rgba(255,255,255,.07)}
.tab:active{transform:scale(.97)}
.tab.is-active{
  color:#04211F;font-weight:600;
  background:linear-gradient(180deg,#7FE9DE,#2FD4C4);
  border-color:rgba(127,233,222,.55);
  box-shadow:0 0 24px -8px rgba(47,212,196,.9);
}
.tab:focus-visible,button:focus-visible,select:focus-visible,input:focus-visible,textarea:focus-visible{
  outline:2px solid var(--teal-soft);outline-offset:2px;
}

/* ---------- views ---------- */
.view{animation:viewIn .4s var(--ease) both}
@keyframes viewIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}

/* ---------- hero ---------- */
.hero{position:relative;padding-block:6px 4px}
.hero-glow{
  position:absolute;inset-inline-start:-40px;top:-70px;width:340px;height:260px;
  background:radial-gradient(circle,rgba(47,212,196,.22),transparent 70%);
  filter:blur(20px);pointer-events:none;z-index:-1;
}
.eyebrow{
  display:inline-flex;align-items:center;gap:8px;
  font-size:11.5px;font-weight:600;color:var(--teal);margin-bottom:10px;
}
.eyebrow::before{content:'';width:18px;height:1px;background:var(--teal);opacity:.7}
.hero-title{font-size:clamp(27px,6.4vw,44px);line-height:1.24;font-weight:700;letter-spacing:0;margin-bottom:14px}
.hero-accent{color:var(--teal-soft)}
.rule{width:62px;height:2px;border-radius:2px;background:var(--copper);opacity:.9;margin-bottom:16px;box-shadow:0 0 16px rgba(217,178,106,.45)}
.lede{color:var(--muted);font-size:14.5px;max-width:62ch;line-height:1.75}

/* ---------- steps ---------- */
.steps{display:flex;gap:8px;flex-wrap:wrap;list-style:none;margin:22px 0 18px;padding:0}
.steps li{
  display:inline-flex;align-items:center;gap:8px;font-size:12.5px;color:var(--muted);
  background:rgba(255,255,255,.03);border:1px solid var(--line-soft);
  padding:6px 13px;border-radius:999px;
}
.step-num{
  display:grid;place-items:center;width:21px;height:21px;border-radius:50%;
  background:rgba(47,212,196,.15);color:var(--teal);font-size:11.5px;font-weight:600;
}

/* ---------- glass & cards ---------- */
.glass{
  background:var(--glass);border:1px solid var(--line);border-radius:var(--radius);
  -webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);
  box-shadow:0 24px 60px -46px rgba(0,0,0,.95);
}
.lab-card{padding:18px}
@media (min-width:768px){ .lab-card{padding:26px} }

/* ---------- fields ---------- */
.field-label{display:block;font-size:13.5px;font-weight:600;color:var(--ink);margin:0 0 8px}
.field-label.small{font-size:12px;color:var(--muted);font-weight:500}
.field,.input,.select{
  width:100%;font-size:16px;line-height:1.65;color:var(--ink);
  background:rgba(7,22,40,.62);border:1px solid var(--line-soft);
  border-radius:12px;padding:13px 15px;outline:none;
  transition:border-color .2s var(--ease),box-shadow .2s var(--ease),background .2s;
  -webkit-appearance:none;appearance:none;
}
.field::placeholder,.input::placeholder{color:rgba(143,166,184,.62)}
.field:focus,.input:focus,.select:focus{border-color:var(--teal);box-shadow:0 0 0 3px rgba(47,212,196,.14);background:rgba(7,22,40,.8)}
textarea.field{resize:vertical;min-height:96px}
select.input{
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238FA6B8' stroke-width='2' stroke-linecap='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat:no-repeat;background-position:left 12px center;background-size:16px;
  padding-inline-start:14px;padding-inline-end:38px;
}
select.input option{background:#0B1F33;color:var(--ink)}
.field-meta{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-top:7px;font-size:11.5px;color:var(--muted)}
.hint{opacity:.85}

/* ---------- domains ---------- */
.domains{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin:0 0 20px}
@media (min-width:680px){ .domains{grid-template-columns:repeat(4,1fr)} }
.domain-card{
  display:flex;flex-direction:column;align-items:flex-start;justify-content:space-between;gap:10px;
  min-height:94px;padding:13px;border-radius:14px;text-align:start;cursor:pointer;
  background:rgba(255,255,255,.03);border:1px solid var(--line-soft);color:var(--muted);
  font-size:13.5px;font-weight:500;
  transition:background .22s var(--ease),border-color .22s var(--ease),color .22s var(--ease),box-shadow .25s var(--ease),transform .16s var(--ease);
}
.domain-card svg{width:25px;height:25px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;transition:color .22s,transform .25s var(--ease)}
.domain-card:hover{background:rgba(255,255,255,.06);color:var(--ink);transform:translateY(-2px)}
.domain-card[aria-checked="true"]{
  color:var(--ink);border-color:var(--teal);background:rgba(47,212,196,.1);
  box-shadow:0 0 30px -14px rgba(47,212,196,.95);
}
.domain-card[aria-checked="true"] svg{color:var(--teal);transform:scale(1.06)}
.domain-card .dc-label{display:block;line-height:1.3}

/* ---------- buttons ---------- */
.btn-primary{
  display:inline-flex;align-items:center;justify-content:center;gap:9px;
  width:100%;min-height:54px;padding:13px 22px;border:none;border-radius:14px;
  font-size:15.5px;font-weight:600;color:#04211F;cursor:pointer;
  background:linear-gradient(180deg,#7FE9DE,#2FD4C4);
  box-shadow:0 12px 34px -16px rgba(47,212,196,.95);
  transition:transform .16s var(--ease),box-shadow .25s var(--ease),filter .2s var(--ease),opacity .2s;
}
.btn-primary:hover:not(:disabled){filter:brightness(1.07);box-shadow:0 16px 40px -14px rgba(47,212,196,.95)}
.btn-primary:active:not(:disabled){transform:scale(.985)}
.btn-primary:disabled{opacity:.4;cursor:not-allowed;box-shadow:none;filter:grayscale(.25)}
@media (min-width:640px){ .btn-primary{width:auto;min-width:290px} }

.btn-soft{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:44px;padding:10px 18px;border-radius:12px;cursor:pointer;
  background:rgba(47,212,196,.12);border:1px solid var(--line);color:var(--teal-soft);
  font-size:13.5px;font-weight:600;
  transition:background .2s var(--ease),transform .16s var(--ease),border-color .2s;
}
.btn-soft:hover{background:rgba(47,212,196,.2);border-color:rgba(47,212,196,.4)}
.btn-soft:active{transform:scale(.97)}

.btn-ghost{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:42px;padding:9px 16px;border-radius:12px;cursor:pointer;
  background:transparent;border:1px solid var(--line-soft);color:var(--muted);
  font-size:13px;font-weight:500;transition:.2s var(--ease);
}
.btn-ghost:hover{color:var(--ink);border-color:var(--line);background:rgba(255,255,255,.04)}

.icon-btn{
  display:inline-flex;align-items:center;justify-content:center;
  width:42px;height:42px;border-radius:12px;cursor:pointer;
  background:rgba(255,255,255,.04);border:1px solid var(--line-soft);color:var(--muted);
  transition:.2s var(--ease);
}
.icon-btn svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.icon-btn:hover{color:var(--ink);border-color:var(--line);background:rgba(255,255,255,.07)}
.icon-btn.wide{width:auto;padding-inline:14px;font-size:12.5px;font-weight:500}
.icon-btn.del:hover{color:#F0A99C;border-color:rgba(232,131,111,.4)}
.link-btn{
  background:none;border:none;color:var(--teal);font-size:12.5px;font-weight:600;
  cursor:pointer;padding:4px 6px;border-radius:8px;transition:.2s;
}
.link-btn:hover{background:rgba(47,212,196,.1)}

.coin-tag{
  display:inline-flex;align-items:center;gap:4px;
  background:rgba(4,33,31,.22);border-radius:999px;padding:2px 9px;font-size:12px;font-weight:600;
}

/* ---------- lab actions / status ---------- */
.lab-actions{display:flex;flex-direction:column;gap:10px;margin-top:4px}
@media (min-width:640px){ .lab-actions{flex-direction:row;align-items:center;gap:16px} }
.cost-note{font-size:11.5px;color:var(--muted);line-height:1.6;margin:0;max-width:46ch}

.lab-status{margin-top:16px;border-radius:12px;padding:13px 15px;font-size:13px;line-height:1.7;display:flex;gap:10px;align-items:flex-start}
.lab-status.loading{background:rgba(47,212,196,.07);border:1px solid var(--line);color:var(--teal-soft)}
.lab-status.error{background:rgba(232,131,111,.08);border:1px solid rgba(232,131,111,.36);color:#F3B8AC;flex-wrap:wrap}
.lab-status .msg{flex:1 1 220px}
.dots{display:inline-flex;gap:4px;align-items:center;flex:0 0 auto;padding-top:5px}
.dots i{width:6px;height:6px;border-radius:50%;background:currentColor;opacity:.4;animation:dotPulse 1.05s infinite}
.dots i:nth-child(2){animation-delay:.15s}
.dots i:nth-child(3){animation-delay:.3s}
@keyframes dotPulse{0%,100%{opacity:.25;transform:translateY(0)}50%{opacity:1;transform:translateY(-3px)}}

/* ---------- branch banner ---------- */
.branch-banner{
  display:flex;align-items:center;gap:9px;flex-wrap:wrap;
  margin-bottom:16px;padding:10px 13px;border-radius:12px;
  background:rgba(47,212,196,.08);border:1px solid var(--line);
  font-size:12.5px;color:var(--teal-soft);
}
.branch-banner svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:0 0 auto}
.branch-banner strong{color:var(--ink);font-weight:600}
.branch-banner .link-btn{margin-inline-start:auto}

/* ---------- saved list ---------- */
.saved-section{margin-top:30px}
.section-head{display:flex;align-items:center;gap:12px;justify-content:space-between;margin-bottom:14px;flex-wrap:wrap}
.section-title{font-size:17px;font-weight:600}
.view-title{font-size:clamp(19px,4.4vw,25px);font-weight:700;line-height:1.35}
.count-pill{
  display:inline-grid;place-items:center;min-width:26px;height:24px;padding-inline:8px;
  border-radius:999px;background:rgba(47,212,196,.14);color:var(--teal);
  font-size:12px;font-weight:600;
}
.saved-list{display:grid;gap:10px}
.saved-item{
  display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:14px;
  background:rgba(255,255,255,.03);border:1px solid var(--line-soft);
  transition:background .2s var(--ease),border-color .2s var(--ease),transform .16s var(--ease);
  cursor:pointer;
}
.saved-item:hover{background:rgba(255,255,255,.055);border-color:var(--line)}
.saved-item:active{transform:scale(.995)}
.saved-item.is-active{border-color:var(--line);background:rgba(47,212,196,.07)}
.mini-ring{position:relative;flex:0 0 auto;width:46px;height:46px;display:grid;place-items:center}
.mini-ring svg{position:absolute;inset:0;width:46px;height:46px;transform:rotate(-90deg)}
.mini-ring circle{fill:none;stroke-width:3.4;stroke-linecap:round}
.mini-track{stroke:rgba(255,255,255,.08)}
.mini-fill{stroke:var(--teal);transition:stroke-dashoffset .8s var(--ease)}
.mini-ring span{font-size:12.5px;font-weight:600;color:var(--teal-soft)}
.saved-main{min-width:0;flex:1}
.saved-main strong{display:block;font-size:13.5px;font-weight:600;line-height:1.45;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.saved-meta{display:block;font-size:11px;color:var(--muted);margin-top:3px}
.empty-inline{font-size:13px;color:var(--muted);padding:14px 0}

/* ---------- empty state ---------- */
.empty{
  display:flex;flex-direction:column;align-items:center;gap:12px;text-align:center;
  padding:44px 20px;border-radius:var(--radius);border:1px dashed var(--line-soft);
  background:rgba(255,255,255,.02);
}
.empty-icon{
  width:52px;height:52px;border-radius:50%;display:grid;place-items:center;
  background:rgba(47,212,196,.1);border:1px solid var(--line);color:var(--teal);
}
.empty-icon svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.empty h3{font-size:15.5px;font-weight:600}
.empty p{font-size:13px;color:var(--muted);max-width:40ch;line-height:1.7}

/* ---------- scenario view ---------- */
.decision-head{
  display:flex;align-items:flex-start;gap:12px;justify-content:space-between;
  flex-wrap:wrap;margin-bottom:6px;
}
.decision-head h2{font-size:clamp(18px,4.4vw,24px);font-weight:700;line-height:1.4;max-width:44ch}
.tag-row{display:flex;gap:8px;flex-wrap:wrap;margin-top:9px}
.tag{
  display:inline-flex;align-items:center;gap:6px;font-size:11.5px;color:var(--teal-soft);
  background:rgba(47,212,196,.1);border:1px solid var(--line);border-radius:999px;padding:4px 11px;
}
.tag.muted{color:var(--muted);background:rgba(255,255,255,.04);border-color:var(--line-soft)}
.summary-line{font-size:13.5px;color:var(--muted);line-height:1.8;margin-top:10px;max-width:70ch}

.scenario-grid{display:grid;gap:13px;margin-top:20px}
@media (min-width:900px){ .scenario-grid{grid-template-columns:repeat(3,1fr)} }
.scen{
  position:relative;overflow:hidden;display:flex;flex-direction:column;gap:12px;
  padding:17px;border-radius:16px;background:rgba(255,255,255,.04);border:1px solid var(--line);
  animation:cardIn .45s var(--ease) both;
}
.scen:nth-child(2){animation-delay:.07s}
.scen:nth-child(3){animation-delay:.14s}
@keyframes cardIn{from{opacity:0;transform:translateY(14px) scale(.985)}to{opacity:1;transform:none}}
.scen::before{content:'';position:absolute;inset-block-start:0;inset-inline:0;height:2px;background:var(--accent)}
.scen-pos{--accent:var(--teal)}
.scen-mid{--accent:var(--steel)}
.scen-risk{--accent:var(--coral)}
.scen-kicker{display:flex;align-items:center;gap:7px;font-size:11.5px;font-weight:600;color:var(--accent)}
.scen-kicker svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.scen h3{font-size:16px;font-weight:600;line-height:1.45}
.scen .body{font-size:13.5px;color:#C6D6E1;line-height:1.8}
.conf{display:flex;flex-direction:column;gap:6px;margin-top:auto}
.conf-top{display:flex;justify-content:space-between;font-size:11px;color:var(--muted)}
.conf-track{height:6px;border-radius:99px;background:rgba(255,255,255,.08);overflow:hidden}
.conf-fill{height:100%;width:0;border-radius:99px;background:var(--accent);transition:width .9s var(--ease)}
details.assumptions{border-top:1px solid var(--line-soft);padding-top:10px}
details.assumptions summary{
  cursor:pointer;font-size:12.5px;font-weight:500;color:var(--teal);
  display:flex;align-items:center;gap:6px;list-style:none;min-height:24px;
}
details.assumptions summary::-webkit-details-marker{display:none}
details.assumptions summary::after{content:'';width:7px;height:7px;border-inline-end:1.6px solid currentColor;border-block-end:1.6px solid currentColor;transform:rotate(45deg);margin-inline-start:auto;transition:transform .25s var(--ease)}
details.assumptions[open] summary::after{transform:rotate(-135deg)}
details.assumptions ul{margin:10px 0 0;padding-inline-start:16px;font-size:12.5px;color:var(--muted);line-height:1.85}
details.assumptions li{margin-bottom:5px}

.disclaimer{
  margin-top:16px;font-size:11.5px;color:var(--muted);line-height:1.75;
  display:flex;gap:8px;align-items:flex-start;padding:12px 14px;border-radius:12px;
  background:rgba(217,178,106,.06);border:1px solid rgba(217,178,106,.2);
}
.disclaimer svg{width:15px;height:15px;flex:0 0 auto;margin-top:2px;fill:none;stroke:var(--copper);stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}

/* ---------- impact index ---------- */
.impact-panel{margin-top:22px;padding:20px}
@media (min-width:880px){ .impact-panel{display:grid;grid-template-columns:200px 1fr;gap:26px;align-items:center;padding:26px} }
.impact-head{display:flex;align-items:center;gap:8px;margin-bottom:16px;grid-column:1/-1}
.impact-head h3{font-size:15px;font-weight:600}
.ring-wrap{position:relative;width:168px;height:168px;margin-inline:auto;display:grid;place-items:center;flex:0 0 auto}
.ring{width:168px;height:168px;transform:rotate(-90deg)}
.ring circle{fill:none;stroke-linecap:round}
.ring-track{stroke:rgba(255,255,255,.075);stroke-width:10}
.ring-fill{stroke:url(#ringGrad);stroke-width:10;transition:stroke-dashoffset 1.1s var(--ease);filter:drop-shadow(0 0 7px rgba(47,212,196,.55))}
.ring-center{position:absolute;inset:0;display:grid;place-content:center;text-align:center;line-height:1.1}
.ring-center strong{font-size:38px;font-weight:700;color:var(--ink);letter-spacing:-.5px}
.ring-center span{font-size:11px;color:var(--muted);display:block;margin-top:3px}
.crit-list{width:100%}
.crit-row{display:grid;grid-template-columns:minmax(84px,110px) 1fr 34px;gap:10px;align-items:center;margin-bottom:11px;font-size:12.5px}
.crit-row:last-child{margin-bottom:0}
.crit-name{color:var(--muted)}
.crit-track{height:7px;border-radius:99px;background:rgba(255,255,255,.07);overflow:hidden}
.crit-fill{height:100%;width:0;border-radius:99px;background:linear-gradient(90deg,#2FD4C4,#7FE9DE);transition:width .95s var(--ease)}
.crit-val{font-size:12px;font-weight:600;color:var(--teal-soft);text-align:end}
.impact-notes{margin-top:18px;display:grid;gap:9px;grid-column:1/-1}
.note-line{display:flex;gap:9px;align-items:flex-start;font-size:12.5px;line-height:1.75;color:#C6D6E1}
.note-line i{
  flex:0 0 auto;width:6px;height:6px;border-radius:50%;margin-top:7px;
}
.note-line.good i{background:var(--teal);box-shadow:0 0 8px rgba(47,212,196,.8)}
.note-line.bad i{background:var(--coral);box-shadow:0 0 8px rgba(232,131,111,.7)}

/* ---------- tree ---------- */
.tree-tools{display:flex;gap:7px;align-items:center}
.tree-shell{position:relative;height:clamp(320px,58vh,560px);overflow:hidden;touch-action:none}
#tree-svg{width:100%;height:100%;cursor:grab;touch-action:none}
#tree-svg.dragging{cursor:grabbing}
.tree-hint{
  position:absolute;inset-block-end:8px;inset-inline-start:12px;
  font-size:10.5px;color:var(--muted);background:rgba(7,22,40,.75);
  padding:5px 10px;border-radius:999px;border:1px solid var(--line-soft);
  pointer-events:none;max-width:calc(100% - 24px);
}
@media (max-width:520px){ .tree-hint{display:none} }
.tree-empty{position:absolute;inset:0;display:grid;place-content:center;padding:20px}
.tnode{cursor:pointer}
.tnode .tnode-bg{
  fill:rgba(255,255,255,.05);stroke:rgba(143,166,184,.28);stroke-width:1.2;
  transition:fill .22s var(--ease),stroke .22s var(--ease);
}
.tnode:hover .tnode-bg{fill:rgba(47,212,196,.12);stroke:var(--teal)}
.tnode.is-active .tnode-bg{fill:rgba(47,212,196,.15);stroke:var(--teal);filter:drop-shadow(0 0 12px rgba(47,212,196,.5))}
.tnode text{font-family:var(--font);fill:var(--ink);pointer-events:none}
.tnode-title{font-size:12.5px;font-weight:600}
.tnode-score{font-size:10.5px;fill:var(--teal-soft);font-weight:600}
.tedge{fill:none;stroke:rgba(47,212,196,.3);stroke-width:1.6}
.twhisk{fill:none;stroke-width:1.4;opacity:.55}
.legend{display:flex;gap:16px;flex-wrap:wrap;margin-top:14px;font-size:11.5px;color:var(--muted)}
.legend span{display:inline-flex;align-items:center;gap:7px}
.lg{width:14px;height:2px;border-radius:2px;display:inline-block}
.lg-pos{background:var(--teal)}
.lg-mid{background:var(--steel)}
.lg-risk{background:var(--coral)}
.lg-node{background:rgba(143,166,184,.5);height:8px;width:8px;border-radius:3px}

/* ---------- compare ---------- */
.picker{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:18px}
.pick{
  display:inline-flex;align-items:center;gap:8px;max-width:100%;
  padding:10px 14px;border-radius:12px;cursor:pointer;font-size:12.5px;
  background:rgba(255,255,255,.035);border:1px solid var(--line-soft);color:var(--muted);
  transition:.2s var(--ease);text-align:start;
}
.pick span.t{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:200px}
.pick .box{width:15px;height:15px;border-radius:5px;border:1.5px solid rgba(143,166,184,.5);flex:0 0 auto;display:grid;place-items:center;transition:.2s}
.pick .box::after{content:'';width:8px;height:4px;border-inline-start:2px solid #04211F;border-block-end:2px solid #04211F;transform:rotate(-45deg) scale(0);transition:transform .2s var(--ease)}
.pick[aria-pressed="true"]{color:var(--ink);border-color:var(--teal);background:rgba(47,212,196,.1)}
.pick[aria-pressed="true"] .box{background:var(--teal);border-color:var(--teal)}
.pick[aria-pressed="true"] .box::after{transform:rotate(-45deg) scale(1)}
.pick:disabled{opacity:.38;cursor:not-allowed}

.cmp-wrap{display:grid;gap:18px;margin-top:6px}
@media (min-width:900px){ .cmp-wrap{grid-template-columns:1.15fr .85fr;align-items:start} }
.table-scroll{overflow-x:auto;border-radius:var(--radius);border:1px solid var(--line);background:var(--glass);-webkit-overflow-scrolling:touch}
.cmp-table{width:100%;border-collapse:collapse;min-width:420px;font-size:12.5px}
.cmp-table th,.cmp-table td{padding:11px 12px;text-align:center;border-bottom:1px solid var(--line-soft)}
.cmp-table thead th{font-size:11.5px;font-weight:600;color:var(--muted);background:rgba(255,255,255,.03);line-height:1.5}
.cmp-table thead th:first-child{text-align:start}
.cmp-table tbody th,.cmp-table tfoot th{text-align:start;font-weight:500;color:var(--muted);font-size:12px;white-space:nowrap}
.cmp-table tbody td{font-weight:600;color:var(--ink);position:relative}
.cmp-table tbody td.best{color:var(--teal-soft);background:rgba(47,212,196,.1)}
.cmp-table tbody td.best::after{content:'';position:absolute;inset-block-start:6px;inset-inline-end:6px;width:5px;height:5px;border-radius:50%;background:var(--teal);box-shadow:0 0 7px var(--teal)}
.cmp-table tfoot td{font-weight:700;font-size:14px;color:var(--teal-soft)}
.cmp-table tfoot th{font-weight:600;color:var(--ink);font-size:12.5px}
.cmp-table tr:last-child th,.cmp-table tr:last-child td{border-bottom:none}

.radar-card{padding:16px;display:flex;flex-direction:column;gap:10px}
.radar-card h3{font-size:13.5px;font-weight:600;color:var(--muted)}
.radar{width:100%;height:auto;max-width:360px;margin-inline:auto;overflow:visible}
.radar .grid{fill:none;stroke:rgba(143,166,184,.2);stroke-width:1}
.radar .axis{stroke:rgba(143,166,184,.18);stroke-width:1}
.radar .rlabel{font-family:var(--font);font-size:10.5px;fill:var(--muted)}
.radar-shape{transform-box:fill-box;transform-origin:center;opacity:0;animation:radarPop .5s var(--ease) forwards}
@keyframes radarPop{from{opacity:0;transform:scale(.5)}to{opacity:1;transform:none}}
.radar-legend{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;font-size:11.5px;color:var(--muted)}
.radar-legend span{display:inline-flex;align-items:center;gap:6px}
.radar-legend i{width:11px;height:11px;border-radius:3px;display:inline-block}
.cmp-summary{
  margin-top:16px;padding:15px 17px;border-radius:14px;font-size:13px;line-height:1.85;color:#C6D6E1;
  background:rgba(47,212,196,.06);border:1px solid var(--line);
}
.cmp-summary strong{color:var(--teal-soft);font-weight:600}

/* ---------- challenge ---------- */
.challenge-card{
  position:relative;overflow:hidden;padding:22px;border-radius:18px;
  background:linear-gradient(160deg,rgba(47,212,196,.1),rgba(255,255,255,.03) 55%);
  border:1px solid var(--line);
}
.challenge-card::after{
  content:'';position:absolute;inset-inline-end:-60px;inset-block-start:-60px;width:200px;height:200px;
  background:radial-gradient(circle,rgba(47,212,196,.22),transparent 68%);pointer-events:none;
}
.challenge-day{display:inline-flex;align-items:center;gap:7px;font-size:11.5px;color:var(--teal);font-weight:600;margin-bottom:10px}
.challenge-card h3{font-size:clamp(17px,4.2vw,21px);font-weight:700;line-height:1.45;margin-bottom:10px;position:relative}
.challenge-card p.brief{font-size:13.5px;color:#C6D6E1;line-height:1.85;max-width:66ch;position:relative}
.prompt-list{margin:14px 0 0;padding:0;list-style:none;display:grid;gap:7px;position:relative}
.prompt-list li{display:flex;gap:8px;font-size:12.5px;color:var(--muted);line-height:1.7}
.prompt-list li::before{content:'؟';color:var(--teal);font-weight:600;flex:0 0 auto}
.answer-box{margin-top:18px;padding:18px;border-radius:16px;background:var(--glass);border:1px solid var(--line)}
.idea-cards{display:grid;gap:10px;margin-top:14px}
.idea-mini{padding:13px 15px;border-radius:13px;background:rgba(255,255,255,.035);border:1px solid var(--line-soft);font-size:13px;line-height:1.75;color:#C6D6E1}
.idea-mini .meta{display:block;font-size:10.5px;color:var(--muted);margin-top:6px}

/* ---------- gallery ---------- */
.idea-form{padding:18px;margin-bottom:18px}
.idea-form-grid{display:grid;gap:12px;margin-top:14px}
@media (min-width:760px){ .idea-form-grid{grid-template-columns:1fr 1fr 1fr} }
.filters{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:14px}
.chip{
  padding:7px 15px;border-radius:999px;font-size:12.5px;cursor:pointer;min-height:36px;
  background:rgba(255,255,255,.035);border:1px solid var(--line-soft);color:var(--muted);
  transition:.2s var(--ease);
}
.chip:hover{color:var(--ink);background:rgba(255,255,255,.07)}
.chip.is-active{color:#04211F;background:linear-gradient(180deg,#7FE9DE,#2FD4C4);border-color:transparent;font-weight:600}
.gallery-grid{display:grid;gap:12px}
@media (min-width:720px){ .gallery-grid{grid-template-columns:1fr 1fr} }
.idea-card{
  padding:16px;border-radius:16px;background:rgba(255,255,255,.04);border:1px solid var(--line);
  display:flex;flex-direction:column;gap:11px;animation:cardIn .4s var(--ease) both;
}
.idea-top{display:flex;align-items:center;gap:10px}
.avatar{
  width:34px;height:34px;border-radius:50%;flex:0 0 auto;display:grid;place-items:center;
  background:rgba(47,212,196,.14);border:1px solid var(--line);color:var(--teal-soft);
  font-size:13px;font-weight:600;
}
.idea-top .who{min-width:0;flex:1}
.idea-top strong{display:block;font-size:12.5px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.idea-top .when{display:block;font-size:10.5px;color:var(--muted)}
.idea-text{font-size:13.5px;line-height:1.8;color:#D6E2EA}
.idea-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;border-top:1px solid var(--line-soft);padding-top:10px;margin-top:auto}
.mini-btn{
  display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:6px 12px;
  border-radius:10px;background:rgba(255,255,255,.04);border:1px solid var(--line-soft);
  color:var(--muted);font-size:11.5px;cursor:pointer;transition:.2s var(--ease);
}
.mini-btn svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.mini-btn:hover{color:var(--ink);border-color:var(--line);background:rgba(255,255,255,.07)}
.mini-btn.voted{color:var(--teal);border-color:var(--line);background:rgba(47,212,196,.1)}
.link-chip{
  font-size:10.5px;color:var(--teal-soft);background:rgba(47,212,196,.1);
  border:1px solid var(--line);border-radius:999px;padding:3px 9px;
  max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}

/* ---------- drawer ---------- */
.drawer-scrim{position:fixed;inset:0;background:rgba(4,12,22,.62);z-index:60;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);animation:fadeIn .25s ease both}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.drawer{
  position:fixed;inset-block:0;inset-inline-start:0;width:min(360px,90vw);z-index:61;
  background:linear-gradient(180deg,#0C2338,#081A2B);
  border-inline-end:1px solid var(--line);
  box-shadow:24px 0 60px -30px rgba(0,0,0,.9);
  padding:20px;overflow-y:auto;
  animation:drawerIn .3s var(--ease) both;
}
[dir="rtl"] .drawer{inset-inline-start:0;inset-inline-end:auto;border-inline-end:1px solid var(--line);border-inline-start:none}
@keyframes drawerIn{from{transform:translateX(-100%);opacity:.6}to{transform:none;opacity:1}}
.drawer-close{
  position:absolute;inset-block-start:14px;inset-inline-end:14px;
  width:38px;height:38px;border-radius:11px;display:grid;place-items:center;cursor:pointer;
  background:rgba(255,255,255,.05);border:1px solid var(--line-soft);color:var(--muted);
  transition:.2s;
}
.drawer-close:hover{color:var(--ink);background:rgba(255,255,255,.09)}
.drawer-close svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
.drawer h3{font-size:16px;font-weight:700;line-height:1.5;padding-inline-end:38px;margin-bottom:8px}
.drawer .d-meta{font-size:11.5px;color:var(--muted);margin-bottom:14px}
.drawer .d-summary{font-size:12.5px;line-height:1.8;color:#C6D6E1;margin-bottom:16px}
.drawer .crit-row{grid-template-columns:minmax(74px,96px) 1fr 30px;font-size:11.5px}
.drawer .d-actions{display:flex;flex-direction:column;gap:9px;margin-top:18px}
.drawer .d-actions .btn-soft,.drawer .d-actions .btn-ghost{width:100%}

/* ---------- toast ---------- */
.toast{
  position:fixed;inset-block-end:22px;inset-inline:0;margin-inline:auto;width:max-content;max-width:calc(100vw - 32px);
  z-index:80;padding:11px 18px;border-radius:12px;font-size:13px;font-weight:500;
  background:rgba(11,31,51,.96);border:1px solid var(--line);color:var(--ink);
  box-shadow:0 20px 50px -24px rgba(0,0,0,.95);
  opacity:0;transform:translateY(14px);pointer-events:none;
  transition:opacity .26s var(--ease),transform .26s var(--ease);
  text-align:center;
}
.toast.show{opacity:1;transform:none}
.toast.warn{border-color:rgba(232,131,111,.45);color:#F3B8AC}

/* ---------- footer ---------- */
.site-foot{
  margin-top:44px;padding-top:18px;border-top:1px solid var(--line-soft);
  font-size:11.5px;color:var(--muted);line-height:1.8;text-align:center;
}
.foot-rule{display:block;width:44px;height:2px;background:var(--copper);opacity:.75;border-radius:2px;margin:0 auto 14px}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation-duration:.001ms !important;animation-iteration-count:1 !important;transition-duration:.001ms !important}
  .view{animation:none}
}