﻿/*!
 * YouTubeMate — style.css
 * -----------------------------------------------------------------------
 * ডিজাইন কনসেপ্ট: "রাতের ফাঁকা হোম-থিয়েটার" — গভীর ইন্ডিগো-বেগুনি অন্ধকার,
 * মারকি-গোল্ড আলো, আর প্রতিটি পারসোনার নিজস্ব রঙে একটা "প্রেজেন্স-লাইট"
 * (breathing glow) যা কথা বলার সময় নিঃশ্বাসের মতো স্পন্দিত হয়।
 *
 * টোকেন সিস্টেম:
 *   রঙ      → নিচে :root-এ নামকরণ করা
 *   টাইপ    → Baloo Da 2 (ডিসপ্লে, ব্যক্তিত্বপূর্ণ) + Hind Siliguri (বডি, স্ক্রিন-লিজিবল)
 *   লেআউট   → মোবাইলে একক-কলাম স্ট্যাক, ≥1000px-এ ভিডিও+চ্যাট পাশাপাশি
 *   সিগনেচার → পারসোনা অ্যাভাটারের "breathing" আলো + মুড-রঙা অ্যাম্বিয়েন্ট আভা
 * -----------------------------------------------------------------------
 */

/* ============================== টোকেন ============================== */
:root {
  /* --- বেস পৃষ্ঠভূমি (থিয়েটার হলের অন্ধকার স্তর) --- */
  --bg-deep: #14101F;
  --bg-panel: #1C1730;
  --bg-panel-2: #241C3B;
  --bg-elevated: #2C2347;
  --line: rgba(244, 239, 232, 0.09);
  --line-strong: rgba(244, 239, 232, 0.18);

  /* --- টেক্সট --- */
  --text-primary: #F4EFE8;
  --text-muted: #B6ACC9;
  --text-faint: #8880A0;

  /* --- সিগনেচার রঙ (প্রতিটি পারসোনার নিজস্ব "আলো") --- */
  --gold: #E8A94A;
  --gold-soft: rgba(232, 169, 74, 0.18);
  --clay: #D98E73;
  --teal: #6FA3B5;
  --rose: #C97A93;

  /* --- মুড রঙ (ইমোশন ডিটেকশন → রঙে অনুবাদ) --- */
  --mood-happy: #E8C24A;
  --mood-funny: #E8A94A;
  --mood-sad: #6A93C9;
  --mood-romantic: #C97A93;
  --mood-scary: #7C6BC4;
  --mood-excited: #E0834E;
  --mood-calm: #6FB89E;
  --mood-neutral: #8C86A6;

  --accent: var(--gold); /* বর্তমান পারসোনা অনুযায়ী JS এটা override করে */
  --mood-color: var(--gold);

  /* --- আকার/রেডিয়াস --- */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  /* --- ছায়া --- */
  --shadow-1: 0 4px 20px rgba(8, 5, 16, 0.4);
  --shadow-2: 0 16px 50px rgba(8, 5, 16, 0.55);

  /* --- ফন্ট --- */
  --font-display: 'Baloo Da 2', 'Hind Siliguri', 'Segoe UI', sans-serif;
  --font-body: 'Hind Siliguri', 'Segoe UI', sans-serif;

  --dock-width: 400px;
  --topbar-h: 60px;
}

/* ============================== রিসেট ============================== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; }
p { margin: 0; }
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold); }
ul { margin: 0; padding: 0; list-style: none; }
input, select, textarea { accent-color: var(--gold); }

::selection { background: var(--gold-soft); color: var(--text-primary); }

/* থিন, থিমড স্ক্রলবার */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--radius-pill); }
*::-webkit-scrollbar-track { background: transparent; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* সূক্ষ্ম ফিল্ম-গ্রেইন টেক্সচার — পুরো অ্যাপের পেছনে, খুব হালকা */
.app::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================== অ্যাপ শেল ============================== */
.app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(232, 169, 74, 0.10), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 10%, rgba(201, 122, 147, 0.08), transparent 55%),
    var(--bg-deep);
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 6px;
}
.muted-note { color: var(--text-faint); font-size: 12.5px; }

