:root {
  --font-family: "Google Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "Google Sans Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  
  /* Gemini Light Theme */
  --bg-primary: #ffffff;
  --bg-secondary: #f0f4f9;
  --bg-tertiary: #e1e5ea;
  --bg-sidebar: #f0f4f9;
  --border-color: #e1e3e1;
  --border-focus: #1a73e8;
  
  --text-primary: #1f1f1f;
  --text-secondary: #444746;
  --text-muted: #747775;
  
  --user-msg-bg: #e9eef6;
  --user-msg-text: #1f1f1f;
  --assistant-msg-bg: transparent;
  --assistant-msg-text: #1f1f1f;
  
  --accent-color: #1a73e8;
  --accent-hover: #1557b0;
  --gemini-gradient: linear-gradient(74deg, #4285f4 0%, #9b72cf 35%, #d96570 65%, #1ba1e3 100%);
  --accent-light: rgba(66, 133, 244, 0.1);
  --accent-border: #d2e3fc;
  
  --success-color: #1e8e3e;
  --warning-color: #f9ab00;
  --danger-color: #d93025;
  --danger-hover: #b3261e;
  --danger-light: #fce8e6;
  
  --code-bg: #1e1f20;
  --code-text: #f8fafc;
  
  --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.1);
  --shadow-md: 0 4px 12px 0 rgba(60, 64, 67, 0.15);
  --shadow-lg: 0 8px 24px 0 rgba(60, 64, 67, 0.2);
  --shadow-xl: 0 16px 36px 0 rgba(60, 64, 67, 0.25);
  
  --sidebar-width: 280px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 28px;
  --radius-full: 9999px;
  
  --transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

[data-theme="dark"] {
  /* Gemini Iconic Dark Palette (gemini.google.com) */
  --bg-primary: #131314;
  --bg-secondary: #1e1f20;
  --bg-tertiary: #28292a;
  --bg-sidebar: #1e1f20;
  --border-color: #28292a;
  --border-focus: #8ab4f8;
  
  --text-primary: #e3e3e3;
  --text-secondary: #c4c7c5;
  --text-muted: #8e918f;
  
  --user-msg-bg: #282a2c;
  --user-msg-text: #e3e3e3;
  --assistant-msg-bg: transparent;
  --assistant-msg-text: #e3e3e3;
  
  --accent-color: #8ab4f8;
  --accent-hover: #aecbfa;
  --gemini-gradient: linear-gradient(74deg, #4285f4 0%, #9b72cf 35%, #d96570 65%, #1ba1e3 100%);
  --accent-light: rgba(138, 180, 248, 0.12);
  --accent-border: #3c4043;
  
  --success-color: #81c995;
  --warning-color: #fdd663;
  --danger-color: #f28b82;
  --danger-hover: #ee675c;
  --danger-light: #3c1e1e;
  
  --code-bg: #18191a;
  --code-text: #f8fafc;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px 0 rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 8px 28px 0 rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 16px 40px 0 rgba(0, 0, 0, 0.65);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

/* Layout App Container */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Gemini Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1), transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
  overflow: hidden;
}

.sidebar.closed {
  margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
  padding: 0.75rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.gemini-sparkle-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.brand-text-col {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gemini-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.sidebar-actions {
  padding: 0.25rem 1rem 0.75rem 1rem;
}

/* Gemini Style "+ New Chat" Button */
.btn-new-chat {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.75rem 1.15rem;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-new-chat:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--accent-color);
}

.chat-history-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.chat-history-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.6rem 0.75rem 0.35rem 0.75rem;
  letter-spacing: 0.02em;
}

/* Custom Projects Section in Sidebar */
.projects-section {
  padding: 0.25rem 0.5rem 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.5rem;
}

.projects-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
}

.projects-section-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.icon-btn-xs {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.icon-btn-xs:hover {
  color: var(--accent-color);
  background-color: var(--accent-light);
}

.projects-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.2rem;
}

.projects-empty-hint {
  padding: 0.45rem 0.65rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.project-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.15rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.project-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.38rem 0.55rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.project-group-header:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.project-group.active > .project-group-header {
  background-color: var(--accent-light);
  color: var(--accent-color);
  font-weight: 600;
}

.project-group-chevron {
  background: transparent;
  border: none;
  padding: 0.15rem;
  margin-right: 0.2rem;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.project-group-chevron:hover {
  color: var(--text-primary);
}

.project-group.expanded .project-group-chevron svg {
  transform: rotate(90deg);
}

.project-group-main {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}

.project-group-icon {
  font-size: 0.95rem;
  flex-shrink: 0;
}

.project-group-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.84rem;
  font-weight: 600;
}

.project-nav-badge {
  font-size: 0.68rem;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-pill);
  background-color: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 600;
  margin-left: 0.25rem;
}

.project-group.active .project-nav-badge {
  background-color: rgba(66, 133, 244, 0.2);
  color: var(--accent-color);
}

.project-group-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.25rem;
  opacity: 0.85;
  transition: opacity var(--transition);
}

.project-group-header:hover .project-group-actions,
.project-group.active > .project-group-header .project-group-actions {
  opacity: 1;
}

.project-group-chats {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  margin-left: 0.95rem;
  padding-left: 0.65rem;
  border-left: 2px solid var(--border-color);
  margin-top: 0.15rem;
  margin-bottom: 0.35rem;
}

.project-nested-chat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.81rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.project-nested-chat:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.project-nested-chat.active {
  background-color: var(--accent-light);
  color: var(--accent-color);
  font-weight: 600;
}

