/* ========== Telegram theme tokens ========== */
:root {
  --tg-bg: var(--tg-theme-bg-color, #ffffff);
  --tg-secondary: var(--tg-theme-secondary-bg-color, #f4f4f5);
  --tg-text: var(--tg-theme-text-color, #000000);
  --tg-hint: var(--tg-theme-hint-color, #8e8e93);
  --tg-link: var(--tg-theme-link-color, #2481cc);
  --tg-button: var(--tg-theme-button-color, #2481cc);
  --tg-button-text: var(--tg-theme-button-text-color, #ffffff);
  --tg-header: var(--tg-theme-header-bg-color, var(--tg-secondary));
  --tg-separator: var(--tg-theme-section-separator-color, rgba(0, 0, 0, 0.08));
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --row-avatar: 46px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans Arabic", sans-serif;
  --ai-bg: #07080f;
  --ai-violet: #8b5cf6;
  --ai-cyan: #22d3ee;
  --ai-pink: #f472b6;
}

body.tg-dark {
  --tg-bg: var(--tg-theme-bg-color, #18222d);
  --tg-secondary: var(--tg-theme-secondary-bg-color, #232e3c);
  --tg-text: var(--tg-theme-text-color, #ffffff);
  --tg-hint: var(--tg-theme-hint-color, #708499);
  --tg-link: var(--tg-theme-link-color, #6ab3f3);
  --tg-button: var(--tg-theme-button-color, #2aabee);
  --tg-button-text: var(--tg-theme-button-text-color, #ffffff);
  --tg-header: var(--tg-theme-header-bg-color, #232e3c);
  --tg-separator: var(--tg-theme-section-separator-color, rgba(255, 255, 255, 0.08));
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--tg-bg);
  color: var(--tg-text);
  min-height: 100dvh;
  overflow-x: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.35;
}

[hidden] {
  display: none !important;
}

.app {
  min-height: 100dvh;
  padding-bottom: var(--safe-bottom);
}

.view {
  min-height: 100dvh;
  display: none;
  flex-direction: column;
}

.view.is-active {
  display: flex;
}

/* ========== Hub ========== */
.view-hub {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(42, 171, 238, 0.18), transparent 55%),
    var(--tg-bg);
  padding: calc(1.25rem + var(--safe-top)) 1rem 2rem;
}

.hub-hero {
  margin-bottom: 1.5rem;
  padding-top: 0.5rem;
}

.hub-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tg-link);
  margin-bottom: 0.4rem;
}

.hub-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
}

.hub-sub {
  font-size: 14px;
  color: var(--tg-hint);
  max-width: 320px;
  line-height: 1.5;
}

.hub-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.hub-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  text-align: right;
  padding: 1rem 0.9rem;
  border: 0.5px solid var(--tg-separator);
  border-radius: 16px;
  background: var(--tg-secondary);
  color: var(--tg-text);
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, background 0.15s ease;
}

.hub-card:active {
  transform: scale(0.985);
  background: color-mix(in srgb, var(--tg-secondary) 80%, var(--tg-link));
}

.hub-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--tg-bg);
}

.hub-card-icon--ai {
  background: linear-gradient(135deg, var(--ai-violet), var(--ai-cyan));
  color: #fff;
  font-size: 18px;
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.45);
}

.hub-card--ai {
  border-color: rgba(139, 92, 246, 0.35);
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(34, 211, 238, 0.08)),
    var(--tg-secondary);
}

.hub-card-glow {
  position: absolute;
  inset: -40% auto auto -20%;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.35), transparent 70%);
  pointer-events: none;
}

.hub-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.hub-card-title {
  font-size: 16px;
  font-weight: 600;
}

.hub-card-desc {
  font-size: 13px;
  color: var(--tg-hint);
  line-height: 1.4;
}

.hub-card-chevron {
  color: var(--tg-hint);
  font-size: 22px;
  line-height: 1;
}

/* ========== Shared search chrome ========== */
.tg-search-header,
.page-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--tg-header);
  border-bottom: 0.5px solid var(--tg-separator);
}

.tg-search-header {
  padding: 0.5rem 0.75rem 0;
  padding-top: calc(0.5rem + var(--safe-top));
}

.page-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.75rem;
  padding-top: calc(0.75rem + var(--safe-top));
}

.page-header-title {
  font-size: 17px;
  font-weight: 600;
}

