/* Phone and tablet layout. Load after style.css / results-fix.css. */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.upload-cta-narrow {
  display: none;
}

@media (max-width: 768px) {
  html {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-x: none;
  }

  body {
    overflow-x: hidden !important;
    overflow-y: visible !important;
    overscroll-behavior-x: none;
  }

  body {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body::before {
    display: none;
  }

  body::after {
    opacity: 0.55;
  }

  /* Scan deck is position:fixed; a document scrollbar would leave a gray gutter. */
  html:has(#analyzer.slide-mode.active),
  body:has(#analyzer.slide-mode.active) {
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  body:has(#analyzer.slide-mode.active) {
    padding-bottom: 0 !important;
  }

  /* Notch-safe header */
  .top-navbar {
    padding: env(safe-area-inset-top, 0px) max(10px, env(safe-area-inset-right, 0px)) 0 max(10px, env(safe-area-inset-left, 0px)) !important;
    height: calc(60px + env(safe-area-inset-top, 0px)) !important;
    gap: 8px !important;
    overflow: visible !important;
    align-items: center !important;
  }

  .nav-logo {
    font-size: 1.12rem !important;
    font-weight: 750 !important;
    gap: 8px !important;
    min-width: 0 !important;
    letter-spacing: -0.02em !important;
  }

  .nav-logo-text {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-logo-icon {
    width: 24px !important;
    height: 24px !important;
  }

  .nav-top-right {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    flex-shrink: 0 !important;
    height: 36px !important;
  }

  /* Three matching 36×36 circles. flex-basis beats leftover pill width from hidden "Unlimited". */
  header.top-navbar .nav-top-right > .coin-nav-balance,
  header.top-navbar .nav-top-right > .theme-toggle-btn,
  header.top-navbar .nav-top-right > .profile-chip {
    display: flex !important;
    flex: 0 0 36px !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    justify-content: center !important;
    align-items: center !important;
    align-self: center !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    aspect-ratio: 1 / 1 !important;
    position: relative !important;
    white-space: nowrap !important;
  }

  header.top-navbar .coin-nav-balance .coin-balance-value {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    font-size: 0 !important;
  }

  header.top-navbar .coin-nav-balance .coin-nav-icon,
  header.top-navbar .coin-nav-balance .coin-nav-icon svg {
    width: 16px !important;
    height: 16px !important;
    display: block !important;
    flex-shrink: 0 !important;
  }

  header.top-navbar .profile-chip-name {
    display: none !important;
  }

  /* Flatten nested guest/initials disc — chip is the only circle. */
  header.top-navbar .profile-chip .profile-avatar:not(.profile-avatar-img) {
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
  }

  header.top-navbar .profile-chip .profile-avatar-guest svg,
  header.top-navbar .profile-chip .profile-avatar svg {
    width: 16px !important;
    height: 16px !important;
  }

  header.top-navbar .profile-chip .profile-avatar-img {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    position: absolute !important;
    inset: 0 !important;
    object-fit: cover !important;
  }

  .mobile-bottom-nav {
    min-height: 62px !important;
    padding: 4px 0 calc(6px + env(safe-area-inset-bottom, 0px)) !important;
    gap: 0 !important;
  }

  .mobile-nav-btn {
    min-height: 48px !important;
    padding: 4px 0 2px !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .mobile-nav-btn .lbl {
    font-size: 8.5px !important;
    max-width: 100%;
    overflow: hidden;
    white-space: normal !important;
    text-align: center;
    line-height: 1.1 !important;
  }

  section.section.page {
    scroll-margin-top: calc(60px + env(safe-area-inset-top, 0px));
    min-width: 0;
  }

  #home,
  #analyzer:not(.slide-mode),
  #results,
  #ethnicities,
  #about,
  #coinstore,
  #familytree,
  #yamnaya,
  #lookalike {
    padding-left: 14px;
    padding-right: 14px;
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: clip;
  }

  /* Results: room for top nav + bottom tab bar, tighter horizontal edges */
  #results {
    padding-top: calc(72px + env(safe-area-inset-top, 0px));
    padding-bottom: 24px;
  }

  #coinstore,
  #familytree {
    padding-top: calc(88px + env(safe-area-inset-top, 0px));
    padding-bottom: 40px;
    min-height: 0;
  }

  #about {
    padding-top: calc(88px + env(safe-area-inset-top, 0px));
  }

  /* Tap-friendly primary actions */
  .btn-primary,
  .btn-secondary,
  .btn-analyze,
  .scan-package-buy-btn,
  .ctrl-btn-capture,
  .ctrl-btn-clear,
  .btn-unlock {
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .btn-primary,
  .btn-secondary {
    justify-content: center;
  }

  input,
  select,
  textarea {
    font-size: 16px;
    max-width: 100%;
  }

  /* Hero / home */
  .section-sub,
  .hero-sub,
  .upload-hint,
  .analyzer-header .section-sub,
  .scan-shop-heading .section-sub,
  .scan-shop-sub {
    color: var(--text-md, #9A9390);
  }

  .cred-section {
    padding: 8px 0 28px;
  }

  .cred-block {
    margin-bottom: 48px;
  }

  .cred-reviews-grid {
    grid-template-columns: 1fr;
  }

  .community-globe-section {
    padding: 40px 0 24px;
  }

  .community-globe-wrapper {
    height: min(52vw, 280px);
    margin-top: 16px;
  }

  .feature-strip {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .feat-card:hover {
    transform: none;
  }

  /* Analyzer */
  .analyzer-steps li {
    min-width: 0;
  }

  /* Step 1: one title, the drop zone, quiet tips — no stacked warnings */
  #analyzer[data-analyzer-step="1"] .analyzer-header {
    margin-bottom: 16px;
  }

  #analyzer[data-analyzer-step="1"] .analyzer-header .section-eyebrow {
    font-size: 10px;
    letter-spacing: 0.12em;
    margin-bottom: 6px;
  }

  #analyzer[data-analyzer-step="1"] .analyzer-header .section-title {
    font-size: 22px;
    line-height: 1.2;
  }

  #analyzer[data-analyzer-step="1"] .analyzer-header .section-sub {
    display: none;
  }

  #analyzer[data-analyzer-step="1"] .analyzer-steps {
    margin-top: 12px;
    gap: 4px;
  }

  #analyzer[data-analyzer-step="1"] .panel-header,
  #analyzer[data-analyzer-step="1"] .status-bar {
    display: none;
  }

  #analyzer[data-analyzer-step="1"] .camera-panel {
    background: transparent;
    border: none;
    box-shadow: none;
  }

  #analyzer[data-analyzer-step="1"] .upload-zone {
    margin: 0;
    padding: 36px 16px;
    min-height: 220px;
  }

  .upload-cta-wide {
    display: none;
  }

  .upload-cta-narrow {
    display: inline;
  }

  #analyzer[data-analyzer-step="1"] .photo-tips {
    margin: 12px 0 0;
    padding: 0;
    border: none;
    background: transparent;
  }

  #analyzer[data-analyzer-step="1"] .photo-tips-kicker,
  #analyzer[data-analyzer-step="1"] .photo-tips-lead {
    display: none;
  }

  #analyzer[data-analyzer-step="1"] .photo-tips-list {
    justify-content: center;
  }

  #analyzer[data-analyzer-step="1"] .photo-tips-list li {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-md, #9A9390);
    background: transparent;
    padding: 4px 8px;
  }

  .trait-select,
  select.trait-select {
    width: 100%;
    min-height: 44px;
  }

  .camera-controls,
  .analyze-footer {
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }

  /* Results header — titles must wrap, not clip ("Top Match: North Itali") */
  .results-header {
    min-width: 0;
    max-width: 100%;
    padding-inline: 2px;
    margin-bottom: 12px;
  }

  #resultsTitle,
  .results-header .section-title {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: clamp(1.12rem, 5.8vw, 1.55rem);
    line-height: 1.25;
    letter-spacing: -0.02em;
    white-space: normal !important;
    overflow-wrap: break-word;
    word-break: break-word;
    padding-inline: 4px;
  }

  .results-header .section-eyebrow {
    margin-bottom: 6px;
  }

  .results-header .section-sub {
    font-size: 12.5px;
    line-height: 1.45;
    padding-inline: 4px;
    margin-top: 6px;
  }

  #regionDominanceNotice {
    max-width: 100%;
    min-width: 0;
  }

  #results .dominance-notice {
    text-align: left !important;
    padding: 12px 14px !important;
    margin: 0 0 12px !important;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .sample-report-banner,
  .free-preview-banner {
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
  }

  .free-preview-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .sample-report-banner-text {
    font-size: 12.5px;
    line-height: 1.4;
  }

  .result-primary-name {
    font-size: clamp(1.15rem, 6vw, 1.5rem);
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .podium-eth,
  .eth-cell-name,
  .bar-label,
  .dna-region-name {
    white-space: normal !important;
    overflow: visible;
    text-overflow: unset;
    overflow-wrap: break-word;
  }

  .sport-name,
  .ability-name {
    white-space: normal !important;
    overflow: visible;
    text-overflow: unset;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
    padding-inline: 2px;
  }

  .sport-card,
  .ability-card {
    min-width: 0;
    overflow: hidden;
  }

  /* Results — stack actions; Do Another Scan is the green primary */
  .results-actions {
    flex-direction: column;
    align-items: stretch;
    max-width: none;
    margin: 20px 0 28px;
    padding: 4px 0 20px;
    gap: 8px;
  }

  .results-actions .btn-primary,
  .results-actions .btn-secondary,
  .share-actions .btn-primary,
  .share-actions .btn-secondary {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    border-radius: var(--r-md, 12px);
  }

  /* Locked feature cards — compact, not a stack of green pills */
  .lock-wrap.is-locked {
    min-height: 0;
  }

  .lock-wrap.is-locked > :not(.lock-overlay) {
    min-height: 140px;
  }

  #results .lock-wrap {
    margin-bottom: 12px;
  }

  .lock-overlay {
    position: relative;
    inset: auto;
    min-height: 148px;
    padding: 16px 14px 14px;
    gap: 6px;
    border-radius: var(--r-lg, 18px);
  }

  /* When locked, hide the blurred content chrome and show only the gate card */
  .lock-wrap.is-locked > :not(.lock-overlay) {
    display: none;
  }

  .lock-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .lock-icon svg {
    width: 14px;
    height: 14px;
  }

  .lock-title {
    font-size: 13.5px;
  }

  .lock-sub {
    font-size: 11.5px;
    max-width: none;
    padding: 0 4px;
  }

  .lock-cost-badge {
    font-size: 9.5px;
    margin-top: 0;
  }

  .lock-overlay .btn-unlock {
    width: 100%;
    max-width: 240px;
    margin-top: 6px;
  }

  .civ-migration-cta {
    margin-top: 14px;
    padding-top: 4px;
  }

  .civ-migration-btn {
    width: 100%;
    border-radius: var(--r-md, 12px);
    min-height: 46px;
  }

  .results-nav {
    top: calc(60px + env(safe-area-inset-top, 0px));
    margin-bottom: 12px;
    padding-bottom: 4px;
  }

  /* Vertical rhythm: keep cards from stacking flush */
  #results .reveal-card,
  #results .sub-ethnicity-card,
  #results .map-card,
  #results .full-grid-card,
  #results .ancient-civs-card,
  #results .results-panel,
  #results .dna-card,
  #results .measure-card,
  #results .facts-card,
  #results .heatmap-globe-card,
  #results .genetic-comp-card-wrap,
  #results .three-pillars-card-wrap,
  #results .charts-row,
  #results .subChartsRow,
  #shareCardContainer {
    margin-bottom: 14px;
  }

  #results .insights-row {
    margin-bottom: 14px;
  }

  .podium-wrap {
    gap: 12px;
  }

  .podium-title {
    margin-bottom: 8px;
  }

  .podium-items {
    gap: 8px;
    width: 100%;
  }

  .podium-item {
    padding: 10px 12px;
  }

  .genetic-comp-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .insights-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .map-card svg,
  .map-card canvas,
  .heatmap-globe-card canvas,
  #worldMap,
  #heatmapGlobe,
  #photoShareCanvas {
    max-width: 100%;
    height: auto;
  }

  /* Store */
  .scan-compare-checkout {
    padding: 24px 2px 6px;
  }

  .pay-chooser-overlay {
    align-items: flex-end;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .pay-chooser {
    max-width: none;
    width: 100%;
  }

  /* Family tree */
  .ft-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
  }

  .ft-toolbar .btn-primary,
  .ft-toolbar .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .toast {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .ft-inline-form {
    flex-direction: column;
  }

  .ft-dropzone {
    padding: 22px 14px;
  }

  .family-modal-overlay {
    width: 100%;
    height: 100%;
    height: 100dvh;
    align-items: flex-end;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .family-modal-card {
    max-height: min(92dvh, 100%);
    overflow-y: auto;
    border-radius: 16px 16px 12px 12px;
  }

  .family-modal-header h2 {
    font-size: 1.05rem;
    padding-right: 28px;
  }

  /* Auth modal — centered on phone, matching desktop focus */
  .auth-modal-backdrop,
  .reset-modal-backdrop {
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .auth-modal,
  .auth-modal.reset-modal {
    width: min(100%, 392px) !important;
    max-width: 100% !important;
    margin: 0 auto;
    padding: 24px 18px 18px !important;
    border-radius: 20px !important;
    max-height: min(88dvh, 100%);
    overflow-y: auto;
    text-align: center;
  }

  .auth-modal-brand {
    justify-content: center !important;
  }

  .auth-title,
  .auth-subtitle,
  .auth-label,
  .auth-trust-row,
  .auth-switch-mode,
  .auth-field-hint {
    text-align: center !important;
  }

  .auth-field {
    align-items: stretch;
  }

  .auth-forgot-btn {
    align-self: center !important;
  }

  .auth-modal input,
  .auth-modal .auth-username,
  .auth-modal .auth-email,
  .auth-modal .auth-password {
    font-size: 16px;
    min-height: 48px;
    text-align: center;
  }

  .auth-close-btn {
    width: 40px;
    height: 40px;
  }

  /* Share / profile drawers */
  .photo-share-modal {
    align-items: flex-end;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .photo-share-modal-inner {
    max-width: none;
    width: 100%;
    max-height: 90dvh;
    padding: 16px 14px;
  }

  .photo-share-actions {
    flex-direction: column;
  }

  .profile-panel {
    top: auto;
    right: 10px;
    left: 10px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
    max-height: min(58dvh, 400px);
    border-radius: 16px;
    overflow: hidden;
  }

  .profile-panel-head {
    padding: 14px 16px 10px;
  }

  .profile-panel .auth-logout-btn {
    width: calc(100% - 32px) !important;
    margin: 8px 16px 14px !important;
    min-height: 44px;
  }

  .globe-intro-overlay {
    width: 100%;
    max-width: 100%;
  }

  .civ-panel {
    width: min(560px, calc(100% - 24px));
    padding: 14px 14px 16px;
    bottom: calc(8% + env(safe-area-inset-bottom, 0px));
  }

  .civ-caption {
    width: calc(100% - 32px);
    font-size: 13px;
  }

  .site-footer {
    padding: 20px 14px calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .legal-page {
    padding: calc(88px + env(safe-area-inset-top, 0px)) 16px 48px;
  }

  .sample-report-face {
    margin-inline: auto;
  }

  /* 10-slide Scan — phone layout between the top bar and bottom tabs */
  #analyzer.slide-mode {
    padding: 0 !important;
    /* min-height:100vh on #analyzer would ignore inset bottom and cover the tab bar. */
    min-height: 0 !important;
    height: auto !important;
    top: calc(60px + env(safe-area-inset-top, 0px)) !important;
    right: 0 !important;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    background: var(--bg-deep, #060810) !important;
    animation: none !important;
    transform: none !important;
  }

  #analyzer.slide-mode .slide-deck {
    width: 100%;
    height: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  #analyzer.slide-mode .slide {
    width: 100%;
    max-width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 54px 16px 0;
    background: var(--bg-deep, #060810);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    isolation: isolate;
  }

  #analyzer.slide-mode .slide.active {
    z-index: 2;
  }

  #analyzer.slide-mode .slide::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }

  #analyzer.slide-mode .slide-inner {
    max-width: none;
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
    padding-bottom: 8px;
  }

  #analyzer.slide-mode .slide-back-btn,
  #analyzer.slide-mode .slide-close-btn {
    top: 12px;
    width: 44px;
    height: 44px;
    -webkit-tap-highlight-color: transparent;
  }

  #analyzer.slide-mode .slide-back-btn { left: 10px; }
  #analyzer.slide-mode .slide-close-btn { right: 10px; }

  #analyzer.slide-mode .scan-photo-strip {
    position: sticky;
    top: 0;
    z-index: 6;
    margin: 0 -16px 14px;
    width: calc(100% + 32px);
    padding: 10px 16px 12px;
    background: var(--bg-deep, #060810);
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #analyzer.slide-mode .scan-photo-dock {
    position: static;
    width: auto;
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border: none;
    border-radius: 0;
  }

  #analyzer.slide-mode .slide-inner > .scan-photo-dock:not([hidden]) {
    display: block;
  }

  #analyzer.slide-mode .scan-photo-dock img {
    width: auto;
    max-width: min(220px, 78vw);
    max-height: 132px;
    margin: 0 auto;
    border-radius: 12px;
    border: 1px solid var(--border, rgba(255,255,255,0.14));
    object-fit: contain;
    object-position: center center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
  }

  #analyzer.slide-mode .slide-inner.has-scan-photo {
    display: flex;
    flex-direction: column;
  }

  #analyzer.slide-mode .slide-title {
    font-size: clamp(22px, 6.2vw, 28px);
    line-height: 1.2;
    overflow-wrap: break-word;
    word-break: normal;
    white-space: normal;
    margin-bottom: 6px;
    padding-right: 8px;
  }

  #analyzer.slide-mode .slide-sub {
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 16px;
  }

  #analyzer.slide-mode .slide-eyebrow {
    font-size: 10px;
    letter-spacing: 0.14em;
    margin-bottom: 6px;
  }

  #analyzer.slide-mode .upload-zone-big {
    flex: 1 1 auto;
    min-height: 180px;
    max-height: 420px;
    padding: 28px 16px;
    width: 100%;
    box-sizing: border-box;
    border-radius: 16px;
    justify-content: center;
  }

  #analyzer.slide-mode .upload-text-big {
    font-size: 15px;
  }

  #analyzer.slide-mode .upload-hint-big {
    font-size: 12px;
    line-height: 1.4;
    max-width: 28ch;
  }

  .photo-privacy-modal {
    align-items: center;
    justify-content: center;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .photo-privacy-modal-inner {
    max-width: min(420px, 100%);
    width: 100%;
    max-height: min(80dvh, 560px);
    padding: 22px 16px 16px;
    border-radius: 16px;
    margin-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }

  .photo-privacy-title {
    font-size: 20px;
  }

  .photo-privacy-actions {
    flex-direction: column-reverse;
  }

  .photo-privacy-actions .btn-secondary,
  .photo-privacy-actions .btn-next {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  #analyzer.slide-mode .detect-status-panel {
    margin-top: 16px;
    width: 100%;
  }

  #analyzer.slide-mode .detect-canvas-wrap {
    max-width: 100%;
  }

  /* Color swatches: 4 even columns, 44px targets, name under each dot */
  #analyzer.slide-mode .color-options-big {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px 6px;
    justify-content: stretch;
    width: 100%;
  }

  #analyzer.slide-mode .color-dot-big {
    position: relative;
    width: 44px;
    height: 44px;
    margin: 0 auto 22px;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
  }

  #analyzer.slide-mode .color-dot-big::after {
    content: attr(title);
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: 0;
    color: var(--text-md, #9A9390);
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #analyzer.slide-mode .color-dot-big.selected::after {
    color: var(--text-hi, #F2EEE8);
    font-weight: 600;
  }

  #analyzer.slide-mode .trait-slide-group {
    margin-bottom: 18px;
  }

  #analyzer.slide-mode .trait-slide-label {
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-md, #9A9390);
    margin-bottom: 10px;
  }

  #analyzer.slide-mode .trait-guide-card-slide {
    display: block;
    margin-top: 12px;
    margin-bottom: 10px;
    padding: 10px;
  }

  #analyzer.slide-mode .trait-guide-card-slide img {
    max-height: min(38vh, 240px);
    width: 100%;
    object-fit: contain;
  }

  #analyzer.slide-mode .option-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #analyzer.slide-mode .option-card {
    min-height: 48px;
    min-width: 0;
    font-size: 13px;
    line-height: 1.25;
    padding: 12px 10px;
    overflow-wrap: break-word;
    word-break: normal;
    -webkit-tap-highlight-color: transparent;
  }

  #analyzer.slide-mode .option-card--with-example {
    min-height: 0;
    padding: 10px 8px 8px;
    gap: 6px;
  }

  #analyzer.slide-mode .option-card-example {
    max-width: none;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 112px;
    object-fit: cover;
  }

  #analyzer.slide-mode #bodyTypeCards .option-card-example {
    max-height: 128px;
    object-fit: contain;
    background: var(--bg-deep, #060810);
  }

  /* Odd leftover (Deep-set, Triangle, …) spans the row instead of looking broken */
  #analyzer.slide-mode .option-card-grid > .option-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  /* 7-option grids — keep the last card from stretching awkwardly with a tall image */
  #analyzer.slide-mode #noseTypeCards > .option-card:last-child:nth-child(odd),
  #analyzer.slide-mode #eyeShapeCards > .option-card:last-child:nth-child(odd),
  #analyzer.slide-mode #faceShapeCards > .option-card:last-child:nth-child(odd) {
    max-width: 100%;
  }

  #analyzer.slide-mode #eyeShapeCards .option-card-example,
  #analyzer.slide-mode #eyebrowShapeCards .option-card-example,
  #analyzer.slide-mode #noseTypeCards .option-card-example,
  #analyzer.slide-mode #hairTextureCards .option-card-example,
  #analyzer.slide-mode #faceShapeCards .option-card-example,
  #analyzer.slide-mode #frecklesCards .option-card-example,
  #analyzer.slide-mode #cheekboneCards .option-card-example {
    max-height: 112px;
    object-fit: cover;
  }

  #analyzer.slide-mode #eyeShapeCards .option-card-example--eye {
    max-height: 112px;
    width: 100%;
  }

  #analyzer.slide-mode .region-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: visible;
  }

  #analyzer.slide-mode .region-card {
    min-height: 64px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
  }

  #analyzer.slide-mode .region-grid > .region-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  #analyzer.slide-mode .region-card-name {
    font-size: 12px;
    line-height: 1.25;
    overflow-wrap: break-word;
    word-break: normal;
  }

  #analyzer.slide-mode .slide-range {
    width: 100%;
    height: 28px;
    margin: 4px 0 8px;
  }

  #analyzer.slide-mode .slide-range-val {
    font-size: 13px;
    margin-bottom: 4px;
  }

  /* Top circular Back already exists — hide the duplicate. Continue is full-width. */
  #analyzer.slide-mode .slide-nav-row {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: stretch;
    margin-top: auto;
    margin-left: -16px;
    margin-right: -16px;
    padding: 12px 16px 18px;
    position: sticky;
    bottom: 0;
    flex-shrink: 0;
    z-index: 8;
    background: var(--bg-deep, #060810);
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    box-sizing: border-box;
  }

  #analyzer.slide-mode .btn-back-inline {
    display: none;
  }

  #analyzer.slide-mode .slide-skip-btn {
    flex: none;
    width: 100%;
    order: -1;
    text-align: center;
    min-height: 40px;
    padding: 8px 8px 4px;
  }

  #analyzer.slide-mode .btn-next,
  #analyzer.slide-mode .btn-analyze-big {
    flex: none;
    width: 100%;
    min-width: 0;
    min-height: 52px;
    margin-left: 0;
    border-radius: 12px;
    font-size: 15px;
  }

  /* Upload: drop zone is the CTA; auto-advance after detect. Hide extra Continue so it cannot sit over the close X. */
  #analyzer.slide-mode #slide-upload .slide-nav-row {
    display: none;
  }

  .section-title,
  .section-sub,
  .slide-sub,
  .slide-title,
  .scan-shop-title,
  .scan-shop-sub,
  .results-empty-state p,
  .ft-gate-card p,
  .site-footer-brand,
  #familytree .analyzer-header,
  #coinstore .scan-shop-heading {
    display: block;
    min-width: 0;
    width: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
  }

  .scan-shop-sub {
    max-width: none;
  }

  .results-empty-state,
  .ft-gate-card {
    max-width: 100%;
    box-sizing: border-box;
    padding-left: 16px;
    padding-right: 16px;
  }

  .scan-shop-header {
    flex-direction: column;
    align-items: stretch;
  }

  .scan-shop-heading {
    max-width: 100%;
    min-width: 0;
  }

  .ft-gate-card h3 {
    font-size: 1.1rem;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }
}

