.article-shell {
    width: min(100% - 28px, 1180px);
}
.article-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 13px;
}
.article-title {
    min-width: 0;
    flex: 1;
}
.article-title p {
    margin: 0;
    color: var(--muted);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .1em;
}
.article-title h1 {
    margin: 1px 0 0;
    font-size: 25px;
    line-height: 1.1;
}
.article-pills {
    align-items: center;
}
.target-pill {
    padding: 5px 9px;
    border: 1px solid #c9d5fa;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #435cc1;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}
.article-input-panel {
    margin-bottom: 10px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 8px 28px rgba(37,49,73,.055);
}
.article-input-panel label {
    display: block;
    margin-bottom: 5px;
    color: #566176;
    font-size: 10px;
    font-weight: 800;
}
#articleSource {
    width: 100%;
    min-height: 156px;
    resize: vertical;
    padding: 11px 12px;
    border: 1px solid #d7dee9;
    border-radius: 11px;
    background: #fbfcfe;
    color: var(--ink);
    font-size: 16px;
    line-height: 1.55;
    outline: none;
}
#articleSource:focus {
    border-color: #879ce5;
    box-shadow: 0 0 0 3px rgba(73,103,219,.11);
}
.article-results {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(37,49,73,.055);
}
.embedded-article-results {
    margin-top: 0;
}
.article-column-headings,
.article-pair,
.article-paragraph-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.article-column-headings {
    background: #f7f9fc;
    color: var(--muted);
    font-size: 11px;
}
.article-column-headings strong {
    padding: 10px 14px;
}
.article-column-headings strong + strong {
    border-left: 1px solid var(--line);
}
.article-pairs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    height: clamp(320px, 58vh, 640px);
}
.article-scroll-column {
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}
.article-scroll-column + .article-scroll-column {
    border-left: 1px solid var(--line);
}
.article-pair {
    border-top: 1px solid var(--line);
}
.article-paragraph-pair {
    border-top: 1px solid var(--line);
}
.article-paragraph {
    min-width: 0;
    padding: 13px 14px;
    background: #fff;
    font-size: 15px;
    line-height: 2.05;
    overflow-wrap: anywhere;
}
.article-unit-group {
    display: inline;
    margin-right: .32em;
    white-space: normal;
    cursor: pointer;
}
.article-unit {
    padding: 2px 4px;
    border-radius: 5px;
    transition: background .13s ease, box-shadow .13s ease, color .13s ease;
}
.article-punctuation {
    color: #536074;
}
.article-unit-group.is-active .article-unit {
    background: #dfe8ff;
    box-shadow: inset 0 -2px 0 #6e83db;
    color: #243b91;
}
.article-unit-group.is-pinned .article-unit {
    background: #d5e0ff;
}
.article-unit-group.is-start-point .article-unit {
    background: #e8edff;
    box-shadow: inset 0 -2px 0 #8397e5;
    color: #314995;
}
.article-unit-group.is-reading .article-unit {
    background: #cddaff;
    box-shadow: inset 0 -2px 0 #4967db, 0 0 0 2px rgba(73,103,219,.12);
    color: #203783;
}
.article-unit-group.is-start-side .article-unit {
    background: #dce4ff;
    box-shadow: inset 0 -3px 0 #5c73d6;
}
.article-unit-group.is-reading-primary .article-unit {
    background: #b9c9ff;
    box-shadow: inset 0 -3px 0 #3555ce, 0 0 0 2px rgba(53,85,206,.16);
    color: #172f8f;
}
.article-block {
    min-width: 0;
    padding: 11px 14px;
    background: #fff;
    font-size: 15px;
    line-height: 1.65;
    overflow-wrap: anywhere;
    transition: background .14s ease, box-shadow .14s ease;
    cursor: default;
}
.article-block + .article-block {
    border-left: 1px solid var(--line);
}
.article-pair.is-active .article-block {
    background: #edf2ff;
    box-shadow: inset 3px 0 0 #6e83db;
}
.article-pair.is-pinned .article-block {
    background: #e6edff;
}
.mobile-block-label,
.mobile-column-label {
    display: none;
}
.saved-articles-panel {
    margin-top: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 8px 28px rgba(37,49,73,.045);
}
.saved-articles-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 13px;
    border-bottom: 1px solid var(--line);
    background: #f7f9fc;
}
.saved-articles-header strong {
    font-size: 12px;
}
.saved-articles-header span {
    color: var(--muted);
    font-size: 9px;
}
.saved-articles-list {
    display: grid;
    max-height: 300px;
    overflow-y: auto;
}
.saved-article-row {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    align-items: stretch;
    border-bottom: 1px solid var(--line);
    background: #fff;
}
.saved-article-row:last-child {
    border-bottom: 0;
}
.saved-article-item {
    width: 100%;
    display: grid;
    gap: 3px;
    padding: 10px 13px;
    border: 0;
    border-radius: 0;
    background: #fff;
    color: var(--ink);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.saved-article-item:hover {
    background: #f6f8fe;
}
.saved-article-item:disabled {
    opacity: .58;
}
.saved-article-item strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.saved-article-item span {
    color: var(--muted);
    font-size: 9px;
}
.saved-article-delete-form {
    display: grid;
}
.saved-article-delete-button {
    width: 42px;
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    background: #fff;
    color: #b35a64;
    font: 600 21px/1 system-ui, sans-serif;
    cursor: pointer;
}
.saved-article-delete-button:hover {
    background: #fff3f4;
    color: #a4313f;
}
.saved-article-delete-button:disabled {
    opacity: .45;
    cursor: wait;
}
.saved-articles-empty {
    margin: 0;
    padding: 16px 13px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}
.saved-article-view .article-title h1 {
    overflow: hidden;
    font-size: 21px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.saved-article-view .article-pairs {
    height: clamp(420px, 76vh, 820px);
}
.article-view-hint {
    margin: 8px 2px 0;
    color: var(--muted);
    font-size: 10px;
    text-align: center;
}
.article-reading-controls {
    min-height: 43px;
    display: flex;
    align-items: center;
    gap: 7px;
    margin: -3px 0 10px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255,255,255,.9);
    box-shadow: 0 6px 20px rgba(37,49,73,.04);
}
.article-reading-controls button {
    min-height: 31px;
    padding: 0 11px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}
.article-read-all-button {
    border: 0;
    background: var(--accent);
    color: #fff;
}
.article-read-all-button[aria-pressed="true"] {
    background: #354fae;
}
.article-stop-reading-button {
    border: 1px solid #e0c4c8;
    background: #fff6f7;
    color: #a13d49;
}
.article-reading-controls button:disabled {
    opacity: .45;
    cursor: not-allowed;
}
.article-reading-controls > span {
    color: var(--muted);
    font-size: 9px;
}
.speech-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 7px;
    border: 1px solid #d5dce9;
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    user-select: none;
}
.speech-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.speech-toggle-track {
    position: relative;
    width: 25px;
    height: 14px;
    border-radius: 999px;
    background: #cbd2df;
    transition: background .15s ease;
}
.speech-toggle-track::after {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(25,35,55,.25);
    content: "";
    transition: transform .15s ease;
}
.speech-toggle input:checked + .speech-toggle-track {
    background: var(--accent);
}
.speech-toggle input:checked + .speech-toggle-track::after {
    transform: translateX(11px);
}
.speech-toggle strong {
    font-size: 9px;
    white-space: nowrap;
}
.speech-toggle.is-disabled {
    opacity: .45;
    cursor: not-allowed;
}
.api-speech-toggle {
    flex: 0 0 auto;
    border-color: #cdd8f6;
    background: #f7f9ff;
    color: #3d56b4;
}
.api-speech-toggle input:checked + .speech-toggle-track {
    background: #6b55c8;
}
.api-speech-toggle.is-loading {
    opacity: .65;
}
.history-search-results {
    margin-top: 0;
}
.history-query-summary {
    margin: 0;
    padding: 8px 13px;
    border-bottom: 1px solid var(--line);
    background: #fbfcfe;
    color: var(--muted);
    font-size: 10px;
    overflow-wrap: anywhere;
}
.history-query-summary strong {
    color: var(--ink);
}
.history-search-results .saved-articles-list {
    max-height: none;
}
.article-language-list {
    display: grid;
}
.article-language-row {
    min-height: 58px;
    display: grid;
    grid-template-columns: 20px 32px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
}
.article-language-row:last-child {
    border-bottom: 0;
}
.article-language-row input {
    width: 19px;
    height: 19px;
    accent-color: var(--accent);
}
.article-language-row strong {
    font-size: 13px;
}
.article-preferences-panel {
    margin-top: 11px;
}
.article-setting-group {
    padding: 12px;
    border-bottom: 1px solid var(--line);
}
.article-setting-group:last-child {
    border-bottom: 0;
}
.article-setting-label {
    display: block;
    margin-bottom: 8px;
    color: #566176;
    font-size: 10px;
    font-weight: 800;
}
.article-target-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}
.article-target-option {
    min-width: 0;
    min-height: 45px;
    display: grid;
    grid-template-columns: 18px 27px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    padding: 6px 7px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fbfcfe;
    cursor: pointer;
}
.article-target-option input,
.granularity-grid input {
    width: 17px;
    height: 17px;
    accent-color: var(--accent);
}
.article-target-option span {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    background: var(--accent-soft);
    color: #435cc1;
    font-size: 9px;
    font-weight: 850;
}
.article-target-option strong {
    min-width: 0;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.granularity-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}
