* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Crimson Text', serif;
    background-color: #0a0a0a;
    color: #e0e0e0;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease;
}

.hidden {
    display: none !important;
}

/* Экран ошибки 404 */
#error-screen {
    background-color: #000;
    z-index: 100;
}

.error-container {
    text-align: center;
    animation: fadeIn 2s ease;
}

.error-number {
    font-family: 'Cinzel Decorative', cursive;
    font-size: 12rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.7);
    margin-bottom: 1rem;
}

.error-number .blood {
    color: #8b0000;
    animation: pulse 1.5s infinite alternate;
}

.error-text {
    font-size: 2.5rem;
    color: #ccc;
    margin-bottom: 1rem;
    font-family: 'MedievalSharp', cursive;
}

.error-subtext {
    font-size: 1.2rem;
    color: #888;
    max-width: 600px;
    margin: 0 auto;
}

/* Экран потери соединения */
#connection-screen {
    background-color: #111;
    z-index: 90;
}

.connection-container {
    text-align: center;
    animation: fadeIn 1s ease;
}

.connection-icon {
    font-size: 5rem;
    color: #8b0000;
    margin-bottom: 2rem;
    animation: heartbeat 1.5s infinite;
}

.connection-text {
    font-size: 3rem;
    color: #b22222;
    margin-bottom: 1.5rem;
    font-family: 'Cinzel Decorative', cursive;
}

.connection-subtext {
    font-size: 1.5rem;
    color: #aaa;
    max-width: 700px;
    margin: 0 auto;
}

/* Экран ввода имени */
#name-screen {
    background-color: #0a0a0a;
    z-index: 80;
}

.blood-window {
    background-color: #1a0a0a;
    border: 3px solid #600;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(139, 0, 0, 0.7);
    animation: windowAppear 2s ease;
}

.blood-drips {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.drip {
    position: absolute;
    width: 4px;
    background-color: #8b0000;
    border-radius: 0 0 2px 2px;
    box-shadow: 0 0 10px #8b0000;
}

.drip-1 { top: 10%; left: 15%; height: 60px; animation: dripFall 4s infinite; }
.drip-2 { top: 5%; left: 40%; height: 80px; animation: dripFall 5s infinite 1s; }
.drip-3 { top: 15%; left: 70%; height: 50px; animation: dripFall 4.5s infinite 0.5s; }
.drip-4 { top: 8%; left: 85%; height: 70px; animation: dripFall 5.5s infinite 1.5s; }
.drip-5 { top: 20%; left: 30%; height: 65px; animation: dripFall 4.8s infinite 0.8s; }

.window-title {
    background: linear-gradient(to right, #400, #800);
    color: #fff;
    font-family: 'Cinzel Decorative', cursive;
    font-size: 1.8rem;
    padding: 1.2rem;
    text-align: center;
    border-bottom: 2px solid #600;
}

.window-content {
    padding: 2rem;
}

.window-content p {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.input-container {
    position: relative;
    margin: 2rem 0;
}

#username-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.4rem;
    background-color: #1a1a1a;
    border: none;
    color: #e0e0e0;
    font-family: 'Crimson Text', serif;
    text-align: center;
    letter-spacing: 1px;
}

#username-input:focus {
    outline: none;
}

.input-border {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, transparent, #8b0000, transparent);
    animation: borderPulse 2s infinite;
}

.warning {
    color: #ff6b6b;
    font-size: 1rem !important;
    font-style: italic;
    margin-top: 1.5rem;
}

.blood-button {
    display: block;
    width: 100%;
    padding: 1.2rem;
    background: linear-gradient(to bottom, #8b0000, #600);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.5rem;
    font-family: 'Cinzel Decorative', cursive;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 1.5rem;
    letter-spacing: 1px;
}

.blood-button:hover {
    background: linear-gradient(to bottom, #a00, #700);
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.8);
    transform: translateY(-2px);
}

.blood-button:active {
    transform: translateY(1px);
}

/* Экран истории */
#story-screen {
    background-color: #0a0a0a;
    z-index: 70;
    flex-direction: column;
    padding: 2rem;
}

.story-container {
    width: 100%;
    max-width: 1000px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.story-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #600;
}

.story-header h1 {
    font-family: 'Cinzel Decorative', cursive;
    font-size: 2.2rem;
    color: #c9a66b;
    margin-bottom: 0.5rem;
}

.user-info {
    font-size: 1.2rem;
    color: #aaa;
}

#user-display {
    color: #8b0000;
    font-weight: bold;
}

.story-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: rgba(26, 10, 10, 0.7);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: 1px solid #333;
}

.story-text {
    font-size: 1.4rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.story-text.active {
    opacity: 1;
    transform: translateY(0);
}

.story-text.fading {
    opacity: 0;
    transform: translateY(-20px);
}

.story-text h2 {
    color: #c9a66b;
    font-family: 'Cinzel Decorative', cursive;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.story-text p {
    margin-bottom: 1rem;
}

.story-footer {
    margin-top: auto;
}

.progress-bar {
    height: 8px;
    background-color: #333;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, #400, #800);
    width: 0%;
    transition: width 0.5s ease;
}

.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-button {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(to bottom, #333, #222);
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 5px;
    font-family: 'Crimson Text', serif;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-button:hover:not(:disabled) {
    background: linear-gradient(to bottom, #444, #333);
    border-color: #8b0000;
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-counter {
    font-size: 1.2rem;
    color: #aaa;
}

#current-page {
    color: #c9a66b;
    font-weight: bold;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0% { text-shadow: 0 0 20px rgba(255, 0, 0, 0.7); }
    100% { text-shadow: 0 0 30px rgba(255, 0, 0, 0.9), 0 0 40px rgba(255, 0, 0, 0.6); }
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes windowAppear {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes dripFall {
    0% { height: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { height: var(--drip-height); opacity: 0; }
}

@keyframes borderPulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Адаптивность */
@media (max-width: 768px) {
    .error-number { font-size: 8rem; }
    .error-text { font-size: 1.8rem; }
    .connection-text { font-size: 2rem; }
    .story-header h1 { font-size: 1.8rem; }
    .story-text { font-size: 1.2rem; }
    .nav-button { padding: 0.6rem 1rem; font-size: 1rem; }
}
