/* ==========================================
   壁の証言 - 全画面テキストスタイル
   サウンドノベル風（弟切草スタイル）
   ========================================== */

/* フォント読み込み */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;500;600;700&display=swap');

/* リセットと基本設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Noto Serif JP', 'Yu Mincho', 'Hiragino Mincho ProN', serif;
    background: #000;
    color: #e0e0e0;
}

/* 画面コンテナ */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

.screen.overlay {
    background: rgba(0, 0, 0, 0.95);
    z-index: 100;
}

/* ==========================================
   タイトル画面
   ========================================== */

#title-screen {
    background: linear-gradient(180deg, #0a0a0f 0%, #1a1a2e 50%, #0a0a0f 100%);
    position: relative;
}

/* パーティクル背景 */
#title-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,0.3), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(255,255,255,0.4), transparent),
        radial-gradient(2px 2px at 130px 80px, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 160px 120px, rgba(255,255,255,0.3), transparent);
    background-size: 200px 200px;
    animation: particleFloat 20s linear infinite;
    pointer-events: none;
}

@keyframes particleFloat {
    0% { transform: translateY(0); }
    100% { transform: translateY(-200px); }
}

.title-content {
    text-align: center;
    z-index: 1;
}

.game-title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 700;
    letter-spacing: 0.3em;
    margin-bottom: 1rem;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 30px rgba(255, 255, 255, 0.3); }
    50% { text-shadow: 0 0 50px rgba(255, 255, 255, 0.5), 0 0 80px rgba(200, 200, 255, 0.3); }
}

.game-subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    color: #888;
    letter-spacing: 0.2em;
    margin-bottom: 4rem;
}

.title-menu {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.title-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ccc;
    padding: 1rem 3rem;
    font-family: inherit;
    font-size: 1.1rem;
    letter-spacing: 0.3em;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.title-btn:hover {
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.title-btn:hover::before {
    left: 100%;
}

.title-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ==========================================
   ゲーム画面 - 全画面テキスト表示
   ========================================== */

#game-screen {
    flex-direction: column;
    justify-content: flex-start;
    padding: 0;
}

/* 背景レイヤー */
#background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0a0a0f;
    transition: background-color 1s ease;
    z-index: 0;
}

/* 章タイトル表示 */
#chapter-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    text-align: center;
    animation: chapterFadeIn 0.8s ease-out;
}

#chapter-title.hidden {
    display: none;
}

#chapter-text {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 600;
    letter-spacing: 0.4em;
    color: #fff;
    text-shadow: 0 0 40px rgba(255, 255, 255, 0.5);
}

@keyframes chapterFadeIn {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 証拠獲得ポップアップ */
#evidence-popup {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(139, 90, 43, 0.95), rgba(100, 60, 20, 0.95));
    border: 2px solid #c9a227;
    padding: 1rem 2.5rem;
    border-radius: 4px;
    z-index: 60;
    animation: evidenceSlide 0.5s ease-out;
    box-shadow: 0 0 30px rgba(201, 162, 39, 0.4);
}

#evidence-popup.hidden {
    display: none;
}

#evidence-text {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: #fff;
    letter-spacing: 0.1em;
}

@keyframes evidenceSlide {
    0% { opacity: 0; transform: translateX(-50%) translateY(-30px); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==========================================
   全画面テキストウィンドウ
   ========================================== */

#text-window {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 8vh 8vw;
    cursor: pointer;
    z-index: 10;
}

/* 話者名 */
#speaker-name {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    color: #c9a227;
    margin-bottom: 2rem;
    letter-spacing: 0.2em;
    font-weight: 600;
    min-height: 1.5em;
    text-shadow: 0 0 10px rgba(201, 162, 39, 0.3);
}

/* メインテキスト - 大きく読みやすく */
#text-content {
    font-size: clamp(1.4rem, 3.5vw, 2.2rem);
    line-height: 2.2;
    letter-spacing: 0.08em;
    color: #e8e8e8;
    flex: 1;
    overflow-y: auto;
    padding-right: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* スクロールバースタイル */
#text-content::-webkit-scrollbar {
    width: 4px;
}

#text-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#text-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* クリックインジケーター */
#click-indicator {
    position: absolute;
    bottom: 5vh;
    right: 8vw;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.6);
    animation: indicatorPulse 1.2s ease-in-out infinite;
    transition: opacity 0.3s ease;
}

@keyframes indicatorPulse {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(5px); }
}

/* ==========================================
   選択肢 - 全画面中央表示
   ========================================== */

#choices {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 20;
    width: 90%;
    max-width: 700px;
}

#choices.hidden {
    display: none;
}

