:root {
  /* Palet "Midnight Brass" -- charcoal dingin senada foto pantai malam, aksen kuningan/brass buat kesan premium. */
  --bg: #0A0B0C;
  --panel: #16171A;
  --panel-2: #101113;
  --accent: #A9812E;
  --accent-bright: #D4AF66;
  --on-accent: #1C1710; /* teks di atas fill emas -- kontrasnya jauh lebih baik daripada putih */
  --text: #ECEAE2;
  --text-dim: #9C9C9E;
  --border: #2B2C2F;
  --sidebar-width: 260px;
}

* { box-sizing: border-box; }

/* Scrollbar tipis & senada tema gelap (Firefox) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Scrollbar tipis & senada tema gelap (Chrome/Edge/Safari) */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--accent-bright); }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    linear-gradient(rgba(6, 7, 8, 0.74), rgba(6, 7, 8, 0.88)),
    url('bg.jpg') center / cover no-repeat fixed;
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.screen { height: 100vh; }
.hidden { display: none !important; }

/* --- Auth & profile screens --- */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, rgba(212, 175, 102, 0.10), transparent 45%);
}
.auth-box {
  background: rgba(22, 23, 26, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  padding: 40px;
  border-radius: 14px;
  width: 320px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 28px; }
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent) 60%, #241d0c);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  color: #fff;
  letter-spacing: 1px;
  overflow: hidden;
  box-shadow: 0 0 0 2px var(--accent-bright);
}
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.brand-logo {
  width: 140px;
  max-width: 70%;
  height: auto;
  border-radius: 10px;
}
.brand h1 {
  font-size: 18px;
  letter-spacing: 4px;
  margin: 0;
  font-weight: 700;
  color: var(--text);
}

.auth-box input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  margin-bottom: 12px;
  font-size: 14px;
}
.auth-box input:focus { outline: none; border-color: var(--accent-bright); }

.auth-box button#login-btn {
  width: 100%;
  padding: 11px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: background 0.15s;
}
.auth-box button#login-btn:hover { background: var(--accent-bright); }

.link-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  margin-top: 12px;
  padding: 4px;
}
.link-btn:hover { color: var(--text); }

.error { color: #ff6b6b; font-size: 13px; margin-top: 8px; min-height: 16px; }

.profile-question { color: var(--text-dim); margin-bottom: 20px; font-size: 14px; }
.profile-cards { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.profile-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.15s, transform 0.1s;
}
.profile-card:hover { border-color: var(--accent-bright); transform: translateY(-2px); }
.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--on-accent);
  overflow: hidden;
  box-shadow: 0 0 0 2px var(--accent-bright);
}

/* --- App layout --- */
#app-screen { display: flex; height: 100vh; position: relative; }

#sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 18px;
  cursor: pointer;
}

#sidebar-overlay { display: none; }

#sidebar {
  width: var(--sidebar-width);
  min-width: 200px;
  max-width: 420px;
  background: var(--panel-2);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid var(--border);
  position: relative;
  transition: width 0.15s ease;
}

.sidebar-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 5;
}
.sidebar-resizer:hover { background: var(--accent-bright); opacity: 0.4; }

.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-header-top { justify-content: center; }
.sidebar-logo { height: 30px; width: auto; border-radius: 6px; }

.profile-corner { position: fixed; top: 14px; right: 18px; z-index: 30; }
.profile-avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  border: none;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 0 0 2px var(--accent-bright);
  flex-shrink: 0;
}
.profile-menu {
  position: absolute;
  top: 42px;
  right: 0;
  z-index: 20;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  min-width: 170px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}
.profile-menu-name {
  padding: 6px 10px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.profile-menu button {
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
}
.profile-menu button:hover { background: var(--panel-2); }

/* --- Ribbon collapse/expand, nempel di tepi kanan sidebar --- */
#collapse-toggle {
  position: absolute;
  top: 50%;
  right: -14px;
  transform: translateY(-50%);
  width: 16px;
  height: 46px;
  padding: 0;
  border-radius: 0 10px 10px 0;
  border: 1px solid var(--border);
  border-left: none;
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
}
#collapse-toggle:hover { color: var(--on-accent); background: var(--accent); }

