:root {
    color-scheme: light;
    --bg: #edf1f4;
    --panel: #ffffff;
    --text: #17202a;
    --muted: #5e6b78;
    --line: #d7dee5;
    --accent: #1769e0;
    --danger: #b42318;
    --shadow: 0 12px 34px rgba(22, 34, 51, .13);
}

body[data-theme="dark"] {
    color-scheme: dark;
    --bg: #111417;
    --panel: #1b2026;
    --text: #f3f6f8;
    --muted: #a7b0ba;
    --line: #303944;
    --accent: #62a7ff;
    --danger: #ff8a80;
    --shadow: 0 12px 34px rgba(0, 0, 0, .35);
}

body[data-theme="sepia"] {
    --bg: #eee8dc;
    --panel: #fffaf0;
    --text: #2a241d;
    --muted: #6d6255;
    --line: #ded3bf;
    --accent: #8a4f16;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, sans-serif;
    overflow: hidden;
    overscroll-behavior: none;
}

button,
select {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    position: relative;
}

.topbar {
    height: 58px;
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    padding: 0 10px;
    padding-top: env(safe-area-inset-top);
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 10;
}

.brand {
    text-align: center;
    font-weight: 700;
    letter-spacing: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.mode-btn {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.mode-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.net-status {
    min-width: 52px;
    padding: 3px 7px;
    border-radius: 999px;
    background: #e7f7ee;
    color: #167044;
    font-size: 11px;
    font-weight: 700;
}

.net-status.offline {
    background: #fff0d9;
    color: #965900;
}

.icon-btn,
.plain-btn,
.primary-btn,
.action-btn,
.menu-option,
.bottom-action {
    border: 0;
    cursor: pointer;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 23px;
}

.feed {
    height: 100vh;
    padding-top: calc(58px + env(safe-area-inset-top));
    padding-bottom: calc(62px + env(safe-area-inset-bottom));
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
}

.card {
    height: calc(100vh - 120px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    scroll-snap-align: start;
    display: grid;
    place-items: center;
    padding: 14px;
}

.card-inner {
    width: min(100%, 760px);
    height: min(100%, 900px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

.card-media {
    width: 100%;
    max-height: 40vh;
    object-fit: cover;
    background: var(--line);
}

.card-svg {
    width: 100%;
    max-height: 34vh;
    object-fit: contain;
    padding: 12px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.question-svg {
    max-height: 24vh;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 10px 0 14px;
}

.image-only .card-media {
    max-height: none;
    height: 100%;
    object-fit: contain;
}

.image-only .card-svg {
    max-height: none;
    height: 100%;
}

.embed-code {
    width: 100%;
    min-height: 120px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.image-only .card-body,
.image-only .card-actions {
    display: none;
}

.card-body {
    overflow-y: auto;
    padding: 18px 18px 8px;
    scrollbar-width: thin;
}

.card-type {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.card-title {
    margin: 12px 0 10px;
    font-size: clamp(19px, 3vw, 28px);
    line-height: 1.25;
}

.card-text {
    margin: 0;
    white-space: pre-line;
    font-size: clamp(15px, 2.4vw, 20px);
    line-height: 1.58;
    text-align: left;
}

.small-content .card-text {
    font-size: clamp(22px, 5vw, 36px);
    line-height: 1.35;
}

.meta {
    margin-top: 12px;
    color: var(--muted);
    font-size: 13px;
}

.read-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    margin-top: 14px;
    padding: 5px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
}

.translation-missing {
    margin-top: 10px;
    color: var(--danger);
    font-size: 13px;
}

.card-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
}

.action-btn {
    width: 44px;
    height: 44px;
    min-height: 44px;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
    font-size: 22px;
    font-weight: 700;
    display: grid;
    place-items: center;
    line-height: 1;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 12;
    display: grid;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 9px 8px calc(9px + env(safe-area-inset-bottom));
    background: var(--panel);
    border-top: 1px solid var(--line);
}

.bottom-action {
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 21px;
    font-weight: 700;
    cursor: pointer;
    display: grid;
    place-items: center;
    line-height: 1;
}

.bottom-action.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.menu-option {
    width: 100%;
    min-height: 44px;
    margin: 5px 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    text-align: left;
    font-weight: 800;
}

.menu-option.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.filter-panel {
    display: none;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.filter-panel.open {
    display: block;
}

.question-title {
    font-size: clamp(18px, 2.3vw, 23px);
    font-weight: 800;
    line-height: 1.28;
    text-transform: none;
}

.options-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.option-row {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 10px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    line-height: 1.45;
    cursor: pointer;
}

.right-option {
    border-color: #168a4a;
    background: #eaf8ef;
}

.wrong-option {
    border-color: #b42318;
    background: #fff0ee;
}

.submit-btn {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.submit-btn:disabled {
    opacity: .55;
}

.answer-box {
    margin-top: 16px;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.answer-box.correct {
    border-color: #168a4a;
}

.answer-box.wrong {
    border-color: #b42318;
}

.concept-box {
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.concept-box span {
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
}

.concept-box strong {
    font-size: 16px;
    line-height: 1.3;
}

.rationale {
    margin-top: 12px;
}

.rationale-title {
    display: block;
    font-size: 17px;
    line-height: 1.35;
    text-transform: none;
}

.rationale p {
    margin: 8px 0 0;
    white-space: pre-line;
    line-height: 1.5;
    font-size: 15px;
}

.action-btn:active {
    transform: scale(.97);
}

.action-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.drawer {
    position: fixed;
    top: 0;
    width: min(86vw, 340px);
    height: 100vh;
    background: var(--panel);
    z-index: 30;
    padding: calc(18px + env(safe-area-inset-top)) 18px 18px;
    box-shadow: var(--shadow);
    transition: transform .22s ease;
}

.left-drawer {
    left: 0;
    transform: translateX(-105%);
}

.right-drawer {
    right: 0;
    transform: translateX(105%);
}

.drawer.open {
    transform: translateX(0);
}

.drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.drawer h2 {
    margin: 0 0 18px;
}

.drawer label {
    display: block;
    margin: 16px 0 6px;
    color: var(--muted);
}

.drawer select,
.primary-btn {
    width: 100%;
    padding: 11px;
    border-radius: 7px;
}

.drawer select {
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
}

.primary-btn {
    margin-top: 18px;
    background: var(--accent);
    color: #fff;
}

.plain-btn {
    background: transparent;
    color: var(--accent);
}

.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .34);
    z-index: 20;
    display: none;
}

.backdrop.show {
    display: block;
}

.empty-state {
    min-height: calc(100vh - 58px - env(safe-area-inset-top));
    display: grid;
    place-items: center;
    color: var(--muted);
    padding: 24px;
    text-align: center;
}

@media (max-width: 520px) {
    .card {
        padding: 0;
    }

    .card-inner {
        width: 100%;
        height: 100%;
        border-width: 0;
        border-radius: 0;
    }

    .card-actions {
        gap: 10px;
        padding: 9px;
    }

    .action-btn {
        width: 40px;
        height: 40px;
        min-height: 40px;
        font-size: 20px;
        padding: 0;
    }

    .card-title {
        font-size: clamp(18px, 5.8vw, 25px);
    }

    .card-text {
        font-size: clamp(15px, 4.4vw, 19px);
    }

    .bottom-action {
        width: 40px;
        height: 40px;
        font-size: 19px;
    }
}

/* NOLOSS-style front polish */
.feed {
    height: calc(100vh - 58px - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin-top: calc(58px + env(safe-area-inset-top));
    margin-bottom: calc(62px + env(safe-area-inset-bottom));
    padding: 0;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-padding: 0;
}

.card {
    height: calc(100vh - 58px - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: calc(100vh - 58px - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: clamp(10px, 2.5vw, 20px);
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.card-inner {
    width: min(100%, 760px);
    height: 100%;
    max-height: 100%;
    box-shadow: 0 18px 44px rgba(76, 61, 38, .12);
}

.card-body {
    overflow: hidden;
    padding: clamp(16px, 3vw, 28px);
}

.card-title {
    font-size: clamp(22px, 2.2vw, 32px);
    line-height: 1.18;
}

.card-text {
    font-size: clamp(16px, 1.75vw, 24px);
    line-height: 1.58;
}

.card-svg {
    max-height: 35%;
    object-fit: contain;
}

.bottom-nav {
    min-height: 62px;
    backdrop-filter: blur(14px);
    background: color-mix(in srgb, var(--panel) 94%, transparent);
}

.bottom-action {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(36, 27, 17, .06);
}

.drawer {
    width: min(92vw, 380px);
    padding: calc(16px + env(safe-area-inset-top)) 16px 18px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 96%, var(--accent) 4%), var(--panel));
    border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    overflow-y: auto;
}

.left-drawer {
    border-radius: 0 20px 20px 0;
}

.right-drawer {
    border-radius: 20px 0 0 20px;
}

.drawer-head {
    margin-bottom: 14px;
}

.drawer h2 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 0;
}

.plain-btn {
    min-height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    font-weight: 800;
}

.drawer-card {
    margin: 0 0 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--panel) 94%, var(--accent) 6%);
    box-shadow: 0 8px 22px rgba(24, 34, 48, .07);
}

.progress-title,
.read-total-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 10px;
}

.progress-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 14px;
    align-items: center;
}

.progress-grid span {
    color: var(--muted);
}

.progress-grid strong,
.read-total-card strong {
    font-size: 20px;
    color: var(--accent);
}

.read-total-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.read-total-card span {
    margin: 0;
}

.menu-option {
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--panel) 88%, var(--bg) 12%);
    box-shadow: 0 4px 14px rgba(24, 34, 48, .04);
}

.menu-option span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.menu-option.active {
    box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 22%, transparent);
}

.filter-panel {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    background: color-mix(in srgb, var(--panel) 94%, var(--bg) 6%);
}

.switch-row {
    min-height: 52px;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 16px 0 6px !important;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--panel) 92%, var(--bg) 8%);
    color: var(--text) !important;
    font-weight: 800;
}

