body.ios {
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    --card-radius: 20px;
    --card-radius-lg: 28px;
    --input-radius: 16px;
    --button-radius: 9999px;
    --card-pad: 16px;
    --card-pad-lg: 24px;
    --pill-radius: 9999px;
    --pill-pad: 4px 10px;
    --actionbar-radius: 20px;
    --actionbar-pad: 10px 12px;
    --actionbar-pad-lg: 16px 20px;
    --icon-btn-size: 40px;
    --icon-btn-size-lg: 44px;
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    background: radial-gradient(circle at top, rgba(6, 6, 239, 0.04), transparent 45%),
                linear-gradient(180deg, rgba(251, 248, 245, 0.92), rgba(251, 248, 245, 1));
}

/* Harmonized radius scale */
body.ios .rounded-card,
body.ios .rounded-2xl,
body.ios .rounded-xl,
body.ios .rounded-lg {
    border-radius: var(--card-radius) !important;
}
body.ios .rounded-input {
    border-radius: var(--input-radius) !important;
}
body.ios .rounded-button {
    border-radius: var(--button-radius) !important;
}

/* Mobile-first typography scale */
@media (max-width: 767px) {
    body.ios h1 {
        font-size: 1.25rem !important; /* 20px */
        line-height: 1.3;
    }
    body.ios h2 {
        font-size: 1.125rem !important; /* 18px */
        line-height: 1.35;
    }
    body.ios h3 {
        font-size: 1rem !important; /* 16px */
        line-height: 1.4;
    }
    body.ios h4 {
        font-size: 0.9375rem !important; /* 15px */
        line-height: 1.4;
    }
}

/* Page padding under fixed header */
body.ios .app-page {
    padding-top: 52px !important;
}
@media (min-width: 768px) {
    body.ios .app-page {
        padding-top: 96px !important;
    }
}

/* iOS-like card feel (only white cards) */
body.ios .bg-white.rounded-card,
body.ios .bg-white.rounded-2xl {
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-color: rgba(46, 45, 44, 0.08) !important;
    box-shadow: 0 10px 24px rgba(17, 17, 17, 0.08);
}

body.ios .ios-solid {
    background: #FFFFFF !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#rejectModal .bg-white.rounded-card,
#rejectModal .bg-white.rounded-card.ios-solid,
#allRejectedModal .bg-white.rounded-card {
    background: #FFFFFF !important;
}

/* Line-height consistency */
body.ios h1,
body.ios h2,
body.ios h3 {
    line-height: 1.3;
}

/* iOS card + pill system */
body.ios .ios-card {
    background: var(--card-bg, rgba(255, 255, 255, 0.94)) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: var(--card-border-width, 1px) solid var(--card-border-color, rgba(46, 45, 44, 0.08)) !important;
    box-shadow: var(--card-shadow, 0 10px 22px rgba(17, 17, 17, 0.08)) !important;
    border-radius: var(--card-radius) !important;
    padding: var(--card-pad) !important;
}

body.ios .ios-card-lg {
    --card-pad: 1.5rem;
    --card-pad-lg: 2rem;
    --card-border-width: 2px;
}

body.ios .ios-card-xl {
    --card-pad: 1.5rem;
    --card-pad-lg: 3rem;
    --card-border-width: 2px;
}

body.ios .border-primary {
    --card-border-color: rgba(6, 6, 239, 0.45);
}

body.ios .border-success {
    --card-border-color: rgba(0, 200, 83, 0.45);
}

body.ios .border-reject {
    --card-border-color: rgba(229, 57, 53, 0.45);
}

body.ios .border-dark\\/10 {
    --card-border-color: rgba(46, 45, 44, 0.1);
}

body.ios .border-amber-400\\/40 {
    --card-border-color: rgba(251, 191, 36, 0.4);
}

body.ios .border-reject\\/30 {
    --card-border-color: rgba(229, 57, 53, 0.3);
}

/* CTA buttons (desktop text visible, mobile compact) */
body.ios .ios-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--pill-radius);
    font-size: 0.875rem;
    font-weight: 600;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

body.ios .ios-cta--primary {
    background: #0606EF;
    color: white;
}

body.ios .ios-cta--ghost {
    background: transparent;
    color: #0606EF;
    border-color: rgba(6, 6, 239, 0.4);
}

body.ios .ios-cta--ghost:hover,
body.ios .ios-cta--primary:hover {
    text-decoration: none;
}

