:root {
    --bg-dark: #1a0a1e;
    --bg-card: #2a1230;
    --bg-card-hover: #3a1a42;
    --pink-light: #ffb7c5;
    --pink: #ff8fa3;
    --pink-dark: #d4607a;
    --cherry: #e8a0bf;
    --gold: #f0c674;
    --text: #f5e6f0;
    --text-muted: #b89abf;
    --border: rgba(255, 183, 197, 0.15);
    --shadow: rgba(0, 0, 0, 0.4);
    --gradient-main: linear-gradient(135deg, #1a0a1e 0%, #2d1035 50%, #1a0a1e 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: var(--gradient-main);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

#sakura-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

header {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 2.5rem 1rem 1.5rem;
    background: linear-gradient(180deg, rgba(45, 16, 53, 0.95) 0%, rgba(26, 10, 30, 0.8) 100%);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.logo {
    font-family: 'Noto Serif JP', serif;
    font-size: 2.8rem;
    color: var(--pink-light);
    text-shadow: 0 0 30px rgba(255, 183, 197, 0.4);
    margin-bottom: 0.2rem;
}

.logo span {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 300;
    font-size: 2.2rem;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    letter-spacing: 2px;
}

nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    cursor: pointer;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    border-color: var(--pink);
    color: var(--pink-light);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--pink-dark), #a04060);
    border-color: var(--pink);
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 143, 163, 0.3);
}

main {
    position: relative;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

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

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.8rem;
    color: var(--pink-light);
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
    font-size: 0.9rem;
}

.search-bar {
    margin-top: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.search-bar input {
    width: 100%;
    padding: 0.8rem 1.2rem;
    border-radius: 30px;
    border: 1px solid var(--border);
    background: rgba(42, 18, 48, 0.8);
    color: var(--text);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-bar input:focus {
    border-color: var(--pink);
    box-shadow: 0 0 15px rgba(255, 143, 163, 0.2);
}

.filter-bar {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

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

.filter-btn.active {
    background: rgba(232, 160, 191, 0.2);
    border-color: var(--cherry);
    color: var(--cherry);
}

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

.anime-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.anime-card:hover {
    transform: translateY(-4px);
    border-color: var(--pink);
    box-shadow: 0 8px 30px rgba(255, 143, 163, 0.15);
    background: var(--bg-card-hover);
}

.anime-card.rated {
    border-color: rgba(240, 198, 116, 0.4);
}

.anime-card.rated::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--pink));
}

.card-image {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
}

.card-placeholder {
    width: 100%;
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    background: linear-gradient(135deg, #2a1230, #3a1a42);
}

.card-info {
    padding: 0.8rem;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-genre {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.card-rating {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.card-stars {
    color: var(--gold);
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(26, 10, 30, 0.85);
    border: 1px solid var(--gold);
    color: var(--gold);
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

.rec-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, var(--pink-dark), #a04060);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
}

.rec-stats {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--pink-light);
    font-family: 'Noto Serif JP', serif;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--pink-light);
    margin-bottom: 0.5rem;
    font-family: 'Noto Serif JP', serif;
}

.empty-state p {
    color: var(--text-muted);
}

/* My List */
.my-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.list-item:hover {
    border-color: var(--pink);
    background: var(--bg-card-hover);
}

.list-rank {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.2rem;
    color: var(--text-muted);
    min-width: 2rem;
    text-align: center;
}

.list-rank.top-3 {
    color: var(--gold);
    font-size: 1.4rem;
}

.list-emoji {
    font-size: 2rem;
    min-width: 2.5rem;
    text-align: center;
}

.list-info {
    flex: 1;
}

.list-title {
    font-weight: 500;
    margin-bottom: 0.2rem;
}

.list-genre {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.list-stars {
    color: var(--gold);
    font-size: 1.1rem;
    letter-spacing: 2px;
}

.list-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.3rem;
    border-radius: 50%;
    transition: all 0.3s;
}

.list-remove:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: linear-gradient(135deg, #2a1230, #1a0a1e);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

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

.modal-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal-header img {
    width: 80px;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
}

.modal-header h3 {
    font-family: 'Noto Serif JP', serif;
    color: var(--pink-light);
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

.modal-genres {
    font-size: 0.8rem;
    color: var(--cherry);
}

.modal-year {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.modal-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.modal-rating-section {
    text-align: center;
}

.modal-rating-section > p {
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
}

.watched-toggle {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.toggle-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'Noto Sans JP', sans-serif;
    transition: all 0.3s;
}

.toggle-btn:hover {
    border-color: var(--pink);
    color: var(--pink-light);
}

.toggle-btn.active {
    background: linear-gradient(135deg, var(--pink-dark), #a04060);
    border-color: var(--pink);
    color: #fff;
}

.rating-stars-section {
    margin-top: 1rem;
}

.rating-stars-section.hidden {
    display: none;
}

.star-rating {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.8rem 0;
}

.star {
    font-size: 2.2rem;
    color: #444;
    cursor: pointer;
    transition: all 0.2s;
}

.star:hover,
.star.active {
    color: var(--gold);
    text-shadow: 0 0 15px rgba(240, 198, 116, 0.5);
    transform: scale(1.15);
}

.star.hover-preview {
    color: rgba(240, 198, 116, 0.6);
}

.rating-label {
    color: var(--cherry);
    font-size: 0.9rem;
    min-height: 1.4rem;
}

.save-btn {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.8rem;
    border-radius: 30px;
    border: none;
    background: linear-gradient(135deg, var(--pink-dark), #a04060);
    color: #fff;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.save-btn:hover {
    box-shadow: 0 0 25px rgba(255, 143, 163, 0.4);
    transform: translateY(-2px);
}

footer {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--pink-dark);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--pink);
}

@media (max-width: 600px) {
    .logo {
        font-size: 2rem;
    }
    .logo span {
        font-size: 1.5rem;
    }
    .anime-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.8rem;
    }
    .card-placeholder {
        height: 200px;
    }
    .card-image {
        height: 200px;
    }
    .modal-content {
        padding: 1.5rem;
    }
    .list-item {
        flex-wrap: wrap;
    }
}
