* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #000000;
    font-family: 'Courier Prime', 'Courier New', monospace;
    color: #ccc;
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
}

/* ノイズ背景 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><filter id="noise"><feTurbulence baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"/></filter></defs><rect width="100%" height="100%" filter="url(%23noise)"/></svg>');
    opacity: 0.3;
    pointer-events: none;
    z-index: -1;
}

.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-image: url('img/yurei.png');
    background-position: 20% 50%;
    background-repeat: no-repeat;
    background-size: 400px;
    background-attachment: fixed;
}

.main-container {
    max-width: 960px;
    width: 90%;
    padding: 20px;
    animation: subtleShake 0s infinite;
}

.header {
    text-align: center;
    margin-bottom: 15px;
    opacity: 0.7;
}

.header h1 {
    font-size: 1.8rem;
    color: #999;
    letter-spacing: 2px;
    margin-bottom: 10px;
    font-weight: normal;
    /* animation: horrorTitle 4s ease-in-out infinite; */
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    position: relative;
}

.header p {
    font-size: 1.08rem;
    color: #666;
}

.chat-output {
    height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 20px;
    border: 1px solid #333;
    background-color: rgba(0, 0, 0, 0.8);
    position: relative;
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.output-line {
    margin-bottom: 15px;
    opacity: 1;
    transition: all 0.5s ease;
}

.output-line.old {
    opacity: 0.6;
}

.user-message {
    color: #aaddff;
    text-align: right;
}

.ai-message {
    margin-right: 35%;
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: #ccc;
    animation: blink 1.5s infinite;
    margin-left: 2px;
}

.input-section {
    position: relative;
}

.input-group {
    background-color: rgba(0, 0, 0, 0.9);
    border: 1px solid #333;
    border-radius: 0;
}

.form-control {
    background-color: transparent;
    border: none;
    color: #cce;
    font-family: inherit;
    font-size: 1rem;
    padding: 15px;
}

.form-control:focus {
    background-color: rgba(0, 0, 0, 0.95);
    border: none;
    box-shadow: 0 0 15px rgba(100, 150, 255, 0.2);
    color: #cce;
}

.form-control::placeholder {
    color: #666;
}

.btn-send {
    background-color: #000;
    border: 1px solid #666;
    color: #ccc;
    padding: 15px 25px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.btn-send:hover {
    background-color: #1a0000;
    border-color: #800000;
    color: #ff6666;
    animation: redBlink 0.5s ease;
}


/* アニメーション */
@keyframes intenseShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-2px, -3px); }
    20% { transform: translate(3px, 2px); }
    30% { transform: translate(-4px, -2px); }
    40% { transform: translate(2px, 4px); }
    50% { transform: translate(-3px, 1px); }
    60% { transform: translate(4px, 2px); }
    70% { transform: translate(-1px, -3px); }
    80% { transform: translate(2px, -1px); }
    90% { transform: translate(-3px, 2px); }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes redBlink {
    0%, 100% { background-color: #1a0000; }
    50% { background-color: #330000; }
}

@keyframes flicker {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}

.flicker {
    animation: flicker 0.1s ease;
}

@keyframes userMessageFade {
    0% { opacity: 1; filter: blur(0); }
    50% { opacity: 0.8; }
    100% { opacity: 0; filter: blur(2px); transform: translateY(-5px); }
}

/* レスポンシブ */
@media (max-width: 768px) {
    .main-container {
        max-width: 95%;
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.2rem;
    }
    
    .chat-output {
        min-height: 250px;
        padding: 15px;
    }
}

/* 特殊効果用クラス */
.glitch-text {
    letter-spacing: 0.1em;
    font-stretch: condensed;
}

.distorted-text {
    letter-spacing: 0.3em;
    font-size: 0.9em;
}

.text-bleed {
    animation: text-bleed-anim 0.5s ease-out;
}

@keyframes text-bleed-anim {
    0% { text-shadow: 0 0 0 rgba(255,0,0,0); }
    50% { text-shadow: 0 0 10px rgba(255,0,0,0.8), 0 0 2px rgba(255,0,0,1); }
    100% { text-shadow: 0 0 0 rgba(255,0,0,0); }
}

.blood-drip-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
    overflow: hidden;
}

.blood-drip {
    position: absolute;
    top: -200px; /* 初期位置を画面外に */
    width: 3px;
    height: 200px;
    background: linear-gradient(to bottom, rgba(150,0,0,0.8), rgba(100,0,0,1));
    animation: drip 5s ease-in forwards;
}

@keyframes drip {
    0% { top: -200px; }
    100% { top: 100vh; }
}

/* フェードイン効果 */
.fade-in {
    animation: fadeIn 2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 20vw rgba(0,0,0,0.5);
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 5s ease-in-out;
}

.fake-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    display: none;
}

