.history-search {
  display: flex;
  align-items: center;
  background: rgba(25, 27, 35, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
  gap: 16px;
}

.history-search input {
  width: 100%;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 14px;
  font-weight: 400;
  outline: none;
  padding: 0;
  border-radius: 0;
}

.history-search input::placeholder {
  color: #ffffff;
  font-size: 14px;
  font-weight: 400;
}

.search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-icon svg {
  width: 24px;
  height: 24px;
  stroke: #ffffff;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  margin: 16px 0 12px;
  padding: 4px;
  position: relative;
}

.history-tabs .active-indicator {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(50% - 4px);
  margin: 4px;
  background: #ffffff;
  border-radius: 6px;
  transition: transform 0.2s ease;
  z-index: 0;
}

.history-tabs.workspace-active .active-indicator {
  transform: translateX(100%);
}

.history-tabs .tab {
  padding: 10px 0;
  background: transparent;
  color: #ffffff;
  letter-spacing: -0.08px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
  border: none;
  cursor: pointer;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

.history-tabs .tab.active {
  color: #0b0b0b;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-group {
  display: flex;
  flex-direction: column;
}

.history-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 0 4px;
  border-bottom: 1px solid #434550;
}

.history-group-text {
  font-size: 12px;
  font-weight: 300;
  line-height: 22px;
  color: #b6b6b6;
}

.history-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
}

.history-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.workspace-row {
  align-items: flex-start;
  padding: 16px 0;
  gap: 12px;
}

.workspace-row .history-info {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
}

