/* ==========================================================================
   TECH TITAN IMPERIAL CROWN — G03 NATIVE MOBILE WEB EXPERIENCE SHELL
   Strictly scoped to `body.ts` (public marketing website ONLY).
   Zero cascade into the 108 storefront themes or merchant workspaces.
   Supports: RTL & LTR, Evening Dark & Morning Light (WCAG AA), 320px..1920px,
   iOS/Android safe areas, native touch snap rails, bottom sheets, mobile dock,
   responsive comparison cards, and reduced-motion accessibility.
   ========================================================================== */

/* Smooth MPA route transitions when supported & motion is allowed */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

/* ---------- 1. Universal Offscreen Motion & Skeleton Performance Guard ---------- */
body.ts [data-g03-offscreen="1"],
body.ts [data-g03-offscreen="1"] *,
body.ts [data-g03-offscreen="1"]::before,
body.ts [data-g03-offscreen="1"]::after,
body.ts [data-g03-offscreen="1"] *::before,
body.ts [data-g03-offscreen="1"] *::after {
  animation-play-state: paused !important;
}

body.ts img[data-g03-img="loading"] {
  background-color: rgba(243, 217, 149, 0.05);
}
html[data-theme="light"] body.ts img[data-g03-img="loading"] {
  background-color: rgba(22, 20, 26, 0.05);
}

body.ts video[data-g03-video-error="1"] {
  opacity: 0 !important;
  pointer-events: none;
}

/* ---------- 2. Slider Engine Perfection (Flagship Rail, Swipe Tabs, Pill Strips) ---------- */
body.ts .ts-rail {
  position: relative;
}

/* Adaptive slide widths — fixes catastrophic minmax(0,84%) grid crush on mobile! */
body.ts .ts-rail__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 3 * 18px) / 4);
  gap: 18px;
  margin: 0;
  padding: 6px 2px 16px;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 2px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  scrollbar-width: none;
}
body.ts .ts-rail__track::-webkit-scrollbar {
  display: none;
}
body.ts .ts-rail__track > li {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  min-inline-size: 0;
}
body.ts .ts-rail__track:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 16px;
}

@media (max-width: 1180px) {
  body.ts .ts-rail__track {
    grid-auto-columns: calc((100% - 2 * 16px) / 3);
    gap: 16px;
  }
}
@media (max-width: 900px) {
  body.ts .ts-rail__track {
    grid-auto-columns: calc((100% - 16px) / 2);
    gap: 16px;
  }
}
@media (max-width: 640px) {
  body.ts .ts-rail__track {
    grid-auto-columns: 76%;
    gap: 14px;
    padding-inline: 2px;
  }
}
@media (max-width: 479px) {
  body.ts .ts-rail__track {
    grid-auto-columns: 84%;
    gap: 12px;
  }
}
@media (max-width: 359px) {
  body.ts .ts-rail__track {
    grid-auto-columns: 90%;
    gap: 10px;
  }
}

/* Rail card buttons & live-pill touch ergonomics */
body.ts .ts-edition__live-pill {
  min-block-size: 44px;
  min-inline-size: 44px;
  padding: 8px 13px;
  max-inline-size: calc(100% - 20px);
  text-align: start;
  line-height: 1.25;
}
body.ts .ts-edition__flag {
  max-inline-size: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
}
body.ts .ts-edition__links .ts-btn {
  min-block-size: 44px;
  min-inline-size: 44px;
}

/* Pagination dots + live counter bar */
body.ts .g03-rail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-block-start: 10px;
}
body.ts .g03-dots {
  display: flex;
  align-items: center;
  gap: 0;
  max-inline-size: calc(100% - 68px);
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
}
body.ts .g03-dots::-webkit-scrollbar {
  display: none;
}
body.ts .g03-dot {
  position: relative;
  flex: 0 0 44px;
  inline-size: 44px;
  block-size: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}
