/* =========================================
   Reset & Base Styles
========================================= */
@font-face {
    font-family: par;
    src: url(Parastoo.ttf);
}


* {
    font-family: par !important;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* حذف هایلایت آبی کلیک در موبایل */
}

:root {
    --bg-color: #030303;
    --text-primary: #e0e0e0;
    --text-muted: #888888;
    --blood-red: #9e0b0b;
    --blood-red-glow: rgba(158, 11, 11, 0.6);
    --system-green: #2a4b2a;
    --system-gray: #6b6b6b;
    
    --font-title: 'Lalezar', cursive;
    --font-ui: 'Vazirmatn', sans-serif;
    --font-sys: 'Fira Code', monospace;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-ui);
    height: 100dvh; /* استفاده از dvh برای حل مشکل نوار آدرس موبایل */
    width: 100vw;
    overflow: hidden;
    position: relative;
    user-select: none;
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--blood-red);
}

/* =========================================
   Global Atmospheric Effects
========================================= */
.vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 10%, rgba(0, 0, 0, 0.95) 100%);
    z-index: 10;
    pointer-events: none;
}

.scanlines {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.2) 51%);
    background-size: 100% 4px;
    z-index: 12;
    pointer-events: none;
    opacity: 0.7;
}


/* =========================================
   1. MAIN MENU STYLES
========================================= */
body:not(.game-body) {
    display: flex;
    justify-content: center;
    align-items: center;
}

.menu-container {
    position: relative;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(2rem, 5vw, 4rem);
    width: 90%;
    max-width: 600px;
}

.game-title {
    font-family: var(--font-title);
    font-size: clamp(3rem, 10vw, 5rem);
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.15);
    animation: titlePulse 4s infinite alternate;
    text-align: center;
    line-height: 1.1;
}

.game-subtitle {
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    color: var(--blood-red);
    letter-spacing: 2px;
    text-align: center;
    margin-top: 0.5rem;
}

.button-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 15px 20px;
    position: relative;
    width: 100%;
    max-width: 280px;
}

.menu-btn .btn-text {
    font-family: var(--font-ui);
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.menu-btn::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%; transform: translateX(-50%);
    width: 0; height: 1px; background-color: var(--blood-red);
    transition: width 0.4s ease;
    box-shadow: 0 0 10px var(--blood-red);
}

.menu-btn:hover .btn-text {
    color: #ffffff;
    text-shadow: 0 0 10px var(--blood-red-glow);
    transform: scale(1.05);
}

.menu-btn:hover::after { width: 80%; }
.start-btn .btn-text { color: var(--text-primary); font-weight: bold; }
.start-btn:hover .btn-text { color: var(--blood-red); }

.version-info {
    position: absolute;
    bottom: -60px;
    font-size: 0.8rem;
    color: #444;
}

@keyframes titlePulse {
    0% { text-shadow: 0 0 10px rgba(255, 255, 255, 0.1); }
    50% { text-shadow: 0 0 25px rgba(255, 255, 255, 0.3), 0 0 10px var(--blood-red-glow); }
    100% { text-shadow: 0 0 10px rgba(255, 255, 255, 0.1); }
}

/* =========================================
   2. GAME INTERFACE STYLES
========================================= */
.game-body {
    display: flex;
    justify-content: center;
    align-items: center; /* مرکزیت بهتر در موبایل */
}

.game-wrapper {
    position: relative;
    z-index: 20;
    width: 100%;
    max-width: 800px;
    height: 90dvh;
    display: flex;
    flex-direction: column;
    padding: 1rem clamp(1rem, 4vw, 2rem);
    animation: fadeInGame 2s ease-in-out;
}

@keyframes fadeInGame {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* System Status */
.system-status {
    font-family: var(--font-sys);
    font-size: clamp(0.7rem, 2.5vw, 0.85rem);
    color: var(--system-gray);
    text-align: left;
    margin-bottom: 1rem;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    direction: ltr;
    display: flex;
    align-items: center;
}

.system-status .cursor {
    display: inline-block;
    width: 8px;
    height: 12px;
    background-color: var(--system-gray);
    margin-left: 5px;
    animation: blink 1s step-end infinite;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Story Text */
.story-container {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.story-container::-webkit-scrollbar { width: 4px; }
.story-container::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.02); border-radius: 4px; }
.story-container::-webkit-scrollbar-thumb { background: var(--blood-red); border-radius: 4px; }

.story-text {
    font-size: clamp(1rem, 3.5vw, 1.25rem);
    line-height: 1.9;
    color: var(--text-primary);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.1);
    text-align: justify;
    font-weight: 300;
}

/* Choices */
.choices-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding-bottom: env(safe-area-inset-bottom, 1rem); /* رعایت فضای امن آیفون */
}

.choice-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 3px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    padding: 16px 15px; /* پدینگ بیشتر برای تاچ بهتر در موبایل */
    text-align: right;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    border-radius: 4px;
}

.choice-btn:hover, .choice-btn:active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-right: 3px solid var(--blood-red);
    padding-right: 25px;
    box-shadow: inset -25px 0 25px -25px var(--blood-red);
}

/* =========================================
   3. CREDITS MODAL STYLES
========================================= */
.credits-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 1000;
}

.credits-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.credits-box {
    position: relative;
    width: 90%;
    max-width: 400px;
    background: rgba(15,15,15,0.95);
    border: 1px solid rgba(255,255,255,0.08);
    border-top: 3px solid var(--blood-red);
    padding: 35px 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.9), 0 0 20px var(--blood-red-glow);
    border-radius: 8px;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.credits-modal.active .credits-box {
    transform: translateY(0) scale(1);
}

.credits-title {
    font-family: var(--font-title);
    font-size: clamp(1.8rem, 6vw, 2.2rem);
    color: #fff;
    margin-bottom: 10px;
    text-shadow: 0 0 15px var(--blood-red-glow);
}

.credits-text {
    color: var(--text-muted);
    font-size: clamp(0.85rem, 3vw, 0.95rem);
    line-height: 1.6;
    margin-bottom: 20px;
}

.credits-divider {
    height: 1px;
    width: 60%;
    margin: 20px auto;
    background: linear-gradient(to right, transparent, var(--blood-red), transparent);
}

.credits-item {
    font-size: clamp(0.9rem, 3.5vw, 1.05rem);
    margin: 15px 0;
    color: var(--text-muted);
}

.credits-item span {
    display: block;
    color: var(--text-primary);
    margin-top: 5px;
    font-weight: bold;
}

.credits-footer {
    margin-top: 30px;
    font-size: 0.8rem;
    color: #555;
}

.credits-close {
    position: absolute;
    top: 10px;
    left: 15px;
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    transition: 0.2s;
    padding: 5px;
}

.credits-close:hover {
    color: var(--blood-red);
    transform: scale(1.1);
}

/* =========================================
   4. TWEAKS FOR VERY SMALL DEVICES
========================================= */
@media (max-height: 600px) {
    .game-wrapper { height: 95dvh; }
    .game-title { font-size: 2.5rem; }
    .menu-container { gap: 1.5rem; }
}
