/* Basic Reset & Body */
html {
    scroll-behavior: smooth;
}

:root {
    --bg-color: #1d2739;
    --primary-color: #11b9da;
    --text-color: #ffffff;
    --card-bg: #2a3a50;
    --section-bg: #253145;
    --green-btn: #28a745;
    --green-btn-hover: #218838;
}

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

body {
    font-family: 'Helvetica Neue', 'Arial', 'Hiragino Sans', 'Meiryo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
}

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

h1, h2, h3 {
    font-weight: 600;
}

ul {
    list-style: none;
}

section {
    padding: 40px 15px;
}

section h2 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: var(--primary-color);
}

/* Header & First View */
#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

#hero h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

/* Card Grid Animation */
.card-grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 480px; 
    margin: 0 auto 30px;
    perspective: 1000px;
}

.card {
    aspect-ratio: 1 / 1;
    position: relative;
    min-width: 90px;
}

.card-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card.is-flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    overflow: hidden; /* To keep img corners rounded */
}

.card-front {
    background-color: var(--card-bg);
}

.card-front a,
.card-front img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-back {
    background-color: var(--primary-color);
    transform: rotateY(180deg);
    font-size: 0.8rem;
    padding: 5px;
}

.card-back a {
    color: var(--bg-color);
    display: flex;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
}

/* Buttons and Links */
.btn-register {
    display: inline-block;
    background-color: var(--green-btn);
    color: var(--text-color);
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 20px;
    transition: background-color 0.3s;
}

.btn-register:hover {
    background-color: var(--green-btn-hover);
}

.site-news {
    display: block;
    margin-bottom: 30px;
    color: #ccc;
}

.scroll-down {
    font-size: 2rem;
    color: var(--primary-color);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-15px); }
    60% { transform: translateY(-10px); }
}

/* Main Content */

/* Banner */
.banner {
    padding: 0;
}
.banner-inner {
}
.banner-inner img{width: 100%;
}

/* General Song List Styles */
.song-list li, .song-list-simple li {
    display: flex;
    align-items: center;
    background-color: var(--section-bg);
    border-radius: 8px;
    margin-bottom: 15px;
}

.song-list li {
     padding: 10px;
}

.song-list-simple li {
    background-color: transparent;
}

.song-list-simple li > a:first-child {
    margin-right: 15px;
}

.song-list img, .song-list-simple img {
    width: 90px;
    height: 90px;
    border-radius: 5px;
    display: block;
}

.song-info a {
    color: var(--text-color);
}

/* Ranking List */
#ranking .song-list {
    counter-reset: ranking;
}

#ranking .song-list .rank {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-right: 15px;
    min-width: 30px;
    text-align: center;
}

#ranking .song-list li > a:first-of-type {
    margin-right: 15px;
}

#ranking .song-info h3 {
    font-size: 1rem;
    margin-bottom: 5px;
    color: var(--text-color);
}
#ranking .song-info p {
    font-size: 0.8rem;
    color: #ccc;
    margin-bottom: 5px;
}
#ranking .song-info span {
    font-size: 0.75rem;
    color: #aaa;
}

/* New Songs List */
#new-songs .song-list-simple a {
    color: var(--text-color);
}

#new-songs .song-list-simple h3 { font-size: 1rem; color: var(--text-color);}
#new-songs .song-list-simple p { font-size: 0.8rem; color: #ccc; }
#new-songs .song-list-simple span { font-size: 0.75rem; color: #aaa; }

/* Search Form */
#search form {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    border: 1px solid var(--primary-color);
    border-radius: 50px;
    overflow: hidden;
}

#search input[type="text"] {
    flex-grow: 1;
    border: none;
    background: transparent;
    color: var(--text-color);
    padding: 15px 20px;
    font-size: 1rem;
}

#search input[type="text"]:focus {
    outline: none;
}

#search button {
    background: var(--primary-color);
    border: none;
    color: var(--text-color);
    padding: 0 25px;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Genres */
#genres ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

#genres li a {
    display: block;
    background-color: var(--section-bg);
    padding: 10px 20px;
    border-radius: 20px;
    transition: background-color 0.3s;
}

#genres li a:hover {
    background-color: var(--primary-color);
    color: var(--text-color);
}

/* Pickup Grid */
#pickup .pickup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

#pickup .pickup-grid li > a:first-child img {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    margin-bottom: 8px;
}

#pickup .pickup-grid div a {
    color: var(--text-color);
}

#pickup .pickup-grid h3 {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
}

#pickup .pickup-grid p {
    font-size: 0.75rem;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer */
#footer {
    background-color: #111;
    padding: 40px 15px;
    text-align: center;
}

.user-menu h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.user-menu ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 20px;
    margin-bottom: 30px;
}

.user-menu li a {
    color: #ccc;
    font-size: 0.8rem;
}

.license {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    font-size: 0.75rem;
}

.license dt {
    font-weight: bold;
    color: #ccc;
}

.license dd {
    color: #aaa;
}

.copyright {
    font-size: 0.75rem;
    color: #888;
}

/* Responsive for PC */
@media (min-width: 768px) {
    section { padding: 60px 40px; }
    #hero h1 { font-size: 4.5rem; }
    .card-grid-container { 
        grid-template-columns: repeat(6, 1fr); /* Example: 6 columns on wider screens */
        max-width: 780px;
     }
     .card-grid-container .card:nth-child(n+13) { display: none; } /* Hide cards beyond 12 on desktop */

    #ranking .song-list { max-width: 800px; margin: 0 auto; }
    #new-songs .song-list-simple { 
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        max-width: 1000px;
        margin: 0 auto;
    }
    #pickup .pickup-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-width: 1200px; margin: 0 auto; }
}