.project-nested-chat-icon {
  flex-shrink: 0;
  opacity: 0.65;
}

.project-nested-chat.active .project-nested-chat-icon {
  opacity: 1;
}

.project-nested-chat-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-left: 0.4rem;
}

.project-nested-chat-actions {
  display: none;
  align-items: center;
  gap: 0.15rem;
  margin-left: 0.25rem;
}

.project-nested-chat:hover .project-nested-chat-actions,
.project-nested-chat.active .project-nested-chat-actions {
  display: flex;
}



.chat-history-empty {
  padding: 0.75rem 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
}

.chat-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.chat-item.active {
  background-color: var(--accent-light);
  color: var(--accent-color);
  font-weight: 600;
}

.chat-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  padding-right: 0.5rem;
}

.chat-item-project-tag {
  font-size: 0.85rem;
  margin-right: 0.4rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.chat-item-actions {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

.chat-item:hover .chat-item-actions,
.chat-item.active .chat-item-actions {
  display: flex;
}

.chat-item.editing {
  background-color: var(--bg-tertiary);
  padding: 0.35rem 0.5rem;
}

.chat-item-rename-box {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.chat-item-rename-input {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  font-family: inherit;
  border: 1px solid var(--accent-color);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-light);
}

.icon-btn-sm {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.icon-btn-sm:hover {
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

.btn-rename-chat:hover,
.btn-rename-topbar:hover {
  color: var(--accent-color);
  background-color: var(--accent-light);
}

.btn-delete-chat:hover,
.btn-cancel-rename:hover {
  color: var(--danger-color);
  background-color: var(--danger-light);
}

.btn-confirm-rename:hover {
  color: var(--success-color);
  background-color: rgba(52, 168, 83, 0.15);
}

/* Sidebar Footer (Profile / Settings) */
.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-sidebar);
}

.user-profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-pill);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.user-profile-bar:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--accent-color);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
}

.user-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--gemini-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
}

.user-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  background-color: var(--success-color);
  border: 2px solid var(--bg-primary);
}

.user-status-dot.offline {
  background-color: var(--text-muted);
}

.user-meta-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.user-tier {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.profile-settings-hint {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.user-profile-bar:hover .profile-settings-hint {
  color: var(--accent-color);
}

/* Main Chat Area */
.main-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* Top Navigation Bar Header */
.chat-topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background-color: var(--bg-primary);
  z-index: 10;
  gap: 1rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.topbar-title-wrap {
  display: flex;
  align-items: center;
  position: relative;
  max-width: 320px;
  min-width: 0;
}

.topbar-title-display {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.topbar-title-display:hover {
  background-color: var(--bg-hover);
}

.topbar-chat-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

.btn-rename-topbar {
  opacity: 0;
  color: var(--text-muted);
  transition: opacity 0.15s ease, color 0.15s ease;
  padding: 0.2rem;
}

.topbar-title-display:hover .btn-rename-topbar {
  opacity: 1;
}

.topbar-rename-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.topbar-rename-input {
  min-width: 160px;
  max-width: 240px;
  padding: 0.3rem 0.6rem;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid var(--accent-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-light);
}

/* Topbar Active Project Pill */
.topbar-project-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  background-color: var(--accent-light);
  border: 1px solid rgba(66, 133, 244, 0.3);
  color: var(--accent-color);
  font-size: 0.82rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  max-width: 220px;
}

.topbar-project-pill:hover {
  background-color: rgba(66, 133, 244, 0.2);
}

.project-pill-icon {
  font-size: 0.95rem;
}

.project-pill-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-pill-btn-edit,
.project-pill-btn-exit {
  background: none;
  border: none;
  color: var(--accent-color);
  cursor: pointer;
  padding: 0.15rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  opacity: 0.75;
}

.project-pill-btn-edit:hover,
.project-pill-btn-exit:hover {
  opacity: 1;
  background-color: rgba(66, 133, 244, 0.25);
}

/* Google Gemini Standard Circular Icon Button (40px) */
.btn-gemini-icon,
.btn-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
  position: relative;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
  flex-shrink: 0;
  user-select: none;
  padding: 0;
}

.btn-gemini-icon:hover,
.btn-icon:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-gemini-icon:active,
.btn-icon:active {
  transform: scale(0.92);
  background-color: rgba(255, 255, 255, 0.12);
}

.btn-gemini-icon:focus-visible,
.btn-icon:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-color);
}

/* Sidebar Header [|<] Collapse Button */
#btn-close-sidebar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

#btn-close-sidebar:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Topbar Header [|>] Open Button */
#btn-toggle-sidebar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

#btn-toggle-sidebar:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

/* When sidebar is OPEN on desktop: Hide topbar open button completely (removes header duplicate!) */
@media (min-width: 769px) {
  body:not(.sidebar-closed) #btn-toggle-sidebar,
  .sidebar:not(.closed) ~ .main-chat #btn-toggle-sidebar {
    display: none !important;
  }
}

/* When sidebar is CLOSED: Topbar open button is visible with [|>] */
body.sidebar-closed #btn-toggle-sidebar,
.sidebar.closed ~ .main-chat #btn-toggle-sidebar {
  display: inline-flex !important;
}

/* Gemini Model Selector Pill */
.model-picker-wrapper {
  position: relative;
  flex-shrink: 0;
}

.model-picker-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  max-width: 320px;
}

.model-picker-btn:hover {
  border-color: var(--accent-color);
  background-color: var(--bg-tertiary);
}

