/* ============================================================
   CRIMSON PETALS (深紅の花弁) — Visual Novel Stylesheet
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --crimson: #c41e3a;
    --crimson-dark: #8a1528;
    --crimson-glow: rgba(196, 30, 58, 0.6);
    --deep-navy: #1a1a2e;
    --midnight: #16213e;
    --soft-pink: #e87ba8;
    --gold: #d4a843;
    --gold-dim: rgba(212, 168, 67, 0.4);
    --text-light: #e8e8e8;
    --text-dim: #8888aa;
    --text-warm: #d4c4a8;
    --glass-bg: rgba(20, 20, 40, 0.85);
    --glass-bg-heavy: rgba(10, 10, 25, 0.92);
    --glass-border: rgba(196, 30, 58, 0.3);
    --glass-border-light: rgba(196, 30, 58, 0.15);
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #e53935;
    --phone-bg: #0d1117;
    --phone-accent: #58a6ff;
    --stat-trust: #e87ba8;
    --stat-suspicion: #ff6b6b;
    --stat-relationship: #d4a843;
    --stat-work: #58a6ff;
    --stat-stress: #ff9800;
    --stat-resolve: #9c7cff;
    --transition-speed: 0.35s;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--deep-navy);
    color: var(--text-light);
    font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    cursor: default;
    user-select: none;
}

/* --- Utility Classes --- */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.5s ease forwards; }
.fade-out { animation: fadeOut 0.5s ease forwards; }
.no-pointer { pointer-events: none; }

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* --- Screen Shake --- */
.screen-shake {
    animation: shake 0.4s ease-in-out;
}
@keyframes shake {
    0%, 100% { transform: translate(0); }
    10%  { transform: translate(-6px, 3px); }
    20%  { transform: translate(5px, -4px); }
    30%  { transform: translate(-4px, 2px); }
    40%  { transform: translate(3px, -2px); }
    50%  { transform: translate(-2px, 4px); }
    60%  { transform: translate(4px, -1px); }
    70%  { transform: translate(-3px, 3px); }
    80%  { transform: translate(2px, -3px); }
    90%  { transform: translate(-1px, 1px); }
}

/* ============================================================
   GAME CONTAINER
   ============================================================ */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--deep-navy);
}

/* ============================================================
   TITLE SCREEN
   ============================================================ */
#title-screen {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg,
        #0d0d1a 0%,
        #1a1a2e 30%,
        #1f1035 60%,
        #2a1a3a 100%
    );
    overflow: hidden;
}

/* Town silhouette */
#title-screen::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35%;
    background:
        /* lighthouse */
        linear-gradient(to right, transparent 72%, transparent 72.5%),
        /* buildings silhouette */
        polygon(
            0% 100%,
            0% 70%, 5% 68%, 5% 60%, 8% 60%, 8% 65%, 12% 63%, 12% 55%, 15% 55%, 15% 50%, 17% 50%, 17% 58%, 20% 56%, 20% 48%, 23% 48%, 23% 55%, 28% 52%, 28% 42%, 30% 42%, 30% 50%, 33% 48%, 35% 48%, 35% 40%, 37% 38%, 37% 45%, 40% 43%, 42% 43%, 42% 35%, 44% 33%, 44% 40%, 48% 38%, 48% 30%, 50% 28%, 50% 35%, 54% 33%, 54% 25%, 56% 23%, 56% 18%, 57% 15%, 58% 18%, 58% 30%, 60% 28%, 62% 28%, 62% 38%, 66% 36%, 66% 42%, 70% 40%, 70% 45%, 74% 43%, 74% 50%, 78% 48%, 78% 55%, 82% 53%, 82% 58%, 86% 56%, 86% 62%, 90% 60%, 90% 65%, 95% 63%, 95% 68%, 100% 66%, 100% 100%
        );
    background: transparent;
    z-index: 1;
}

.title-silhouette {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30vh;
    z-index: 1;
    overflow: hidden;
}

.title-silhouette svg {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* Ocean glow */
.title-ocean {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 12vh;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(30, 40, 80, 0.4) 40%,
        rgba(20, 30, 70, 0.6) 100%
    );
    z-index: 2;
}

.title-ocean::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent,
        rgba(196, 30, 58, 0.3),
        rgba(212, 168, 67, 0.2),
        rgba(196, 30, 58, 0.3),
        transparent
    );
    animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Title text */
.title-content {
    position: relative;
    z-index: 10;
    text-align: center;
    margin-bottom: 3vh;
}

.title-japanese {
    font-family: "Yu Mincho", "Hiragino Mincho ProN", "MS Mincho", serif;
    font-size: clamp(1rem, 2vw, 1.6rem);
    color: var(--text-dim);
    letter-spacing: 0.8em;
    margin-bottom: 1vh;
    opacity: 0.7;
}

.title-main {
    font-family: "Georgia", "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: clamp(3rem, 6vw, 5.5rem);
    font-weight: 700;
    color: var(--text-light);
    text-shadow:
        0 0 40px var(--crimson-glow),
        0 0 80px rgba(196, 30, 58, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.08em;
    line-height: 1.1;
    background: linear-gradient(180deg, #fff 0%, #e8d0d6 50%, var(--soft-pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px var(--crimson-glow));
}

.title-tagline {
    font-family: "Georgia", "Yu Mincho", serif;
    font-size: clamp(0.75rem, 1.2vw, 1rem);
    color: var(--text-dim);
    letter-spacing: 0.3em;
    margin-top: 1.5vh;
    font-style: italic;
    opacity: 0.6;
}

/* Title menu */
.title-menu {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2vh;
    margin-top: 4vh;
}

.title-btn {
    position: relative;
    width: 260px;
    padding: 12px 40px;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-light);
    font-family: "Georgia", "Yu Mincho", serif;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    overflow: hidden;
}

.title-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent,
        rgba(196, 30, 58, 0.15),
        transparent
    );
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.title-btn:hover {
    border-color: var(--crimson);
    color: #fff;
    text-shadow: 0 0 20px var(--crimson-glow);
    box-shadow: 0 0 20px rgba(196, 30, 58, 0.2), inset 0 0 20px rgba(196, 30, 58, 0.1);
}

.title-btn:hover::before {
    transform: translateX(100%);
}

.title-btn:active {
    transform: scale(0.97);
}

