/* =================================================================
   WriterPi — public website styles
   Three themes (Dark default, Forest, Galaxy). The active theme is set
   on <html data-theme="..."> by theme.js / the no-flash head snippet.
   ================================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
  transition: background .2s ease, color .2s ease;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* =====================================================
   THEME TOKENS
   Dark is the default. theme.js sets data-theme on <html>,
   and a tiny no-flash snippet in each page <head> applies
   the saved theme before the first paint.
   ===================================================== */
:root,
html[data-theme="dark"] {
  --bg:          #1E1F23;
  --bg-soft:     #26282E;
  --bg-sunken:   #17181B;
  --surface:     #26282E;
  --nav:         rgba(23, 24, 27, 0.88);
  --text:        #F1F3F5;
  --muted:       #AEB4BD;
  --border:      #3A3D45;
  --accent:      #56C98A;
  --accent-2:    #4C8B5E;
  --accent-soft: #243027;
  --grad: linear-gradient(135deg, #5DA975, #2D6A4F);
}
html[data-theme="forest"] {
  --bg:          #FAFCF7;
  --bg-soft:     #F0F4ED;
  --bg-sunken:   #E8EDE3;
  --surface:     #FFFFFF;
  --nav:         rgba(250, 252, 247, 0.85);
  --text:        #14201A;
  --muted:       #5C7560;
  --border:      #D9E3D1;
  --accent:      #2D6A4F;
  --accent-2:    #4C8B5E;
  --accent-soft: #E8EDE3;
  --grad: linear-gradient(135deg, #5DA975, #2D6A4F);
}
html[data-theme="galaxy"] {
  --bg:          #07090F;
  --bg-soft:     #11141C;
  --bg-sunken:   #161B2A;
  --surface:     #11141C;
  --nav:         rgba(7, 9, 15, 0.88);
  --text:        #ECF4FF;
  --muted:       #98A8C4;
  --border:      #232A3E;
  --accent:      #5BE49B;
  --accent-2:    #2BB57F;
  --accent-soft: #14302A;
  --grad: linear-gradient(135deg, #5BE49B, #00AA66);
}

/* =====================================================
   NAV
   ===================================================== */
.wp-nav {
  position: sticky; top: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px;
  background: var(--nav);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}
.wp-nav-brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 17px; letter-spacing: -0.1px;
}
.wp-nav-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--grad); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
}
.wp-nav-links { display: flex; gap: 26px; }
.wp-nav-links a { color: var(--muted); font-size: 14px; font-weight: 500; }
.wp-nav-links a:hover { color: var(--text); }

/* =====================================================
   BUTTONS
   ===================================================== */
.wp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border: 1px solid transparent;
  border-radius: 9px; font-weight: 600; font-size: 14px;
  transition: filter .15s, background .15s, color .15s, border-color .15s, transform .08s;
}
.wp-btn-primary { background: var(--grad); color: #fff; box-shadow: 0 1px 2px rgba(45,106,79,0.18); }
.wp-btn-primary:hover { filter: brightness(1.06); }
.wp-btn-primary:active { transform: translateY(1px); }
.wp-btn-ghost   { background: var(--surface); color: var(--accent); border-color: var(--border); }
.wp-btn-ghost:hover { background: var(--bg-soft); border-color: var(--accent-2); }
.wp-btn-lg { padding: 13px 22px; font-size: 15px; border-radius: 11px; }
.wp-btn-block { width: 100%; }
.wp-btn-danger { color: #DC2626; border-color: #FECACA; }
.wp-btn-danger:hover { background: #FEF2F2; }

.wp-link { background: none; border: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.wp-link:hover { color: var(--text); }

.wp-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: none; color: var(--muted);
  font-size: 17px; transition: background .12s, color .12s;
}
.wp-iconbtn:hover { background: var(--bg-soft); color: var(--text); }

/* =====================================================
   HERO
   ===================================================== */
.wp-hero {
  position: relative;
  padding: 96px 32px 80px;
  background: radial-gradient(ellipse at 20% 0%, rgba(93,169,117,0.18) 0%, transparent 55%),
              radial-gradient(ellipse at 95% 25%, rgba(45,106,79,0.10) 0%, transparent 55%),
              var(--bg);
  overflow: hidden;
}
.wp-hero-inner { max-width: 760px; margin: 0 auto; text-align: center; position: relative; z-index: 2; }
.wp-hero-tag {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 22px;
}
.wp-hero h1 {
  font-size: 56px; line-height: 1.05;
  font-weight: 800; letter-spacing: -1.4px;
  margin-bottom: 18px;
}
.wp-hero-sub {
  font-size: 18px; color: var(--muted); margin-bottom: 30px;
  max-width: 600px; margin-left: auto; margin-right: auto;
  line-height: 1.55;
}
.wp-hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.wp-hero-trust { font-size: 12.5px; color: var(--muted); }

/* Floating orbs in the hero background — visual flair */
.wp-hero-art {
  position: absolute; inset: 0;
  pointer-events: none; overflow: hidden;
}
.wp-hero-orb {
  position: absolute; width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(93,169,117,0.4), transparent 65%);
  top: -80px; right: -80px;
  filter: blur(40px);
  animation: orb-drift 18s ease-in-out infinite;
}
.wp-hero-orb-2 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(45,106,79,0.35), transparent 65%);
  top: 60%; left: -60px;
  animation-delay: -6s;
}
.wp-hero-orb-3 {
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(167,139,250,0.22), transparent 65%);
  top: 30%; right: 20%;
  animation-delay: -12s;
}
@keyframes orb-drift {
  0%, 100% { transform: translate(0, 0); }
  33%      { transform: translate(40px, -30px); }
  66%      { transform: translate(-30px, 50px); }
}

