html.ai-page-root,
body.ai-page {
  height: auto !important;
  min-height: 100vh;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  background: #030712 !important;
}

body.ai-page .ai-page-stage {
  width: 100%;
  min-height: calc(100vh - var(--menu-h, 122px));
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: visible;
  box-sizing: border-box;
  padding: 34px 0 48px;
  background: transparent;
}

body.ai-page .ai-page-layer {
  width: 960px;
  max-width: none;
  transform: scale(var(--ai-page-scale, 1));
  transform-origin: top center;
}

body.ai-page .ai-page-head {
  margin: 0 0 18px;
}

body.ai-page .ai-page-head h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: #f8fafc;
  font-size: 29px;
  line-height: 1.18;
  font-weight: 900;
}

body.ai-page .ai-page-head svg {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  fill: none;
  stroke: #fbbf24;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.ai-page .ai-page-head .ai-page-engine-label,
body.ai-page .ai-page-head .ai-page-description {
  margin: 8px 0 0 42px;
  font-size: 14px;
  line-height: 1.6;
}

body.ai-page .ai-page-head .ai-page-engine-label {
  color: #bae6fd;
  font-weight: 800;
}

body.ai-page .ai-page-head .ai-page-description {
  margin-top: 2px;
  color: #94a3b8;
}

body.ai-page .ai-points-card {
  padding: 24px;
  border: 1px solid rgba(139, 92, 246, 0.42);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(8, 13, 29, 0.8));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.ai-page .ai-points-card-head,
body.ai-page .ai-points-value-row,
body.ai-page .ai-points-meta,
body.ai-page .ai-page-actions {
  display: flex;
  align-items: center;
}

body.ai-page .ai-points-card-head {
  justify-content: space-between;
  gap: 16px;
  color: #cbd5e1;
  font-size: 15px;
  font-weight: 800;
}

body.ai-page .ai-page-status {
  color: #7dd3fc;
  font-size: 14px;
}

body.ai-page .ai-page-status.error { color: #fca5a5; }
body.ai-page .ai-page-status.ready { color: #86efac; }
body.ai-page .ai-page-status.trial { color: #fcd34d; }

body.ai-page .ai-points-value-row {
  align-items: baseline;
  gap: 14px;
  margin-top: 20px;
  color: #94a3b8;
  font-size: 18px;
  font-weight: 700;
}

body.ai-page .ai-points-value-row > strong {
  color: #fbbf24;
  font-size: 54px;
  line-height: 1;
  font-weight: 950;
  text-shadow: 0 0 24px rgba(251, 191, 36, 0.22);
}

body.ai-page .ai-points-track {
  height: 8px;
  margin-top: 24px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(51, 65, 85, 0.72);
}

body.ai-page .ai-points-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0284c7, #38bdf8, #fbbf24);
  transition: width 0.25s ease;
}

body.ai-page .ai-points-meta {
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  color: #94a3b8;
  font-size: 14px;
}

body.ai-page .ai-page-entitlement-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 7px;
  color: #cbd5e1;
  background: rgba(2, 6, 23, 0.36);
  font-size: 13px;
  line-height: 1.55;
}

body.ai-page .ai-page-entitlement-note.trial {
  border-color: rgba(251, 191, 36, 0.32);
  color: #fde68a;
  background: rgba(120, 53, 15, 0.14);
}

body.ai-page .ai-page-actions {
  gap: 10px;
  margin-top: 26px;
}

body.ai-page .ai-page-actions .btn.primary {
  border: 1px solid rgba(251, 191, 36, 0.55) !important;
  background: rgba(251, 191, 36, 0.10) !important;
  color: #fbbf24 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

body.ai-page .ai-page-actions .btn.primary:hover,
body.ai-page .ai-page-actions .btn.primary:active {
  border-color: rgba(251, 191, 36, 0.72) !important;
  background: rgba(251, 191, 36, 0.16) !important;
  color: #fef3c7 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

body.ai-page .ai-page-actions .btn {
  min-height: 44px;
  text-decoration: none;
}

body.ai-page .ai-info-card {
  margin-top: 18px;
  padding: 26px 28px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.86), rgba(8, 13, 29, 0.78));
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

@media (max-width: 768px) {
  body.ai-page .ai-page-stage { padding: 22px 16px 40px; }
  body.ai-page .ai-page-head h1 { font-size: 28px; }
  body.ai-page .ai-page-head .ai-page-engine-label,
  body.ai-page .ai-page-head .ai-page-description { margin-left: 0; font-size: 16px; line-height: 1.6; }
  body.ai-page .ai-points-card,
  body.ai-page .ai-info-card { padding: 18px 16px; }
  body.ai-page .ai-points-card-head,
  body.ai-page .ai-points-meta { font-size: 14px; }
  body.ai-page .ai-page-entitlement-note { font-size: 14px; }
  body.ai-page .ai-page-actions .btn { min-height: 44px; font-size: 14px; }
}

body.ai-page .ai-section-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

body.ai-page .ai-section-head > svg {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  margin-top: 2px;
  fill: none;
  stroke: #fbbf24;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.ai-page .ai-section-head h3 {
  margin: 0;
  color: #f8fafc;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 900;
}

body.ai-page .ai-section-head p {
  margin: 5px 0 0;
  color: #94a3b8;
  font-size: 14px;
  line-height: 1.55;
}

body.ai-page .ai-rate-grid,
body.ai-page .ai-plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

body.ai-page .ai-rate-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 7px;
  background: rgba(2, 6, 23, 0.46);
}

body.ai-page .ai-rate-item strong {
  color: #fbbf24;
  font-size: 20px;
  line-height: 1;
}

body.ai-page .ai-rate-item span {
  color: #dbeafe;
  font-size: 14px;
  font-weight: 700;
}

body.ai-page .ai-info-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 24px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

body.ai-page .ai-info-list li {
  position: relative;
  padding-left: 17px;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.55;
}

body.ai-page .ai-info-list li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
}

body.ai-page .ai-plan-item {
  position: relative;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 7px;
  background: rgba(2, 6, 23, 0.5);
}

body.ai-page .ai-plan-item.current {
  border-color: rgba(56, 189, 248, 0.75);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2), 0 0 20px rgba(14, 165, 233, 0.12);
}