.title-btn.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* --- Falling Petals --- */
.petals-container {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

.petal {
    position: absolute;
    top: -40px;
    width: 14px;
    height: 18px;
    background: radial-gradient(ellipse at 30% 30%, #e84060, var(--crimson), var(--crimson-dark));
    border-radius: 50% 0 50% 50%;
    opacity: 0;
    animation: petalFall linear infinite;
    filter: blur(0.5px);
    box-shadow: 0 0 6px rgba(196, 30, 58, 0.3);
}

.petal:nth-child(1)  { left: 5%;  animation-duration: 8s;  animation-delay: 0s;    width: 12px; height: 15px; }
.petal:nth-child(2)  { left: 12%; animation-duration: 10s; animation-delay: 1.5s;  width: 16px; height: 20px; }
.petal:nth-child(3)  { left: 20%; animation-duration: 7s;  animation-delay: 3s;    width: 10px; height: 13px; }
.petal:nth-child(4)  { left: 30%; animation-duration: 9s;  animation-delay: 0.8s;  width: 14px; height: 18px; }
.petal:nth-child(5)  { left: 38%; animation-duration: 11s; animation-delay: 2.2s;  width: 12px; height: 16px; }
.petal:nth-child(6)  { left: 48%; animation-duration: 8.5s;animation-delay: 4s;    width: 15px; height: 19px; }
.petal:nth-child(7)  { left: 55%; animation-duration: 9.5s;animation-delay: 1s;    width: 11px; height: 14px; }
.petal:nth-child(8)  { left: 64%; animation-duration: 7.5s;animation-delay: 3.5s;  width: 13px; height: 17px; }
.petal:nth-child(9)  { left: 73%; animation-duration: 10s; animation-delay: 0.5s;  width: 16px; height: 20px; }
.petal:nth-child(10) { left: 82%; animation-duration: 8s;  animation-delay: 2.8s;  width: 10px; height: 13px; }
.petal:nth-child(11) { left: 90%; animation-duration: 9s;  animation-delay: 4.5s;  width: 14px; height: 18px; }
.petal:nth-child(12) { left: 95%; animation-duration: 7s;  animation-delay: 1.8s;  width: 12px; height: 15px; }
.petal:nth-child(13) { left: 25%; animation-duration: 11s; animation-delay: 5s;    width: 9px;  height: 12px; }
.petal:nth-child(14) { left: 42%; animation-duration: 8.5s;animation-delay: 6s;    width: 15px; height: 19px; }
.petal:nth-child(15) { left: 68%; animation-duration: 10s; animation-delay: 3.2s;  width: 11px; height: 14px; }

@keyframes petalFall {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg) scale(1);
        opacity: 0;
    }
    5% {
        opacity: 0.8;
    }
    25% {
        transform: translateY(25vh) translateX(30px) rotate(90deg) scale(0.95);
    }
    50% {
        transform: translateY(50vh) translateX(-20px) rotate(200deg) scale(0.9);
        opacity: 0.6;
    }
    75% {
        transform: translateY(75vh) translateX(40px) rotate(310deg) scale(0.85);
        opacity: 0.4;
    }
    100% {
        transform: translateY(105vh) translateX(-10px) rotate(420deg) scale(0.8);
        opacity: 0;
    }
}

/* ============================================================
   MAIN GAME SCENE
   ============================================================ */
#game-scene {
    position: absolute;
    inset: 0;
    z-index: 10;
}

/* Background */
#scene-background {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.6s ease, opacity 0.6s ease;
    z-index: 1;
}

#scene-background::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        transparent 50%,
        rgba(10, 10, 25, 0.4) 85%,
        rgba(10, 10, 25, 0.7) 100%
    );
    z-index: 2;
}

/* Background transition overlay */
#bg-transition-overlay {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.6s ease;
    z-index: 2;
    pointer-events: none;
}

/* --- Character Sprites --- */
#character-layer {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
}

.character-sprite {
    position: absolute;
    bottom: 18%;
    height: 72%;
    max-height: 72vh;
    object-fit: contain;
    transition: all 0.4s ease;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.5));
}

.character-sprite.pos-left {
    left: 5%;
    transform: translateX(0);
}

.character-sprite.pos-center {
    left: 50%;
    transform: translateX(-50%);
}

.character-sprite.pos-right {
    right: 5%;
    transform: translateX(0);
}

/* Character entrance animations */
.character-sprite.enter-left {
    animation: spriteEnterLeft 0.5s ease forwards;
}

.character-sprite.enter-right {
    animation: spriteEnterRight 0.5s ease forwards;
}

.character-sprite.enter-fade {
    animation: spriteEnterFade 0.5s ease forwards;
}

.character-sprite.exit-left {
    animation: spriteExitLeft 0.4s ease forwards;
}

.character-sprite.exit-right {
    animation: spriteExitRight 0.4s ease forwards;
}

.character-sprite.dimmed {
    filter: brightness(0.5) drop-shadow(0 4px 20px rgba(0,0,0,0.5));
}

@keyframes spriteEnterLeft {
    from { transform: translateX(-80px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes spriteEnterRight {
    from { transform: translateX(80px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes spriteEnterFade {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes spriteExitLeft {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(-80px); opacity: 0; }
}

@keyframes spriteExitRight {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(80px); opacity: 0; }
}

/* ============================================================
   DIALOGUE BOX
   ============================================================ */
#dialogue-box {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    padding: 0 4vw 3vh;
    pointer-events: auto;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#dialogue-box.hidden-dialogue {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.dialogue-inner {
    position: relative;
    background: var(--glass-bg-heavy);
    border: 1px solid var(--glass-border);
    border-radius: 8px 8px 0 0;
    padding: 1.5vh 2.5vw 2vh;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow:
        0 -4px 30px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(196, 30, 58, 0.1);
    min-height: 160px;
    max-width: 1200px;
    margin: 0 auto;
}

.dialogue-inner::before {
    content: "";
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--crimson-glow), transparent);
}

/* Character name */
#char-name {
    font-family: "Georgia", "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: clamp(1rem, 1.4vw, 1.3rem);
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 12px var(--gold-dim);
    margin-bottom: 0.6vh;
    letter-spacing: 0.05em;
    min-height: 1.5em;
}

#char-name.narrator {
    color: var(--text-dim);
    font-style: italic;
    text-shadow: none;
}

/* Character-specific name colors */
#char-name.char-kenji    { color: #88bbee; }
#char-name.char-yui      { color: var(--soft-pink); }
#char-name.char-ryouichi { color: #d4a843; }
#char-name.char-mika     { color: #e8a060; }
#char-name.char-shinji   { color: #7ec87e; }
#char-name.char-haruka   { color: #b8b8d0; }
#char-name.char-iwasaki  { color: #a0a0c0; }

/* Dialogue text */
#dialogue-text {
    font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    color: var(--text-light);
    line-height: 1.8;
    min-height: 3.6em;
    text-shadow: 0 0 8px rgba(232, 232, 232, 0.1);
}

#dialogue-text.narrator-text {
    font-family: "Georgia", "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-style: italic;
    color: var(--text-warm);
}

/* Typewriter cursor */
#dialogue-text .typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: var(--text-light);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursorBlink 0.8s step-end infinite;
}

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

/* Click to advance indicator */
#advance-indicator {
    position: absolute;
    bottom: 12px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#advance-indicator.visible {
    opacity: 1;
    animation: advancePulse 1.5s ease-in-out infinite;
}

