/* ECHOTAKE mobile usability layer — spacing and sizing only; preserves the existing visual theme. */
@media (max-width: 640px) {
  html { font-size: 16px; scroll-padding-top: 74px; -webkit-text-size-adjust: 100%; }
  body { font-size: 15px; line-height: 1.55; padding-bottom: calc(82px + env(safe-area-inset-bottom)) !important; }
  button, a, input, select, textarea { touch-action: manipulation; }
  button, .primary-btn, .ghost-btn, .danger-btn, .icon-btn, .save-btn { min-height: 44px; }
  input, select, textarea { font-size: 16px !important; }
  .topbar { height: 58px; padding: 7px 10px; gap: 8px; }
  .brand { padding: 5px 7px !important; gap: 0; max-width: 42vw; }
  .brand b { font-size: 1rem !important; }
  .top-actions { gap: 5px; }
  .top-actions .icon-btn { width: 42px; height: 42px; min-width: 42px; padding: 0; }
  .topbar .nav { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); gap: 4px; padding: 6px; }
  .topbar .nav a, .topbar .nav a:nth-child(n) { min-height: 44px; padding: 9px 12px; font-size: .76rem; }
  main { width: 100%; min-width: 0; }
  .hero { width: calc(100% - 20px); min-height: clamp(420px, 66svh, 560px); margin: 8px auto 0; border-radius: 18px; }
  .hero-content { padding: 24px 18px 26px; gap: 12px; }
  .hero h1 { font-size: clamp(2rem, 9.2vw, 3.2rem); line-height: 1.04; overflow-wrap: anywhere; }
  .hero p, .hero-overview { font-size: .92rem; line-height: 1.55; max-width: 42ch; }
  .hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .hero-actions > * { flex: 1 1 140px; min-width: 0; }
  .section, main > section { width: calc(100% - 24px); margin: 34px auto; scroll-margin-top: 72px; }
  .section-heading { gap: 8px; margin-bottom: 14px; }
  .section-heading h2 { font-size: clamp(1.25rem, 5.5vw, 1.65rem); line-height: 1.2; }
  .section-heading p, .section-description { font-size: .86rem; }
  .section-tools { width: 100%; gap: 8px; }
  .section-tools > * { min-width: 0; }
  .movie-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
  .movie-card { min-width: 0; border-radius: 12px; }
  .poster { aspect-ratio: 2 / 3; }
  .poster img { width: 100%; height: 100%; object-fit: cover; }
  .card-info { padding: 8px 8px 10px; }
  .card-title { font-size: .88rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  .card-sub { font-size: .75rem; margin-top: 3px; }
  .rating { font-size: .72rem; padding: 4px 6px; }
  .save-btn { width: 40px; height: 40px; min-height: 40px; top: 6px; right: 6px; }
  .filter-grid, .stats, .os-metrics, .about-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .filter-grid > *, .section-tools input, .section-tools select, .concierge input, .ai-chat-form input, .ai-chat-form textarea { width: 100%; min-width: 0; }
  .concierge-wrap { padding: 14px; }
  .concierge { gap: 10px; }
  .concierge input, .filter-grid select, .search-panel input { min-height: 48px; padding: 11px 12px; }
  .modal { align-items: flex-end; padding: 0 !important; }
  .modal .modal-card, .modal .battle-card, .modal .search-panel {
    width: 100% !important; max-width: 100% !important; max-height: 91svh !important;
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
    border-radius: 20px 20px 0 0 !important; padding: 16px 14px calc(18px + env(safe-area-inset-bottom));
  }
  .detail-hero { min-height: 150px; }
  .detail-content { padding: 14px 0; gap: 14px; }
  .netflix-detail { grid-template-columns: 88px minmax(0, 1fr); gap: 12px; }
  .netflix-detail .detail-poster { width: 88px; max-width: 88px; border-radius: 10px; }
  .detail-copy { min-width: 0; }
  .detail-copy h2 { font-size: 1.35rem; line-height: 1.18; overflow-wrap: anywhere; }
  .detail-overview { font-size: .9rem; line-height: 1.6; }
  .detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .detail-actions > * { width: 100%; min-width: 0; min-height: 44px; padding: 9px 10px; font-size: .84rem; }
  .detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
  .fact-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fact-row span { min-width: 0; overflow-wrap: anywhere; }
  .settings-card, .account-card {
    width: 100vw !important; max-width: 100vw !important; max-height: 94svh !important;
    margin: 0; padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0 !important; overflow-y: auto; overscroll-behavior: contain;
  }
  .settings-card h2, .settings-card h3, .account-card h2 { line-height: 1.25; overflow-wrap: anywhere; }
  .settings-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .settings-nav-item { min-width: 0; min-height: 44px; padding: 9px 7px; font-size: .78rem; }
  .settings-nav-item span { font-size: .75rem; line-height: 1.2; }
  .settings-panel { min-width: 0; }
  .settings-section { padding: 13px 11px; margin-bottom: 10px; }
  .settings-section h3 { font-size: 1rem; }
  .settings-section p, .settings-hint, .settings-status { font-size: .84rem; line-height: 1.5; overflow-wrap: anywhere; }
  .settings-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .settings-actions > *, .settings-footer > * { width: 100%; min-width: 0; min-height: 46px; }
  .settings-footer { position: sticky; bottom: -14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 0 2px; }
  .setting-row, .setting-label { gap: 10px; }
  .setting-row > *, .setting-label > * { min-width: 0; }
  .setting-row p, .setting-label p { overflow-wrap: anywhere; }
  .setting-toggle { flex: 0 0 auto; }
  .system-checks, .system-check-summary { overflow-wrap: anywhere; }
  .ai-movie-assistant { padding: 13px; }
  .ai-chat-form { grid-template-columns: minmax(0, 1fr); }
  .ai-chat-form button { width: 100%; min-height: 46px; }
  .ai-message { max-width: 100%; overflow-wrap: anywhere; }
  .person-detail { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 0 0 18px; }
  .person-detail-photo { width: 76px; }
  .person-detail > div { min-width: 0; padding-top: 12px; }
  .character-grid, .person-movie-grid, .similar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  footer { padding: 22px 16px; font-size: .82rem; overflow-wrap: anywhere; }
  .cinema-loading-label { font-size: 13px; }
  .cinema-loading-footer { align-items: flex-start; flex-direction: column; gap: 6px; }
}
@media (max-width: 380px) {
  .hero { min-height: 400px; }
  .hero-content { padding-inline: 15px; }
  .movie-grid { gap: 10px 8px; }
  .section, main > section { width: calc(100% - 20px); }
  .netflix-detail { grid-template-columns: 72px minmax(0, 1fr); }
  .netflix-detail .detail-poster { width: 72px; max-width: 72px; }
  .settings-card { padding-inline: 9px; }
  .settings-section { padding: 11px 9px; }
  .settings-footer { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .cinema-loading-screen::before, .cinema-loading-screen::after, .cinema-dot-field, .loading-pulse { animation: none !important; }
}


/* V32.5 — make every header action reachable on small screens. */
@media (max-width: 900px) {
  .topbar { display:flex; align-items:center; width:100%; min-width:0; padding-inline:12px; gap:8px; }
  .topbar > .brand { flex:0 1 auto; min-width:0; max-width:34vw; overflow:hidden; }
  .topbar > .nav { display:none !important; }
  .topbar .top-actions { display:flex; flex:1 1 auto; min-width:0; justify-content:flex-end; gap:6px; }
  .topbar .top-actions .icon-btn { display:inline-grid; flex:0 0 40px; width:40px; min-width:40px; height:40px; padding:0; font-size:1.05rem; }
  .topbar .top-actions #surpriseBtn { display:none !important; }
  .mobile-menu-btn { display:inline-grid !important; }
}
@media (max-width: 380px) {
  .topbar { padding-inline:8px; gap:5px; }
  .topbar > .brand { max-width:29vw; padding-inline:3px !important; }
  .topbar .top-actions { gap:4px; }
  .topbar .top-actions .icon-btn { flex-basis:35px; width:35px; min-width:35px; height:38px; border-radius:10px; }
}
.mobile-nav { z-index:9500; overflow-y:auto; overscroll-behavior:contain; padding-top:calc(18px + env(safe-area-inset-top)); padding-bottom:calc(20px + env(safe-area-inset-bottom)); }
.mobile-nav-inner { width:min(100%,560px); margin:0 auto; max-height:none; }
.mobile-nav-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:0 2px 8px; color:#fff; letter-spacing:.08em; }
.mobile-nav-heading .icon-btn { flex:0 0 42px; }
.mobile-quick-action { display:flex; align-items:center; gap:12px; width:100%; min-height:48px; padding:11px 14px; border:1px solid var(--line); border-radius:13px; background:rgba(255,255,255,.045); color:inherit; text-align:left; font:inherit; font-weight:750; cursor:pointer; }
.mobile-quick-action span { flex:1; }
.mobile-quick-action:focus-visible, .mobile-nav a:focus-visible, .topbar button:focus-visible { outline:2px solid #ff2633; outline-offset:2px; }
.mobile-nav-divider { height:1px; background:var(--line); margin:5px 0; }
.mobile-nav a { display:flex; align-items:center; min-height:46px; padding:12px 14px; }
@media (min-width: 641px) and (max-width: 900px) {
  .topbar .top-actions .icon-btn { flex-basis:42px; width:42px; min-width:42px; }
}


/* V33.1 final mobile finish */
@media(max-width:640px){
  .section{scroll-margin-top:82px}
  .section-heading{gap:12px;align-items:flex-start}
  .section-heading h2{line-height:1.16;overflow-wrap:anywhere}
  .movie-grid{min-width:0}
  .movie-card, .person-card, .collection-card{min-width:0}
  .movie-card h3,.movie-card-title{overflow-wrap:anywhere}
  .modal-card,.search-panel,.battle-card{max-width:calc(100vw - 16px)}
  input,select,textarea{font-size:16px!important}
  .mobile-quick-action{min-height:48px}
}
@media(max-width:360px){
  .section-heading{flex-direction:column}
  .et-final-footer{overflow-wrap:anywhere}
}
