:root{
  --bg:#07070c;
  --bg-2:#090913;
  --surface:#0d0c17;
  --surface-2:#11101d;
  --surface-3:#161425;
  --surface-4:#1b1830;

  --border:#1c1930;
  --border-2:#2a2640;
  --border-3:#36314f;

  --text:#f4f3f8;
  --text-secondary:#b8b4c7;
  --text-muted:#7f7a92;
  --text-dim:#656075;

  --green:#22d77a;
  --green-soft:rgba(34,215,122,.12);
  --blue:#5f72ff;
  --blue-soft:rgba(95,114,255,.12);
  --orange:#f2a84a;
  --red:#ff6b73;

  --radius-xl:18px;
  --radius-lg:14px;
  --radius-md:12px;
  --radius-sm:10px;
  --shadow:0 10px 30px rgba(0,0,0,.28);
  --transition:140ms ease;
}

*{box-sizing:border-box}
html,body{margin:0;min-height:100%}

body{
  font-family:Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size:15px;
  line-height:1.4;
  color:var(--text);
  font-variant-numeric:tabular-nums;
  background:
    radial-gradient(circle at 100% 0%, rgba(88,74,160,.13), transparent 28%),
    radial-gradient(circle at 0% 100%, rgba(20,90,130,.10), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  padding:24px;
}

button,input,select{font:inherit}
button{cursor:pointer}

.app{
  width:min(1440px, 100%);
  margin:0 auto;
}

.topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:16px;
  padding:6px 2px 0;
}

.eyebrow{
  color:#68d6a0;
  font-size:11px;
  font-weight:700;
  letter-spacing:.16em;
  text-transform:uppercase;
  margin-bottom:8px;
}

h1{
  margin:0;
  font-size:32px;
  line-height:1.05;
  font-weight:800;
  letter-spacing:-.04em;
  color:#e5e2ee;
}

.subtitle{
  margin-top:8px;
  color:var(--text-muted);
  font-size:14px;
  max-width:760px;
  font-weight:500;
}

.top-meta{
  display:flex;
  align-items:center;
  gap:10px;
  padding-top:6px;
  flex-wrap:wrap;
  position:relative;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:38px;
  padding:0 14px;
  border-radius:999px;
  background:rgba(16,14,27,.88);
  border:1px solid var(--border-2);
  color:var(--text-secondary);
  font-size:13px;
  font-weight:600;
  box-shadow:var(--shadow);
}

#soundBtn{cursor:pointer}
#soundBtn:hover{border-color:var(--border-3); color:var(--text)}

.dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--green);
  box-shadow:0 0 0 4px rgba(34,215,122,.09);
  flex:0 0 auto;
}

.tooltip{
  position:absolute; right:0; top:calc(100% + 14px); z-index:20; width:230px;
  background:var(--surface-2); border:1px solid var(--border-3); color:var(--text);
  border-radius:14px; padding:12px 14px; box-shadow:0 12px 40px rgba(0,0,0,.45);
  font-size:14px; line-height:1.35; cursor:pointer;
}
.tooltip .arrow{
  position:absolute; right:28px; top:-8px; width:14px; height:14px;
  background:var(--surface-2); border-left:1px solid var(--border-3);
  border-top:1px solid var(--border-3); transform:rotate(45deg);
}
.tooltip.gone{display:none}

.workspace{
  display:grid;
  grid-template-columns:420px minmax(0,1fr);
  gap:16px;
  align-items:start;
}

.panel{
  background:linear-gradient(180deg, rgba(18,16,31,.96), rgba(12,11,22,.96));
  border:1px solid var(--border);
  border-radius:var(--radius-xl);
  box-shadow:var(--shadow);
  overflow:hidden;
}

.panel-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:18px 20px 14px;
  border-bottom:1px solid rgba(255,255,255,.03);
}

.panel-title{
  font-size:19px;
  font-weight:800;
  color:#f0eef6;
  letter-spacing:-.02em;
}

