
:root {
  --bg-color: #000000;
  --card-bg: #121214;
  --text-primary: #ffffff;
  --text-secondary: #8e8e93;
  --text-muted: #555556;
  --danger-color: #ff3b30;
  --success-color: #30d158;
  --warning-color: #ffb300;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Roboto Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  overflow: hidden;
  height: 100%;
  height: var(--viewport-height, 100%);
  width: 100%;
  position: fixed;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: var(--viewport-height, 100%);
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  background-color: #000000;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.95);
  overflow: hidden;
}

.view-content {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  overflow-y: visible !important;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  height: 100%;
  scrollbar-width: none;
}

.view-content::-webkit-scrollbar {
  display: none;
}

.tab-view {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  scroll-snap-align: start;
  box-sizing: border-box;
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: calc(90px + env(safe-area-inset-bottom));
  background-color: transparent !important;
}

#tab-chats {
  padding-top: 0;
}

#tab-search {
  position: relative;
  padding-top: 0;
  padding-bottom: 0 !important;
  overflow: visible !important;
  background-color: transparent !important;
}

.hidden {
  display: none !important;
}

.mono-font {
  font-family: var(--font-mono);
}

.brand-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: calc(16px + env(safe-area-inset-top)) 20px 8px 20px;
  gap: 12px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  background-color: #000000;
}

.brand-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-primary);
  line-height: 38px;
}

.bottom-bar {
  position: absolute;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 20px;
  right: 20px;
  height: 62px;
  background: rgba(10, 10, 12, 0.4);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 31px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  padding: 0 10px;
}

.nav-tab {
  background: none;
  border: none;
  color: #8e8e93;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  position: relative;
  transition: color 0.3s ease;
  z-index: 1;
}

.nav-tab::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #ffffff;
  opacity: 0;
  transform: translateY(4px) scale(0.5);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.nav-tab.active::after {
  opacity: 1;
  transform: translateY(0) scale(1);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.95);
}

.nav-indicator {
  position: absolute;
  top: 11px;
  left: 0;
  width: 60px;
  height: 40px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  z-index: 0;
  pointer-events: none;
  box-shadow:
    0 4px 16px rgba(255, 255, 255, 0.04),
    inset 0 1px 2px rgba(255, 255, 255, 0.15);
}

.nav-tab ion-icon {
  font-size: 23px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s ease;
}

.nav-tab.active ion-icon {
  transform: scale(1.18);
  color: #ffffff;
}

.nav-tab .tab-icon-active {
  display: none;
}

.nav-tab .tab-icon-inactive {
  display: block;
}

.nav-tab.active .tab-icon-active {
  display: block;
}

.nav-tab.active .tab-icon-inactive {
  display: none;
}

.tab-header {
  padding: calc(24px + env(safe-area-inset-top)) 24px 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-direction: row;
  position: relative;
  background-color: #000000;
  z-index: 10;
}

.tab-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08) 15%, rgba(255, 255, 255, 0.08) 85%, transparent);
  pointer-events: none;
}

.tab-header-title-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.tab-header-title {
  font-size: 26px;
  font-weight: 700;
  font-family: var(--font-sans);
  letter-spacing: -0.5px;
  color: #ffffff;
}

.tab-header-badge {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-weight: 600;
}

.tab-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tab-header-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  opacity: 0.5;
  font-size: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-header-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.tab-header-btn.delete-all:hover {
  color: var(--danger-color);
}

.tab-header-btn.add-bot {
  color: #ffffff;
  font-size: 26px;
}

.tab-header-btn.add-bot:hover {
  transform: scale(1.15) rotate(90deg);
}

.tab-header-btn.add-bot:active {
  transform: scale(0.9) rotate(90deg);
}

.created-bots-container {
  padding: 24px 0 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background-color: var(--bg-color);
}

.section-title {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 0 24px;
  display: block;
  margin-bottom: 10px;
}

