/* Limit — header SUPPER AI (trắng–xanh, bridge với theme SP tối) */
body.fx-limit-shell {
  padding-top: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}

/* Palette bridge: landing mint + SP emerald #2dd4a0 */
header.sticky.limit-app-header--light {
  --lh-bg-top: #f0faf5;
  --lh-bg-bottom: #dcefe6;
  --lh-bg-soft: #e8f4ed;
  --lh-line: rgba(45, 212, 160, 0.32);
  --lh-line-soft: #b8dcc8;
  --lh-green: #2dd4a0;
  --lh-green-mid: #3d9e7a;
  --lh-green-deep: #1a8f68;
  --lh-text: #152420;
  --lh-muted: #4a6358;
  position: relative;
  isolation: isolate;
}

/* Ẩn logo SP trong header */
header.sticky div.flex.min-w-0.items-center.gap-3,
body.fx-limit-shell header.sticky div.flex.min-w-0.items-center.gap-3 {
  display: none !important;
}

.fx-limit-site-nav {
  display: none !important;
}

/* Header trắng–xanh — đồng bộ landing + accent SP */
header.sticky.limit-app-header--light {
  background: linear-gradient(180deg, var(--lh-bg-top) 0%, var(--lh-bg-bottom) 100%) !important;
  background-color: var(--lh-bg-top) !important;
  border-bottom: 1px solid var(--lh-line) !important;
  border-bottom-color: var(--lh-line) !important;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow:
    0 1px 0 rgba(45, 212, 160, 0.22),
    0 6px 28px rgba(5, 8, 7, 0.35);
}

/* Dải chuyển mint → nền tối (main, vì shell overflow-hidden cắt ::after header) */
body.fx-limit-shell div.relative.min-h-screen.overflow-hidden > main {
  position: relative;
}

body.fx-limit-shell div.relative.min-h-screen.overflow-hidden > main::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 40px;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(
    180deg,
    #d4ebe2 0%,
    rgba(8, 14, 11, 0.72) 62%,
    transparent 100%
  );
}

header.limit-app-header--light > .mx-auto {
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  min-height: 60px;
  height: auto;
  padding-top: 0.625rem;
  padding-bottom: 0.625rem;
}

header.limit-app-header--light .limit-app-header__logo {
  margin-right: auto;
}

header.limit-app-header--light .rounded-full.border {
  border-color: var(--lh-line) !important;
  background: rgba(45, 212, 160, 0.07) !important;
}

header.limit-app-header--light .text-zinc-600 {
  color: var(--lh-muted) !important;
}

header.limit-app-header--light .text-zinc-500 {
  color: var(--lh-green-deep) !important;
}

/* Logo landing trong header */
header.limit-app-header--light .lp-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  flex-shrink: 0;
}

header.limit-app-header--light .lp-logo__mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--lh-green-mid) 0%, var(--lh-green) 100%);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 8px rgba(45, 212, 160, 0.28);
}

header.limit-app-header--light .lp-logo__text {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--lh-text);
  letter-spacing: -0.03em;
}

header.limit-app-header--light .lp-logo__text em {
  font-style: normal;
  color: var(--lh-green-deep);
  font-weight: 800;
}

/* Nút menu */
header.limit-app-header--light button#limit-nav-toggle.lp-nav-toggle {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: center !important;
  gap: 5px !important;
  width: 2.25rem !important;
  height: 2.25rem !important;
  min-width: 2.25rem !important;
  min-height: 2.25rem !important;
  padding: 0.35rem !important;
  margin-left: 0.25rem !important;
  border: 1px solid var(--lh-line-soft) !important;
  border-radius: 8px !important;
  background: var(--lh-bg-soft) !important;
  cursor: pointer !important;
  box-shadow: none !important;
  appearance: none !important;
  flex-shrink: 0 !important;
}

header.limit-app-header--light button#limit-nav-toggle span {
  display: block !important;
  width: 100% !important;
  height: 1.5px !important;
  border-radius: 1px !important;
  background: var(--lh-muted) !important;
}