body.ts .g03-dot::after {
  content: "";
  inline-size: 9px;
  block-size: 9px;
  border-radius: 999px;
  background: rgba(243, 217, 149, 0.28);
  transition: inline-size 0.22s ease, background-color 0.22s ease;
}
body.ts .g03-dot[aria-selected="true"]::after,
body.ts .g03-dot.is-active::after {
  inline-size: 24px;
  background: linear-gradient(90deg, var(--crimson-hot), var(--gold));
}
html[data-theme="light"] body.ts .g03-dot::after {
  background: rgba(138, 92, 17, 0.25);
}
body.ts .g03-counter {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ivory-2);
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
html[data-theme="light"] body.ts .g03-counter {
  background: rgba(255, 255, 255, 0.85);
  color: #26222c;
}

/* Real touch swipe feedback on [data-ts-tabs] & .ttx-frame without blocking vertical scroll */
body.ts [data-ts-swipe],
body.ts .ttx-frame {
  touch-action: pan-y pinch-zoom;
}
body.ts [data-ts-swipe] > .ts-stage__panel[data-active],
body.ts .ttx-frame > img {
  transform: translate3d(var(--g03-drag-x, 0px), 0, 0);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
body.ts .g03-dragging > .ts-stage__panel[data-active],
body.ts .ttx-frame.g03-dragging > img {
  transition: none;
}

/* Stage mobile pager (prev / counter / next) */
body.ts .g03-stage-pager {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
body.ts .g03-pager-btn {
  display: inline-grid;
  place-items: center;
  inline-size: 44px;
  block-size: 44px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ivory);
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}
body.ts .g03-pager-btn:hover,
body.ts .g03-pager-btn:focus-visible {
  border-color: var(--gold);
  background: rgba(243, 217, 149, 0.08);
}
html[data-theme="light"] body.ts .g03-pager-btn {
  background: rgba(255, 255, 255, 0.85);
  color: #16141a;
  border-color: rgba(124, 92, 30, 0.24);
}
body.ts .ts-stage__ctrl {
  flex-wrap: wrap;
  min-block-size: 46px;
}
body.ts .ts-shot figcaption .ts-link {
  min-block-size: 44px;
}

/* Horizontal snap pill rails on mobile (eliminates 361px vertical tab stacks!) */
@media (max-width: 768px) {
  body.ts .ttx-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 8px !important;
    padding: 4px 2px 10px !important;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    scrollbar-width: none;
  }
  body.ts .ttx-tabs::-webkit-scrollbar {
    display: none;
  }
  body.ts .ttx-tabs > button,
  body.ts .ttx-tabs > [role="tab"] {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    min-block-size: 44px !important;
    scroll-snap-align: start;
  }
  body.ts .ttx-shots {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 8px !important;
    padding-block-end: 8px !important;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
    scrollbar-width: none;
  }
  body.ts .ttx-shots::-webkit-scrollbar {
    display: none;
  }
  body.ts .ttx-shots > .ttx-shot-btn {
    flex: 0 0 auto !important;
    min-block-size: 44px !important;
    white-space: nowrap !important;
    scroll-snap-align: start;
  }
  body.ts .ts-tour__tabs,
  body.ts .ts-plan__steps,
  body.ts .tsa-switcher {
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    scrollbar-width: none;
  }
  body.ts .ts-tour__tabs::-webkit-scrollbar,
  body.ts .ts-plan__steps::-webkit-scrollbar,
  body.ts .tsa-switcher::-webkit-scrollbar {
    display: none;
  }
  body.ts .tsa-switcher__pill {
    min-block-size: 44px !important;
    scroll-snap-align: start;
  }
}

