:root {
  --bg: #050305;
  --bg-deep: #020102;
  --panel: #0c080b;
  --panel-2: #130b11;
  --panel-3: #1c0d17;
  --line: rgba(255, 126, 199, .11);
  --line-strong: rgba(255, 86, 181, .24);
  --text: #fff3fa;
  --muted: #a9869a;
  --dim: #6e5363;
  --acid: #ff2f9f;
  --acid-soft: rgba(255, 47, 159, .13);
  --violet: #c45bff;
  --danger: #ff477e;
  --sidebar: 286px;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { width: 100%; max-width: 100vw; height: 100%; margin: 0; overflow: hidden; }
body {
  background:
    radial-gradient(circle at 78% 3%, rgba(255, 31, 143, .105), transparent 29%),
    radial-gradient(circle at 24% 104%, rgba(198, 48, 146, .08), transparent 32%),
    linear-gradient(115deg, #030203 0%, #080407 48%, #030203 100%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, textarea, input { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.noise {
  position: fixed; inset: 0; pointer-events: none; opacity: .31; z-index: 100;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.10'/%3E%3C/svg%3E");
  mix-blend-mode: screen;
}

.sigil-field { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.field-sigil { position: absolute; fill: none; stroke: rgba(255,47,159,.18); stroke-width: .7; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 13px rgba(255,20,137,.14)); }
.field-sigil-a { width: min(24vw, 330px); height: auto; right: 3vw; top: 14vh; transform: rotate(7deg); opacity: .72; }
.field-sigil-b { width: min(31vw, 430px); height: auto; left: 19vw; bottom: -16vh; transform: rotate(13deg); opacity: .38; }
.field-sigil-c { width: min(18vw, 250px); height: auto; left: 31vw; top: -5vh; transform: rotate(-16deg); opacity: .34; }
.rune { position: absolute; color: rgba(255,91,180,.16); font-family: Georgia, serif; text-shadow: 0 0 24px rgba(255,20,137,.26); }
.rune-a { left: 18vw; top: 12vh; font-size: 64px; transform: rotate(-12deg); }
.rune-b { right: 29vw; bottom: 12vh; font-size: 38px; transform: rotate(22deg); }
.rune-c { right: 5vw; bottom: 4vh; font-size: 75px; transform: rotate(9deg); }

.app-shell { position: relative; z-index: 1; display: grid; grid-template-columns: var(--sidebar) 1fr; height: 100%; }

/* Authentication gate */
.auth-screen {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center;
  gap: 12px; padding: 24px; text-align: center; z-index: 50;
  background:
    linear-gradient(rgba(8,9,11,.92), rgba(8,9,11,.98)),
    repeating-linear-gradient(90deg, transparent 0 79px, rgba(255,255,255,.025) 80px),
    repeating-linear-gradient(0deg, transparent 0 79px, rgba(255,255,255,.025) 80px);
}
.auth-screen[hidden] { display: none; }
.auth-kicker { color: var(--acid); letter-spacing: .24em; font-size: 10px; font-weight: 700; }
.auth-screen h1 { margin: 4px 0 0; font-size: clamp(30px, 7vw, 54px); letter-spacing: -.055em; }
.auth-screen h1 i { color: var(--acid); font-style: normal; font-weight: 300; }
.auth-screen p { color: var(--muted); max-width: 360px; line-height: 1.6; margin: 0; }
.ghost-button { border: 1px solid var(--line-strong); background: var(--panel); border-radius: 10px; padding: 10px 16px; cursor: pointer; }
.auth-form { width: min(360px, calc(100vw - 36px)); margin-top: 5px; text-align: left; }
.auth-form[hidden] { display: none; }
.auth-form label { display: block; margin: 0 0 8px 3px; color: var(--dim); font: 700 8px ui-monospace, monospace; letter-spacing: .17em; }
.auth-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 7px; border: 1px solid var(--line-strong); border-radius: 13px; background: rgba(17,20,25,.94); }
.auth-input-row:focus-within { border-color: rgba(216,255,83,.4); box-shadow: 0 0 0 1px rgba(216,255,83,.05), 0 14px 50px rgba(0,0,0,.3); }
.auth-input-row input { min-width: 0; padding: 6px 8px; border: 0; outline: 0; background: transparent; color: var(--text); font: 14px ui-monospace, monospace; letter-spacing: .08em; }
.auth-input-row input::placeholder { color: #50545a; letter-spacing: .16em; }
.auth-input-row button { min-width: 78px; padding: 0 13px; border: 0; border-radius: 8px; background: var(--acid); color: #101205; font: 750 9px ui-monospace, monospace; letter-spacing: .09em; cursor: pointer; }
.auth-input-row button:disabled { opacity: .35; cursor: default; }
.auth-form > small { display: block; margin: 8px 3px 0; color: var(--dim); font-size: 9px; }
.auth-form.locked .auth-input-row { border-color: rgba(255,95,115,.3); }
.auth-form.locked > small { color: var(--danger); }
.auth-sigil { position: relative; width: 96px; height: 96px; margin-bottom: 10px; animation: breathe 3s ease-in-out infinite; }
.auth-sigil span { position: absolute; inset: 13px; border: 1px solid rgba(216,255,83,.48); transform: rotate(45deg); }
.auth-sigil span:nth-child(2) { inset: 25px; transform: rotate(0); border-color: rgba(167,139,250,.52); }
.auth-sigil span:nth-child(3) { inset: 39px; border-radius: 50%; border-color: var(--text); box-shadow: 0 0 22px rgba(216,255,83,.24); }
.auth-sigil span:nth-child(4) { inset: 0 47px; transform: none; border: 0; border-left: 1px solid var(--acid); }

/* Sidebar */
.sidebar {
  min-width: 0; height: 100%; padding: calc(18px + var(--safe-top)) 14px calc(14px + var(--safe-bottom));
  display: flex; flex-direction: column; background: rgba(7, 8, 10, .88);
  border-right: 1px solid var(--line); backdrop-filter: blur(28px); z-index: 30;
}
.brand-row { display: flex; align-items: center; min-height: 48px; padding: 0 5px; gap: 11px; }
.brand-mark { width: 37px; height: 37px; padding: 0; border: 0; background: transparent; color: var(--acid); }
.brand-mark svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.25; filter: drop-shadow(0 0 8px rgba(216,255,83,.16)); }
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-copy strong { font-size: 14px; letter-spacing: .015em; }
.brand-copy strong b { color: var(--acid); font-weight: 400; }
.brand-copy span { margin-top: 2px; color: var(--dim); font: 700 8px/1.2 ui-monospace, monospace; letter-spacing: .22em; }
.new-chat {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; margin: 24px 0 22px;
  padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(255,255,255,.025);
  font-size: 13px; cursor: pointer; transition: .18s ease;
}
.new-chat:hover { border-color: rgba(216,255,83,.36); background: var(--acid-soft); }
.new-chat svg { width: 17px; fill: none; stroke: var(--acid); stroke-width: 1.7; }
.new-chat kbd { margin-left: auto; color: var(--dim); font: 10px ui-monospace, monospace; }
.sidebar-label { display: flex; align-items: center; gap: 10px; padding: 0 9px 10px; }
.sidebar-label span { color: var(--dim); font: 700 9px ui-monospace, monospace; letter-spacing: .16em; text-transform: uppercase; }
.sidebar-label i { height: 1px; flex: 1; background: var(--line); }
.conversation-list { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.conversation-item {
  position: relative; width: 100%; display: grid; grid-template-columns: 1fr 28px; gap: 4px; align-items: center;
  padding: 10px 7px 10px 11px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left;
  transition: background .15s ease;
}
.conversation-item:hover, .conversation-item.active { background: rgba(255,255,255,.05); }
.conversation-item.active::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; background: var(--acid); box-shadow: 0 0 8px var(--acid); }
.conversation-copy { overflow: hidden; }
.conversation-copy strong, .conversation-copy small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.conversation-copy strong { font-size: 12.5px; font-weight: 570; }
.conversation-copy small { color: var(--dim); font-size: 10px; margin-top: 4px; }
.delete-chat { display: grid; place-items: center; width: 27px; height: 27px; padding: 0; border: 0; border-radius: 7px; background: transparent; opacity: 0; cursor: pointer; }
.conversation-item:hover .delete-chat { opacity: .7; }
.delete-chat:hover { color: var(--danger); background: rgba(255,95,115,.1); opacity: 1; }
.delete-chat svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.sidebar-footer { border-top: 1px solid var(--line); padding-top: 12px; }
.profile-card { display: flex; align-items: center; width: 100%; padding: 7px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(216,255,83,.35); border-radius: 9px; background: var(--acid-soft); color: var(--acid); font-weight: 750; font-size: 12px; }
.profile-copy { min-width: 0; display: flex; flex-direction: column; margin-left: 9px; }
.profile-copy strong { font-size: 12px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy small { color: var(--dim); font-size: 9px; margin-top: 3px; }
.online-dot { width: 7px; height: 7px; margin-left: auto; margin-right: 7px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 9px rgba(216,255,83,.55); }

/* Main */
.main-panel { position: relative; min-width: 0; height: 100%; display: grid; grid-template-rows: auto 1fr auto; }
.main-panel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .28;
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 48px 48px; mask-image: linear-gradient(to bottom, #000, transparent 60%);
}
.topbar {
  position: relative; z-index: 20; height: calc(70px + var(--safe-top)); padding: var(--safe-top) 26px 0;
  display: flex; align-items: center; border-bottom: 1px solid var(--line); background: rgba(8,9,11,.76); backdrop-filter: blur(22px);
}
.model-status { display: flex; align-items: center; gap: 11px; }
.model-picker-button { padding: 5px 8px 5px 4px; border: 1px solid transparent; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.model-picker-button:hover, .model-picker-button[aria-expanded="true"] { border-color: var(--line); background: rgba(255,255,255,.025); }
.status-rune { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--acid); font: 18px serif; }
.model-status > div { display: flex; flex-direction: column; }
.model-status strong { font: 680 11px/1.2 ui-monospace, monospace; letter-spacing: .08em; }
.model-status small { display: flex; align-items: center; gap: 6px; margin-top: 5px; color: var(--dim); font-size: 9px; }
.model-status small i { width: 5px; height: 5px; background: var(--acid); border-radius: 50%; box-shadow: 0 0 6px var(--acid); }
.model-chevron { width: 14px; margin-left: 5px; fill: none; stroke: var(--muted); stroke-width: 1.5; }
.model-popover { position: absolute; z-index: 55; top: calc(61px + var(--safe-top)); left: 22px; width: min(430px, calc(100vw - 28px)); padding: 14px; border: 1px solid var(--line-strong); border-radius: 15px; background: rgba(11,5,9,.98); box-shadow: 0 28px 90px rgba(0,0,0,.64); backdrop-filter: blur(24px); animation: pop .16s ease-out; }
.model-popover[hidden] { display: none; }
.model-popover header { display: flex; flex-direction: column; padding: 2px 4px 11px; }
.model-popover header small { color: var(--acid); font: 700 8px ui-monospace, monospace; letter-spacing: .18em; }
.model-popover header strong { margin-top: 5px; font-size: 15px; }
.model-options { display: grid; gap: 7px; }
.model-option { position: relative; display: grid; grid-template-columns: 33px minmax(0,1fr) auto; gap: 10px; align-items: start; width: 100%; padding: 11px; border: 1px solid var(--line); border-radius: 4px 12px 4px 12px; background: rgba(255,255,255,.018); text-align: left; cursor: pointer; }
.model-option:hover { border-color: rgba(255,47,159,.36); background: rgba(255,47,159,.055); }
.model-option.active { border-color: rgba(255,47,159,.6); background: linear-gradient(100deg, rgba(255,47,159,.13), rgba(255,47,159,.025)); }
.model-glyph { display: grid; place-items: center; width: 33px; height: 33px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--acid); font: 12px ui-monospace, monospace; }
.model-option-copy { min-width: 0; display: flex; flex-direction: column; }
.model-option-copy strong { font-size: 12px; }
.model-option-copy span { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.model-option-copy small { margin-top: 6px; color: var(--dim); font: 8px ui-monospace, monospace; letter-spacing: .04em; }
.model-price { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font: 7px ui-monospace, monospace; white-space: nowrap; }
.model-option.active .model-price { border-color: rgba(255,47,159,.28); color: #ffc3e3; }
.model-popover > p { margin: 11px 4px 1px; color: var(--dim); font-size: 9px; line-height: 1.4; }
.balance-pill {
  margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 176px; height: 45px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); cursor: pointer; text-align: left;
}
.balance-pill:hover, .balance-pill[aria-expanded="true"] { border-color: rgba(216,255,83,.28); background: rgba(216,255,83,.045); }
.balance-orbit { position: relative; width: 27px; height: 27px; border-radius: 50%; background: conic-gradient(var(--acid) var(--progress, 0%), rgba(255,255,255,.08) 0); }
.balance-orbit::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--panel); }
.balance-orbit i { position: absolute; z-index: 1; inset: 10px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 7px var(--acid); }
.balance-copy { display: flex; flex-direction: column; flex: 1; }
.balance-copy small { color: var(--dim); font: 650 7.5px ui-monospace, monospace; letter-spacing: .1em; }
.balance-copy strong { margin-top: 4px; font: 650 13px ui-monospace, monospace; }
.balance-pill > svg { width: 14px; fill: none; stroke: var(--muted); stroke-width: 1.5; }
.balance-popover {
  position: absolute; z-index: 50; top: calc(60px + var(--safe-top)); right: 26px; width: min(350px, calc(100vw - 28px));
  padding: 18px; border: 1px solid var(--line-strong); border-radius: 16px; background: rgba(13,15,18,.97);
  box-shadow: 0 24px 80px rgba(0,0,0,.55); backdrop-filter: blur(24px); transform-origin: top right; animation: pop .16s ease-out;
}
.balance-popover[hidden] { display: none; }
.balance-head { display: flex; align-items: end; justify-content: space-between; }
.balance-head > div { display: flex; flex-direction: column; }
.balance-head small { color: var(--dim); font: 700 8px ui-monospace, monospace; letter-spacing: .14em; }
.balance-head strong { margin-top: 5px; font: 650 24px ui-monospace, monospace; }
.balance-head > span { color: var(--acid); font: 12px ui-monospace, monospace; }
.budget-track { height: 4px; margin: 15px 0 17px; overflow: hidden; border-radius: 8px; background: rgba(255,255,255,.07); }
.budget-track i { display: block; width: 0; height: 100%; background: var(--acid); box-shadow: 0 0 10px rgba(216,255,83,.5); transition: width .3s ease; }
.usage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.usage-grid > div { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.018); }
.usage-grid span, .usage-grid strong { display: block; }
.usage-grid span { color: var(--dim); font-size: 9px; }
.usage-grid strong { margin-top: 5px; font: 12px ui-monospace, monospace; }
.tool-budget { display: flex; justify-content: space-between; margin-top: 13px; color: var(--dim); font: 9px ui-monospace, monospace; letter-spacing: .07em; }
.tool-budget b { color: var(--text); margin-left: 4px; }
.balance-popover p { margin: 14px 0 0; color: var(--dim); font-size: 9px; line-height: 1.45; }

