/* 基本スタイル */
:root {
    --primary-bg: linear-gradient(135deg, #0a0a0a, #1a1a1a);
    --secondary-bg: rgba(255, 255, 255, 0.08);
    --text-primary: #e8e8e8;
    --text-secondary: #fff;
    --border-color: rgba(255, 255, 255, 0.1);
    --hover-color: rgba(255, 255, 255, 0.12);
    --transition: all 0.4s ease;
}

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

body {
    font-family: 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* アクセシビリティ改善 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* フォーカス表示の改善 */
*:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* ローディング画面 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-bg);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.8s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
    margin-bottom: 30px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 3px;
    opacity: 0;
    animation: loadingTextFade 2s ease-in-out infinite;
}

@keyframes loadingTextFade {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* 縦書きメッセージ */
.vertical-message {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    line-height: 2;
    color: rgba(255, 255, 255, 0.9);
    z-index: 100;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    opacity: 0;
    max-height: 60vh;
    overflow: hidden;
}

.vertical-message.left {
    left: 80px;
    animation: verticalSlideInLeft 2s ease-out 3s forwards;
}

.vertical-message.right {
    right: 80px;
    animation: verticalSlideInRight 2s ease-out 3s forwards;
}

@keyframes verticalSlideInLeft {
    0% { opacity: 0; transform: translateY(-50%) translateX(-100px); }
    100% { opacity: 0.9; transform: translateY(-50%) translateX(0); }
}

@keyframes verticalSlideInRight {
    0% { opacity: 0; transform: translateY(-50%) translateX(100px); }
    100% { opacity: 0.9; transform: translateY(-50%) translateX(0); }
}

.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 20px; 
}

/* ヘッダー */
header {
    background: rgba(0, 0, 0, 0.95);
    padding: 20px 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-color);
    animation: slideDown 1s ease-out;
}

@keyframes slideDown { 
    from { transform: translateY(-100%); opacity: 0; } 
    to { transform: translateY(0); opacity: 1; } 
}

nav ul { 
    list-style: none; 
    display: flex; 
    justify-content: center; 
    gap: 40px; 
    flex-wrap: wrap; 
}

nav a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 400;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
    padding: 12px 20px;
    border-radius: 8px;
    opacity: 0;
    animation: fadeInStagger 0.8s ease-out forwards;
    letter-spacing: 0.5px;
}

nav a:nth-child(1) { animation-delay: 0.1s; }
nav a:nth-child(2) { animation-delay: 0.2s; }
nav a:nth-child(3) { animation-delay: 0.3s; }
nav a:nth-child(4) { animation-delay: 0.4s; }
nav a:nth-child(5) { animation-delay: 0.5s; }
nav a:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInStagger { 
    from { opacity: 0; transform: translateY(-20px); } 
    to { opacity: 1; transform: translateY(0); } 
}

nav a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4));
    transition: var(--transition);
    transform: translateX(-50%);
}

nav a:hover::before,
nav a:focus::before { 
    width: 90%; 
}

nav a:hover,
nav a:focus { 
    color: var(--text-secondary); 
    background: var(--hover-color); 
    transform: translateY(-3px); 
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.1);
}

/* ヒーローセクション */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.01) 0%, transparent 50%),
        var(--primary-bg);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="0.5" fill="%23333" opacity="0.4"/><circle cx="80" cy="40" r="0.8" fill="%23333" opacity="0.2"/><circle cx="40" cy="80" r="0.6" fill="%23333" opacity="0.3"/><circle cx="60" cy="60" r="0.4" fill="%23333" opacity="0.5"/></svg>') repeat;
    animation: float 40s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) translateX(0px); }
    25% { transform: translateY(-15px) translateX(8px); }
    50% { transform: translateY(-8px) translateX(-8px); }
    75% { transform: translateY(-20px) translateX(5px); }
}

.hero-content { 
    position: relative; 
    z-index: 200;
    max-width: 60%;
    margin: 0 auto;
}

.hero h1 {
    font-size: 5rem;
    margin-bottom: 40px;
    font-weight: 100;
    letter-spacing: 16px;
    text-shadow: 3px 3px 12px rgba(0, 0, 0, 0.9);
    opacity: 0;
    animation: titleReveal 2.5s ease-out 0.8s forwards;
    background: linear-gradient(135deg, #fff, #e8e8e8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes titleReveal {
    0% { opacity: 0; transform: translateY(60px) scale(0.7); filter: blur(15px); }
    50% { opacity: 0.8; transform: translateY(25px) scale(0.85); filter: blur(8px); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0px); }
}

.hero-description {
    font-size: 1.3rem;
    margin-bottom: 30px;
    opacity: 0;
    font-weight: 300;
    letter-spacing: 1px;
    animation: descriptionFade 1.5s ease-out 2.5s forwards;
}

@keyframes descriptionFade { 
    from { opacity: 0; transform: translateY(40px); } 
    to { opacity: 0.8; transform: translateY(0); } 
}

.hero-message {
    font-size: 1.1rem;
    font-style: italic;
    margin-top: 50px;
    padding: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    animation: messagePulse 2s ease-out 3.5s forwards;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
}