@media (hover: hover) {
    body.ios .ios-cta--primary:hover {
        background: #0505CC;
        box-shadow: 0 10px 18px rgba(6, 6, 239, 0.2);
    }

    body.ios .ios-cta--ghost:hover {
        background: rgba(6, 6, 239, 0.08);
    }
}

@media (min-width: 768px) {
    body.ios .ios-cta {
        padding: 0.9rem 1.75rem;
    }
}

/* Details elements (summary) */
body.ios details > summary {
    list-style: none;
    cursor: pointer;
}
body.ios details > summary::-webkit-details-marker {
    display: none;
}
body.ios details > summary::after {
    content: '›';
    float: right;
    color: rgba(46, 45, 44, 0.45);
    transition: transform 0.2s ease;
}
body.ios details[open] > summary::after {
    transform: rotate(90deg);
}

body.ios .anim-delay {
    animation-delay: var(--anim-delay, 0s);
}

body.ios .is-muted {
    opacity: 0.6;
}
@media (min-width: 768px) {
    body.ios .ios-card {
        padding: var(--card-pad-lg) !important;
        border-radius: var(--card-radius-lg) !important;
    }
}
body.ios .ios-pill {
    border-radius: var(--pill-radius) !important;
    padding: var(--pill-pad) !important;
    border: 1px solid rgba(46, 45, 44, 0.1) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 0.875rem !important;
    font-weight: 600;
}

/* Stack rhythm */
body.ios .ios-stack > * + * {
    margin-top: var(--space-sm) !important;
}
@media (min-width: 768px) {
body.ios .ios-stack > * + * {
        margin-top: var(--space-lg) !important;
    }
}

/* Tighter list rhythm on mobile */
body.ios .ios-tight > * + * {
    margin-top: var(--space-xs) !important;
}
@media (min-width: 768px) {
    body.ios .ios-tight > * + * {
        margin-top: var(--space-md) !important;
    }
}

/* Common section spacing */
body.ios #actionTiles,
body.ios .quick-actions {
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}
body.ios #ideasGrid,
body.ios #resultsGrid {
    gap: var(--space-lg);
}
body.ios #historyGrid {
    gap: var(--space-sm);
}

/* Card header */
body.ios .ios-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Section spacing */
body.ios .section-block {
    margin-top: 8px;
}
@media (min-width: 768px) {
    body.ios .section-block {
        margin-top: 16px;
    }
}

body.ios .ios-card-header .ios-truncate {
    min-width: 0;
}

body.ios .ios-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* iOS controls */
body.ios input,
body.ios select,
body.ios textarea {
    border-radius: 16px !important;
    border-color: rgba(46, 45, 44, 0.12) !important;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: inset 0 1px 2px rgba(17, 17, 17, 0.06);
}

/* iOS header + bottom nav refinement */
body.ios .app-header {
    background: rgba(251, 248, 245, 0.9);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(46, 45, 44, 0.08);
}
body.ios .app-header__nav-link {
    border-radius: 12px;
}
body.ios .bottom-nav {
    background: rgba(251, 248, 245, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(46, 45, 44, 0.08);
}
body.ios .bottom-nav__item {
    border-radius: 16px;
}

/* Mobile radius adjustments */
@media (max-width: 767px) {
    body.ios .rounded-card,
    body.ios .rounded-2xl,
    body.ios .rounded-input,
    body.ios .rounded-button {
        border-radius: 20px !important;
    }
}

/* Sticky bars: slimmer + glass */
body.ios .ios-sticky {
    padding: var(--actionbar-pad) !important;
    border-radius: var(--actionbar-radius) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 22px rgba(6, 6, 239, 0.16);
}

/* Action bars */
body.ios .ios-actionbar {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
}
body.ios .ios-actionbar .ios-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* FAB offset from bottom nav */
body.ios .fab {
    position: fixed;
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom, 0) + 94px) !important;
    z-index: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem 1.25rem;
    min-height: 48px;
    white-space: nowrap;
}
@media (max-width: 639px) {
    body.ios .fab {
        width: 56px;
        height: 56px;
        padding: 0;
        border-radius: 9999px;
        justify-content: center;
    }
}
@media (min-width: 1024px) {
    body.ios .fab {
        right: 32px;
        bottom: 32px !important;
    }
}