/* Chat */
.chat-scroll { position: relative; z-index: 2; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.message-list { width: min(860px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 24px; }
.empty-state { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 22px 40px; text-align: center; }
.empty-state[hidden] { display: none; }
.hero-sigil { position: relative; width: 118px; height: 118px; margin-bottom: 28px; }
.sigil-ring { position: absolute; border: 1px solid; }
.ring-a { inset: 6px; border-color: rgba(216,255,83,.35); transform: rotate(45deg); box-shadow: inset 0 0 25px rgba(216,255,83,.03); }
.ring-a::before, .ring-a::after { content: ""; position: absolute; background: var(--bg); }
.ring-a::before { left: 42%; right: 42%; top: -2px; bottom: -2px; }
.ring-a::after { top: 42%; bottom: 42%; left: -2px; right: -2px; }
.ring-b { inset: 25px; border-radius: 50%; border-color: rgba(167,139,250,.45); }
.sigil-spine { position: absolute; left: 58px; top: -12px; height: 142px; border-left: 1px solid rgba(255,255,255,.32); }
.sigil-spine::before, .sigil-spine::after { content: ""; position: absolute; left: -5px; width: 9px; height: 9px; border: 1px solid var(--acid); transform: rotate(45deg); }
.sigil-spine::before { top: 27px; } .sigil-spine::after { bottom: 27px; }
.sigil-eye { position: absolute; inset: 45px 29px; border: 1px solid var(--text); border-radius: 100% 0; transform: rotate(45deg); }
.sigil-eye::after { content: ""; position: absolute; width: 8px; height: 8px; top: 8px; left: 8px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 16px var(--acid); }
.sigil-node { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 8px var(--violet); }
.sigil-node.n1 { top: 6px; left: 57px; } .sigil-node.n2 { bottom: 6px; left: 57px; }
.eyebrow { color: var(--acid); font: 650 9px ui-monospace, monospace; letter-spacing: .2em; }
.empty-state h2 { margin: 14px 0 11px; font-size: clamp(34px, 5.2vw, 58px); line-height: .98; letter-spacing: -.055em; font-weight: 620; }
.empty-state h2 em { color: transparent; font-style: normal; -webkit-text-stroke: 1px rgba(242,241,237,.62); }
.empty-state > p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.prompt-grid { width: min(590px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 34px; }
.prompt-grid button { display: flex; align-items: center; gap: 13px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.018); text-align: left; cursor: pointer; }
.prompt-grid button:hover { border-color: rgba(216,255,83,.22); background: rgba(216,255,83,.035); }
.prompt-grid svg { width: 22px; min-width: 22px; fill: none; stroke: var(--acid); stroke-width: 1.25; }
.prompt-grid span { display: flex; flex-direction: column; }
.prompt-grid strong { font-size: 11px; font-weight: 600; }
.prompt-grid small { margin-top: 4px; color: var(--dim); font-size: 9px; }

.message { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 14px; margin-bottom: 30px; animation: message-in .2s ease-out; }
.message.user { grid-template-columns: minmax(0, 1fr); justify-items: end; }
.message-avatar { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(216,255,83,.25); border-radius: 9px; color: var(--acid); background: var(--acid-soft); font: 10px ui-monospace, monospace; }
.message-body { min-width: 0; width: 100%; max-width: 100%; overflow: hidden; }
.message.user .message-body { max-width: min(76%, 660px); padding: 12px 15px; border: 1px solid var(--line); border-radius: 16px 16px 4px 16px; background: var(--panel-2); }
.message-content { color: #e7e6e2; font-size: 14px; line-height: 1.68; word-break: break-word; }
.message-content > :first-child { margin-top: 0; } .message-content > :last-child { margin-bottom: 0; }
.message-content p { margin: 0 0 12px; }
.message-content h1, .message-content h2, .message-content h3 { margin: 20px 0 8px; line-height: 1.25; letter-spacing: -.02em; }
.message-content h1 { font-size: 20px; } .message-content h2 { font-size: 17px; } .message-content h3 { font-size: 15px; }
.message-content strong { color: #fff; font-weight: 650; }
.message-content em { color: #c3c1bd; }
.message-content ul, .message-content ol { margin: 8px 0 14px; padding-left: 22px; }
.message-content li { margin: 5px 0; }
.message-content a { color: var(--acid); text-decoration-color: rgba(216,255,83,.35); text-underline-offset: 3px; }
.message-content code { padding: 2px 5px; border: 1px solid var(--line); border-radius: 5px; background: #050607; color: #d9d2ff; font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.message-content pre { position: relative; margin: 14px 0; padding: 14px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; background: #050607; }
.message-content pre code { padding: 0; border: 0; background: none; color: #d8d7d2; }
.message-content blockquote { margin: 12px 0; padding: 4px 0 4px 13px; border-left: 2px solid var(--acid); color: var(--muted); }
.message-content .karishka-signoff { margin-top: 18px; color: #ff83c3; font-size: 11px; font-style: italic; letter-spacing: .035em; text-shadow: 0 0 14px rgba(255,47,159,.24); }
.message-tools { display: flex; align-items: center; gap: 5px; margin-top: 8px; opacity: 0; transition: opacity .15s; }
.message:hover .message-tools { opacity: 1; }
.message-tools button { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--dim); cursor: pointer; }
.message-tools button:hover { color: var(--text); background: rgba(255,255,255,.05); }
.message-tools svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.message-attachments { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 9px; }
.file-card { display: inline-flex; align-items: center; gap: 8px; max-width: 270px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); color: inherit; text-decoration: none; }
.file-card:hover { border-color: rgba(216,255,83,.3); }
.file-card svg { width: 17px; min-width: 17px; fill: none; stroke: var(--acid); stroke-width: 1.4; }
.file-card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.image-card { position: relative; width: min(280px, 65vw); height: 170px; padding: 0; overflow: hidden; }
.image-card img { width: 100%; height: 100%; object-fit: cover; }
.image-card::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(0,0,0,.76)); }
.image-card span { position: absolute; z-index: 1; left: 10px; right: 10px; bottom: 8px; color: white; }
.streaming-cursor::after { content: ""; display: inline-block; width: 6px; height: 14px; margin-left: 3px; background: var(--acid); vertical-align: -2px; animation: blink .8s steps(1) infinite; box-shadow: 0 0 6px rgba(216,255,83,.45); }
.thinking { display: flex; gap: 5px; padding: 7px 0; }
.thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: dots 1.1s infinite; }
.thinking i:nth-child(2) { animation-delay: .14s; }.thinking i:nth-child(3) { animation-delay: .28s; }

/* Composer */
.composer-zone { position: relative; z-index: 15; padding: 6px max(22px, calc((100% - 860px) / 2)) calc(15px + var(--safe-bottom)); background: linear-gradient(to top, var(--bg) 72%, transparent); }
.composer { display: flex; align-items: flex-end; gap: 7px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 17px; background: rgba(17,20,25,.94); box-shadow: 0 16px 60px rgba(0,0,0,.32); transition: border-color .18s, box-shadow .18s; }
.composer:focus-within { border-color: rgba(216,255,83,.27); box-shadow: 0 16px 60px rgba(0,0,0,.4), 0 0 0 1px rgba(216,255,83,.035); }
.composer textarea { flex: 1; min-height: 36px; max-height: 170px; padding: 8px 5px 7px; resize: none; overflow-y: auto; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; line-height: 1.45; }
.composer textarea::placeholder { color: #656970; }
.attach-button, .send-button { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border: 0; border-radius: 10px; cursor: pointer; }
.attach-button { background: transparent; color: var(--muted); }
.attach-button:hover { color: var(--text); background: rgba(255,255,255,.05); }
.attach-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.45; }
.send-button { background: var(--acid); color: #101205; box-shadow: 0 0 15px rgba(216,255,83,.1); }
.send-button:disabled { opacity: .28; cursor: default; }
.send-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.send-button .stop-icon { display: none; fill: currentColor; stroke: none; }
.send-button.generating .send-icon { display: none; }.send-button.generating .stop-icon { display: block; }
.composer-tools { display: flex; align-items: center; gap: 7px; padding: 8px 5px 0; }
.tool-toggle { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--dim); font: 700 8px ui-monospace, monospace; letter-spacing: .08em; cursor: pointer; }
.tool-toggle svg { width: 13px; fill: none; stroke: currentColor; stroke-width: 1.45; }
.tool-toggle[aria-pressed="true"] { color: var(--acid); border-color: rgba(216,255,83,.3); background: var(--acid-soft); }
.context-status { display: flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-left: 1px solid var(--line); color: var(--dim); font: 700 8px ui-monospace, monospace; letter-spacing: .06em; }
.context-status svg { width: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.context-status b { color: var(--muted); font-weight: 700; }
.context-status.compacted { color: var(--acid); }
.privacy-note { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--dim); font: 8px ui-monospace, monospace; }
.privacy-note i { width: 4px; height: 4px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 6px var(--violet); }
.attachment-strip { display: flex; gap: 7px; overflow-x: auto; padding: 0 4px 8px; }
.attachment-strip[hidden] { display: none; }
.pending-file { display: flex; align-items: center; gap: 7px; max-width: 220px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.pending-file.image { position: relative; width: 76px; height: 64px; flex: 0 0 76px; padding: 0; overflow: hidden; }
.pending-file.image img { width: 100%; height: 100%; object-fit: cover; }
.pending-file.image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 45%, rgba(0,0,0,.7)); pointer-events: none; }
.pending-file.image span { position: absolute; z-index: 1; left: 6px; right: 20px; bottom: 5px; color: #fff; }
.pending-file.image button { position: absolute; z-index: 2; top: 4px; right: 4px; color: #fff; background: rgba(0,0,0,.62); }
.pending-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.pending-file button { width: 17px; height: 17px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.07); color: var(--muted); cursor: pointer; }
.drop-halo { position: absolute; inset: -90px 22px 4px; display: none; place-items: center; border: 1px dashed rgba(216,255,83,.6); border-radius: 18px; background: rgba(8,9,11,.92); color: var(--acid); font: 10px ui-monospace, monospace; letter-spacing: .15em; z-index: 5; }
.composer-zone.dragging .drop-halo { display: grid; }

.icon-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.mobile-only { display: none; }
.sidebar-backdrop { display: none; }
.toast-stack { position: fixed; z-index: 200; right: 16px; bottom: calc(16px + var(--safe-bottom)); display: grid; gap: 8px; }
.toast { max-width: 330px; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: #14171b; box-shadow: 0 12px 45px rgba(0,0,0,.4); font-size: 11px; animation: toast-in .2s ease-out; }
.toast.error { border-color: rgba(255,95,115,.3); color: #ffd6db; }

/* Black / pink sigil skin */
.auth-screen {
  background:
    radial-gradient(circle at 50% 38%, rgba(255,26,143,.16), transparent 24%),
    linear-gradient(rgba(4,2,4,.88), rgba(4,2,4,.96)),
    repeating-linear-gradient(90deg, transparent 0 79px, rgba(255,47,159,.05) 80px),
    repeating-linear-gradient(0deg, transparent 0 79px, rgba(255,47,159,.05) 80px);
}
.auth-screen::before, .auth-screen::after { content: ""; position: absolute; pointer-events: none; }
.auth-screen::before { width: min(72vw, 620px); aspect-ratio: 1; border: 1px solid rgba(255,47,159,.1); border-radius: 50%; box-shadow: 0 0 120px rgba(255,0,128,.08), inset 0 0 90px rgba(255,0,128,.04); }
.auth-screen::after { width: min(54vw, 430px); aspect-ratio: 1; border: 1px solid rgba(255,151,211,.13); transform: rotate(45deg); }
.auth-screen > * { position: relative; z-index: 1; }
.auth-sigil { filter: drop-shadow(0 0 20px rgba(255,26,143,.32)); }
.auth-sigil span { border-color: rgba(255,47,159,.68); }
.auth-sigil span:nth-child(2) { border-color: rgba(255,168,219,.45); }
.auth-sigil span:nth-child(3) { border-color: #ffd7ed; box-shadow: 0 0 24px rgba(255,47,159,.38); }
.auth-input-row { border-color: rgba(255,75,170,.27); background: rgba(10,4,8,.95); border-radius: 4px 13px 4px 13px; }
.auth-input-row:focus-within { border-color: rgba(255,47,159,.64); box-shadow: 0 0 0 1px rgba(255,47,159,.08), 0 0 40px rgba(255,0,126,.12); }
.auth-input-row button { color: #15000c; border-radius: 2px 8px 2px 8px; box-shadow: 0 0 24px rgba(255,47,159,.24); }

.sidebar {
  background:
    linear-gradient(180deg, rgba(255,47,159,.045), transparent 18%),
    rgba(5,2,4,.91);
  border-right-color: rgba(255,69,166,.17);
  box-shadow: 14px 0 70px rgba(0,0,0,.2);
}
.brand-mark { filter: drop-shadow(0 0 13px rgba(255,47,159,.34)); }
.brand-mark svg { filter: none; }
.new-chat { border-color: rgba(255,71,165,.27); border-radius: 3px 13px 3px 13px; background: linear-gradient(105deg, rgba(255,47,159,.09), rgba(255,255,255,.01)); }
.new-chat:hover { border-color: rgba(255,47,159,.62); background: rgba(255,47,159,.13); box-shadow: 0 0 28px rgba(255,0,128,.08); }
.conversation-item { border-radius: 2px 10px 2px 10px; }
.conversation-item:hover, .conversation-item.active { background: linear-gradient(90deg, rgba(255,47,159,.12), rgba(255,47,159,.02)); }
.conversation-item.active::before { top: 8px; bottom: 8px; background: var(--acid); box-shadow: 0 0 13px rgba(255,47,159,.75); }
.avatar { border-color: rgba(255,47,159,.42); border-radius: 3px 9px 3px 9px; }
.online-dot { background: var(--acid); box-shadow: 0 0 11px rgba(255,47,159,.8); }

.main-panel::before {
  opacity: .42;
  background-image:
    linear-gradient(rgba(255,47,159,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,47,159,.025) 1px, transparent 1px);
  background-size: 54px 54px;
}
.main-panel::after { content: ""; position: absolute; z-index: 0; inset: 70px 0 auto; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,47,159,.25), transparent); pointer-events: none; }
.topbar { border-bottom-color: rgba(255,68,165,.14); background: rgba(5,2,4,.72); }
.status-rune { border-color: rgba(255,47,159,.3); box-shadow: inset 0 0 17px rgba(255,47,159,.08), 0 0 16px rgba(255,0,126,.07); }
.model-status small i { background: var(--acid); box-shadow: 0 0 8px rgba(255,47,159,.85); }
.balance-pill { border-color: rgba(255,74,170,.18); border-radius: 3px 13px 3px 13px; background: rgba(16,6,13,.64); }
.balance-pill:hover, .balance-pill[aria-expanded="true"] { border-color: rgba(255,47,159,.48); background: rgba(255,47,159,.08); }
.balance-orbit i { box-shadow: 0 0 11px rgba(255,47,159,.85); }
.balance-popover { border-color: rgba(255,67,166,.3); border-radius: 4px 16px 4px 16px; background: rgba(12,4,10,.97); box-shadow: 0 28px 90px rgba(0,0,0,.65), 0 0 50px rgba(255,0,128,.07); }
.budget-track i { box-shadow: 0 0 13px rgba(255,47,159,.65); }

.hero-sigil { filter: drop-shadow(0 0 21px rgba(255,47,159,.22)); }
.ring-a { border-color: rgba(255,47,159,.58); box-shadow: inset 0 0 28px rgba(255,47,159,.08), 0 0 35px rgba(255,0,128,.06); animation: sigil-turn 18s linear infinite; }
.ring-b { border-color: rgba(255,178,220,.45); animation: sigil-turn-reverse 13s linear infinite; }
.sigil-spine { border-left-color: rgba(255,178,220,.52); }
.sigil-eye { border-color: #ffc4e3; }
.sigil-eye::after { background: var(--acid); box-shadow: 0 0 20px rgba(255,47,159,.95); }
.sigil-node { background: #ff99cf; box-shadow: 0 0 10px #ff2f9f; }
.empty-state h2 { text-shadow: 0 0 45px rgba(255,47,159,.08); }
.empty-state h2 em { -webkit-text-stroke-color: rgba(255,126,194,.67); }
.prompt-grid button { border-color: rgba(255,79,173,.17); border-radius: 3px 14px 3px 14px; background: rgba(15,6,12,.58); }
.prompt-grid button:hover { border-color: rgba(255,47,159,.45); background: rgba(255,47,159,.075); transform: translateY(-1px); }

.message-avatar { border-color: rgba(255,47,159,.36); border-radius: 2px 9px 2px 9px; box-shadow: 0 0 16px rgba(255,0,128,.07); }
.message.user .message-body { border-color: rgba(255,81,174,.25); border-radius: 15px 3px 15px 15px; background: linear-gradient(135deg, rgba(255,47,159,.13), rgba(27,10,21,.9)); box-shadow: 0 10px 38px rgba(0,0,0,.16); }
.message-content { color: #f9eaf3; }
.message-content a { text-decoration-color: rgba(255,47,159,.4); }
.message-content code, .message-content pre { border-color: rgba(255,69,167,.16); background: #050204; color: #ffc5e4; }
.file-card { border-color: rgba(255,77,171,.18); background: rgba(255,47,159,.055); }
.file-card:hover { border-color: rgba(255,47,159,.46); }
.streaming-cursor::after { box-shadow: 0 0 9px rgba(255,47,159,.75); }

.composer-zone { background: linear-gradient(to top, #050305 70%, transparent); }
.composer { border-color: rgba(255,72,168,.28); border-radius: 4px 17px 4px 17px; background: rgba(10,4,8,.94); box-shadow: 0 18px 70px rgba(0,0,0,.45), 0 0 40px rgba(255,0,128,.025); }
.composer:focus-within { border-color: rgba(255,47,159,.58); box-shadow: 0 18px 70px rgba(0,0,0,.52), 0 0 0 1px rgba(255,47,159,.05), 0 0 40px rgba(255,0,128,.07); }
.composer textarea::placeholder { color: #775568; }
.send-button { color: #16000c; border-radius: 2px 10px 2px 10px; box-shadow: 0 0 23px rgba(255,47,159,.3); }
.tool-toggle { border-color: rgba(255,76,171,.16); border-radius: 2px 8px 2px 8px; }
.tool-toggle[aria-pressed="true"] { border-color: rgba(255,47,159,.52); background: rgba(255,47,159,.14); box-shadow: 0 0 16px rgba(255,0,128,.06); }
.privacy-note i { background: var(--acid); box-shadow: 0 0 8px rgba(255,47,159,.8); }
.drop-halo { border-color: rgba(255,47,159,.68); background: rgba(5,2,4,.94); }
.toast { border-color: rgba(255,66,166,.26); border-radius: 3px 11px 3px 11px; background: #150811; }

@keyframes sigil-turn { to { transform: rotate(405deg); } }
@keyframes sigil-turn-reverse { to { transform: rotate(-360deg); } }

@keyframes blink { 50% { opacity: 0; } }
@keyframes dots { 0%, 65%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }
@keyframes message-in { from { opacity: 0; transform: translateY(5px); } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes breathe { 50% { transform: scale(1.035); filter: brightness(1.2); } }

@media (max-width: 760px) {
  :root { --sidebar: min(86vw, 310px); }
  .field-sigil-a { width: 260px; right: -118px; top: 18vh; opacity: .58; }
  .field-sigil-b { width: 285px; left: -145px; bottom: -4vh; opacity: .33; }
  .field-sigil-c { display: none; }
  .rune-a { left: 7vw; top: 14vh; font-size: 42px; }
  .rune-b { right: 7vw; bottom: 16vh; }
  .rune-c { display: none; }
  .app-shell { grid-template-columns: minmax(0, 1fr); width: 100vw; overflow: hidden; }
  .main-panel { width: 100vw; max-width: 100vw; overflow: hidden; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 20px 0 70px rgba(0,0,0,.55); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 29; background: rgba(0,0,0,.58); backdrop-filter: blur(4px); }
  .sidebar-backdrop.open { display: block; }
  .mobile-only { display: grid; }
  .brand-row .mobile-only { margin-left: auto; }
  .topbar { height: calc(62px + var(--safe-top)); padding: var(--safe-top) 13px 0; gap: 8px; }
  .model-status { min-width: 0; gap: 7px; }.status-rune { display: none; }
  .model-status strong { font-size: 8.5px; white-space: nowrap; }.model-status small { display: none; }
  .model-picker-button { padding: 5px; }.model-chevron { width: 11px; margin-left: 0; }
  .model-popover { top: calc(57px + var(--safe-top)); left: 13px; padding: 11px; }
  .model-option { grid-template-columns: 30px minmax(0,1fr) auto; padding: 9px; gap: 8px; }
  .model-glyph { width: 30px; height: 30px; }
  .balance-pill { min-width: 102px; width: 102px; height: 39px; padding: 0 8px; gap: 7px; }
  .balance-orbit { width: 23px; min-width: 23px; height: 23px; }.balance-copy small { display: none; }.balance-copy strong { font-size: 10px; white-space: nowrap; }
  .balance-pill > svg { display: none; }
  .balance-popover { top: calc(56px + var(--safe-top)); right: 13px; }
  .message-list { width: calc(100% - 26px); max-width: 100%; padding-top: 24px; overflow: hidden; }
  .message { grid-template-columns: 27px minmax(0,1fr); gap: 10px; margin-bottom: 23px; }
  .message-avatar { width: 27px; height: 27px; }
  .message.user .message-body { width: auto; max-width: 89%; }
  .message-content { font-size: 13.5px; }
  .composer-zone { padding: 5px 11px calc(9px + var(--safe-bottom)); }
  .composer { border-radius: 15px; }
  .privacy-note { display: none; }
  .empty-state { justify-content: flex-start; padding-top: max(72px, 12vh); }
  .hero-sigil { width: 96px; height: 96px; transform: scale(.82); margin-bottom: 15px; }
  .empty-state h2 { font-size: 38px; }
  .prompt-grid { grid-template-columns: 1fr; max-width: 380px; margin-top: 25px; }
  .prompt-grid button:nth-child(2) { display: none; }
  .toast-stack { left: 12px; right: 12px; }.toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