.tg-top-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tg-back {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--tg-link);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scaleX(-1);
}

.tg-back--light {
  color: #fff;
}

.tg-search-bar {
  flex: 1;
  min-width: 0;
}

.tg-search-field {
  display: flex;
  align-items: center;
  height: 36px;
  border-radius: 10px;
  padding: 0 0.5rem;
  background: rgba(0, 0, 0, 0.06);
}

body.tg-dark .tg-search-field {
  background: rgba(0, 0, 0, 0.25);
}

.tg-search-icon {
  color: var(--tg-hint);
  margin-left: 0.3rem;
  flex-shrink: 0;
}

.tg-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--tg-text);
  font: inherit;
  font-size: 16px;
  height: 100%;
  -webkit-appearance: none;
}

.tg-search-input::placeholder {
  color: var(--tg-hint);
}

.tg-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.tg-clear-btn {
  border: none;
  background: var(--tg-hint);
  color: var(--tg-bg);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tg-tabs {
  display: flex;
  margin-top: 0.4rem;
}

.tg-tab {
  flex: 1;
  text-align: center;
  padding: 0.65rem 0.5rem 0.7rem;
  font-size: 15px;
  font-weight: 500;
  color: var(--tg-link);
  position: relative;
}

.tg-tab.is-active::after {
  content: "";
  position: absolute;
  right: 18%;
  left: 18%;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--tg-link);
}

.tg-main {
  flex: 1;
  background: var(--tg-bg);
}

.tg-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--tg-hint);
  padding: 0.75rem 1rem 0.4rem;
  background: var(--tg-secondary);
}

.tg-idle,
.tg-empty,
.tg-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3.5rem 1.5rem;
  min-height: 40vh;
  color: var(--tg-hint);
}

.tg-idle strong,
.tg-empty strong {
  display: block;
  color: var(--tg-text);
  font-size: 18px;
  margin-bottom: 0.35rem;
}

.tg-spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--tg-separator);
  border-top-color: var(--tg-link);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== Result rows ========== */
.tg-list {
  list-style: none;
}

.tg-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  cursor: pointer;
  position: relative;
  user-select: none;
}

.tg-row:active {
  background: var(--tg-secondary);
}

.tg-row::after {
  content: "";
  position: absolute;
  left: 1rem;
  right: calc(1rem + var(--row-avatar) + 0.75rem);
  bottom: 0;
  height: 0.5px;
  background: var(--tg-separator);
}

.tg-row:last-child::after {
  display: none;
}

.tg-avatar {
  width: var(--row-avatar);
  height: var(--row-avatar);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 17px;
}

.tg-row-body {
  flex: 1;
  min-width: 0;
}

.tg-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.12rem;
}

.tg-row-title {
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-row-date {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--tg-hint);
}