#advance-indicator .advance-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-dim);
    animation: advanceBounce 1.5s ease-in-out infinite;
}

@keyframes advancePulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 0.9; }
}

@keyframes advanceBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(4px); }
}

/* Dialogue back button - positioned outside and above dialogue box */
.dialogue-back-btn {
    position: fixed;
    top: 20px; /* Top of screen instead */
    left: 20px;
    background: rgba(102, 126, 234, 0.3);
    color: var(--text-light);
    border: 1px solid rgba(102, 126, 234, 0.5);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.8;
    z-index: 50; /* Above most UI elements */
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.dialogue-back-btn:hover {
    opacity: 1;
    background: rgba(102, 126, 234, 0.5);
    border-color: rgba(102, 126, 234, 0.8);
    transform: translateX(-3px);
}

.dialogue-back-btn:active {
    transform: scale(0.95) translateX(-3px);
}

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

.dialogue-back-btn:hover {
    opacity: 1;
    background: rgba(102, 126, 234, 0.4);
    border-color: rgba(102, 126, 234, 0.8);
    transform: translateX(-2px);
}

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

/* ============================================================
   CHOICE BUTTONS
   ============================================================ */
#choice-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 180px;
    z-index: 25;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5vh;
    padding: 2vw;
    background: rgba(10, 10, 25, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#choice-container.active {
    opacity: 1;
    pointer-events: auto;
}

.choice-btn {
    position: relative;
    width: min(600px, 80vw);
    padding: 14px 30px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-left: 3px solid var(--crimson);
    border-radius: 4px;
    color: var(--text-light);
    font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", sans-serif;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.choice-btn::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(90deg, rgba(196, 30, 58, 0.2), transparent);
    transition: width 0.4s ease;
}

.choice-btn:hover {
    border-color: var(--crimson);
    border-left-color: var(--crimson);
    transform: translateX(8px);
    box-shadow: 0 0 25px rgba(196, 30, 58, 0.25), 0 4px 15px rgba(0, 0, 0, 0.3);
    text-shadow: 0 0 10px rgba(232, 232, 232, 0.3);
}

.choice-btn:hover::before {
    width: 100%;
}

.choice-btn:active {
    transform: translateX(8px) scale(0.98);
}

/* Locked choices - visually indicate unavailable options */
.choice-btn.choice-locked {
    opacity: 0.5;
    cursor: not-allowed;
    border-left-color: #666;
    background: rgba(50, 50, 60, 0.6);
}

.choice-btn.choice-locked:hover {
    transform: none;
    border-color: #666;
    box-shadow: none;
}

.choice-btn.choice-locked::before {
    display: none;
}

.choice-btn .choice-lock-reason {
    color: var(--crimson);
    font-style: italic;
}

.choice-btn .choice-label {
    position: relative;
    z-index: 1;
}

.choice-btn .choice-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* ============================================================
   STATS PANEL
   ============================================================ */
#stats-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    z-index: 30;
    background: var(--glass-bg-heavy);
    border-right: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2vh 1.5vw;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
}

#stats-panel.open {
    transform: translateX(0);
}

#stats-panel::-webkit-scrollbar {
    width: 4px;
}
#stats-panel::-webkit-scrollbar-track {
    background: transparent;
}
#stats-panel::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 2px;
}

.stats-header {
    font-family: "Georgia", "Yu Mincho", serif;
    font-size: 1.1rem;
    color: var(--gold);
    text-align: center;
    padding-bottom: 1.5vh;
    border-bottom: 1px solid var(--glass-border-light);
    margin-bottom: 2vh;
    letter-spacing: 0.1em;
}

/* Day & Time */
.stats-time-block {
    text-align: center;
    margin-bottom: 2vh;
    padding-bottom: 1.5vh;
    border-bottom: 1px solid var(--glass-border-light);
}

#stats-day {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-light);
}

#stats-time-of-day {
    font-size: 0.85rem;
    color: var(--text-dim);
    letter-spacing: 0.1em;
    margin-top: 4px;
}