.horizontal-scroll-list {
  display: flex;
  overflow-x: auto;
  gap: 16px;
  padding: 20px 24px 12px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  cursor: grab;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.horizontal-scroll-list.active-grab {
  cursor: grabbing;
  scroll-behavior: auto;
  user-select: none;
}

.horizontal-scroll-list::-webkit-scrollbar {
  height: 5px;
}

.horizontal-scroll-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  margin: 0 24px;
}

.horizontal-scroll-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  transition: all 0.3s ease;
}

.horizontal-scroll-list:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 179, 0, 0.35);
}

.horizontal-scroll-list::-webkit-scrollbar-thumb:hover {
  background: var(--warning-color) !important;
  box-shadow: 0 0 8px rgba(255, 179, 0, 0.6) !important;
}

.created-bot-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 68px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}

.created-bot-item:active {
  transform: scale(0.88);
}

.delete-bot-btn {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(28, 28, 30, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
  font-size: 14px;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.created-bot-item:hover .delete-bot-btn {
  opacity: 0.85;
  transform: scale(1);
}

.delete-bot-btn:hover {
  background: #ff3b30 !important;
  border-color: #ff3b30 !important;
  color: #ffffff !important;
  opacity: 1 !important;
  transform: scale(1.1) !important;
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.4) !important;
}

.delete-bot-btn:active {
  transform: scale(0.9) !important;
}

.edit-bot-btn {
  position: absolute;
  top: -2px;
  left: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(28, 28, 30, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
  font-size: 11px;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.created-bot-item:hover .edit-bot-btn {
  opacity: 0.85;
  transform: scale(1);
}

.edit-bot-btn:hover {
  background: var(--warning-color) !important;
  border-color: var(--warning-color) !important;
  color: #000000 !important;
  opacity: 1 !important;
  transform: scale(1.1) !important;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4) !important;
}

.edit-bot-btn:active {
  transform: scale(0.9) !important;
}

@media (hover: none) {
  .delete-bot-btn,
  .edit-bot-btn {
    opacity: 0.7;
    transform: scale(1);
  }
}

.story-avatar-wrapper {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.story-avatar-wrapper.recent {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  animation: story-pulse 2s infinite ease-in-out;
}

@keyframes story-pulse {
  0% {
    box-shadow: 0 0 0 0px rgba(255, 255, 255, 0.12);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0px rgba(255, 255, 255, 0);
  }
}

.avatar-container {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  overflow: hidden;
  background-color: #161618;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.avatar-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.story-avatar-wrapper .avatar-container {
  width: 100%;
  height: 100%;
  background-color: #08080a;
  border: 2px solid #000000;
  border-radius: 14px;
  box-shadow: none;
}

.avatar-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.created-bot-name {
  color: var(--text-secondary);
  font-size: 11px;
  margin-top: 6px;
  text-align: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.1px;
  font-weight: 500;
}

.chats-list-container {
  padding: 16px 0;
}

.chat-row {
  display: flex;
  align-items: center;
  background: rgba(10, 10, 12, 0.65);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  margin: 0 16px 12px 16px;
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.chat-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0.12), transparent);
  pointer-events: none;
}

.chat-row:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px) scale(1.008);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.7),
    inset 0 1px 2px rgba(255, 255, 255, 0.12);
}

.chat-row:active {
  transform: scale(0.985);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.24);
}

.chat-row-avatar-wrapper {
  position: relative;
  width: 50px;
  height: 50px;
  flex-shrink: 0;
}

.chat-row-avatar-wrapper .avatar-container {
  width: 100%;
  height: 100%;
  border-radius: 14px;
}

.chat-row-avatar-wrapper .status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background-color: var(--success-color);
  border: 2px solid #000000;
  box-shadow: 0 0 10px rgba(48, 209, 88, 0.45);
  animation: status-pulse 2s infinite ease-in-out;
  z-index: 2;
}

@keyframes status-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0px rgba(48, 209, 88, 0.5);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 5px rgba(48, 209, 88, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0px rgba(48, 209, 88, 0);
  }
}

.bot-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  font-family: var(--font-sans);
}

