/**
 * ============================================================================
 * style.css - Nevergrad 기본 스타일
 * ============================================================================
 * CSS Custom Properties로 테마 전환 (romance → thriller)
 */

/* ===== Theme Variables ===== */
:root {
    --color-primary: #FFB7C5;
    --color-secondary: #FFF0F5;
    --color-text: #4A3040;
    --color-dialogue-bg: rgba(255, 240, 245, 0.92);
    --color-accent: #FF69B4;

    --transition-theme: all 2s ease;
    --font-main: 'Noto Sans KR', sans-serif;
}

/* ===== Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background: #000;
    color: var(--color-text);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* ===== Screen System ===== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

.screen.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

.overlay {
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
}

/* ===== Title Screen ===== */
#title-screen {
    background: var(--color-secondary);
    transition: var(--transition-theme);
}

.title-bg {
    text-align: center;
    position: relative;
}

.title-text {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    transition: var(--transition-theme);
}

.title-subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    color: var(--color-accent);
    letter-spacing: 0.3em;
    transition: var(--transition-theme);
}

.title-menu {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.menu-btn {
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 0.8rem 3rem;
    font-size: 1rem;
    font-family: var(--font-main);
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.1em;
    white-space: nowrap;
    min-width: 200px;
}

.menu-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.4);
}

.menu-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== Name Input ===== */
.name-input-container {
    text-align: center;
    background: var(--color-secondary);
    padding: 3rem;
    border-radius: 1rem;
}

.name-prompt {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

#player-name-input {
    font-family: var(--font-main);
    font-size: 1.2rem;
    padding: 0.8rem 1.5rem;
    border: 2px solid var(--color-primary);
    border-radius: 0.5rem;
    outline: none;
    text-align: center;
    width: 200px;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: border-color 0.3s;
}

#player-name-input:focus {
    border-color: var(--color-accent);
}

/* ===== Game Screen ===== */
#game-screen {
    background: #000;
}

/* Background */
.bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 1;
    transition: background-image 0.5s ease;
}

.bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    transition: background 1s ease;
}

/* Time-of-day overlays */
.bg-overlay.morning {
    background: linear-gradient(180deg, rgba(255, 240, 200, 0.08) 0%, rgba(255, 220, 180, 0.12) 100%);
}

.bg-overlay.sunset {
    background: linear-gradient(180deg, rgba(255, 120, 50, 0.2) 0%, rgba(255, 60, 20, 0.35) 100%);
}

.bg-overlay.night {
    background: linear-gradient(180deg, rgba(10, 10, 40, 0.5) 0%, rgba(5, 5, 30, 0.65) 100%);
}

.bg-overlay.dawn {
    background: linear-gradient(180deg, rgba(80, 60, 120, 0.3) 0%, rgba(180, 100, 80, 0.2) 100%);
}

.bg-overlay.rain {
    background: linear-gradient(180deg, rgba(30, 30, 50, 0.5) 0%, rgba(20, 20, 40, 0.6) 100%);
}

.bg-overlay.dark {
    background: linear-gradient(180deg, rgba(5, 5, 15, 0.6) 0%, rgba(0, 5, 10, 0.75) 100%);
}

/* bg-layer CSS filters for time-of-day */
.bg-layer.time-morning {
    filter: brightness(1.05) saturate(1.05);
}

.bg-layer.time-sunset {
    filter: brightness(0.85) saturate(1.2) sepia(0.15) hue-rotate(-10deg);
}

.bg-layer.time-night {
    filter: brightness(0.35) saturate(0.5) hue-rotate(10deg);
}

.bg-layer.time-dawn {
    filter: brightness(0.55) saturate(0.7) hue-rotate(-5deg);
}

.bg-layer.time-dark {
    filter: brightness(0.2) saturate(0.3) hue-rotate(15deg);
}

.bg-layer.time-rain {
    filter: brightness(0.6) saturate(0.6) contrast(1.1);
}

/* Characters */
.char-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

