/* 내 서재: 번역 화면 아래의 논문 목록. 색은 tokens.css를 그대로 쓴다. */
.library {
    margin-top: 1rem;
    display: grid;
    gap: 16px;
}

.library[hidden],
.library [hidden] {
    display: none !important;
}

.library .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.library-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.library-head h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.library-summary,
.library-muted {
    color: var(--ink-soft);
    font-size: 13.5px;
}

/* 이어 읽기 */
.library-continue {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 12px 16px 12px 12px;
    border-radius: 12px;
    background: var(--card);
}

.library-continue:not(:has(.library-thumb)) {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-left: 16px;
}

.library-thumb {
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 0 0 1px var(--line);
}

.library-thumb img {
    display: block;
    width: 100%;
}

.library-continue-body {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.library-eyebrow {
    color: var(--ink-soft);
    font-size: 12.5px;
}

.library-continue-title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-continue .library-bar {
    max-width: 360px;
    margin-top: 4px;
}

/* 거름과 검색 */
.library-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.library-filters {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    border-radius: 9px;
    background: var(--pill);
}

.library-filter {
    border: 0;
    border-radius: 7px;
    padding: 5px 11px;
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
}

.library-filter[aria-pressed="true"] {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 14%, transparent);
}

.library-count {
    margin-left: 5px;
    color: var(--ink-faint);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.library-search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 220px;
    padding: 6px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--surface);
    color: var(--ink-faint);
}

.library-search svg {
    width: 14px;
    height: 14px;
    flex: none;
}

.library-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
}

/* 목록 */
.library-table-wrap {
    overflow-x: auto;
}

.library-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    font-size: 14px;
}

.library-table th {
    padding: 6px 10px;
    border-bottom: 1px solid var(--line);
    color: var(--ink-faint);
    font-size: 12.5px;
    font-weight: 400;
    text-align: left;
    white-space: nowrap;
}

.library-table td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.library-table tbody tr:hover td {
    background: var(--card);
}

.library-table tr.is-expired td {
    color: var(--ink-faint);
}

.library-title {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.library-title strong {
    display: block;
    max-width: 440px;
    overflow: hidden;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-title .library-muted {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.library-title .library-bar {
    width: 180px;
}

.library-num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.library-actions {
    text-align: right;
    white-space: nowrap;
}

.library-actions > * + * {
    margin-left: 6px;
}

.library-none {
    padding: 28px 10px;
    color: var(--ink-faint);
    text-align: center;
}

.library-confirm {
    color: var(--ink-soft);
    font-size: 13px;
}

.library-chip {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
}

.library-chip.translating,
.library-chip.expiring {
    background: var(--accent-tint);
    color: var(--accent-text);
}

.library-chip.expired,
.library-chip.tier {
    background: var(--pill);
    color: var(--ink-soft);
}

.library-bar {
    height: 4px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--pill);
}

.library-bar i {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: var(--accent);
}

.library-bar.read i {
    background: var(--ink-faint);
}

.library-btn {
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
}

.library-btn:hover:not(:disabled) {
    background: var(--card);
}

.library-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.library-btn.primary {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--bg);
}

.library-btn.primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--ink), #fff 12%);
}

.library-btn.ghost {
    border-color: transparent;
    color: var(--ink-soft);
}

.library-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    padding: 0;
    vertical-align: middle;
}

.library-btn.danger {
    border-color: transparent;
    background: var(--accent);
    color: #fff;
}

/* 확인용 빨간 삭제 버튼: 공통 hover 배경(연한 회색)에 흰 글씨가 묻히지 않게 빨강을 조금 진하게 */
.library-btn.danger:hover:not(:disabled) {
    background: color-mix(in srgb, var(--accent), #000 12%);
}

.library button:focus-visible,
.library input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.library-empty {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 36px 20px;
    border-radius: 12px;
    background: var(--card);
    text-align: center;
}

.library-empty strong {
    font-size: 16px;
    font-weight: 500;
}

.library-empty p {
    max-width: 52ch;
    margin: 0;
    color: var(--ink-soft);
    font-size: 14px;
}

.library-status {
    margin: 0;
    color: var(--ink-soft);
    font-size: 13.5px;
}

/* 중간 폭: 번역 날짜 열을 빼서 버튼이 잘리지 않게 한다 */
@media (max-width: 960px) {
    .library-table {
        min-width: 0;
    }

    .library-table th:nth-child(3),
    .library-table td:nth-child(3) {
        display: none;
    }

    .library-title strong {
        max-width: 300px;
    }
}

@media (max-width: 600px) {
    .library-continue {
        grid-template-columns: 64px minmax(0, 1fr);
    }

    .library-continue > .library-btn {
        grid-column: 1 / -1;
    }

    .library-search {
        flex: 1 1 100%;
        min-width: 0;
    }

    /* 휴대폰: 제목과 버튼만 남겨 옆으로 밀리지 않게 한다 */
    .library-table {
        min-width: 0;
        table-layout: fixed;
    }

    .library-table th:nth-child(n+2):nth-child(-n+5),
    .library-table td:nth-child(n+2):nth-child(-n+5) {
        display: none;
    }

    .library-table th:last-child,
    .library-table td:last-child {
        width: 206px;
    }

    .library-title .library-bar {
        width: 100%;
    }

    .library-actions .library-btn:not(.library-icon-btn) {
        padding: 0 10px;
    }
}

/* 이 창에서 시작한 번역 줄: 종이가 날아와 앉을 때까지 숨겨 두고, 줄무늬가 흐르는 막대가 튕기듯 차오른다 */
/* 줄들이 스프링으로 내려앉으며 잠깐 넘쳐도 세로 스크롤바가 비치지 않게 */
.library-table-wrap {
    overflow-y: hidden;
}

.library-table tr.is-arriving {
    visibility: hidden;
}

/* 줄 어디를 눌러도 논문이 열린다(번역 중인 줄은 진행 보기) */
.library-table tr.is-openable {
    cursor: pointer;
}

.library-chip.translating {
    font-variant-numeric: tabular-nums;
}

.library-chip.saving {
    background: var(--pill);
    color: var(--ink-soft);
}

.library-chip.today {
    gap: 6px;
    background: color-mix(in srgb, var(--ok) 14%, var(--bg));
    color: var(--ok);
}

.library-chip.today::before {
    content: "";
    width: 7px;
    height: 4px;
    margin-top: -2px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
}

.library-bar.live {
    height: 5px;
}

.library-bar.live i {
    background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.3) 25%, transparent 25% 50%, rgba(255, 255, 255, 0.3) 50% 75%, transparent 75%);
    background-size: 10px 10px;
    transition: width 0.7s var(--spring-pop);
    animation: libraryStripes 0.6s linear infinite;
}

.library-bar.live.done i {
    background-color: var(--ok);
    background-image: none;
    animation: none;
}

.library-btn.go {
    border-color: var(--ok);
    background: var(--ok);
    color: #fff;
}

.library-btn.go:hover:not(:disabled) {
    background: color-mix(in srgb, var(--ok), #000 10%);
}

.library-table tr.is-arrived td {
    animation: libraryArrived 1.4s ease 2;
}

@keyframes libraryStripes {
    to { background-position: 10px 0; }
}

@keyframes libraryArrived {
    0%, 100% { background: transparent; }
    40% { background: color-mix(in srgb, var(--ok) 12%, var(--bg)); }
}

@media (prefers-reduced-motion: reduce) {
    .library-bar.live i,
    .library-table tr.is-arrived td {
        animation: none;
        transition: none;
    }
}