.workspace-logos {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-logo {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.workspace-logo-badge {
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
  min-width: 20px;
  max-width: 24px;
}

.workspace-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
  color: #fff;
}

.workspace-row .dot-menu svg circle {
  fill: #626368;
}

.dot-menu {
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.dot-menu svg {
  width: 4px;
  height: 16px;
  fill: #7d808d;
}

.history-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-icon svg {
  width: 24px;
  height: 24px;
}

.history-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
  color: #ffffff;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.star {
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.star svg {
  width: 24px;
  height: 24px;
}

.star svg path {
  transition: fill 0.2s ease, stroke 0.2s ease;
}

.history-empty {
  padding: 32px 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
}
.history-menu {
  position: absolute;
  top: 46px;
  left: 0;
  background: #262832;
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  min-width: 120px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  animation: menuFade 0.18s ease forwards;
  z-index: 10;
}

.menu-option {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 12px;
  font-weight: 400;
  padding: 6px 16px;
  cursor: pointer;
  text-align: center;
}

.menu-option + .menu-option {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.menu-option:hover {
  opacity: 0.85;
}

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

.history-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 10, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  transform: translateY(8px) scale(0.98);
}

.history-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.modal-card {
  background: #262832;
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  padding: 24px 24px 16px;
  text-align: center;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 16px;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.history-modal.open .modal-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.modal-question {
  margin: 0;
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
}

.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  font-size: 15px;
  font-weight: 500;
  outline: none;
}

.modal-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.modal-btn {
  border: none;
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.modal-btn.primary {
  background: #434550;
  color: #ffffff;
}

.modal-btn.danger {
  background: #b23b3b;
  color: #ffffff;
}

.modal-btn.secondary {
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
}

.modal-btn:hover:not(:disabled) {
  transform: scale(0.99);
  opacity: 0.95;
}

.modal-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.start-chat-card {
  position: fixed;
  left: 50%;
  bottom: calc(104px + env(safe-area-inset-bottom)); /* add 16px gap above footer bar */
  max-width: 560px;
  width: 94%;
  margin: 0;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  transform: translateX(-50%) scale(1);
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease, opacity 0.15s ease;
  z-index: 9;
}

.start-chat-card:hover {
  background: rgba(255, 255, 255, 0.09);
  transform: translateX(-50%) scale(0.99);
  opacity: 0.95;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
}

.start-chat-card:active {
  transform: translateX(-50%) scale(0.97);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

.start-chat-icon svg {
  width: 24px;
  height: 24px;
  stroke: #ffffff;
}

.start-chat-text {
  font-size: 16px;
  font-weight: 600;
}

/* Chat page layout */
.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 6px;
  background: #11131a;
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0;
}

.chat-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.chat-back svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.chat-title {
  color: #fff;
  font-weight: 600;
  font-size: 16px;
}

.chat-header-balance {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.chat-balance-value {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  min-width: 40px;
  text-align: right;
}

.chat-balance-add {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0;
  min-width: 24px;
  min-height: 24px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.chat-balance-add:hover {
  background: rgba(255, 255, 255, 0.15);
}

.chat-balance-add svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.chat-hero {
  position: sticky;
  top: 40px;
  overflow: visible;
}

.chat-head-wrap {
  margin: 0 -16px;
  padding: 0 16px 16px;
  position: fixed;
  width: 100vw;
  max-width: 560px;
  z-index: 10;
  background: #191b23;
  top: 0;
}

#chat.settings-open .chat-head-wrap {
  padding-bottom: 0;
}

.chat-hero .chat-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.chat-model-name {
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}

.chat-menu {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  gap: 4px;
  cursor: pointer;
}

.chat-menu span {
  display: block;
  width: 16px;
  height: 2px;
  background: #fff;
}

.chat-open-bar {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  z-index: 1;
  align-items: flex-end;
}

.chat-open-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.chat-open-add {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: none;
  background: #262835;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 6px;
}

.chat-open-add svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.chat-open-more {
  border-radius: 6px;
  border: none;
  background: #262835;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  cursor: pointer;
  justify-content: flex-start;
  transition: gap 0.25s ease;
}

.chat-open-more-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  transition: transform 0.25s ease;
}

.chat-open-bar.stack-open .chat-open-more-icon {
  transform: rotate(180deg);
}

.chat-open-more-icon svg {
  stroke: currentColor;
}

.chat-open-toggle-text {
  font-size: 12px;
  color: #b6b6b6;
  white-space: nowrap;
  overflow: hidden;
  max-width: 140px;
  transition: opacity 0.25s ease, transform 0.25s ease, max-width 0.25s ease;
}

.chat-open-bar.stack-open .chat-open-toggle-text {
  opacity: 0;
  transform: translateX(-6px);
  max-width: 0;
}

.chat-open-bar.stack-open .chat-open-more {
  gap: 0;
}

.chat-opened-item {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  gap: 2px;
  align-items: center;
  padding: 8px;
  padding-left: 2px;
  background: #262832;
  border-radius: 10px;
  color: #fff;
  border: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.chat-opened-item.menu-open {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
}

.chat-opened-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.chat-opened-handle {
  display: inline-flex;
  width: 12px;
  height: 12px;
  padding: 0;
  cursor: grab;
}

.chat-opened-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
}

.chat-opened-icon svg {
  width: 24px;
  height: 24px;
}

.chat-opened-title {
  font-size: 12px;
  line-height: 20px;
}

.chat-opened-close {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-opened-stack {
  height: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}

.chat-opened-stack.open {
  pointer-events: auto;
  margin-bottom: 8px;
}


.chat-opened-stack.open .chat-opened-item {
  opacity: 1;
  transform: translateY(0);
}

.chat-opened-menu-btn {
  border: none;
  background: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chat-opened-menu {
  position: absolute;
  background: #262832;
  border-radius: 8px;
  padding: 6px 8px;
  flex-direction: column;
  min-width: 120px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  animation: menuFade 0.18s ease forwards;
  z-index: 20;
}

.chat-opened-menu button {
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 12px;
  font-weight: 400;
  padding: 6px 16px;
  cursor: pointer;
  text-align: center;
}

.chat-opened-menu button + button {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-opened-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 10, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  transform: translateY(8px) scale(0.98);
}

.chat-opened-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.chat-opened-modal .modal-card {
  background: #262832;
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  padding: 24px 24px 16px;
  text-align: center;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 16px;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.chat-opened-modal.open .modal-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.chat-opened-modal .modal-question {
  margin: 0;
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
}

.chat-opened-modal .modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.chat-opened-modal .modal-btn {
  border: none;
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  width: 100%;
}

.chat-opened-modal .modal-btn.danger {
  background: #b23b3b;
  color: #ffffff;
}

.chat-opened-modal .modal-btn.secondary {
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
}

.chat-opened-modal .modal-btn:hover:not(:disabled) {
  transform: scale(0.99);
  opacity: 0.95;
}

.chat-opened-modal .modal-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.chat-opened-modal .modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-opened-add-modal {
  position: fixed;
  inset: 0;
  display: block;
  padding: 0;
  background: transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 45;
}

.chat-opened-add-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.chat-opened-add-card {
  width: min(100%, 318px);
  padding: 16px 21px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  backdrop-filter: blur(15px);
  position: absolute;
  text-align: center;
  isolation: isolate;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-opened-add-modal.open .chat-opened-add-card {
  opacity: 1;
  transform: translateY(0);
}

.chat-opened-add-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: none;
  padding: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  cursor: pointer;
}

.chat-opened-add-close svg {
  width: 14px;
  height: 14px;
  stroke: #7d808d;
  stroke-width: 1.5;
  fill: none;
}

.chat-opened-add-title,
.chat-opened-add-subtitle {
  font-size: 16px;
  line-height: 20px;
  color: #ffffff;
  margin: 0;
}

.chat-opened-add-start {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.15s ease;
}

.chat-opened-add-start-icon svg {
  width: 18px;
  height: 18px;
}

.chat-opened-add-start:hover {
  transform: scale(0.99);
  opacity: 0.95;
  background: rgba(255, 255, 255, 0.16);
}

.chat-opened-add-start:active {
  transform: scale(0.97);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25);
}

.chat-opened-add-start-text {
  font-size: 12px;
  line-height: 15px;
  font-weight: 600;
}

.chat-opened-add-search {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(25, 27, 35, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-opened-add-search-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}

.chat-opened-add-search-icon svg {
  width: 19px;
  height: 19px;
  stroke: #ffffff;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-opened-add-search-input {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 0;
  color: #ffffff;
  font-size: 12px;
  line-height: 15px;
  outline: none;
  padding: 0;
}

.chat-opened-add-search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.chat-opened-add-list {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 224px;
  overflow-y: auto;
}

.chat-opened-add-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  color: inherit;
  cursor: pointer;
  width: 100%;
  text-align: left;
}


.chat-opened-add-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.chat-opened-add-item-title {
  font-size: 12px;
  line-height: 20px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-opened-add-star {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.chat-opened-add-star svg {
  width: 18px;
  height: 18px;
}

.chat-opened-add-empty {
  font-size: 12px;
  line-height: 15px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: 16px 0;
}

.chat-body.settings-open .chat-opened-add-modal:not(.model-modal) {
  display: none;
}

.chat-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 110px;
  height: auto;
}

.chat-body.hello-active {
  height: 60vh;
}

.chat-body.has-messages {
  height: auto;
}

.messages-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.message {
  max-width: 100%;
  font-size: 14px;
  line-height: 20px;
  color: #fff;
  position: relative;
}

.message-user {
  align-self: flex-end;
  width: auto;
  max-width: 80%;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(15, 59, 142, 0.5) 0%, rgba(4, 17, 40, 0.5) 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px 12px 0 12px;
}

.message-user .message-content {
  flex: 1;
}

.message-other {
  align-self: flex-start;
  width: 100%;
  max-width: 100%;
  background: none;
  border: none;
  padding: 12px 8px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: flex-start;
  gap: 16px;
}

.message-logo {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}

.message-logo svg {
  width: 24px;
  height: 24px;
}

.message-content {
  color: #fff;
  font-size: 14px;
  line-height: 20px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-content > * {
  margin-top: 0;
  margin-bottom: 0;
}

.message-other .message-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.message-content p {
  margin: 0;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
  margin: 0;
  font-weight: 600;
  line-height: 1.3;
}

.message-content h1 {
  font-size: 18px;
}

.message-content h2 {
  font-size: 17px;
}

.message-content h3 {
  font-size: 16px;
}

.message-content h4,
.message-content h5,
.message-content h6 {
  font-size: 15px;
}

.message-content ul,
.message-content ol {
  margin: 0 0 0 18px;
  padding: 0;
}

.message-content li {
  margin: 2px 0;
}

.message-content a {
  color: #7dd3fc;
  text-decoration: underline;
}

.message-content strong {
  font-weight: 600;
}

.message-content em {
  font-style: italic;
}

.message-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 4px;
  border-radius: 4px;
}

.message-content pre {
  margin: 0;
  overflow-x: auto;
}

.message-content blockquote {
  margin: 0;
  padding: 6px 10px;
  border-left: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
}

.message-content hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 0;
}

.message-content .md-table {
  margin: 0;
  max-width: 100%;
  overflow-x: auto;
}

.message-content table {
  width: 100%;
  border-collapse: collapse;
}

.message-content img {
  display: block;
  max-width: 100%;
  height: auto;
}

.message-content th,
.message-content td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 8px;
  font-size: 13px;
  line-height: 18px;
  color: #ffffff;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.message-content th {
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
}

.code-block {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  max-width: 100%;
  width: fit-content;
  overflow-x: auto;
}

.message-other .code-block {
  width: 100%;
  max-width: 100%;
}

.code-block code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: block;
  white-space: pre;
}

.message-share {
  width: 26px;
  height: 26px;
  margin-top: -5px;
  border: none;
  background: none;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.message-share.hidden {
  opacity: 0;
  pointer-events: none;
}

.message-share:active {
  transform: scale(0.94);
}
.message-share svg {
  width: 16px;
  height: 16px;
}

#chat.image-mode .image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 358px;
}

#chat.image-mode .image-tile {
  border: none;
  background: #262832;
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  aspect-ratio: 167 / 200;
}

#chat.image-mode .image-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.message-image .message-content {
  width: 100%;
  max-width: 360px;
}

.message-edit {
  width: 16px;
  height: 16px;
  border: none;
  background: none;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.message-edit-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 12, 18, 0.55);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 60;
}

.message-edit-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.message-edit-card {
  width: min(360px, calc(100% - 32px));
  max-height: 360px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  backdrop-filter: blur(15px);
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.message-edit-modal.open .message-edit-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.message-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.message-edit-title {
  margin: 0;
  font-size: 16px;
  line-height: 20px;
  color: #ffffff;
}

.message-edit-close {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #7d808d;
}

.message-edit-close svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
}

.message-edit-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.message-edit-attachments {
  display: none;
  flex-direction: column;
  gap: 8px;
  max-height: 120px;
  overflow-y: auto;
}

.message-edit-attachments.has-items {
  display: flex;
}