/* =====================================================
   SECTIONS / CARDS / GRID
   ===================================================== */
.wp-section { padding: 80px 32px; max-width: 1180px; margin: 0 auto; }
.wp-section-alt {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  max-width: none; padding: 80px 32px;
}
.wp-section-head { text-align: center; margin-bottom: 50px; }
.wp-section-head h2 { font-size: 36px; font-weight: 800; letter-spacing: -0.8px; margin-bottom: 10px; }
.wp-section-head p  { color: var(--muted); font-size: 16px; max-width: 580px; margin: 0 auto; }

.wp-grid { display: grid; gap: 20px; max-width: 1140px; margin: 0 auto; }
.wp-grid-3 { grid-template-columns: repeat(3, 1fr); }
.wp-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .wp-grid-3, .wp-grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .wp-grid-3, .wp-grid-4 { grid-template-columns: 1fr; }
}

.wp-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.wp-card:hover { border-color: var(--accent-2); box-shadow: 0 8px 24px rgba(45,106,79,0.08); transform: translateY(-2px); }
.wp-card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--bg-soft); font-size: 20px;
  margin-bottom: 14px;
}
.wp-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.wp-card p  { color: var(--muted); font-size: 13.5px; line-height: 1.55; }

/* =====================================================
   PRICING
   ===================================================== */
.wp-pricing .wp-plan { position: relative; }
.wp-plan-name    { font-size: 15px; font-weight: 700; color: var(--accent); letter-spacing: 0.4px; text-transform: uppercase; margin-bottom: 6px; }
.wp-plan-price   { font-size: 36px; font-weight: 800; letter-spacing: -1px; }
.wp-plan-price span { font-size: 14px; font-weight: 500; color: var(--muted); }
.wp-plan-credits { color: var(--muted); margin: 4px 0 16px; font-size: 13.5px; }
.wp-plan-feats { list-style: none; margin: 0 0 20px; padding: 0; font-size: 13.5px; }
.wp-plan-feats li { padding: 5px 0; color: var(--text); border-bottom: 1px dashed var(--border); }
.wp-plan-feats li:last-child { border-bottom: none; }
.wp-plan-cta { width: 100%; }

.wp-plan-featured {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-soft) 100%);
  border: 1.5px solid var(--accent);
  box-shadow: 0 10px 30px rgba(45,106,79,0.14);
}
.wp-plan-badge {
  position: absolute; top: -12px; right: 22px;
  background: var(--accent); color: #fff;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
}
.wp-pricing-fineprint { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 26px; max-width: 720px; margin-left: auto; margin-right: auto; }

/* =====================================================
   INSTALL STEPS
   ===================================================== */
.wp-install { max-width: 720px; margin: 0 auto; text-align: center; }
.wp-install-steps { display: flex; flex-direction: column; gap: 14px; margin-bottom: 30px; }
.wp-step {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  text-align: left;
}
.wp-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--grad); color: #fff; font-weight: 800;
  flex-shrink: 0;
}
.wp-step b { display: block; font-size: 14.5px; }
.wp-step-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* =====================================================
   FOOTER
   ===================================================== */
