/* ═══════════════════════════════════════════════════════
   ANONAI — CYBERPUNK CHAT + REACTIVE CHARACTER
   built by anons. for anons.
   ═══════════════════════════════════════════════════════ */

:root {
  --void: #06060c;
  --abyss: #09090f;
  --slab: #0e0e17;
  --plate: #13131f;
  --card: #19192b;
  --card-up: #1e1e33;
  --card-hi: #25253d;

  --neon-purple: #9333ea;
  --purple: #7c3aed;
  --purple-soft: #a78bfa;
  --purple-dim: rgba(147, 51, 234, 0.15);
  --purple-face: #b89cfc;
  --purple-face-dark: #8b6fd4;

  --cyan: #00e5ff;
  --cyan-dim: rgba(0, 229, 255, 0.12);
  --cyan-glow: rgba(0, 229, 255, 0.4);

  --hot: #ff3b3b;
  --green: #00ff88;
  --gold: #fbbf24;

  --text: #e8e8ef;
  --text2: #8888a0;
  --text3: #555568;
  --text4: #333345;

  --border: #1c1c2e;
  --border2: #2a2a42;

  --mono: 'IBM Plex Mono', 'Share Tech Mono', monospace;
  --display: 'Syne', sans-serif;
  --term: 'Share Tech Mono', monospace;

  --sidebar-w: 260px;
  --header-h: 52px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--mono);
  background: var(--void);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ─── DITHER BACKGROUND ─── */
#dither-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: var(--mono); cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: var(--mono); }
::selection { background: rgba(147, 51, 234, 0.4); color: #fff; }

/* ─── GRAIN ─── */
.grain {
  position: fixed; inset: 0; z-index: 9998; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat; background-size: 180px;
}

/* ─── GLITCH FLASH ─── */
.glitch-flash {
  position: fixed; inset: 0; z-index: 9997; pointer-events: none;
  background: var(--cyan); opacity: 0; mix-blend-mode: overlay;
}
.glitch-flash.fire { animation: glitchFlash 0.15s steps(2) 1; }
@keyframes glitchFlash {
  0% { opacity: 0.12; } 30% { opacity: 0; } 50% { opacity: 0.08; transform: translateX(2px); } 100% { opacity: 0; }
}

/* ─── APP ─── */
.app {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  background: transparent;
}

/* ═══════════════ HEADER ═══════════════ */
.header {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h); padding: 0 14px;
  background: rgba(9, 9, 15, 0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 50; flex-shrink: 0; position: relative;
}
.header::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--neon-purple) 20%, var(--cyan) 80%, transparent);
  opacity: 0.4;
}
.sidebar-toggle {
  display: none; flex-direction: column; gap: 4px;
  width: 32px; height: 32px; align-items: center; justify-content: center; border-radius: 4px;
}
.sidebar-toggle span { display: block; width: 16px; height: 1.5px; background: var(--text2); transition: all 0.2s; }
.sidebar-toggle:hover span { background: var(--cyan); }
.logo-cluster { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  position: relative; width: 44px; height: 44px; cursor: pointer; overflow: hidden; border-radius: 50%;
}
.logo-img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.logo-mark::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid var(--purple); opacity: 0.3;
  animation: logoPulse 3s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.08); }
}
.logo-stack { display: flex; flex-direction: column; }
.logo-name {
  font-family: var(--display); font-size: 18px; font-weight: 800;
  letter-spacing: 2px; color: var(--text); line-height: 1;
}
.logo-ai { color: var(--cyan); text-shadow: 0 0 12px var(--cyan-glow); }
.logo-sub { font-size: 10px; color: var(--text3); letter-spacing: 1px; margin-top: 2px; }
.blink { animation: blink 1s step-end infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.header-actions { display: flex; gap: 4px; }
.hdr-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; font-size: 11px; font-weight: 500;
  letter-spacing: 1px; color: var(--text2);
  border: 1px solid var(--border); border-radius: 4px;
  text-transform: uppercase; transition: all 0.15s;
}
.hdr-btn:hover { border-color: var(--purple); color: var(--purple-soft); background: var(--purple-dim); }
.hdr-btn-icon { font-weight: 700; color: var(--cyan); }

/* ═══════════════ BODY ═══════════════ */
.body-wrap { display: flex; flex: 1; overflow: hidden; }

