/* Style: matches the logo — charcoal ground, pale lavender-white ink, hairlines, no glow.
   Inter for text, Geist Mono for numbers. Muted sage/rose only for up/down. */
:root {
  --bg: #121214;
  --bg-alt: #0d0d0f;
  --surface: #18181b;
  --surface-raised: #1c1c20;
  --ink: #e4def5;
  --muted: #8d8a96;
  --subtle: #5f5c68;
  --accent: #e4def5;
  --accent-2: #e4def5;
  --accent-ink: #121214;
  --glow: transparent;
  --line: rgba(228, 222, 245, 0.07);
  --line-2: rgba(228, 222, 245, 0.12);
  --up: #9fd4b0;
  --red: #d0868f;
  --font: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
  --r: 8px;
  --r-lg: 14px;
  --fast: 150ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.up { text-transform: uppercase; }
.muted { color: var(--muted); }
b { font-weight: 500; }

/* the one violet bloom */
.bloom { display: none; }
@keyframes breathe { from { opacity: .75; transform: translateX(-50%) scale(1); } to { opacity: 1; transform: translateX(-50%) scale(1.06); } }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
  padding: 14px 28px; background: rgba(18, 18, 20, 0.85); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0; font-weight: 700; letter-spacing: -0.03em; font-size: 22px; }