.switch-row input {
    width: 22px;
    height: 22px;
    accent-color: var(--accent);
}

.search-panel {
    position: fixed;
    left: 50%;
    bottom: calc(74px + env(safe-area-inset-bottom));
    transform: translate(-50%, 18px);
    width: min(92vw, 560px);
    z-index: 16;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

.search-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.search-panel input,
.search-panel button {
    min-height: 42px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    padding: 0 12px;
}

.search-panel button {
    font-weight: 800;
    cursor: pointer;
}

.search-panel #searchApplyBtn {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

@media (min-width: 900px) {
    .card-inner {
        width: min(100%, 1140px);
    }
}

@media (max-width: 520px) {
    .feed,
    .card {
        height: calc(100vh - 58px - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        min-height: calc(100vh - 58px - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }

    .card {
        padding: 0;
    }

    .card-title {
        font-size: clamp(20px, 6vw, 27px);
    }

    .card-text {
        font-size: clamp(15px, 4.4vw, 18px);
        line-height: 1.5;
    }

    .drawer {
        width: min(94vw, 360px);
    }

    .search-panel {
        grid-template-columns: 1fr auto;
    }

    .search-panel #searchCloseBtn {
        grid-column: 2;
    }
}

/* Compact Q&A card so full question/options/submit fit better */
.question-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: clamp(12px, 2.2vw, 24px);
    overflow: hidden;
}

.question-card .card-type {
    flex: 0 0 auto;
}

.question-card .question-title {
    flex: 0 0 auto;
    margin: 6px 0 8px;
    font-size: clamp(16px, 1.45vw, 22px);
    line-height: 1.22;
    font-weight: 800;
    letter-spacing: 0;
}

.question-card .options-list {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-rows: repeat(4, minmax(38px, auto)) auto;
    gap: 8px;
    margin-top: 4px;
    overflow: hidden;
}

.question-card .option-row {
    min-height: 38px;
    padding: 8px 10px;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    font-size: clamp(14px, 1.15vw, 18px);
    line-height: 1.25;
}

.question-card .option-row input {
    width: 16px;
    height: 16px;
}

.question-card .submit-btn {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 15px;
}

.question-card .answer-box {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    margin-top: 6px;
    padding: 10px;
    font-size: 14px;
}

.question-card .rationale p {
    font-size: 14px;
    line-height: 1.42;
}

@media (max-width: 620px) {
    .question-card .question-title {
        font-size: clamp(15px, 4.2vw, 20px);
        line-height: 1.18;
    }

    .question-card .option-row {
        font-size: clamp(13px, 3.65vw, 16px);
        padding: 7px 9px;
    }
}

.developer-credit {
    margin: auto 0 0;
    padding-top: 18px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
    user-select: text;
}
/* Newspaper-style article card layout v22 */
body {
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

.article-card {
    background: #fffdf8;
    grid-template-rows: minmax(0, 1fr);
}

body[data-theme="dark"] .article-card {
    background: var(--panel);
}

.article-card.has-media {
    display: grid;
    grid-template-columns: minmax(260px, 40%) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
}

.article-card.no-media {
    display: block;
    width: min(100%, 1060px);
}

.article-card .card-visual {
    margin: 0;
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #fff;
    border-right: 1px solid var(--line);
}

.article-card .card-media {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    display: block;
    background: #f4f4f4;
}

.article-card .card-svg {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
    padding: clamp(14px, 2.4vw, 34px);
    border: 0;
    background: #fff;
    display: block;
}

.article-card .embed-code {
    width: 100%;
    height: 100%;
    min-height: 180px;
}

.article-card .card-body {
    min-width: 0;
    height: 100%;
    overflow: auto;
    padding: clamp(18px, 3vw, 34px);
}

.article-card .card-type {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 11px;
}

.article-card .card-title {
    max-width: 820px;
    margin: 12px 0 12px;
    font-family: Georgia, Cambria, "Times New Roman", serif;
    font-size: clamp(25px, 2.35vw, 38px);
    line-height: 1.13;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--text);
}

.article-card .card-text {
    max-width: 860px;
    font-family: Georgia, Cambria, "Times New Roman", serif;
    font-size: clamp(18px, 1.55vw, 25px);
    line-height: 1.48;
    letter-spacing: 0;
    color: color-mix(in srgb, var(--text) 88%, transparent);
    white-space: pre-line;
}

.article-card .read-pill {
    margin-top: clamp(14px, 2vw, 24px);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.article-card.image-only {
    display: grid;
    grid-template-columns: 1fr;
}

.article-card.image-only .card-visual {
    border-right: 0;
}

.article-card.image-only .card-body {
    display: none;
}

@media (min-width: 1100px) {
    .article-card.has-media {
        width: min(100%, 1260px);
    }
}

@media (max-width: 780px) {
    .article-card.has-media {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(145px, 38%) minmax(0, 1fr);
    }

    .article-card .card-visual {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .article-card .card-media {
        object-fit: cover;
    }

    .article-card .card-svg {
        padding: 10px 14px;
    }

    .article-card .card-body {
        padding: 18px 18px 14px;
    }

    .article-card .card-title {
        font-size: clamp(23px, 7vw, 32px);
        line-height: 1.12;
    }

    .article-card .card-text {
        font-size: clamp(16px, 4.8vw, 20px);
        line-height: 1.44;
    }
}

@media (max-width: 520px) {
    .article-card.has-media {
        grid-template-rows: minmax(130px, 34%) minmax(0, 1fr);
    }

    .article-card.no-media .card-body,
    .article-card .card-body {
        padding: 16px 17px 12px;
    }

    .article-card .card-title {
        margin-top: 10px;
        font-size: clamp(21px, 6.4vw, 28px);
    }
}
/* SVG fit + compact reading layout v23 */
.article-card.has-media {
    grid-template-columns: minmax(240px, 38%) minmax(0, 1fr);
}

.article-card .card-visual {
    padding: clamp(10px, 1.6vw, 22px);
    align-content: center;
    justify-content: center;
}

.article-card .card-svg {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    padding: 0 !important;
}

.article-card .card-media {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.article-card .card-body {
    overflow: hidden;
    padding: clamp(16px, 2.4vw, 28px);
}

.article-card .card-title {
    font-family: Georgia, Cambria, "Times New Roman", serif;
    font-size: clamp(22px, 2vw, 31px);
    line-height: 1.16;
    font-weight: 600;
    margin: 10px 0 10px;
}

.article-card .card-text {
    font-family: Georgia, Cambria, "Times New Roman", serif;
    font-size: clamp(16px, 1.35vw, 21px);
    line-height: 1.42;
    font-weight: 400;
}

.article-card .read-pill {
    margin-top: 14px;
    font-size: 12px;
    padding: 4px 8px;
}

@media (max-width: 780px) {
    .article-card.has-media {
        grid-template-rows: minmax(104px, 26%) minmax(0, 1fr);
    }

    .article-card .card-visual {
        padding: 8px 12px;
    }

    .article-card .card-body {
        overflow: hidden;
        padding: 14px 16px 10px;
    }

    .article-card .card-type {
        min-height: 21px;
        font-size: 10px;
        padding: 1px 7px;
    }

    .article-card .card-title {
        font-size: clamp(19px, 5.4vw, 24px);
        line-height: 1.13;
        font-weight: 600;
        margin: 8px 0 8px;
    }

    .article-card .card-text {
        font-size: clamp(14px, 3.85vw, 16.5px);
        line-height: 1.36;
    }

    .article-card .read-pill {
        margin-top: 9px;
    }
}

@media (max-width: 520px) {
    .article-card.has-media {
        grid-template-rows: minmax(92px, 24%) minmax(0, 1fr);
    }

    .article-card .card-visual {
        padding: 6px 10px;
    }

    .article-card .card-body {
        padding: 13px 15px 9px;
    }

    .article-card .card-title {
        font-size: clamp(18px, 5vw, 22px);
    }

    .article-card .card-text {
        font-size: clamp(13.5px, 3.75vw, 15.5px);
        line-height: 1.34;
    }
}
/* Mobile stacked article layout v24 */
@media (max-width: 980px) {
    .article-card.has-media {
        grid-template-columns: 1fr !important;
        grid-template-rows: minmax(88px, 23vh) minmax(0, 1fr) !important;
    }

    .article-card .card-visual {
        min-height: 0 !important;
        height: auto !important;
        padding: 6px 10px !important;
        border-right: 0 !important;
        border-bottom: 1px solid var(--line) !important;
        overflow: hidden !important;
    }

    .article-card .card-svg,
    .article-card .card-media {
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
    }

    .article-card .card-body {
        min-height: 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 12px 15px 9px !important;
    }

    .article-card .card-type {
        flex: 0 0 auto;
        min-height: 20px;
        font-size: 10px;
        padding: 1px 7px;
    }

    .article-card .card-title {
        flex: 0 0 auto;
        font-size: clamp(18px, 4.6vw, 23px) !important;
        line-height: 1.12 !important;
        font-weight: 600 !important;
        margin: 8px 0 7px !important;
    }

    .article-card .card-text {
        flex: 1 1 auto;
        min-height: 0;
        font-size: clamp(13px, 3.35vw, 15.5px) !important;
        line-height: 1.32 !important;
        overflow: hidden !important;
        display: -webkit-box !important;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 11;
    }

    .article-card .read-pill {
        flex: 0 0 auto;
        margin-top: 8px !important;
        font-size: 11px !important;
        padding: 3px 7px !important;
    }
}

@media (max-width: 420px) {
    .article-card.has-media {
        grid-template-rows: minmax(76px, 20vh) minmax(0, 1fr) !important;
    }

    .article-card .card-title {
        font-size: clamp(17px, 4.8vw, 21px) !important;
    }

    .article-card .card-text {
        font-size: clamp(12.5px, 3.55vw, 14.5px) !important;
        -webkit-line-clamp: 10;
    }
}
/* Softer reading typography v25 */
.card-type,
.article-card .card-type,
.question-card .card-type {
    display: none !important;
}

.article-card .card-title,
.card-title {
    font-weight: 500 !important;
    letter-spacing: 0 !important;
}

.question-card .question-title,
.question-title {
    font-family: Georgia, Cambria, "Times New Roman", serif !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
    line-height: 1.18 !important;
}

@media (max-width: 980px) {
    .article-card .card-title,
    .question-card .question-title {
        font-weight: 500 !important;
    }
}
/* Mobile image fit and space balance v26 */
@media (max-width: 980px) {
    .article-card.has-media {
        grid-template-rows: minmax(130px, 34vh) minmax(0, 1fr) !important;
    }

    .article-card .card-visual {
        padding: 4px 8px !important;
        place-items: center !important;
    }

    .article-card .card-media,
    .article-card .card-svg {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
    }

    .article-card .card-body {
        padding-top: 10px !important;
        padding-bottom: 7px !important;
    }
}

@media (max-width: 520px) {
    .article-card.has-media {
        grid-template-rows: minmax(118px, 31vh) minmax(0, 1fr) !important;
    }

    .article-card .card-title {
        margin-top: 5px !important;
        margin-bottom: 6px !important;
    }

    .article-card .card-text {
        -webkit-line-clamp: 9;
    }
}

@media (max-width: 380px) {
    .article-card.has-media {
        grid-template-rows: minmax(108px, 29vh) minmax(0, 1fr) !important;
    }
}
/* Fast public web shell v27 */
.compact-topbar {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
}

.top-actions {
    gap: 6px;
}

.top-action-btn,
.top-read-btn {
    min-width: 38px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.top-read-btn {
    min-width: 44px;
    padding: 0 8px;
    color: var(--accent);
}

#questionMenuBtn {
    font-size: 18px;
    font-weight: 800;
}

.bottom-action.locked {
    opacity: .58;
}

.drawer .menu-option span {
    pointer-events: none;
}

@media (max-width: 520px) {
    .top-actions {
        gap: 4px;
    }

    .top-action-btn,
    .top-read-btn {
        min-width: 34px;
        height: 32px;
        font-size: 14px;
    }

    .net-status {
        min-width: 48px;
        font-size: 10px;
        padding-inline: 5px;
    }
}
/* Topbar small polish v28 */
#questionMenuBtn {
    font-size: 25px !important;
    line-height: 1;
    font-weight: 800;
}

.top-actions {
    gap: 8px;
}
/* iPhone Safari safe viewport and no read pill v29 */
.read-pill {
    display: none !important;
}

@supports (height: 100svh) {
    .feed {
        height: calc(100svh - 58px - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    }

    .card {
        height: calc(100svh - 58px - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
        min-height: calc(100svh - 58px - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    }
}

@media (max-width: 700px) {
    .feed {
        scroll-padding-top: 10px;
    }

    .card {
        padding-top: max(10px, env(safe-area-inset-top)) !important;
        padding-bottom: 8px !important;
        place-items: start center !important;
    }

    .card-inner {
        height: calc(100% - 12px) !important;
    }

    .article-card .card-body,
    .question-card .card-body {
        padding-top: 14px !important;
    }
}/* Image reliability + cache refresh v31 */
.article-card.has-media .card-visual {
    min-width: 0 !important;
    min-height: 0 !important;
}

.article-card.has-media .card-media {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
}

@media (min-width: 981px) {
    .article-card.has-media .card-media {
        width: 100% !important;
        height: 100% !important;
    }
}