/* ============================== টপবার ============================== */
.topbar {
  position: relative;
  z-index: 5;
  flex: 0 0 var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 16, 31, 0.7);
  backdrop-filter: blur(10px);
}
.topbar__brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.brand-mark { font-size: 20px; }
.brand-name { display: none; }
@media (min-width: 480px) { .brand-name { display: inline; } }

.topbar__persona {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 5px 12px 5px 5px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.topbar__persona:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.topbar__persona-name { font-weight: 600; font-size: 13.5px; }

.topbar__actions { display: flex; align-items: center; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: var(--text-primary);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--bg-panel-2); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn--sm { width: 32px; height: 32px; }

/* ============================== অ্যাভাটার রিং (সিগনেচার এলিমেন্ট) ============================== */
.avatar-ring {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  font-size: 19px;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 5px rgba(0,0,0,0.0);
  flex: none;
}
.avatar-ring--sm { width: 26px; height: 26px; font-size: 13px; }
.avatar-ring::after {
  content: '';
  position: absolute; inset: -5px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0.35;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.avatar-ring.is-thinking::after { opacity: 0.7; animation: ringPulse 1.1s ease-in-out infinite; }
.avatar-ring.is-speaking { animation: breathe 1.8s ease-in-out infinite; }
.avatar-ring.is-speaking::after { opacity: 0.85; }

@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent), 0 0 10px 2px transparent; }
  50% { box-shadow: 0 0 0 2px var(--accent), 0 0 16px 5px color-mix(in srgb, var(--accent) 55%, transparent); }
}
@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.12); opacity: 0.9; }
}

/* ============================== স্টেজ (মূল লেআউট) ============================== */
.stage {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 1000px) {
  .stage { flex-direction: row; }
}

/* ============================== ভিডিও জোন — খালি অবস্থা ============================== */
.video-zone {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 16px 28px;
}
.video-zone.has-video { flex: none; overflow-y: visible; }
@media (min-width: 1000px) {
  .video-zone, .video-zone.has-video { flex: 1; padding: 32px 28px; overflow-y: auto; }
}

.video-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-empty__inner {
  width: 100%;
  max-width: 460px;
  text-align: center;
}
.video-empty__title {
  font-size: clamp(28px, 6vw, 40px);
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--text-primary), var(--gold) 120%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.video-empty__sub { color: var(--text-muted); margin-bottom: 24px; font-size: 14.5px; }
.video-empty__hint { margin-top: 10px; color: var(--text-faint); font-size: 12.5px; }

.yt-form { display: flex; gap: 8px; }
.yt-form__input {
  flex: 1;
  min-width: 0;
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 13px 18px;
  color: var(--text-primary);
  font-size: 14.5px;
}
.yt-form__input:focus { border-color: var(--gold); }
.yt-form__input::placeholder { color: var(--text-faint); }

.or-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-faint); font-size: 12.5px; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.btn--file { width: 100%; justify-content: center; }
#dropZone.is-dragover { border-color: var(--gold); background: var(--gold-soft); }

.inline-error {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(224, 90, 90, 0.12);
  border: 1px solid rgba(224, 90, 90, 0.35);
  color: #F0AFAF;
  font-size: 13px;
  text-align: left;
}