.time-morning    { color: #ffc107 !important; }
.time-afternoon  { color: #ff9800 !important; }
.time-evening    { color: #e87ba8 !important; }
.time-night      { color: #7c7cbb !important; }

/* Stat rows */
.stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5vh;
}

.stat-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.stat-bar-outer {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.stat-bar-inner {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.stat-bar-inner::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.2), transparent);
    border-radius: 4px 4px 0 0;
}

.stat-bar-inner.bar-trust       { background: linear-gradient(90deg, #c06080, var(--stat-trust)); }
.stat-bar-inner.bar-suspicion   { background: linear-gradient(90deg, #aa3030, var(--stat-suspicion)); }
.stat-bar-inner.bar-relationship{ background: linear-gradient(90deg, #a08030, var(--stat-relationship)); }
.stat-bar-inner.bar-work        { background: linear-gradient(90deg, #305080, var(--stat-work)); }
.stat-bar-inner.bar-stress      { background: linear-gradient(90deg, #b06000, var(--stat-stress)); }
.stat-bar-inner.bar-resolve     { background: linear-gradient(90deg, #5c4ca0, var(--stat-resolve)); }

.stat-value {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 2px;
    text-align: right;
}

/* Stats toggle button */
#stats-toggle {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 29;
    width: 36px;
    height: 80px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: var(--text-dim);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed) ease;
    backdrop-filter: blur(8px);
}

#stats-toggle:hover {
    color: var(--crimson);
    border-color: var(--crimson);
    background: var(--glass-bg-heavy);
}

#stats-toggle.panel-open {
    left: 300px;
}

/* ============================================================
   QUICK MENU
   ============================================================ */
#quick-menu {
    position: absolute;
    bottom: 8px;
    right: 12px;
    z-index: 22;
    display: flex;
    gap: 4px;
}

.qm-btn {
    padding: 6px 12px;
    background: rgba(20, 20, 40, 0.6);
    border: 1px solid rgba(196, 30, 58, 0.15);
    border-radius: 3px;
    color: var(--text-dim);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
    backdrop-filter: blur(4px);
}

.qm-btn:hover {
    color: var(--text-light);
    border-color: var(--crimson);
    background: rgba(196, 30, 58, 0.15);
}

/* ============================================================
   EVIDENCE JOURNAL
   ============================================================ */
#evidence-journal {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: rgba(10, 10, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#evidence-journal.active {
    opacity: 1;
    pointer-events: auto;
}

.journal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2vh 3vw;
    border-bottom: 1px solid var(--glass-border);
}

.journal-title {
    font-family: "Georgia", "Yu Mincho", serif;
    font-size: 1.6rem;
    color: var(--gold);
    letter-spacing: 0.1em;
}

.journal-close-btn {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.journal-close-btn:hover {
    border-color: var(--crimson);
    color: var(--text-light);
}

.journal-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5vw;
    padding: 3vh 3vw;
    overflow-y: auto;
}

.evidence-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-light);
    border-radius: 6px;
    padding: 1.2rem;
    transition: all 0.3s ease;
    cursor: default;
}

.evidence-card:hover {
    border-color: var(--crimson);
    box-shadow: 0 0 20px rgba(196, 30, 58, 0.15);
    transform: translateY(-2px);
}

.evidence-card.locked {
    opacity: 0.3;
    filter: grayscale(1);
    pointer-events: none;
}

.evidence-card .evidence-chapter {
    font-size: 0.7rem;
    color: var(--crimson);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 6px;
}

.evidence-card .evidence-name {
    font-family: "Georgia", "Yu Mincho", serif;
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.evidence-card .evidence-desc {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.5;
}

/* ============================================================
   PHONE INVESTIGATION OVERLAY
   ============================================================ */
#phone-overlay {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#phone-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.phone-frame {
    position: relative;
    width: 340px;
    height: 680px;
    background: #1a1a1a;
    border-radius: 36px;
    border: 3px solid #333;
    box-shadow:
        0 0 0 2px #111,
        0 20px 60px rgba(0, 0, 0, 0.6),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Phone notch */
.phone-frame::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 24px;
    background: #111;
    border-radius: 0 0 14px 14px;
    z-index: 5;
}

/* Phone timer bar */
.phone-timer-bar {
    height: 4px;
    background: #222;
    position: relative;
    z-index: 6;
    margin-top: 36px;
}

.phone-timer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--success), var(--success));
    transition: width 0.1s linear;
    border-radius: 0 2px 2px 0;
}

.phone-timer-fill.warning {
    background: linear-gradient(90deg, var(--warning), #ffcc00);
}

.phone-timer-fill.danger {
    background: linear-gradient(90deg, var(--danger), #ff6666);
    animation: timerPulse 0.5s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.6; }
}

.phone-timer-text {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: var(--text-dim);
    z-index: 6;
    letter-spacing: 0.1em;
}

/* Phone tabs */
.phone-tabs {
    display: flex;
    background: #111;
    border-bottom: 1px solid #333;
    z-index: 4;
    margin-top: 20px;
}

.phone-tab {
    flex: 1;
    padding: 10px 0;
    text-align: center;
    font-size: 0.7rem;
    color: #666;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.25s ease;
    border-bottom: 2px solid transparent;
}

.phone-tab.active {
    color: var(--phone-accent);
    border-bottom-color: var(--phone-accent);
}

.phone-tab:hover {
    color: #aaa;
}

/* Phone content */
.phone-content {
    flex: 1;
    background: var(--phone-bg);
    overflow-y: auto;
    padding: 12px;
}

.phone-content::-webkit-scrollbar {
    width: 3px;
}
.phone-content::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

/* Phone content panels */
.phone-panel {
    display: none;
}

.phone-panel.active {
    display: block;
}

/* Message threads */
.message-thread {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 10px;
    border-bottom: 1px solid #1a2030;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.message-thread:hover {
    background: rgba(88, 166, 255, 0.05);
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2a2a3a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #888;
    flex-shrink: 0;
}

.message-preview {
    flex: 1;
    min-width: 0;
}

.message-sender {
    font-size: 0.8rem;
    color: #ccc;
    font-weight: 600;
    margin-bottom: 2px;
}

.message-snippet {
    font-size: 0.7rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-time {
    font-size: 0.6rem;
    color: #555;
    flex-shrink: 0;
}

.message-badge {
    width: 8px;
    height: 8px;
    background: var(--phone-accent);
    border-radius: 50%;
    flex-shrink: 0;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.2); }
}

/* Photo thumbnails */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.photo-thumb {
    aspect-ratio: 1;
    background: #1a1a2a;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 1.4rem;
    overflow: hidden;
}

.photo-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.2);
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Call log */
.call-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #1a2030;
}

.call-icon {
    font-size: 0.9rem;
}

.call-icon.incoming  { color: var(--success); }
.call-icon.outgoing  { color: var(--phone-accent); }
.call-icon.missed    { color: var(--danger); }

.call-info {
    flex: 1;
}

.call-name {
    font-size: 0.8rem;
    color: #ccc;
}

.call-detail {
    font-size: 0.65rem;
    color: #555;
}

/* Phone exit button */
.phone-exit-btn {
    padding: 10px;
    background: #1a1a1a;
    border-top: 1px solid #333;
    text-align: center;
    cursor: pointer;
    color: #888;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    transition: all 0.2s ease;
}

.phone-exit-btn:hover {
    color: var(--danger);
    background: rgba(229, 57, 53, 0.1);
}

/* ============================================================
   CONFRONTATION OVERLAY
   ============================================================ */
#confrontation-overlay {
    position: absolute;
    inset: 0;
    z-index: 55;
    display: flex;
    flex-direction: column;
    background: rgba(5, 5, 15, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#confrontation-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Split screen portraits */
.confrontation-portraits {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
    height: 50vh;
    position: relative;
}

.confrontation-char {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 2vh;
    position: relative;
    overflow: hidden;
}

.confrontation-char.left-char {
    background: linear-gradient(135deg, rgba(88, 130, 200, 0.1), transparent);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.confrontation-char.right-char {
    background: linear-gradient(225deg, rgba(196, 30, 58, 0.1), transparent);
}

.confrontation-char img {
    max-height: 80%;
    object-fit: contain;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.6));
}

.confrontation-name {
    font-family: "Georgia", "Yu Mincho", serif;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    margin-top: 1vh;
}

