.com-kdrama-library {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.kdrama-library-header {
    margin-bottom: 2rem;
}

.kdrama-library-header h1 {
    margin: 0 0 0.5rem;
}

.kdrama-library-subtitle {
    margin: 0;
    color: #666;
}

.kdrama-library-empty {
    font-style: italic;
    color: #888;
}

.kdrama-library-filters-panel {
    margin-bottom: 1.25rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    background: #f8fafc;
}

.kdrama-library-filters__title {
    margin: 0 0 0.5rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: #334155;
    letter-spacing: 0.01em;
}

.kdrama-library-filters__search-form {
    margin: 0 0 0.45rem;
}

.kdrama-library-filters {
    margin: 0;
}

.kdrama-library-filters__line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.85rem;
}

.kdrama-library-filters__line--search {
    margin-bottom: 0.45rem;
}

.kdrama-library-filters__line--filters {
    padding-top: 0.45rem;
    border-top: 1px solid #e2e8f0;
}

.kdrama-library-filters__flag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 34px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.kdrama-library-filters__flag input {
    width: 0.95rem;
    height: 0.95rem;
    margin: 0;
}

.kdrama-library-filters__field {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
}

.kdrama-library-filters__scope {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.85rem;
}

.kdrama-library-filters__group {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.45rem 0.55rem;
    min-width: 0;
}

.kdrama-library-filters__search-wrap {
    display: flex;
    align-items: stretch;
    flex: 1 1 220px;
    width: min(100%, 360px);
    border: 1px solid #c8d0dc;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.kdrama-library-filters__field--search {
    flex: 1 1 auto;
    margin: 0;
}

.kdrama-library-filters__input--search {
    width: 100%;
    min-height: 34px;
    padding: 0.3rem 0.55rem;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 0.92rem;
}

.kdrama-library-filters__search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 34px;
    padding: 0 0.55rem;
    border: 0;
    border-left: 1px solid #3568eb;
    background: #4a7cff;
    color: #fff;
    cursor: pointer;
}

.kdrama-library-filters__search-btn:hover,
.kdrama-library-filters__search-btn:focus-visible {
    background: #3568eb;
    outline: none;
}

.kdrama-library-filters__search-icon {
    display: block;
}

.kdrama-library-filters__select,
.kdrama-library-filters__input {
    min-height: 34px;
    padding: 0.28rem 0.5rem;
    border: 1px solid #c8d0dc;
    border-radius: 6px;
    background: #fff;
    font-size: 0.92rem;
}

.kdrama-library-filters__group .kdrama-library-filters__select {
    min-width: 6.5rem;
    max-width: 9rem;
}

.kdrama-library-filters__group .kdrama-library-filters__select--platform {
    min-width: 8.5rem;
    max-width: 11rem;
}

.kdrama-library-filters__select:disabled,
.kdrama-library-filters__input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.kdrama-library-filters__actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    margin-left: auto;
}

.kdrama-library-filters__submit {
    min-height: 34px;
    padding: 0.28rem 0.75rem;
    border: 1px solid #4a7cff;
    border-radius: 6px;
    background: #4a7cff;
    color: #fff;
    font-size: 0.92rem;
    cursor: pointer;
    white-space: nowrap;
}

.kdrama-library-filters__submit:hover {
    background: #3568eb;
    border-color: #3568eb;
}

.kdrama-library-filters__reset {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.75rem;
    border: 1px solid #c8d0dc;
    border-radius: 6px;
    background: #fff;
    color: #1a3a8a;
    text-decoration: none;
    font-size: 0.92rem;
    line-height: 1.2;
    white-space: nowrap;
}

.kdrama-library-filters__reset:hover,
.kdrama-library-filters__reset:focus-visible {
    background: #eef3ff;
    border-color: #4a7cff;
    color: #1a3a8a;
    text-decoration: none;
    outline: none;
}

.kdrama-library-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 0.75rem;
    margin: 1.25rem 0 1.5rem;
}

.kdrama-library-pagination__pages {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.kdrama-library-pagination__link,
.kdrama-library-pagination__current,
.kdrama-library-pagination__ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.95rem;
    line-height: 1;
}

.kdrama-library-pagination__link {
    border: 1px solid #c8d0dc;
    background: #fff;
    color: #1a3a8a;
    text-decoration: none;
}

.kdrama-library-pagination__link:hover,
.kdrama-library-pagination__link:focus-visible {
    background: #eef3ff;
    border-color: #4a7cff;
    outline: none;
}

.kdrama-library-pagination__link--nav {
    min-width: auto;
    font-weight: 600;
}

.kdrama-library-pagination__current {
    border: 1px solid #4a7cff;
    background: #4a7cff;
    color: #fff;
    font-weight: 700;
}

.kdrama-library-pagination__ellipsis {
    color: #666;
    min-width: auto;
    padding: 0.35rem 0.25rem;
}