.mode-tabs {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}
.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 7px 4px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.mode-tab.active { background: var(--accent); color: var(--on-accent); }
.mode-tab:not(.active):hover { color: var(--text); }
.tab-icon {
  display: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 800;
  flex-shrink: 0;
}
.mode-tab.active .tab-icon { background: rgba(255,255,255,0.25); }

#new-chat-btn {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--accent-bright);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
#new-chat-btn:hover { background: var(--accent); border-color: var(--accent); }

.session-list-header { display: flex; gap: 4px; }
.list-toggle {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 5px;
  font-size: 11.5px;
  border-radius: 6px;
  cursor: pointer;
}
.list-toggle.active { border-color: var(--accent-bright); color: var(--text); background: var(--panel); }

#session-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 0; }
.session-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  padding: 6px 8px 2px;
  opacity: 0.75;
}
.session-section-label:first-child { padding-top: 2px; }
.session-empty {
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 6px 8px;
  opacity: 0.7;
}
.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 12.5px;
  line-height: 1.2;
  cursor: pointer;
  color: var(--text-dim);
  gap: 6px;
}
.session-item .pin-indicator { font-size: 11px; flex-shrink: 0; }
.session-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.75; }
.session-item span.session-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.session-item:hover { background: var(--panel); color: var(--text); }
.session-item.active { background: var(--panel); color: var(--text); font-weight: 700; }
.session-item.active .session-icon { opacity: 1; color: var(--accent-bright); }
.session-item.dragging { opacity: 0.4; }
.session-item.drag-over { border-top: 2px solid var(--accent-bright); }

.session-menu-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 15px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  flex-shrink: 0;
}
.session-item:hover .session-menu-btn { opacity: 1; }
.session-menu-btn:hover { color: var(--text); background: rgba(255,255,255,0.08); }

.context-menu {
  position: fixed;
  z-index: 50;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.context-menu button {
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 5px;
  cursor: pointer;
}
.context-menu button:hover { background: var(--panel-2); }
.context-menu button.danger { color: #ff6b6b; }
.context-menu button.danger:hover { background: rgba(255,107,107,0.1); }

#logout-btn {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
}
#logout-btn:hover { color: var(--text); border-color: var(--text-dim); }

.icon-only { display: none; }

/* --- Sidebar collapsed --- */
#app-screen.sidebar-collapsed #sidebar {
  width: 68px !important;
  min-width: 68px;
  padding: 14px 10px;
  align-items: center;
}
#app-screen.sidebar-collapsed .label-text,
#app-screen.sidebar-collapsed .session-list-header,
#app-screen.sidebar-collapsed #session-list { display: none; }

#app-screen.sidebar-collapsed .sidebar-header {
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

#app-screen.sidebar-collapsed .mode-tabs { flex-direction: column; width: 100%; }
#app-screen.sidebar-collapsed .mode-tab { padding: 8px 0; }
#app-screen.sidebar-collapsed .tab-icon { display: flex; }

#app-screen.sidebar-collapsed #new-chat-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
#app-screen.sidebar-collapsed #new-chat-btn .label-text { display: none; }
#app-screen.sidebar-collapsed #new-chat-btn .icon-only,
#app-screen.sidebar-collapsed #logout-btn .icon-only { display: inline; }
#app-screen.sidebar-collapsed #logout-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#app-screen.sidebar-collapsed #logout-btn .label-text { display: none; }
#app-screen.sidebar-collapsed #collapse-toggle { transform: translateY(-50%) rotate(180deg); }
#app-screen.sidebar-collapsed .sidebar-resizer { display: none; }
#app-screen.sidebar-collapsed #session-list { flex: 0; }

#chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  position: relative;
  background: radial-gradient(circle at 50% 0%, rgba(212, 175, 102, 0.08), transparent 55%);
  overflow: hidden;
}

#empty-state {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 640px;
  padding: 0 20px;
  text-align: center;
  pointer-events: none;
}
#empty-state.hidden { display: none; }
.empty-logo { width: 38px; height: auto; margin-bottom: 16px; }
#empty-state h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}
#empty-state h2 span { color: var(--text); font-weight: 600; }
#empty-state-quote {
  margin: 14px 0 0;
  font-size: 13.5px;
  font-style: italic;
  color: var(--text-dim);
  line-height: 1.5;
  opacity: 0.85;
}

#chat-scroll {
  width: 100%;
  max-width: 760px;
  flex: 1;
  overflow-y: auto;
  padding: 28px 20px 12px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/old Edge */
}
#chat-scroll::-webkit-scrollbar { width: 0; height: 0; background: transparent; }
#messages { display: flex; flex-direction: column; }