/* ---------- 3. Desktop Single-Row 5-Item Primary Nav + Split Caret + "More" (D-G03-1) ---------- */
body.ts .ts-nav__split {
  display: inline-flex;
  align-items: center;
  border-radius: 11px;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
body.ts .ts-nav__split[data-current] {
  background: linear-gradient(180deg, rgba(243, 217, 149, 0.11), rgba(230, 0, 35, 0.06));
  box-shadow: inset 0 0 0 1px rgba(243, 217, 149, 0.22);
}
body.ts .ts-nav__split .ts-nav__link {
  padding-inline-end: 4px;
  background: none !important;
  box-shadow: none !important;
}
body.ts .ts-nav__caret {
  display: inline-grid;
  place-items: center;
  min-inline-size: 28px;
  min-block-size: 44px;
  padding: 0 6px 0 2px;
  border: 0;
  border-radius: 0 11px 11px 0;
  background: none;
  color: var(--gold);
  cursor: pointer;
}
[dir="rtl"] body.ts .ts-nav__caret {
  padding: 0 2px 0 6px;
  border-radius: 11px 0 0 11px;
}
body.ts .ts-nav__caret .ts-chev {
  inline-size: 13px;
  block-size: 13px;
  fill: none !important;
  stroke: var(--gold);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}
body.ts .ts-nav__caret[aria-expanded="true"] .ts-chev {
  transform: rotate(180deg);
}
html[data-theme="light"] body.ts .ts-nav__split[data-current] {
  background: rgba(181, 123, 28, 0.12);
  box-shadow: inset 0 0 0 1px rgba(138, 92, 17, 0.28);
}

body.ts .ts-mega--more {
  inline-size: min(940px, 100%);
}
body.ts .ts-mega--more .ts-mega__groups {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

/* Desktop >=1024px: single ultra-crisp 72px bar: Brand | Home -> Features -> Themes -> Plans -> Academy -> More | Tools */
@media (min-width: 1024px) {
  body.ts {
    --header-h: 72px;
  }
  body.ts .ts-header > .ts-wrap.ts-header__bar {
    inline-size: min(1280px, calc(100% - 28px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-block-size: 72px;
    padding-block: 0;
  }
  body.ts .ts-header .ts-brand {
    flex: 0 0 auto;
  }
  body.ts .ts-header .ts-brand > .brand-logo {
    width: 158px !important;
    max-height: 52px !important;
    object-fit: contain;
  }
  body.ts .ts-header .ts-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-inline-size: 0;
    min-block-size: 48px;
    border-block-start: 0;
  }
  body.ts .ts-header .ts-nav__list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(2px, 0.5vw, 8px);
  }
  body.ts .ts-header .ts-mega {
    display: block;
  }
  body.ts .ts-header .ts-mega[hidden] {
    display: none !important;
  }
  body.ts .ts-header .ts-burger {
    display: none;
  }
  body.ts .ts-header .ts-tool--lang {
    display: inline-flex;
  }
}

@media (min-width: 1024px) and (max-width: 1220px) {
  body.ts .ts-header .ts-brand > .brand-logo {
    width: 132px !important;
    max-height: 44px !important;
  }
  body.ts .ts-header .ts-tool--currency {
    display: none;
  }
  body.ts .ts-header .ts-tool--search span,
  body.ts .ts-header .ts-tool kbd {
    display: none;
  }
  body.ts .ts-header .ts-tool__lang-full {
    display: none;
  }
  body.ts .ts-header .ts-tool__lang-short {
    display: inline;
  }
  body.ts .ts-nav__link,
  body.ts .ts-nav__trigger {
    padding-inline: 7px;
    font-size: 0.87rem;
  }
  body.ts .ts-header .ts-login {
    padding-inline: 10px;
    font-size: 0.85rem;
  }
  body.ts .ts-header .ts-btn--start {
    padding-inline: 12px;
    font-size: 0.85rem;
  }
}

/* ---------- 4. Compact Single-Row Sticky Mobile Header (<=1023px) ---------- */
body.ts .ts-tool__lang-short {
  display: none;
}

@media (max-width: 1023px) {
  body.ts {
    --header-h: 62px;
  }
  body.ts .ts-header .tsh-families {
    display: none !important;
  }
  body.ts .ts-header .ts-nav,
  body.ts .ts-header .ts-tool--currency {
    display: none !important;
  }
  body.ts .ts-header .ts-burger {
    display: inline-flex !important;
  }
  body.ts .ts-header__bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-block-size: 62px;
    padding-block: 6px;
    padding-inline-start: env(safe-area-inset-left, 0px);
    padding-inline-end: env(safe-area-inset-right, 0px);
  }
  body.ts .ts-header__bar > .ts-brand {
    flex: 0 1 auto;
    min-inline-size: 92px;
    min-block-size: 44px;
    padding: 0;
  }
  body.ts .ts-header .ts-brand > .brand-logo {
    width: 132px !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 44px !important;
    object-fit: contain;
  }
  body.ts .ts-header .ts-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    margin-inline-start: auto;
  }
  body.ts .ts-header .ts-tool {
    min-inline-size: 44px;
    min-block-size: 44px;
    padding: 0 10px;
  }
  body.ts .ts-header .ts-tool--search span,
  body.ts .ts-header .ts-tool kbd {
    display: none;
  }
  body.ts .ts-header .ts-tool--lang {
    display: inline-flex !important;
    padding: 0 10px;
    font-weight: 800;
    font-size: 0.84rem;
  }
  body.ts .ts-header .ts-tool__lang-full {
    display: none;
  }
  body.ts .ts-header .ts-tool__lang-short {
    display: inline;
  }
  body.ts .ts-header .ts-login {
    min-block-size: 44px;
    min-inline-size: 44px;
    padding: 8px 12px;
    gap: 6px;
  }
}