/* ═══════════════ SIDEBAR ═══════════════ */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: rgba(9, 9, 15, 0.92); backdrop-filter: blur(10px); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.sb-inner { display: flex; flex-direction: column; height: 100%; padding: 10px 8px; overflow: hidden; }
.sb-new {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px; font-size: 12px; letter-spacing: 0.5px;
  color: var(--text2); border: 1px dashed var(--border2); border-radius: 4px;
  transition: all 0.2s; margin-bottom: 8px; flex-shrink: 0;
}
.sb-new:hover { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-dim); }
.sb-new-plus { font-size: 15px; font-weight: 700; color: var(--cyan); line-height: 1; }
.sb-section { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.sb-label { font-size: 10px; font-weight: 600; letter-spacing: 2px; color: var(--text4); padding: 8px 12px 4px; flex-shrink: 0; }
.sb-list {
  flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sb-list::-webkit-scrollbar { width: 3px; }
.sb-list::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
.sb-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: 12px; color: var(--text3);
  border-radius: 3px; cursor: pointer; transition: all 0.12s;
  position: relative; border-left: 2px solid transparent;
}
.sb-item::before { content: '>'; font-weight: 700; color: var(--text4); flex-shrink: 0; transition: color 0.12s; }
.sb-item:hover { background: var(--card); color: var(--text); border-left-color: var(--purple); }
.sb-item:hover::before { color: var(--purple-soft); }
.sb-item.active { background: var(--purple-dim); color: var(--purple-soft); border-left-color: var(--neon-purple); }
.sb-item.active::before { color: var(--neon-purple); }
.sb-item-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-item-del {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); opacity: 0;
  font-size: 14px; color: var(--text4); width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center; border-radius: 3px; transition: all 0.1s;
}
.sb-item:hover .sb-item-del { opacity: 1; }
.sb-item-del:hover { color: var(--hot); background: rgba(255, 59, 59, 0.1); }
.sb-footer { flex-shrink: 0; padding-top: 8px; }
.sb-rule { height: 1px; background: var(--border); margin: 0 8px 10px; }
.sb-ascii { font-size: 10px; line-height: 1.3; color: var(--text4); padding: 0 8px; white-space: pre; }
.sb-links { display: flex; gap: 8px; padding: 8px 8px 4px; }
.sb-link { font-size: 10px; color: var(--text4); letter-spacing: 0.5px; }
.sb-link:hover { color: var(--cyan); text-decoration: none; }
.sidebar-shade { display: none; position: fixed; inset: 0; top: var(--header-h); background: rgba(6,6,12,0.7); z-index: 99; }

/* ═══════════════ CHAT MAIN ═══════════════ */
.chat-main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; position: relative; background: transparent;
}
/* Dither WebGL handles the background now */

/* ═══════════════ WELCOME ═══════════════ */
.welcome {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px; position: relative; z-index: 1;
}
.welcome.hidden { display: none; }
.w-doge-wrap {
  margin-bottom: 20px;
  width: 140px;
  position: relative;
}
.w-doge-img {
  width: 140px; height: auto;
  animation: floatDoge 5s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(147, 51, 234, 0.3));
}
@keyframes floatDoge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.w-title {
  font-family: var(--display); font-size: 48px; font-weight: 800;
  letter-spacing: 4px; color: var(--text); position: relative; text-transform: uppercase;
}
.w-title::before, .w-title::after { content: attr(data-text); position: absolute; inset: 0; }
.w-title::before { color: var(--cyan); animation: glitchText 4s infinite steps(2); clip-path: inset(0 0 65% 0); }
.w-title::after { color: var(--neon-purple); animation: glitchText2 4s infinite steps(2); clip-path: inset(60% 0 0 0); }
@keyframes glitchText {
  0%, 92%, 100% { transform: translate(0); } 93% { transform: translate(-3px, 1px); } 96% { transform: translate(2px, -1px); }
}
@keyframes glitchText2 {
  0%, 90%, 100% { transform: translate(0); } 91% { transform: translate(3px, 1px); } 94% { transform: translate(-2px, -1px); }
}
.w-tagline { font-size: 12px; color: var(--text3); letter-spacing: 1.5px; margin-top: 6px; }
.w-terminal {
  margin-top: 28px; width: 100%; max-width: 440px;
  background: var(--slab); border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.w-term-bar {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  background: var(--plate); border-bottom: 1px solid var(--border);
}
.w-dot { width: 8px; height: 8px; border-radius: 50%; }
.w-dot.r { background: #ff5f57; } .w-dot.y { background: #febc2e; } .w-dot.g { background: #28c840; }
.w-term-title { font-size: 10px; color: var(--text3); margin-left: 6px; letter-spacing: 0.5px; }
.w-term-body { padding: 14px 16px; font-size: 12px; color: var(--green); line-height: 1.7; min-height: 60px; }
.w-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  margin-top: 24px; max-width: 440px; width: 100%;
}
.w-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; background: var(--card);
  border: 1px solid var(--border); border-radius: 4px;
  text-align: left; transition: all 0.2s; position: relative; overflow: hidden;
}
.w-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 2px; height: 100%; background: var(--purple); opacity: 0; transition: opacity 0.2s;
}
.w-card:hover { border-color: var(--purple); background: var(--card-up); transform: translateY(-1px); }
.w-card:hover::before { opacity: 1; }
.w-card-tag { font-size: 9px; font-weight: 600; letter-spacing: 2px; color: var(--cyan); }
.w-card-text { font-size: 12px; color: var(--text2); line-height: 1.4; }
.w-card:hover .w-card-text { color: var(--text); }

