/* Mobile-first polish shared by the public pages and CMS. */
.detail-sidebar .promo-card { display: none !important; }
@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; scroll-padding-top: 14px; }
  body { overflow-x: hidden; font-size: 15px; }
  .container { width: min(100% - 30px, 600px); }
  .site-header .nav { min-height: 62px; padding: 9px 0; gap: 8px; }
  .site-header .brand { min-width: 0; gap: 8px; font-size: 15px; }
  .brand-logo { width: 42px; height: 42px; object-fit: contain; }
  .site-header .header-telegram { width: 42px; height: 42px; }
  .site-header .header-search { min-height: 43px; gap: 6px; padding: 3px 5px 3px 10px; }
  .site-header .header-search input { min-height: 36px; font-size: 16px; }
  .site-header .header-search button { min-height: 36px; padding: 7px 12px; }
  .highlight-marquee { height: 36px; }
  .highlight-item { gap: 6px; padding: 0 10px; font-size: 11px; }
  .top-app-banner { padding: 14px 0 16px; }
  .top-app-banner-grid { gap: 8px; }
  .top-app-promo { min-width: 0; min-height: 82px; gap: 9px; padding: 9px; border-radius: 14px; }
  .top-promo-icon { width: 52px; height: 52px; border-radius: 14px; }
  .top-promo-copy { flex: 1; min-width: 0; }
  .top-promo-copy strong { font-size: 14px; }
  .top-promo-copy small { white-space: normal; font-size: 10px; line-height: 1.25; }
  .top-promo-arrow { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0 9px; border-radius: 9px; background: #087d52; color: #fff; font-size: 10px; }
  .section { padding: 20px 0 44px; }
  .app-grid { gap: 9px; }
  body #directory > .app-grid .app-card { grid-template-columns: 58px minmax(0,1fr) auto; column-gap: 9px; min-height: 92px; padding: 9px; border-radius: 13px; }
  body #directory > .app-grid .app-icon { width: 58px; height: 58px; border-radius: 13px; }
  body #directory > .app-grid .app-card h3 { font-size: 14px; line-height: 1.2; }
  body #directory > .app-grid .app-meta span { font-size: 11px; line-height: 1.3; }
  body #directory > .app-grid .download-button { min-height: 40px; padding: 8px 9px; font-size: 11px; }
  body .spotlight .collection-panel .app-card { grid-template-columns: 58px minmax(0,1fr) auto; column-gap: 9px; min-height: 90px; padding: 9px; }
  body .spotlight .collection-panel .app-icon { width: 58px; height: 58px; }
  body .spotlight .collection-panel .app-card h3 { font-size: 14px; line-height: 1.2; }
  body .spotlight .collection-panel .app-meta span { font-size: 11px; line-height: 1.25; }
  body .spotlight .collection-panel .download-button { min-height: 40px; padding: 8px 9px; font-size: 11px; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters .search { grid-column: 1 / -1; min-height: 44px; }
  .filters select, .filters .button { width: 100%; min-height: 44px; }
  .detail { padding: 22px 0 48px; }
  .detail-hero { grid-template-columns: 78px minmax(0,1fr); align-items: center; gap: 13px; margin: 18px 0 20px; padding: 15px; border-radius: 18px; box-shadow: 5px 6px 0 #e1ebe3; }
  .detail-hero-image { grid-column: 1; grid-row: 1; width: 78px; height: 78px; border-radius: 16px; font-size: 30px; }
  .detail-hero-copy { min-width: 0; }
  .detail-hero h1 { margin: 7px 0 5px; font-size: clamp(25px, 7vw, 34px); line-height: 1.06; letter-spacing: -1px; overflow-wrap: anywhere; }
  .detail-hero .lead { margin: 0; font-size: 12px; line-height: 1.45; }
  .detail-hero-copy > .tag { font-size: 9px; }
  .detail-hero .hero-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 11px; }
  .detail-hero .hero-actions .button { min-height: 44px; padding: 10px 8px; font-size: 12px; }
  .detail-grid { grid-template-columns: minmax(0,1fr); gap: 18px; padding-top: 10px; }
  .facts-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
  .facts-grid > div { min-width: 0; padding: 12px; border-radius: 12px; }
  .facts-grid > div:last-child { grid-column: 1 / -1; }
  .facts-grid small { font-size: 9px; line-height: 1.25; }
  .facts-grid strong { margin-top: 5px; font-size: 15px; overflow-wrap: anywhere; }
  .content-section { margin-top: 10px; padding: 17px 15px; border-radius: 14px; }
  .content-section h2 { font-size: 20px; line-height: 1.2; letter-spacing: -.5px; overflow-wrap: anywhere; }
  .content-section .detail-copy { margin-top: 10px; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
  .source-strip { gap: 12px; margin-top: 10px; padding: 15px; border-radius: 14px; }
  .source-strip .button, .promo-card .button { min-height: 44px; }
  .related-section { margin-top: 12px; padding: 15px; border-radius: 14px; }
  .related-heading { gap: 6px; margin-bottom: 10px; }
  .related-heading h2 { font-size: 21px; }
  .related-grid { gap: 8px; }
  .related-card { min-height: 64px; padding: 8px; }
  .related-icon { width: 46px; height: 46px; border-radius: 12px; }
  .detail-sidebar { position: static; gap: 10px; }
  .promo-card { padding: 17px; border-radius: 14px; }
  .detail-panel { min-width: 0; overflow-wrap: anywhere; }
  .seo-content { padding: 42px 0 48px; }
  .seo-copy h2 { font-size: 28px; line-height: 1.15; letter-spacing: -.8px; }
  .seo-copy h3 { margin-top: 24px; font-size: 20px; }
  .seo-copy p, .seo-copy li { font-size: 14px; }
  .site-footer { padding: 17px 0; }
  .footer-inner { align-items: flex-start; font-size: 10px; line-height: 1.6; }
  .footer-inner > * { max-width: 100%; }
  .side-app-ads, .side-app-ad, .floating-ads, .floating-ad { display: none !important; }
  .admin-main { padding-top: 20px; }
  .admin-header .nav { min-height: 60px; height: auto; flex-wrap: wrap; padding: 9px 0; }
  .admin-nav { max-width: 100%; gap: 12px; overflow-x: auto; white-space: nowrap; font-size: 12px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 680px; }
  .editor-form { padding: 15px; }
  .editor-form input, .editor-form textarea, .editor-form select { font-size: 16px; }
  .form-actions { position: sticky; bottom: 0; z-index: 5; padding: 10px 0 max(10px, env(safe-area-inset-bottom)); background: rgba(246,248,245,.96); backdrop-filter: blur(10px); }
  .media-grid { gap: 9px; }
  .media-card-body { padding: 9px; }
  .media-actions { flex-wrap: wrap; }
  .media-actions .button { min-height: 40px; }
  button, .button, a { -webkit-tap-highlight-color: transparent; }
}

/* Admin CMS: compact navigation, touch-friendly forms, and dashboard cards on phones. */
@media (max-width: 760px) {
  body.admin-page { overflow-x: hidden; }
  .admin-header .nav {
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0 12px;
  }
  .admin-header .brand { min-width: 0; font-size: 14px; }
  .admin-header .brand-logo { width: 38px; height: 38px; object-fit: cover; }
  .admin-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
    max-width: none;
    overflow: visible;
    white-space: normal;
    font-size: 12px;
  }
  .admin-nav a {
    display: flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8faf8;
    text-align: center;
    line-height: 1.25;
  }
  .admin-main { padding: 24px 0 44px; }
  .admin-title { gap: 14px; margin-bottom: 18px; }
  .admin-title h1 { font-size: clamp(27px, 8vw, 34px); line-height: 1.08; letter-spacing: -1.2px; overflow-wrap: anywhere; }
  .admin-title p { font-size: 13px; line-height: 1.55; }
  .admin-title > .button { width: 100%; min-height: 44px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 20px 0; }
  .stats > div { min-width: 0; padding: 12px 10px; }
  .stats small { font-size: 10px; line-height: 1.3; }
  .stats strong { margin-top: 5px; font-size: 23px; }
  .table-wrap { overflow: visible; border: 0; background: transparent; }
  .table-wrap table { display: block; width: 100%; min-width: 0; }
  .table-wrap thead { display: none; }
  .table-wrap tbody { display: grid; gap: 10px; }
  .table-wrap tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(31, 48, 39, .045);
  }
  .table-wrap td,
  .table-wrap td:first-child {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 12px;
  }
  .table-wrap td:first-child { grid-column: 1 / -1; }
  .table-wrap td:first-child strong { font-size: 14px; }
  .table-wrap td:first-child small { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.4; }
  .table-wrap td:nth-child(2)::before,
  .table-wrap td:nth-child(3)::before,
  .table-wrap td:nth-child(4)::before,
  .table-wrap td:nth-child(5)::before {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font: 10px 'DM Mono', monospace;
    text-transform: uppercase;
    letter-spacing: .04em;
  }
  .table-wrap td:nth-child(2)::before { content: 'Category'; }
  .table-wrap td:nth-child(3)::before { content: 'Status'; }
  .table-wrap td:nth-child(4)::before { content: 'Updated'; }
  .table-wrap td:nth-child(5)::before { content: 'Actions'; }
  .table-wrap td:nth-child(5) { grid-column: 1 / -1; padding-top: 9px; border-top: 1px solid var(--line); }
  .table-actions { gap: 10px; }
  .table-action, .table-delete { display: inline-flex; min-height: 36px; align-items: center; padding: 6px 12px; border: 1px solid var(--line); border-radius: 9px; background: #f8faf8; }
  .editor-form { gap: 16px; padding: 16px; border-radius: 14px; }
  .editor-form h3 { margin-bottom: 0; font-size: 17px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .editor-form label { min-width: 0; line-height: 1.45; }
  .editor-form input:not([type="checkbox"]):not([type="color"]):not([type="range"]),
  .editor-form textarea,
  .editor-form select,
  .stack input { min-height: 44px; max-width: 100%; font-size: 16px; }
  .editor-form textarea { min-height: 100px; }
  .check-row { flex-direction: column; gap: 11px; }
  .check-row label { min-height: 32px; }
  .form-actions { position: sticky; bottom: 0; gap: 8px; margin: 0 -16px -16px; padding: 10px 16px max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-radius: 0 0 14px 14px; }
  .form-actions .button { min-width: 0; min-height: 44px; padding: 10px 12px; }
  .branding-preview { flex-wrap: wrap; gap: 18px; padding: 12px; }
  .branding-preview img { width: 88px; height: 88px; }
  .theme-color-grid { gap: 12px; }
  .color-input-row { grid-template-columns: 52px minmax(0, 1fr); gap: 8px; }
  .media-upload-card { margin: 16px 0; padding: 12px; }
  .media-upload-form { gap: 10px; }
  .media-upload-form > .button { width: 100%; min-height: 44px; }
  .upload-drop { min-width: 0; padding: 14px; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .media-card { min-width: 0; }
  .media-preview { height: auto !important; aspect-ratio: 1 / 1; }
  .media-card-body { min-width: 0; padding: 10px; }
  .media-card-body small { overflow-wrap: anywhere; line-height: 1.4; }
  .media-url { min-width: 0; font-size: 11px; }
  .media-actions { align-items: stretch; gap: 6px; }
  .media-actions .button { min-width: 0; min-height: 40px; padding: 8px; font-size: 11px; }
  .media-actions form { margin-left: 0; }
  .login-card { padding: 24px 20px; }
  .login-card h1 { font-size: 32px; }
}

@media (max-width: 390px) {
  .admin-nav { gap: 6px; }
  .admin-nav a { min-height: 38px; padding: 7px 6px; font-size: 11px; }
  .stats > div { padding: 10px 7px; }
  .stats small { font-size: 9px; }
  .stats strong { font-size: 21px; }
  .table-wrap tr { gap: 10px; padding: 12px; }
  .media-grid { gap: 8px; }
  .media-card-body { padding: 8px; }
  .media-actions { flex-direction: column; }
  .media-actions .button, .media-actions form, .media-actions form button { width: 100%; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
}

@media (max-width: 390px) {
  .container { width: calc(100% - 24px); }
  .top-app-promo { gap: 7px; padding: 8px; }
  .top-promo-icon { width: 44px; height: 44px; border-radius: 12px; }
  .top-promo-copy strong { font-size: 12px; }
  .top-promo-copy small { font-size: 9px; }
  .top-promo-arrow { min-height: 36px; padding: 0 7px; font-size: 9px; }
  body #directory > .app-grid .app-card, body .spotlight .collection-panel .app-card { grid-template-columns: 50px minmax(0,1fr) auto; column-gap: 7px; padding: 8px; }
  body #directory > .app-grid .app-icon, body .spotlight .collection-panel .app-icon { width: 50px; height: 50px; border-radius: 11px; }
  body #directory > .app-grid .app-card h3, body .spotlight .collection-panel .app-card h3 { font-size: 12px; }
  body #directory > .app-grid .app-meta span, body .spotlight .collection-panel .app-meta span { font-size: 9px; }
  body #directory > .app-grid .download-button, body .spotlight .collection-panel .download-button { padding: 7px 6px; font-size: 10px; }
  .detail-hero { grid-template-columns: 64px minmax(0,1fr); gap: 10px; padding: 12px; }
  .detail-hero-image { width: 64px; height: 64px; border-radius: 13px; }
  .detail-hero h1 { font-size: 25px; }
  .detail-hero .hero-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .top-app-promo, .top-promo-icon, .ambient-particle, .brand-logo { animation: none !important; }
  * { scroll-behavior: auto !important; }
}

@media (max-width: 760px) {
  body .detail-hero { grid-template-columns: minmax(0,1fr); justify-items: center; text-align: center; gap: 12px; padding: 20px 16px; }
  .detail-hero .detail-hero-image { grid-column: 1; grid-row: 1; width: 136px; height: 136px; margin: 0 auto; border-radius: 24px; }
  .detail-hero .detail-hero-copy { grid-column: 1; grid-row: 2; width: 100%; display: flex; flex-direction: column; align-items: center; }
  .detail-hero-copy > .tag { order: 0; }
  .detail-hero-copy h1 { order: 1; margin: 9px 0 7px; }
  .detail-title-rating { order: 2; margin: 0 0 4px; }
  .detail-hero-copy .lead { order: 3; max-width: 34em; }
  .detail-hero .hero-actions { grid-column: 1; grid-row: 3; width: 100%; margin-top: 3px; }
}
@media (max-width: 390px) {
  body .detail-hero { padding: 17px 12px; gap: 10px; }
  .detail-hero .detail-hero-image { width: 120px; height: 120px; border-radius: 21px; }
}

@media (max-width: 760px) {
  .detail-hero .hero-actions { display: flex; justify-content: center; width: 100%; }
  .detail-hero .hero-actions .detail-download-stack { width: 80vw; max-width: 360px; align-items: stretch; }
  .detail-hero .hero-actions .detail-download-stack > .button { width: 100%; min-height: 48px; }
  .detail-hero .hero-actions > .button-ghost { display: none !important; }
}