.bot-badge.public {
  background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

.bot-badge.private {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.45);
}

.bot-badge ion-icon {
  font-size: 8px;
}

.chat-row-info {
  flex: 1;
  margin-left: 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.chat-row-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-row-last-msg {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(to right, black 82%, transparent 98%);
  mask-image: linear-gradient(to right, black 82%, transparent 98%);
}

.chat-row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  opacity: 0.4;
  margin-left: 8px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-row:hover .chat-row-actions,
.chat-row:active .chat-row-actions {
  opacity: 1;
}

.delete-row-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border-radius: 10px;
  font-size: 16px;
  padding: 6px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-row-btn:hover,
.delete-row-btn:active {
  background: rgba(255, 59, 48, 0.15);
  border-color: rgba(255, 59, 48, 0.25);
  color: #ff453a;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.15);
}

.list-empty-text {
  color: var(--text-muted);
  text-align: center;
  margin-top: 50px;
  font-size: 14px;
  padding: 0 20px;
}

.overlay-view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  z-index: 150;
  height: 100%;
  height: var(--viewport-height, 100%);
  width: 100%;
}

.chat-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  margin: calc(12px + env(safe-area-inset-top)) 16px 8px 16px;
  background: rgba(28, 28, 30, 0.75);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.header-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.chat-bot-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.chat-bot-info .avatar-container {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
  background-color: #111;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  flex-shrink: 0;
}

.chat-bot-info:hover .avatar-container {
  transform: scale(1.06) rotate(2deg);
}

.bot-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messages-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: calc(12px + env(safe-area-inset-top) + 56px + 16px);
  padding-bottom: calc(12px + env(safe-area-inset-bottom) + 54px + 16px);
  padding-left: 16px;
  padding-right: 16px;
  z-index: 1;
}

.load-more-messages-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 12px 0 4px 0;
  font-size: 13px;
  color: var(--text-secondary);
  opacity: 0.8;
  animation: fadeIn 0.3s ease;
}

.load-more-messages-banner span {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  font-weight: 500;
  letter-spacing: 0.2px;
}

.message-bubble-container {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  position: relative;
}

.message-bubble-container.user {
  align-self: flex-end;
  align-items: flex-end;
}

.message-bubble-container.bot {
  align-self: flex-start;
  align-items: flex-start;
}

.message-bubble {
  width: 100%;
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.45;
  word-wrap: break-word;
}

.message-bubble p {
  margin-bottom: 6px;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble.user {
  background: linear-gradient(135deg, #4f46e5, #3b0764);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
}

.message-bubble.bot {
  background-color: #121214;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 20px;
  border-bottom-left-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.message-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  padding: 3px 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  background: rgba(28, 28, 30, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  width: fit-content;
}

.message-bubble-container:hover .message-actions,
.message-bubble-container.active .message-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, transform 0.15s ease;
  border-radius: 8px;
}

.action-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  transform: scale(1.08);
}

.action-btn.delete-btn:hover {
  color: var(--danger-color);
}

.action-btn.reroll-btn:hover {
  color: var(--success-color);
}

.inline-edit-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 220px;
}

.inline-edit-textarea {
  background-color: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #fff;
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--font-sans);
  line-height: 1.4;
  resize: vertical;
  width: 100%;
  min-height: 70px;
  outline: none;
}

.inline-edit-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.inline-btn {
  border: none;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.inline-btn:hover {
  opacity: 0.9;
}

.inline-btn.save-btn {
  background-color: #fff;
  color: #000;
}

.inline-btn.cancel-btn {
  background-color: var(--card-bg);
  color: var(--text-secondary);
}

.message-bubble.bot em {
  font-style: italic;
  color: #aaaaaa;
}

.message-bubble.bot strong {
  font-weight: 700;
}

.message-bubble.bot code {
  font-family: var(--font-mono);
  background-color: rgba(0,0,0,0.5);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 13px;
  color: #00ff00;
}

.message-bubble.bot pre {
  background-color: #000000;
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
}

.message-bubble.bot pre code {
  background: none;
  padding: 0;
  color: #00ff00;
}

.spinner-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  height: 20px;
  padding: 0 4px;
}