@media (max-width: 480px) {
  .insights-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .home-stats-inner {
    grid-template-columns: 1fr;
  }

  .home-stat-item:nth-child(n) {
    border-right: none;
  }

  .landmark-info {
    grid-template-columns: 1fr 1fr;
  }

  .hero-title {
    font-size: 30px;
    line-height: 1.12;
  }

  .hero-title .t-green {
    font-size: 0.52em;
  }

  .section-title {
    font-size: clamp(20px, 6.4vw, 24px);
    line-height: 1.22;
    overflow-wrap: break-word;
  }

  #resultsTitle,
  .results-header .section-title {
    font-size: clamp(1.1rem, 6vw, 1.45rem);
  }
}

@media (max-width: 360px) {
  header.top-navbar .nav-top-right {
    gap: 6px !important;
  }

  .mobile-nav-btn .nav-ico {
    width: 32px !important;
    height: 26px !important;
  }

  .mobile-nav-btn .nav-ico svg {
    width: 20px !important;
    height: 20px !important;
  }

  .mobile-nav-btn .lbl {
    font-size: 9px !important;
  }

  .nav-logo-text {
    font-size: 1.02rem !important;
  }

  #analyzer.slide-mode .region-card {
    min-height: 58px;
    padding: 8px 6px;
  }

  #analyzer.slide-mode .region-card-name {
    font-size: 11px;
  }

  #analyzer.slide-mode .color-dot-big {
    width: 40px;
    height: 40px;
    margin-bottom: 20px;
  }

  #analyzer.slide-mode .color-dot-big::after {
    font-size: 9px;
  }

  #analyzer.slide-mode .slide-nav-row {
    padding: 10px 16px 12px;
  }

  #analyzer.slide-mode .slide-skip-btn {
    min-height: 36px;
    padding: 6px 8px 2px;
  }

  #analyzer.slide-mode .btn-next,
  #analyzer.slide-mode .btn-analyze-big {
    min-height: 48px;
  }
}