header.limit-app-header--light button#limit-nav-toggle:hover {
  border-color: rgba(45, 212, 160, 0.35) !important;
  background: rgba(45, 212, 160, 0.08) !important;
}

header.limit-app-header--light button#limit-nav-toggle[aria-expanded="true"] {
  border-color: var(--lh-green) !important;
  background: rgba(45, 212, 160, 0.1) !important;
}

/* Nav panel */
header.limit-app-header--light .lp-nav-link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--lh-muted);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

header.limit-app-header--light .lp-nav-link:hover {
  color: var(--lh-green-deep);
  background: rgba(45, 212, 160, 0.06);
}

header.limit-app-header--light .lp-nav-link--active {
  color: var(--lh-green-deep);
  background: rgba(45, 212, 160, 0.1);
  font-weight: 600;
}

header.limit-app-header--light .lp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

header.limit-app-header--light .lp-btn--primary {
  background: linear-gradient(135deg, var(--lh-green-mid) 0%, var(--lh-green) 100%);
  border-color: var(--lh-green-mid);
  color: #fff;
  box-shadow: 0 2px 10px rgba(45, 212, 160, 0.22);
}

header.limit-app-header--light .lp-btn--primary:hover {
  filter: brightness(1.04);
}

header.limit-app-header--light .lp-btn--ghost {
  background: transparent;
  border-color: var(--lh-line-soft);
  color: #3f5249;
}

header.limit-app-header--light .lp-btn--ghost:hover {
  border-color: rgba(45, 212, 160, 0.35);
  background: rgba(45, 212, 160, 0.06);
  color: var(--lh-green-deep);
}

header.limit-app-header--light .lp-btn--text {
  background: transparent;
  border: none;
  color: #6d7f76;
}

header.limit-app-header--light .lp-user {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--lh-green-deep);
}

header.limit-app-header--light .lp-nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

header.limit-app-header--light .lp-nav-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

header.limit-app-header--light .lp-nav-actions.hidden {
  display: none !important;
}

@media (max-width: 1023px) {
  header.limit-app-header--light .limit-app-header__panel:not(.hidden) {
    order: 10;
    flex-basis: 100%;
    width: 100%;
    padding: 0.875rem;
    border: 1px solid var(--lh-line-soft);
    border-radius: 12px;
    background: var(--lp-white, #fff);
    box-shadow: 0 1px 2px rgba(21, 36, 32, 0.04), 0 8px 24px rgba(21, 36, 32, 0.06);
  }

  header.limit-app-header--light .lp-nav-links {
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--lh-line-soft);
  }

  header.limit-app-header--light .lp-nav-actions {
    flex-direction: row;
    flex-wrap: wrap;
    margin-top: 0;
    gap: 0.5rem;
  }

  header.limit-app-header--light .lp-nav-actions .lp-btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-height: 40px;
    justify-content: center;
  }

  header.limit-app-header--light .lp-nav-actions .lp-btn--text,
  header.limit-app-header--light .lp-nav-actions .lp-user {
    flex: 1 1 100%;
    text-align: center;
  }

  header.limit-app-header--light button#limit-nav-toggle {
    order: 10;
    margin-left: auto !important;
  }

  header.limit-app-header--light > .mx-auto {
    min-height: 56px;
    height: 56px;
    padding-top: 0;
    padding-bottom: 0;
  }
}

@media (min-width: 1024px) {
  header.limit-app-header--light button#limit-nav-toggle {
    display: none !important;
  }

  header.limit-app-header--light > .mx-auto {
    flex-wrap: nowrap;
    height: 60px;
    padding-top: 0;
    padding-bottom: 0;
  }

  header.limit-app-header--light .limit-app-header__logo {
    margin-right: 0;
  }

  header.limit-app-header--light .limit-app-header__panel {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    width: auto;
    margin-left: auto;
    margin-right: 0.5rem;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  header.limit-app-header--light .limit-app-header__panel.hidden {
    display: flex !important;
  }

  header.limit-app-header--light .lp-nav-links {
    flex-direction: row;
    margin-right: 0.5rem;
  }

  header.limit-app-header--light .lp-nav-actions {
    flex-direction: row;
    align-items: center;
    margin-top: 0;
    margin-left: 0.25rem;
  }
}