.spinner-dots span {
  width: 8px;
  height: 8px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  animation: dot-flash 1.4s infinite linear;
}

.spinner-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.spinner-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dot-flash {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

.input-area {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-top: none;
  padding: 8px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: transparent;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.input-area-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(28, 28, 30, 0.75);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 26px;
  padding: 6px 8px 6px 18px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.input-area-pill:focus-within {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 32px rgba(255, 255, 255, 0.08);
}

.input-area-pill textarea {
  flex: 1;
  min-width: 0;
  background: none !important;
  border: none !important;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  padding: 8px 0;
  resize: none;
  outline: none;
  max-height: 120px;
}

.send-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.send-button.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

.send-button.active:active {
  transform: scale(0.92);
}

.platform-selector {
  display: flex;
  background-color: var(--card-bg);
  border-radius: 20px;
  padding: 4px;
  margin: 0 15px 15px 15px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.platform-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.platform-tab ion-icon {
  font-size: 16px;
  transition: color 0.25s ease;
}

.platform-tab.active {
  background-color: var(--bg-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  color: #ffffff;
}

.platform-tab.active[id="platform-chai-btn"] ion-icon {
  color: var(--warning-color);
}

.platform-tab.active[id="platform-cai-btn"] ion-icon {
  color: #00e5ff;
}

/* === WRAPPER: позиционирование + анимированное кольцо === */
.search-ring-wrapper {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  left: 20px;
  right: 78px;
  height: 48px;
  border-radius: 26px;
  z-index: 10;
}

/* Вращающееся световое кольцо вокруг поисковика */
.search-ring-wrapper::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 28px;
  padding: 2px;
  background: conic-gradient(
    from var(--search-angle, 0deg),
    transparent 0%,
    transparent 35%,
    rgba(255, 255, 255, 0.0) 42%,
    rgba(255, 255, 255, 0.9) 50%,
    rgba(255, 255, 255, 0.5) 56%,
    rgba(255, 255, 255, 0.0) 63%,
    transparent 70%,
    transparent 100%
  );
  /* Маска: показываем только кольцо (не заливку внутри) */
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
  z-index: 11;
  animation: none;
}

/* Состояние фокуса — показать кольцо */
.search-ring-wrapper:has(input:focus)::before,
.search-ring-wrapper:focus-within::before {
  opacity: 1;
  animation: spin-search-ring 2.8s linear infinite;
}

/* Сам поисковик — blur + blur */
.search-bar-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  background: rgba(10, 10, 12, 0.4);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-radius: 26px;
  padding: 0 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
  z-index: 10;
}

.search-bar-container:focus-within {
  border-color: transparent;
  box-shadow: 0 8px 32px rgba(255, 255, 255, 0.09);
}

@property --search-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes spin-search-ring {
  to {
    --search-angle: 360deg;
  }
}

.search-icon {
  font-size: 20px;
  color: var(--text-muted);
}

.search-bar-container input {
  flex: 1;
  min-width: 0;
  background: none !important;
  border: none !important;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  padding: 0 10px;
  outline: none;
}

.clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

#tab-search {
  display: flex;
  flex-direction: column;
  flex: 0 0 100%;
  width: 100%;
  overflow: visible !important;
  background: transparent !important;
  background-color: transparent !important;
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  padding: calc(16px + env(safe-area-inset-top) + 48px + 16px) 15px calc(env(safe-area-inset-bottom) + 94px) 15px;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
  background: transparent !important;
  background-color: transparent !important;
}

#search-loading {
  margin-top: calc(16px + env(safe-area-inset-top) + 48px + 40px);
}

.bot-card {
  height: 200px;
  border-radius: 18px;
  overflow: hidden;
  background-color: #121214;
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-color: #0c0c0e;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 68px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.5) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 12px;
}

.card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.1px;
  width: 100%;
}

.card-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