.panel-kicker{
  color:var(--text-dim);
  font-size:13px;
  font-weight:600;
}

.controls{
  padding:18px 18px 20px;
}

.field{margin-bottom:14px}
.field-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:14px;
  margin-bottom:14px;
  width:100%;
  align-items:end;
}

.field-grid > div{
  min-width:0;
}

.field-grid > div:last-child{
  justify-self:stretch;
  width:100%;
}

label{
  display:block;
  margin-bottom:8px;
  color:#88839a;
  font-size:12px;
  font-weight:800;
  letter-spacing:.14em;
  text-transform:uppercase;
}

input,select{
  width:100%;
  max-width:100%;
  min-width:0;
  height:56px;
  padding:0 18px;
  border-radius:12px;
  border:1px solid #322c46;
  background:#0b0a14;
  color:#cfcadd;
  font-size:18px;
  font-weight:500;
  outline:none;
  transition:border-color var(--transition), background var(--transition), box-shadow var(--transition), color var(--transition), transform var(--transition);
}

input::placeholder{
  color:#7c768d;
  opacity:1;
}

input:hover{
  border-color:#433b59;
  background:#0d0b16;
}

select:hover{
  border-color:#4b4562;
  background-color:#0d0b16;
  box-shadow:0 6px 18px rgba(0,0,0,.28);
  transform:translateY(-1px);
}

select option{
  background:#0b0a14;
  color:var(--text-secondary);
  padding:6px 10px;
}

select option:checked{
  background:#1b1830;
  color:var(--text);
}

input:focus{
  border-color:#5d5476;
  background:#0f0d18;
  box-shadow:0 0 0 3px rgba(105,93,144,.11);
  color:var(--text);
}

select:focus{
  border-color:#5d5476;
  background-color:#0f0d18;
  box-shadow:0 0 0 3px rgba(105,93,144,.11);
  color:var(--text);
}

.target-input{
  border-color:#544a6c;
  box-shadow:0 0 0 1px rgba(112,95,160,.08);
}

