/* テーマ設定 */
:root {
    --bg-dark: #070913;
    --bg-grad-1: #1a1b4b;
    --bg-grad-2: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    --modal-bg: rgba(7, 9, 19, 0.85);
    --skeleton-base: #1e293b;
    --skeleton-shine: #334155;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* 全体レイアウト */
body {
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-grad-1), var(--bg-grad-2));
    background-size: 400% 400%;
    animation: bgShift 15s ease infinite;
    color: var(--text-main);
    font-family: var(--font-body);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

@keyframes bgShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

h1 {
    margin-top: 60px;
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 3.5rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    background: linear-gradient(to right, #fff, var(--text-sub));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--accent-cyan);
    font-family: var(--font-heading);
    letter-spacing: 2px;
    font-weight: 400;
    text-transform: uppercase;
    font-size: 1rem;
    margin-bottom: 40px;
}

/* 追従する光 */
.glow {
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, rgba(6, 182, 212, 0.05) 40%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    transition: 0.1s ease-out;
    mix-blend-mode: screen;
}

/* グリッドとカード */
.container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 40px;
    width: 90%;
    max-width: 1200px;
    padding: 20px 0 80px;
    perspective: 1200px;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 30px;
    text-align: center;
    transition: transform 0.1s ease, box-shadow 0.4s ease, border-color 0.4s ease;
    transform-style: preserve-3d;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* カード内の装飾光 */
.card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to bottom right, rgba(255, 255, 255, 0.1), transparent, transparent);
    transform: rotate(45deg);
    pointer-events: none;
    transition: 0.5s ease;
    opacity: 0;
}

.card:hover {
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), 0 0 40px rgba(6, 182, 212, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.card:hover::before {
    opacity: 1;
}

.card h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin-bottom: 12px;
    font-weight: 700;
    transform: translateZ(40px);
    color: #fff;
}

.card p {
    font-size: 0.95rem;
    color: var(--text-sub);
    transform: translateZ(25px);
    line-height: 1.5;
}

.day-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    color: #fff;
    font-size: 0.75rem;
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
    transform: translateZ(30px);
}

/* モーダル表示 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    padding: 40px;
    max-width: 650px;
    width: 90%;
    position: relative;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    opacity: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-sub);
    transition: color 0.2s, transform 0.2s;
    z-index: 10;
}

.close-btn:hover {
    color: #fff;
    transform: scale(1.1);
}

/* 画像とスケルトン（読み込み待機） */
.img-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 20px;
    margin-bottom: 25px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.skeleton {
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.img-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
    transform: scale(1.05);
}

.img-container img.loaded {
    opacity: 1;
    transform: scale(1);
}

/* メタデータとボタン */
#modalTitle {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    margin: 0 0 15px 0;
    font-weight: 700;
    text-align: center;
}

#modalDesc {
    color: var(--text-sub);
    text-align: center;
    margin-bottom: 25px;
    line-height: 1.6;
}

.app-meta {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-heading);
    color: #fff;
}

.app-meta>span {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.app-meta span i {
    color: var(--accent-cyan);
}

.share-button {
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
    border: none;
    border-radius: 30px;
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(6, 182, 212, 0.3);
    position: relative;
    overflow: hidden;
}

.share-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(6, 182, 212, 0.4);
}

.share-button:hover::after {
    left: 150%;
}

.share-button:active {
    transform: scale(0.96);
}

.star-active {
    color: #fbbf24;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.star-inactive {
    color: rgba(255, 255, 255, 0.2);
}

/* ヘルプボタン */
.help-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-sub);
    font-size: 1.5rem;
    font-family: var(--font-heading);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.help-btn:hover {
    color: #fff;
    transform: translateY(-3px);
    border-color: var(--accent-cyan);
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.3);
}

/* ヘルプモーダル専用調整 */
.help-modal-content {
    align-items: flex-start;
    text-align: left;
}

.help-modal-content h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 20px;
    color: #fff;
}

.help-modal-content p {
    color: var(--text-sub);
    line-height: 1.6;
    margin-bottom: 25px;
}

@media (max-width: 600px) {
    h1 {
        font-size: 2.5rem;
    }

    .container {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 30px 20px;
    }

    #modalTitle {
        font-size: 1.8rem;
    }
}
