/* ==================== Screenshot-style Mobile Header ==================== */
@media (max-width: 768px) {
    body {
        background: #fff;
    }

    .header {
        position: sticky;
        top: 0;
        z-index: 1200;
        box-shadow: none;
        border-bottom: 0;
        background: #fff;
    }

    .header .container {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        width: 100%;
        max-width: none;
        min-height: 0;
        height: auto;
        padding: 0;
        gap: 0;
    }

    .logo {
        order: 1;
        margin: 1px 0 1px 12px;
        max-width: 44%;
        min-height: 0;
        font-size: 15px;
        line-height: 1;
        padding: 2px 8px !important;
    }

    .logo img {
        max-height: 18px;
    }

    .logo span {
        max-width: 120px;
        font-size: 15px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-menu-btn {
        display: none;
    }

    .header-right {
        display: contents;
    }

    .auth-group {
        order: 2;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 0;
        margin-left: auto;
        margin-right: 12px;
        height: 40px;
        border-right: 0;
    }

    .auth-group .nav-link {
        min-width: 56px;
        height: 30px;
        padding: 0 10px;
        justify-content: center;
        border-radius: 0;
        color: #2c587b;
        font-size: 15px;
        font-weight: 700;
        background: transparent;
    }

    .auth-group .nav-link.active,
    .auth-group .nav-link:hover {
        color: #2c587b;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .auth-group .nav-divider {
        height: 32px;
        width: 1px;
        margin: 0 4px;
        color: transparent;
        background: #e5e5e5;
    }

    .user-menu-wrap,
    .header-right > div[style*="position:relative"] {
        order: 2;
        margin-left: auto;
    }

    .logout-btn,
    .header-right > a[href="/logout"] {
        order: 2;
        margin-right: 18px;
        color: #2c587b !important;
        font-size: 15px !important;
        font-weight: 700;
    }

    .nav {
        order: 3;
        display: flex;
        flex-wrap: nowrap;
        flex: 0 0 100%;
        width: 100%;
        height: 42px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        touch-action: pan-x;
        background: linear-gradient(#248cdf, #0863b8);
        border-top: 1px solid #4aa0e8;
        border-bottom: 1px solid #0a4e90;
        scrollbar-width: none;
    }

    .nav::-webkit-scrollbar {
        display: none;
    }

    .nav-link,
    .nav-dropdown {
        flex: 0 0 auto;
    }

    .nav-dropdown {
        min-width: max-content;
        position: relative;
    }

    .nav-link {
        height: 42px;
        min-width: 76px;
        padding: 0 12px;
        border-radius: 0;
        color: #050505;
        font-size: 15px;
        font-weight: 800;
        justify-content: center;
        background: transparent;
        border-right: 1px solid rgba(255,255,255,0.2);
        border-left: 1px solid rgba(0,0,0,0.08);
    }

    .auth-group .nav-link,
    .auth-group .nav-link.active,
    .auth-group .nav-link:hover {
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .nav-link.active,
    .nav-link:hover {
        color: #050505;
        background: rgba(255,255,255,0.12);
        border-left-color: rgba(0,0,0,0.08);
        border-right-color: rgba(255,255,255,0.2);
        box-shadow: inset 0 -3px 0 rgba(255,255,255,0.75);
    }

    .nav-dropdown > .nav-link {
        min-width: 96px;
    }

    .dropdown-menu {
        position: fixed;
        left: var(--mobile-dropdown-left, 12px);
        right: auto;
        top: var(--mobile-dropdown-top, 110px);
        width: auto;
        min-width: 108px;
        max-width: 168px;
        max-height: 42vh;
        overflow-y: auto;
        padding: 4px;
        margin-top: 0;
        border-radius: 4px;
        border: 1px solid #d7e6f5;
        box-shadow: 0 5px 14px rgba(0,0,0,0.16);
    }

    .nav-dropdown.mobile-open .dropdown-menu {
        display: block !important;
    }

    .dropdown-menu::before {
        display: none;
    }

    .dropdown-item {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 30px;
        padding: 5px 8px;
        border-radius: 3px;
        font-size: 13px;
        text-align: center;
        white-space: normal;
        color: #222;
    }

    .dropdown-item + .dropdown-item {
        margin-top: 2px;
    }

    .dropdown-item:hover {
        background: #e8f4ff;
    }

    .dropdown-item.active {
        color: #0969a9;
        background: #e8f4ff;
        font-weight: 700;
    }

    .search-box {
        order: 4;
        display: flex;
        align-items: center;
        flex: 0 0 calc(100% - 24px);
        width: calc(100% - 24px);
        height: 36px;
        margin: 5px 12px 4px;
        padding: 0;
        background: #fff;
        border: 1px solid #d9e0e7;
        border-radius: 0;
        box-shadow: 0 0 0 1px rgba(0,0,0,0.02);
    }

    .search-box:focus-within {
        border-color: #b8c9d9;
        box-shadow: none;
    }

    .search-input {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
        height: 100%;
        padding: 0 10px;
        color: #333;
        font-size: 15px;
    }

    .search-input::placeholder {
        color: #888;
    }

    .search-clear {
        flex: 0 0 auto;
        padding: 0 8px;
    }

    .search-btn {
        flex: 0 0 40px !important;
        width: 40px !important;
        height: 34px !important;
        margin-left: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 4px !important;
        background: none !important;
        color: #8c8c8c !important;
        overflow: hidden !important;
        box-shadow: none !important;
        position: static !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .search-btn::before {
        content: none;
    }

    .search-btn::after {
        content: none;
    }

    .search-icon {
        width: 18px;
        height: 18px;
    }

    .main {
        padding: 0;
    }

    .main > .container {
        width: 100%;
        max-width: none;
        padding: 0;
    }

    .auth-screen .auth-page {
        align-items: flex-start;
        min-height: auto;
        padding: 8px 12px 42vh;
    }

    .auth-screen .auth-box {
        max-width: none;
        padding: 18px 18px 20px;
        border-radius: 8px;
        box-shadow: none;
    }

    .auth-screen .auth-box h1 {
        margin-bottom: 18px;
        font-size: 22px;
    }

    .auth-screen .form-group {
        margin-bottom: 14px;
    }

    .auth-screen input {
        scroll-margin-bottom: 42vh;
    }

    .login-screen .auth-page {
        padding-bottom: 48vh;
    }

    .register-screen .auth-page {
        padding-bottom: 42vh;
    }

    .auth-screen .btn-block {
        width: 100%;
        height: 46px;
        padding: 0 14px;
        border-radius: 6px;
        font-size: 16px;
    }

    .auth-screen .auth-link {
        margin-top: 16px;
    }

    .home-page::before,
    .search-results-page .home-page::before {
        content: none;
        display: none;
    }

    .category-title {
        padding-top: 5px;
        padding-bottom: 6px;
    }
}

 

@media (max-width: 380px) {
    .logo {
        margin-left: 10px;
        max-width: 40%;
    }

    .auth-group {
        margin-right: 8px;
    }

    .auth-group .nav-link {
        min-width: 50px;
        padding: 0 8px;
        font-size: 14px;
    }

    .nav-link {
        min-width: 70px;
        padding: 0 10px;
        font-size: 14px;
    }

}

@media (max-width: 768px) {
    .step-bar {
        gap: 4px;
        margin-bottom: 20px;
    }

    .step-item {
        font-size: 10px;
        padding: 8px 4px;
        border-radius: 4px;
        background: #f5f5f5;
        color: #999;
        border: 1px solid #e8e8e8;
    }

    .step-item.active {
        background: #1890ff;
        color: #fff;
        font-weight: 500;
        border-color: #1890ff;
    }

    .step-item.done {
        background: #1890ff;
        color: #fff;
        border-color: #1890ff;
    }

    .forgot-wrapper {
        margin: 20px auto;
        padding: 0 12px 46vh;
    }

    .forgot-card {
        padding: 16px 12px;
    }

    .form-title {
        font-size: 14px;
        margin-bottom: 16px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-group input {
        height: 36px;
        font-size: 13px;
        scroll-margin-bottom: 42vh;
    }

    .btn-block {
        padding: 10px;
        font-size: 14px;
    }

    .verify-tip {
        font-size: 14px;
    }

    .countdown {
        font-size: 13px;
        margin-bottom: 14px;
    }

    .back-link {
        margin-top: 14px;
        font-size: 13px;
    }

    .msg-tip {
        font-size: 13px;
        padding: 8px 10px;
    }
}

@media (max-width: 768px) {
    /* Keep list cards clear of the phone edges on narrow screens. */
    .article-list {
        width: calc(100% - 24px);
        max-width: none;
        margin-left: auto;
        margin-right: auto;
    }

    .article-card-new {
        display: grid;
        grid-template-columns: 92px minmax(0, 1fr);
        column-gap: 12px;
        align-items: start;
        width: 100%;
        min-height: 112px;
        padding: 10px 0;
        flex-direction: row;
        border-bottom: 1px solid #f0f0f0;
    }

    .article-card-new .article-thumb {
        width: 92px;
        height: 86px;
        align-self: start;
    }

    .article-card-new .thumb-inner {
        width: 100%;
        height: 100%;
        margin-left: 0;
    }

    .article-card-new .article-thumb img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    .article-card-new .article-content {
        min-width: 0;
        padding: 0;
    }

    .article-card-new .article-title {
        font-size: 16px;
        line-height: 1.35;
        margin-bottom: 5px;
    }

    .article-card-new .article-summary {
        height: auto;
        max-height: 42px;
        margin: 0 0 8px;
        flex: none;
        font-size: 13px;
        line-height: 21px;
        -webkit-line-clamp: 2;
    }

    .article-card-new .article-meta {
        /* Place meta inside the content column and align left with title */
        position: static;
        width: 100%;
        box-sizing: border-box;
        padding-left: 0;
        margin-top: 4px;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px 8px;
        font-size: 11px;
        line-height: 1.25;
    }

    .article-card-new .article-meta .meta-item:nth-child(1),
    .article-card-new .article-meta .meta-item:nth-child(2) {
        display: none;
    }

    .article-card-new .article-category-tag {
        display: inline-block;
        margin-bottom: 4px;
        margin-top: 2px;
        font-size: 12px;
        color: #1890ff;
        background: #e6f7ff;
        padding: 1px 8px;
        border-radius: 3px;
        line-height: 1.6;
    }

    .article-card-new .meta-icon {
        flex: 0 0 auto;
        font-size: 11px;
        line-height: 1;
    }

    .article-card-new .article-like {
        display: none;
    }

    .article-card-new .like-meta,
    .article-card-new .page-like-meta {
        margin-left: 0;
        display: inline-flex;
        flex: 0 0 auto;
    }

    .article-breadcrumb {
        margin: 0;
        padding: 6px 12px;
        background: #f0f2f5;
        font-size: 12px;
        line-height: 20px;
    }

    .article-detail {
        max-width: none;
        border-radius: 0;
        box-shadow: none;
    }

    .article-detail .article-header {
        padding: 0 12px;
    }

    .article-detail .article-header h1 {
        padding: 12px 0 8px;
        font-size: 21px;
        line-height: 1.35;
    }

    .article-detail .article-header .article-meta {
        flex-wrap: nowrap;
        justify-content: center;
        gap: 6px;
        font-size: 11px;
        white-space: nowrap;
    }

    .article-detail .article-header .article-meta > * {
        flex: 0 1 auto;
        min-width: 0;
        white-space: nowrap;
    }

    /* Uploaded article images must scale down instead of overflowing. */
    .article-detail .article-content figure,
    .page-content figure {
        max-width: 100%;
    }

    .article-detail .article-content img,
    .page-content img {
        display: block;
        /* CKEditor preserves inline width/height; reset both together so
           narrowing the image cannot leave its height stretched. */
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        aspect-ratio: auto !important;
    }
}