.card-stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(10, 10, 12, 0.45);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 8px;
  border-radius: 9999px;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  letter-spacing: -0.1px;
}

.card-stat-item ion-icon {
  font-size: 11px;
  color: #ffffff;
}

.bot-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
}

.bot-card:hover .card-image {
  transform: scale(1.06);
}



.bot-card:active {
  transform: translateY(-2px) scale(0.98);
  border-color: rgba(255, 255, 255, 0.2);
}

.tab-center-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(90px + env(safe-area-inset-bottom)) 20px;
  min-height: 70vh;
  position: relative;
  z-index: 1;
}

.tab-scroll-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(90px + env(safe-area-inset-bottom)) 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.premium-card.glass-module {
  background: rgba(18, 18, 20, 0.45);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 30px 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.premium-card.glass-module::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0.06), transparent);
  pointer-events: none;
}

.glass-icon-wrapper {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.premium-card.glass-module:hover .glass-icon-wrapper {
  transform: scale(1.05) translateY(-2px);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 20px rgba(255, 255, 255, 0.02);
}

.center-icon-header {
  text-align: center;
  margin-bottom: 24px;
  width: 100%;
}

.large-header-icon {
  font-size: 32px;
  color: var(--text-primary);
  display: block;
}

.section-heading {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.section-description {
  font-size: 14px;
  color: var(--text-secondary);
}

.link-input-container {
  display: flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  width: 100%;
  margin-bottom: 20px;
  padding: 0 16px;
  height: 48px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.link-input-container:focus-within {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.03);
}

.input-icon {
  font-size: 20px;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.link-input-container:focus-within .input-icon {
  color: #ffffff;
}

.link-input-container input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14.5px;
  padding: 0 12px;
  outline: none;
}

.status-panel {
  width: 100%;
  margin-bottom: 12px;
}

.panel-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.metrics-card {
  background-color: var(--card-bg);
  border-radius: 16px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-label {
  color: var(--text-secondary);
  font-size: 13px;
}

.metric-val {
  color: var(--text-primary);
  font-size: 13px;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-btn {
  background-color: var(--text-primary);
  color: var(--bg-color);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 15px;
  border: none;
  border-radius: 20px;
  height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.primary-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.12);
}

.primary-btn:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.secondary-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  border-radius: 20px;
  height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.secondary-btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-primary);
  transform: scale(1.02);
  background-color: rgba(255, 255, 255, 0.02);
}

.secondary-btn:active {
  transform: scale(0.96);
  border-color: rgba(255, 255, 255, 0.35);
  background-color: rgba(255, 255, 255, 0.05);
}

.spinner-container {
  display: flex;
  justify-content: center;
  margin-top: 50px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

.btn-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0,0,0,0.1);
  border-top-color: #000000;
  border-radius: 50%;
  animation: spin 0.8s infinite linear;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.centered {
  align-items: center;
}

.modal-content {
  background-color: rgba(10, 10, 12, 0.8);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
  max-height: 85%;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 45px rgba(0, 0, 0, 0.95);
  animation: slide-up 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
}
.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), transparent);
  pointer-events: none;
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

.modal-overlay.centered .modal-content {
  border-radius: 24px;
  max-width: 345px;
  width: 92%;
  padding: 0;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
  animation: zoom-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes zoom-in {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  height: 55px;
  border-bottom: 1px solid var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.private-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(255, 179, 0, 0.05);
  border: 1px solid rgba(255, 179, 0, 0.2);
  border-radius: 20px;
  padding: 6px 14px;
  align-self: flex-start;
  color: var(--warning-color);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(255, 179, 0, 0.05);
}

.avatar-upload-zone {
  border: 1.5px dashed rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.02);
}

.avatar-upload-zone:hover,
.avatar-upload-zone.drag-over {
  border-color: var(--warning-color);
  background-color: rgba(255, 179, 0, 0.03);
  box-shadow: 0 8px 24px rgba(255, 179, 0, 0.03);
}

.avatar-upload-zone.has-image {
  border-style: solid;
  border-color: #333;
  cursor: default;
}

