:root {
    --bg-color: #0d0d0c;
    --primary-red: #ff0000;
    --dim-green: #a8a87d;
    --text-main: #f0f0f0;
    --text-dim: #5c5c4d;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-mono);
    height: 100vh;
    height: 100dvh; /* 適配移動端動態高度 */
    overflow: hidden;
    touch-action: none;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    filter: sepia(0.4) contrast(1.1);
}

/* --- 字體加大與移動端適配 --- */
h1.story-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--primary-red);
    letter-spacing: 2px;
}

p.story-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--dim-green);
    max-width: 90%;
    margin: 0 auto 3rem;
}

.logo {
    font-size: 1.2rem;
    letter-spacing: 3px;
}

.prompt {
    font-size: 1rem;
    margin-bottom: 1rem;
}

input[type="text"] {
    font-size: 1.4rem;
    padding: 1rem;
}

/* --- 誘餌層優化 --- */
#bait-screen {
    position: absolute;
    inset: 0;
    background: var(--bg-color);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

#start-trigger-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#start-trigger {
    width: 60px; /* 加大按鈕方便點擊 */
    height: 60px;
    background: var(--primary-red);
    border-radius: 50%;
    box-shadow: 0 0 30px var(--primary-red);
    animation: blink 0.8s infinite alternate;
}

#start-trigger-container span {
    font-size: 0.9rem;
    color: var(--text-dim);
}

/* --- 驚嚇層 --- */
.scare-layer {
    position: fixed;
    inset: 0;
    background: black;
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
}

.scare-layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* 雙重濾鏡處理：消除 AI 的精細感，增強顆粒感 */
    filter: brightness(1.5) contrast(3) grayscale(1) blur(1px);
    animation: jitter 0.05s infinite;
}

@keyframes jitter {
    0% { transform: scale(1) translate(0,0); }
    50% { transform: scale(1.05) translate(5px, -5px); }
    100% { transform: scale(1) translate(-5px, 5px); }
}

/* --- 側邊日誌 (手機端位置調整) --- */
.side-log {
    position: absolute;
    right: 1.5rem;
    top: 15%;
    width: 250px;
    max-height: 40%;
    font-size: 0.8rem;
    pointer-events: none;
    mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}

/* --- CRT & Noise --- */
.crt-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 3px, 2px 100%;
    z-index: 1000;
    pointer-events: none;
}

.noise-overlay {
    position: fixed;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.08;
    z-index: 999;
    pointer-events: none;
}

/* --- 響應式微調 --- */
@media (max-width: 600px) {
    #app { padding: 1rem; }
    h1.story-title { font-size: 1.4rem; }
    p.story-text { font-size: 1rem; }
    .side-log { 
        width: 150px; 
        right: 1rem;
        top: 10%;
        font-size: 0.7rem;
    }
    .core-container { transform: scale(0.7); margin-bottom: 1rem; }
}

/* --- 動效 --- */
@keyframes blink {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0.4; transform: scale(0.9); }
}

.scare-active {
    animation: shake 0.05s infinite !important;
}

@keyframes shake {
    0% { transform: translate(5px, 5px); }
    50% { transform: translate(-5px, -5px); }
    100% { transform: translate(5px, -5px); }
}