.model-picker-sparkle {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

#selected-model-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-provider-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background-color: var(--border-color);
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.03em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* Messages Scroll Container */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.messages-inner {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Gemini Hero Welcome Screen */
.welcome-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  padding: 3rem 0.5rem 2rem 0.5rem;
  margin: auto 0;
  width: 100%;
}

.welcome-gemini-greeting {
  font-size: 3.2rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.04em;
  margin-bottom: 0.5rem;
}

.welcome-gemini-greeting .gradient-text {
  background: var(--gemini-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.welcome-gemini-subtitle {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -0.02em;
  margin-bottom: 2.5rem;
}

/* Gemini Suggestion Cards Grid */
.starter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  width: 100%;
}

.starter-card {
  padding: 1.15rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 150px;
  position: relative;
  border: 1px solid transparent;
}

.starter-card:hover {
  background-color: var(--bg-tertiary);
  transform: translateY(-2px);
  border-color: var(--border-color);
}

.starter-card-desc {
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.45;
  font-weight: 500;
}

.starter-card-icon-bubble {
  align-self: flex-end;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background-color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  color: var(--accent-color);
}

/* Gemini Message Styles */
.message-wrapper {
  display: flex;
  gap: 1.25rem;
  width: 100%;
  animation: fadeIn 0.25s ease-out;
}

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

.message-wrapper.user {
  justify-content: flex-end;
}

.message-wrapper.user .message-avatar {
  display: none; /* Gemini does not show a heavy user avatar, just the clean message bubble */
}

.message-avatar.assistant {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.message-content-container {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  flex: 1;
}

.message-wrapper.user .message-content-container {
  max-width: 75%;
  align-items: flex-end;
}

/* Gemini User Speech Bubble */
.message-bubble.user {
  padding: 0.85rem 1.25rem;
  border-radius: 20px;
  background-color: var(--user-msg-bg);
  color: var(--user-msg-text);
  font-size: 0.95rem;
  line-height: 1.6;
  word-break: break-word;
}

/* Gemini Assistant Message (Open, borderless, natural flow) */
.message-bubble.assistant {
  padding: 0;
  background-color: transparent;
  color: var(--assistant-msg-text);
  font-size: 1rem;
  line-height: 1.7;
  word-break: break-word;
}

.message-attachment {
  max-width: 300px;
  max-height: 240px;
  border-radius: var(--radius-md);
  margin-bottom: 0.6rem;
  display: block;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

/* Gemini Thinking Process Accordion */
.reasoning-block {
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  overflow: hidden;
  font-size: 0.85rem;
}

.reasoning-header {
  padding: 0.6rem 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.82rem;
}

.reasoning-header:hover {
  background-color: var(--bg-tertiary);
}

.reasoning-content {
  padding: 0.95rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  max-height: 320px;
  overflow-y: auto;
}

.reasoning-block.collapsed .reasoning-content {
  display: none;
}

/* Markdown Rendering */
.markdown-body {
  line-height: 1.7;
}

.markdown-body p {
  margin-bottom: 1rem;
}

.markdown-body p:last-child {
  margin-bottom: 0;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
  margin: 1.4rem 0 0.6rem 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.markdown-body h1 { font-size: 1.5rem; }
.markdown-body h2 { font-size: 1.3rem; }
.markdown-body h3 { font-size: 1.15rem; }

.markdown-body ul, .markdown-body ol {
  margin: 0.5rem 0 1rem 1.5rem;
}

.markdown-body li {
  margin-bottom: 0.4rem;
}

.markdown-body blockquote {
  border-left: 3px solid var(--accent-color);
  padding-left: 1rem;
  color: var(--text-secondary);
  margin: 1rem 0;
  font-style: italic;
}

.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}

.markdown-body th, .markdown-body td {
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.85rem;
  text-align: left;
}

.markdown-body th {
  background-color: var(--bg-secondary);
  font-weight: 600;
}

.markdown-body code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background-color: var(--bg-secondary);
  padding: 0.2em 0.45em;
  border-radius: 4px;
  color: var(--accent-color);
}

.code-block-wrapper {
  margin: 1.25rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--code-bg);
  border: 1px solid var(--border-color);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background-color: rgba(255, 255, 255, 0.04);
  color: #9aa0a6;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.btn-copy-code {
  background: none;
  border: none;
  color: #9aa0a6;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-copy-code:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
}

.code-block-wrapper pre {
  margin: 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--code-text);
}

/* Gemini Message Action Bar */
.message-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  opacity: 0;
  transition: var(--transition);
}

.message-wrapper:hover .message-actions {
  opacity: 1;
}

.message-meta-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

/* Drag & Drop Overlay Indicator */
.drop-zone-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--accent-light);
  backdrop-filter: blur(2px);
  border: 2px dashed var(--accent-color);
  border-radius: var(--radius-pill);
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--accent-color);
  font-size: 0.95rem;
  z-index: 30;
  pointer-events: none;
}

.drop-zone-overlay.active {
  display: flex;
}

/* Gemini Floating Pill Input Container */
.input-area-wrapper {
  padding: 0.75rem 1.5rem 1.25rem 1.5rem;
  background-color: var(--bg-primary);
  position: relative;
}

.input-box-container {
  max-width: 800px;
  margin: 0 auto;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 0.5rem 0.85rem 0.5rem 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
}

.input-box-container:focus-within {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-md);
}

.attachment-preview-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem 0.5rem 0.5rem;
}

.attachment-preview-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
}

.attachment-preview-thumb {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 0.96rem;
  color: var(--text-primary);
  max-height: 180px;
  min-height: 24px;
  line-height: 1.5;
  padding: 0.4rem 0.2rem;
}