.tg-row-preview {
  font-size: 14px;
  color: var(--tg-hint);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.tg-row-preview mark {
  background: transparent;
  color: var(--tg-link);
  font-weight: 600;
}

.tg-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.meta-chip {
  font-size: 11px;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: var(--tg-secondary);
  color: var(--tg-hint);
  white-space: nowrap;
}

.meta-chip--search {
  color: var(--tg-link);
  background: color-mix(in srgb, var(--tg-link) 14%, transparent);
}

.meta-chip--deal {
  color: #34c759;
  background: rgba(52, 199, 89, 0.14);
}

.meta-chip--hot {
  color: #ff9500;
  background: rgba(255, 149, 0, 0.14);
}

.meta-chip--rating {
  color: #ffd60a;
  background: rgba(255, 214, 10, 0.12);
}

/* ========== Filters ========== */
.filter-toggle {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--tg-link);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-toggle.is-on {
  background: color-mix(in srgb, var(--tg-link) 16%, transparent);
}

.filter-chips {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.55rem 0 0.65rem;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  font-size: 12px;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 0.5px solid var(--tg-separator);
  background: var(--tg-bg);
  color: var(--tg-text);
}

.filter-panel {
  background: var(--tg-secondary);
  border-bottom: 0.5px solid var(--tg-separator);
  animation: slideDown 0.22s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.filter-panel-inner {
  padding: 1rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.filter-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--tg-hint);
  margin-bottom: 0.45rem;
}

.filter-range-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-input {
  flex: 1;
  height: 40px;
  border-radius: 10px;
  border: 0.5px solid var(--tg-separator);
  background: var(--tg-bg);
  color: var(--tg-text);
  font: inherit;
  font-size: 15px;
  padding: 0 0.75rem;
  outline: none;
}

.filter-input:focus {
  border-color: var(--tg-link);
}

.filter-dash {
  color: var(--tg-hint);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pill {
  border: 0.5px solid var(--tg-separator);
  background: var(--tg-bg);
  color: var(--tg-text);
  font: inherit;
  font-size: 13px;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

.pill.is-active {
  border-color: var(--tg-link);
  color: var(--tg-link);
  background: color-mix(in srgb, var(--tg-link) 14%, transparent);
}

.filter-rating {
  display: flex;
  gap: 0.4rem;
}

.rating-btn {
  flex: 1;
  height: 36px;
  border-radius: 10px;
  border: 0.5px solid var(--tg-separator);
  background: var(--tg-bg);
  color: var(--tg-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.rating-btn.is-active {
  border-color: var(--tg-link);
  color: var(--tg-link);
  background: color-mix(in srgb, var(--tg-link) 14%, transparent);
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-ghost,
.btn-primary {
  flex: 1;
  height: 42px;
  border-radius: 11px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.btn-ghost {
  background: var(--tg-bg);
  color: var(--tg-text);
  border: 0.5px solid var(--tg-separator);
}

.btn-primary {
  background: var(--tg-button);
  color: var(--tg-button-text);
}

/* ========== AI view ========== */
.view-ai {
  background: var(--ai-bg);
  color: #e8eaf0;
  position: relative;
}

.view-ai::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 40% at 50% 20%, rgba(139, 92, 246, 0.25), transparent 60%),
    radial-gradient(ellipse 50% 30% at 80% 70%, rgba(34, 211, 238, 0.12), transparent 55%),
    radial-gradient(ellipse 40% 25% at 15% 80%, rgba(244, 114, 182, 0.1), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.ai-header,
.ai-stage,
.ai-composer {
  position: relative;
  z-index: 1;
}

.ai-header {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  padding: calc(0.75rem + var(--safe-top)) 1rem 0.75rem;
}

.ai-header-text h1 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.ai-header-text p {
  font-size: 12px;
  color: rgba(232, 234, 240, 0.55);
  margin-top: 0.15rem;
}

.ai-stage {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ai-orb-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 0 0.5rem;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.ai-orb-wrap.is-compact {
  padding: 0.5rem 0;
  transform: scale(0.72);
}

.ai-orb {
  position: relative;
  width: 180px;
  height: 180px;
  cursor: pointer;
  border: none;
  background: none;
}

.ai-orb-core {
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff 0%, transparent 35%),
    radial-gradient(circle at 50% 50%, var(--ai-cyan), var(--ai-violet) 55%, #4c1d95 100%);
  box-shadow:
    0 0 40px rgba(139, 92, 246, 0.55),
    0 0 80px rgba(34, 211, 238, 0.25),
    inset 0 0 20px rgba(255, 255, 255, 0.25);
  animation: orbPulse 3.2s ease-in-out infinite;
}

.ai-orb.is-listening .ai-orb-core {
  animation: orbListen 0.9s ease-in-out infinite;
  box-shadow:
    0 0 50px rgba(34, 211, 238, 0.7),
    0 0 100px rgba(139, 92, 246, 0.45),
    inset 0 0 24px rgba(255, 255, 255, 0.35);
}

.ai-orb.is-thinking .ai-orb-core {
  animation: orbThink 1.4s linear infinite;
}

.ai-orb-ring {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px solid rgba(139, 92, 246, 0.25);
  animation: ringSpin 10s linear infinite;
}

.ai-orb-ring--2 {
  inset: 0;
  border-color: rgba(34, 211, 238, 0.2);
  animation-duration: 14s;
  animation-direction: reverse;
}

.ai-orb-ring--3 {
  inset: 16%;
  border-color: rgba(244, 114, 182, 0.18);
  animation-duration: 8s;
}

.ai-orb-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.85;
}

.ai-orb-status {
  margin-top: 1rem;
  font-size: 13px;
  color: rgba(232, 234, 240, 0.6);
  text-align: center;
}

@keyframes orbPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes orbListen {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

@keyframes orbThink {
  to {
    filter: hue-rotate(60deg);
  }
}

@keyframes ringSpin {
  to {
    transform: rotate(360deg);
  }
}

.ai-chat {
  display: flex;
  flex-direction: column;
}

.ai-messages {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ai-bubble {
  max-width: 92%;
  padding: 0.75rem 0.9rem;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  animation: bubbleIn 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ai-bubble--user {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-right-radius: 4px;
  color: #fff;
}

.ai-bubble--bot {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(34, 211, 238, 0.2));
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-bottom-left-radius: 4px;
  color: #f3e8ff;
}

.ai-fields {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 0.85rem;
  backdrop-filter: blur(12px);
}

.ai-fields-title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(232, 234, 240, 0.5);
  margin-bottom: 0.65rem;
}

.ai-fields-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ai-field-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.25);
  min-width: 72px;
  animation: chipPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes chipPop {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.ai-field-chip span:first-child {
  font-size: 10px;
  color: rgba(232, 234, 240, 0.45);
}

.ai-field-chip span:last-child {
  font-size: 13px;
  font-weight: 600;
  color: #67e8f9;
}

.ai-results-wrap {
  margin: 0 -1rem;
}

.ai-results-wrap .tg-section-title {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(232, 234, 240, 0.5);
}

.ai-results-wrap .tg-row:active {
  background: rgba(255, 255, 255, 0.06);
}

.ai-results-wrap .tg-row-title,
.ai-results-wrap .tg-row-preview {
  color: inherit;
}

.ai-results-wrap .tg-row-title {
  color: #fff;
}

.ai-results-wrap .tg-row-preview,
.ai-results-wrap .tg-row-date {
  color: rgba(232, 234, 240, 0.55);
}

.ai-results-wrap .meta-chip {
  background: rgba(255, 255, 255, 0.06);
}

.ai-composer {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem;
  padding-bottom: calc(0.75rem + var(--safe-bottom));
  background: rgba(7, 8, 15, 0.85);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-mic-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(139, 92, 246, 0.4);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(34, 211, 238, 0.2));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.ai-mic-btn.is-on {
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.2), 0 0 24px rgba(34, 211, 238, 0.45);
  transform: scale(1.06);
}

.ai-input-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  height: 44px;
  padding: 0 0.35rem 0 0.85rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 14px;
  height: 100%;
}

.ai-input::placeholder {
  color: rgba(232, 234, 240, 0.35);
}

.ai-send {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ai-violet), var(--ai-cyan));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-send:active {
  transform: scale(0.94);
}

/* ========== Hub AI section ========== */
.hub-section-label {
  margin: 1.35rem 0 0.55rem;
  font-size: 12px;
  font-weight: 700;
  color: var(--tg-hint);
  letter-spacing: 0.04em;
}

.hub-section-label--ai {
  color: #a78bfa;
}

.hub-grid--10 {
  gap: 0.55rem;
}

.hub-card--priority {
  border-color: rgba(42, 171, 238, 0.28);
}

.hub-num {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--tg-link);
  background: color-mix(in srgb, var(--tg-link) 14%, transparent);
}

.hub-card--neon {
  border-color: rgba(139, 92, 246, 0.28);
}

.hub-card-icon--score {
  background: linear-gradient(135deg, #22d3ee, #8b5cf6);
  color: #fff;
  font-weight: 700;
}

.hub-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

.meta-chip--trust {
  color: #34c759;
  background: rgba(52, 199, 89, 0.14);
}

/* Flash search */
.flash-wrap {
  padding: 0.75rem 1rem 1rem;
}

.flash-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.flash-input {
  flex: 1;
  height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(42, 171, 238, 0.35);
  background: var(--tg-secondary);
  color: var(--tg-text);
  font: inherit;
  font-size: 16px;
  padding: 0 0.9rem;
  outline: none;
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.08);
}

.flash-input:focus {
  border-color: var(--tg-link);
}

.flash-go {
  height: 48px;
  padding: 0 1rem;
  border: none;
  border-radius: 14px;
  background: var(--tg-button);
  color: var(--tg-button-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.flash-suggest {
  margin-top: 0.75rem;
}

.suggest-label,
.hist-hint {
  font-size: 12px;
  color: var(--tg-hint);
  margin-bottom: 0.45rem;
}

.suggest-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip-btn {
  border: 0.5px solid var(--tg-separator);
  background: var(--tg-secondary);
  color: var(--tg-text);
  font: inherit;
  font-size: 12px;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}

.chip-btn--ai {
  border-color: rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.12);
}

.hist-block {
  margin-bottom: 0.5rem;
}

.hist-block h3 {
  font-size: 14px;
  margin-bottom: 0.5rem;
}

.hist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.btn-ghost--sm {
  height: 32px;
  padding: 0 0.65rem;
  font-size: 12px;
  flex: 0;
}

.hist-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hist-item {
  width: 100%;
  text-align: right;
  border: 0.5px solid var(--tg-separator);
  background: var(--tg-secondary);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  color: var(--tg-text);
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.hist-q {
  font-size: 14px;
  font-weight: 600;
}

.hist-meta {
  font-size: 11px;
  color: var(--tg-hint);
}

.floor-card,
.trust-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem;
  border-radius: 16px;
  background: var(--tg-secondary);
  border: 0.5px solid var(--tg-separator);
}

.floor-gap {
  width: 64px;
  flex-shrink: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: #34c759;
  line-height: 1.1;
}

.floor-gap small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--tg-hint);
}

.floor-main h3,
.trust-card h3 {
  font-size: 15px;
}

.floor-main p span {
  color: var(--tg-hint);
  font-size: 12px;
  margin-right: 0.35rem;
}

.trust-score {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: rgba(52, 199, 89, 0.15);
  color: #34c759;
  flex-shrink: 0;
}

.trust-line {
  font-size: 12px;
  color: var(--tg-hint);
  margin: 0.25rem 0;
}

.shield-toolbar {
  display: flex;
  gap: 0.4rem;
  padding: 0.65rem 1rem 0;
  overflow-x: auto;
}

.shield-block {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 12px;
  color: #ff9f0a;
}

.heat-go {
  border: none;
  background: rgba(34, 211, 238, 0.15);
  color: #67e8f9;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
}

.restock-block {
  margin-bottom: 0.75rem;
}

.restock-block h3 {
  font-size: 15px;
  margin-bottom: 0.25rem;
}

.page-header-sub {
  font-size: 12px;
  color: var(--tg-hint);
  margin-top: 0.1rem;
}

.page-header--dark {
  background: #0b0d16;
  border-bottom-color: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.page-header--dark .page-header-title {
  color: #fff;
}

.page-header--dark .page-header-sub {
  color: rgba(255, 255, 255, 0.45);
}

/* ========== Lab screens ========== */
.view-lab .lab-body {
  padding: 0.75rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.view-lab--dark {
  background: #07080f;
  color: #e8eaf0;
}

.lab-banner {
  margin: 0.75rem 1rem 0;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  background: color-mix(in srgb, var(--tg-link) 12%, var(--tg-secondary));
  color: var(--tg-text);
}

.lab-banner--warn {
  background: rgba(255, 149, 0, 0.12);
  color: #ffb340;
}

.lab-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #a78bfa;
  margin-bottom: 0.25rem;
}

.lab-h3 {
  font-size: 14px;
  margin: 0.5rem 0 0.25rem;
  color: rgba(255, 255, 255, 0.7);
}

.lab-link {
  margin-top: 0.55rem;
  border: none;
  background: none;
  color: var(--tg-link);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-align: right;
}

.iq-card,
.risk-card,
.oracle-card,
.coach-panel {
  border: 0.5px solid var(--tg-separator);
  background: var(--tg-secondary);
  border-radius: 16px;
  padding: 0.9rem;
  animation: bubbleIn 0.45s ease both;
}

.iq-card--high {
  border-color: rgba(52, 199, 89, 0.45);
}

.iq-card--good {
  border-color: rgba(42, 171, 238, 0.35);
}

.iq-card--low {
  border-color: rgba(255, 69, 58, 0.35);
}

.iq-top,
.risk-top {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.iq-gauge {
  --p: 50;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: conic-gradient(#34c759 calc(var(--p) * 1%), rgba(255, 255, 255, 0.08) 0);
  position: relative;
}

.iq-gauge::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--tg-secondary);
}

.iq-gauge span {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 700;
}

.iq-gauge--sm {
  width: 48px;
  height: 48px;
  margin-top: 0.5rem;
}

.iq-meta h3 {
  font-size: 15px;
  font-weight: 600;
}

.iq-meta p {
  font-size: 12px;
  color: var(--tg-hint);
  margin-top: 0.15rem;
}

.iq-label {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 11px;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgba(52, 199, 89, 0.15);
  color: #34c759;
}

.iq-card--low .iq-label {
  background: rgba(255, 69, 58, 0.15);
  color: #ff453a;
}

.iq-reasons {
  list-style: none;
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.iq-reasons li {
  font-size: 12px;
  color: var(--tg-hint);
  line-height: 1.4;
}

.iq-reasons .is-ok {
  color: #34c759;
}

.iq-reasons .is-bad {
  color: #ff9f0a;
}

.risk-meter {
  width: 64px;
  text-align: center;
  flex-shrink: 0;
}

.risk-meter b {
  display: block;
  font-size: 22px;
  font-weight: 800;
}

.risk-meter span {
  font-size: 11px;
  color: var(--tg-hint);
}

.risk-card--danger {
  border-color: rgba(255, 69, 58, 0.45);
}

.risk-card--warn {
  border-color: rgba(255, 159, 10, 0.4);
}

.risk-card--safe {
  border-color: rgba(52, 199, 89, 0.35);
}

.risk-card--danger .risk-meter b {
  color: #ff453a;
}

.risk-card--warn .risk-meter b {
  color: #ff9f0a;
}

.risk-card--safe .risk-meter b {
  color: #34c759;
}

.pick-grid {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.pick-card {
  text-align: right;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 0.5px solid var(--tg-separator);
  background: var(--tg-secondary);
  color: var(--tg-text);
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.pick-card span {
  font-size: 12px;
  color: var(--tg-hint);
}

.pick-card.is-on {
  border-color: var(--tg-link);
  box-shadow: inset 0 0 0 1px var(--tg-link);
}

.verdict {
  padding: 1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(34, 211, 238, 0.12));
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.verdict h2 {
  font-size: 20px;
  margin: 0.25rem 0;
}

.verdict p {
  font-size: 13px;
  color: var(--tg-hint);
}

.vs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.vs-card {
  padding: 0.75rem;
  border-radius: 14px;
  background: var(--tg-secondary);
  border: 0.5px solid var(--tg-separator);
  font-size: 12px;
  color: var(--tg-hint);
}

.vs-card h3 {
  color: var(--tg-text);
  font-size: 13px;
  margin: 0.35rem 0;
}

.vs-card.is-win {
  border-color: rgba(52, 199, 89, 0.5);
}

.vs-tag {
  font-size: 10px;
  font-weight: 700;
  color: #a78bfa;
}

.pulse-hero {
  padding: 1rem;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(139, 92, 246, 0.25), rgba(7, 8, 15, 0.2));
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.pulse-hero h2 {
  font-size: 20px;
  margin: 0.4rem 0;
  color: #fff;
}

.pulse-hero p {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(232, 234, 240, 0.65);
}

.pulse-live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 11px;
  font-weight: 700;
  color: #34c759;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34c759;
  box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.6);
  animation: livePulse 1.6s ease infinite;
}

@keyframes livePulse {
  70% {
    box-shadow: 0 0 0 10px rgba(52, 199, 89, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 199, 89, 0);
  }
}

.pulse-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.pulse-stat {
  padding: 0.7rem 0.4rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}

.pulse-stat b {
  display: block;
  font-size: 18px;
  color: #67e8f9;
}

.pulse-stat span {
  font-size: 10px;
  color: rgba(232, 234, 240, 0.45);
}

.heat-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.45rem 0;
}

.heat-label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: rgba(232, 234, 240, 0.45);
}

.heat-label strong {
  font-size: 13px;
  color: #fff;
}

.heat-bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.heat-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b5cf6, #22d3ee);
}

.pulse-ai-note {
  margin-top: 0.5rem;
  padding: 0.85rem;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.2);
  color: #a5f3fc;
}

/* Toast */
.tg-toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + var(--safe-bottom));
  z-index: 100;
  max-width: calc(100% - 2.5rem);
  transform: translateX(-50%) translateY(10px);
  padding: 0.65rem 1rem;
  border-radius: 12px;
  background: rgba(40, 40, 40, 0.92);
  color: #fff;
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.tg-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 560px) {
  .app {
    max-width: 480px;
    margin-inline: auto;
    border-inline: 0.5px solid var(--tg-separator);
    min-height: 100dvh;
  }
}
