* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/*noname 브라우저 기본 크기 */
.container {
    max-width: 1080px;
    margin: 80px auto 20px;
    padding: 20px;
}

/* 최근 본 타이틀 섹션 */
.recent-titles-section {
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.section-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 {
    color: #667eea;
    margin: 0;
    font-size: 20px;
}

.toggle-icon {
    color: #667eea;
    font-size: 14px;
    transition: transform 0.3s;
}

.recent-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.recent-titles-section:not(.collapsed) .recent-content {
    padding-top: 15px;
}

.clear-btn {
    padding: 6px 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    transition: all 0.3s;
}

.clear-btn:hover {
    background: #ff5252;
    color: white;
    border-color: #ff5252;
}

.recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.recent-card {
    position: relative;
    background: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
}

.recent-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.recent-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.no-image-small {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 12px;
}

.recent-info {
    padding: 10px;
}

.recent-info h3 {
    font-size: 14px;
    margin: 0 0 5px 0;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.episode-info {
    font-size: 12px;
    color: #667eea;
    margin: 0 0 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-info {
    font-size: 11px;
    color: #999;
    margin: 0;
}

.recent-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s;
}

.recent-card:hover .remove-btn {
    opacity: 1;
}

.remove-btn:hover {
    background: #ff5252;
    transform: scale(1.1);
}

/* 검색 필터 섹션 */
.search-filter-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: bold;
    min-width: 60px;
    color: #333;
}

.search-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.search-button {
    padding: 10px 30px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.search-button:hover {
    background: #5568d3;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.filter-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
    font-weight: bold;
}

/* 결과 섹션 */
.results-section {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-header {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-header h2 {
    color: #667eea;
    margin: 0;
    font-size: 24px;
}

.result-count {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* 메인 페이지 */
.welcome-section {
    background: white;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.welcome-section h1 {
    color: #667eea;
    font-size: 48px;
    margin-bottom: 20px;
}

.welcome-section > p {
    font-size: 18px;
    color: #666;
    margin-bottom: 50px;
}

.category-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.showcase-item {
    padding: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    transition: transform 0.3s;
}

.showcase-item:hover {
    transform: translateY(-5px);
}

.showcase-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.showcase-item h3 {
    font-size: 24px;
    color: #333;
    margin-bottom: 10px;
}

.showcase-item p {
    color: #666;
    font-size: 14px;
}

/* 결과 없음 */
.no-results {
    background: white;
    padding: 60px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.no-results p {
    font-size: 18px;
    color: #666;
}

/* 타이틀 그리드 */
/* 여기서 minmax(150px, 1fr) x축 변경값 */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* 타이틀 그리드 */
/* 여기서 height : 200px y축 변경값 */
.card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    object-position: top;
    display: block;
}


.card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

/* 타이틀 제목 오버레이 */
/*  이건 제목이 길면 ... 버전
.card .title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 5;
}
*/
/*글자를 다 보이는 버전 
    white-space: normal;      줄바꿈 허용
    overflow: visible;        잘림 없음
    height: auto;             높이 자동 확장
*/
.card .title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    white-space: normal;      /* 줄바꿈 허용 */
    overflow: visible;        /* 잘림 없음 */
    height: auto;             /* 높이 자동 확장 */
    z-index: 5;
}


.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ff5252;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
}


.no-image {
    width: 100%;
    height: 300px;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

.card h3 {
    padding: 10px;
    font-size: 12px;
    text-align: center;
    word-break: break-word;
}

.card a {
    text-decoration: none;
    color: inherit;
}

.path-info {
    padding: 0 15px 15px;
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* 로그인/회원가입 폼 */
.auth-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

/* 대기 페이지 */
.waiting-container {
    max-width: 600px;
    margin: 100px auto;
    background: white;
    padding: 60px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    text-align: center;
}

.waiting-container h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.waiting-container p {
    font-size: 18px;
    color: #666;
    line-height: 1.6;
}

/* 페이징 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-link {
    padding: 8px 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 14px;
}

.page-link:hover {
    border-color: #667eea;
    color: #667eea;
}

.page-link.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
    font-weight: bold;
}

.page-dots {
    padding: 8px 5px;
    color: #999;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        margin-top: 70px;
    }
    
    .filter-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-label {
        width: 100%;
    }
    
    .search-input {
        width: 100%;
    }
    
    .filter-buttons {
        width: 100%;
    }
    
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .card h3 {
        font-size: 14px;
        padding: 10px;
    }
    
    .header-content {
        flex-wrap: wrap;
    }
    
    .episode-select {
        font-size: 18px;
        max-width: 300px;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .results-header h2 {
        font-size: 20px;
    }
}