.message-edit-modal .message-edit-input {
  width: 100%;
  min-height: 90px;
  max-height: 240px;
  height: auto;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  color: #ffffff;
  font-size: 14px;
  line-height: 20px;
  resize: none;
  overflow-y: auto;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 12, 18, 0.7);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 70;
}

.image-preview-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.image-preview-card {
  position: relative;
  width: min(350px, 100%);
  background: #262832;
  border-radius: 16px;
  padding: 24px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 6px 10px 4px rgba(0, 0, 0, 0.15), 0 2px 3px rgba(0, 0, 0, 0.3);
}

.image-preview-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #7d808d;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.image-preview-main img {
  width: 100%;
  height: 304px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.image-preview-thumbs {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 0 16px;
}

.image-preview-thumbs.is-empty {
  display: none;
}

.image-preview-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  padding: 0;
  cursor: pointer;
  opacity: 0.7;
}

.image-preview-thumb.active {
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.35);
}

.image-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-preview-actions {
  display: flex;
  gap: 4px;
}

.image-preview-action {
  flex: 1;
  height: 49px;
  background: #434550;
  border-radius: 12px;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.image-preview-action:hover:not(:disabled) {
  transform: scale(0.99);
  opacity: 0.95;
}

.image-preview-action:active:not(:disabled) {
  transform: scale(0.97);
}

.image-preview-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.image-preview-action-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}

.image-preview-action-label {
  max-width: 98px;
  font-size: 12px;
  line-height: 140%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-preview-copy {
  width: 100%;
  height: 49px;
  background: #434550;
  border-radius: 12px;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-family: Arial, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.image-preview-copy:hover {
  transform: scale(0.99);
  opacity: 0.95;
}

.image-preview-copy:active {
  transform: scale(0.97);
}

.image-preview-dismiss {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
}

.message-edit-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.message-edit-attach {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #ffffff;
}

.message-edit-file-input {
  display: none;
}

.message-edit-actions {
  display: flex;
  gap: 12px;
}

.message-edit-cancel,
.message-edit-save {
  flex: 1;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
  line-height: 18px;
  font-weight: 600;
  cursor: pointer;
}

.message-edit-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.message-edit-save {
  background: #ffffff;
  color: #0b0b0b;
  border-color: transparent;
}

.message-edit-input {
  width: 100%;
  min-height: 90px;
  max-height: 240px;
  height: auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  color: #fff;
  font-size: 14px;
  line-height: 20px;
  resize: none;
  overflow-y: auto;
}

.message-user.message-editing {
  width: 90%;
}

.edit-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-actions .send-message {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.edit-actions .edit-save {
  background: #ffffff;
  color: #434550;
}

.edit-actions .edit-cancel {
  background: transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
  color: #fff;
}

.edit-actions .edit-save,
.edit-actions .edit-cancel {
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.edit-actions .edit-save:hover,
.edit-actions .edit-cancel:hover {
  transform: scale(0.99);
  opacity: 0.95;
}

.edit-actions .edit-save:active,
.edit-actions .edit-cancel:active {
  transform: scale(0.97);
}

.typing-indicator {
  position: relative;
  overflow: hidden;
}

.typing-indicator .message-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.typing-label {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.15));
  -webkit-background-clip: text;
  color: transparent;
  background-size: 200% 100%;
  animation: shimmer 1.8s linear infinite;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: blink 1s infinite ease-in-out;
}

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

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

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.hello-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 16px;
  color: #fff;
  margin: auto;
}

.hello-icon {
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.hello-icon svg {
  width: 32px;
  height: 32px;
}

.input-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 560px;
  bottom: calc(95px + env(safe-area-inset-bottom));
  z-index: 9;
  background: transparent;
  transition: transform 0.2s ease;
}

.input-toolbar::before {
  content: "";
  width: 100vw;
  height: 160px;
  position: absolute;
  background: #191b23;
  z-index: -1;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.input-toolbar.menu-open {
  transform: translate(-50%, 80px);
  pointer-events: none;
}

.chat-opened-limit {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom) + 70px);
  width: 95vw;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: #262832;
  border-radius: 12px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-opened-limit.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.chat-opened-limit.menu-open {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 140%);
}

.chat-opened-limit__content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.chat-opened-limit__icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.chat-opened-limit__text {
  font-size: 12px;
  line-height: 15px;
  color: #ffffff;
}

.chat-opened-limit__close {
  width: 24px;
  height: 24px;
  border: none;
  padding: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  cursor: pointer;
}

.chat-opened-limit__close svg {
  width: 14px;
  height: 14px;
  stroke: #7d808d;
  stroke-width: 1.5;
  fill: none;
}

.chat-settings {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  place-self: self-end;
  margin-bottom: 12px;
}

.chat-body.settings-open {
  height: auto;
  margin-top: 60px;
  min-height: calc(100vh - 160px);
  align-items: center;
  justify-content: center;
}

.chat-body.settings-open .messages-container,
.chat-body.settings-open .hello-message,
.chat-body.settings-open .input-toolbar {
  display: none !important;
}

.chat-body.settings-open .chat-opened-limit {
  display: none !important;
}

#chat.settings-open .chat-hero {
  display: none;
}

.chat-settings-screen {
  position: relative;
  display: none;
  min-height: 100%;
  width: 100%;
  overflow: visible;
  color: #ffffff;
}

.chat-body.settings-open .chat-settings-screen {
  display: flex;
  align-items: center;
  justify-content: center;
}



.chat-settings-card {
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  width: 358px;
  height: auto;
  background: rgba(25, 27, 35, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: visible;
}

.chat-settings-card--tall {
  height: auto;
}

.chat-settings-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  align-self: stretch;
}

.chat-settings-field--compact {
  flex: 0 0 151px;
  max-width: 151px;
  height: 50px;
}

.chat-settings-field--slider {
  gap: 11px;
  min-height: 34px;
  width: 326px;
}

.chat-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 17px;
}

.chat-settings-label {
  font-size: 14px;
  line-height: 17px;
  font-weight: 400;
  color: #ffffff;
}

.chat-settings-value {
  font-size: 14px;
  line-height: 17px;
  font-weight: 400;
  color: #ffffff;
  min-width: 48px;
  text-align: right;
}

.chat-settings-slider {
  position: relative;
  height: 8px;
  display: flex;
  align-items: center;
}

.chat-settings-range {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  padding: 0;
  transform: translateY(-50%);
  background: rgba(120, 120, 128, 0.16);
  border-radius: 8px;
  overflow: visible;
  pointer-events: none;
}

.chat-settings-range-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 3px;
  width: var(--fill-percent, 0%);
  background: #ffffff;
  border-radius: 100px;
}

.chat-settings-range-thumb {
  position: absolute;
  top: 50%;
  left: var(--fill-percent, 0%);
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #262832;
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  box-shadow: none;
}

.chat-settings-range-input {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.chat-settings-range-input:focus {
  outline: none;
}

.chat-settings-slider:focus-within .chat-settings-range-thumb {
  box-shadow: none;
}

.chat-settings-field--textarea {
  gap: 10px;
  width: 326px;
}

.chat-settings-textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: #ffffff;
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  resize: none;
}

.chat-settings-textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.chat-settings-textarea--flat {
  border-radius: 0;
}

.chat-settings-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  row-gap: 16px;
  column-gap: 24px;
  width: 326px;
  margin: 0 auto;
}