.chat-textarea::placeholder {
  color: var(--text-muted);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Gemini Round Send Button */
.btn-send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background-color: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
  opacity: 0.9;
  transform: scale(1.05);
}

.btn-send:disabled {
  background-color: var(--border-color);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-stop {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background-color: var(--danger-color);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.input-footer-note {
  max-width: 800px;
  margin: 0.6rem auto 0 auto;
  text-align: center;
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.input-footer-note a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

.input-footer-note a:hover {
  text-decoration: underline;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 620px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: translateY(14px);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-dialog {
  transform: translateY(0);
}

.modal-header {
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background-color: var(--bg-primary);
  z-index: 2;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

/* Modern Non-Scrollable Segmented Tab Control */
.modal-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.35rem 0.6rem;
  gap: 0.35rem;
  flex-shrink: 0;
  overflow: hidden;
}

.modal-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.modal-tab-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-hover);
}

.modal-tab-btn.active {
  color: var(--text-primary);
  background-color: var(--bg-primary);
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.modal-tab-btn .tab-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.modal-tab-btn .tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-body {
  padding: 1.4rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
}

.tab-content.active {
  display: flex;
}

.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.account-card-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.account-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--gemini-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
}

.account-details h3 {
  font-size: 1rem;
  font-weight: 600;
}

.account-details p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.usage-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.stat-box {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-color);
  margin-top: 0.2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.form-input, .form-textarea, .form-select {
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--border-focus);
}

.custom-username-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-prefix-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  position: relative;
}

.input-prefix {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
  font-size: 0.95rem;
}

.form-input.with-prefix {
  width: 100%;
  padding-left: 2rem;
}

.link-manage-puter {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--accent-color);
  text-decoration: none;
  margin-top: 0.25rem;
  transition: opacity 0.15s ease;
}

.link-manage-puter:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* In-Window Custom Project Studio View (Gemini Style) */
.project-studio-view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  z-index: 25;
  overflow: hidden;
}

.studio-topbar {
  height: 60px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  gap: 1rem;
  flex-shrink: 0;
}

.studio-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.studio-title-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.studio-header-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.studio-header-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.btn-danger-text {
  background: none;
  border: none;
  color: var(--danger-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-pill);
  transition: var(--transition);
}

.btn-danger-text:hover {
  background-color: var(--danger-light);
}

.btn-sm {
  padding: 0.45rem 1rem !important;
  font-size: 0.84rem !important;
}

.studio-mobile-view-toggle {
  display: none;
  background-color: var(--bg-secondary);
  padding: 0.2rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
}

.studio-toggle-pill {
  background: none;
  border: none;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.studio-toggle-pill.active {
  background-color: var(--accent-light);
  color: var(--accent-color);
}

/* Studio 2-Column Content Grid */
.studio-content-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(420px, 1.35fr) minmax(360px, 1fr);
  height: calc(100% - 60px);
  overflow: hidden;
}

/* Left Column: Editor & Settings */
.studio-editor-column {
  overflow-y: auto;
  padding: 2rem;
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  scroll-behavior: smooth;
}

.studio-editor-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 2rem;
}

.studio-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
}

.studio-section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.15rem;
}

.studio-section-num {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--gemini-gradient);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.studio-card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.studio-input-lg {
  font-size: 1rem;
  padding: 0.65rem 0.85rem;
  font-weight: 500;
}

.emoji-picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.emoji-pill {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.emoji-pill:hover {
  background-color: var(--bg-hover);
  transform: scale(1.08);
}

.emoji-pill.active {
  border-color: var(--accent-color);
  background-color: var(--accent-light);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.label-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-pill);
  background-color: var(--accent-light);
  color: var(--accent-color);
  text-transform: uppercase;
}

.label-badge.secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
}

.project-token-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  background-color: var(--bg-primary);
  color: var(--accent-color);
  border: 1px solid rgba(66, 133, 244, 0.3);
  white-space: nowrap;
}

.project-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  background-color: var(--bg-primary);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.project-dropzone:hover,
.project-dropzone.dragover {
  border-color: var(--accent-color);
  background-color: var(--accent-light);
  color: var(--accent-color);
}

.dropzone-text {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.dropzone-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.project-files-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.75rem;
  max-height: 260px;
  overflow-y: auto;
}

.project-file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  transition: var(--transition);
}

.project-file-card:hover {
  border-color: var(--border-focus);
}

.project-file-icon {
  color: var(--accent-color);
  flex-shrink: 0;
  margin-right: 0.5rem;
  display: flex;
  align-items: center;
}

.project-file-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.project-file-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-file-info {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.project-file-btn-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.project-file-btn-delete:hover {
  color: var(--danger-color);
  background-color: var(--danger-light);
}

/* Right Column: Live Interactive Preview & Test Pane (Gemini Style) */
.studio-preview-column {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-sidebar);
  overflow: hidden;
}

.studio-preview-header {
  height: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
}