.choice-btn {
    background: rgba(20, 20, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #e0e0e0;
    padding: 1.5rem 2rem;
    font-family: inherit;
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.choice-btn::before {
    content: '▶';
    position: absolute;
    left: -30px;
    opacity: 0;
    transition: all 0.3s ease;
    color: #c9a227;
}

.choice-btn:hover {
    background: rgba(40, 40, 60, 0.95);
    border-color: rgba(201, 162, 39, 0.6);
    color: #fff;
    padding-left: 3rem;
    box-shadow: 0 0 20px rgba(201, 162, 39, 0.2);
}

.choice-btn:hover::before {
    left: 1rem;
    opacity: 1;
}

/* ==========================================
   コントロールボタン
   ========================================== */

#controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.8rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    z-index: 30;
}

.control-btn {
    background: rgba(30, 30, 40, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    padding: 0.6rem 1rem;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.05em;
}

.control-btn:hover {
    background: rgba(50, 50, 70, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.control-btn.active {
    background: rgba(139, 90, 43, 0.8);
    border-color: #c9a227;
    color: #fff;
}

/* ==========================================
   オーバーレイ画面共通
   ========================================== */

.overlay-content {
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    background: rgba(15, 15, 25, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
}

.overlay-title {
    font-size: 1.3rem;
    letter-spacing: 0.2em;
    color: #c9a227;
}

.close-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #888;
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

.overlay-body {
    padding: 1.5rem;
    max-height: 65vh;
    overflow-y: auto;
}

.overlay-body::-webkit-scrollbar {
    width: 6px;
}

.overlay-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.overlay-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* ==========================================
   バックログ
   ========================================== */

.log-entry {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-speaker {
    color: #c9a227;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    letter-spacing: 0.1em;
}

.log-text {
    color: #bbb;
    line-height: 1.8;
    font-size: 1rem;
}

/* ==========================================
   セーブ・ロード
   ========================================== */

.save-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.save-slot {
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.save-slot:hover {
    background: rgba(50, 50, 70, 0.8);
    border-color: rgba(201, 162, 39, 0.5);
}

.save-slot-title {
    color: #c9a227;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

.save-slot-info {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.save-slot-preview {
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================
   設定画面
   ========================================== */

.settings-group {
    margin-bottom: 2rem;
}

.settings-group:last-child {
    margin-bottom: 0;
}

.settings-label {
    display: block;
    color: #ccc;
    margin-bottom: 0.8rem;
    font-size: 1rem;
    letter-spacing: 0.1em;
}

.settings-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #c9a227;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.settings-slider::-webkit-slider-thumb:hover {
    background: #ddb52f;
}

.settings-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #c9a227;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* ==========================================
   証拠画面
   ========================================== */

.evidence-item {
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid rgba(201, 162, 39, 0.3);
    padding: 1.2rem;
    margin-bottom: 1rem;
}

.evidence-item:last-child {
    margin-bottom: 0;
}

.evidence-item-title {
    color: #c9a227;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

.evidence-item-desc {
    color: #aaa;
    line-height: 1.7;
    font-size: 0.95rem;
}

.no-evidence {
    text-align: center;
    color: #666;
    padding: 3rem;
    font-size: 1.1rem;
}

/* ==========================================
   レスポンシブ対応
   ========================================== */

@media (max-width: 768px) {
    /* タイトル */
    .game-title {
        letter-spacing: 0.15em;
    }
    
    .title-btn {
        padding: 0.9rem 2rem;
        font-size: 1rem;
    }
    
    /* テキストウィンドウ */
    #text-window {
        padding: 6vh 5vw;
    }
    
    #speaker-name {
        margin-bottom: 1.5rem;
    }
    
    #text-content {
        line-height: 2;
    }
    
    #click-indicator {
        bottom: 12vh;
        right: 5vw;
    }
    
    /* 選択肢 */
    .choice-btn {
        padding: 1.2rem 1.5rem;
    }
    
    /* コントロール */
    #controls {
        flex-wrap: wrap;
        gap: 0.3rem;
        padding: 0.6rem;
    }
    
    .control-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
    }
    
    /* オーバーレイ */
    .overlay-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .overlay-body {
        max-height: 70vh;
    }
    
    .save-slots {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    /* 極小画面対応 */
    #text-window {
        padding: 5vh 4vw;
    }
    
    #text-content {
        font-size: 1.2rem;
        line-height: 1.9;
    }
    
    .choice-btn {
        padding: 1rem;
        font-size: 1rem;
    }
    
    #controls {
        gap: 0.2rem;
    }
    
    .control-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
    }
}

/* ==========================================
   アニメーション・エフェクト
   ========================================== */

/* フェードイン */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* テキスト表示アニメーション */
.text-fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* 画面遷移 */
.screen-transition {
    animation: fadeIn 0.5s ease-out;
}