.chat-model-toggle {
  background: none;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.chat-title-chevron {
  display: inline-flex;
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.chat-title-chevron svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
}

.chat-model-toggle.is-open .chat-title-chevron {
  transform: rotate(180deg);
}

.chat-settings-stepper {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 103px;
  height: 34px;
  padding: 6px 8px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
}

.chat-settings-stepper-btn {
  width: 24px;
  height: 22px;
  border-radius: 0;
  border: none;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 18px;
  line-height: 22px;
  font-weight: 400;
  color: #ffffff;
}

.chat-settings-stepper-value {
  min-width: 7px;
  padding: 0;
  text-align: center;
  font-size: 14px;
  line-height: 17px;
  font-weight: 400;
  color: #ffffff;
}

.chat-settings-preset {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-settings-control {
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  height: 50px;
}

.chat-settings-control--input {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  height: 48px;
}

.chat-settings-control .chat-settings-stepper {
  margin-left: auto;
}

.chat-settings-control-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #ffffff;
  flex-shrink: 0;
}

.chat-settings-control-icon svg {
  width: 24px;
  height: 24px;
}

.chat-settings-input {
  flex: 1;
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  padding: 0;
}

.chat-settings-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.chat-settings-dropdown {
  position: relative;
  width: 100%;
}

.chat-settings-dropdown-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: none;
}

.chat-settings-dropdown.is-open .chat-settings-dropdown-trigger {
  border-color: rgba(255, 255, 255, 0.08);
  background: transparent;
}

.chat-settings-control-text {
  flex: 1;
  text-align: left;
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  color: #ffffff;
}

.chat-settings-control-chevron {
  width: 6px;
  height: 12px;
  display: grid;
  place-items: center;
  color: #ffffff;
  transition: none;
}

.chat-settings-control-chevron svg {
  width: 6px;
  height: 12px;
}

.chat-settings-dropdown.is-open .chat-settings-control-chevron {
  transform: rotate(180deg);
}

.chat-settings-dropdown-menu {
  box-sizing: border-box;
  position: absolute;
  left: 0;
  right: auto;
  top: calc(100% + 8px);
  background: #2b2d35;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  width: 325px;
  height: auto;
  max-height: 130px;
  box-shadow: none;
  overflow-y: auto;
  display: none;
  z-index: 12;
}

.chat-settings-dropdown.is-open .chat-settings-dropdown-menu {
  display: flex;
  flex-direction: column;
}

.chat-settings-dropdown-search {
  width: 100%;
  height: 32px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 12px;
  line-height: 20px;
  font-weight: 400;
}

.chat-settings-dropdown-search::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.chat-settings-dropdown-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.chat-settings-dropdown-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  min-height: 20px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: none;
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
}

.chat-settings-option-hash {
  width: 18px;
  text-align: center;
  color: #ffffff;
  font-size: 14px;
  line-height: 20px;
}

.chat-settings-option-label {
  font-size: 14px;
  line-height: 20px;
}

.chat-settings-dropdown--compact {
  width: 103px;
  margin-left: auto;
}

.chat-settings-dropdown--compact .chat-settings-dropdown-trigger {
  height: 34px;
  padding: 6px 8px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  gap: 8px;
}

.chat-settings-dropdown--compact .chat-settings-control-text {
  font-size: 14px;
  line-height: 17px;
  text-align: center;
}

.chat-settings-dropdown--compact .chat-settings-control-chevron {
  width: 4px;
  height: 8px;
}

.chat-settings-dropdown--compact .chat-settings-control-chevron svg {
  width: 4px;
  height: 8px;
}

.chat-settings-dropdown--ratio .chat-settings-dropdown-menu {
  width: 235px;
  height: auto;
  max-height: 130px;
  padding: 8px;
  left: auto;
  right: 0;
}

.chat-settings-dropdown--ratio.is-open .chat-settings-dropdown-menu {
  display: flex;
}

.chat-settings-dropdown--ratio .chat-settings-dropdown-options {
  display: grid;
  grid-template-columns: 100px 111px;
  grid-auto-rows: 24px;
  column-gap: 8px;
  row-gap: 0;
  align-content: start;
}

.chat-settings-dropdown--ratio .chat-settings-dropdown-option {
  height: 24px;
  padding: 2px;
  gap: 8px;
  font-size: 10px;
  line-height: 12px;
}

.chat-settings-dropdown--ratio .chat-settings-option-label {
  font-size: 10px;
  line-height: 12px;
  text-align: center;
}

.chat-settings-ratio-icon {
  position: relative;
  width: 20px;
  height: 20px;
}

.chat-settings-ratio-icon::before {
  content: '';
  position: absolute;
  border: 0.5px solid #ffffff;
  border-radius: 2px;
  width: 10px;
  height: 10px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.chat-settings-ratio-icon--portrait::before {
  width: 10px;
  height: 14px;
}

.chat-settings-ratio-icon--landscape::before {
  width: 14px;
  height: 10px;
}

.chat-settings-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.chat-settings-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  height: 32px;
  border-radius: 6px;
  background: #2b2d35;
  color: #ffffff;
  font-size: 12px;
  line-height: 20px;
  font-weight: 400;
  min-width: 75px;
}

.chat-settings-chip button {
  border: none;
  background: transparent;
  color: #7d808d;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
}

.chat-settings-chip button::before,
.chat-settings-chip button::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 1px;
  background: #7d808d;
}

.chat-settings-chip button::before {
  transform: rotate(45deg);
}

.chat-settings-chip button::after {
  transform: rotate(-45deg);
}

.model-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px calc(12px + env(safe-area-inset-bottom));
  background: transparent;
}

.model-modal .model-modal-card {
  width: min(100%, 420px);
  padding: 16px 21px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  backdrop-filter: blur(15px);
  position: relative;
  text-align: left;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.model-modal.open .model-modal-card {
  opacity: 1;
  transform: translateY(0);
}

.model-modal-title {
  margin: 0;
  font-size: 16px;
  line-height: 20px;
  color: #ffffff;
}

.model-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
}

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

.model-group-title {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.3px;
}