.confrontation-name.left-name  { color: #88bbee; }
.confrontation-name.right-name { color: var(--crimson); }

/* VS divider */
.confrontation-vs {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: "Georgia", serif;
    font-size: 2rem;
    color: var(--gold);
    text-shadow: 0 0 20px var(--gold-dim);
    z-index: 2;
}

/* Emotional state */
.emotional-state {
    position: absolute;
    bottom: 10px;
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.left-char .emotional-state  { left: 20px; }
.right-char .emotional-state { right: 20px; }

/* Tension meter */
.tension-bar-container {
    width: 100%;
    padding: 1vh 4vw;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(196, 30, 58, 0.2);
    border-bottom: 1px solid rgba(196, 30, 58, 0.2);
}

.tension-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-align: center;
    margin-bottom: 6px;
}

.tension-bar-outer {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.tension-bar-inner {
    height: 100%;
    width: 50%;
    background: linear-gradient(90deg, var(--gold), var(--crimson));
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Confrontation dialogue options */
.confrontation-options {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1vh;
    padding: 2vh 4vw;
}

.confrontation-timer {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gold);
    font-family: "Georgia", serif;
    margin-bottom: 1vh;
    text-shadow: 0 0 20px var(--gold-dim);
}

.confrontation-timer.urgent {
    color: var(--crimson);
    text-shadow: 0 0 20px var(--crimson-glow);
    animation: timerPulse 0.5s ease infinite;
}

.confrontation-btn {
    width: min(550px, 75vw);
    padding: 12px 24px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    color: var(--text-light);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
}

.confrontation-btn:hover {
    border-color: var(--crimson);
    box-shadow: 0 0 20px rgba(196, 30, 58, 0.2);
    transform: translateX(4px);
}

.confrontation-btn.evidence-btn {
    border-left: 3px solid var(--gold);
    margin-top: 1vh;
}

.confrontation-btn.evidence-btn:hover {
    border-color: var(--gold);
    box-shadow: 0 0 20px var(--gold-dim);
}

/* ============================================================
   GALLERY SCREEN
   ============================================================ */
#gallery-screen {
    position: absolute;
    inset: 0;
    z-index: 80;
    background: linear-gradient(180deg, #0d0d1a, var(--deep-navy));
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#gallery-screen.active {
    opacity: 1;
    pointer-events: auto;
}

.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2vh 3vw;
    border-bottom: 1px solid var(--glass-border);
}

.gallery-title {
    font-family: "Georgia", "Yu Mincho", serif;
    font-size: 1.6rem;
    color: var(--gold);
    letter-spacing: 0.1em;
}

.gallery-tabs {
    display: flex;
    gap: 1vw;
}

.gallery-tab {
    padding: 6px 18px;
    background: transparent;
    border: 1px solid var(--glass-border-light);
    border-radius: 3px;
    color: var(--text-dim);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.05em;
}

.gallery-tab.active {
    border-color: var(--crimson);
    color: var(--text-light);
    background: rgba(196, 30, 58, 0.1);
}

.gallery-tab:hover {
    border-color: var(--crimson);
    color: var(--text-light);
}

.gallery-close-btn {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.gallery-close-btn:hover {
    border-color: var(--crimson);
    color: var(--text-light);
}

/* CG Grid */
.gallery-content {
    flex: 1;
    overflow-y: auto;
    padding: 3vh 3vw;
}

.gallery-section {
    display: none;
}

.gallery-section.active {
    display: block;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.2vw;
}

.gallery-item {
    aspect-ratio: 16 / 9;
    background: #111122;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: 1px solid var(--glass-border-light);
    transition: all 0.3s ease;
}

.gallery-item:hover {
    border-color: var(--crimson);
    box-shadow: 0 0 20px rgba(196, 30, 58, 0.2);
    transform: scale(1.03);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item.locked {
    cursor: default;
}

.gallery-item.locked::after {
    content: "🔒";
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 25, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    filter: grayscale(1);
}

.gallery-item.locked img {
    filter: blur(20px) brightness(0.2);
}

/* Full-size viewer */
#gallery-viewer {
    position: absolute;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#gallery-viewer.active {
    opacity: 1;
    pointer-events: auto;
}

#gallery-viewer img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
}

/* Endings section */
.endings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2vw;
}

.ending-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-light);
    border-radius: 6px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.ending-card.unlocked {
    border-color: var(--gold-dim);
}

.ending-card.unlocked:hover {
    border-color: var(--gold);
    box-shadow: 0 0 20px var(--gold-dim);
}

.ending-card .ending-number {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.ending-card .ending-name {
    font-family: "Georgia", "Yu Mincho", serif;
    font-size: 1rem;
    color: var(--text-light);
    margin: 8px 0;
}

.ending-card.locked .ending-name {
    color: var(--text-dim);
}

/* Achievements */
.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.achievement-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-light);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.achievement-row.unlocked {
    border-color: var(--gold-dim);
}

.achievement-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(212, 168, 67, 0.1);
    border: 1px solid var(--gold-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.achievement-row.locked .achievement-icon {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
    filter: grayscale(1);
    opacity: 0.4;
}

.achievement-info .achievement-name {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
}

.achievement-row.locked .achievement-name {
    color: var(--text-dim);
}

.achievement-info .achievement-desc {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 2px;
}

/* ============================================================
   SETTINGS SCREEN
   ============================================================ */
#settings-screen {
    position: absolute;
    inset: 0;
    z-index: 70;
    background: rgba(10, 10, 20, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#settings-screen.active {
    opacity: 1;
    pointer-events: auto;
}

.settings-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2vh 3vw;
    border-bottom: 1px solid var(--glass-border);
}

.settings-title {
    font-family: "Georgia", "Yu Mincho", serif;
    font-size: 1.6rem;
    color: var(--gold);
    letter-spacing: 0.1em;
}

.settings-close-btn {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.settings-close-btn:hover {
    border-color: var(--crimson);
    color: var(--text-light);
}

.settings-body {
    width: min(600px, 90vw);
    padding: 4vh 2vw;
    display: flex;
    flex-direction: column;
    gap: 3vh;
    overflow-y: auto;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 1vh;
}

.setting-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.setting-row .setting-name {
    width: 140px;
    font-size: 0.95rem;
    color: var(--text-light);
    flex-shrink: 0;
}

.setting-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

.setting-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--crimson);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px var(--crimson-glow);
    transition: box-shadow 0.2s ease;
}

.setting-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 0 16px var(--crimson-glow);
}

.setting-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--crimson);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px var(--crimson-glow);
}

.setting-value {
    width: 40px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch.active {
    background: var(--crimson);
}

.toggle-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: var(--text-light);
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-switch.active::after {
    transform: translateX(24px);
}

/* ============================================================
   SAVE / LOAD / PAUSE MENU
   ============================================================ */
#pause-menu {
    position: absolute;
    inset: 0;
    z-index: 65;
    background: rgba(10, 10, 20, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#pause-menu.active {
    opacity: 1;
    pointer-events: auto;
}

.pause-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2vh 3vw;
    border-bottom: 1px solid var(--glass-border);
}

.pause-title {
    font-family: "Georgia", "Yu Mincho", serif;
    font-size: 1.6rem;
    color: var(--gold);
    letter-spacing: 0.1em;
}

.pause-close-btn {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.pause-close-btn:hover {
    border-color: var(--crimson);
    color: var(--text-light);
}

.pause-body {
    width: min(900px, 94vw);
    padding: 3vh 2vw;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Save/Load tabs */
.pause-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2vh;
}

.pause-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border-light);
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.05em;
}

.pause-tab:first-child { border-radius: 4px 0 0 4px; }
.pause-tab:last-child  { border-radius: 0 4px 4px 0; }

.pause-tab.active {
    color: var(--text-light);
    background: rgba(196, 30, 58, 0.15);
    border-color: var(--crimson);
}

/* Save slots */
.save-slots {
    display: flex;
    flex-direction: column;
    gap: 1.2vh;
}