/* ============================== বোতাম ============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius-pill);
  padding: 12px 22px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn--gold { background: linear-gradient(135deg, #F0BD6C, var(--gold)); color: #241705; }
.btn--gold:hover { filter: brightness(1.08); }
.btn--outline { background: transparent; border-color: var(--line-strong); color: var(--text-primary); }
.btn--outline:hover { border-color: var(--gold); color: var(--gold); }
.btn--ghost { background: var(--bg-panel); border-color: var(--line); color: var(--text-primary); }
.btn--ghost:hover { border-color: var(--line-strong); }
.btn--danger { background: transparent; border-color: rgba(224,90,90,0.4); color: #E77; }
.btn--danger:hover { background: rgba(224,90,90,0.12); }
.btn--sm { padding: 8px 15px; font-size: 12.5px; }
.btn--lg { padding: 15px 22px; font-size: 15.5px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  color: var(--text-primary);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 13px;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.chip-btn:hover { border-color: var(--line-strong); background: var(--bg-panel-2); }
.chip-btn.is-active { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); }

/* ============================== ভিডিও প্লেয়ার ============================== */
.video-player-wrap { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-2);
  border: 1px solid var(--line);
  flex: none;
}
.video-frame__yt, .video-frame__yt iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
.video-frame__local {
  position: absolute; inset: 0; width: 100%; height: 100%; background: #000;
}
.video-frame__local[hidden] { display: none; }

.overlay-bubble {
  position: absolute;
  left: 14px;
  bottom: 14px;
  max-width: min(78%, 420px);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(20, 16, 31, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: var(--shadow-1);
  animation: bubbleIn 0.35s cubic-bezier(.2,.8,.3,1);
  z-index: 3;
}
.overlay-bubble.is-leaving { animation: bubbleOut 0.3s ease forwards; }
.overlay-bubble__avatar { font-size: 18px; flex: none; margin-top: 1px; }
.overlay-bubble__text { font-size: 14px; line-height: 1.4; }

@keyframes bubbleIn { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes bubbleOut { to { opacity: 0; transform: translateY(6px) scale(0.97); } }

.video-controls-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.video-controls-mini__spacer { flex: 1; min-width: 8px; }
.mood-chips { display: flex; gap: 6px; overflow-x: auto; }

.sync-panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  animation: fadeSlideUp 0.2s ease;
}
.sync-panel__form { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.sync-panel__time {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  background: var(--bg-elevated);
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  flex: none;
}
.sync-panel__form input {
  flex: 1; min-width: 160px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-primary);
}
.sync-panel__list { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow-y: auto; }
.sync-point {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel-2);
  font-size: 12.5px;
}
.sync-point__time { font-family: var(--font-display); color: var(--gold); font-weight: 600; flex: none; cursor: pointer; }
.sync-point__desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.sync-point__del { flex: none; opacity: 0.6; }
.sync-point__del:hover { opacity: 1; color: #E77; }
.sync-panel__empty { color: var(--text-faint); font-size: 12.5px; padding: 4px; }

/* ============================== সঙ্গী ডক (চ্যাট) ============================== */
.companion-dock {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--mood-color) 7%, var(--bg-panel)), var(--bg-panel));
  transition: background 1.2s ease;
}
@media (min-width: 1000px) {
  .companion-dock {
    flex: none;
    width: var(--dock-width);
    border-top: none;
    border-left: 1px solid var(--line);
  }
}