.model-options {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.model-option {
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  border-radius: 0;
  padding: 10px 0;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.model-option-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.model-option-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.model-option-icon svg {
  width: 24px;
  height: 24px;
}

.model-option-label {
  font-size: 14px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-option-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.model-option-unavailable {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

.model-modal[data-context="create"] .model-option-state {
  display: none;
}

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

.model-option.active {
  opacity: 1;
}

.model-option:not(.active) {
  opacity: 0.75;
}

.model-option-state {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

.model-empty {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  padding: 6px 0 4px;
}

.chat-settings-actions {
  display: flex;
  gap: 16px;
  margin-top: 0;
  width: 326px;
  margin-left: auto;
  margin-right: auto;
}

.chat-settings-btn {
  flex: 1;
  min-width: 155px;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  height: 43px;
  font-size: 16px;
  line-height: 19px;
  font-weight: 600;
  cursor: pointer;
  transition: none;
}

.chat-settings-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-settings-save {
  background: #ffffff;
  color: #0b0b0b;
}

.input-container {
  flex: 1;
  display: block;
  background: #262832;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px;
  position: relative;
}

.attachments {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  max-height: 160px;
  overflow-y: auto;
}

.attachments.has-items {
  display: flex;
}

.attachment-card {
  display: flex;
  align-items: center;
  padding: 4px;
  gap: 8px;
  background: rgba(52, 49, 110, 0.5);
  border-radius: 8px;
  max-width: 218px;
  width: fit-content;
}

.attachment-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  flex-shrink: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-doc-icon {
  width: 32px;
  height: 32px;
}

.attachment-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 144px;
}

.attachment-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: #ffffff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-subtitle {
  font-size: 12px;
  font-weight: 300;
  line-height: 18px;
  color: #b6b6b6;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-remove {
  margin-left: auto;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  align-self: flex-start;
}

.attachment-remove svg {
  width: 8px;
  height: 8px;
  stroke: #b6b6b6;
  stroke-width: 1.5;
}

.input-inner {
  display: grid;
  grid-template-columns: 24px 1fr 24px;
  align-items: center;
  gap: 8px;
}

.chat-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-role-pill {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  white-space: nowrap;
}

.chat-role-pill.is-visible {
  display: inline-flex;
}

.chat-role-pill-remove {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  color: #7d808d;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.chat-role-pill-remove svg {
  width: 10px;
  height: 10px;
}

.chat-role-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: 100%;
  max-width: 260px;
  padding: 8px;
  border-radius: 8px;
  background: #2b2d35;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: none;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
  z-index: 12;
}

.chat-role-menu.is-open {
  display: flex;
}

.chat-role-option {
  border: none;
  background: transparent;
  color: #ffffff;
  text-align: left;
  font-size: 12px;
  line-height: 18px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.chat-role-option:hover,
.chat-role-option.is-active {
  background: rgba(255, 255, 255, 0.08);
}

.chat-role-empty {
  font-size: 12px;
  line-height: 18px;
  color: rgba(255, 255, 255, 0.6);
  padding: 6px 8px;
}

.input-container .clip {
  width: 24px;
  height: 24px;
  stroke: #7d808d;
}

.clip-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #7d808d;
}

.clip-menu {
  position: absolute;
  left: 6px;
  bottom: 55px;
  display: none;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px;
  gap: 8px;
  background: #434550;
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  animation: menuFade 0.18s ease forwards;
  z-index: 25;
}

.clip-menu.open {
  display: flex;
}

.clip-menu button {
  border: none;
  background: transparent;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.clip-menu svg {
  width: 28px;
  height: 28px;
}

.chat-input {
  background: transparent;
  border: none;
  resize: none;
  color: #fff;
  font-size: 14px;
  line-height: 20px;
  padding: 0;
  border-radius: 0;
  height: 23px;
  flex: 1;
  min-width: 0;
}

.chat-input:focus {
  outline: none;
}

.send-message {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: #434550;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 5px;
}

/* Home screen */
#welcome {
  position: relative;
}

#welcome .top-bar {
  gap: 8px;
}

.home-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
}

.home-screen > * {
  position: relative;
  z-index: 1;
}

.home-search {
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 4px 8px;
  gap: 8px;
  width: 100%;
  height: 48px;
  margin-right: 16px;
  background: rgba(25, 27, 35, 0.3);
  background-blend-mode: soft-light;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  flex: 1 1 auto;
  align-self: stretch;
}

.home-search-icon {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 8px;
  gap: 10px;
  width: 40px;
  height: 40px;
  flex: none;
}

.home-search-icon svg {
  width: 24px;
  height: 24px;
  stroke: #ffffff;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-search-input {
  width: 145px;
  height: 17px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #dadada;
  font-size: 14px;
  line-height: 17px;
  letter-spacing: 0.25px;
  text-align: justify;
  padding: 0;
  flex: none;
}

.home-search-input::placeholder {
  color: #dadada;
}

.home-search-input:focus {
  outline: none;
}

.home-ai-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.home-ai-strip::-webkit-scrollbar {
  display: none;
}

.home-ai-card {
  position: relative;
  flex: 0 0 150px;
  min-height: 180px;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(to bottom, rgba(52, 49, 110, 0.55) -20%, #191b23 30%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background-clip: padding-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 19px;
  overflow: hidden;
  scroll-snap-align: start;
}

.home-ai-card--mid {
  background: linear-gradient(to bottom, rgba(15, 59, 142, 0.55) -20%, #191b23 30%);
  background-clip: padding-box;
}

.home-ai-card--voice {
  background: linear-gradient(to bottom, rgba(29, 85, 78, 0.55) -20%, #191b23 30%);
  background-clip: padding-box;
}

.home-ai-card--bytedance {
  background: linear-gradient(to bottom, rgba(90, 64, 18, 0.55) -20%, #191b23 30%);
  background-clip: padding-box;
}
.home-ai-card > * {
  position: relative;
  z-index: 1;
}

.home-ai-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-ai-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.home-ai-icon svg {
  width: 24px;
  height: 24px;
}

.home-ai-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 19px;
  color: #ffffff;
}

.home-ai-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  line-height: 22px;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: underline;
  align-self: flex-start;
  cursor: pointer;
}

.home-start-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  background: #ffffff;
  color: #000000;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.home-start-chat svg {
  width: 20px;
  height: 20px;
}

.home-start-chat:hover {
  background: #f2f2f2;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.25);
  transform: scale(0.99);
  opacity: 0.95;
}

.home-start-chat:active {
  background: #e9e9e9;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.28);
  transform: scale(0.97);
}

.home-favorites {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-favorites-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #24262e;
  border-radius: 12px;
}

.home-favorites-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  color: #fefefe;
}

.home-favorites-link {
  background: none;
  border: none;
  color: #58cde7;
  font-size: 12px;
  line-height: 22px;
  cursor: pointer;
  padding: 0;
}

.home-favorites-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 351px;
  overflow-y: auto;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(153, 153, 153, 0.7) transparent;
}

.home-favorites-list::-webkit-scrollbar {
  width: 4px;
}

.home-favorites-list::-webkit-scrollbar-thumb {
  background: rgba(153, 153, 153, 0.7);
  border-radius: 4px;
}

.home-favorites-list::-webkit-scrollbar-track {
  background: transparent;
}

.home-favorite-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #181a23;
  color: #ffffff;
  text-align: left;
  cursor: pointer;
  position: relative;
  border: none;
  overflow: hidden;
  flex-shrink: 0;
}

.home-favorite-card::before {
  content: "";
  position: absolute;
  inset: 0;
  padding-bottom: 1px;
  border-radius: 12px;
  background: linear-gradient(-84deg, #4d329c 0%, #287f75 41%, #2a647e 73%, #194875 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.home-favorite-card > * {
  position: relative;
  z-index: 1;
}

.home-favorite-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.home-favorite-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.home-favorite-icon img {
  width: 16px;
  height: 16px;
}

.home-favorite-icon svg {
  display: block;
}

.home-favorite-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-favorite-star {
  width: 24px;
  height: 24px;
  border: none;
  padding: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.home-favorite-star svg {
  width: 24px;
  height: 24px;
  display: block;
}

.home-favorite-empty {
  font-size: 13px;
  color: #a8b2d1;
  padding: 10px 4px;
  text-align: center;
}

.home-ai-link:focus-visible,
.home-start-chat:focus-visible,
.home-favorite-card:focus-visible,
.home-favorites-link:focus-visible {
  outline: 2px solid rgba(88, 205, 231, 0.6);
  outline-offset: 2px;
}

/* Profile */
#profile {
  position: relative;
}

#profile .top-bar {
  padding: 8px 16px;
  margin: 0 -16px;
  background: linear-gradient(
    180deg,
    rgba(14, 16, 22, calc(0.95 * var(--profile-topbar-alpha, 0))) 0%,
    rgba(14, 16, 22, calc(0.75 * var(--profile-topbar-alpha, 0))) 60%,
    rgba(14, 16, 22, 0) 100%
  );
}