/* Phones 360px..639px: Brand + Search + Theme + Lang(short) + Login(icon) + Burger — 0 overflow, all >=44px */
@media (max-width: 639px) {
  body.ts {
    --wrap: min(1200px, calc(100% - 20px));
    --header-h: 60px;
  }
  body.ts .ts-header__bar {
    gap: 6px;
    min-block-size: 60px;
  }
  body.ts .ts-header .ts-btn--start {
    display: none !important;
  }
  body.ts .ts-header .ts-tools {
    gap: 4px;
  }
  body.ts .ts-header .ts-tool {
    padding: 0;
    inline-size: 44px;
    block-size: 44px;
  }
  body.ts .ts-header .ts-login {
    padding: 0;
    inline-size: 44px;
    block-size: 44px;
    justify-content: center;
    gap: 0;
  }
  body.ts .ts-header .ts-login > span,
  body.ts .ts-header .ts-login .ts-chev {
    position: absolute !important;
    inline-size: 1px;
    block-size: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  body.ts .ts-header__bar > .ts-brand {
    min-inline-size: 92px;
  }
  body.ts .ts-header .ts-brand > .brand-logo {
    width: 112px !important;
    max-height: 38px !important;
  }
}

@media (max-width: 385px) {
  body.ts .ts-header .ts-brand > .brand-logo {
    width: 96px !important;
    max-height: 34px !important;
  }
}

/* Ultra-narrow 320px..359px: move lang button into drawer header so 4 tools + brand never crowd or overflow */
@media (max-width: 359px) {
  body.ts .ts-header .ts-tool--lang {
    display: none !important;
  }
  body.ts .ts-header__bar > .ts-brand {
    min-inline-size: 96px;
  }
  body.ts .ts-header .ts-brand > .brand-logo {
    width: 104px !important;
    max-height: 36px !important;
  }
}

/* ---------- 5. App-Like Mobile Bottom Navigation Dock (<=768px) ---------- */
body.ts .ts-mobile-dock {
  display: none;
}

@media (max-width: 768px) {
  body.ts .ts-mobile-dock {
    position: fixed;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: 95;
    display: block;
    padding-block-start: 4px;
    padding-block-end: max(4px, env(safe-area-inset-bottom, 0px));
    padding-inline-start: env(safe-area-inset-left, 0px);
    padding-inline-end: env(safe-area-inset-right, 0px);
    background: linear-gradient(180deg, rgba(16, 16, 22, 0.94), rgba(9, 9, 13, 0.98));
    backdrop-filter: saturate(160%) blur(20px);
    -webkit-backdrop-filter: saturate(160%) blur(20px);
    border-block-start: 1px solid rgba(243, 217, 149, 0.22);
    box-shadow: 0 -10px 30px -12px rgba(0, 0, 0, 0.72);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
  }

  /* Auto-hide when virtual keyboard is active or modal/drawer/palette is open */
  body.ts[data-g03-kb="1"] .ts-mobile-dock,
  body.ts[data-g03-overlay-open] .ts-mobile-dock {
    transform: translateY(115%);
    opacity: 0;
    pointer-events: none;
  }

  body.ts .ts-mobile-dock__list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    gap: 2px;
    margin: 0 auto;
    padding: 0 4px;
    max-inline-size: 560px;
    list-style: none;
  }

  body.ts .ts-mobile-dock__link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-block-size: 52px;
    min-inline-size: 44px;
    padding: 6px 2px 5px;
    border-radius: 12px;
    color: var(--ivory-2);
    text-decoration: none !important;
    font-size: 0.69rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.16s ease, background-color 0.16s ease, transform 0.14s ease;
  }
  body.ts .ts-mobile-dock__link.is-tapping {
    transform: scale(0.95);
  }
  body.ts .ts-mobile-dock__ico {
    inline-size: 21px;
    block-size: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  body.ts .ts-mobile-dock__label {
    display: block;
    max-inline-size: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.ts .ts-mobile-dock__link[aria-current="page"] {
    color: var(--gold);
    background: rgba(243, 217, 149, 0.1);
  }
  body.ts .ts-mobile-dock__link[aria-current="page"]::before {
    content: "";
    position: absolute;
    inset-block-start: 0;
    inset-inline: 22%;
    block-size: 2.5px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, var(--crimson-hot), var(--gold));
  }

  /* Guarantee the dock NEVER obscures footer links, hero CTAs, or floating contact orb */
  body.ts .ts-hero {
    padding-block-start: clamp(16px, 3.5vw, 26px);
  }
  body.ts .ts-hero__copy {
    gap: 13px;
  }
  body.ts .ts-hero__cta {
    gap: 10px;
  }
  body.ts .ts-hero__cta .ts-btn {
    min-block-size: 48px;
  }
  body.ts .ts-footer.tsf,
  body.ts .ts-footer {
    padding-block-end: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  }
  html body.ts .aio-contact-parent .aio-contact-trigger {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    right: 14px !important;
    width: 52px !important;
    height: 52px !important;
  }
  html body.ts .aio-contact-parent .aio-contact-floating {
    bottom: calc(138px + env(safe-area-inset-bottom, 0px)) !important;
    right: 14px !important;
  }
  html body.ts[data-g03-overlay-open] .aio-contact-parent .aio-contact-trigger,
  html body.ts[data-g03-kb="1"] .aio-contact-parent .aio-contact-trigger {
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* Light Mode Dock (WCAG 2.2 AAA >= 7:1 contrast) */
  html[data-theme="light"] body.ts .ts-mobile-dock {
    background: linear-gradient(180deg, rgba(252, 250, 245, 0.96), rgba(245, 240, 230, 0.99));
    border-block-start-color: rgba(124, 92, 30, 0.28);
    box-shadow: 0 -10px 28px -14px rgba(24, 18, 8, 0.16);
  }
  html[data-theme="light"] body.ts .ts-mobile-dock__link {
    color: #2b2633;
  }
  html[data-theme="light"] body.ts .ts-mobile-dock__link[aria-current="page"] {
    color: #6b4407;
    background: rgba(181, 123, 28, 0.14);
  }
}

@media (max-width: 359px) {
  body.ts .ts-mobile-dock__link {
    font-size: 0.64rem;
  }
  body.ts .ts-mobile-dock__ico {
    inline-size: 19px;
    block-size: 19px;
  }
}

/* ---------- 6. Mobile Drawer Primary / Secondary Structure & Clear CTAs ---------- */
body.ts .ts-drawer__group-label {
  display: block;
  margin: 10px 4px 4px;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
[dir="rtl"] body.ts .ts-drawer__group-label {
  letter-spacing: 0;
}
body.ts .ts-drawer__cta-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-block: 4px 6px;
}
body.ts .ts-drawer__cta-strip .ts-btn {
  min-block-size: 46px;
  padding-inline: 12px;
  font-size: 0.9rem;
}
body.ts .ts-drawer__divider {
  margin-block: 10px 6px;
  border: 0;
  border-block-start: 1px solid var(--line);
}

/* ---------- 7. Quick Search Palette Close Icon + Mobile Bottom Sheets ---------- */
body.ts .ts-palette__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-inline-size: 44px;
  min-block-size: 44px;
  padding: 0 10px;
}
body.ts .ts-palette__close .ts-i {
  inline-size: 18px;
  block-size: 18px;
}
body.ts .ts-w5-modal__close,
body.ts .ts-pet-modal__close {
  inline-size: 44px !important;
  block-size: 44px !important;
  min-inline-size: 44px;
  min-block-size: 44px;
}