.save-slot {
    display: flex;
    align-items: center;
    gap: 1.5vw;
    padding: 1.2rem 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-light);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-slot:hover {
    border-color: var(--crimson);
    box-shadow: 0 0 15px rgba(196, 30, 58, 0.15);
}

.save-slot-thumb {
    width: 140px;
    height: 80px;
    background: #111122;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.save-slot-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.save-slot-info {
    flex: 1;
}

.save-slot-number {
    font-size: 0.7rem;
    color: var(--crimson);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.save-slot-chapter {
    font-family: "Georgia", "Yu Mincho", serif;
    font-size: 1.05rem;
    color: var(--text-light);
    margin: 4px 0;
}

.save-slot-date {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.save-slot.empty .save-slot-chapter {
    color: var(--text-dim);
    font-style: italic;
}

/* Pause menu buttons */
.pause-actions {
    display: flex;
    gap: 1vw;
    margin-top: 2vh;
    padding-top: 2vh;
    border-top: 1px solid var(--glass-border-light);
}

.pause-action-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    letter-spacing: 0.05em;
}

.pause-action-btn:hover {
    border-color: var(--crimson);
    color: var(--text-light);
    background: rgba(196, 30, 58, 0.1);
}

.pause-action-btn.danger:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(229, 57, 53, 0.1);
}

/* ============================================================
   NOTIFICATION TOASTS
   ============================================================ */
#notification-container {
    position: absolute;
    top: 1.5vh;
    right: 1.5vw;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 360px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--glass-bg-heavy);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: toastIn 0.4s ease forwards;
    pointer-events: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.toast.dismissing {
    animation: toastOut 0.3s ease forwards;
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-body {
    flex: 1;
}

.toast-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.72rem;
    color: var(--text-dim);
    line-height: 1.4;
}

.toast.toast-evidence {
    border-left: 3px solid var(--gold);
}

.toast.toast-stat-up {
    border-left: 3px solid var(--success);
}

.toast.toast-stat-down {
    border-left: 3px solid var(--danger);
}

.toast.toast-warning {
    border-left: 3px solid var(--warning);
}

.toast.toast-info {
    border-left: 3px solid var(--phone-accent);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }
}

/* ============================================================
   CHAPTER TITLE CARD
   ============================================================ */
#chapter-title-card {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 15, 0.97);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

#chapter-title-card.active {
    opacity: 1;
    pointer-events: auto;
}

.chapter-number {
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: var(--crimson);
    text-transform: uppercase;
    letter-spacing: 0.4em;
    margin-bottom: 1.5vh;
}

.chapter-name {
    font-family: "Georgia", "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--text-light);
    text-shadow:
        0 0 40px rgba(196, 30, 58, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.08em;
    text-align: center;
    max-width: 80vw;
}

.chapter-subtitle {
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    color: var(--text-dim);
    margin-top: 1.5vh;
    font-style: italic;
    letter-spacing: 0.2em;
}

/* ============================================================
   FULLSCREEN OVERLAY / CG VIEW
   ============================================================ */
#cg-overlay {
    position: absolute;
    inset: 0;
    z-index: 35;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#cg-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#cg-overlay img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (max-width: 1280px) {
    .dialogue-inner {
        min-height: 140px;
        padding: 1.2vh 2vw 1.5vh;
    }

    #stats-panel {
        width: 260px;
    }

    #stats-toggle.panel-open {
        left: 260px;
    }

    .phone-frame {
        width: 300px;
        height: 600px;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 900px) {
    #dialogue-box {
        padding: 0 2vw 2vh;
    }

    .dialogue-inner {
        min-height: 120px;
    }

    .confrontation-portraits {
        height: 40vh;
    }

    .save-slot-thumb {
        width: 100px;
        height: 56px;
    }
}

/* Fullscreen styling */
:fullscreen #game-container,
:-webkit-full-screen #game-container,
:-moz-full-screen #game-container {
    width: 100vw;
    height: 100vh;
}

/* ============================================================
   SCROLLBAR GLOBAL
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(196, 30, 58, 0.3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(196, 30, 58, 0.5);
}

/* ============================================================
   PARALLAX SUPPORT
   ============================================================ */
#scene-background.parallax {
    transition: background-position 0.1s ease-out;
}

/* ============================================================
   LOADING / TRANSITION
   ============================================================ */
#loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 300;
    background: var(--deep-navy);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease;
}

#loading-overlay.done {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(196, 30, 58, 0.15);
    border-top-color: var(--crimson);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 1.5vh;
    font-size: 0.8rem;
    color: var(--text-dim);
    letter-spacing: 0.15em;
}

/* ============================================================
   GAME OVERLAY BASE (festival, evidence board)
   ============================================================ */
.game-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 15, 0.92);
    backdrop-filter: blur(6px);
}
.game-overlay.hidden { display: none !important; }

/* --- Festival Navigation --- */
.festival-container {
    width: 90vw; max-width: 1100px;
    max-height: 90vh; overflow-y: auto;
    background: var(--glass-bg-heavy);
    border: 1px solid var(--glass-border);
    border-radius: 16px; padding: 28px;
}
.festival-header { text-align: center; margin-bottom: 20px; }
.festival-header h2 { font-size: 1.6rem; color: var(--crimson); }
.festival-time { margin-top: 8px; font-size: 0.95rem; color: var(--text-dim); }
.festival-time-bar { height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; margin-top: 6px; }
.festival-time-fill { height: 100%; background: var(--gold); border-radius: 3px; transition: width 0.4s ease; }
.festival-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.festival-location {
    background: rgba(25,25,50,0.7); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px; padding: 16px; cursor: pointer; transition: all 0.25s;
}
.festival-location.enabled:hover { border-color: var(--crimson); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(196,30,58,0.15); }
.festival-location.visited { opacity: 0.5; cursor: default; border-color: rgba(76,175,80,0.3); }
.festival-location.unavailable { opacity: 0.35; cursor: not-allowed; }
.festival-location.expensive { opacity: 0.5; }
.festival-loc-icon { font-size: 2rem; margin-bottom: 6px; }
.festival-loc-name { font-weight: 700; color: var(--text-light); font-size: 1rem; }
.festival-loc-cost { font-size: 0.8rem; color: var(--gold); margin: 4px 0; }
.festival-loc-desc { font-size: 0.82rem; color: var(--text-dim); line-height: 1.4; }
.festival-loc-reveals { font-size: 0.78rem; color: var(--soft-pink); margin-top: 6px; font-style: italic; }
.festival-loc-locked { font-size: 0.75rem; color: var(--danger); margin-top: 4px; }
.festival-loc-required { font-size: 0.75rem; color: var(--gold); margin-top: 4px; font-weight: 700; }
.festival-visited { text-align: center; margin-top: 16px; color: var(--text-dim); font-size: 0.9rem; }
.festival-end-btn {
    display: block; margin: 20px auto 0; padding: 12px 36px;
    background: var(--crimson); color: #fff; border: none; border-radius: 8px;
    font-size: 1rem; cursor: pointer; transition: background 0.2s;
}
.festival-end-btn:hover { background: var(--crimson-dark); }
.festival-event { text-align: center; max-width: 700px; padding: 40px; }
.festival-event-icon { font-size: 3rem; margin-bottom: 12px; }
.festival-event h3 { font-size: 1.4rem; color: var(--gold); margin-bottom: 16px; }
.festival-event-text { font-size: 0.95rem; color: var(--text-light); line-height: 1.7; text-align: left; }
.festival-continue-btn {
    margin-top: 24px; padding: 10px 30px;
    background: transparent; border: 1px solid var(--gold); color: var(--gold);
    border-radius: 8px; font-size: 0.95rem; cursor: pointer;
}
.festival-continue-btn:hover { background: rgba(212,168,67,0.1); }