/* ═══════════════ MESSAGES ═══════════════ */
.messages {
  flex: 1; overflow-y: auto; padding: 12px 0; scroll-behavior: smooth;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
.messages:empty { display: none; }
.msg {
  display: flex; gap: 12px; padding: 18px 20px;
  max-width: 860px; margin: 0 auto; width: 100%;
  position: relative; animation: msgSlide 0.3s ease-out;
}
@keyframes msgSlide { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.msg.ai {
  border-left: 2px solid var(--neon-purple);
  background: linear-gradient(90deg, rgba(147,51,234,0.05), transparent 60%);
}
.msg.ai::before {
  content: ''; position: absolute; left: -4px; top: 24px;
  width: 6px; height: 6px; background: var(--cyan); border-radius: 50%;
  box-shadow: 0 0 6px var(--cyan), 0 0 12px var(--cyan-glow);
}
.msg.ai::after {
  content: ''; position: absolute; left: -1px; top: 30px; bottom: 0;
  width: 0; height: calc(100% - 30px); border-left: 1px dashed var(--border);
}
.msg.user { flex-direction: row-reverse; }
.msg-avatar { flex-shrink: 0; width: 32px; height: 32px; }
.doge-msg-img {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--neon-purple);
  box-shadow: 0 0 8px rgba(147, 51, 234, 0.3);
}
.user-msg-img {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--purple);
  padding: 5px;
  background: var(--card);
  box-shadow: 0 0 8px rgba(147, 51, 234, 0.2);
}
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.msg-name { font-size: 11px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; }
.msg.ai .msg-name { color: var(--neon-purple); }
.msg.user .msg-name { color: var(--text3); }
.msg-time { font-size: 10px; color: var(--text4); }
.msg-text { font-family: var(--mono); font-size: 13.5px; line-height: 1.75; color: var(--text); word-wrap: break-word; overflow-wrap: break-word; }
.msg-text p { margin-bottom: 10px; } .msg-text p:last-child { margin-bottom: 0; }
.msg-text strong { color: var(--purple-soft); font-weight: 600; }
.msg-text em { color: var(--text2); }
.msg-text code {
  background: var(--plate); padding: 2px 6px; border-radius: 3px;
  font-size: 12px; color: var(--cyan); border: 1px solid var(--border);
}
.msg-text pre {
  background: var(--slab); border: 1px solid var(--border); border-radius: 4px;
  padding: 14px 16px; margin: 10px 0; overflow-x: auto; position: relative;
}
.msg-text pre::before { content: '// code'; position: absolute; top: 4px; right: 8px; font-size: 9px; color: var(--text4); letter-spacing: 1px; }
.msg-text pre code { background: none; padding: 0; border: none; color: var(--text); font-size: 12px; line-height: 1.6; }
.msg-text ul, .msg-text ol { padding-left: 18px; margin: 8px 0; }
.msg-text li { margin-bottom: 4px; } .msg-text li::marker { color: var(--purple-soft); }
.msg-text blockquote { border-left: 2px solid var(--neon-purple); padding-left: 12px; margin: 10px 0; color: var(--text2); font-style: italic; }
.msg-text h1, .msg-text h2, .msg-text h3 { font-family: var(--display); margin: 14px 0 6px; color: var(--purple-soft); }
.msg-text h1 { font-size: 18px; } .msg-text h2 { font-size: 16px; } .msg-text h3 { font-size: 14px; }
.msg-text a { color: var(--cyan); text-decoration: underline; text-underline-offset: 2px; }
.msg-text table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 12px; }
.msg-text th, .msg-text td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.msg-text th { background: var(--card); color: var(--purple-soft); font-weight: 600; }
.msg-text hr { border: none; height: 1px; background: var(--border); margin: 14px 0; }
.msg-actions { display: flex; gap: 2px; margin-top: 8px; opacity: 0; transition: opacity 0.15s; }
.msg:hover .msg-actions { opacity: 1; }
.msg-act {
  font-size: 12px; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 3px; color: var(--text4); transition: all 0.12s;
}
.msg-act:hover { background: var(--card); color: var(--text); }

