/* Phone ergonomics shared by Safari and the iOS app. Native chrome owns its safe areas. */
@media (max-width: 600px) {
    html:has(body.page-ask){height:auto;overflow-x:clip;overflow-y:auto;overscroll-behavior-y:none;touch-action:pan-y pinch-zoom}
    body.page-ask{height:auto;overflow:visible;overscroll-behavior-y:none}
    body.page-ask>main.wrap{height:auto;max-height:none;overflow:visible;padding-bottom:12px}
    body.page-ask .footer-end-space{height:24px}
    html { -webkit-text-size-adjust: 100%; }
    .wrap { padding-left:max(16px, env(safe-area-inset-left)); padding-right:max(16px, env(safe-area-inset-right)); }
    .topbar { padding-top:max(10px, env(safe-area-inset-top)); padding-bottom:10px; }
    .topbar-inner { flex-wrap:wrap; gap:10px; }
    .topbar-right { flex:1; justify-content:flex-end; flex-wrap:wrap; min-width:0; }
    .brand { padding:10px 12px; font-size:14px; }
    input:not([type=checkbox]):not([type=radio]), select, textarea { font-size:16px; max-width:100%; }
    button, .btn, .mini-btn, .icon-btn, .mode-toggle { min-height:44px; }
    .mode-toggle, .icon-btn { min-width:44px; }
    .btn:hover { transform:none; }
    .task-hero { padding:28px 0; }
    .task-hero h1 { font-size:clamp(38px,10vw,54px); }
    .task-hero > p { font-size:16px; }
    .hero, .hero.slim { padding:28px 0; }
    .narrow { padding-top:28px; padding-bottom:28px; }
    .model-card, .battle-box { padding:20px; }
    .card-foot, .share-row, .footer-inner { flex-wrap:wrap; gap:12px; }
    .share-row input { min-width:0; flex:1 1 180px; }
    .modal-backdrop { padding:16px; padding-top:max(16px, env(safe-area-inset-top)); padding-bottom:max(16px, env(safe-area-inset-bottom)); }
    .modal { max-height:85dvh; overflow-y:auto; width:100%; box-sizing:border-box; }
    .arena-vote-actions { gap:10px; }
    .arena-swipe-card { padding:18px; }
    .arena-swipe-card h2 { font-size:30px; }
    .arena-card-navigation { flex-wrap:wrap; }
    .task-card, .model-card, .arena-swipe-card, .auth-choice-card { overflow-wrap:anywhere; min-width:0; }
    .board-scroll, .api-table-scroll { overscroll-behavior-x:contain; }
    .account-page main { padding:20px 16px; }
    .account-toolbar, .activity-note-row { flex-wrap:wrap; }
    .account-profile { flex-wrap:wrap; }
}
/* The native app inserts this attribute before the document is parsed. */
html[data-platform=ios] body { padding-bottom:0; }
html[data-platform=ios] .topbar .mainnav.app-tabbar,
html[data-platform=ios] .topbar .brand { display:none; }
html[data-platform=ios] .topbar { position:static; padding:8px 0; }
html[data-platform=ios] .topbar-right { width:100%; justify-content:flex-end; }
html[data-platform=ios] .toast { bottom:16px; }
html[data-platform=ios] { scroll-padding-top:16px; scroll-padding-bottom:24px; }
html[data-platform=ios] .footer { margin-top:28px; }
html[data-platform=ios] .front-section-next { bottom:24px; }
html[data-platform=ios] .front-scroll-cue { bottom:20px; }
html[data-platform=ios] .page-front .editorial-hero-foot { bottom:52px; }
@media (max-width:600px) {
    /* The decorative model cloud extends beyond its layout box on small screens. */
    .editorial-hero { overflow:clip; }
    html[data-platform=ios] .editorial-hero { min-height:540px; height:540px; padding-top:16px; }
    html[data-platform=ios] .editorial-hero h1 { top:42px; font-size:clamp(42px,12vw,58px); gap:218px; }
    html[data-platform=ios] .model-cloud { top:44%; scale:.56; }
    html[data-platform=ios] .editorial-hero-foot { bottom:14px; gap:8px; }
    html[data-platform=ios] .editorial-hero-foot p { font-size:15px; }
    html[data-platform=ios] .front-scroll-cue { display:none; }
}