.studio-preview-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-text-sm {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-text-sm:hover {
  color: var(--accent-color);
  background-color: var(--bg-hover);
}

.studio-preview-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.studio-preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

.preview-empty-icon {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

.preview-empty-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.preview-empty-sub {
  font-size: 0.82rem;
  line-height: 1.45;
  max-width: 280px;
}

.preview-bubble {
  max-width: 88%;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-lg);
  font-size: 0.86rem;
  line-height: 1.45;
  word-break: break-word;
}

.preview-bubble.user {
  align-self: flex-end;
  background-color: var(--accent-color);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.preview-bubble.assistant {
  align-self: flex-start;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.studio-preview-input-bar {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.studio-preview-textarea {
  flex: 1;
  min-height: 38px;
  max-height: 110px;
  resize: none;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.86rem;
  padding: 0.55rem 0.95rem;
  line-height: 1.35;
  outline: none;
  transition: var(--transition);
}

.studio-preview-textarea:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.btn-send-preview {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--gemini-gradient);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.btn-send-preview:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 1024px) {
  .studio-mobile-view-toggle {
    display: inline-flex;
  }
  .studio-content-grid {
    grid-template-columns: 1fr;
  }
  .studio-preview-column {
    display: none;
  }
  .studio-content-grid.show-preview .studio-editor-column {
    display: none;
  }
  .studio-content-grid.show-preview .studio-preview-column {
    display: flex;
  }
  .studio-editor-column {
    border-right: none;
    padding: 1.25rem 1rem;
  }
}

.modal-footer {
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  background-color: var(--bg-secondary);
  flex-shrink: 0;
}

.btn-secondary {
  padding: 0.55rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background-color: var(--bg-tertiary);
}

.btn-primary {
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--gemini-gradient);
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-danger {
  padding: 0.55rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--danger-color);
  background-color: var(--danger-light);
  color: var(--danger-color);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover {
  background-color: var(--danger-color);
  color: white;
}

/* Model Search & Provider Pills in Modal */
.modal-sticky-filter-header {
  padding: 1rem 1.25rem 0.5rem 1.25rem;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex-shrink: 0;
}

.provider-pills-bar {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
}

.provider-pill {
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.provider-pill:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.provider-pill.active {
  background-color: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.model-search-box {
  position: relative;
}

.model-search-input {
  width: 100%;
  padding: 0.65rem 0.85rem 0.65rem 2.25rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}

.model-search-input:focus {
  border-color: var(--border-focus);
}

.model-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.modal-body-models {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.models-list-container {
  max-height: 420px;
  overflow-y: auto;
  background-color: var(--bg-secondary);
}

.model-group-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background-color: var(--bg-sidebar);
  color: var(--accent-color);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border-color);
  border-top: 1px solid var(--border-color);
}

.model-option-item {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.model-option-item:last-child {
  border-bottom: none;
}

.model-option-item:hover {
  background-color: var(--bg-tertiary);
}

.model-option-item.selected {
  background-color: var(--accent-light);
  border-left: 3px solid var(--accent-color);
}

.model-option-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.model-option-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.model-option-id {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.model-badges-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.badge-featured {
  background: var(--gemini-gradient);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-pill);
}

.badge-reasoning {
  background-color: rgba(155, 114, 207, 0.2);
  color: #c499f5;
  border: 1px solid rgba(155, 114, 207, 0.4);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-pill);
}

.badge-context {
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-pill);
}

/* Friendly In-App Error & Model Recovery Widget */
.chat-error-card {
  background-color: var(--danger-light);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 560px;
}

.chat-error-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--danger-color);
  font-size: 0.92rem;
}

.chat-error-body {
  color: var(--text-primary);
  font-size: 0.84rem;
  line-height: 1.45;
  background-color: rgba(0, 0, 0, 0.25);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  word-break: break-word;
}

.chat-error-hint {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.4;
}

.chat-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.btn-recovery {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 0.42rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-recovery:hover {
  background-color: var(--accent-light);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

/* Scroll-to-bottom Floating Button */
.btn-scroll-bottom {
  position: absolute;
  bottom: 95px;
  right: 25px;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  z-index: 20;
}

.btn-scroll-bottom.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 200;
  pointer-events: none;
}

.toast {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-pill);
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transform: translateY(10px);
  transition: var(--transition);
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Sidebar Backdrop for Mobile Drawer */
.sidebar-backdrop {
  display: none;
}

@media (min-width: 769px) {
  .btn-sidebar-close {
    opacity: 0.7;
  }
  .btn-sidebar-close:hover {
    opacity: 1;
  }
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .starter-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 95;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 85vw);
    height: 100%;
    margin-left: 0 !important;
    transform: translateX(-100%); /* Closed by default on mobile */
    box-shadow: var(--shadow-xl);
    z-index: 100;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  .sidebar.closed {
    transform: translateX(-100%) !important;
    margin-left: 0 !important;
  }

  .btn-sidebar-close {
    display: inline-flex !important;
  }

  /* Mobile Modals: responsive sizing and pinned headers */
  .modal-dialog {
    width: 95%;
    max-width: 500px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
  }

  .modal-header {
    padding: 0.95rem 1.15rem;
  }

  .modal-tabs {
    padding: 0.35rem 0.45rem;
    gap: 0.25rem;
  }

  .modal-tab-btn {
    padding: 0.5rem 0.3rem;
    font-size: 0.78rem;
  }

  .modal-tab-btn .tab-icon {
    font-size: 0.85rem;
  }

  .modal-body {
    padding: 1.15rem;
    gap: 1rem;
  }

  .modal-footer {
    padding: 0.85rem 1.15rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .modal-footer .app-version-badge {
    display: none;
  }

  .welcome-gemini-greeting {
    font-size: 2.2rem;
  }

  .welcome-gemini-subtitle {
    font-size: 1.4rem;
  }

  .starter-grid {
    grid-template-columns: 1fr;
  }

  .message-wrapper.user .message-content-container {
    max-width: 88%;
  }

  .input-area-wrapper {
    padding: 0.5rem 0.75rem calc(0.85rem + env(safe-area-inset-bottom, 0px)) 0.75rem;
  }

  /* Strict 16px font-size prevents iOS Safari from auto-zooming viewport */
  .chat-textarea {
    font-size: 16px !important;
  }
}

/* ==========================================================================
   Cloud Sync & Refresh Animations
   ========================================================================== */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.spin-icon,
.btn-icon.syncing svg,
#btn-manual-sync.syncing svg {
  animation: spin 0.85s linear infinite;
}

#btn-topbar-sync {
  transition: transform 0.2s ease, color 0.2s ease;
}