/* --- Evidence Board --- */
.evidence-board-container {
    width: 95vw; max-width: 1200px;
    max-height: 92vh; overflow-y: auto;
    background: var(--glass-bg-heavy);
    border: 1px solid var(--glass-border);
    border-radius: 16px; padding: 24px;
}
.evidence-board-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.evidence-board-header h2 { font-size: 1.4rem; color: var(--gold); }
.evidence-board-header span { color: var(--text-dim); font-size: 0.85rem; }
.evidence-board-close {
    background: transparent; border: 1px solid var(--text-dim); color: var(--text-dim);
    padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 0.85rem;
}
.evidence-board-close:hover { border-color: var(--crimson); color: var(--crimson); }
.evidence-board-main { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.evidence-board-cork {
    position: relative; min-height: 400px;
    background: #3d2b1f; border-radius: 10px;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.03) 10px, rgba(0,0,0,0.03) 20px);
    padding: 10px; overflow: auto;
}
.evidence-card {
    position: absolute; width: 120px;
    background: #f5f0e0; color: #333; border-radius: 4px;
    padding: 10px 8px; text-align: center; cursor: pointer;
    box-shadow: 2px 3px 8px rgba(0,0,0,0.3);
    transition: transform 0.15s, box-shadow 0.15s;
    border-top: 3px solid var(--crimson);
}
.evidence-card:hover { transform: scale(1.05); box-shadow: 3px 5px 14px rgba(0,0,0,0.4); }
.evidence-card-icon { font-size: 1.6rem; }
.evidence-card-title { font-size: 0.7rem; font-weight: 700; margin-top: 4px; line-height: 1.2; }
.evidence-card-chapter { font-size: 0.65rem; color: #888; margin-top: 3px; }
.evidence-card-selected { position: absolute; inset: 0; background: rgba(196,30,58,0.25); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; color: var(--crimson); font-weight: 700; }
.evidence-board-chains { }
.evidence-board-chains h3 { color: var(--text-light); font-size: 1rem; margin-bottom: 10px; }
.evidence-chain { margin-bottom: 12px; background: rgba(255,255,255,0.03); border-radius: 8px; padding: 10px; }
.evidence-chain.completed { background: rgba(76,175,80,0.08); }
.evidence-chain-header { display: flex; justify-content: space-between; align-items: center; padding-left: 8px; font-size: 0.9rem; }
.evidence-chain-progress { color: var(--text-dim); font-size: 0.8rem; }
.evidence-chain-insight { font-size: 0.82rem; color: var(--text-warm); margin-top: 8px; line-height: 1.5; font-style: italic; }
.evidence-chain-needed { margin-top: 6px; display: flex; gap: 6px; }
.evidence-chain-needed .found { opacity: 1; }
.evidence-chain-needed .missing { opacity: 0.3; }
.evidence-board-summary { margin-top: 20px; border-top: 1px solid rgba(255,255,255,0.06); padding-top: 16px; }
.evidence-board-summary h3 { color: var(--gold); margin-bottom: 10px; }
.evidence-board-summary p { font-size: 0.88rem; color: var(--text-dim); line-height: 1.5; margin-bottom: 10px; }

/* --- Confrontation (dynamic) additional --- */
.confrontation-container { max-width: 800px; width: 90vw; text-align: center; }
.confrontation-tension-bar { margin-bottom: 16px; }
.tension-label { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 4px; }
.tension-bar-bg { height: 8px; background: rgba(255,255,255,0.08); border-radius: 4px; }
.tension-bar-fill { height: 100%; background: linear-gradient(90deg, var(--success), var(--warning), var(--danger)); border-radius: 4px; transition: width 0.4s ease; }
.confrontation-portraits { display: flex; align-items: center; justify-content: center; gap: 40px; margin-bottom: 20px; }
.confrontation-portrait { text-align: center; }
.confrontation-vs { font-size: 1.4rem; color: var(--crimson); font-weight: 700; }
.portrait-name { font-size: 1rem; color: var(--text-light); margin-top: 6px; }
.confrontation-dialogue { background: rgba(0,0,0,0.3); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.confrontation-speaker { font-size: 0.85rem; color: var(--gold); margin-bottom: 6px; }
.confrontation-text { font-size: 1rem; color: var(--text-light); line-height: 1.6; font-style: italic; }
.confrontation-timer { height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; margin-bottom: 12px; position: relative; }
.confrontation-timer-fill { height: 100%; background: var(--gold); border-radius: 2px; transition: width 1s linear; }
.confrontation-timer span { position: absolute; right: 0; top: -18px; font-size: 0.75rem; color: var(--text-dim); }
.confrontation-choices { display: flex; flex-direction: column; gap: 8px; }
.confrontation-choice-btn {
    background: rgba(25,25,50,0.7); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-light); padding: 12px 20px; border-radius: 8px;
    font-size: 0.92rem; cursor: pointer; text-align: left; transition: all 0.2s;
}
.confrontation-choice-btn:hover { border-color: var(--crimson); background: rgba(196,30,58,0.1); }
.confrontation-round { margin-top: 12px; font-size: 0.75rem; color: var(--text-dim); }
.confrontation-response { background: rgba(0,0,0,0.3); border-radius: 10px; padding: 20px; margin: 20px 0; }
.confrontation-continue-btn {
    padding: 10px 30px; background: transparent; border: 1px solid var(--gold);
    color: var(--gold); border-radius: 8px; cursor: pointer; font-size: 0.95rem;
}
.confrontation-continue-btn:hover { background: rgba(212,168,67,0.1); }
.confrontation-result { padding: 40px; text-align: center; }
.confrontation-result h2 { font-size: 1.8rem; margin-bottom: 12px; }
.confrontation-result.victory h2 { color: var(--gold); }
.confrontation-result.defeat h2 { color: var(--danger); }
.confrontation-result.draw h2 { color: var(--text-dim); }
.confrontation-result p { color: var(--text-dim); margin-bottom: 16px; line-height: 1.5; }
.confrontation-result button {
    padding: 10px 30px; background: var(--crimson); color: #fff; border: none;
    border-radius: 8px; cursor: pointer; font-size: 1rem;
}

/* --- Phone (dynamic) additional --- */
.phone-container { display: flex; gap: 20px; align-items: flex-start; }
.phone-frame {
    width: 360px; height: 640px;
    background: var(--phone-bg); border: 2px solid #333;
    border-radius: 24px; overflow: hidden; display: flex;
    flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.phone-timer-bar { height: 4px; background: #222; position: relative; }
.phone-timer-fill { height: 100%; background: var(--success); transition: width 1s linear; }
.phone-timer-fill.warning { background: var(--warning); }
.phone-timer-fill.danger { background: var(--danger); animation: pulse 0.5s ease infinite; }
.phone-timer-text { position: absolute; right: 8px; top: 6px; font-size: 0.75rem; color: var(--text-dim); }
.phone-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 14px; background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.phone-status-text { font-size: 0.85rem; color: var(--text-light); }
.phone-exit-btn {
    background: transparent; border: 1px solid var(--danger); color: var(--danger);
    padding: 4px 10px; border-radius: 4px; font-size: 0.75rem; cursor: pointer;
}
.phone-content { flex: 1; overflow-y: auto; padding: 8px; }
.phone-tab-bar { display: flex; border-top: 1px solid rgba(255,255,255,0.06); }
.phone-tab {
    flex: 1; padding: 10px; text-align: center; background: transparent;
    border: none; font-size: 1.2rem; cursor: pointer; transition: background 0.2s;
}
.phone-tab.active { background: rgba(88,166,255,0.1); }
.phone-tab:hover { background: rgba(255,255,255,0.05); }
.phone-thread-list { }
.phone-thread-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 8px; border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer; border-radius: 6px; transition: background 0.15s;
}
.phone-thread-item:hover { background: rgba(255,255,255,0.04); }
.phone-thread-item.evidence-found { border-left: 3px solid var(--success); }
.phone-thread-avatar { font-size: 1.5rem; }
.phone-thread-name { font-size: 0.9rem; color: var(--text-light); font-weight: 600; }
.phone-thread-preview { font-size: 0.78rem; color: var(--text-dim); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 200px; }
.phone-thread-header {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 8px;
}
.phone-back-btn {
    background: transparent; border: none; color: var(--phone-accent);
    cursor: pointer; font-size: 0.9rem;
}
.phone-messages-list { max-height: 380px; overflow-y: auto; padding: 4px; }
.phone-msg { margin-bottom: 8px; display: flex; flex-direction: column; }
.phone-msg.sent { align-items: flex-end; }
.phone-msg.received { align-items: flex-start; }
.phone-msg-bubble {
    max-width: 80%; padding: 8px 12px; border-radius: 12px;
    font-size: 0.85rem; line-height: 1.4;
}
.phone-msg.sent .phone-msg-bubble { background: #0a84ff; color: #fff; border-bottom-right-radius: 4px; }
.phone-msg.received .phone-msg-bubble { background: #333; color: var(--text-light); border-bottom-left-radius: 4px; }
.phone-msg-time { font-size: 0.65rem; color: var(--text-dim); margin-top: 2px; padding: 0 4px; }
.phone-evidence-btn {
    display: block; width: 100%; margin-top: 10px; padding: 10px;
    background: rgba(76,175,80,0.15); border: 1px solid var(--success);
    color: var(--success); border-radius: 8px; cursor: pointer; font-size: 0.9rem;
}
.phone-evidence-btn:hover { background: rgba(76,175,80,0.25); }
.phone-evidence-btn-small {
    background: transparent; border: 1px solid var(--success); color: var(--success);
    padding: 3px 8px; border-radius: 4px; cursor: pointer; font-size: 0.75rem;
}
.phone-evidence-found { text-align: center; color: var(--success); padding: 8px; font-size: 0.85rem; }
.phone-photos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.phone-photo-thumb {
    aspect-ratio: 1; background: #222; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; cursor: pointer; position: relative;
}
.phone-photo-thumb.deleted { border: 1px dashed var(--danger); }
.phone-photo-thumb.evidence-found { border-color: var(--success); }
.phone-photo-deleted-badge { position: absolute; top: 4px; right: 4px; font-size: 0.7rem; }
.phone-section-header { font-size: 0.8rem; color: var(--danger); margin: 12px 0 6px; padding-left: 4px; }
.phone-call-list { }
.phone-call-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.phone-call-item.suspicious { border-left: 3px solid var(--warning); }
.phone-call-item.evidence-found { border-left: 3px solid var(--success); }
.phone-call-name { font-size: 0.9rem; color: var(--text-light); }
.phone-call-detail { font-size: 0.75rem; color: var(--text-dim); }
.phone-app-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 10px; }
.phone-app-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 14px 8px; border-radius: 10px; cursor: pointer;
    background: rgba(255,255,255,0.03); transition: background 0.15s;
}
.phone-app-item:hover { background: rgba(255,255,255,0.06); }
.phone-app-item.secret-app { border: 1px dashed var(--danger); }
.phone-app-icon { font-size: 1.8rem; }
.phone-app-name { font-size: 0.75rem; color: var(--text-dim); }
.phone-app-badge { position: absolute; top: -2px; right: -2px; width: 14px; height: 14px; background: var(--danger); border-radius: 50%; font-size: 0.6rem; display: flex; align-items: center; justify-content: center; }
.phone-secret-app-warning { background: rgba(229,57,53,0.1); border: 1px solid rgba(229,57,53,0.3); border-radius: 6px; padding: 8px; font-size: 0.8rem; color: var(--danger); margin-bottom: 8px; }
.phone-empty { text-align: center; color: var(--text-dim); padding: 40px; font-size: 0.9rem; }
.phone-evidence-panel {
    background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px; padding: 14px; min-width: 180px;
}
.phone-evidence-panel h3 { font-size: 0.9rem; color: var(--gold); }
.phone-evidence-panel.flash { animation: flash 0.5s ease; }
.phone-caught {
    text-align: center; padding: 40px;
    background: rgba(229,57,53,0.1); border-radius: 16px;
}
.phone-caught h2 { font-size: 2rem; color: var(--danger); margin-bottom: 12px; }
.phone-caught p { color: var(--text-light); margin-bottom: 8px; line-height: 1.5; }
.phone-caught-penalty { color: var(--danger); font-size: 0.85rem; margin-top: 10px; }
.phone-caught button {
    margin-top: 16px; padding: 10px 30px; background: var(--crimson); color: #fff;
    border: none; border-radius: 8px; cursor: pointer;
}

@keyframes flash {
    0%, 100% { background: rgba(0,0,0,0.4); }
    50% { background: rgba(76,175,80,0.2); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