.avatar-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
}

.avatar-preview-wrapper {
  width: 100%;
  height: 110px;
  position: relative;
}

.avatar-preview-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

.avatar-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.7);
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 50%;
  padding: 2px;
  transition: color 0.15s ease;
}

.avatar-remove-btn:hover {
  color: var(--danger-color);
}

.avatar-upload-zone.is-default-avatar {
  border-style: dashed !important;
  border-color: #333 !important;
  cursor: pointer !important;
}

.avatar-upload-zone.is-default-avatar:hover {
  border-color: var(--text-secondary) !important;
  background-color: #1a1a1a !important;
}

.avatar-upload-zone.is-default-avatar .avatar-remove-btn {
  display: none !important;
}

.avatar-upload-zone.is-default-avatar .avatar-preview-wrapper::after {
  content: 'CLICK TO UPLOAD PHOTO';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.avatar-upload-zone.is-default-avatar:hover .avatar-preview-wrapper::after {
  opacity: 1;
}

.avatar-uploading {
  border-color: var(--warning-color) !important;
  animation: pulse-border 1s infinite ease-in-out;
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--warning-color); }
  50% { border-color: #7a5700; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.form-group input, .form-group textarea {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14.5px;
  padding: 12px 16px;
  outline: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.form-group input:focus, .form-group textarea:focus {
  border-color: rgba(255, 255, 255, 0.25);
  background-color: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.03);
}

.form-group textarea {
  resize: none;
}

.toast-notification {
  position: fixed;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: #1c1c1e;
  border: 1px solid #2c2c2e;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  text-align: center;
  white-space: normal;
  width: calc(100% - 40px);
  max-width: 400px;
  line-height: 1.4;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-notification.success {
  border-color: var(--success-color);
}

.toast-notification.error {
  border-color: var(--danger-color);
}

.edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(28, 28, 30, 0.95);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--warning-color);
  animation: banner-slide-up 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  width: calc(100% - 32px);
  margin: 0 auto -1px auto;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
}

.edit-banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.edit-banner-icon {
  font-size: 16px;
}

.cancel-edit-button {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color 0.15s ease;
  padding: 0;
}

.cancel-edit-button:hover {
  color: var(--danger-color);
}

@keyframes banner-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-label {
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.05);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #888888;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #ffffff;
  border-color: #ffffff;
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #000000;
}

.exp-locked-row {
  opacity: 0.6;
  cursor: not-allowed;
}

.exp-in-progress-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ff9800;
  background: rgba(255, 152, 0, 0.12);
  border: 1px solid rgba(255, 152, 0, 0.3);
  border-radius: 6px;
  padding: 2px 6px;
  white-space: nowrap;
}

.telegram-promo-card {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(37, 99, 235, 0.2));
  border: 1.5px solid rgba(124, 58, 237, 0.3);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 25px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.1);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.telegram-promo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(124, 58, 237, 0.2);
  border-color: rgba(124, 58, 237, 0.5);
}

.telegram-promo-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 60%);
  pointer-events: none;
}

.telegram-promo-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.telegram-promo-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: rgba(37, 99, 235, 0.15);
  border-radius: 12px;
  color: #3b82f6;
  font-size: 24px;
  border: 1px solid rgba(37, 99, 235, 0.3);
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.15);
  transition: transform 0.3s ease;
}

.telegram-promo-card:hover .telegram-promo-icon-wrapper {
  transform: scale(1.1) rotate(5deg);
  color: #ffffff;
  background: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
}

.telegram-promo-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.telegram-promo-desc {
  font-size: 13.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.75);
}

.telegram-promo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.telegram-promo-btn:hover {
  background: #3b82f6;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.telegram-promo-btn:active {
  transform: translateY(1px);
}

.telegram-header-btn {
  position: absolute;
  right: 26px;
  top: calc(22px + env(safe-area-inset-top));
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 50%;
  color: #3b82f6;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.15);
  text-decoration: none;
}