/* Native-first presentation. The website's desktop layouts stay intact. */
.ios-explore-intro { display:none; }
html[data-platform=ios] { --font:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
html[data-platform=ios] body { font-family:var(--font); line-height:1.5; }
html[data-platform=ios] .topbar { display:none; }
html[data-platform=ios] h1, html[data-platform=ios] h2, html[data-platform=ios] h3,
html[data-platform=ios] button, html[data-platform=ios] .btn {
    font-family:var(--font); text-transform:none; letter-spacing:normal;
}
html[data-platform=ios] h1 { font-size:28px; line-height:1.15; }
html[data-platform=ios] .page-models .editorial-hero { display:none; }
html[data-platform=ios] .ios-explore-intro { display:block; padding:24px 0 16px; }
html[data-platform=ios] .ios-explore-intro h1 { margin:0 0 10px; max-width:290px; }
html[data-platform=ios] .ios-explore-intro p { color:var(--dim); margin:0 0 8px; }
html[data-platform=ios] .ios-explore-intro a { display:inline-flex; align-items:center; min-height:44px; font-weight:600; }
html[data-platform=ios] .recommendations-toolbar { flex-wrap:wrap; gap:8px; margin-bottom:12px; }
html[data-platform=ios] .task-grid { grid-template-columns:minmax(0,1fr); gap:10px; }
html[data-platform=ios] .task-card { border-radius:16px; box-shadow:none; }
html[data-platform=ios] .ios-task-disclosure > summary {
    display:flex; align-items:center; gap:12px; padding:14px; list-style:none; cursor:pointer;
}
html[data-platform=ios] .ios-task-disclosure > summary::-webkit-details-marker { display:none; }
html[data-platform=ios] .ios-task-disclosure .task-art { width:56px; height:56px; flex:0 0 56px; border-radius:12px; }
html[data-platform=ios] .ios-task-disclosure > summary > div:nth-child(2) { min-width:0; flex:1; }
html[data-platform=ios] .ios-task-disclosure h3 { font-size:17px; margin:0 0 4px; line-height:1.2; }
html[data-platform=ios] .ios-task-disclosure summary p { font-size:13px; margin:0; line-height:1.4; }
html[data-platform=ios] .ios-disclosure-arrow { color:var(--dim); font-size:26px; }
html[data-platform=ios] .ios-task-disclosure[open] > summary .ios-disclosure-arrow { transform:rotate(90deg); }
html[data-platform=ios] .ios-task-disclosure .task-card-body { padding:0 16px 16px; }
html[data-platform=ios] .ios-task-disclosure .task-card-body::before { display:none; }
html[data-platform=ios] summary { min-height:44px; align-content:center; }
html[data-platform=ios] button, html[data-platform=ios] .btn { min-height:44px; }
html[data-platform=ios] :focus-visible { outline:3px solid var(--accent,#763fe6); outline-offset:3px; }
html[data-platform=ios] .swipe-arena { padding:16px 0 24px; }
html[data-platform=ios] .arena-swipe-card { padding:18px; border-radius:20px; box-shadow:none; }
html[data-platform=ios] .arena-swipe-card h2 { font-size:28px; line-height:1.2; margin:14px 0; }
html[data-platform=ios] .arena-model-question { margin:16px 0; }
html[data-platform=ios] .arena-choice { min-height:60px; padding:14px 10px; border-radius:14px; flex-wrap:wrap; }
html[data-platform=ios] .arena-card-navigation { margin-top:12px; }
html[data-platform=ios] .arena-source { margin-top:12px; padding-top:6px; }
html[data-platform=ios] .arena-swipe-hint { font-size:13px; }
html[data-platform=ios] .chart-view-toggle button { min-height:44px; }
html[data-platform=ios] .api-table-scroll { overflow:visible; border:0; }
html[data-platform=ios] .api-model-table { display:block; width:100%; min-width:0; }
html[data-platform=ios] .api-model-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
html[data-platform=ios] .api-model-table tbody { display:grid; gap:16px; }
html[data-platform=ios] .api-model-table tbody tr { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); border:1px solid var(--line); border-radius:16px; background:var(--card); overflow:hidden; }
html[data-platform=ios] .api-model-table tbody th { grid-column:1/-1; display:block; width:auto; padding:16px; }
html[data-platform=ios] .api-model-table td { display:block; min-width:0; width:auto; padding:12px 16px; white-space:normal; overflow-wrap:anywhere; border-top:1px solid var(--line); }
html[data-platform=ios] .api-model-table td::before { content:attr(data-label); display:block; font-size:12px; font-weight:500; color:var(--dim); margin-bottom:5px; }
html[data-platform=ios] .api-model-table .api-source-links { grid-column:1/-1; }
html[data-platform=ios] .api-source-links a { display:inline-flex; align-items:center; min-height:44px; margin-right:16px; }
html[data-platform=ios] [hidden] { display:none!important; }
html[data-platform=ios] .account-page main > a:first-child { display:none; }
html[data-platform=ios] #account-logout { display:block; margin-left:auto; }
html[data-platform=ios] .account-profile { gap:16px; margin-top:16px; }
html[data-platform=ios] .account-profile h1 { font-size:26px; }
html[data-platform=ios] .account-stats { grid-template-columns:repeat(3,minmax(0,1fr)); }
html[data-platform=ios] .footer { font-size:12px; padding-bottom:16px; }
html[data-platform=ios] .page-models .recommendations-toolbar { flex-wrap:nowrap; }
html[data-platform=ios] .page-models .recommendations-toolbar > p { flex:1; font-size:12px; }
html[data-platform=ios] #refreshRecommendations { font-size:12px; padding:8px 12px; white-space:nowrap; }
html[data-platform=ios] .page-models .recommendations-toolbar #recommendationsStatus:not([hidden]) { flex:1; }

/* October web UI sync: Feeds, the unified model catalog and section overview. */
html[data-platform=ios] .feeds-heading { padding:20px 0 16px; gap:12px; }
html[data-platform=ios] .feeds-heading h1 { font-size:28px; margin:0; }
html[data-platform=ios] .feeds-heading > .btn { font-size:14px; }
html[data-platform=ios] .feeds-layout { gap:16px; }
html[data-platform=ios] #communityPostList { grid-template-columns:minmax(0,1fr); gap:16px; }
html[data-platform=ios] .community-post { height:auto; border-radius:16px; overflow:visible; }
html[data-platform=ios] .feed-post-header { height:auto; flex-basis:auto; min-height:74px; padding:14px; }
html[data-platform=ios] .feed-post-content { flex:none; overflow:visible; padding:20px 16px; justify-content:flex-start; }
html[data-platform=ios] .community-post h2 { font-size:22px; margin-bottom:12px; }
html[data-platform=ios] .feed-post-footer { max-height:none; overflow:visible; padding:10px 14px 14px; }
html[data-platform=ios] .feed-author-meta time { white-space:normal; }
html[data-platform=ios] .feed-post-manage { max-width:none; gap:4px; }
html[data-platform=ios] .feed-action, html[data-platform=ios] .feed-permalink { min-width:44px; min-height:44px; }
html[data-platform=ios] .feed-post-manage button, html[data-platform=ios] .feed-comment-manage button { padding-inline:8px; }
html[data-platform=ios] .feed-comment-head { flex-wrap:wrap; gap:4px 12px; }
html[data-platform=ios] .feeds-toolbar #feedSearch { flex-basis:100%; width:100%; }
html[data-platform=ios] .feeds-toolbar #feedSort { flex:1; min-width:0; }
html[data-platform=ios] .feeds-toolbar .feeds-mine { min-height:44px; padding:0 8px; }
html[data-platform=ios] .feeds-page :is(input:not([type=checkbox]),textarea,select),
html[data-platform=ios] .feed-editor :is(input,textarea) { font-size:16px; min-height:44px; }
html[data-platform=ios] .feed-editor { padding:18px; border-radius:20px; max-height:calc(100dvh - 24px); }
html[data-platform=ios] .feed-editor-head h2 { font-size:24px; }
html[data-platform=ios] .feed-edit-actions { flex-wrap:wrap; }
html[data-platform=ios] .models-page-heading { padding:20px 0 16px; display:block; }
html[data-platform=ios] .models-page-heading h1 { font-size:28px; margin:0 0 16px; }
html[data-platform=ios] .models-view-selector { display:flex; width:100%; box-sizing:border-box; gap:4px; border-radius:12px; padding:4px; background:var(--card); border:1px solid var(--line); }
html[data-platform=ios] .models-view-selector a { flex:1; min-width:0; display:flex; align-items:center; justify-content:center; min-height:44px; padding:4px 8px; border-radius:9px; font-size:14px; text-align:center; }
html[data-platform=ios] .models-view-selector a[aria-current=page] { background:var(--accent); color:white; }
html[data-platform=ios] .model-suggestions { padding-top:8px; }
html[data-platform=ios] .suggestions-heading { flex-wrap:wrap; gap:12px; }
html[data-platform=ios] .suggestions-heading h2 { font-size:24px; }
html[data-platform=ios] .suggestion-filters { display:flex; overflow-x:auto; flex-wrap:nowrap; padding:4px 2px 12px; overscroll-behavior-x:contain; }
html[data-platform=ios] .suggestion-filter { flex:none; white-space:nowrap; }
html[data-platform=ios] .suggestion-grid { grid-template-columns:minmax(0,1fr); }
html[data-platform=ios] .suggestion-card { border-radius:16px; }
html[data-platform=ios] .suggestion-visual { height:140px; }
html[data-platform=ios] .suggestion-card h3 { white-space:normal; overflow-wrap:anywhere; }
html[data-platform=ios] .api-catalog-heading { padding:8px 0 16px; }
html[data-platform=ios] .api-catalog-heading h2 { font-size:24px; }
html[data-platform=ios] .front-section-page { min-height:0; display:flex; flex-direction:column; align-items:stretch; gap:16px; padding:24px 0; }
html[data-platform=ios] .front-section-copy h2 { font-size:28px; line-height:1.2; }
html[data-platform=ios] .front-section-description { font-size:16px; }
html[data-platform=ios] .front-section-art { min-height:0; padding:20px; border-radius:16px; }
html[data-platform=ios] .front-section-art > svg { width:64px; height:64px; }
html[data-platform=ios] .front-section-next { position:static; display:flex; align-items:center; min-height:44px; }
html[data-platform=ios] .page-front .editorial-hero-foot a { min-height:44px; display:flex; align-items:center; }
html[data-platform=ios]:has(body.page-front) { scroll-snap-type:none; scroll-padding-top:16px; }

@media (max-width:600px) {
    body > footer.footer { display:none; }
}

/* The native app supplies navigation, account access and theme controls. */
html[data-platform=ios] body>.topbar{display:none}
html[data-platform=ios] .nav-sidebar-backdrop{display:none}

@media(max-width:600px){html[data-ask-keyboard-open=true] .ask-history-ui,html[data-ask-keyboard-open=true] .mainnav.app-tabbar{display:none!important}}