.profile-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 12px;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-avatar {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: #d9d9d9;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-avatar.has-image {
  background: transparent;
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.profile-avatar.has-image .profile-avatar-img {
  display: block;
}

.profile-avatar-initials {
  font-size: 16px;
  font-weight: 600;
  color: #111111;
}

.profile-name-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-name {
  font-size: 16px;
  font-weight: 500;
  line-height: 19px;
  color: #ffffff;
}

.profile-handle {
  font-size: 12px;
  font-weight: 400;
  line-height: 15px;
  color: #626368;
}

.profile-balance-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 16px;
  border-radius: 12px;
  background: #262832;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.25);
}

.profile-balance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.profile-balance-label {
  font-size: 12px;
  font-weight: 300;
  line-height: 22px;
  color: #b6b6b6;
}

.profile-balance-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-balance-mark svg {
  width: 10px;
  height: 15px;
}

.profile-balance-value {
  font-size: 24px;
  font-weight: 400;
  line-height: 29px;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.profile-topup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 128px;
  height: 48px;
  padding: 12px 18px;
  border-radius: 12px;
  background: linear-gradient(90deg, #0e1e38 0%, #2b66cc 52%, #122a52 104%);
  border: 1px solid rgba(120, 180, 255, 0.55);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(25, 84, 170, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.profile-topup-icon svg {
  width: 18px;
  height: 18px;
}

.profile-transactions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid #434550;
}

.profile-section-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.profile-section-title {
  font-size: 12px;
  font-weight: 300;
  line-height: 22px;
  color: #b6b6b6;
}

.profile-section-label {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 300;
  line-height: 22px;
  color: rgba(182, 182, 182, 0.65);
}

.profile-filter-toggle {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #b6b6b6;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.profile-filter-toggle svg {
  width: 18px;
  height: 18px;
}

.profile-filter-toggle svg path {
  fill: currentColor;
}

.profile-filter-toggle:hover {
  opacity: 0.9;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.profile-filter-toggle:active {
  transform: scale(0.97);
}

.profile-filter-toggle.active {
  color: #f66164;
  border-color: rgba(246, 97, 100, 0.4);
  background: rgba(246, 97, 100, 0.08);
}

.profile-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 4px;
  position: relative;
}

.profile-tabs-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: #ffffff;
  border-radius: 6px;
  transition: transform 0.2s ease;
  z-index: 0;
}

.profile-tab {
  padding: 10px 0;
  background: transparent;
  color: #ffffff;
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
  border: none;
  cursor: pointer;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

.profile-tab.active {
  color: #0b0b0b;
}

.profile-transactions-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.profile-transaction {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-transaction-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.profile-transaction-badge {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(38, 40, 50, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.25);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.profile-transaction-badge svg {
  width: auto;
  height: 16px;
  display: block;
}

.profile-transaction-badge[data-badge='visa'] svg {
  width: 34px;
  height: 34px;
}

.profile-transaction-badge[data-badge='visa'] {
  background: transparent;
  border: none;
  box-shadow: none;
}

.profile-transaction-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.profile-transaction-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
  color: #ffffff;
}

.profile-transaction-time {
  font-size: 12px;
  font-weight: 300;
  line-height: 22px;
  color: #b6b6b6;
}

.profile-transaction-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
}

.profile-transaction-credits,
.profile-transaction-amount {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: #b6b6b6;
}

.profile-transaction-credits {
  color: #05df72;
  text-wrap-mode: nowrap;
}

.profile-transaction--negative .profile-transaction-credits {
  color: #f66164;
}

.profile-empty {
  color: #a8b2d1;
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
}

.profile-topup:hover {
  transform: scale(0.99);
  opacity: 0.95;
  box-shadow: 0 12px 22px rgba(25, 84, 170, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.profile-topup:active {
  transform: scale(0.97);
  box-shadow: 0 6px 14px rgba(15, 52, 115, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

/* Shop page */
#shop {
  position: relative;
  overflow: hidden;
}

#shop .top-bar {
  position: sticky;
  top: 0;
  z-index: 9;
  padding: 8px 0;
  min-height: 56px;
}

#shop .shop-top-balance {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 600;
  line-height: 22px;
  color: #ffffff;
  text-align: center;
  white-space: nowrap;
}

#shop .shop-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 16px 0 0;
}

#shop .shop-credits-heading {
  font-size: 18px;
  font-weight: 600;
  line-height: 22px;
  color: #ffffff;
  margin-top: 6px;
}

#shop .shop-token-card {
  width: 100%;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

#shop .shop-token-input {
  width: 90%;
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 56px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  outline: none;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

#shop .shop-token-input::-webkit-scrollbar {
  display: none;
}

#shop .shop-slider {
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  --shop-slider-fill: 23%;
}

#shop .shop-slider-track {
  position: relative;
  height: 4px;
  background: rgba(120, 120, 128, 0.16);
  border-radius: 8px;
}

#shop .shop-slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 4px;
  width: var(--shop-slider-fill);
  background: #ffffff;
  border-radius: 100px;
}

#shop .shop-slider-thumb {
  position: absolute;
  top: 50%;
  left: var(--shop-slider-fill);
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #262832;
}

#shop .shop-slider-input {
  position: absolute;
  left: 0;
  top: -10px;
  width: 100%;
  height: 24px;
  opacity: 0;
  cursor: pointer;
}

#shop .shop-slider-label {
  width: 100%;
  text-align: right;
  font-size: 13px;
  line-height: 22px;
  color: #b6b6b6;
}

#shop .shop-credit-selection {
  width: 100%;
  display: flex;
  justify-content: center;
}

#shop .shop-credit-options {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
}

#shop .shop-credit-option {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  min-width: 60px;
  height: 34px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: none;
  color: #ffffff;
  font-size: 14px;
  line-height: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.12s ease;
}

#shop .shop-credit-option:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.99);
  opacity: 0.95;
}

#shop .shop-credit-option:active {
  transform: scale(0.97);
}

#shop .shop-credit-option.active {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

#shop .shop-context-hint {
  width: 100%;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  line-height: 22px;
  color: #ffffff;
}

#shop .shop-glass-panel {
  width: 100%;
  background: rgba(97, 94, 94, 0.1);
  border-radius: 20px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

#shop .shop-glass-title {
  font-size: 13px;
  font-weight: 400;
  line-height: 22px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 10px;
}

#shop .shop-glass-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

#shop .shop-glass-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 400;
  line-height: 22px;
  color: #ffffff;
}

#shop .shop-glass-value {
  font-size: 13px;
  font-weight: 400;
  line-height: 22px;
  color: #ffffff;
}

#shop .shop-tooltip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: transparent;
  cursor: default;
}

#shop .shop-tooltip-trigger svg {
  width: 16px;
  height: 16px;
  display: block;
}

#shop .shop-disclaimer {
  width: 100%;
  text-align: center;
  font-size: 11px;
  font-weight: 400;
  line-height: 20px;
  color: #ffffff;
  opacity: 0.8;
}

#shop .shop-purchase-btn {
  position: fixed;
  left: 50%;
  bottom: calc(104px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: 94%;
  max-width: 560px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #ffffff;
  color: #191b23;
  border: none;
  border-radius: 14px;
  font-weight: 600;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.12s ease, background 0.12s ease;
  z-index: 9;
}

#shop .shop-purchase-btn:hover:not(:disabled) {
  background: #f2f2f2;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%) scale(0.99);
  opacity: 0.95;
}

