@charset "utf-8";

/* === 全体の設定 === */
body {
    margin: 0; padding: 0;
    background-color: #ffddee;
    background-image: url('images/bg_room_y2k.png');
    background-size: cover;
    background-position: center bottom 40px; /* タスクバーの分あける */
    color: #fff;
    font-family: 'DotGothic16', sans-serif;
    
    /* アドレスバー対策 */
    width: 100vw;
    height: 100dvh; /* dvhを使用 */
    
    overflow: hidden; 
    cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEUAAAD///8iIiI0NC8qV4cAAAAAAnRSTlMAtVnL4G0AAAAiSURBVAjXY2AgETAwMDGgCjAwMDIwMqAKMDMwsKCrAAoAAAw+A4E7h76kAAAAAElFTkSuQmCC'), auto;
    
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* お部屋を暗くするフィルター */
#night-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 0, 30, 0.4);
    pointer-events: none; z-index: 1;
}

/* 走査線 */
body::after {
    content: ""; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,0.1) 50%);
    background-size: 100% 4px; pointer-events: none; z-index: 999;
}


/* =========================================
   ★縦持ち禁止システム（鉄壁）
   ========================================= */
#rotate-warning {
    display: none; /* 基本は消す */
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; /* 真っ黒にする */
    color: #00ffff; 
    z-index: 999999; /* 最前面 */
    flex-direction: column; justify-content: center; align-items: center; text-align: center;
}
#rotate-warning i { font-size: 50px; margin-bottom: 20px; animation: rotate-icon 2s infinite; }

/* 縦向き（ポートレート）の時だけ発動 */
@media screen and (orientation: portrait) { 
    #rotate-warning { display: flex !important; } /* 強制表示 */
    #desktop { display: none !important; } /* ゲーム画面は消す */
}

@keyframes rotate-icon { 0% {transform: rotate(0deg);} 25% {transform: rotate(-90deg);} 100% {transform: rotate(-90deg);} }