/* FAB */
body.ios .ios-fab {
    background: rgba(6, 6, 239, 0.92) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 18px 30px rgba(6, 6, 239, 0.28);
}

/* Inputs + buttons sizing */
body.ios input,
body.ios select,
body.ios textarea {
    min-height: 44px;
}
body.ios button.rounded-button {
    min-height: 40px;
}

/* Icon button sizing */
body.ios .ios-icon-btn {
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
@media (max-width: 767px) {
    body.ios .ios-icon-btn {
        width: var(--icon-btn-size);
        height: var(--icon-btn-size);
        padding: 0 !important;
    }
}
@media (min-width: 768px) {
    body.ios .ios-icon-btn {
        height: var(--icon-btn-size-lg);
        padding: 0 14px !important;
        gap: 8px;
    }
}

/* Icon sizing */
body.ios .ios-icon-btn svg,
body.ios .fab__icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Material Icons inline sizing */
.material-icons.icon-inline,
.material-icons-outlined.icon-inline {
    font-size: 1.2em;
    vertical-align: -0.15em;
    line-height: 1;
}

/* Default icon color */
body.ios svg {
    color: #0606EF;
}

body.ios .text-white svg,
body.ios .voting-callout__confirmation-icon svg {
    color: #ffffff;
}

body.ios .text-primary svg {
    color: #0606EF;
}

body.ios .idea-overlay__delete-header svg,
body.ios .text-reject svg,
body.ios .text-reject\/10 svg {
    color: #E53935;
}

body.ios .text-success svg {
    color: #00C853;
}

body.ios .text-amber-700 svg {
    color: inherit;
}

/* Masonry layout helpers */
.masonry {
    column-gap: 16px;
}
.masonry-item {
    break-inside: avoid;
    margin-bottom: 16px;
    display: inline-block;
    width: 100%;
}
@media (min-width: 768px) {
    .masonry-2 {
        column-count: 2;
    }
    .masonry-item {
        margin-bottom: 24px;
    }
}

body.ios .ios-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.75rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232E2D2C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px;
}

/* Allow hover styles to surface on touch (tap) */
/* Focus ring */
body.ios :focus-visible {
    outline: 3px solid rgba(6, 6, 239, 0.3);
    outline-offset: 2px;
}

/* Ultra-small screens (<=330px) */
@media (max-width: 330px) {
    body.ios {
        --card-pad: 14px;
        --card-pad-lg: 18px;
        --actionbar-pad: 8px 10px;
        --actionbar-pad-lg: 12px 14px;
        --icon-btn-size: 36px;
        --icon-btn-size-lg: 40px;
        --space-xs: 6px;
        --space-sm: 10px;
        --space-md: 14px;
        --space-lg: 20px;
        --space-xl: 28px;
    }

    body.ios h1 { font-size: 1.125rem !important; }
    body.ios h2 { font-size: 1rem !important; }
    body.ios h3 { font-size: 0.95rem !important; }

    body.ios .ios-card-lg { --card-pad: 1rem; }
    body.ios .ios-card { --card-pad: 0.9rem; }

    body.ios .ios-cta {
        padding: 0.6rem 0.9rem;
    }

    body.ios .process-stepper {
        padding: 1rem 1.25rem;
    }

    body.ios .ios-card-header {
        gap: 8px !important;
        flex-wrap: wrap;
    }

    body.ios .ios-card-header .text-3xl,
    body.ios .ios-card-header .text-4xl {
        font-size: 1.5rem !important;
        line-height: 1.1;
    }

    body.ios .ios-pill {
        font-size: 0.7rem !important;
        padding: 3px 8px !important;
    }

    body.ios .ios-cta {
        font-size: 0.8rem;
        padding: 0.55rem 0.85rem;
    }

    body.ios .ios-actionbar {
        gap: 8px !important;
    }

    body.ios .ios-actionbar .ios-icon-btn {
        min-height: 36px;
        padding: 0.4rem 0.6rem;
    }

    body.ios .bottom-nav__item {
        padding: 6px 8px;
    }

    body.ios .bottom-nav__label {
        max-width: 54px;
    }

    body.ios #ideasGrid,
    body.ios #resultsGrid {
        gap: var(--space-md);
    }

    body.ios .idea-action-sheet__panel {
        border-radius: 16px;
        padding: 10px;
    }

    body.ios .idea-action-sheet__item {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}