/* Hero badge — thay khối SP trùng lặp */
body.fx-limit-shell main div.mb-8[data-hero-patched="1"] {
  margin-bottom: 1.25rem !important;
}

.limit-hero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem 0.5rem 0.8rem;
  border-radius: 9999px;
  border: 1px solid rgba(45, 212, 160, 0.3);
  background: linear-gradient(
    135deg,
    rgba(45, 212, 160, 0.1) 0%,
    rgba(5, 8, 7, 0.55) 100%
  );
  box-shadow:
    0 0 0 1px rgba(45, 212, 160, 0.06) inset,
    0 8px 28px rgba(0, 0, 0, 0.28);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.limit-hero-badge__dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2dd4a0;
  box-shadow: 0 0 10px rgba(45, 212, 160, 0.75);
  animation: limit-hero-pulse 2.2s ease-in-out infinite;
}

.limit-hero-badge__label {
  color: #3de0ad;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.limit-hero-badge__sep {
  color: rgba(45, 212, 160, 0.45);
  font-weight: 400;
}

.limit-hero-badge__sub {
  color: rgba(201, 230, 216, 0.82);
  font-weight: 600;
  letter-spacing: 0.1em;
}

@keyframes limit-hero-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.65;
    transform: scale(0.88);
  }
}

/* Countdown / hold nút phân tích */
@keyframes limit-hold-glow {
  0%,
  100% {
    box-shadow:
      0 0 14px rgba(56, 189, 248, 0.28),
      0 0 32px rgba(99, 102, 241, 0.16),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border-color: rgba(56, 189, 248, 0.42);
  }
  50% {
    box-shadow:
      0 0 22px rgba(56, 189, 248, 0.48),
      0 0 44px rgba(129, 140, 248, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.12);
    border-color: rgba(125, 211, 252, 0.72);
  }
}

@keyframes limit-hold-shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes limit-hold-tick {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.92; transform: scale(1.03); }
}

button.limit-reanalyze-hold {
  cursor: not-allowed !important;
  opacity: 1 !important;
  pointer-events: none !important;
  background: linear-gradient(
    135deg,
    rgba(8, 47, 73, 0.72),
    rgba(49, 46, 129, 0.55),
    rgba(14, 116, 144, 0.62)
  ) !important;
  background-size: 220% 220% !important;
  animation: limit-hold-shimmer 5s ease infinite, limit-hold-glow 2.4s ease-in-out infinite;
  border: 1px solid rgba(56, 189, 248, 0.48) !important;
  color: #bae6fd !important;
}

button.limit-reanalyze-hold .limit-reanalyze-timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 0.45rem;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(125, 211, 252, 0.35);
  color: #e0f2fe;
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

button.limit-reanalyze-ready {
  background: linear-gradient(135deg, rgba(45, 212, 160, 0.3), rgba(16, 185, 129, 0.22)) !important;
  border: 1px solid rgba(52, 211, 153, 0.58) !important;
  color: #a7f3d0 !important;
  box-shadow: 0 0 18px rgba(45, 212, 160, 0.22) !important;
  animation: none !important;
}

@media (max-width: 639px) {
  body.fx-limit-shell main .max-w-2xl.pb-28 {
    padding-bottom: 5.25rem !important;
  }

  body.fx-limit-shell div.fixed.inset-x-0.bottom-0.z-40 {
    padding: 0.5rem 0.625rem !important;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px)) !important;
  }

  body.fx-limit-shell div.fixed.inset-x-0.bottom-0 .mx-auto.flex.max-w-2xl {
    gap: 0.375rem !important;
    max-width: 100% !important;
  }

  body.fx-limit-shell div.fixed.inset-x-0.bottom-0 .mx-auto.flex.max-w-2xl > button {
    height: 2.25rem !important;
    min-height: 2.25rem !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    font-size: 0.6875rem !important;
    border-radius: 0.5rem !important;
    white-space: nowrap !important;
  }
}