@keyframes messagePulse {
    0% { opacity: 0; transform: scale(0.95); }
    50% { opacity: 0.9; transform: scale(1.02); }
    100% { opacity: 0.7; transform: scale(1); }
}

/* セクション共通スタイル */
.section {
    padding: 120px 0;
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}

.section.visible { 
    opacity: 1; 
    transform: translateY(0); 
}

/* 警告ボックス */
.warning-box {
    background: linear-gradient(135deg, rgba(40, 40, 40, 0.9), rgba(20, 20, 20, 0.9));
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 40px;
    margin: 80px auto;
    text-align: center;
    color: var(--text-secondary);
    font-weight: 400;
    max-width: 900px;
    position: relative;
    overflow: hidden;
    animation: warningPulse 4s ease-in-out infinite;
    backdrop-filter: blur(10px);
}

@keyframes warningPulse {
    0%, 100% { 
        border-color: rgba(255, 255, 255, 0.15); 
        box-shadow: 0 0 0 rgba(255, 255, 255, 0); 
    }
    50% { 
        border-color: rgba(255, 255, 255, 0.3); 
        box-shadow: 0 0 30px rgba(255, 255, 255, 0.1); 
    }
}

.warning-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    animation: shine 6s ease-in-out infinite;
}

@keyframes shine { 
    0% { left: -100%; } 
    100% { left: 100%; } 
}

/* ゲーム概要セクション */
.game-overview { 
    text-align: center; 
    margin-bottom: 80px; 
}

.game-overview p { 
    font-size: 1.3rem; 
    margin-bottom: 25px; 
    max-width: 900px; 
    margin-left: auto; 
    margin-right: auto; 
    font-weight: 300;
    line-height: 1.8;
}

.game-overview .highlight {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 1.4rem;
    display: block;
    margin-top: 40px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    border-left: 4px solid rgba(255, 255, 255, 0.8);
    animation: highlightGlow 3s ease-in-out infinite alternate;
    backdrop-filter: blur(5px);
}

@keyframes highlightGlow { 
    from { box-shadow: 0 0 8px rgba(255, 255, 255, 0.1); } 
    to { box-shadow: 0 0 20px rgba(255, 255, 255, 0.2); } 
}

/* 情報グリッド */
.info-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 40px; 
    margin-top: 60px; 
}

.info-card {
    background: linear-gradient(135deg, var(--secondary-bg), rgba(255, 255, 255, 0.03));
    border-radius: 16px;
    padding: 35px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    text-align: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    transition: left 0.8s ease;
}

.info-card:hover::before,
.info-card:focus-within::before { 
    left: 100%; 
}

.info-card:hover,
.info-card:focus-within { 
    transform: translateY(-12px) scale(1.03); 
    box-shadow: 0 20px 40px rgba(255, 255, 255, 0.15); 
    border-color: rgba(255, 255, 255, 0.3); 
}

.info-card h3 { 
    font-size: 1.3rem; 
    margin-bottom: 18px; 
    color: var(--text-secondary); 
    font-weight: 400;
    letter-spacing: 1px;
}

/* キャラクター一覧 */
.character-container { 
    margin-top: 60px; 
    position: relative; 
}

.character-slider-wrapper { 
    overflow: hidden; 
    width: 100%; 
    max-width: 1000px; 
    margin: 0 auto; 
    position: relative; 
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.02);
    padding: 20px;
}

.character-slider { 
    display: flex; 
    width: 200%; 
    transition: transform 0.5s ease; 
}

.character-slide { 
    width: 50%; 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    grid-template-rows: repeat(2, 1fr); 
    gap: 8px; 
}

.character-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.character-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.8s ease;
}

.character-item:hover::before,
.character-item:focus::before { 
    transform: translateX(100%); 
}

.character-item:hover,
.character-item:focus { 
    background: linear-gradient(135deg, var(--hover-color), rgba(255, 255, 255, 0.06)); 
    transform: scale(1.05); 
    text-decoration: none; 
    color: inherit; 
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.15); 
}

.character-avatar { 
    width: 100%; 
    height: 220px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden; 
    position: relative; 
    background: rgba(255, 255, 255, 0.04); 
    border-radius: 8px;
}

.character-avatar img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: transform 0.4s ease; 
    loading: lazy;
}

.character-item:hover .character-avatar img,
.character-item:focus .character-avatar img { 
    transform: scale(1.15); 
}

.character-name { 
    display: none; 
}

/* スライダーコントロール */
.slider-controls { 
    display: flex; 
    justify-content: center; 
    gap: 25px; 
    margin-top: 40px; 
}

.slider-radio { 
    display: none; 
}

.slider-label { 
    display: block; 
    width: 14px; 
    height: 14px; 
    border-radius: 50%; 
    background: rgba(255, 255, 255, 0.3); 
    cursor: pointer; 
    transition: var(--transition); 
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.slider-radio:checked + .slider-label { 
    background: rgba(255, 255, 255, 0.9); 
    transform: scale(1.4); 
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.6); 
    border-color: rgba(255, 255, 255, 0.8);
}

#slide1:checked ~ .character-slider-wrapper .character-slider { 
    transform: translateX(0%); 
}