/* Typing indicator */
.typing-dots { display: flex; gap: 4px; padding: 6px 0; }
.typing-dots span {
  width: 6px; height: 6px; background: var(--neon-purple);
  border-radius: 50%; animation: typePulse 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typePulse {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; background: var(--neon-purple); }
  40% { transform: scale(1.1); opacity: 1; background: var(--cyan); }
}

/* ═══════════════ INPUT ═══════════════ */
.input-dock {
  padding: 10px 20px 16px; flex-shrink: 0; position: relative; z-index: 2;
  background: linear-gradient(to top, rgba(6, 6, 12, 0.85) 50%, transparent);
}
.input-box {
  display: flex; align-items: flex-end; gap: 8px;
  max-width: 860px; margin: 0 auto;
  background: var(--slab); border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 12px; transition: border-color 0.2s, box-shadow 0.2s;
}
.input-box:focus-within {
  border-color: var(--neon-purple);
  box-shadow: 0 0 0 1px var(--neon-purple), 0 0 20px rgba(147,51,234,0.08);
}
.input-prefix {
  color: var(--cyan); font-weight: 700; font-size: 14px; line-height: 1.5;
  padding: 4px 0; flex-shrink: 0; opacity: 0.6; transition: opacity 0.2s;
}
.input-box:focus-within .input-prefix { opacity: 1; text-shadow: 0 0 8px var(--cyan-glow); }
.input-box textarea {
  flex: 1; background: transparent; border: none; color: var(--text);
  font-size: 14px; line-height: 1.5; resize: none; max-height: 160px; outline: none; padding: 4px 0;
}
.input-box textarea::placeholder { color: var(--text4); }
.fire-btn {
  width: 34px; height: 34px; background: var(--neon-purple); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: white; transition: all 0.15s;
}
.fire-btn:hover:not(:disabled) { background: var(--purple-soft); box-shadow: 0 0 16px var(--purple-dim); }
.fire-btn:active:not(:disabled) { transform: scale(0.92); }
.fire-btn:disabled { background: var(--border); color: var(--text4); cursor: not-allowed; }
.input-meta {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 860px; margin: 6px auto 0; font-size: 10px; letter-spacing: 0.5px;
}
.input-status { color: var(--green); text-transform: uppercase; letter-spacing: 1.5px; }
.input-status.busy { color: var(--cyan); animation: statusBlink 1s step-end infinite; }
@keyframes statusBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.input-warn { color: var(--text4); }


/* ═══════════════════════════════════════════════════════════
   REACTIVE CYBER DOG CHARACTER
   ═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════
   REACTIVE CHARACTER (PNG swap)
   ═══════════════════════════════════════════════════════════ */

.character-container {
  position: fixed;
  right: 24px;
  bottom: 80px;
  width: 280px;
  z-index: 90;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.4s ease;
}

.char-glow {
  position: absolute;
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(147,51,234,0.25) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(16px);
  animation: glowBreath 3s ease-in-out infinite;
  pointer-events: none;
}
@keyframes glowBreath {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.08); }
}

.character-img {
  width: 250px;
  height: auto;
  position: relative;
  z-index: 1;
  animation: breathe 3.5s ease-in-out infinite;
  transition: filter 0.3s;
  image-rendering: auto;
}
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.015); } }

.char-state-label {
  text-align: center;
  font-family: var(--term);
  font-size: 9px; color: var(--text4);
  text-transform: uppercase;
  letter-spacing: 2.5px;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}