.message-row { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 16px; max-width: 82%; }
.message-row.user { margin-left: auto; flex-direction: row-reverse; }
.message-row.assistant { margin-right: auto; }

.copy-btn {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 6px;
  padding: 4px;
  opacity: 0;
  align-self: flex-end;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.copy-btn svg { width: 100%; height: 100%; display: block; }
.message-row:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.copy-btn.copied { color: var(--accent-bright); opacity: 1; }

.msg-avatar {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 0 1.5px var(--accent-bright);
}

.message {
  padding: 12px 17px;
  border-radius: 22px;
  line-height: 1.55;
  font-size: 14.5px;
}
.message.user {
  background: linear-gradient(135deg, var(--accent-bright), var(--accent) 70%);
  color: var(--on-accent);
  border-bottom-right-radius: 6px;
  white-space: pre-wrap;
  font-weight: 500;
}
.message.assistant {
  background: var(--panel);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}
.message.error-msg { background: rgba(255,107,107,0.1); border: 1px solid rgba(255,107,107,0.3); color: #ff9d9d; white-space: pre-wrap; }

/* --- Rendering Markdown di bubble assistant --- */
.message.assistant > *:first-child { margin-top: 0; }
.message.assistant > *:last-child { margin-bottom: 0; }
.message.assistant p { margin: 0 0 10px; }
.message.assistant ul, .message.assistant ol { margin: 0 0 10px; padding-left: 22px; }
.message.assistant li { margin-bottom: 4px; }
.message.assistant h1, .message.assistant h2, .message.assistant h3,
.message.assistant h4, .message.assistant h5, .message.assistant h6 {
  margin: 14px 0 8px;
  line-height: 1.3;
}
.message.assistant h1 { font-size: 1.25em; }
.message.assistant h2 { font-size: 1.15em; }
.message.assistant h3 { font-size: 1.05em; }
.message.assistant strong { color: var(--accent-bright); }
.message.assistant a { color: var(--accent-bright); text-decoration: underline; }
.message.assistant code {
  background: rgba(255,255,255,0.08);
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 0.9em;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}
.message.assistant pre {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
  margin: 0 0 10px;
}
.message.assistant pre code { background: none; padding: 0; }
.message.assistant blockquote {
  margin: 0 0 10px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  opacity: 0.85;
}
.message.assistant table { border-collapse: collapse; margin: 0 0 10px; font-size: 0.92em; }
.message.assistant th, .message.assistant td { border: 1px solid var(--border); padding: 6px 10px; }

.typing-bubble { display: flex; align-items: center; gap: 8px; }
.typing-label { font-size: 13px; color: var(--text-dim); }
.typing-dots { display: flex; gap: 4px; }
.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-bright);
  display: inline-block;
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.message-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.message-images img { max-width: 260px; border-radius: 14px; border: 1px solid var(--border); }

.reasoning-block {
  margin-top: 8px;
  border-top: 1px dashed rgba(255,255,255,0.2);
  padding-top: 8px;
  font-size: 12.5px;
  opacity: 0.85;
}
.reasoning-block summary { cursor: pointer; font-weight: 600; }

/* --- Composer mengambang --- */
#composer {
  width: 100%;
  max-width: 760px;
  margin: 0 auto 22px;
  padding: 10px 14px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  position: relative;
}

/* --- Kucing gif, bisa di-drag ke mana aja di layar --- */
/* #pixel-cat-track dibiarin gak ganggu layout -- posisi kucing dikontrol JS lewat position:fixed di elemen anaknya */
#pixel-cat-track { position: static; width: 0; height: 0; overflow: visible; pointer-events: none; }
#pixel-cat {
  position: fixed;
  width: 75px;
  height: 75px;
  z-index: 50;
  cursor: grab;
  touch-action: none;
  user-select: none;
  pointer-events: auto;
  background-image: url('cat-walk.gif');
  background-repeat: no-repeat;
  background-size: 75px 75px;
  image-rendering: pixelated;
}
#pixel-cat.dragging { cursor: grabbing; }

#usage-bar {
  padding: 2px 10px 10px;
  font-size: 10.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
#usage-stats { display: flex; gap: 8px; flex-shrink: 0; }