.character-sprite {
    position: absolute;
    bottom: 0;
    height: 85%;
    object-fit: contain;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.character-sprite[src=""] {
    opacity: 0;
    pointer-events: none;
}

.pos-left { left: 5%; }
.pos-center { left: 50%; transform: translateX(-50%); }
.pos-right { right: 5%; }

.char-talking {
    animation: char-breathe 0.8s ease-in-out infinite;
}

@keyframes char-breathe {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* ===== Dialogue Box ===== */
.dialogue-box {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.2rem 1.5rem 1.5rem;
    background: var(--color-dialogue-bg);
    z-index: 10;
    min-height: 150px;
    cursor: pointer;
    transition: var(--transition-theme);
}

.speaker-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
    transition: var(--transition-theme);
}

.dialogue-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--color-text);
    min-height: 3em;
    transition: var(--transition-theme);
}

.click-indicator {
    position: absolute;
    bottom: 0.8rem;
    right: 1.2rem;
    font-size: 0.8rem;
    color: var(--color-accent);
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(4px); opacity: 0.5; }
}

/* Narration (asterisk-wrapped text) */
.narration {
    font-style: italic;
    color: var(--color-accent);
    text-align: center;
    letter-spacing: 0.02em;
    padding: 0.4rem 1.2rem;
}

.speaker-name.hidden {
    visibility: hidden;
}

/* ===== Choice Panel ===== */
.choice-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 1rem;
}

.choice-btn {
    background: var(--color-dialogue-bg);
    color: var(--color-text);
    border: 2px solid var(--color-primary);
    padding: 0.8rem 2rem;
    font-size: 0.95rem;
    font-family: var(--font-main);
    border-radius: 0.5rem;
    cursor: pointer;
    width: 80%;
    max-width: 500px;
    text-align: center;
    transition: all 0.3s ease;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.choice-btn:hover {
    background: var(--color-primary);
    color: #fff;
    transform: scale(1.02);
}

/* ===== HUD ===== */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0.8rem 1rem;
    z-index: 15;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.day-display {
    font-size: 0.85rem;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    letter-spacing: 0.1em;
    white-space: nowrap;
    overflow: visible;
    max-width: 60%;
    text-overflow: ellipsis;
}

.stat-display {
    font-size: 0.8rem;
    color: var(--color-primary);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

.ingame-menu-btn {
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    z-index: 15;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
    font-family: var(--font-main);
    border-radius: 0.3rem;
    cursor: pointer;
    white-space: nowrap;
}

/* ===== Pause Menu ===== */
.pause-container {
    background: var(--color-secondary);
    padding: 2rem;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-width: 250px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .title-text { font-size: 1.8rem; }
    .dialogue-box { padding: 1rem; min-height: 130px; }
    .dialogue-text { font-size: 0.9rem; }
    .choice-btn { font-size: 0.85rem; padding: 0.7rem 1.5rem; }
}

/* ===== Rotate Prompt (모바일/태블릿 세로모드 → 가로 회전 안내) ===== */
.rotate-prompt {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    gap: 1.5rem;
}

.rotate-prompt .rotate-icon {
    font-size: 4rem;
    animation: rotate-phone 2s ease-in-out infinite;
}

.rotate-prompt .rotate-text {
    font-size: 1.1rem;
    font-family: var(--font-main);
    letter-spacing: 0.05em;
    opacity: 0.85;
    line-height: 1.6;
}

@keyframes rotate-phone {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-30deg); }
    75% { transform: rotate(90deg); }
}

/* 터치 디바이스 + 세로모드일 때만 표시 */
@media (hover: none) and (pointer: coarse) and (orientation: portrait) {
    .rotate-prompt {
        display: flex !important;
    }
}

/* 태블릿 포함: 터치 + 세로 + 화면 너비 1024px 이하 */
@media (any-pointer: coarse) and (orientation: portrait) and (max-width: 1024px) {
    .rotate-prompt {
        display: flex !important;
    }
}