#shop .shop-purchase-btn:active:not(:disabled) {
  background: #e9e9e9;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
  transform: translateX(-50%) scale(0.97);
}

#shop .shop-purchase-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

#shop .shop-purchase-label,
#shop .shop-purchase-price {
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
  color: #191b23;
}

#shop .shop-purchase-divider {
  width: 1px;
  height: 22px;
  background: #b6b6b6;
}

#shop .shop-tooltip {
  position: fixed;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#shop .shop-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

#shop .shop-tooltip-content {
  background: #1f2129;
  color: #f2f3f7;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 18px;
  border: none;
  width: fit-content;
  max-width: min(90vw, 380px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

#shop .shop-tooltip-line + .shop-tooltip-line {
  margin-top: 4px;
}

#shop .shop-tooltip-example {
  color: rgba(242, 243, 247, 0.8);
}

/* Login UI: isolate login-only fullscreen rules from authenticated screens. */
body.login-only {
  overflow: hidden;
}

.login-only .page.login-page {
  /* Floor + measured strategy to prevent dock clipping on early/unstable layout passes. */
  --login-dock-base: 190px;
  --login-dock-measured: 0px;
  --login-dock-space: calc(max(var(--login-dock-base), var(--login-dock-measured)) + env(safe-area-inset-bottom));
  --login-icon-surface: rgba(25, 27, 35, 0.7);
  --login-scroll-progress: 0;
  position: relative;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: 0;
  padding-bottom: 0;
}

/* Login glow layers: keep ambient effects behind content without adding scroll. */
.login-only .page.login-page::before,
.login-only .page.login-page::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.login-only .page.login-page::before {
  inset: -20% -16% auto;
  height: 62%;
  background:
    radial-gradient(62% 68% at 50% 12%, rgba(84, 64, 236, 0.82) 0%, rgba(84, 64, 236, 0.22) 46%, rgba(84, 64, 236, 0) 75%),
    radial-gradient(44% 48% at 86% 18%, rgba(40, 104, 216, 0.42) 0%, rgba(40, 104, 216, 0) 72%);
}

.login-only .page.login-page::after {
  inset: 46% -12% -10% -12%;
  background:
    radial-gradient(50% 40% at 20% 34%, rgba(67, 188, 179, 0.16) 0%, rgba(67, 188, 179, 0) 72%),
    linear-gradient(180deg, rgba(12, 14, 22, 0) 0%, rgba(12, 14, 22, 0.7) 44%, #0b0d14 100%);
}

/* Login no-scroll: hard-lock login section to viewport height. */
.login-only .section.active#login {
  position: relative;
  height: 100%;
  overflow: hidden;
  padding-bottom: 0;
}

.login-only #login .login-shell {
  position: relative;
  z-index: 2;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(22px + var(--tg-top-inset, 0px)) 0 var(--login-dock-space);
}

.login-only #login .login-center {
  min-height: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(8px, 1.8vh, 18px) clamp(8px, 2vw, 16px) 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  gap: clamp(12px, 2vh, 22px);
}

/* Login motion: staged entry is opt-in through JS class toggles. */
.login-only #login.motion-enabled .login-badge,
.login-only #login.motion-enabled .login-title,
.login-only #login.motion-enabled .login-subtitle,
.login-only #login.motion-enabled .login-icon-tile,
.login-only #login.motion-enabled .login-icon-label,
.login-only #login.motion-enabled .login-value-card,
.login-only #login.motion-enabled .login-fixed-actions {
  opacity: 0;
}

.login-only #login.motion-enabled .login-badge,
.login-only #login.motion-enabled .login-title,
.login-only #login.motion-enabled .login-subtitle {
  transform: translateY(12px) scale(0.985);
  transition: opacity var(--motion-base) var(--motion-ease-enter), transform var(--motion-base) var(--motion-ease-enter);
}

.login-only #login.motion-enabled .login-icon-tile {
  transform: translateY(10px) scale(0.92);
  transition: opacity var(--motion-base) var(--motion-ease-enter), transform var(--motion-base) var(--motion-ease-enter);
}

.login-only #login.motion-enabled .login-icon-label {
  transform: translateY(7px);
  transition: opacity var(--motion-fast) var(--motion-ease-soft), transform var(--motion-fast) var(--motion-ease-soft);
}

.login-only #login.motion-enabled .login-value-card {
  transform: translateY(20px);
  filter: blur(10px);
  transition:
    opacity var(--motion-base) var(--motion-ease-soft),
    transform var(--motion-base) var(--motion-ease-soft),
    filter var(--motion-base) var(--motion-ease-soft);
  will-change: transform, opacity;
}

.login-only #login.motion-enabled .login-fixed-actions {
  transform: translateY(20px);
  transition: opacity var(--motion-base) var(--motion-ease-enter), transform var(--motion-base) var(--motion-ease-enter);
}

.login-only #login.is-ready .login-badge,
.login-only #login.is-ready .login-title,
.login-only #login.is-ready .login-subtitle,
.login-only #login.is-ready .login-icon-tile,
.login-only #login.is-ready .login-icon-label,
.login-only #login.is-ready .login-fixed-actions {
  opacity: 1;
  transform: none;
}

.login-only #login.is-ready .login-badge {
  transition-delay: 30ms;
}

.login-only #login.is-ready .login-title {
  transition-delay: 90ms;
}

.login-only #login.is-ready .login-subtitle {
  transition-delay: 130ms;
}

.login-only #login.is-ready .login-fixed-actions {
  transition-delay: 520ms;
}

.login-only #login .login-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(242, 243, 247, 0.76);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.login-only #login .login-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.login-only #login .login-title {
  margin: 0;
  max-width: 660px;
  font-size: clamp(42px, 11vw, 92px);
  line-height: 0.95;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.045em;
  text-shadow: 0 10px 26px rgba(83, 74, 232, 0.34);
}

.login-only #login .login-subtitle {
  margin: 0;
  max-width: 460px;
  color: rgba(242, 243, 247, 0.64);
  font-size: clamp(14px, 2.2vw, 17px);
  line-height: 1.45;
}

.login-only #login .login-icon-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.login-only #login .login-icon-item {
  --icon-delay: 0ms;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.login-only #login .login-icon-item:nth-child(1) {
  --icon-delay: 170ms;
}

.login-only #login .login-icon-item:nth-child(2) {
  --icon-delay: 220ms;
}

.login-only #login .login-icon-item:nth-child(3) {
  --icon-delay: 270ms;
}

.login-only #login .login-icon-item:nth-child(4) {
  --icon-delay: 320ms;
}

.login-only #login.is-ready .login-icon-item .login-icon-tile {
  transition-delay: var(--icon-delay);
}

.login-only #login.is-ready .login-icon-item .login-icon-label {
  transition-delay: calc(var(--icon-delay) + 80ms);
}

.login-only #login .login-icon-tile {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 84px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 24px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-only #login .login-model-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-only #login .login-model-icon svg {
  width: 30px;
  height: 30px;
}

.login-only #login .login-model-icon--flux svg {
  width: 30px;
  height: 20px;
}

.login-only #login .login-model-icon--seedream svg {
  width: 26px;
  height: 26px;
}

.login-only #login .login-model-icon path {
  fill: currentColor !important;
}

.login-only #login .login-model-icon {
  color: #ffffff;
}

.login-only #login .login-icon-label {
  font-size: 14px;
  font-weight: 600;
  color: rgba(245, 246, 251, 0.94);
}