body.ai-page .ai-plan-current {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 7px;
  border-radius: 6px;
  color: #bae6fd;
  background: rgba(14, 116, 144, 0.32);
  font-size: 11px;
  font-weight: 800;
}

body.ai-page .ai-plan-item.current .ai-plan-current { display: inline-flex; }

body.ai-page .ai-plan-item h4 {
  margin: 0 0 9px;
  color: #f8fafc;
  font-size: 16px;
  font-weight: 900;
}

body.ai-page .ai-plan-item > strong {
  display: block;
  color: #fbbf24;
  font-size: 19px;
}

body.ai-page .ai-plan-item p {
  margin: 12px 0 6px;
  color: #cbd5e1;
  font-size: 13px;
}

body.ai-page .ai-plan-item b,
body.ai-page .ai-plan-item small {
  display: block;
}

body.ai-page .ai-plan-item b { color: #7dd3fc; font-size: 15px; }
body.ai-page .ai-plan-item small { margin-top: 4px; color: #94a3b8; font-size: 12px; }

body.ai-page .ai-plan-note {
  margin: 16px 0 0;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.6;
}

body.ai-page .ai-plan-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 14px;
  padding: 0 14px;
  border: 1px solid rgba(251, 191, 36, 0.42);
  border-radius: 7px;
  color: #fde68a;
  background: rgba(120, 53, 15, 0.18);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 768px), (orientation: portrait) and (min-width: 769px) and (max-width: 1180px) {
  body.ai-page .ai-page-stage { padding: 16px 0 34px; }
  body.ai-page .ai-page-layer { width: 390px; }
  body.ai-page .ai-page-head,
  body.ai-page .ai-points-card,
  body.ai-page .ai-info-card { width: calc(100% - 28px); margin-left: auto; margin-right: auto; box-sizing: border-box; }
  body.ai-page .ai-page-head h1 { font-size: 23px; }
  body.ai-page .ai-page-head svg { width: 23px; height: 23px; flex-basis: 23px; }
  body.ai-page .ai-page-head .ai-page-engine-label { margin: 6px 0 0; font-size: 14px; }
  body.ai-page .ai-page-head .ai-page-description { margin: 2px 0 0; font-size: 12px; }
  body.ai-page .ai-points-card { padding: 17px 15px; }
  body.ai-page .ai-points-card-head { font-size: 13px; }
  body.ai-page .ai-points-value-row { gap: 7px; font-size: 14px; }
  body.ai-page .ai-points-value-row > strong { font-size: 40px; }
  body.ai-page .ai-points-meta { align-items: flex-start; flex-direction: column; gap: 5px; }
  body.ai-page .ai-page-actions { display: grid; grid-template-columns: 1fr 1fr; }
  body.ai-page .ai-page-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    height: 44px;
    padding: 0 8px;
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
  }
  body.ai-page .ai-info-card { padding: 19px 16px; }
  body.ai-page .ai-section-head h3 { font-size: 17px; }
  body.ai-page .ai-section-head p { font-size: 12px; }
  body.ai-page .ai-rate-grid,
  body.ai-page .ai-plan-grid,
  body.ai-page .ai-info-list { grid-template-columns: 1fr; }
  body.ai-page .ai-rate-grid { gap: 7px; margin-top: 15px; }
  body.ai-page .ai-rate-item { padding: 11px 13px; }
  body.ai-page .ai-rate-item strong { width: 40px; font-size: 18px; }
  body.ai-page .ai-info-list { gap: 7px; margin-top: 14px; }
  body.ai-page .ai-plan-grid { gap: 8px; margin-top: 15px; }
  body.ai-page .ai-plan-item { padding: 15px; }
}