@media (max-width: 680px) {
  /* Palette as top-aligned full-width sheet on mobile (keyboard-friendly) */
  body.ts .ts-palette {
    padding: max(12px, env(safe-area-inset-top, 12px)) 10px 10px;
  }
  body.ts .ts-palette__box {
    max-block-size: calc(100dvh - 24px);
    border-radius: 20px;
  }
  body.ts .ts-palette__opt {
    min-block-size: 48px;
  }

  /* Wave 5 modal & Theme Details modal as native-like Bottom Sheets on phones */
  body.ts .ts-w5-modal,
  body.ts #ts-pet-video-modal {
    align-items: end !important;
    padding: 0 !important;
  }
  body.ts .ts-w5-modal__dialog,
  body.ts #ts-pet-video-modal .ts-pet-modal__dialog {
    inline-size: 100% !important;
    max-inline-size: 100% !important;
    max-block-size: 90dvh !important;
    border-radius: 24px 24px 0 0 !important;
    border-block-end: 0 !important;
    padding: 20px 16px max(22px, env(safe-area-inset-bottom, 22px)) !important;
    animation: g03-sheet-up 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }
  body.ts .ts-w5-modal__dialog::before,
  body.ts #ts-pet-video-modal .ts-pet-modal__dialog::before,
  body.ts [data-theme-modal] .tt-modal-dialog::before {
    content: "";
    display: block;
    inline-size: 42px;
    block-size: 4px;
    margin: -6px auto 14px;
    border-radius: 999px;
    background: rgba(243, 217, 149, 0.34);
  }
  body.ts .ts-w5-tab {
    min-block-size: 44px;
  }
  body.ts [data-theme-modal] {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  body.ts [data-theme-modal] .tt-modal-dialog {
    inline-size: 100% !important;
    max-inline-size: 100% !important;
    max-block-size: 90dvh !important;
    border-radius: 24px 24px 0 0 !important;
    padding-block-end: max(22px, env(safe-area-inset-bottom, 22px)) !important;
  }

  /* Account popover stays strictly inside viewport on 320..640px */
  body.ts .ts-pop {
    inset-inline: 10px !important;
    inline-size: auto !important;
    border-radius: 20px;
  }
}