/* Logo: just the D. Traces itself on load (faint echoes first, then the crisp letter), replays on hover. */
.dmark { height: 40px; width: auto; display: block; overflow: visible; color: var(--ink); cursor: pointer; }
.dmark.sm { height: 32px; }
.dmark path { fill: none; stroke: currentColor; stroke-linejoin: miter; stroke-dasharray: 1; stroke-dashoffset: 0; }
.dmark .k { stroke-width: 5.5; }
.dmark .h { stroke-width: 2.4; opacity: .5; }
.dmark .e { stroke-width: 2.4; opacity: 0; }
.dmark.play .k, .dmark.play .h { animation: dm-draw 1.4s cubic-bezier(.65, 0, .35, 1) both; }
.dmark.play .e { animation: dm-echo 2.2s cubic-bezier(.65, 0, .35, 1) both; }
@keyframes dm-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes dm-echo { 0% { stroke-dashoffset: 1; opacity: .35; } 55% { stroke-dashoffset: 0; opacity: .35; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.tabs { display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.tabs button {
  border: 0; background: transparent; color: var(--muted); font: 500 15px var(--font); padding: 9px 22px;
  border-radius: 999px; cursor: pointer; transition: color var(--fast), background var(--fast);
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: rgba(228, 222, 245, 0.16); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(228, 222, 245, 0.35); }
.top-right { justify-self: end; display: flex; gap: 8px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); font: 500 13px var(--font); cursor: pointer;
}
.chip.mono { font-family: var(--mono); font-size: 12px; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--subtle); }
.chip.live .dot { background: var(--accent-2); box-shadow: none; }

main { position: relative; z-index: 1; padding: 28px; }
.view { display: none; }
.view.on { display: block; animation: rise 520ms var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }

.head { max-width: 1240px; margin: 20px auto 32px; }
.title { margin: 0; font-weight: 800; font-size: clamp(44px, 6vw, 84px); line-height: 0.98; letter-spacing: -0.055em; color: var(--ink); }
.title em { font-style: normal; font-weight: 800; color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.title.sm { font-size: 34px; }
.lead { color: var(--muted); font-size: 18px; margin: 16px 0 0; max-width: 620px; }

/* Cards */
.card {
  background: var(--surface); border-radius: var(--r-lg);
  border: 1px solid var(--line); padding: 20px;
}
.card.narrow { max-width: 760px; margin: 0 auto; }
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.label { display: block; font: 500 13px/1.4 var(--font); color: var(--muted); margin-bottom: 7px; }
.keys { float: right; color: var(--subtle); font: 11px var(--mono); }
.link { color: var(--muted); font-size: 13px; cursor: pointer; background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; font-family: var(--font); }
.link:hover { color: var(--ink); }

input, textarea {
  width: 100%; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line-2); border-radius: var(--r);
  color: var(--ink); font: 400 15px var(--font); padding: 12px 14px; outline: none; transition: border-color var(--fast), box-shadow var(--fast);
}
input::placeholder, textarea::placeholder { color: var(--subtle); }
input.mono, textarea.mono { font-family: var(--mono); }
input:focus, textarea:focus { border-color: rgba(228, 222, 245, 0.7); box-shadow: 0 0 0 3px rgba(228, 222, 245, 0.15); }
textarea { resize: vertical; }
label { display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  border: 1px solid var(--line-2); border-radius: 999px; padding: 11px 18px; cursor: pointer;
  font: 600 15px var(--font); color: var(--ink); background: rgba(255, 255, 255, 0.03);
  transition: background var(--fast), transform var(--fast), box-shadow var(--fast), border-color var(--fast);
}
.btn:hover { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.06); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn.primary { background: var(--ink); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { background: #ffffff; }
.btn.big { width: 100%; padding: 16px 22px; font-size: 16px; }
.btn.sm { padding: 8px 14px; }
.btn.ghost { background: transparent; }
.btn.buy { background: rgba(159, 212, 176, 0.07); color: var(--up); border-color: rgba(159, 212, 176, 0.3); }
.btn.buy:hover { background: rgba(159, 212, 176, 0.14); }
.btn.sell { background: rgba(208, 134, 143, 0.07); color: var(--red); border-color: rgba(208, 134, 143, 0.3); }
.btn.sell:hover { background: rgba(208, 134, 143, 0.14); }
.btn.danger { background: var(--red); color: #1a0d0f; border-color: transparent; font-weight: 700; }
.btn.danger:hover { background: #dc98a0; }
.btn.danger .keys { color: #1a0508; opacity: .6; float: none; }

.row { display: flex; gap: 8px; align-items: center; }
.row.gap { gap: 10px; margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form > * + *, .studio > * + *, .settings > * + * { margin-top: 14px; }
.status { min-height: 18px; color: var(--muted); font-size: 12px; font-family: var(--mono); }
.status.err { color: var(--red); }
.hr { height: 1px; background: var(--line); }

/* Launch */
.launch-grid { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 420px 1fr; gap: 16px; align-items: start; }
.av-preview {
  aspect-ratio: 1; border-radius: 14px; overflow: hidden; position: relative;
  background: #0d0d0f;
  border: 1px solid var(--line); display: grid; place-items: center;
}
.av-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-empty { color: var(--subtle); text-align: center; font-size: 13px; }
.av-preview.busy::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(228, 222, 245, 0.28) 50%, transparent 70%) 0 0 / 250% 100%;
  animation: sweep 1.2s linear infinite;
}
@keyframes sweep { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.av-history { display: flex; gap: 8px; overflow-x: auto; }
.av-history:empty { display: none; }
.av-history img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; cursor: pointer; opacity: .5; border: 1px solid var(--line); transition: opacity var(--fast); flex: none; }
.av-history img.on, .av-history img:hover { opacity: 1; outline: 2px solid var(--accent); outline-offset: 1px; }
.studio .btn.primary { width: 100%; }
.edit-box { padding-top: 14px; border-top: 1px solid var(--line); }
.devrow { align-items: end; }
.devinfo { display: grid; gap: 4px; font-size: 13px; padding-bottom: 6px; }

/* Trading */
.trade-grid { display: grid; grid-template-columns: 290px 1fr 320px; gap: 14px; height: calc(100vh - 120px); min-height: 620px; }
.list { display: flex; flex-direction: column; overflow: hidden; padding: 16px; }
.addca { display: flex; gap: 6px; margin-bottom: 12px; }
.addca input { padding: 8px 11px; font-size: 12px; }
.tokens { overflow-y: auto; margin: 0 -8px; padding: 0 8px; flex: 1; }
.tok { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; padding: 9px 8px; border-radius: 12px; cursor: pointer; transition: background var(--fast); }
.tok:hover { background: rgba(255,255,255,.04); }
.tok.on { background: rgba(228, 222, 245, 0.12); box-shadow: inset 0 0 0 1px rgba(228, 222, 245, 0.35); }
.tok img, .tok .ph { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; background: var(--bg-alt); }
.tok .nm { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tok .sub { font: 11px var(--mono); color: var(--subtle); }
.tok .pnl { text-align: right; font: 12px var(--mono); }
.pos-c { color: var(--up); } .neg-c { color: var(--red); }

.chartcard { display: flex; flex-direction: column; padding: 16px 16px 8px; min-width: 0; }
.chart-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tk { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tk img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.tk .nm { font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.tk .ca { font: 11px var(--mono); color: var(--subtle); cursor: pointer; }
.tk .ca:hover { color: var(--ink); }
.tk a { color: var(--muted); font-size: 12px; }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255,255,255,.03); border: 1px solid var(--line); }
.seg button { border: 0; background: none; color: var(--muted); font: 12px var(--mono); padding: 5px 11px; border-radius: 999px; cursor: pointer; }
.seg button.on { background: rgba(228, 222, 245, 0.18); color: var(--ink); }
.stats { display: flex; flex-wrap: wrap; gap: 18px; padding: 12px 2px; font-size: 12px; color: var(--muted); }
.stats b { color: var(--ink); font-weight: 400; margin-left: 6px; }
.prog { display: inline-block; width: 80px; height: 4px; border-radius: 4px; background: var(--line-2); vertical-align: middle; margin-left: 6px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--accent); box-shadow: none; }
#chart { flex: 1; min-height: 300px; }

.side { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.pos { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.pos-big { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.pos-big .label { margin: 0; }
.pos-big b { font-size: 32px; letter-spacing: -0.03em; }
.pos-big b.pos-c {  }
.kv { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); padding: 3px 0; }
.kv b { color: var(--ink); font-weight: 400; }
.btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.btns .btn { padding: 11px 6px; font-family: var(--mono); font-size: 14px; }
.block .row input { padding: 9px 11px; }
.trades { font: 11px var(--mono); color: var(--subtle); display: grid; gap: 4px; }
.trades a { color: inherit; text-decoration: none; display: flex; justify-content: space-between; padding: 4px 0; border-top: 1px solid rgba(255,255,255,.05); }
.trades a:hover { color: var(--ink); }

/* Wallets */
.wallets { display: grid; gap: 8px; }
.wal { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.02); border: 1px solid var(--line); }
.wal.on { border-color: rgba(228, 222, 245, 0.55); box-shadow: none; }
.wal .addr { font: 12px var(--mono); color: var(--muted); cursor: pointer; overflow: hidden; text-overflow: ellipsis; }
.wal .nm { font-weight: 500; }
.wal .acts { display: flex; gap: 6px; align-items: center; }
.wal .acts .btn { padding: 6px 12px; font-size: 12px; }
.empty { color: var(--subtle); text-align: center; padding: 28px 0; font-size: 13px; }

/* Welcome / lock screen: split like bundleit — charcoal, hairlines, no glow */
.lock { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: 1fr 1fr; background: #121214; }
.lock.off { display: none; }
.lock-art { position: relative; overflow: hidden; background: #121214; border-right: 1px solid rgba(255,255,255,.06); }
.lock-brand { position: absolute; top: 32px; left: 36px; z-index: 3; display: flex; align-items: baseline; gap: 0; font-weight: 600; font-size: 20px; letter-spacing: -0.02em; color: #e4def5; }
.paths { position: absolute; inset: 0; width: 100%; height: 100%; }
.paths path { fill: none; stroke: #e4def5; stroke-width: .5; stroke-dasharray: .45 .55; stroke-opacity: var(--o);
  animation: floating-path var(--dur) linear infinite; }
@keyframes floating-path {
  0% { stroke-dashoffset: 1; stroke-opacity: 0; }
  15%, 85% { stroke-opacity: calc(var(--o) * .6); }
  100% { stroke-dashoffset: -1; stroke-opacity: 0; }
}
.monogram { position: absolute; left: 50%; top: 50%; width: min(42%, 300px); transform: translate(-50%, -50%); z-index: 2; overflow: visible; }
.monogram .ml { fill: none; stroke-linejoin: miter; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: logo-line 9s cubic-bezier(.65, 0, .35, 1) infinite both; }
.monogram .k { stroke: #e4def5; }
.monogram .e { stroke: rgba(228, 222, 245, 0.22); }
/* trace in, hold, fade out, repeat */
@keyframes logo-line {
  0% { stroke-dashoffset: 1; opacity: 0; }
  6% { opacity: 1; }
  40% { stroke-dashoffset: 0; }
  82% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
.lock-foot { position: absolute; left: 36px; bottom: 28px; z-index: 3; font-size: 12px; color: #6f6b78; }
.lock-side { display: grid; place-items: center; padding: 32px; background: #0d0d0f; }
.lock-card { width: min(380px, 100%); display: grid; gap: 14px; }
.lock-title { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.035em; }
.lock-card p { margin: -6px 0 6px; font-size: 15px; }
.field { position: relative; }
.field svg { position: absolute; left: 14px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; }
.field input { padding-left: 42px; }
.lock-card .link { justify-self: start; }
@media (max-width: 900px) { .lock { grid-template-columns: 1fr; } .lock-art { display: none; } }

/* Toasts */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 8px; width: 340px; }
.toast { padding: 12px 14px; border-radius: 12px; background: #1c1c20; backdrop-filter: blur(12px); border: 1px solid var(--line-2); font-size: 13px; animation: rise 300ms var(--ease) both; }
.toast .t { font-weight: 500; }
.toast .d { font: 11px var(--mono); color: var(--muted); margin-top: 3px; word-break: break-all; }
.toast a { color: var(--muted); }
.toast.ok { border-color: rgba(228, 222, 245, 0.55); box-shadow: none; }
.toast.err { border-color: rgba(208, 134, 143, 0.5); }

@media (max-width: 1180px) {
  .trade-grid { grid-template-columns: 1fr; height: auto; }
  #chart { height: 420px; flex: none; }
  .launch-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .top { flex-wrap: wrap; padding: 12px 16px; gap: 12px; }
  main { padding: 16px; }
  .grid3 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .view.on, .toast, .bloom, .paths path { animation: none; }
  .monogram .ml { animation: none; stroke-dashoffset: 0; }
  .dmark path { animation: none !important; }
  .av-preview.busy::after { animation: none; }
}