.telegram-header-btn:hover {
  background: #2563eb;
  color: #ffffff;
  transform: scale(1.1) rotate(-10deg);
  border-color: #2563eb;
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.5);
}

.telegram-header-btn:active {
  transform: scale(0.95);
}

.message-bubble.bot.typing::after {
  content: '\25cf';
  display: inline-block;
  color: var(--warning-color);
  animation: typewriter-blink 0.8s infinite;
  margin-left: 2px;
  font-size: 14px;
  vertical-align: middle;
}

@keyframes typewriter-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.confirm-dialog-notification {
  position: fixed;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: rgba(28, 28, 30, 0.9);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
  padding: 14px 18px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: calc(100% - 40px);
  max-width: 360px;
}

.confirm-dialog-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.confirm-dialog-text {
  text-align: center;
  line-height: 1.4;
  color: var(--text-primary);
}

.confirm-dialog-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
}

.confirm-btn {
  flex: 1;
  border: none;
  border-radius: 14px;
  height: 38px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.confirm-btn.yes {
  background: linear-gradient(135deg, var(--warning-color), #ff9800);
  color: #000000;
  box-shadow: 0 4px 12px rgba(255, 179, 0, 0.2);
}

.confirm-btn.yes:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.confirm-btn.no {
  background-color: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.confirm-btn.no:active {
  transform: scale(0.96);
  background-color: rgba(255, 255, 255, 0.05);
}

.settings-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 16px;
}

.settings-toggle-row:last-child {
  border-bottom: none;
}

.toggle-info-col {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.toggle-label-text {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-desc-text {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-top: 3px;
}

.badge-experimental {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--warning-color);
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.25);
  border-radius: 4px;
  padding: 1px 4px;
  text-transform: uppercase;
}

.settings-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border-radius: 14px;
  height: 46px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  outline: none;
}

.settings-action-btn ion-icon {
  font-size: 20px;
}

.settings-action-btn:hover,
.settings-action-btn:active {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.settings-action-btn.danger {
  background: rgba(255, 59, 48, 0.08);
  border-color: rgba(255, 59, 48, 0.15);
  color: #ff453a;
}

.settings-action-btn.danger:hover,
.settings-action-btn.danger:active {
  background: rgba(255, 59, 48, 0.15);
  border-color: rgba(255, 59, 48, 0.25);
  color: #ff453a;
  box-shadow: 0 4px 15px rgba(255, 59, 48, 0.05);
}

.telegram-promo-card-compact {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(124, 58, 237, 0.08));
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 10px;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.05);
  transition: all 0.25s ease;
}

.telegram-promo-card-compact:hover {
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.1);
}

.tg-mini-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 8px;
  flex-shrink: 0;
}

.tg-mini-btn {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.tg-mini-btn:hover {
  background: #3b82f6;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.tg-mini-btn:active {
  transform: translateY(0.5px);
}

.draggable-panel {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, border-color 0.2s ease;
  user-select: none;
  -webkit-user-drag: element;
}

.draggable-panel.dragging {
  opacity: 0.35;
  transform: scale(0.97);
  border: 1px dashed rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.drag-handle {
  cursor: grab;
  padding: 4px;
  border-radius: 6px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.drag-handle:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff !important;
}

.drag-handle:active {
  cursor: grabbing;
}

/* Premium Select styles */
.premium-select {
  background-color: var(--bg-color);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #ffffff;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 140px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 18px;
  padding-right: 28px;
}

.premium-select:focus, .premium-select:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.03);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.02);
}

.premium-select option {
  background-color: #0c0c0e;
  color: #ffffff;
}

.chat-continue-row {
  display: flex;
  justify-content: center;
  margin: 12px 0;
  width: 100%;
}

.chat-continue-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chat-continue-pill ion-icon {
  font-size: 14px;
}

.chat-continue-pill:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.03);
}

.chat-continue-pill:active {
  transform: scale(0.97);
}