.dock-header {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.dock-header__text { display: flex; flex-direction: column; min-width: 0; }
.dock-header__name { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.dock-header__status { font-size: 11.5px; color: var(--text-faint); }
.dock-header__status.is-live { color: var(--gold); }

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-empty-hint {
  margin: auto;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  max-width: 220px;
}

.msg { display: flex; gap: 8px; max-width: 92%; animation: fadeSlideUp 0.22s ease; }
.msg--assistant { align-self: flex-start; }
.msg--user { align-self: flex-end; flex-direction: row-reverse; }
.msg--system { align-self: center; max-width: 100%; }

.msg__avatar {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated);
  font-size: 14px;
  box-shadow: 0 0 0 1.5px var(--accent);
  margin-top: 2px;
}
.msg__bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 9px 13px;
  font-size: 14px;
  line-height: 1.45;
  min-width: 24px;
}
.msg--assistant .msg__bubble { border-top-left-radius: 4px; border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.msg--user .msg__bubble { background: var(--gold-soft); border-color: rgba(232,169,74,0.4); border-top-right-radius: 4px; }
.msg--system .msg__bubble { background: transparent; border: none; color: var(--text-faint); font-size: 12px; text-align: center; padding: 2px 8px; }
.msg--error .msg__bubble { background: rgba(224,90,90,0.1); border-color: rgba(224,90,90,0.35); color: #F0AFAF; }

.msg__meta { display: block; margin-top: 4px; font-size: 10.5px; color: var(--text-faint); }

.msg.is-typing .msg__bubble { display: flex; align-items: center; gap: 4px; padding: 12px 14px; }
.typing-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); animation: typingBounce 1.1s infinite ease-in-out; }
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.chat-input {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}
.chat-input input {
  flex: 1; min-width: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 11px 16px;
  color: var(--text-primary);
  font-size: 14px;
}
.chat-input input:focus { border-color: var(--gold); }
.icon-btn--send { background: var(--gold); border-color: var(--gold); color: #241705; }
.icon-btn--send:hover { filter: brightness(1.08); }
.icon-btn--mic.is-listening { background: #C24A4A; border-color: #C24A4A; color: #fff; animation: micPulse 1.1s ease-in-out infinite; }
@keyframes micPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(194,74,74,0.5); } 50% { box-shadow: 0 0 0 8px rgba(194,74,74,0); } }

.mic-status { flex: none; padding: 0 14px 10px; font-size: 12px; color: var(--gold); }

/* ============================== ড্রয়ার ============================== */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(8, 5, 16, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0; transition: opacity 0.25s ease;
}
.drawer-overlay.is-open { opacity: 1; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 21;
  width: min(400px, 100vw);
  background: var(--bg-panel);
  border-left: 1px solid var(--line-strong);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(.2,.8,.3,1);
  box-shadow: var(--shadow-2);
}
.drawer.is-open { transform: translateX(0); }

.drawer__header {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px 0;
  border-bottom: 1px solid var(--line);
}
.drawer__tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  background: transparent; border: none; border-bottom: 2px solid transparent;
  padding: 12px 10px; font-weight: 600; font-size: 13px; color: var(--text-muted);
}
.tab.is-active { color: var(--gold); border-bottom-color: var(--gold); }

.drawer__body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.tab-panel[hidden] { display: none; }

.panel-hint { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; }

.field-group {
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.field-group:last-child { border-bottom: none; }
.field-group__title { font-size: 15px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.field-group__desc { color: var(--text-muted); font-size: 12.5px; margin-bottom: 10px; line-height: 1.5; }
.field-label { display: block; font-size: 12.5px; color: var(--text-muted); margin: 12px 0 6px; }

.field-group input[type="text"],
.field-group input[type="password"],
.field-group input[type="number"],
.field-group select,
.field-group textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--text-primary);
}
.field-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23B6ACC9' d='M5.5 7.5 10 12l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.field-group textarea { resize: vertical; min-height: 70px; font-family: var(--font-body); }
.field-group input:focus, .field-group select:focus, .field-group textarea:focus { border-color: var(--gold); }

.input-with-btn { display: flex; gap: 6px; }
.input-with-btn input { flex: 1; min-width: 0; }

.row-gap { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.row-gap--wrap { flex-wrap: wrap; }
.test-result { font-size: 12.5px; color: var(--text-muted); }
.test-result.is-ok { color: #7CC49A; }
.test-result.is-err { color: #E77; }

.switch-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0;
  font-size: 13.5px;
  cursor: pointer;
}
.switch-row input { width: 18px; height: 18px; flex: none; }

.history-list {
  max-height: 240px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 10px;
}
.history-item {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12.5px;
}
.history-item__role { font-weight: 700; color: var(--gold); margin-right: 4px; }
.history-empty { color: var(--text-faint); font-size: 12.5px; text-align: center; padding: 20px 0; }

/* ============================== পারসোনা গ্রিড / কার্ড ============================== */
.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.persona-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--bg-panel-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 10px 10px;
  text-align: center;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.persona-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.persona-card.is-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg-panel-2)); }