.wp-footer {
  background: var(--bg-soft);
  padding: 60px 32px 30px;
  border-top: 1px solid var(--border);
}
.wp-footer-grid {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 30px; max-width: 1180px; margin: 0 auto;
}
.wp-footer-grid h4 { font-size: 13px; font-weight: 700; margin-bottom: 12px; letter-spacing: 0.4px; }
.wp-footer-grid a { display: block; color: var(--muted); font-size: 14px; padding: 4px 0; }
.wp-footer-grid a:hover { color: var(--text); }
.wp-footer-tag { color: var(--muted); margin-top: 8px; }
.wp-footer-bottom {
  text-align: center; color: var(--muted); font-size: 12px;
  margin-top: 40px; padding-top: 20px;
  border-top: 1px solid var(--border);
}
@media (max-width: 800px) { .wp-footer-grid { grid-template-columns: 1fr 1fr; } }

/* =====================================================
   MODAL
   ===================================================== */
.wp-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 32, 25, 0.45);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.wp-modal-backdrop.show { display: flex; }
.wp-modal {
  background: var(--surface); border-radius: 18px;
  padding: 36px 32px; max-width: 380px; width: 100%;
  text-align: center; position: relative;
  box-shadow: 0 30px 80px rgba(15, 32, 25, 0.30);
  animation: pop-in .18s ease-out;
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.96) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.wp-modal-icon {
  width: 60px; height: 60px; border-radius: 16px;
  background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; margin: 0 auto 16px;
}
.wp-modal h3 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 6px; }
.wp-modal p  { color: var(--muted); margin-bottom: 22px; font-size: 14px; }
.wp-modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border-radius: 8px;
  border: none; background: transparent;
  color: var(--muted); font-size: 22px; line-height: 1;
}
.wp-modal-close:hover { background: var(--bg-soft); color: var(--text); }
.wp-modal-back { margin-top: 14px; font-size: 13px; }
.wp-modal-msg { margin-top: 12px; font-size: 12.5px; color: var(--muted); min-height: 18px; }
.wp-modal-msg.error { color: #DC2626; }
.wp-modal-msg.ok    { color: #16A34A; }

/* =====================================================
   FORM INPUTS
   ===================================================== */
.wp-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: var(--surface);
  outline: none;
  margin-bottom: 12px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.wp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,106,79,0.12); }
.wp-input-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; text-align: center; letter-spacing: 6px; font-size: 18px; font-weight: 700; }
.wp-input-sm   { padding: 8px 10px; font-size: 13px; margin: 0; border-width: 1px; }
.wp-codebox {
  background: var(--bg-soft);
  border: 1.5px dashed var(--accent);
  padding: 14px;
  border-radius: 10px;
  font-family: ui-monospace, monospace;
  font-size: 22px;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 8px;
  margin-bottom: 12px;
}
.wp-codebox-hint { font-size: 11.5px; color: var(--muted); margin-top: -4px; margin-bottom: 14px; }

/* =====================================================
   APP SHELL (chat app page)
   ===================================================== */
body.wp-app {
  background: var(--bg);
  height: 100vh; overflow: hidden;
}
.wp-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
  position: relative;
}

/* ---------- Sidebar ---------- */
.wp-side {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.wp-side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px;
}
.wp-side-brand { font-size: 16px; }
.wp-side-search { padding: 0 16px 12px; }
.wp-side-list {
  flex: 1; overflow-y: auto;
  padding: 0 12px 12px;
}
.wp-side-list::-webkit-scrollbar { width: 6px; }
.wp-side-list::-webkit-scrollbar-thumb { background: rgba(45,106,79,0.18); border-radius: 3px; }