.granularity-grid label {
    min-width: 0;
    min-height: 62px;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    column-gap: 7px;
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fbfcfe;
    cursor: pointer;
}
.granularity-grid input {
    grid-row: 1 / span 2;
    align-self: center;
}
.granularity-grid strong {
    font-size: 11px;
}
.granularity-grid small {
    color: var(--muted);
    font-size: 8px;
    line-height: 1.25;
}
@media (max-width: 700px) {
    .article-shell {
        width: min(100% - 16px, 1180px);
        padding-top: max(20px, calc(16px + env(safe-area-inset-top)));
    }
    .article-title h1 {
        font-size: 21px;
    }
    .article-pills {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 4px;
    }
    .saved-article-view .article-pills {
        max-width: 148px;
    }
    .saved-article-view .article-header {
        align-items: flex-start;
    }
    .article-reading-controls {
        position: sticky;
        z-index: 5;
        top: max(8px, env(safe-area-inset-top));
        margin-top: 0;
        backdrop-filter: blur(12px);
    }
    .article-reading-controls > span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .speech-toggle strong {
        display: none;
    }
    .api-speech-toggle strong {
        display: inline;
        font-size: 8px;
    }
    .article-input-panel {
        padding: 10px;
        border-radius: 13px;
    }
    #articleSource {
        min-height: 128px;
    }
    .article-pair {
        grid-template-columns: 1fr;
    }
    .article-paragraph {
        padding: 11px;
        font-size: 14px;
        line-height: 2.05;
    }
    .article-block {
        padding: 10px 11px;
        font-size: 14px;
    }
    .article-block + .article-block {
        border-top: 1px dashed #d8deea;
        border-left: 0;
    }
    .mobile-block-label {
        display: block;
        margin-bottom: 3px;
        color: var(--muted);
        font-size: 9px;
        font-weight: 800;
    }
    .article-target-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 900px) and (orientation: portrait) {
    .article-column-headings {
        display: none;
    }
    .article-pairs {
        grid-template-columns: 1fr;
        height: auto;
    }
    .article-scroll-column {
        height: min(36vh, 340px);
    }
    .saved-article-view .article-scroll-column {
        height: min(39vh, 380px);
    }
    .article-scroll-column + .article-scroll-column {
        border-top: 1px solid var(--line);
        border-left: 0;
    }
    .mobile-column-label {
        position: sticky;
        z-index: 2;
        top: 0;
        display: block;
        padding: 6px 11px;
        border-bottom: 1px solid var(--line);
        background: rgba(247,249,252,.96);
        color: var(--muted);
        font-size: 9px;
        font-weight: 800;
        backdrop-filter: blur(8px);
    }
}
