/* ============================================================
   Nyaa 디자인 시스템
   다크 테마 기반, 모바일 퍼스트 반응형 디자인
   ============================================================ */

/* ============ CSS 변수 ============ */
:root {
    /* 색상 */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-tertiary: #333333;
    --border-color: #333333;
    --text-primary: #e0e0e0;
    --text-secondary: #999999;
    --text-muted: #666666;
    --accent: #4a9eff;
    --accent-hover: #3a8eef;
    --cache: #7b3fb5;
    --danger: #d94040;
    --danger-hover: #c93030;
    --success: #4ade80;
    --warning: #f59e0b;

    /* 타이포그래피 */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* 레이아웃 */
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --transition: 0.2s ease;

    /* 브레이크포인트 (참고용, 실제 미디어 쿼리는 리터럴 값 사용) */
    /* sm: 480px, md: 768px, lg: 1024px, xl: 1400px */
}

/* ============ 리셋 ============ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

/* ============ 네비게이션 바 (모바일 퍼스트) ============ */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 0.75rem;
}

.nav-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.nav-logo:hover {
    color: var(--accent-hover);
}

/* 모바일: 네비게이션 메뉴 숨김 (하단 탭바 사용) */
.nav-menu {
    display: none;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: color var(--transition);
    /* 터치 최적화: 최소 44px 높이 확보 */
    padding: 0.5rem 0.25rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.nav-user {
    color: var(--text-secondary);
    font-size: 0.75rem;
    /* 모바일에서 너무 긴 이름은 생략 */
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-logout {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.nav-logout:hover {
    color: var(--danger);
}

/* ============ 하단 탭 바 (모바일 전용) ============ */
.bottom-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 56px;
    z-index: 100;
    padding: 0 0.5rem;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    transition: color var(--transition);
}

.tab-item:hover,
.tab-item.active {
    color: var(--text-primary);
}

.tab-item-icon {
    font-size: 1.25rem;
    margin-bottom: 0.125rem;
}

/* ============ 메인 컨텐츠 ============ */
.main-content {
    /* 모바일: 하단 탭바 공간 확보 (56px + 여유 16px) */
    padding: 1rem 0 72px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 0.75rem;
}

/* ============ 카드 ============ */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    transition: border-color var(--transition);
}

.card:hover {
    border-color: var(--accent);
}

/* 카드 그리드: 모바일 2열 → sm 3열 → lg+ 동적 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.welcome-card {
    text-align: center;
    padding: 2rem 1rem;
}

.welcome-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.welcome-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============ 버튼 (터치 최적화) ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 터치 최적화: 최소 44px 높이 */
    padding: 0.625rem 1rem;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    gap: 0.5rem;
}

.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

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

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

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

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    min-height: 36px;
}