#model-select {
  padding: 5px 9px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  max-width: 60%;
  flex-shrink: 1;
}

#chat-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
#chat-input {
  flex: 1;
  resize: none;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  max-height: 160px;
}
#chat-input:focus { outline: none; border-color: var(--accent-bright); }
#chat-form button[type="submit"] {
  padding: 11px 22px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: var(--on-accent);
  cursor: pointer;
  font-weight: 700;
  flex-shrink: 0;
}
#chat-form button[type="submit"]:hover { filter: brightness(1.1); }

#web-search-toggle {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
}
#web-search-toggle:hover { color: var(--text); }
#web-search-toggle.active {
  background: rgba(212, 175, 102, 0.22);
  border-color: var(--accent-bright);
  color: #fff;
}
#web-search-toggle:disabled { opacity: 0.35; cursor: not-allowed; }

#attach-image-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
}
#attach-image-btn:hover { color: var(--text); }
#attach-image-btn.active {
  background: rgba(212, 175, 102, 0.22);
  border-color: var(--accent-bright);
  color: #fff;
}
#attach-image-btn:disabled { opacity: 0.35; cursor: not-allowed; }

#flirt-mode-toggle {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.flirt-icon-img {
  width: 26px;
  height: 26px;
  image-rendering: pixelated;
  filter: grayscale(1) opacity(0.55);
  transition: filter 0.15s ease, transform 0.15s ease;
}
#flirt-mode-toggle:hover .flirt-icon-img { filter: grayscale(1) opacity(0.85); }
#flirt-mode-toggle.active .flirt-icon-img {
  filter: none;
  transform: scale(1.12);
  animation: flirt-pulse 1.4s ease-in-out infinite;
}
@keyframes flirt-pulse {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(255,45,85,0.6)); }
  50% { filter: drop-shadow(0 0 8px rgba(255,45,85,0.9)); }
}

/* --- Tombol kirim menyala pink pas Flirt Mode aktif --- */
#send-btn.flirt-active {
  background: linear-gradient(135deg, #ff5a78, #ff2d55) !important;
  box-shadow: 0 0 10px rgba(255,45,85,0.7), 0 0 22px rgba(255,45,85,0.45);
  animation: send-flirt-glow 1.4s ease-in-out infinite;
}
@keyframes send-flirt-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(255,45,85,0.55), 0 0 16px rgba(255,45,85,0.3); }
  50% { box-shadow: 0 0 14px rgba(255,45,85,0.85), 0 0 30px rgba(255,45,85,0.55); }
}

.image-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.image-preview img {
  height: 52px;
  width: 52px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.image-preview-name { font-size: 12px; color: var(--text-dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#image-remove-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
#image-remove-btn:hover { background: rgba(255,107,107,0.25); }

.search-block {
  margin-top: 8px;
  border-top: 1px dashed rgba(255,255,255,0.2);
  padding-top: 8px;
  font-size: 12.5px;
  opacity: 0.9;
}
.search-block summary { cursor: pointer; font-weight: 600; }
.search-result { margin-top: 6px; }
.search-result a { color: var(--accent-bright); text-decoration: none; }
.search-result a:hover { text-decoration: underline; }
.search-result p { margin: 2px 0 0; opacity: 0.8; }

/* --- Modal (pengaturan profil) --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}
.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  width: 420px;
  max-width: 90vw;
}
.modal-box h3 { margin: 0 0 16px; font-size: 16px; }
.modal-label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }
.modal-box textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  resize: vertical;
}
.modal-box textarea:focus { outline: none; border-color: var(--accent-bright); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn-secondary, .btn-primary {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
}
.btn-secondary { background: transparent; color: var(--text-dim); }
.btn-secondary:hover { color: var(--text); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-bright); }

/* --- Responsive --- */
@media (max-width: 768px) {
  #sidebar-toggle { display: block; }
  #collapse-toggle { display: none; }

  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 25;
    width: 280px !important;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  #app-screen.sidebar-open #sidebar { transform: translateX(0); }
  .sidebar-resizer { display: none; }

  #sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 20;
  }
  #app-screen.sidebar-open #sidebar-overlay { display: block; }

  #chat-main { padding-top: 52px; }
  .message-row { max-width: 92%; }
  #chat-scroll { padding: 16px 12px 8px; }
  #composer { margin: 0 auto 12px; border-radius: 18px; }
}