select{
  appearance:none;
  -webkit-appearance:none;
  padding-left:18px;
  padding-right:48px;
  font-size:17px;
  background-image:
    linear-gradient(45deg, transparent 50%, #f0eef7 50%),
    linear-gradient(135deg, #f0eef7 50%, transparent 50%);
  background-position:
    calc(100% - 24px) 24px,
    calc(100% - 17px) 24px;
  background-size:7px 7px, 7px 7px;
  background-repeat:no-repeat;
}

.primary{
  width:100%;
  height:56px;
  border:none;
  border-radius:14px;
  background:linear-gradient(180deg, #181528 0%, #11101d 100%);
  color:#edeaf5;
  font-size:18px;
  font-weight:800;
  letter-spacing:-.015em;
  box-shadow:inset 0 0 0 1px #2f2a43;
  transition:transform var(--transition), background var(--transition), box-shadow var(--transition), color var(--transition);
}

.primary:hover{
  background:linear-gradient(180deg, #1b1830 0%, #141224 100%);
  box-shadow:inset 0 0 0 1px #484061;
  color:#ffffff;
  transform:translateY(-1px);
}

.update-note{
  margin-top:14px;
  padding:14px 16px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(9,9,16,.7);
  color:var(--text-muted);
  font-size:14px;
  font-weight:600;
  min-height:36px;
}

.msg.err{color:var(--red)}
.msg.ok{color:var(--green)}

.list-panel-body{
  padding:12px;
}

.list-head{
  display:grid;
  grid-template-columns:.82fr minmax(220px,1.5fr) .72fr 1fr 1fr 160px;
  gap:16px;
  padding:4px 14px 12px;
  color:#7b758c;
  font-size:11px;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.token{
  position:relative;
  isolation:isolate;
  display:grid;
  grid-template-columns:.82fr minmax(220px,1.5fr) .72fr 1fr 1fr 160px;
  gap:16px;
  align-items:center;
  padding:16px 14px;
  margin-bottom:10px;
  border-radius:16px;
  border:1px solid var(--border);
  background:linear-gradient(180deg, rgba(18,16,31,.96), rgba(13,11,23,.96));
  box-shadow:0 8px 20px rgba(0,0,0,.18);
  transition:border-color var(--transition), transform var(--transition), background var(--transition), box-shadow var(--transition);
}

.token:hover{
  transform:translateY(-1px);
  border-color:#312b46;
  background:linear-gradient(180deg, rgba(20,18,35,.98), rgba(15,13,26,.98));
}

/* rainbow jackpot — kept */
.token.won{
  background:rgba(10,9,18,.96);
  border-color:rgba(255,255,255,.95);
  box-shadow:
    0 0 0 1px #fff,
    0 0 14px rgba(255,236,90,.85),
    0 0 28px rgba(34,215,122,.5),
    0 0 42px rgba(255,40,180,.45);
}
.token.won::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:16px;
  padding:3px;
  background:linear-gradient(90deg, #ff0037, #ffd000, #ffff55, #3dff3d, #00ffff, #8b7cff, #ff2ad8, #ff0037);
  background-size:220% 220%;
  animation:rainbowBorder .4s linear infinite;
  pointer-events:none;
  z-index:1;
  -webkit-mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite:xor;
  mask-composite:exclude;
}
@keyframes rainbowBorder{
  0%{background-position:0% 50%;}
  100%{background-position:100% 50%;}
}

.empty{
  padding:70px 20px;
  text-align:center;
  color:var(--text-muted);
  font-size:15px;
  font-weight:600;
}

.asset{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
}

.token-icon,
.icon{
  width:46px;
  height:46px;
  border-radius:14px;
  border:1px solid var(--border-2);
  display:grid;
  place-items:center;
  font-size:16px;
  font-weight:900;
  color:white;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05);
  flex:0 0 auto;
}

.icon{
  object-fit:cover;
  background:#11101d;
}

.token-icon.gold{
  background:linear-gradient(135deg, #f0bf57, #4b3210);
}

.token-icon.silver{
  background:linear-gradient(135deg, #d8dce7, #6c7387);
  color:#13131a;
}

.token-icon.blue{
  background:linear-gradient(135deg, #5793ff, #263fd4);
}

.token-icon.violet{
  background:linear-gradient(135deg, #8b7cff, #2c2370);
}

.token-icon.mint{
  background:linear-gradient(135deg, #3ddc97, #0d4a31);
}

.asset-copy{
  min-width:0;
}

.asset-name{
  color:#f5f3fb;
  font-size:19px;
  font-weight:800;
  letter-spacing:-.02em;
  margin-bottom:4px;
  white-space:nowrap;
}

.asset-sub{
  color:var(--text-muted);
  font-size:13px;
  font-weight:600;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.status{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:38px;
  padding:0 14px;
  border-radius:12px;
  font-size:14px;
  font-weight:800;
  letter-spacing:-.01em;
  border:1px solid transparent;
}

.status.buy{
  color:#7ff0ac;
  background:rgba(12,63,38,.60);
  border-color:rgba(58,137,91,.40);
}

.status.warn{
  color:#f0c86d;
  background:rgba(70,51,17,.45);
  border-color:rgba(161,115,34,.36);
}

.status.live{
  color:#c9c6d5;
  background:rgba(39,35,58,.60);
  border-color:rgba(71,63,97,.46);
}

.status.err{
  color:#ff9ba1;
  background:rgba(74,22,28,.55);
  border-color:rgba(161,58,66,.40);
}

.status.pulse{
  animation:statusPulse 1.2s ease-in-out infinite;
}
@keyframes statusPulse{
  0%,100%{opacity:1;}
  50%{opacity:.45;}
}

.metric{
  min-width:0;
  align-self:center;
}

.metric-label{
  color:#787286;
  font-size:11px;
  font-weight:700;
  letter-spacing:.10em;
  text-transform:uppercase;
  margin-bottom:6px;
}

.metric-value{
  color:#f4f2f9;
  font-size:18px;
  font-weight:800;
  letter-spacing:-.02em;
  line-height:1.15;
}

.metric-value.market-cap{
  font-size:24px;
  font-weight:900;
}

.metric-sub{
  margin-top:5px;
  color:var(--text-muted);
  font-size:12px;
  font-weight:600;
  line-height:1.2;
}

.target-metric{
  text-align:left;
  opacity:.68;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:flex-start;
  min-height:64px;
}

.target-metric .metric-label{
  color:#6f697f;
}

.target-metric .metric-value{
  color:#bbb6c8;
  font-weight:700;
}

.target-metric .metric-sub{
  color:#6e687b;
}

.target-metric .target-wrap{
  justify-content:flex-start;
  text-align:left;
}

.target-metric .edit-target{
  opacity:.78;
}

.target-wrap{
  display:flex;
  align-items:center;
  gap:10px;
}

.edit-target{
  width:38px;
  height:38px;
  border:none;
  border-radius:12px;
  background:linear-gradient(180deg, #151324 0%, #0f0e18 100%);
  box-shadow:inset 0 0 0 1px #2d2941;
  color:#c4c0d0;
  font-size:15px;
  font-weight:800;
  transition:box-shadow var(--transition), color var(--transition), transform var(--transition);
  flex:0 0 auto;
}

.edit-target:hover{
  box-shadow:inset 0 0 0 1px #4b4562;
  color:#fff;
  transform:translateY(-1px);
}

.distance-metric{
  padding-top:0;
}

.distance-metric .metric-value{
  margin-bottom:5px;
  font-size:18px;
}

.actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  justify-content:stretch;
  align-items:center;
  width:100%;
}

.actions .chip-btn{
  width:100%;
  min-width:0;
}

.actions .remove-btn{
  grid-column:1 / -1;
  width:100%;
}

.chip-btn{
  min-width:44px;
  height:38px;
  padding:0 14px;
  border:none;
  border-radius:12px;
  background:linear-gradient(180deg, #171528 0%, #0f0e18 100%);
  box-shadow:inset 0 0 0 1px #2f2a44;
  color:#d1cddd;
  font-size:14px;
  font-weight:800;
  letter-spacing:-.01em;
  transition:transform var(--transition), box-shadow var(--transition), color var(--transition), background var(--transition);
}

.chip-btn:hover{
  transform:translateY(-1px);
  color:#ffffff;
  box-shadow:inset 0 0 0 1px #484061;
  background:linear-gradient(180deg, #1a1730 0%, #12101d 100%);
}

.chip-btn.blue{
  color:#9fb1ff;
  box-shadow:inset 0 0 0 1px rgba(95,114,255,.28);
  background:linear-gradient(180deg, rgba(31,38,82,.80) 0%, rgba(17,18,37,.95) 100%);
}

.editbox{
  grid-column:1 / -1;
  display:flex;
  align-items:center;
  gap:10px;
}

.editbox input{
  height:44px;
  font-size:15px;
  flex:1;
}

.footerbar{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  padding:6px 4px 0;
  color:var(--text-dim);
  font-size:12px;
  font-weight:600;
}

.legend{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
}

.legend-item{
  display:flex;
  align-items:center;
  gap:7px;
}

.legend-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--green);
}

.legend-dot.warn{background:var(--orange)}
.legend-dot.neg{background:var(--red)}

@media (max-width:1200px){
  .workspace{
    grid-template-columns:1fr;
  }
}

@media (max-width:980px){
  body{padding:16px}
  .topbar{
    flex-direction:column;
    align-items:flex-start;
  }
  .list-head{
    display:none;
  }
  .token{
    grid-template-columns:1fr;
    gap:14px;
  }
  .actions{
    justify-content:flex-start;
  }
  .field-grid{
    grid-template-columns:1fr;
  }
  h1{font-size:28px}
  .target-metric{
    text-align:left;
    align-items:flex-start;
  }
}