/* ============ 폼 (모바일 최적화) ============ */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    /* iOS 줌 방지: 최소 16px 폰트 + 48px 높이 */
    padding: 0.75rem;
    min-height: 48px;
    font-size: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* ============ 알림 ============ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(217, 64, 64, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-success {
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

/* ============ 로그인 페이지 ============ */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    /* dvh: 모바일 브라우저 주소창 고려 */
    min-height: 100dvh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.login-title {
    text-align: center;
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.login-form .btn {
    margin-top: 0.5rem;
}

/* ============ 토스트 알림 (모바일 최적화) ============ */
.toast-container {
    position: fixed;
    /* 모바일: 하단 탭바 위에 표시 (56px + 여유 16px) */
    bottom: calc(72px);
    right: 1rem;
    left: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    box-shadow: var(--shadow);
    animation: toast-in 0.3s ease;
}

.toast.toast-success {
    border-left: 3px solid var(--success);
}

.toast.toast-error {
    border-left: 3px solid var(--danger);
}

.toast.toast-info {
    border-left: 3px solid var(--accent);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ 페이지 헤더 (모바일 퍼스트) ============ */
.page-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ============ 탭 ============ */
.tab-group {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.5rem 0.875rem;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.tab-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

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

/* ============ 배우 카드 ============ */
.actress-card {
    display: block;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    padding: 0;
}

.actress-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.actress-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.actress-card:hover .actress-card-image img {
    transform: scale(1.05);
}

.rank-badge {
    position: absolute;
    top: 0.375rem;
    left: 0.375rem;
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
}

.actress-card-info {
    padding: 0.625rem;
}

.actress-card-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.actress-card-name-jp {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-bottom: 0.125rem;
}

.actress-card-meta {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* ============ 배우 상세 페이지 (모바일 퍼스트) ============ */
.profile-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.profile-image-wrap {
    flex-shrink: 0;
    width: 160px;
    margin: 0 auto;
}

.profile-image {
    width: 100%;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.profile-name-jp {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.meta-badge {
    background: var(--accent);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.meta-item {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.count-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 400;
}

/* ============ 출연작 카드 (모바일 퍼스트) ============ */
.works-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.work-card {
    padding: 0;
    overflow: hidden;
}

.work-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.work-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-icon {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 700;
}

.status-completed {
    background: var(--success);
    color: #000;
}

.status-downloading {
    background: var(--accent);
    color: #fff;
}

.status-cached {
    background: var(--cache);
    color: #fff;
}

.work-card-info {
    padding: 0.5rem;
}

.work-card-code {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.work-card-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.work-card-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.work-card-seeds {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.work-card-seeds.seed-healthy {
    color: var(--success);
    font-weight: 600;
}

.work-card-seeds.seed-low {
    color: var(--warning);
}

.work-card-seeds.seed-dead {
    color: var(--text-muted);
}

.work-card-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.375rem;
    flex-wrap: wrap;
}

/* ============ 토렌트 페이지 (모바일 퍼스트) ============ */
.torrent-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.torrent-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.search-box {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.search-box input {
    flex: 1;
    padding: 0.625rem 0.75rem;
    min-height: 44px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
}

/* 토렌트 카드: 모바일 세로, 데스크톱 가로 */
.torrent-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.torrent-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.875rem;
    transition: border-color var(--transition);
}

.torrent-card:hover {
    border-color: var(--accent);
}

.torrent-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    flex-shrink: 0;
    cursor: pointer;
    transition: opacity var(--transition);
}

.torrent-thumb:hover {
    opacity: 0.8;
}

.torrent-thumb-placeholder {
    width: 100%;
    height: 140px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.torrent-info {
    flex: 1;
    min-width: 0;
}

.torrent-title {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.torrent-translated {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.torrent-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.torrent-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.torrent-actions {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    justify-content: flex-start;
    flex-shrink: 0;
}

/* 상태 배지 */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-not-downloaded {
    background: rgba(102, 102, 102, 0.2);
    color: var(--text-muted);
}

.badge-cached {
    background: rgba(123, 63, 181, 0.2);
    color: var(--cache);
}

.badge-downloading {
    background: rgba(74, 158, 255, 0.2);
    color: var(--accent);
}

.badge-completed {
    background: rgba(74, 222, 128, 0.2);
    color: var(--success);
}

/* 품번 태그 */
.product-code {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: rgba(74, 158, 255, 0.15);
    color: var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

/* 시더/리처 */
.seeders { color: var(--success); }
.leechers { color: var(--danger); }

/* ============ 미디어 페이지 (모바일 퍼스트) ============ */
.media-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.media-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.media-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    justify-content: space-between;
}

.media-search {
    flex: 1;
    min-width: 0;
}

.media-search .search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.media-search .search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.file-count {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.sort-toggle {
    display: flex;
    gap: 0.25rem;
}

.sort-btn {
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all var(--transition);
}

.sort-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

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

.view-toggle {
    display: flex;
    gap: 0.25rem;
}

.view-btn {
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.view-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

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

/* 그리드 뷰: 모바일 2열 → sm 3열 → lg+ 동적 */
.media-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.media-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition);
    color: inherit;
    display: block;
}

.media-card:hover {
    border-color: var(--accent);
}

.media-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: var(--bg-tertiary);
    overflow: hidden;
    cursor: pointer;
}

/* 썸네일 → 정보 영역 분리 링크 */
.media-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.media-card-link:hover .media-card-info {
    background: var(--bg-tertiary);
}

.media-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.media-card:hover .media-card-thumb img {
    transform: scale(1.05);
}

.media-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.new-badge {
    position: absolute;
    top: 0.375rem;
    left: 0.375rem;
    background: var(--warning);
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
}

.media-card-info {
    padding: 0.625rem;
}

.media-card-name {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.media-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.media-card-code {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.75rem;
}

.media-card-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0 0.625rem 0.625rem;
}

/* 리스트 뷰 */
.media-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.media-list .media-card {
    display: flex;
    flex-direction: row;
    border-radius: var(--radius-sm);
}

.media-list .media-card-thumb {
    width: 80px;
    aspect-ratio: auto;
    height: 50px;
    flex-shrink: 0;
}

.media-list .media-card-link {
    flex: 1;
    min-width: 0;
}

.media-list .media-card-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    min-width: 0;
}

.media-list .media-card-name {
    flex: 1;
    margin-bottom: 0;
}

.media-list .media-card-meta {
    gap: 0.5rem;
    flex-shrink: 0;
}

.media-list .media-card-actions {
    padding: 0.5rem;
    align-items: center;
}

/* 메타데이터 아이콘 */
.metadata-icon {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* ============ 플레이어 페이지 (모바일 퍼스트) ============ */
.player-container {
    max-width: 1200px;
    margin: 0 auto;
    /* 모바일: 여백 없음 (전체 화면 활용) */
    padding: 0;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.75rem;
    padding: 0 0.75rem;
}

/* HEVC 코덱 경고 */
.codec-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--warning);
    color: var(--warning);
    padding: 0.5rem 0.75rem;
    margin: 0 0.75rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.player-back {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.player-back:hover {
    color: var(--text-primary);
}

.player-actions {
    display: flex;
    gap: 0.5rem;
}

.video-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    /* 모바일: 둥근 모서리 없음 */
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.video-wrapper video {
    width: 100%;
    max-height: 75vh;
    display: block;
}

.player-info {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    margin: 0 0.75rem;
}

.player-filename {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    word-break: break-all;
}

.player-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.player-code {
    color: var(--accent);
    font-weight: 600;
}

.player-metadata {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.player-metadata h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.metadata-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.metadata-tag {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

/* 배우 링크 태그 (클릭 가능) */
a.metadata-tag-link {
    text-decoration: none;
    color: var(--primary);
    border: 1px solid var(--primary);
    background: transparent;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
a.metadata-tag-link:hover {
    background: var(--primary);
    color: #fff;
}

/* 자막 컨트롤 */
.subtitle-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.subtitle-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.subtitle-buttons {
    display: flex;
    gap: 0.375rem;
}

.subtitle-btn {
    min-height: 36px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

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

/* 자막 아이콘 (미디어 목록) */
.subtitle-icon {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--success);
    opacity: 0.8;
}

/* ============ 밴 배지 ============ */
.badge-banned {
    background: rgba(217, 64, 64, 0.2);
    color: var(--danger);
}

.torrent-card.is-banned {
    opacity: 0.5;
}

.search-result-card.is-banned {
    opacity: 0.5;
}

/* ============ 선호 배우 하트 ============ */
.favorite-heart {
    color: #f43f5e;
    font-size: 0.75rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.favorite-heart:hover {
    transform: scale(1.2);
}

.favorite-heart-empty {
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

.favorite-heart-empty:hover {
    color: #f43f5e;
    transform: scale(1.2);
}

/* 미디어 카드 배우 정보 */
.media-card-actresses {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-card-actresses .favorite-mark {
    color: #f43f5e;
}

/* 키보드 힌트: 모바일에서는 숨김 */
.keyboard-hints {
    display: none;
}

/* ============ 파이프라인 모니터링 페이지 ============ */
.pipeline-page {
    max-width: 900px;
    margin: 0 auto;
}

.pipeline-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pipeline-timestamp {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.pipeline-section {
    margin-bottom: 1.5rem;
}

.pipeline-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pipeline-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.pipeline-item-processing {
    border-left: 3px solid var(--accent);
}

.pipeline-item-completed {
    border-left: 3px solid var(--success);
}

.pipeline-item-failed {
    border-left: 3px solid var(--danger);
}

.pipeline-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.pipeline-item-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pipeline-item-name {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.pipeline-step-label {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
}

.pipeline-elapsed {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: auto;
}

.pipeline-time {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: auto;
}

.pipeline-subtitle-info {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* 다운로드 진행률 */
.pipeline-progress-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.375rem;
}

.pipeline-progress-bar {
    flex: 1;
    height: 6px;
}

.pipeline-progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 35px;
    text-align: right;
}

.pipeline-speed {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 70px;
    text-align: right;
}

.pipeline-eta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 스텝 인디케이터 */
.step-indicator {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin-top: 0.625rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
    position: relative;
}

/* 스텝 간 연결선 */
.step-item:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 7px;
    left: calc(50% + 7px);
    width: calc(100% - 14px);
    height: 2px;
    background: var(--border-color);
}

.step-item.step-done:not(:last-child)::after {
    background: var(--success);
}

.step-item.step-active:not(:last-child)::after {
    background: var(--border-color);
}

.step-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    z-index: 1;
    flex-shrink: 0;
}

.step-done .step-dot {
    background: var(--success);
    border-color: var(--success);
}

.step-active .step-dot {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.3);
    animation: step-pulse 1.5s ease-in-out infinite;
}

@keyframes step-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(74, 158, 255, 0.1); }
}

.step-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.step-done .step-label {
    color: var(--success);
}

.step-active .step-label {
    color: var(--accent);
    font-weight: 600;
}

/* 실패 배지 */
.badge-failed {
    background: rgba(217, 64, 64, 0.2);
    color: var(--danger);
}

/* ============ 페이지네이션 ============ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.pagination .btn {
    min-width: 70px;
}

.page-info {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ============ 모달 (모바일 전체 화면) ============ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 500;
}

.modal-overlay.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* actress 페이지 모달 */
.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    /* 모바일: 전체 화면 */
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

/* torrents 페이지 모달 */
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    /* 모바일: 전체 화면 */
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

.modal-search-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.modal-search-box input {
    flex: 1;
    padding: 0.625rem 0.75rem;
    min-height: 44px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.modal-search-box input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* 검색 결과 아이템 (actress + torrents 공통) */
.search-result-item,
.search-result-card {
    display: flex;
    gap: 0.625rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-primary);
}

.search-result-item:hover,
.search-result-card:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.search-result-item:last-child,
.search-result-card:last-child {
    margin-bottom: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.375rem;
    word-break: break-word;
}

.search-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.search-result-meta .seeders {
    color: var(--success);
    font-weight: 600;
}

.search-result-meta .leechers {
    color: var(--danger);
}

.search-result-action {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* ============ 다운로드 큐 ============ */
.download-queue {
    margin-top: 1.5rem;
}

.download-queue h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--accent);
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    /* 모바일: 줄바꿈 허용 */
    flex-wrap: wrap;
}

.queue-item-name {
    flex: 1;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 100px;
}

.progress-bar {
    width: 80px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s;
}

.queue-progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 35px;
    text-align: right;
}

.queue-speed {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 70px;
    text-align: right;
}

/* ============ 로딩 / 빈 상태 ============ */
.loading-indicator,
.loading-text {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

.empty-state,
.empty-text {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

/* ============================================================
   반응형 미디어 쿼리 (모바일 퍼스트)
   ============================================================ */

/* ============ sm: 480px+ (큰 모바일) ============ */
@media (min-width: 480px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .works-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .media-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .toast-container {
        right: 1.5rem;
        left: auto;
        max-width: 350px;
    }

    .nav-user {
        max-width: 150px;
    }
}

/* ============ md: 768px+ (태블릿) ============ */
@media (min-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .nav-container {
        padding: 0 1rem;
        gap: 2rem;
    }

    .nav-logo {
        font-size: 1.25rem;
    }

    /* 태블릿+: 상단 네비게이션 표시, 하단 탭바 숨김 */
    .nav-menu {
        display: flex;
        gap: 1.5rem;
        flex: 1;
    }

    .nav-link {
        font-size: 0.9rem;
        padding: 0;
    }

    .bottom-tab-bar {
        display: none;
    }

    /* 하단 탭바 제거로 패딩 조정 */
    .main-content {
        padding: 1.5rem 0;
    }

    .toast-container {
        bottom: 1.5rem;
    }

    .nav-user {
        font-size: 0.85rem;
        max-width: 200px;
    }

    .nav-logout {
        font-size: 0.85rem;
    }

    .nav-auth {
        gap: 1rem;
    }

    .card {
        padding: 1.25rem;
    }

    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }

    .welcome-card {
        padding: 3rem 1rem;
    }

    .welcome-card h1 {
        font-size: 2rem;
    }

    .page-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .profile-section {
        flex-direction: row;
        gap: 2rem;
        margin-bottom: 2rem;
    }

    .profile-image-wrap {
        width: 200px;
        margin: 0;
    }

    .profile-name {
        font-size: 1.5rem;
    }

    .profile-name-jp {
        font-size: 1rem;
    }

    .meta-item {
        font-size: 0.9rem;
    }

    .meta-badge {
        font-size: 0.8rem;
    }

    .count-badge {
        font-size: 0.8rem;
    }

    .work-card-info {
        padding: 0.625rem;
    }

    .work-card-code {
        font-size: 0.85rem;
    }

    .work-card-title {
        font-size: 0.8rem;
    }

    .work-card-date {
        font-size: 0.75rem;
    }

    .work-card-seeds {
        font-size: 0.7rem;
    }

    .work-card-actions {
        gap: 0.375rem;
    }

    .status-icon {
        top: 0.375rem;
        right: 0.375rem;
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.75rem;
    }

    /* 토렌트 카드: 가로 레이아웃 */
    .torrent-header {
        flex-direction: row;
        align-items: center;
    }

    .search-box {
        flex: 1;
        max-width: 500px;
    }

    .torrent-card {
        flex-direction: row;
        gap: 1rem;
        padding: 1rem;
    }

    .torrent-thumb,
    .torrent-thumb-placeholder {
        width: 120px;
        height: 80px;
    }

    .torrent-actions {
        flex-direction: column;
        justify-content: center;
    }

    /* 미디어 헤더 */
    .media-header {
        flex-direction: row;
        align-items: center;
    }

    .media-header-right {
        width: auto;
        justify-content: flex-end;
    }

    .media-list .media-card-thumb {
        width: 120px;
        height: 68px;
    }

    .media-list .media-card-info {
        gap: 1rem;
        padding: 0.5rem 0.75rem;
    }

    .media-list .media-card-meta {
        gap: 1rem;
    }

    .media-list .media-card-actions {
        padding: 0.5rem 0.75rem;
    }

    /* 플레이어 */
    .player-container {
        padding: 0 1rem;
    }

    .player-header {
        padding: 0;
    }

    .video-wrapper {
        border-radius: var(--radius);
        margin-bottom: 1rem;
    }

    .player-info {
        padding: 1rem 1.25rem;
        margin: 0;
    }

    .player-filename {
        font-size: 0.95rem;
    }

    .player-meta {
        gap: 1rem;
    }

    .keyboard-hints {
        display: block;
        margin-top: 1rem;
        font-size: 0.75rem;
        color: var(--text-muted);
    }

    .keyboard-hints kbd {
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        border-radius: 3px;
        padding: 0.1rem 0.35rem;
        font-size: 0.7rem;
        font-family: monospace;
    }

    /* 모달: 창 크기로 변경 */
    .modal-content {
        width: 90%;
        max-width: 600px;
        max-height: 80vh;
        height: auto;
        border-radius: var(--radius);
    }

    .modal {
        width: 90%;
        max-width: 800px;
        max-height: 80vh;
        height: auto;
        border-radius: var(--radius);
    }

    .modal-overlay.active {
        padding-top: 5vh;
    }

    .modal-body {
        padding: 1.25rem;
    }

    .queue-item {
        flex-wrap: nowrap;
    }

    .progress-bar {
        width: 100px;
    }

    .queue-progress-text {
        min-width: 40px;
    }

    .queue-speed {
        min-width: 80px;
    }

    .login-card {
        padding: 2rem;
    }

    .login-title {
        font-size: 1.75rem;
    }

    .login-subtitle {
        font-size: 0.9rem;
    }

    .rank-badge {
        top: 0.5rem;
        left: 0.5rem;
        font-size: 0.75rem;
    }

    .actress-card-info {
        padding: 0.75rem;
    }

    .actress-card-name {
        font-size: 0.9rem;
    }

    .actress-card-name-jp {
        font-size: 0.75rem;
    }

    .actress-card-meta {
        font-size: 0.8rem;
    }

    .new-badge {
        top: 0.5rem;
        left: 0.5rem;
    }

    .media-card-info {
        padding: 0.75rem;
    }
}

/* ============ lg: 1024px+ (데스크톱) ============ */
@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .works-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }

    .pagination .btn {
        min-width: 80px;
    }
}

/* ============ xl: 1400px+ (대형 모니터) ============ */
@media (min-width: 1400px) {
    /* 큰 화면에서 추가 최적화 (필요시) */
}

/* ============ 호버 효과 (터치 디바이스 제외) ============ */
@media (hover: hover) {
    /* 호버 효과는 마우스가 있는 환경에서만 적용 */
    /* 기존 :hover 선택자가 이미 적용되어 있으므로 추가 작업 불필요 */
}

/* ============ 이미지 모달 ============ */
.image-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
}

.image-modal.active {
    display: flex;
}

.image-modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10000;
    line-height: 1;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.image-modal-close:hover {
    opacity: 1;
}

.image-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius);
}

.image-modal-title {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.75rem;
    text-align: center;
}