@media (min-width: 540px) and (max-width: 768px) {
  #analyzer.slide-mode .option-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #analyzer.slide-mode .region-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ============================================================
   Homepage: What you get / Celebrity / Live demo
   Tuned for common Android widths (Realme ~360–412 CSS px)
   ============================================================ */
@media (max-width: 768px) {
  #what-you-get.section-wyg {
    padding: 40px 0 36px !important;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  #what-you-get .wy-container {
    padding: 0 max(12px, env(safe-area-inset-left, 0px)) 0 max(12px, env(safe-area-inset-right, 0px)) !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  #what-you-get .wy-header {
    margin-bottom: 18px !important;
    padding: 0 4px;
  }

  #what-you-get .wy-title {
    font-size: clamp(1.45rem, 6.5vw, 1.85rem) !important;
    letter-spacing: -0.02em;
    line-height: 1.15;
  }

  #what-you-get .wy-sub {
    font-size: 13px !important;
    line-height: 1.45;
    padding: 0 6px;
  }

  #what-you-get .wy-slider-wrap {
    gap: 6px !important;
    height: auto !important;
    overflow: visible !important;
  }

  #what-you-get .wy-slider-viewport {
    min-width: 0;
    width: 100%;
  }

  #what-you-get .wy-slider-track {
    gap: 12px !important;
  }

  #what-you-get .wy-slider-track {
    align-items: center !important;
  }

  #what-you-get .wy-card {
    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    top: auto !important;
    position: relative !important;
    height: auto !important;
    min-height: var(--wy-card-min-h, 0px) !important;
    border-radius: 16px !important;
    box-sizing: border-box;
    justify-content: center;
  }

  #what-you-get .wy-slider-viewport {
    display: flex;
    align-items: center;
  }

  #what-you-get .wy-preview {
    padding: 12px !important;
    min-height: 0 !important;
    height: auto !important;
    align-items: center !important;
    flex: 1 1 auto;
  }

  #what-you-get .wy-mock-map {
    grid-template-columns: minmax(96px, 38%) 1fr !important;
    gap: 10px !important;
  }

  #what-you-get .wy-map-stage {
    height: 112px !important;
  }

  #what-you-get .wy-globe-ring {
    width: 96px !important;
    height: 96px !important;
  }

  #what-you-get .wy-mig-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  #what-you-get .wy-mock-civ-card {
    padding: 9px 10px !important;
  }

  #what-you-get .wy-card-info {
    padding: 14px 14px 16px !important;
  }

  #what-you-get .wy-card-info h3 {
    font-size: 1.05rem !important;
  }

  #what-you-get .wy-card-info p {
    font-size: 13px !important;
  }

  #what-you-get .wy-nav-btn {
    flex: 0 0 36px !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px;
    font-size: 14px;
    touch-action: manipulation;
  }

  #what-you-get .wy-mock-eth {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  #what-you-get .wy-mock-hero {
    font-size: 1.05rem !important;
  }

  #what-you-get .wy-mock-rank,
  #what-you-get .wy-mock-chip,
  #what-you-get .wy-mock-civ-card,
  #what-you-get .wy-trait {
    padding: 8px !important;
    font-size: 11px !important;
  }

  #what-you-get .wy-mock-barrow {
    grid-template-columns: 20px 1fr 32px;
    gap: 5px;
  }

  #what-you-get .wy-mock-map {
    height: 120px;
  }

  #what-you-get .wy-globe-ring {
    width: 96px;
    height: 96px;
  }

  .celeb-samples-section {
    padding: 36px max(12px, env(safe-area-inset-left, 0px)) 28px max(12px, env(safe-area-inset-right, 0px)) !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .celeb-samples-header .wy-title {
    font-size: clamp(1.45rem, 6.5vw, 1.85rem);
  }

  .celeb-samples-header .wy-sub {
    font-size: 13px;
    padding: 0 4px;
  }

  .celeb-slider-wrap {
    gap: 6px !important;
    width: 100%;
  }

  .celeb-slider-viewport {
    min-width: 0;
  }

  .celeb-card {
    flex: 0 0 min(200px, calc(100vw - 96px)) !important;
  }

  .celeb-nav-btn {
    flex: 0 0 36px !important;
    width: 36px !important;
    height: 36px !important;
    touch-action: manipulation;
  }

  .home-live-demo {
    margin: 28px auto 48px !important;
    padding: 0 max(12px, env(safe-area-inset-left, 0px)) 0 max(12px, env(safe-area-inset-right, 0px)) !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .lvd-header {
    margin-bottom: 16px !important;
  }

  .lvd-title {
    font-size: clamp(1.2rem, 5.5vw, 1.45rem) !important;
    line-height: 1.2;
    padding: 0 2px;
  }

  .lvd-sub {
    font-size: 12.5px !important;
    line-height: 1.5;
    padding: 0 2px;
    max-width: 100% !important;
  }

  .lvd-panel {
    grid-template-columns: 1fr !important;
    border-radius: 16px !important;
  }

  .lvd-photo-col {
    padding: 14px !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--border);
  }

  .lvd-photo-wrap {
    max-width: min(100%, 320px);
    margin: 0 auto;
  }

  .lvd-refresh-btn {
    min-height: 44px !important;
    font-size: 14px;
    touch-action: manipulation;
  }

  .lvd-results-col {
    padding: 14px !important;
  }

  .lvd-reveal {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .lvd-podium {
    padding: 12px !important;
  }

  .lvd-podium-item {
    grid-template-columns: 22px 18px minmax(0, 1fr) auto !important;
    gap: 6px !important;
    padding: 8px !important;
  }

  .lvd-podium-name {
    font-size: 12px !important;
  }

  .lvd-primary {
    align-items: center;
    gap: 10px;
  }

  .lvd-primary-flag {
    font-size: 24px !important;
  }

  .lvd-top-match-name {
    font-size: clamp(1.1rem, 5vw, 1.35rem) !important;
    word-break: break-word;
  }

  .lvd-top-match-pct {
    font-size: 1.15rem !important;
  }

  .lvd-primary-desc {
    font-size: 12.5px !important;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .lvd-comp-row {
    gap: 6px !important;
    margin-bottom: 7px !important;
  }

  .lvd-comp-name {
    flex: 0 0 min(34%, 110px) !important;
    font-size: 11px;
  }

  .lvd-comp-pct {
    flex: 0 0 40px !important;
    font-size: 11px !important;
  }

  .lvd-loading {
    min-height: 160px !important;
    font-size: 12.5px !important;
  }

  .lvd-error {
    font-size: 12.5px !important;
    padding: 8px 4px;
  }
}

/* Narrow phones (Realme C/Narzo class ~360px CSS width) */
@media (max-width: 400px) {
  #what-you-get .wy-nav-btn {
    flex: 0 0 32px !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
  }

  #what-you-get .wy-preview {
    padding: 10px !important;
  }

  #what-you-get .wy-mock-grid,
  #what-you-get .wy-mock-civ,
  #what-you-get .wy-mock-traits {
    grid-template-columns: 1fr 1fr !important;
  }

  #what-you-get .wy-mock-map {
    grid-template-columns: 1fr !important;
  }

  #what-you-get .wy-mig-cards {
    grid-template-columns: 1fr !important;
  }

  #what-you-get .wy-mock-chip b,
  #what-you-get .wy-mock-civ-card span {
    font-size: 11px;
  }

  .celeb-card {
    flex: 0 0 min(180px, calc(100vw - 88px)) !important;
    padding: 14px 12px !important;
  }

  .celeb-photo-wrap {
    width: 88px !important;
    height: 88px !important;
  }

  .lvd-comp-flag {
    display: none;
  }

  .lvd-comp-name {
    flex: 0 0 min(40%, 120px) !important;
  }

  .lvd-podium-flag {
    font-size: 12px;
  }
}

/* Short landscape phones */
@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
  .home-live-demo {
    margin: 16px auto 28px !important;
  }

  .lvd-panel {
    grid-template-columns: minmax(140px, 38%) 1fr !important;
  }

  .lvd-photo-col {
    border-right: 1px solid var(--border) !important;
    border-bottom: 0 !important;
  }

  .lvd-reveal {
    grid-template-columns: 1fr !important;
  }
}
