:root {
  --bg: #0b0b12;
  --bg-2: #12121c;
  --card: #161624;
  --line: #262638;
  --text: #ececf4;
  --muted: #8d8da6;
  --purple: #9945ff;
  --green: #14f195;
  --red: #ff5c7a;
  --amber: #ffb547;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(153, 69, 255, 0.18), transparent 60%),
    radial-gradient(700px 400px at -10% 20%, rgba(20, 241, 149, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

code, .mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; max-width: 1200px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--purple), var(--green)); color: #0b0b12; font-size: 18px;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }

.pill {
  font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
}

.banner {
  max-width: 1150px; margin: 0 auto 8px; padding: 12px 16px; border-radius: 12px;
  background: rgba(255, 181, 71, 0.08); border: 1px solid rgba(255, 181, 71, 0.3);
  color: #ffd79a; font-size: 14px; line-height: 1.5;
}
.banner a { color: #fff; }
.banner + .banner { margin-top: 8px; }

main { max-width: 1200px; margin: 0 auto; padding: 0 28px 40px; }

.hero { padding: 40px 0 36px; }
.hero h1 { font-size: clamp(36px, 6vw, 60px); line-height: 1.05; margin: 0 0 16px; letter-spacing: -0.03em; }
.grad { background: linear-gradient(90deg, var(--purple), var(--green)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { font-size: 18px; color: var(--muted); max-width: 620px; line-height: 1.55; margin: 0 0 32px; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.steps li { display: flex; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(22, 22, 36, 0.6); }
.steps p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.step-n {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; background: rgba(153, 69, 255, 0.15); color: #c9a6ff;
}

.grid { display: grid; grid-template-columns: 420px 1fr; gap: 20px; align-items: start; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card h2 { margin: 0 0 18px; font-size: 20px; }

.field { display: block; margin-bottom: 18px; position: relative; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.field em { font-style: normal; opacity: 0.7; font-weight: 400; }
.counter { position: absolute; right: 10px; bottom: 8px; color: var(--muted); font-size: 11px; }

input, textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; color: var(--text); font: inherit; font-size: 15px; outline: none; transition: border-color 0.15s;
}
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: var(--purple); }
input[type="datetime-local"] { color-scheme: dark; }

.input-suffix { position: relative; }
.input-suffix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--text);
}
.chip:hover { border-color: var(--purple); }
.chip.active { background: rgba(153, 69, 255, 0.18); border-color: var(--purple); }

.summary {
  padding: 14px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; line-height: 1.5;
  background: rgba(153, 69, 255, 0.08); border: 1px dashed rgba(153, 69, 255, 0.4);
}
.summary b { color: #fff; }

.btn {
  font: inherit; font-weight: 600; font-size: 15px; padding: 11px 18px; border-radius: 10px;
  cursor: pointer; border: 1px solid transparent; transition: transform 0.05s, opacity 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(90deg, var(--purple), #7b5cff); color: #fff; }
.btn-green { background: var(--green); color: #062a1a; }
.btn-red { background: rgba(255, 92, 122, 0.15); color: var(--red); border-color: rgba(255, 92, 122, 0.4); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-block { width: 100%; padding: 14px; font-size: 16px; }
.btn-sm { font-size: 13px; padding: 8px 12px; }
.fine { color: var(--muted); font-size: 12px; text-align: center; margin: 10px 0 0; }

.goals-card { min-height: 420px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px -6px 18px; padding: 0 6px; }
.tab {
  font: inherit; font-weight: 600; background: none; border: none; color: var(--muted);
  padding: 10px 12px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--text); border-bottom-color: var(--purple); }
.count { font-size: 12px; background: var(--bg-2); border-radius: 999px; padding: 2px 8px; margin-left: 4px; }
.icon-btn { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 0 8px; }
.icon-btn:hover { color: var(--text); }

.goal-list { display: flex; flex-direction: column; gap: 14px; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty .big { font-size: 40px; margin-bottom: 10px; }

.goal { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--bg-2); }
.goal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.goal h3 { margin: 0; font-size: 17px; }
.goal-desc { color: var(--muted); font-size: 14px; margin: 6px 0 0; line-height: 1.45; white-space: pre-wrap; }
.stake { font-weight: 800; font-size: 20px; white-space: nowrap; }
.stake small { font-size: 12px; color: var(--muted); font-weight: 600; }

.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 14px 0 12px; font-size: 13px; color: var(--muted); }
.meta b { color: var(--text); font-weight: 600; }
.addr { font-family: "JetBrains Mono", monospace; font-size: 12px; }

.bar { height: 6px; background: #22223a; border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--green), var(--purple)); border-radius: 99px; }
.bar.late > div { background: var(--red); }

.goal-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.status { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }
.status.active { background: rgba(20, 241, 149, 0.12); color: var(--green); }
.status.missed { background: rgba(255, 92, 122, 0.12); color: var(--red); }
.status.stale { background: rgba(255, 181, 71, 0.12); color: var(--amber); }
.actions { display: flex; gap: 8px; }
.countdown { font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--text); }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.toast {
  max-width: 360px; padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 1.4;
  background: #1d1d2e; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: slide 0.2s ease-out;
}
.toast.ok { border-color: rgba(20, 241, 149, 0.5); }
.toast.err { border-color: rgba(255, 92, 122, 0.5); }
.toast a { color: var(--green); }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 20px 28px 40px; }

@media (max-width: 960px) {
  .grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .topbar, main { padding-left: 16px; padding-right: 16px; }
  #cluster-pill { display: none; }
}