.kdrama-grade {
    display: inline-block;
    margin-left: 0.45rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    vertical-align: middle;
}

.kdrama-grade--bello {
    background: #e8f7ea;
    color: #1f6b2c;
}

.kdrama-grade--mediocre {
    background: #fff6df;
    color: #8a6a00;
}

.kdrama-grade--scarso {
    background: #fdecea;
    color: #9b2c2c;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.kdrama-year-section {
    margin-bottom: 2rem;
}

.kdrama-year-heading {
    margin: 0 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #222;
    font-size: 1.4rem;
}

.kdrama-list {
    display: block;
}

.kdrama-row {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    padding: 14px 0;
    border-bottom: 1px solid #ddd;
}

.kdrama-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
    min-width: 0;
    justify-content: center;
    padding-top: 2px;
}

.kdrama-thumb-btn {
    border: 0;
    padding: 0;
    margin: 0;
    background: #eef1f5;
    line-height: 0;
    flex: 0 0 148px;
    width: 148px;
    height: 220px;
    cursor: zoom-in;
    pointer-events: auto !important;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kdrama-thumb-btn:hover,
.kdrama-thumb-btn:focus-visible {
    transform: scale(1.02);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
    outline: 2px solid #4a7cff;
    outline-offset: 2px;
}

.kdrama-thumb-btn .kdrama-thumb {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center center;
    border-radius: 0;
    pointer-events: none;
}

.kdrama-thumb {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center center;
    border-radius: 8px;
    flex-shrink: 0;
}

.kdrama-info {
    min-width: 0;
}

.kdrama-title {
    font-weight: bold;
    margin-right: 5px;
}

.kdrama-year {
    color: #666;
}

.kdrama-year {
    color: #666;
}

.kdrama-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.details-btn {
    border: 1px solid #4a7cff;
    background: #eef3ff;
    color: #1a3a8a;
    border-radius: 6px;
    padding: 0.4rem 0.65rem;
    cursor: pointer;
    white-space: nowrap;
}

.details-btn:hover {
    background: #dce8ff;
}

.vote-buttons {
    display: contents;
}

.vote-btn {
    border: 1px solid #ccc;
    background: #f7f7f7;
    border-radius: 6px;
    padding: 0.4rem 0.65rem;
    cursor: pointer;
    white-space: nowrap;
}

.vote-btn:hover {
    background: #eee;
}

.kdrama-delete-btn {
    display: inline-block;
    border: 1px solid #c0392b;
    background: #c0392b;
    color: #fff;
    border-radius: 6px;
    padding: 0.4rem 0.65rem;
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.2;
    white-space: nowrap;
}

.kdrama-delete-btn:hover,
.kdrama-delete-btn:focus-visible {
    background: #962d22;
    border-color: #962d22;
    color: #fff;
    text-decoration: none;
}

.vote-result {
    min-width: 160px;
    font-weight: 600;
    color: #333;
}

.kdrama-login-msg {
    font-style: italic;
    color: #888;
}

.kdrama-library-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: rgba(0, 0, 0, 0.88);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.kdrama-library-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.kdrama-library-lightbox[hidden] {
    display: none !important;
}

.kdrama-library-lightbox__panel {
    position: relative;
    max-width: min(92vw, 920px);
    max-height: 88vh;
    transform: scale(0.92);
    transition: transform 0.22s ease;
}

.kdrama-library-lightbox.is-open .kdrama-library-lightbox__panel {
    transform: scale(1);
}

.kdrama-library-lightbox__img {
    display: block;
    pointer-events: auto;
    max-width: min(96vw, 1100px);
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.kdrama-library-lightbox__caption {
    margin: 0.75rem 0 0;
    text-align: center;
    color: #f2f2f2;
    font-size: 0.95rem;
}

.kdrama-library-lightbox__close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100051;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}

.kdrama-library-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.3);
}

body.kdrama-library-lightbox-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .kdrama-library-filters__line--filters {
        flex-direction: column;
        align-items: stretch;
    }

    .kdrama-library-filters__group {
        width: 100%;
    }

    .kdrama-library-filters__group .kdrama-library-filters__select {
        flex: 1 1 auto;
        max-width: none;
    }

    .kdrama-library-filters__actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

    .kdrama-library-filters__search-wrap {
        width: 100%;
        max-width: none;
    }

    .kdrama-row {
        flex-wrap: nowrap;
        gap: 14px;
        align-items: flex-start;
    }

    .kdrama-thumb-btn {
        flex: 0 0 110px;
        width: 110px;
        height: 165px;
    }

    .kdrama-content {
        flex: 1 1 0;
        min-width: 0;
    }

    .kdrama-actions {
        flex-wrap: wrap;
    }

    .vote-result {
        flex: 1 1 100%;
    }
}