/* Keyframes for navigation tab flash / glow */
@keyframes tab-flash {
  0% {
    color: #ffffff;
    transform: scale(1);
    filter: drop-shadow(0 0 0px rgba(255, 255, 255, 0));
  }
  30% {
    color: #ffffff;
    transform: scale(1.32);
    filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.95));
  }
  100% {
    transform: scale(1.18);
  }
}

.nav-tab.clicked-flash ion-icon {
  animation: tab-flash 0.42s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

/* Performance Mode: disable backdrop filters and make panels more opaque for budget devices */
body.no-blur * {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.no-blur .bottom-bar,
body.no-blur .search-bar-container {
  background: rgba(10, 10, 12, 0.95) !important;
}

body.no-blur .chat-header,
body.no-blur .input-area-pill {
  background: rgba(28, 28, 30, 0.96) !important;
}

body.no-blur .premium-card.glass-module {
  background: rgba(18, 18, 20, 0.96) !important;
}

body.no-blur .modal-overlay {
  background-color: rgba(0, 0, 0, 0.85) !important;
}

body.no-blur .modal-content {
  background-color: rgba(10, 10, 12, 0.98) !important;
}

body.no-blur .confirm-dialog-notification {
  background: rgba(28, 28, 30, 0.98) !important;
}

body.no-blur .chat-row {
  background: rgba(18, 18, 20, 0.96) !important;
}

body.no-blur .nav-indicator {
  background: rgba(255, 255, 255, 0.15) !important;
}

body.no-blur .chat-continue-pill {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* Ultra Light Mode overrides */
body.light-mode .view-content {
  display: block !important;
  overflow-x: hidden !important;
  scroll-snap-type: none !important;
}

body.light-mode .tab-view {
  display: none !important;
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
}

body.light-mode .tab-view.active {
  display: block !important;
}

body.light-mode #tab-settings.active,
body.light-mode #tab-search.active,
body.light-mode #tab-link.active {
  display: flex !important;
}

body.light-mode * {
  transition: none !important;
  transition-duration: 0s !important;
}

/* Floating FPS Monitor */
.fps-badge {
  position: absolute;
  top: calc(76px + env(safe-area-inset-top));
  right: 20px;
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #30d158; /* Green by default */
  font-weight: bold;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 6px;
}

.fps-badge.warning {
  color: #ffb300; /* Yellow */
}

.fps-badge.danger {
  color: #ff3b30; /* Red */
}

.fps-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 8px currentColor;
}

#tab-link {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
}

#tab-link .tab-center-content {
  width: 100%;
  height: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.floating-particles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.floating-particle {
  position: absolute;
  top: -40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 70%);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
  animation: fallDown linear infinite;
  pointer-events: none;
}

@keyframes fallDown {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: var(--particle-opacity, 0.75);
  }
  90% {
    opacity: var(--particle-opacity, 0.75);
  }
  100% {
    transform: translateY(115vh) translateX(40px);
    opacity: 0;
  }
}

body.no-blur.light-mode .floating-particles-container {
  display: none !important;
}



/* Tablet vertical media queries (only for tablets, PCs and laptops remain in 500px phone view) */
@media (min-width: 768px) and (max-width: 1024px) {
  body {
    background: #000000 !important;
    display: block !important;
    height: 100% !important;
    padding: 0 !important;
  }

  .app-container {
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
    height: var(--viewport-height, 100%) !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
  }
}

#tab-settings {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-y: hidden !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.storage-indicator-text-fixed {
  position: absolute;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  opacity: 0.7;
  pointer-events: none;
  z-index: 95;
}

/* Search Filters Bar */
.search-filters-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 4px 0;
  scrollbar-width: none; /* Firefox */
  -webkit-overflow-scrolling: touch;
  width: calc(100% + 58px);
  box-sizing: border-box;
}

.search-filters-bar::-webkit-scrollbar {
  display: none; /* Safari/Chrome */
}

.filter-chip {
  background: rgba(10, 10, 12, 0.4);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.filter-chip:active {
  transform: scale(0.95);
}

.filter-chip.active {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.6);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.08);
}

body.no-blur .filter-chip {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: #161618;
}