.persona-card__avatar {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--bg-elevated);
  box-shadow: 0 0 0 2px var(--accent);
}
.persona-card__name { font-weight: 700; font-size: 13.5px; font-family: var(--font-display); }
.persona-card__tone { font-size: 11px; color: var(--text-faint); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.persona-card__badge { position: absolute; top: 6px; right: 6px; font-size: 9px; background: var(--gold-soft); color: var(--gold); padding: 2px 6px; border-radius: var(--radius-pill); font-weight: 700; }
.persona-card__actions { position: absolute; top: 4px; left: 4px; display: flex; gap: 3px; opacity: 0; transition: opacity .15s; }
.persona-card:hover .persona-card__actions { opacity: 1; }
.icon-btn--tiny { width: 22px; height: 22px; font-size: 11px; background: var(--bg-elevated); border: 1px solid var(--line); border-radius: 50%; }

.persona-grid--onboard .persona-card { padding: 12px 8px 8px; }

/* ============================== মোডাল ============================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 5, 16, 0.68);
  backdrop-filter: blur(4px);
  padding: 16px;
  overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }

.modal {
  width: 100%; max-width: 440px;
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-2);
  animation: fadeSlideUp 0.25s cubic-bezier(.2,.8,.3,1);
  margin: auto;
}
.modal h2 { font-size: 19px; margin-bottom: 16px; }

.form-row { display: flex; gap: 10px; margin-bottom: 12px; }
.form-field { flex: 1; min-width: 0; }
.form-field--grow { flex: 2; }
.form-field--tiny { flex: 0 0 64px; }
.form-field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.form-field input, .form-field textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 13.5px;
  color: var(--text-primary);
}
.form-field input[type="color"] { padding: 3px; height: 38px; }
.form-field textarea { resize: vertical; min-height: 50px; font-family: var(--font-body); }
.form-field output { color: var(--gold); font-weight: 600; }

.modal__actions { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; gap: 8px; }
.modal__actions-right { display: flex; gap: 8px; margin-left: auto; }

/* --- অনবোর্ডিং --- */
.modal--onboard { max-width: 480px; text-align: center; }
.onboard-hero { position: relative; height: 84px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.onboard-hero__glow {
  position: absolute; width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, var(--gold-soft), transparent 70%);
  animation: heroGlow 3.4s ease-in-out infinite;
}
.onboard-hero__emoji { font-size: 46px; position: relative; }
@keyframes heroGlow { 0%, 100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.15); opacity: 1; } }

.onboard-title { font-size: 25px; margin-bottom: 8px; }
.onboard-sub { color: var(--text-muted); font-size: 13.5px; margin-bottom: 22px; line-height: 1.55; }
.onboard-step { text-align: left; padding: 16px 0; border-top: 1px solid var(--line); }
.onboard-step__title { font-size: 16px; margin-bottom: 6px; }
.onboard-step__desc { color: var(--text-muted); font-size: 12.5px; line-height: 1.55; margin-bottom: 12px; }
.onboard-step .input-with-btn { margin-bottom: 8px; }
.onboard-step .input-with-btn input {
  flex: 1; background: var(--bg-elevated); border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill); padding: 11px 16px; color: var(--text-primary); font-size: 14px;
}
#btnOnboardStart { margin-top: 20px; }

/* ============================== টোস্ট ============================== */
.toast-host {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 50;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
  width: min(92vw, 380px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-size: 13px;
  box-shadow: var(--shadow-1);
  animation: toastIn 0.25s ease;
  text-align: center;
}
.toast--error { border-color: rgba(224,90,90,0.5); color: #F0AFAF; }
.toast--success { border-color: rgba(124,196,154,0.5); color: #A9E0C1; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.toast.is-leaving { animation: toastOut 0.25s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ============================== ইউটিলিটি ============================== */
[hidden] { display: none !important; }