.login-only #login .login-value-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-only #login .login-value-list .login-value-card {
  --card-delay: 0ms;
}

.login-only #login .login-value-list .login-value-card:nth-child(1) {
  --card-delay: 230ms;
}

.login-only #login .login-value-list .login-value-card:nth-child(2) {
  --card-delay: 280ms;
}

.login-only #login .login-value-list .login-value-card:nth-child(3) {
  --card-delay: 330ms;
}

.login-only #login .login-value-list .login-value-card:nth-child(4) {
  --card-delay: 380ms;
}

.login-only #login .login-value-list .login-value-card:nth-child(5) {
  --card-delay: 430ms;
}

.login-only #login.is-ready .login-value-card.is-inview {
  opacity: 1;
  transform: none;
  filter: none;
  transition-delay: var(--card-delay);
}

.login-only #login .login-value-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 22px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(34, 37, 49, 0.31) 0%, rgba(20, 23, 33, 0.39) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 10px 28px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(10px);
  text-align: left;
}

.login-only #login .login-value-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(to bottom, rgba(52, 49, 110, 0.55) -20%, var(--login-icon-surface) 44%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: rgba(234, 240, 255, 0.92);
}

.login-only #login .login-value-icon--sync {
  background: linear-gradient(to bottom, rgba(29, 85, 78, 0.55) -20%, var(--login-icon-surface) 44%);
  color: #82e6d8;
}

.login-only #login .login-value-icon--credits {
  background: linear-gradient(to bottom, rgba(52, 49, 110, 0.55) -20%, var(--login-icon-surface) 44%);
  color: #c4b0ff;
}

.login-only #login .login-value-icon--models {
  background: linear-gradient(to bottom, rgba(15, 59, 142, 0.55) -20%, var(--login-icon-surface) 44%);
  color: #90c2ff;
}

.login-only #login .login-value-icon--saved {
  background: linear-gradient(to bottom, rgba(90, 64, 18, 0.55) -20%, var(--login-icon-surface) 44%);
  color: #e9c88f;
}

.login-only #login .login-value-icon--secure {
  background: linear-gradient(to bottom, rgba(70, 84, 126, 0.58) -20%, var(--login-icon-surface) 44%);
  color: #b7c8ff;
}

.login-only #login .login-value-icon svg {
  width: 24px;
  height: 24px;
}

.login-only #login .login-value-copy h3 {
  margin: 0;
  color: #f5f6fb;
  font-size: clamp(18px, 2.8vw, 22px);
  line-height: 1.2;
  font-weight: 700;
}

.login-only #login .login-value-copy p {
  margin: 4px 0 0;
  color: rgba(242, 243, 247, 0.46);
  font-size: clamp(13px, 2.1vw, 17px);
  line-height: 1.3;
}

/* Login toast: transient status messages (errors/progress) that auto-hide. */
.login-only #login .login-toast {
  position: fixed;
  left: 50%;
  top: calc(14px + var(--tg-top-inset, 0px));
  width: auto;
  max-width: calc(100vw - 24px);
  transform: translateX(-50%) translateY(-10px);
  opacity: 0;
  transition: opacity 160ms ease, transform 200ms ease;
  pointer-events: none;
  z-index: 40;
  text-align: center;
}

.login-only #login .login-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.login-only #login .login-toast-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: min(92vw, 520px);
  background: rgba(247, 249, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  padding: 12px 16px;
  text-align: center;
  color: rgba(18, 19, 26, 0.95);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
}

/* Fixed login dock: keep actions always visible at viewport bottom. */
.login-fixed-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  padding: 0;
  z-index: 24;
  pointer-events: none;
}

.login-dock-fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--login-dock-space) + 72px);
  background: linear-gradient(
    180deg,
    rgba(11, 13, 20, calc(0.02 + var(--login-scroll-progress) * 0.08)) 0%,
    rgba(11, 13, 20, calc(0.72 + var(--login-scroll-progress) * 0.16)) 46%,
    rgba(11, 13, 20, calc(0.9 + var(--login-scroll-progress) * 0.08)) 100%
  );
  transition: background var(--motion-base) var(--motion-ease-soft);
  pointer-events: none;
  z-index: 1;
}

.login-dock {
  pointer-events: auto;
  position: relative;
  z-index: 2;
  background: rgba(12, 14, 22, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: none;
  border-radius: 32px 32px 0 0;
  padding: 12px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(14px);
}

.login-telegram-btn {
  width: 100%;
  min-height: 64px;
  border-radius: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #ffffff;
  color: #12131a;
  border: 1px solid rgba(18, 19, 26, 0.08);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  font-size: 17px;
  font-weight: 700;
}

.login-telegram-icon {
  width: 22px;
  height: 22px;
  color: #12131a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-dev-btn {
  width: 100%;
  border: none;
  background: transparent;
  color: rgba(242, 243, 247, 0.45);
  box-shadow: none;
  font-family: "Roboto Slab", serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.login-dev-btn.hidden {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  /* Reduce-motion fallback: disable staged transforms while keeping content fully visible. */
  .login-only #login.motion-enabled .login-badge,
  .login-only #login.motion-enabled .login-title,
  .login-only #login.motion-enabled .login-subtitle,
  .login-only #login.motion-enabled .login-icon-tile,
  .login-only #login.motion-enabled .login-icon-label,
  .login-only #login.motion-enabled .login-value-card,
  .login-only #login.motion-enabled .login-fixed-actions {
    opacity: 1;
    transform: none;
    filter: none;
    transition: opacity var(--motion-fast) linear !important;
  }
}

@media (max-width: 680px) {
  .login-only #login .login-center {
    padding-inline: 12px;
  }
}

@media (max-width: 420px) {
  .login-only .page.login-page {
    --login-dock-base: 170px;
  }

  .login-only #login .login-title {
    font-size: clamp(38px, 12.5vw, 56px);
  }

  .login-only #login .login-icon-row {
    gap: 8px;
  }

  .login-only #login .login-icon-tile {
    border-radius: 20px;
  }

  .login-only #login .login-value-card {
    padding: 12px;
    border-radius: 20px;
  }

  .login-only #login .login-value-icon {
    width: 44px;
    height: 44px;
  }

  .login-only #login .login-value-copy h3 {
    font-size: 17px;
  }

  .login-only #login .login-value-copy p {
    font-size: 13px;
  }

  .login-telegram-btn {
    min-height: 60px;
    font-size: 16px;
  }
}

@media (max-height: 780px) {
  .login-only .page.login-page {
    --login-dock-base: 170px;
  }

  .login-only #login .login-center {
    gap: 12px;
  }

  .login-only #login .login-title {
    font-size: clamp(36px, 9vw, 62px);
  }

  .login-only #login .login-icon-tile {
    min-height: 72px;
    border-radius: 18px;
  }

  .login-only #login .login-value-card {
    padding: 10px 12px;
  }

  .login-only #login .login-value-icon {
    width: 44px;
    height: 44px;
  }

  .login-only #login .login-value-copy h3 {
    font-size: 16px;
  }

  .login-only #login .login-value-copy p {
    font-size: 12px;
  }

  .login-telegram-btn {
    min-height: 56px;
  }
}

.profile-auth-actions {
  display: flex;
  gap: 12px;
  margin: 16px 0 8px;
}

.profile-auth-btn {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #f5f7ff;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
}

.profile-auth-btn--danger {
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
}
