@media (max-width: 900px) {
    .toolhome-shell {
        overflow: clip;
    }

    .toolhome-layout {
        position: relative;
    }

    .toolhome-main {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 14px 12px 26px;
    }

    .toolhome-main > * {
        margin: 0;
    }

    .toolhome-mobile-rail {
        position: sticky;
        top: 10px;
        z-index: 14;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        padding: 8px;
        border: 1px solid rgba(96, 165, 250, 0.18);
        border-radius: 10px;
        background: rgba(11, 18, 33, 0.82);
        backdrop-filter: blur(16px);
        box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
    }

    .toolhome-mobile-button {
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 0 10px;
        border: 1px solid rgba(96, 165, 250, 0.18);
        border-radius: 8px;
        background: rgba(19, 30, 49, 0.9);
        color: #eef5ff;
        font-size: 0.79rem;
        font-weight: 850;
        text-decoration: none;
        white-space: nowrap;
    }

    .toolhome-mobile-button i {
        color: color-mix(in srgb, var(--home-accent) 74%, #ffffff);
        font-size: 0.84rem;
    }

    .toolhome-mobile-button.is-link {
        background: linear-gradient(135deg, color-mix(in srgb, var(--home-accent) 24%, transparent), rgba(56, 213, 255, 0.12));
    }

    .toolhome-mobile-details {
        display: block;
        border: 1px solid var(--home-line-strong);
        border-radius: var(--home-radius);
        padding: 11px;
        background: linear-gradient(180deg, rgba(28, 40, 64, 0.82), rgba(17, 26, 44, 0.84));
        box-shadow: var(--home-shadow);
    }

    .toolhome-mobile-details-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 10px;
    }

    .toolhome-mobile-details-head h2 {
        margin: 0;
        color: #f8fbff;
        font-size: 0.92rem;
        font-weight: 900;
    }

    .toolhome-mobile-details-head span {
        padding: 4px 8px;
        border-radius: 999px;
        background: color-mix(in srgb, var(--home-accent) 18%, transparent);
        color: color-mix(in srgb, var(--home-accent) 78%, #ffffff);
        font-size: 0.7rem;
        font-weight: 900;
    }

    .toolhome-mobile-detail-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .toolhome-mobile-detail-card {
        padding: 8px 9px;
        border: 1px solid rgba(148, 163, 184, 0.14);
        border-radius: 8px;
        background: rgba(15, 23, 42, 0.5);
    }

    .toolhome-mobile-detail-card span {
        width: 28px;
        height: 28px;
        display: grid;
        place-items: center;
        margin-bottom: 6px;
        border-radius: 8px;
        background: color-mix(in srgb, var(--home-accent) 22%, transparent);
        color: color-mix(in srgb, var(--home-accent) 78%, #ffffff);
    }

    .toolhome-mobile-detail-card strong {
        display: block;
        color: #f8fbff;
        font-size: 0.75rem;
        line-height: 1.35;
    }

    .toolhome-mobile-detail-card small {
        display: block;
        margin-top: 3px;
        color: var(--home-muted);
        font-size: 0.65rem;
        line-height: 1.35;
    }

    .toolhome-leftbar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 30;
        width: min(84vw, 312px);
        min-height: 100dvh;
        padding: 86px 12px 18px;
        overflow-y: auto;
        border-right: 1px solid var(--home-line);
        border-bottom: 0;
        background: linear-gradient(180deg, rgba(10, 17, 32, 0.98), rgba(7, 13, 25, 0.98));
        box-shadow: 24px 0 50px rgba(0, 0, 0, 0.38);
        transform: translateX(-104%);
        opacity: 0;
        visibility: hidden;
        transition: transform .22s ease, opacity .22s ease, visibility .22s ease;
    }

    body.toolhome-sidebar-open {
        overflow: hidden;
    }

    body.toolhome-sidebar-open .toolhome-leftbar {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }

    body.toolhome-sidebar-open::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 24;
        background: rgba(3, 8, 18, 0.62);
        backdrop-filter: blur(3px);
    }

    .toolhome-rightbar {
        display: none;
    }

    .toolhome-premium-card {
        display: none;
    }

    .why-card,
    .new-tools-card {
        display: none;
    }

    .toolhome-identity {
        grid-template-columns: 52px minmax(0, 1fr);
        gap: 12px;
        align-items: start;
    }

    .toolhome-hero-icon {
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
    }

    .toolhome-title-row h1 {
        font-size: 1.26rem;
        line-height: 1.08;
    }

    .toolhome-title-row span {
        font-size: 0.7rem;
    }

    .toolhome-hero p {
        margin-top: 5px;
        font-size: 0.82rem;
        line-height: 1.45;
    }

    .toolhome-pills {
        gap: 8px;
        margin-top: 10px;
    }

    .toolhome-pills li {
        font-size: 0.72rem;
    }

    .toolhome-mobile-rail {
        order: 1;
    }

    .toolhome-hero {
        order: 2;
        margin-bottom: 0;
    }

    nav[aria-label="Breadcrumb"] {
        order: 3;
        display: none;
    }

    .toolhome-search {
        order: 5;
        margin-bottom: 0;
    }

    .toolhome-mobile-details {
        order: 4;
    }

    .top-ad {
        order: 6;
        min-height: 62px;
    }

    .popular-tools-section {
        order: 7;
    }

    .mid-ad {
        order: 8;
        min-height: 62px;
    }

    .all-tools-section {
        order: 9;
    }

    .toolhome-newsletter {
        order: 10;
    }

    .bottom-ad {
        order: 11;
    }

    .toolhome-search {
        grid-template-columns: 34px minmax(0, 1fr) 108px;
        min-height: 46px;
        padding: 5px;
        border-color: rgba(96, 165, 250, 0.22);
        border-radius: 10px;
        background: rgba(13, 20, 36, 0.9);
        box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
    }

    .toolhome-search i {
        font-size: 0.88rem;
    }

    .toolhome-search input {
        padding-right: 8px;
        font-size: 0.84rem;
    }

    .toolhome-search button {
        min-height: 36px;
        border-radius: 8px;
        font-size: 0.8rem;
    }

    .toolhome-section {
        margin-top: 0;
    }

    .toolhome-section-head {
        margin-bottom: 10px;
    }

    .toolhome-section-head h2 {
        font-size: 0.92rem;
    }

    .toolhome-section-head a,
    .result-count {
        font-size: 0.74rem;
    }

    .toolhome-load-all {
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        padding: 0 11px;
        border: 1px solid color-mix(in srgb, var(--home-accent) 24%, transparent);
        border-radius: 999px;
        background: color-mix(in srgb, var(--home-accent) 14%, transparent);
        color: color-mix(in srgb, var(--home-accent) 78%, #ffffff);
        font: inherit;
        font-size: 0.74rem;
        font-weight: 900;
    }

    #all-tools .result-count {
        display: block;
        margin-top: 10px;
        text-align: right;
    }

    .popular-tool-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .popular-tool-card {
        min-height: 0;
        padding: 12px;
    }

    .tool-card-icon {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }

    .tool-card-badge {
        top: 12px;
        right: 12px;
        font-size: 0.66rem;
    }

    .popular-tool-card h3 {
        margin: 11px 0 5px;
        font-size: 0.86rem;
    }

    .popular-tool-card p {
        min-height: 0;
        margin-bottom: 10px;
        font-size: 0.74rem;
        line-height: 1.45;
    }

    .popular-tool-card a {
        min-height: 28px;
        font-size: 0.72rem;
    }

    .all-tool-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    body.toolhome-all-collapsed .all-tools-section .all-tool-grid {
        display: none;
    }

    body.toolhome-all-collapsed .all-tools-section .result-count {
        display: none;
    }

    body.toolhome-all-expanded .toolhome-load-all i {
        transform: rotate(180deg);
    }

    .all-tool-row {
        grid-template-columns: 34px minmax(0, 1fr) auto 14px;
        min-height: 56px;
        gap: 9px;
        padding: 9px 10px;
    }

    .row-icon {
        width: 30px;
        height: 30px;
    }

    .all-tool-row strong {
        font-size: 0.82rem;
    }

    .all-tool-row small {
        font-size: 0.7rem;
    }

    .toolhome-newsletter {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-top: 0;
        padding: 15px;
    }

    .toolhome-newsletter h2 {
        font-size: 0.92rem;
    }

    .toolhome-newsletter p {
        font-size: 0.76rem;
    }

    .toolhome-newsletter form {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .toolhome-newsletter input,
    .toolhome-newsletter button {
        min-height: 38px;
        font-size: 0.8rem;
    }

}

@media (max-width: 560px) {
    .toolhome-main {
        padding: 12px 10px 24px;
        gap: 10px;
    }

    .toolhome-mobile-rail {
        top: 8px;
        padding: 7px;
        gap: 7px;
    }

    .toolhome-mobile-button {
        min-height: 36px;
        gap: 6px;
        padding: 0 8px;
        font-size: 0.74rem;
    }

    .toolhome-hero-icon {
        width: 48px;
        height: 48px;
        font-size: 1.28rem;
    }

    .toolhome-identity {
        grid-template-columns: 48px minmax(0, 1fr);
        gap: 10px;
    }

    .toolhome-title-row h1 {
        font-size: 1.14rem;
    }

    .toolhome-hero p {
        font-size: 0.78rem;
    }

    .toolhome-search {
        grid-template-columns: 30px minmax(0, 1fr) 96px;
    }

    .toolhome-search button {
        grid-column: auto;
        border-radius: 8px;
    }

    .toolhome-mobile-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== TOOL HOME MOBILE APP POLISH ===== */
@media (max-width: 900px) {
    .toolhome-main {
        gap: 14px;
        padding: 16px 13px 28px;
    }

    .toolhome-mobile-rail {
        top: 8px;
        padding: 8px;
        gap: 8px;
        border-radius: 12px;
    }

    .toolhome-mobile-button {
        min-height: 42px;
        font-size: 0.88rem;
        border-radius: 10px;
    }

    .toolhome-identity {
        grid-template-columns: 54px minmax(0, 1fr);
        gap: 12px;
        align-items: center;
    }

    .toolhome-hero-icon {
        width: 54px;
        height: 54px;
        font-size: 1.35rem;
    }

    .toolhome-title-row {
        align-items: center;
        gap: 8px;
    }

    .toolhome-title-row h1 {
        font-size: 1.42rem;
        line-height: 1.08;
        letter-spacing: 0;
    }

    .toolhome-title-row span {
        font-size: 0.72rem;
        padding: 5px 9px;
    }

    .toolhome-hero p {
        font-size: 0.94rem;
        line-height: 1.45;
    }

    .toolhome-pills li {
        min-height: 28px;
        padding: 0 10px;
        font-size: 0.82rem;
    }

    .toolhome-mobile-details {
        padding: 12px;
        border-radius: 12px;
    }

    .toolhome-mobile-details-head h2 { font-size: 1rem; }

    .toolhome-mobile-detail-grid {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .toolhome-mobile-detail-card {
        min-height: 74px;
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr);
        column-gap: 10px;
        align-items: center;
        padding: 11px 12px;
        border-radius: 10px;
    }

    .toolhome-mobile-detail-card span {
        width: 34px;
        height: 34px;
        margin: 0;
        grid-row: 1 / span 2;
    }

    .toolhome-mobile-detail-card strong {
        font-size: 0.93rem;
        line-height: 1.25;
    }

    .toolhome-mobile-detail-card small {
        margin-top: 2px;
        font-size: 0.78rem;
        line-height: 1.38;
    }

    .toolhome-search {
        grid-template-columns: 38px minmax(0, 1fr);
        gap: 0;
        min-height: auto;
        padding: 6px;
        border-radius: 12px;
    }

    .toolhome-search i { font-size: 1rem; }

    .toolhome-search input {
        min-height: 42px;
        font-size: 0.94rem;
    }

    .toolhome-search button {
        grid-column: 1 / -1;
        min-height: 42px;
        margin-top: 6px;
        border-radius: 10px;
        font-size: 0.9rem;
    }

    .popular-tool-card,
    .all-tool-row { border-radius: 12px; }

    .popular-tool-card { padding: 14px; }

    .popular-tool-card h3 { font-size: 1rem; }

    .popular-tool-card p,
    .all-tool-row small {
        font-size: 0.82rem;
        line-height: 1.42;
    }

    .all-tool-row {
        grid-template-columns: 38px minmax(0, 1fr) 14px;
        min-height: 64px;
        padding: 11px 12px;
    }

    .all-tool-row em { display: none; }
}

@media (max-width: 430px) {
    .toolhome-main { padding: 14px 11px 26px; }
    .toolhome-title-row h1 { font-size: 1.28rem; }
    .toolhome-hero p { font-size: 0.88rem; }
    .toolhome-mobile-button {
        min-height: 40px;
        font-size: 0.82rem;
    }
}

/* ===== TOOLHOME MOBILE OVERLAP FIX ===== */
@media (max-width: 900px){
    .toolhome-mobile-rail{
        position:relative;
        top:auto;
        z-index:5;
    }

    .toolhome-pills{
        display:flex;
        flex-wrap:wrap;
        overflow:visible;
    }

    .toolhome-pills li{
        flex:0 0 auto;
    }

    .toolhome-title-row{
        flex-wrap:wrap;
    }
}

/* ===== TOOLHOME MOBILE FIT FINAL ===== */
@media(max-width:900px){
    .toolhome-mobile-rail{ margin-top:8px; }
    .toolhome-main{ padding-top:18px; }
    .toolhome-hero,
    .toolhome-identity,
    .toolhome-title-row,
    .toolhome-title-row h1,
    .toolhome-hero p,
    .toolhome-section,
    .popular-tool-card,
    .all-tool-row{
        min-width:0;
        max-width:100%;
    }

    .toolhome-identity > div{ min-width:0; }
    .toolhome-hero p{ overflow-wrap:anywhere; }
    .toolhome-title-row h1{ word-break:normal; overflow-wrap:anywhere; }
}

/* ===== MOBILE CONTENT WIDTH GUARD ===== */
@media(max-width:900px){
    .toolhome-shell,.toolhome-main,.toolhome-hero,.toolhome-section,.toolhome-search,.popular-tool-card,.all-tool-row{max-width:100%;min-width:0;}
    .toolhome-pills{flex-wrap:wrap;overflow:visible;}
}

/* ===== CATEGORY MOBILE FINAL POLISH ===== */
@media(max-width:900px){
    .toolhome-mobile-rail{
        margin-top:5px !important;
    }

    .toolhome-pills{
        justify-content:center;
        gap:8px;
        width:100%;
    }

    .toolhome-pills li{
        min-height:30px;
        display:inline-flex;
        align-items:center;
        justify-content:center;
        font-family:var(--dna-font-global, "Inter", system-ui, sans-serif);
        font-size:.82rem;
        font-style:italic;
        font-weight:850;
        line-height:1;
    }

    .toolhome-mobile-detail-grid{
        grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
        gap:10px !important;
    }

    .toolhome-mobile-detail-card{
        min-height:132px !important;
        grid-template-columns:1fr !important;
        justify-items:center;
        align-content:center;
        text-align:center;
        padding:12px 9px !important;
    }

    .toolhome-mobile-detail-card span{
        grid-row:auto !important;
        margin:0 0 8px !important;
    }

    .toolhome-mobile-detail-card:last-child:nth-child(odd){
        grid-column:1 / -1;
        width:min(50%, 180px);
        justify-self:center;
    }
}