#slide2:checked ~ .character-slider-wrapper .character-slider { 
    transform: translateX(-50%); 
}

/* モーダル */
.modal { 
    display: none; 
    position: fixed; 
    z-index: 2000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0, 0, 0, 0.85); 
    backdrop-filter: blur(8px); 
}

.modal.show { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.modal-content {
    background: linear-gradient(135deg, rgba(40, 40, 40, 0.95), rgba(20, 20, 20, 0.95));
    padding: 50px;
    border-radius: 20px;
    width: 90%;
    max-width: 650px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    position: relative;
    animation: modalFadeIn 0.4s ease-out;
    text-align: center;
    backdrop-filter: blur(15px);
}

@keyframes modalFadeIn { 
    from { opacity: 0; transform: translateY(-40px) scale(0.85); } 
    to { opacity: 1; transform: translateY(0) scale(1); } 
}

.modal-content img { 
    width: 100%; 
    max-width: 320px; 
    height: auto; 
    border-radius: 15px; 
    margin-bottom: 25px; 
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6); 
}

.close {
    color: #aaa;
    font-size: 30px;
    font-weight: bold;
    text-decoration: none;
    position: absolute;
    top: 20px;
    right: 25px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 2001;
}

.close:hover,
.close:focus { 
    color: var(--text-secondary); 
    background: rgba(255, 255, 255, 0.2); 
    text-decoration: none; 
    border-color: rgba(255, 255, 255, 0.5); 
    transform: scale(1.15) rotate(90deg); 
}

/* セクションスタイル */
.system-section, .story-section, .theme-message {
    background: linear-gradient(135deg, var(--secondary-bg), rgba(255, 255, 255, 0.03));
    border-radius: 20px;
    padding: 50px;
    margin: 50px 0;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.system-section { 
    border-left: 5px solid rgba(255, 255, 255, 0.8); 
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.6)); 
}

.story-section { 
    text-align: center; 
}

.theme-message { 
    border-left: 4px solid rgba(255, 255, 255, 0.8); 
    text-align: center; 
    font-size: 1.2rem; 
    line-height: 1.9; 
}

.system-section h3, .story-section h3 { 
    font-size: 1.5rem; 
    margin-bottom: 25px; 
    color: var(--text-secondary); 
    font-weight: 400;
}

.story-section p { 
    font-size: 1.2rem; 
    line-height: 1.9; 
    margin-bottom: 25px; 
}

/* ソーシャルリンク */
.social-links { 
    display: flex; 
    justify-content: center; 
    gap: 30px; 
    margin-top: 60px; 
    flex-wrap: wrap; 
}

.social-link {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    padding: 18px 30px;
    border-radius: 30px;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.social-link:hover,
.social-link:focus { 
    border-color: rgba(255, 255, 255, 0.8); 
    transform: scale(1.08) translateY(-3px); 
    color: var(--text-secondary); 
    box-shadow: 0 15px 30px rgba(255, 255, 255, 0.15); 
}

/* フッター */
footer { 
    background: var(--primary-bg); 
    padding: 60px 0; 
    text-align: center; 
    margin-top: 120px; 
    border-top: 1px solid var(--border-color); 
}

/* 見出しスタイル */
h2 {
    font-size: 2.8rem;
    margin-bottom: 50px;
    text-align: center;
    color: var(--text-secondary);
    font-weight: 200;
    letter-spacing: 4px;
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    transform: translateX(-50%);
    animation: expand 3s ease-in-out infinite;
}

@keyframes expand { 
    0%, 100% { width: 80px; } 
    50% { width: 120px; } 
}

.fade-in { 
    opacity: 0; 
    transform: translateY(40px); 
    transition: all 0.8s ease-out; 
}

.fade-in.visible { 
    opacity: 1; 
    transform: translateY(0); 
}

/* エラーハンドリング */
.error-message {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: #ff6b6b;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
    display: none;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .vertical-message {
        display: none;
    }
    
    .hero h1 { 
        font-size: 3.2rem; 
        letter-spacing: 8px; 
    }
    
    .hero-description { 
        font-size: 1.1rem; 
    }
    
    .hero-content {
        max-width: 90%;
    }
    
    nav ul { 
        gap: 20px; 
    }
    
    nav a { 
        font-size: 0.9rem; 
        padding: 8px 15px; 
    }
    
    .character-slider-wrapper { 
        max-width: 650px; 
    }
    
    .character-slide { 
        grid-template-columns: repeat(2, 1fr); 
        grid-template-rows: repeat(3, 1fr); 
    }
    
    .character-avatar { 
        height: 160px; 
    }
    
    .modal-content { 
        width: 95%; 
        padding: 30px; 
    }
    
    h2 {
        font-size: 2.2rem;
    }
}

@media (max-width: 480px) {
    .character-avatar { 
        height: 130px; 
    }
    
    .hero h1 {
        font-size: 2.5rem;
        letter-spacing: 4px;
    }
    
    .container {
        padding: 0 15px;
    }
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #ffffff;
        --border-color: rgba(255, 255, 255, 0.5);
    }
}

/* 動きを抑制する設定 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}