@keyframes g03-sheet-up {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 8. Responsive Feature Comparison Table (.mk-table -> Mobile Cards) ---------- */
@media (max-width: 680px) {
  body.ts .mk-table-wrap {
    overflow-x: visible !important;
    padding: 10px !important;
  }
  body.ts .mk-table {
    display: block;
    inline-size: 100% !important;
    min-inline-size: 0 !important;
    border-collapse: separate;
  }
  body.ts .mk-table thead,
  body.ts .mk-table thead tr,
  body.ts .mk-table thead th {
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: 0;
    display: block;
    inline-size: 1px;
    max-inline-size: 1px;
    block-size: 1px;
    max-block-size: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: normal;
  }
  body.ts .mk-table tbody {
    display: grid;
    gap: 10px;
  }
  body.ts .mk-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
  }
  html[data-theme="light"] body.ts .mk-table tbody tr {
    background: rgba(255, 255, 255, 0.9);
  }
  body.ts .mk-table tbody th {
    grid-column: 1 / -1;
    padding: 0 0 8px !important;
    border: 0 !important;
    border-block-end: 1px solid var(--line) !important;
    font-size: 0.94rem;
    font-weight: 800;
    color: var(--ivory);
    text-align: start;
  }
  body.ts .mk-table tbody td {
    display: grid;
    gap: 4px;
    padding: 8px 10px !important;
    border: 1px solid var(--line) !important;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.86rem;
    text-align: start;
    min-inline-size: 0;
    overflow-wrap: anywhere;
  }
  body.ts .mk-table tbody td::before {
    content: attr(data-col-label);
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--gold);
    line-height: 1.3;
  }
}