/* ═══════════════ SETTINGS MODAL ═══════════════ */
.modal-shade {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,6,12,0.85); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s;
}
.modal-shade.open { opacity: 1; visibility: visible; }
.modal-box {
  background: var(--plate); border: 1px solid var(--border2); border-radius: 8px;
  width: 90%; max-width: 420px;
  transform: translateY(10px) scale(0.97); transition: transform 0.2s ease-out;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 1px var(--neon-purple);
}
.modal-shade.open .modal-box { transform: translateY(0) scale(1); }
.modal-bar { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; }
.modal-title { font-size: 14px; font-weight: 600; letter-spacing: 1.5px; color: var(--text2); }
.modal-x {
  font-size: 20px; color: var(--text3); width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center; border-radius: 4px; transition: all 0.12s;
}
.modal-x:hover { background: var(--card); color: var(--text); }
.modal-guts { padding: 16px 20px; }
.cfg-group { margin-bottom: 20px; }
.cfg-label { font-size: 11px; font-weight: 600; letter-spacing: 2px; color: var(--text3); margin-bottom: 4px; display: block; }
.cfg-hint { font-size: 11px; color: var(--text4); margin-bottom: 8px; line-height: 1.4; }
.cfg-row { display: flex; gap: 6px; }
.cfg-input, .cfg-select {
  width: 100%; padding: 9px 12px; background: var(--card);
  border: 1px solid var(--border); border-radius: 4px;
  color: var(--text); font-size: 13px; outline: none; transition: border-color 0.2s;
}
.cfg-input:focus, .cfg-select:focus { border-color: var(--neon-purple); }
.cfg-input::placeholder { color: var(--text4); }
.cfg-select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23555568' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.cfg-select option { background: var(--card); }
.cfg-eye {
  width: 40px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border); border-radius: 4px;
  font-size: 14px; transition: all 0.12s;
}
.cfg-eye:hover { border-color: var(--border2); }
.cfg-nuke {
  padding: 9px 14px; font-size: 12px; color: var(--hot);
  border: 1px solid rgba(255,59,59,0.2); border-radius: 4px;
  transition: all 0.2s; letter-spacing: 0.5px;
}
.cfg-nuke:hover { background: rgba(255,59,59,0.08); border-color: rgba(255,59,59,0.4); }
.modal-foot { padding: 0 20px 16px; display: flex; justify-content: flex-end; }
.cfg-save {
  padding: 9px 24px; background: var(--neon-purple); border-radius: 4px;
  color: white; font-size: 12px; font-weight: 600; letter-spacing: 1.5px; transition: all 0.2s;
}
.cfg-save:hover { background: var(--purple-soft); box-shadow: 0 0 20px rgba(147,51,234,0.3); }

/* ─── TOAST ─── */
.toast-msg {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--card); border: 1px solid var(--border2); border-radius: 4px;
  padding: 10px 18px; font-size: 12px; color: var(--text);
  z-index: 300; opacity: 0; transition: opacity 0.2s, transform 0.2s; letter-spacing: 0.5px;
}
.toast-msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-msg.err { border-color: var(--hot); }
.toast-msg.ok { border-color: var(--green); }

/* ═══════════════ MOBILE ═══════════════ */
@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: var(--header-h); bottom: 0;
    z-index: 100; transform: translateX(-100%); transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-shade { display: block; }
  .sidebar-shade.visible { opacity: 1; visibility: visible; }
  .hdr-btn-label { display: none; }
  .hdr-btn { padding: 6px 8px; }
  .w-title { font-size: 36px; }
  .w-grid { grid-template-columns: 1fr; }
  .msg { padding: 14px; gap: 10px; }
  .msg-avatar { width: 26px; height: 26px; }
  .msg-avatar canvas { width: 26px; height: 26px; }
  .msg-user-icon { width: 26px; height: 26px; font-size: 11px; }
  .msg-text { font-size: 13px; }
  .input-dock { padding: 8px 10px 12px; }

  /* Character — shrink */
  .character-container { width: 120px; right: 10px; bottom: 80px; }
  .character-img { width: 110px; }
  .char-glow { width: 100px; height: 100px; }
  .char-state-label { display: none; }
}

@media (max-width: 480px) {
  .logo-name { font-size: 16px; letter-spacing: 1px; }
  .logo-sub { display: none; }
  .w-title { font-size: 28px; letter-spacing: 2px; }
  .character-container { width: 80px; right: 6px; bottom: 75px; }
  .character-img { width: 70px; }
}