.fake-modal {
    background-color: #111;
    border: 1px solid #444;
    padding: 30px;
    width: 400px;
    text-align: center;
    box-shadow: 0 0 20px rgba(255,0,0,0.3);
}

.fake-modal p {
    margin-bottom: 20px;
    color: #ccc;
}

.fake-modal-buttons button {
    background-color: #333;
    border: 1px solid #666;
    color: #ccc;
    padding: 10px 20px;
    margin: 0 10px;
    cursor: pointer;
}

.blackout {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 10002;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
}

.red-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: red;
    z-index: 10003;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease-in-out;
}

/* ホラー風タイトルアニメーション */
@keyframes horrorTitle {
    0% {
        transform: translateX(0) scaleX(1) scaleY(1);
        filter: blur(0px) contrast(1);
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    }
    15% {
        transform: translateX(-1px) scaleX(0.98) scaleY(1.02);
        filter: blur(0.5px) contrast(1.1);
        text-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
    }
    25% {
        transform: translateX(2px) scaleX(1.02) scaleY(0.98);
        filter: blur(0px) contrast(0.9);
        text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
    }
    35% {
        transform: translateX(-1px) scaleX(0.99) scaleY(1.01);
        filter: blur(1px) contrast(1.2);
        text-shadow: 0 0 20px rgba(150, 0, 150, 0.4);
    }
    50% {
        transform: translateX(1px) scaleX(1.01) scaleY(0.99);
        filter: blur(0.3px) contrast(1);
        text-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
    }
    65% {
        transform: translateX(-2px) scaleX(0.97) scaleY(1.03);
        filter: blur(0.8px) contrast(1.15);
        text-shadow: 0 0 18px rgba(0, 255, 0, 0.2);
    }
    80% {
        transform: translateX(1px) scaleX(1.02) scaleY(0.98);
        filter: blur(0.2px) contrast(0.95);
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    }
    90% {
        transform: translateX(-1px) scaleX(0.99) scaleY(1.01);
        filter: blur(0.6px) contrast(1.05);
        text-shadow: 0 0 14px rgba(255, 100, 100, 0.3);
    }
    100% {
        transform: translateX(0) scaleX(1) scaleY(1);
        filter: blur(0px) contrast(1);
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    }
}

/* ランダムなグリッチ効果 */
.header h1::before {
    content: '幽霊チャット';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: rgba(255, 0, 0, 0.7);
    /* animation: glitchEffect 6s linear infinite; */
    z-index: -1;
}

.header h1::after {
    content: '幽霊チャット';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: rgba(0, 255, 255, 0.7);
    /* animation: glitchEffect2 8s linear infinite; */
    z-index: -1;
}

@keyframes glitchEffect {
    0%, 14%, 15%, 49%, 50%, 99%, 100% {
        transform: translate(0);
        opacity: 0;
    }
    15%, 49% {
        transform: translate(-2px, 1px);
        opacity: 0.8;
    }
    50%, 99% {
        transform: translate(1px, -1px);
        opacity: 0.6;
    }
}

@keyframes glitchEffect2 {
    0%, 19%, 20%, 39%, 40%, 79%, 80%, 100% {
        transform: translate(0);
        opacity: 0;
    }
    20%, 39% {
        transform: translate(1px, -1px);
        opacity: 0.7;
    }
    40%, 79% {
        transform: translate(-1px, 2px);
        opacity: 0.5;
    }
}

/* 確率ベースで適用されるホラー演出クラス */
.horror-active {
    animation: horrorTitle 4s ease-in-out !important;
}

.horror-active::before {
    animation: glitchEffect 6s linear !important;
}

.horror-active::after {
    animation: glitchEffect2 8s linear !important;
}