/* ---------- 9. Shared Touch Targets (>=44px) & /start/themes Mobile Overflow Fix ---------- */
@media (max-width: 1023px) {
  body.ts .ts-footer li a,
  body.ts .tsf .ts-footer__grid li a {
    min-block-size: 44px;
    min-inline-size: 44px;
    padding-block: 6px;
  }
  body.ts .ts-crumbs a,
  body.ts nav:not(.ts-mobile-dock):not(.ts-nav):not(.ts-drawer__nav) a {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    min-inline-size: 44px;
    padding-inline: 4px;
  }
  body.ts details > summary {
    min-block-size: 44px;
    display: flex;
    align-items: center;
  }
}

/* Fix /start/themes live-pill & specs-rail clipping (D-G04-2 wrap-not-clip) strictly within body.ts */
body.ts.ts-page--themes .tts-catalog-intro__meta,
body.ts.ts-page--themes .tts-specs-head,
body.ts.ts-page--themes .tts-specs-rail {
  max-inline-size: 100% !important;
  min-inline-size: 0 !important;
  flex-wrap: wrap !important;
}
body.ts.ts-page--themes .tts-live-pill,
body.ts.ts-page--themes .tts-spec-chip {
  white-space: normal !important;
  max-inline-size: 100% !important;
  flex-wrap: wrap;
  line-height: 1.45;
  text-align: start;
}
@media (max-width: 1023px) {
  body.ts.ts-page--themes .tt-view-btn {
    min-inline-size: 44px !important;
    min-block-size: 44px !important;
    inline-size: 44px !important;
    block-size: 44px !important;
  }
  body.ts.ts-page--themes .tt-card__sector-btn,
  body.ts.ts-page--themes .tts-cat-chip,
  body.ts.ts-page--themes .tts-spec-chip,
  body.ts.ts-page--themes .tt-chip,
  body.ts.ts-page--themes .tt-card button {
    min-block-size: 44px !important;
    min-inline-size: 44px;
  }
}

/* ---------- 10. Reduced-Motion & iOS Scroll-Lock Guarantee ---------- */
html:has(body.ts[data-locked]) {
  overflow: hidden;
}
@media (prefers-reduced-motion: reduce) {
  body.ts .ts-mobile-dock,
  body.ts .ts-w5-modal__dialog,
  body.ts img[data-g03-img="loading"],
  body.ts .g03-dot::after,
  body.ts [data-ts-swipe] > .ts-stage__panel[data-active] {
    animation: none !important;
    transition: none !important;
  }
}
