/* Mobile-first premium polish — phones & small tablets */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.sc-body {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

.sc-body a,
.sc-body button,
.sc-body input,
.sc-body .yt-tab {
  touch-action: manipulation;
}

/* Nav backdrop (toggled via JS) */
.sc-nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(11, 11, 15, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s;
}
.sc-nav-backdrop.is-on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (max-width: 900px) {
  .tb-wrap {
    width: min(1120px, calc(100% - 1rem));
  }

  .sc-shell,
  .sc-main-col {
    width: 100%;
    max-width: 100%;
  }

  .sc-main-col {
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }

  .tb-nav {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
  }

  .tb-nav-inner {
    min-height: 56px;
    gap: 0.65rem;
  }

  .tb-brand-text {
    font-size: 1rem;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tb-nav-toggle {
    box-shadow: 0 4px 14px rgba(255, 252, 0, 0.45);
    transition: transform 0.15s ease, box-shadow 0.2s;
  }
  .tb-nav-toggle:active {
    transform: scale(0.94);
  }

  .tb-menu {
    z-index: 55;
    left: max(0.5rem, env(safe-area-inset-left));
    right: max(0.5rem, env(safe-area-inset-right));
    top: calc(100% + 6px);
    border-radius: 18px;
    border: 1px solid var(--sc-line);
    padding: 0.65rem;
    gap: 0.4rem;
    box-shadow: 0 20px 50px rgba(11, 11, 15, 0.14);
    max-height: min(75vh, calc(100dvh - 72px));
  }

  .tb-menu a {
    font-weight: 700;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
  }
  .tb-menu a:active {
    transform: scale(0.98);
    background: var(--sc-yellow);
    border-color: rgba(0, 0, 0, 0.06);
  }

  .yt-hero {
    padding: 0.85rem 0 0.65rem;
  }

  .yt-hero-premium .yt-hero-panel {
    margin: 0 0.15rem;
    padding: 1rem 0.85rem 1.1rem;
    border-radius: 22px;
    box-shadow: 0 14px 40px rgba(15, 15, 15, 0.08);
  }

  .yt-pill {
    font-size: 0.72rem;
    margin-bottom: 0.85rem;
  }

  .yt-hero h1 {
    font-size: clamp(1.65rem, 7.2vw, 2rem);
    line-height: 1.12;
    margin-bottom: 0.5rem;
  }

  .yt-hero-lead {
    font-size: 0.94rem;
    line-height: 1.5;
    margin-bottom: 1.1rem;
  }

  /* Segmented tabs — premium pill row */
  .yt-tabs {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0.35rem;
    padding: 0.35rem;
    margin-bottom: 1.1rem;
    border: none;
    border-radius: 16px;
    background: color-mix(in srgb, var(--yt-line) 55%, #fff);
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .yt-tab,
  a.yt-tab {
    scroll-snap-align: start;
    border-radius: 12px;
    padding: 0.55rem 0.75rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 800;
    border: 1px solid transparent;
    transition: background 0.2s, box-shadow 0.2s, transform 0.12s;
  }

  .yt-tab.is-on {
    background: #fff;
    border-color: color-mix(in srgb, var(--yt-red) 35%, var(--yt-line));
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
  }

  .yt-tab.is-on::after {
    display: none;
  }

  .yt-tab:active {
    transform: scale(0.97);
  }

  .yt-bar {
    border-radius: 20px;
    box-shadow: 0 12px 36px rgba(15, 15, 15, 0.1);
  }

  .yt-bar-go {
    min-height: 56px;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    border-radius: 0 0 18px 18px;
  }

  .yt-bar-go:active {
    transform: scale(0.99);
    filter: brightness(1.05);
  }

  .yt-bar-paste {
    width: 46px;
    height: 46px;
  }

  .yt-hint,
  #tbForm .tb-status {
    font-size: 0.84rem;
    padding: 0 0.15rem;
  }

  .tb-results .tb-results-box {
    margin: 0.75rem 0.15rem 0;
    border-radius: 20px;
    padding: 1rem 0.85rem;
  }

  .tb-results .tb-file {
    border-radius: 18px;
    padding: 0.95rem;
  }

  .tb-file-thumb {
    width: 64px;
    height: 64px;
    border-radius: 14px;
  }

  .yt-how {
    padding: 1.75rem 0 1.5rem;
  }

  .yt-how h2 {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
  }

  .yt-step {
    background: #fff;
    border: 1px solid var(--yt-line);
    border-radius: 18px;
    padding: 0.85rem 0.95rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  }

  .tb-page {
    padding: 1.25rem 0 2rem;
  }

  .tb-page-card,
  .tb-home-article-card {
    border-radius: 20px;
    padding: 1.1rem 0.95rem;
    margin: 0 0.15rem;
  }

  .tb-prose {
    font-size: 0.98rem;
    line-height: 1.65;
  }

  .tb-foot {
    padding: 1.75rem 0 max(1.25rem, env(safe-area-inset-bottom));
  }

  .tb-foot-grid {
    gap: 1.25rem;
  }

  .tb-foot a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .tb-ad {
    border-radius: 16px;
    margin: 0.75rem 0.15rem;
  }

  .yt-tool-ad-slot {
    margin-top: 0.85rem;
  }
}

@media (max-width: 380px) {
  .yt-tab,
  a.yt-tab {
    font-size: 0.78rem;
    padding: 0.5rem 0.6rem;
  }

  .yt-hero h1 {
    font-size: 1.55rem;
  }
}

/* Slightly larger touch on coarse pointers */
@media (pointer: coarse) {
  .yt-bar-go,
  .tb-btn-primary,
  .tb-menu a {
    min-height: 48px;
  }
}