/* === PC用レイアウト（基本） === */
.desktop-icons {
    position: absolute; top: 20px; left: 20px;
    display: flex; flex-direction: column; gap: 20px; z-index: 10;
}
.icon-item {
    display: flex; flex-direction: column; align-items: center;
    width: 80px; text-align: center; cursor: pointer; text-shadow: 1px 1px 0 #000;
}
.icon-item:hover { opacity: 0.8; transform: scale(1.1); }
.icon-img { font-size: 40px; margin-bottom: 5px; filter: drop-shadow(2px 2px 0 #000); }
.icon-label { font-size: 0.9rem; background: rgba(0,0,0,0.5); padding: 2px 5px; border-radius: 4px; }

/* ねこちゃん */
#neko-container {
    position: absolute;
    top: 70%; left: 50%; transform: translate(-50%, -50%);
    width: 300px; height: 300px;
    display: flex; justify-content: center; align-items: flex-end;
    z-index: 50; cursor: pointer; pointer-events: auto; transition: 0.2s;
}
#neko-container:hover { transform: translate(-50%, -50%) scale(1.05); filter: drop-shadow(0 0 10px #fff); }
.neko-img { width: auto; height: 90%; image-rendering: pixelated; animation: float 3s ease-in-out infinite; }
.jump-anim { animation: jump 0.2s; }
.float-anim { animation: float 3s ease-in-out infinite; }
@keyframes float { 0% {transform:translateY(0);} 50% {transform:translateY(-10px);} 100% {transform:translateY(0);} }
@keyframes jump { 0% {transform: translateY(0);} 50% {transform: translateY(-10px);} 100% {transform: translateY(0);} }

/* ウィンドウ共通 */
.window {
    position: absolute; background: #fff;
    border: 3px solid #000; border-radius: 8px;
    box-shadow: 5px 5px 0 rgba(0, 255, 255, 0.8);
    color: #000; z-index: 100; overflow: hidden; cursor: default;
}
.window-header {
    background: #000; color: #fff; padding: 5px 10px; font-size: 1rem;
    display: flex; justify-content: space-between; align-items: center; cursor: move; user-select: none;
}
.window-icons span { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; margin-left: 4px; }
.window-close-btn { cursor: pointer; color: #ff5555; font-weight: bold; }

/* 各ウィンドウ */
#clock-window { top: 20px; right: 20px; width: 200px; }
.clock-content { padding: 15px; text-align: center; font-size: 2rem; background: #00ffff; color: #000; text-shadow: 2px 2px 0 #fff; }

#talk-window { top: 50%; left: 50px; width: 400px; display: none; }
.talk-content { padding: 20px; background: #000; color: #fff; min-height: 100px; position: relative; cursor: pointer; padding-bottom: 40px; }
#textDisplay { font-size: 1.2rem; line-height: 1.6; }
.next-cursor { position: absolute; bottom: 10px; right: 20px; color: #00ffff; animation: blink 1s infinite; display: none; }
.choices-overlay {
    position: relative; width: 100%; background: #000; padding: 10px;
    display: none; justify-content: center; gap: 10px; box-sizing: border-box; flex-wrap: wrap; 
}
.choice-btn { background: #fff; color: #000; border: 2px solid #00ffff; padding: 8px 20px; font-family: inherit; font-size: 1rem; cursor: pointer; transition: 0.2s; }
.choice-btn:hover { background: #00ffff; }
@keyframes blink { 0% {opacity: 1;} 50% {opacity: 0;} 100% {opacity: 1;} }

/* ブラウザ */
.browser-body { background: #fff; color: #000; height: 100%; display: flex; flex-direction: column; }
.browser-bar { background: #ccc; padding: 5px; border-bottom: 2px solid #888; display: flex; align-items: center; gap: 5px; font-size: 0.8rem; }
.browser-bar button { border: 1px outset #fff; background: #ddd; cursor: pointer; width: 30px; }
.browser-bar input { flex: 1; border: 1px solid #888; padding: 2px; font-family: inherit; }
.browser-content { padding: 20px; overflow-y: auto; flex: 1; font-family: "MS PGothic", "DotGothic16", sans-serif; }
.browser-link { color: blue; text-decoration: underline; cursor: pointer; }
.page-title { background: linear-gradient(to right, #0000ff, #fff); color: #fff; padding: 2px 5px; margin-bottom: 10px; }
.bbs-item { border: 1px dotted #888; padding: 5px; margin-bottom: 10px; background: #f9f9f9; }
#pass-input { border: 2px solid #000; font-family: inherit; font-size: 1rem; text-align: center; }

/* タスクバー */
#taskbar {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 40px;
    background: #c0c0c0; border-top: 2px solid #fff;
    display: flex; align-items: center; padding-left: 5px; gap: 5px;
    box-shadow: 0 -2px 0 #000; z-index: 900;
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(40px + env(safe-area-inset-bottom));
    align-items: start; padding-top: 4px; box-sizing: border-box;
}
.start-btn {
    background: #c0c0c0; color: #000; padding: 2px 10px; font-weight: bold; font-size: 1.1rem;
    border: 2px solid; border-color: #fff #000 #000 #fff;
    cursor: pointer; display: flex; align-items: center; gap: 5px;
}
.start-btn:active { border-color: #000 #fff #fff #000; }
.task-item {
    background: #c0c0c0; color: #000; width: 150px; padding: 3px 10px;
    border: 2px solid; border-color: #fff #000 #000 #fff;
    font-size: 0.9rem; cursor: pointer; white-space: nowrap; overflow: hidden;
}
.task-item.active { background: #e0e0e0; border-color: #000 #fff #fff #000; font-weight: bold; }


/* =========================================
   ★スマホ（横画面）Pro Max完全対応版 (1200px以下)
   ========================================= */
   @media (max-width: 1200px) {

    /* --- 1. 全体設定 --- */
    body {
        background-position: center bottom !important;
        height: 100dvh; width: 100vw;
        position: fixed; overflow: hidden;
    }
    #desktop { position: relative; width: 100%; height: 100%; overflow: hidden; }

    /* --- 2. タスクバー --- */
    #taskbar { 
        position: fixed; bottom: 0; left: 0; width: 100%;
        height: 35px !important; 
        padding-bottom: env(safe-area-inset-bottom);
        box-sizing: content-box; 
        z-index: 999; background: #c0c0c0;
        display: flex; align-items: flex-start;
        overflow: hidden; 
    }
    .task-item { 
        display: block !important; flex: 1; 
        font-size: 10px !important;
        padding: 4px 2px;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
        margin-top: 5px; height: 20px; line-height: 12px;
    }
    .start-btn { 
        width: 60px; flex: none; 
        font-size: 10px !important; height: 25px; margin-top: 5px; margin-right: 2px;
    }

    /* --- 3. ねこちゃん（★センターに戻しました！） --- */
    #neko-container { 
        position: fixed !important;
        
        /* 左右中央揃え */
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
        
        /* タスクバーの上 */
        bottom: calc(35px + env(safe-area-inset-bottom)) !important;
        top: auto !important;
        
        /* サイズ調整 */
        height: 45vh !important; 
        width: auto !important;
        padding: 0 !important; /* 余白削除 */
        
        z-index: 50; pointer-events: auto;
    }
    .neko-img { height: 100%; width: auto; }

/* --- 4. 会話ウィンドウ（修正：強制表示を削除！） --- */
#talk-window { 
    position: fixed !important; 
    
    top: 5px !important; 
    left: 5px !important; 
    
    width: 55vw !important; 
    max-width: 350px !important;
    max-height: 75vh !important;
    height: auto !important;
    
    /* ★重要：ここは display: none; だけにしておきます！ */
    display: none; 
    
    border-width: 2px;
    z-index: 9999;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    
    /* フレックス設定はJSで行うので、ここでは指定しません（重要） */
    flex-direction: column;
}
/* ★ヘッダーの設定（ボタンの基準点にする） */
.window-header { 
    position: relative !important; /* ここを基準にする */
    flex-shrink: 0;
    height: 35px !important; /* 少し高くする */
    font-size: 14px !important; 
    padding: 0 10px !important; 
    line-height: 35px !important; 
    display: flex; align-items: center; justify-content: space-between;
}

/* ★閉じるボタン（右上に強制配置＆巨大化！） */
.window-close-btn {
    position: absolute !important; /* 強制配置 */
    top: 0 !important;
    right: 0 !important;
    
    width: 50px !important;  /* ★幅を50pxに巨大化！（見た目はそのままで判定だけ広げる） */
    height: 100% !important; /* ヘッダーの高さ一杯に */
    
    font-size: 24px !important; /* ×印も見やすく */
    text-align: center; 
    line-height: 35px !important; /* 垂直中央 */
    
    background: transparent; /* 背景は透明 */
    color: #ff5555;
    cursor: pointer;
    z-index: 10000 !important; /* 最前面に持ってくる */
}

/* 中身のスクロール対応 */
.talk-content { 
    padding: 10px; 
    overflow-y: auto !important; 
    flex-grow: 1; min-height: 0;
}

#textDisplay, .choice-btn { 
    font-size: 11px !important; 
    line-height: 1.4 !important; 
}

.choices-overlay { 
    padding: 5px; flex-direction: column !important; 
    align-items: stretch !important; gap: 5px; margin-top: 10px;
}
.choice-btn { 
    padding: 5px; margin: 0; border-width: 1px; width: 100%; 
    background: #fff; color: #000; min-height: 25px; 
    white-space: normal;
}

    /* --- 5. インターネット画面 --- */
    #internet-window, #mysongs-window {
        position: fixed !important;
        top: 50% !important; left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 85% !important; height: 75% !important;
        z-index: 200;
        bottom: auto !important; right: auto !important; margin: 0 !important;
    }
    /* パスワード画面（小さく） */
    #password-window {
        position: fixed !important;
        top: 50% !important; left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 300px !important; height: auto !important;
        z-index: 200;
        bottom: auto !important; right: auto !important; margin: 0 !important;
    }
    .browser-content { font-size: 11px !important; padding: 10px !important; }

    /* --- 6. アイコン・時計（★時計サイズアップ！） --- */
    .desktop-icons { 
        top: 10px; left: 10px; 
        transform: scale(0.6); /* アイコンも少し大きく */
        transform-origin: top left; 
        gap: 10px; 
        left: max(10px, env(safe-area-inset-left)); 
        z-index: 10; 
    }
    
    #clock-window { 
        position: absolute; 
        top: 10px; right: 10px; 
        width: 120px !important; /* ★幅を拡大 (80px -> 120px) */
        transform: scale(0.8); /* 縮小率を緩める */
        transform-origin: top right;
        right: max(10px, env(safe-area-inset-right)); 
        z-index: 20;
    }
    /* 時計の文字サイズアップ */
    .clock-content { 
        font-size: 1.8rem !important; /* ★文字を大きく！ */
        padding: 5px; 
    }
}

/* =========================================
   START MENU: スタートメニュー
   ========================================= */
   #start-menu {
    display: none; /* 最初は隠す */
    position: fixed;
    bottom: 45px; /* タスクバー(40px)のすぐ上 */
    left: 5px;
    width: 200px;
    background: #c0c0c0;
    border: 2px solid;
    border-color: #fff #000 #000 #fff; /* 浮き出し効果 */
    z-index: 10000; /* 最前面 */
    display: flex; /* 横並びレイアウト用（隠す時はJSでnoneにする） */
}

/* 左側の青い帯 */
.start-header {
    background: #000080; /* 濃い青 */
    color: #fff;
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 5px 0;
    text-shadow: 1px 1px #00ffff;
}

/* メニュー部分 */
.start-body {
    flex: 1;
    padding: 5px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* 下に寄せる */
}

/* メニュー項目 */
.menu-item {
    padding: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #000;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ホバー時の青反転 */
.menu-item:hover {
    background: #000080;
    color: #fff;
}

/* スマホ調整 */
@media (max-width: 900px) {
    #start-menu {
        bottom: 45px; /* タスクバーの上 */
        left: 5px;
        width: 160px; /* 少し小さく */
    }
    .start-header { font-size: 1rem; width: 25px; }
    .menu-item { font-size: 0.8rem; padding: 8px; }
}

/* =========================================
   HORROR GLITCH: ホラー演出
   ========================================= */

/* 恐怖モード（bodyにこのクラスがつくと発動） */
body.horror-mode {
    animation: horror-shake 0.1s infinite; /* 激しく揺れる */
    filter: invert(1) hue-rotate(180deg) contrast(1.5); /* 色反転＆高コントラスト */
}

/* その間、猫ちゃんだけは影になる */
body.horror-mode #neko-container img {
    filter: brightness(0) drop-shadow(0 0 10px red); /* 真っ黒＋赤い影 */
    transform: scale(1.1); /* 少し巨大化 */
}

/* 画面揺れアニメーション */
@keyframes horror-shake {
    0% { transform: translate(5px, 5px) rotate(1deg); }
    20% { transform: translate(-5px, -5px) rotate(-1deg); }
    40% { transform: translate(-5px, 5px) rotate(1deg); }
    60% { transform: translate(5px, -5px) rotate(-1deg); }
    80% { transform: translate(-5px, -5px) rotate(1deg); }
    100% { transform: translate(0, 0) rotate(0); }
}

/* エラーウィンドウを赤く点滅させる */
.horror-blink {
    animation: blink-red 0.2s infinite alternate;
}
@keyframes blink-red {
    from { background: #000; color: red; }
    to { background: red; color: #000; }
}

/* =========================================
   HORROR ADD-ON: BBS & BSOD
   ========================================= */

/* --- 1. 偽ブルースクリーン --- */
#bsod-screen {
    display: none; /* 普段は消す */
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: #0000aa; /* あの青色 */
    color: #fff;
    font-family: 'Courier New', monospace; /* カクカクした文字 */
    padding: 50px; box-sizing: border-box;
    z-index: 999999; /* 最前面！ */
    flex-direction: column; justify-content: center;
    cursor: none; /* マウスも消す */
}
.bsod-content { 
    font-size: 1.2rem; line-height: 1.5; 
    max-width: 800px; margin: 0 auto;
}

/* --- 2. 呪いのBBS文字 --- */
.cursed-text {
    color: red !important;
    font-family: "MS Mincho", "Hiragino Mincho ProN", serif; /* 明朝体で怖く */
    font-weight: bold;
    text-shadow: 2px 0 0 #000;
    line-height: 1.8;
    word-break: break-all;
    font-size: 1.1rem;
    
    /* ガタガタ震えるアニメ */
    animation: tremble 0.1s infinite;
}

@keyframes tremble {
    0% { transform: translate(1px, 1px); }
    100% { transform: translate(-1px, -1px); }
}

/* スマホ調整 */
@media (max-width: 900px) {
    .bsod-content { font-size: 0.9rem; padding: 10px; }
}