.wp-chat-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
  font-family: inherit;
}
.wp-chat-item:hover { background: var(--surface); border-color: var(--border); }
.wp-chat-item.active {
  background: var(--surface);
  border-color: var(--accent-2);
  box-shadow: 0 2px 8px rgba(45,106,79,0.10);
}
.wp-chat-title {
  font-size: 13.5px; font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wp-chat-meta {
  font-size: 11px; color: var(--muted); margin-top: 3px;
  display: flex; gap: 6px; align-items: center;
}
.wp-chat-meta .wp-chat-host {
  background: var(--bg-soft);
  padding: 1px 6px; border-radius: 999px;
  max-width: 100px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.wp-side-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-sunken);
}
.wp-side-user {
  display: flex; align-items: center; gap: 10px;
}
.wp-side-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.wp-side-userinfo { flex: 1; min-width: 0; }
.wp-side-userline {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wp-side-planline { font-size: 11px; color: var(--muted); }
.wp-tag {
  background: var(--accent); color: #fff;
  padding: 1px 7px; border-radius: 999px;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.6px;
}

/* =====================================================
   SCROLL BALL — the signature widget
   Drag the ball up/down to scrub past chats fast.
   ===================================================== */
.wp-scrollball {
  position: absolute;
  left: 268px;          /* sits on the seam between sidebar and main */
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  cursor: grab;
  width: 28px; height: 28px;
  user-select: none;
}
.wp-scrollball:active,
.wp-scrollball.dragging { cursor: grabbing; }
.wp-scrollball-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #FFF 0%, #C8E2D0 35%, #4C8B5E 75%, #1B3F2D 100%);
  box-shadow:
    0 6px 14px rgba(45,106,79,0.40),
    inset 0 -3px 6px rgba(0,0,0,0.18),
    inset 0 3px 6px rgba(255,255,255,0.30);
  transition: transform .12s ease-out;
}
.wp-scrollball:hover .wp-scrollball-inner { transform: scale(1.12); }
.wp-scrollball.dragging .wp-scrollball-inner { transform: scale(1.18); }
.wp-scrollball-tooltip {
  position: absolute;
  left: 36px;
  top: 50%;
  transform: translateY(-50%);
  background: #14201A;
  color: #FAFCF7;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  max-width: 240px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity .15s, transform .15s;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}
.wp-scrollball-tooltip::before {
  content: '';
  position: absolute;
  left: -5px; top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 8px; height: 8px;
  background: #14201A;
}
.wp-scrollball.dragging .wp-scrollball-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ---------- Main column ---------- */
.wp-main {
  display: flex; flex-direction: column;
  height: 100vh;
  background: var(--bg);
  overflow: hidden;
}
.wp-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--nav);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}
.wp-topbar-title h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.2px; }
.wp-topbar-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.wp-topbar-tools { display: flex; align-items: center; gap: 12px; }
.wp-pill-group {
  display: inline-flex;
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 3px;
  border: 1px solid var(--border);
}
.wp-pill-btn {
  background: transparent; border: none;
  padding: 5px 14px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  color: var(--muted);
  transition: background .12s, color .12s;
}
.wp-pill-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(45,106,79,0.12);
}

/* ---------- Thread ---------- */
.wp-thread {
  flex: 1;
  overflow-y: auto;
  padding: 30px 28px 100px;
  scroll-behavior: smooth;
}
.wp-thread::-webkit-scrollbar { width: 8px; }
.wp-thread::-webkit-scrollbar-thumb { background: rgba(45,106,79,0.18); border-radius: 4px; }

.wp-empty-state {
  max-width: 540px;
  margin: 60px auto;
  text-align: center;
  padding: 40px 20px;
}
.wp-empty-orb {
  width: 72px; height: 72px; border-radius: 20px;
  background: var(--grad);
  margin: 0 auto 20px;
  box-shadow: 0 14px 30px rgba(45,106,79,0.30);
  position: relative;
}
.wp-empty-orb::after {
  content: '✨';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.wp-empty-state h3 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 6px; }
.wp-empty-state p  { color: var(--muted); margin-bottom: 24px; }
.wp-empty-starters {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.wp-starter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  transition: border-color .12s, background .12s, transform .08s;
}
.wp-starter:hover {
  border-color: var(--accent-2);
  background: var(--bg-soft);
  transform: translateY(-1px);
}