#btn-topbar-sync:hover {
  color: var(--accent-color);
  transform: scale(1.05);
}

#btn-manual-sync:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

/* User Message Actions & Inline Prompt Editing */
.message-wrapper.user {
  position: relative;
}

.message-wrapper.user .message-actions {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  margin-top: 0.35rem;
  justify-content: flex-end;
}

.message-wrapper.user:hover .message-actions,
.message-wrapper.user:focus-within .message-actions {
  opacity: 1;
  pointer-events: auto;
}

.user-prompt-edit-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.user-prompt-edit-textarea {
  width: 100%;
  min-height: 72px;
  background: var(--bg-primary);
  border: 1px solid var(--accent-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.user-prompt-edit-textarea:focus {
  outline: none;
}

.user-prompt-edit-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}



/* Attachment Doc Badge */
.attachment-doc-badge {
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* AI Generated Image Cards */
.ai-generated-image-card {
  margin: 0.6rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: inline-block;
  max-width: 100%;
  box-shadow: var(--shadow-md);
}

.ai-generated-image {
  display: block;
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.ai-generated-image:hover {
  opacity: 0.95;
}

.ai-image-footer {
  padding: 0.45rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
  font-size: 0.78rem;
  color: var(--text-muted);
  gap: 0.5rem;
}

/* AI Generated Document Card (Rendered when user asks to generate/draft PDF or DOCX) */
.ai-generated-document-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.1rem;
  margin-top: 0.85rem;
  transition: var(--transition);
}

.ai-generated-document-card:hover {
  border-color: var(--accent-color);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.doc-card-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.doc-card-badge {
  font-size: 1.6rem;
  line-height: 1;
}

.doc-card-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.doc-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.doc-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-download-doc-card {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.95rem;
  background: var(--accent-gradient, linear-gradient(135deg, #4f46e5, #06b6d4));
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

.btn-download-doc-card:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-export-doc {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.74rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.btn-export-doc:hover {
  color: var(--text-primary);
  border-color: var(--accent-color);
  background: var(--hover-color);
}

/* --- Gemini Chatbox UI Redesign: Left + Tools Popover, Right Mic & Model Picker --- */

/* Left Side: + Button & Dropdown Wrapper */
.chat-tools-dropdown-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.btn-chat-plus {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background-color: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.btn-chat-plus:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-chat-plus:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-color);
}

.btn-chat-plus.open {
  background-color: var(--accent-light);
  color: var(--accent-color);
}

.btn-chat-plus .icon-plus-svg {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-chat-plus.open .icon-plus-svg {
  transform: rotate(45deg);
}

/* Gemini Floating Tools Popover Menu */
.chat-tools-popover {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 0;
  min-width: 270px;
  max-width: 320px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28), 0 3px 12px rgba(0, 0, 0, 0.16);
  padding: 0.45rem;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transform-origin: bottom left;
  animation: popoverSlideUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.chat-tools-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.chat-tool-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.chat-tool-item:hover {
  background-color: var(--bg-secondary);
  transform: translateX(2px);
}

.chat-tool-item:active {
  transform: scale(0.99);
}

.chat-tool-item:focus-visible {
  outline: none;
  background-color: var(--bg-secondary);
  box-shadow: 0 0 0 2px var(--accent-color);
}

.chat-tool-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.chat-tool-item:hover .chat-tool-icon {
  transform: scale(1.08);
}

.tool-icon-file {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.tool-icon-image-upload {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.tool-icon-gen-image {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(236, 72, 153, 0.18));
  color: #8b5cf6;
}

.tool-icon-gen-video {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.18), rgba(245, 158, 11, 0.18));
  color: #ec4899;
}

.tool-icon-gen-music {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(168, 85, 247, 0.18));
  color: #0ea5e9;
}

.chat-tool-content {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;
}

.chat-tool-title {
  font-size: 0.88rem;
  font-weight: 550;
  color: var(--text-primary);
  line-height: 1.25;
}

.chat-tool-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-tool-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent-color);
  margin-left: auto;
  flex-shrink: 0;
}

/* Popover Pagebreak / Divider */
.chat-tools-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 0.35rem 0.4rem;
  opacity: 0.85;
}

/* Active Mode Indicator Bar */
.active-mode-indicator {
  display: flex;
  align-items: center;
  padding: 0.25rem 0.5rem 0.35rem 0.5rem;
}

.active-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent-color);
  border: 1px solid rgba(79, 70, 229, 0.25);
  animation: modeFadeIn 0.2s ease-out;
}

.active-mode-pill.mode-video {
  background: rgba(236, 72, 153, 0.15);
  color: #ec4899;
  border-color: rgba(236, 72, 153, 0.3);
}

.active-mode-pill.mode-music {
  background: rgba(14, 165, 233, 0.15);
  color: #0ea5e9;
  border-color: rgba(14, 165, 233, 0.3);
}

@keyframes modeFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.btn-clear-mode {
  padding: 0.1rem;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  font-size: 0.7rem;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: opacity 0.15s, background-color 0.15s;
}

