/* ============================================
   ANGELEXE — design tokens
   Concept: characters as tiny "programs" you run.
   Dark OS/launcher aesthetic, warm violet glow.
   ============================================ */

:root {
  --bg: #0b0d12;
  --bg-alt: #12151d;
  --bg-raised: #171a24;
  --line: #232634;
  --text: #e9e7f5;
  --text-dim: #8b8fa3;
  --text-faint: #565b66;
  --accent: #7c6fe0;
  --accent-soft: #a79cf2;
  --accent-dim: #423a72;
  --gold: #e8c468;
  --radius: 10px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent-dim); color: var(--text); }

/* ---------- layout shell ---------- */

.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

header.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 13, 18, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

header.top .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

nav.links { display: flex; gap: 4px; }

nav.links a, .btn-nav {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-dim);
  border: 1px solid transparent;
}

nav.links a:hover { color: var(--text); background: var(--bg-alt); }

/* ---------- hero ---------- */

.hero {
  padding: 72px 0 48px;
  border-bottom: 1px solid var(--line);
}

.prompt-line {
  font-family: var(--font-mono);
  color: var(--accent-soft);
  font-size: 0.9rem;
  margin-bottom: 18px;
}

.prompt-line .caret {
  display: inline-block;
  width: 8px;
  height: 1em;
  background: var(--gold);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1.1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

h1.headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 16px;
  max-width: 16ch;
}

.headline .accent { color: var(--accent-soft); }

.subhead {
  color: var(--text-dim);
  max-width: 52ch;
  font-size: 1.05rem;
  margin: 0 0 28px;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: #0b0d12;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-soft); }

.btn-secondary {
  background: transparent;
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--accent-soft); color: var(--accent-soft); }

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-dim);
}
.btn-ghost:hover { color: var(--text); }

/* ---------- section headers ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 48px 0 20px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin: 0;
}

.section-head .count {
  font-family: var(--font-mono);
  color: var(--text-faint);
  font-size: 0.85rem;
}

/* ---------- character grid ("process list") ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 56px;
}

.card {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}

.card-top { display: flex; align-items: center; gap: 12px; }

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.card-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
}

.card-tagline {
  color: var(--text-dim);
  font-size: 0.88rem;
  min-height: 2.6em;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.tag {
  color: var(--accent-soft);
  background: var(--accent-dim);
  padding: 3px 8px;
  border-radius: 5px;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.run-btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 6px 12px;
  background: transparent;
}
.run-btn:hover { background: var(--gold); color: #0b0d12; }

.card-menu {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  border: none;
  background: none;
  cursor: pointer;
}
.card-menu:hover { color: var(--text-dim); }

/* ---------- empty state ---------- */

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 56px;
}

.empty .headline-small {
  font-family: var(--font-display);
  color: var(--text);
  font-size: 1.1rem;
  margin-bottom: 8px;
}

/* ---------- forms ---------- */

.form-page { padding: 48px 0 80px; }

.form-page h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.form-page .lede {
  color: var(--text-dim);
  margin-bottom: 32px;
  max-width: 56ch;
}

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field .hint {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 6px;
}

input[type="text"],
input[type="url"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
}

textarea { resize: vertical; min-height: 90px; }

.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }

.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* ---------- chat ---------- */

.chat-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-alt);
}

.chat-header .avatar { width: 36px; height: 36px; font-size: 1.1rem; }

.chat-header .who { flex: 1; }
.chat-header .who .name { font-family: var(--font-display); font-weight: 700; }
.chat-header .who .status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}
.chat-header .status .dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  margin-right: 6px;
}

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.msg.char {
  align-self: flex-start;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-bottom-left-radius: 3px;
}

.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #0b0d12;
  border-bottom-right-radius: 3px;
}

.msg.system {
  align-self: center;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: none;
}

.chat-input-bar {
  border-top: 1px solid var(--line);
  padding: 16px 24px;
  background: var(--bg-alt);
}

.chat-input-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input-inner textarea {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
}

/* ---------- settings ---------- */

.settings-box {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 560px;
  margin-bottom: 24px;
}

.settings-box h3 {
  font-family: var(--font-display);
  margin-top: 0;
}

.note {
  border-left: 3px solid var(--gold);
  background: rgba(232, 196, 104, 0.08);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 20px 0;
}

footer.foot {
  border-top: 1px solid var(--line);
  padding: 28px 0 60px;
  color: var(--text-faint);
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

@media (max-width: 560px) {
  .field-row { flex-direction: column; }
  .msg { max-width: 90%; }
}