/* ---------- Bubbles ---------- */
.wp-bubble-wrap {
  max-width: 760px;
  margin: 0 auto 18px;
  display: flex;
  gap: 12px;
}
.wp-bubble-wrap.user { justify-content: flex-end; }
.wp-bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.wp-bubble.assistant {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.wp-bubble.user {
  background: var(--grad);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.wp-bubble-meta {
  font-size: 11px; color: var(--muted);
  margin-top: 4px;
  padding: 0 4px;
}

/* ---------- Composer ---------- */
.wp-composer {
  border-top: 1px solid var(--border);
  background: var(--nav);
  backdrop-filter: blur(10px);
  padding: 14px 28px 16px;
  flex-shrink: 0;
}
.wp-composer-controls {
  display: flex; gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.wp-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  transition: all .12s;
}
.wp-chip:hover { color: var(--text); border-color: var(--accent-2); }
.wp-chip-active {
  background: var(--bg-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.wp-composer-input {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 6px 8px;
  transition: border-color .15s, box-shadow .15s;
}
.wp-composer-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,106,79,0.10); }
.wp-attach { font-size: 16px; }
#wpInput {
  flex: 1; resize: none; border: none; outline: none;
  font-family: inherit; font-size: 15px; color: var(--text);
  padding: 10px 4px; max-height: 200px;
  background: transparent;
}
.wp-send {
  width: 38px; height: 38px;
  border-radius: 10px;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
}
.wp-composer-foot {
  display: flex; justify-content: space-between;
  font-size: 11.5px; color: var(--muted);
  margin-top: 7px;
  padding: 0 4px;
}

/* =====================================================
   DRAWER (Settings)
   ===================================================== */
.wp-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 360px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 40px rgba(15,32,25,0.10);
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 80;
  display: flex; flex-direction: column;
}
.wp-drawer.show { transform: translateX(0); }
.wp-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.wp-drawer-head h3 { font-size: 17px; font-weight: 700; }
.wp-drawer-body {
  flex: 1; overflow-y: auto;
  padding: 18px 20px 30px;
}
.wp-set-section { margin-bottom: 28px; }
.wp-set-label {
  font-size: 11px; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
}
.wp-set-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.wp-set-row:last-child { border-bottom: none; }
.wp-set-val { color: var(--muted); }
.wp-set-help { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.wp-link-state {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--bg-soft); border-radius: 8px;
  font-size: 12.5px;
}
.wp-link-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #94A3B8;
}
.wp-link-dot.connected { background: #16A34A; box-shadow: 0 0 0 3px rgba(22,163,74,0.18); }

.wp-theme-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.wp-theme-opt {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 11px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: border-color .12s;
}
.wp-theme-opt:hover { border-color: var(--accent-2); }
.wp-theme-opt.active { border-color: var(--accent); background: var(--bg-soft); }
.wp-theme-dot {
  width: 22px; height: 22px; border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.wp-theme-dot-forest { background: linear-gradient(135deg, #5DA975, #2D6A4F); }
.wp-theme-dot-dark   { background: linear-gradient(135deg, #38383E 0%, #18181C 100%); }
.wp-theme-dot-galaxy { background:
    radial-gradient(circle 2px at 32% 30%, #5BE49B 50%, transparent 51%),
    radial-gradient(circle 1.6px at 70% 64%, #FF6B6B 50%, transparent 51%),
    linear-gradient(135deg, #0E2A1E, #07090F); }

/* =====================================================
   THEME OVERRIDES on the app shell
   ===================================================== */
body.wp-app[data-theme="dark"] {
  --bg: #232328; --bg-soft: #2A2A2E; --bg-sunken: #1F1F23;
  --text: #F5F5F7; --muted: #C9C9D2; --border: #4A4A52;
  --accent: #56C98A; --accent-2: #4C8B5E;
  --grad: linear-gradient(135deg, #4C8B5E, #2D6A4F);
}
body.wp-app[data-theme="galaxy"] {
  --bg: #07090F; --bg-soft: #11141C; --bg-sunken: #161B2A;
  --text: #ECF4FF; --muted: #98A8C4; --border: #232A3E;
  --accent: #5BE49B; --accent-2: #2BB57F;
  --grad: linear-gradient(135deg, #5BE49B, #00AA66);
}

/* dark themes need card overrides */
body.wp-app[data-theme="dark"] .wp-card,
body.wp-app[data-theme="galaxy"]   .wp-card,
body.wp-app[data-theme="dark"] .wp-bubble.assistant,
body.wp-app[data-theme="galaxy"]   .wp-bubble.assistant,
body.wp-app[data-theme="dark"] .wp-composer-input,
body.wp-app[data-theme="galaxy"]   .wp-composer-input,
body.wp-app[data-theme="dark"] .wp-chip,
body.wp-app[data-theme="galaxy"]   .wp-chip,
body.wp-app[data-theme="dark"] .wp-input,
body.wp-app[data-theme="galaxy"]   .wp-input,
body.wp-app[data-theme="dark"] .wp-chat-item:hover,
body.wp-app[data-theme="galaxy"]   .wp-chat-item:hover,
body.wp-app[data-theme="dark"] .wp-chat-item.active,
body.wp-app[data-theme="galaxy"]   .wp-chat-item.active,
body.wp-app[data-theme="dark"] .wp-starter,
body.wp-app[data-theme="galaxy"]   .wp-starter,
body.wp-app[data-theme="dark"] .wp-theme-opt,
body.wp-app[data-theme="galaxy"]   .wp-theme-opt {
  background: var(--bg-soft);
  color: var(--text);
}

/* Light tweak: make pill-group reflect theme */
body.wp-app .wp-pill-btn.active { color: var(--accent); }