.btn-clear-mode:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.12);
}

/* Chat Textarea Dynamic Mode Border Accents */
.chat-textarea.image-mode {
  border-color: var(--accent-color);
}

.chat-textarea.video-mode {
  border-color: #ec4899;
}

.chat-textarea.music-mode {
  border-color: #0ea5e9;
}

/* Chatbox Second Right: Model Change Pill Button */
.chat-model-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 155px;
  flex-shrink: 0;
}

.chat-model-picker-btn:hover {
  border-color: var(--accent-color);
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.chat-model-sparkle {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
}

.chat-model-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 95px;
}

.chat-model-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Chatbox Right: Voice Dictation Mic Button */
.btn-mic {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-mic:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-mic:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-color);
}

.btn-mic.listening {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.15);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.4);
}

.mic-pulse-ring {
  display: none;
}

.btn-mic.listening .mic-pulse-ring {
  display: block;
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid #ef4444;
  animation: micPulseWave 1.4s infinite cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: none;
}

@keyframes micPulseWave {
  0% {
    transform: scale(0.9);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* Responsive tweaks for chatbox */
@media (max-width: 640px) {
  .chat-model-picker-btn {
    padding: 0.28rem 0.45rem;
    max-width: 110px;
  }
  .chat-model-name {
    max-width: 60px;
  }
  .chat-tools-popover {
    min-width: 250px;
    max-width: 290px;
  }
}

/* AI Generated Video Cards */
.ai-generated-video-card {
  margin: 0.65rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  max-width: 100%;
  width: 580px;
  box-shadow: var(--shadow-md);
}

.ai-video-container {
  width: 100%;
  background: #000000;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 240px;
}

.ai-generated-video {
  display: block;
  width: 100%;
  max-height: 440px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  object-fit: contain;
}

.ai-video-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.ai-video-footer span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  flex: 1;
}

/* Video Generating Progress Indicator */
.video-generating-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0;
}

.video-generating-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(139, 92, 246, 0.2);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}

.video-generating-text {
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.video-generating-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* AI Generated Music & Audio Cards */
.ai-generated-music-card {
  margin: 0.75rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-md);
  max-width: 100%;
  width: 560px;
  display: flex;
  flex-direction: column;
}

.music-card-header {
  padding: 1rem 1.15rem;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(168, 85, 247, 0.12));
  display: flex;
  align-items: center;
  gap: 0.9rem;
  border-bottom: 1px solid var(--border-color);
}

.music-play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #8b5cf6);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  flex-shrink: 0;
}

.music-play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.45);
}

.music-meta {
  flex: 1;
  min-width: 0;
}

.music-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.2rem;
}

.music-waveform-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
  padding: 0 0.25rem;
  flex-shrink: 0;
}

.waveform-bar {
  width: 3px;
  height: 6px;
  background-color: var(--text-muted);
  border-radius: 2px;
  transition: height 0.15s ease, background-color 0.2s ease;
}

.ai-generated-music-card.playing .waveform-bar {
  background: linear-gradient(to top, #0ea5e9, #8b5cf6);
  animation: waveBarBounce 0.8s ease-in-out infinite alternate;
}

.ai-generated-music-card.playing .waveform-bar:nth-child(1) { animation-delay: 0.0s; }
.ai-generated-music-card.playing .waveform-bar:nth-child(2) { animation-delay: 0.2s; }
.ai-generated-music-card.playing .waveform-bar:nth-child(3) { animation-delay: 0.4s; }
.ai-generated-music-card.playing .waveform-bar:nth-child(4) { animation-delay: 0.1s; }
.ai-generated-music-card.playing .waveform-bar:nth-child(5) { animation-delay: 0.3s; }
.ai-generated-music-card.playing .waveform-bar:nth-child(6) { animation-delay: 0.5s; }

@keyframes waveBarBounce {
  0% { height: 4px; }
  100% { height: 22px; }
}

.music-card-body {
  padding: 0.85rem 1.15rem;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-secondary);
  background: var(--bg-primary);
}

.music-composition-notes {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  background: var(--bg-secondary);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid #0ea5e9;
  color: var(--text-secondary);
}

.music-tags-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.music-tag {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* ==========================================================================
   Phase 1: Interactive Artifacts & Sandboxed Web Apps Runner
   ========================================================================== */
.artifacts-pane {
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: width 0.25s ease, opacity 0.2s ease;
}

@media (min-width: 900px) {
  .artifacts-pane {
    position: absolute;
    top: 60px;
    right: 0;
    bottom: 0;
    width: 50%;
    border-left: 1px solid var(--border-color);
    z-index: 40;
  }

  .main-chat.has-artifact-open .messages-container,
  .main-chat.has-artifact-open .input-area-wrapper {
    width: 50% !important;
    max-width: 50% !important;
    transition: width 0.25s ease;
  }
}

@media (max-width: 899px) {
  .artifacts-pane {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 150;
  }
}

.artifacts-header {
  height: 54px;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
}

.artifacts-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow: hidden;
}

.artifacts-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.15), rgba(147, 51, 234, 0.15));
  color: var(--accent-color);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid rgba(79, 70, 229, 0.3);
  white-space: nowrap;
}

.artifacts-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifacts-header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.artifacts-viewport-toggle {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  overflow: hidden;
  background-color: var(--bg-primary);
}

.artifacts-vp-btn {
  padding: 0.3rem 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.artifacts-vp-btn.active {
  background-color: var(--bg-tertiary);
  color: var(--accent-color);
}

.btn-publish-artifact {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.artifacts-published-banner {
  padding: 0.55rem 1rem;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.1));
  border-bottom: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  animation: fadeIn 0.2s ease;
}