/* Portrait tablets use their available canvas instead of inheriting the phone-width layer. */
@media (orientation: portrait) and (min-width: 769px) and (max-width: 1180px) {
  body.ai-page .ai-page-layer {
    width: min(960px, calc(100vw - 28px));
  }

  body.ai-page .ai-page-head,
  body.ai-page .ai-points-card,
  body.ai-page .ai-info-card {
    width: 100%;
  }
}

/* Keep the legibility layer last so legacy compact rules cannot shrink mobile copy. */
html.ai-page-root,
body.ai-page { background: var(--km-canvas, #030712) !important; }

body.ai-page .ai-points-card,
body.ai-page .ai-info-card {
  border-color: var(--km-line-soft, #263b59);
  background: var(--km-surface, #0b1426);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

body.ai-page .ai-rate-item,
body.ai-page .ai-plan-item,
body.ai-page .ai-page-entitlement-note {
  border-color: var(--km-line-soft, #263b59);
  background: var(--km-surface-raised, #101d34);
}

body.ai-page .ai-page-head .ai-page-description,
body.ai-page .ai-section-head p,
body.ai-page .ai-info-list li,
body.ai-page .ai-plan-item p,
body.ai-page .ai-plan-item small,
body.ai-page .ai-plan-note,
body.ai-page .ai-points-meta {
  color: var(--km-muted, #c7d0de);
}

@media (max-width: 768px), (orientation: portrait) and (min-width: 769px) and (max-width: 1180px) {
  body.ai-page .ai-page-stage { padding: 22px 0 40px; }
  body.ai-page .ai-page-head h1 { font-size: 28px; }
  body.ai-page .ai-page-head .ai-page-engine-label,
  body.ai-page .ai-page-head .ai-page-description,
  body.ai-page .ai-section-head p { font-size: 16px; line-height: 1.6; }
  body.ai-page .ai-points-card-head,
  body.ai-page .ai-points-meta,
  body.ai-page .ai-rate-item span,
  body.ai-page .ai-info-list li,
  body.ai-page .ai-page-entitlement-note,
  body.ai-page .ai-plan-item p,
  body.ai-page .ai-plan-note { font-size: 14px; }
  body.ai-page .ai-page-actions .btn,
  body.ai-page .ai-plan-link { min-height: 44px; font-size: 14px; }
}