.published-banner-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}

.published-banner-text a {
  color: var(--success-color, #10b981);
  text-decoration: underline;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifacts-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0f1117;
  overflow: hidden;
  position: relative;
}

.artifacts-frame-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: max-width 0.25s ease;
}

.artifacts-frame-container.viewport-mobile {
  max-width: 375px;
  height: 94%;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.artifacts-sandbox-frame {
  width: 100%;
  height: 100%;
  border: none;
  background-color: #ffffff;
}

/* Code block "Run / Preview App" button in message header */
.btn-run-artifact {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.2), rgba(147, 51, 234, 0.2));
  color: var(--accent-color);
  border: 1px solid rgba(79, 70, 229, 0.35);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-run-artifact:hover {
  background: var(--gemini-gradient);
  color: #ffffff;
  border-color: transparent;
  transform: translateY(-1px);
}

/* Inline Artifact Launch Banner card */
.artifact-launch-card {
  margin: 0.75rem 0;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.artifact-launch-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.artifact-launch-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.artifact-launch-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.artifact-launch-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Pillar 2: Plugins Engine & Composer Tool Pills
   ========================================================================== */
.composer-tools-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
}

.composer-tools-bar::-webkit-scrollbar {
  display: none;
}

.tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.tool-pill:hover {
  background: var(--bg-primary);
  border-color: var(--accent-color);
  color: var(--text-primary);
}

.tool-pill.active {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.18), rgba(147, 51, 234, 0.18));
  border-color: rgba(79, 70, 229, 0.45);
  color: var(--accent-color);
}

.tool-pill-status {
  font-size: 0.65rem;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-muted);
  text-transform: uppercase;
}

.tool-pill.active .tool-pill-status {
  background: var(--accent-color);
  color: #ffffff;
}

.tool-pill-manage {
  margin-left: auto;
  border-style: dashed;
}

/* Tool execution status card in assistant messages */
.tool-call-card {
  margin: 0.65rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  overflow: hidden;
  font-size: 0.82rem;
  animation: fadeIn 0.2s ease;
}

.tool-call-header {
  padding: 0.55rem 0.85rem;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.tool-call-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}

.tool-call-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.tool-call-title {
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-call-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-color, #10b981);
  white-space: nowrap;
}

.tool-call-badge.badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-color, #ef4444);
}

.tool-sources-list {
  padding: 0.55rem 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tool-source-chip {
  display: inline-flex;
  flex-direction: column;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  text-decoration: none;
  max-width: 240px;
  transition: all 0.15s ease;
}

.tool-source-chip:hover {
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

.source-chip-domain {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.source-chip-title {
  font-size: 0.78rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

/* Tool Code Execution body */
.tool-code-body {
  padding: 0.65rem 0.85rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.8rem;
  background: #0d1117;
  color: #e6edf3;
  overflow-x: auto;
}

.tool-code-logs pre {
  margin: 0.2rem 0 0 0;
  white-space: pre-wrap;
  word-break: break-all;
  color: #7ee787;
}

.tool-code-result code {
  color: #79c0ff;
  font-weight: 600;
}

.tool-code-error {
  color: #ff7b72;
}

.tool-code-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #8b949e;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

/* ==========================================================================
   Plugins Modal Styles
   ========================================================================== */
.plugins-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.plugin-card {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color 0.15s ease;
}

.plugin-card:hover {
  border-color: var(--accent-color);
}

.plugin-card-left {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.plugin-card-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.plugin-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.plugin-card-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.plugin-card-title-row strong {
  font-size: 0.92rem;
  color: var(--text-primary);
}

.plugin-card-desc {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.plugin-badge-active {
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-color, #10b981);
  font-weight: 700;
}

.plugin-badge-builtin {
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-pill);
  background: rgba(79, 70, 229, 0.15);
  color: var(--accent-color);
  font-weight: 700;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: 0.2s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: 0.2s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--gemini-gradient);
  border-color: transparent;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(18px);
  background-color: #ffffff;
}

/* ==========================================================================
   Pillar 3: Custom AI Apps & Community Catalog
   ========================================================================== */
.explore-apps-search-row {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.explore-category-pills {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.explore-category-pills::-webkit-scrollbar {
  display: none;
}

.explore-cat-pill {
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.explore-cat-pill:hover,
.explore-cat-pill.active {
  background: var(--accent-color);
  color: #ffffff;
  border-color: transparent;
}

.explore-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.2rem;
}

.explore-app-card {
  padding: 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  transition: all 0.2s ease;
}

.explore-app-card:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.explore-app-top {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.explore-app-icon {
  font-size: 1.8rem;
  line-height: 1;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
}

.explore-app-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow: hidden;
}

.explore-app-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.explore-app-category {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent-color);
}

.explore-app-desc {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.explore-app-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-color);
}

/* Guided App Form Card in Chat Welcome */
.app-guided-form-card {
  margin: 1.5rem auto 1rem auto;
  width: 100%;
  max-width: 600px;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.25s ease;
}

.guided-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.guided-form-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-color);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  background: rgba(79, 70, 229, 0.15);
}

.guided-form-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.guided-form-fields {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

.guided-field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.btn-generate-from-form {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  justify-content: center;
  padding: 0.6rem 1rem;
  font-weight: 600;
}

/* Studio Form Field Builder Row */
.app-form-field-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  margin-bottom: 0.5rem;
}

.app-form-field-row input {
  flex: 1;
}







