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

body {
    font-family: 'MedievalSharp', cursive;
    background: #1a0f08;
    color: #f4e4c1;
    overflow: hidden;
    height: 100dvh;
    height: 100vh;
    width: 100vw;
}

.tavern-container {
    position: relative;
    width: 100vw;
    height: 100dvh;
    height: 100vh;
    background: 
        radial-gradient(ellipse at center top, rgba(255, 140, 0, 0.15), transparent 60%),
        linear-gradient(180deg, #2a1810 0%, #1a0f08 100%);
    display: flex;
    flex-direction: column;
    padding: clamp(15px, 3vh, 40px) clamp(15px, 3vw, 40px);
    background-image: 
        radial-gradient(ellipse at 50% 20%, rgba(255, 120, 0, 0.2), transparent 50%),
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect fill="%23000000" opacity="0.3" width="100" height="100"/></svg>');
    background-size: 100% 100%, 4px 4px;
}

.flickering-light {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: radial-gradient(ellipse at center top, rgba(255, 140, 0, 0.3), transparent 70%);
    pointer-events: none;
    animation: flicker 4s ease-in-out infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    25% { opacity: 0.85; }
    50% { opacity: 0.95; }
    75% { opacity: 0.9; }
}

.tavern-header {
    position: relative;
    text-align: center;
    margin-bottom: clamp(20px, 4vh, 40px);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.settings-button {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(50, 30, 15, 0.8);
    border: 2px solid #8b6914;
    border-radius: 50%;
    width: clamp(40px, 8vw, 50px);
    height: clamp(40px, 8vw, 50px);
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.settings-button:hover {
    background: rgba(70, 40, 20, 0.9);
    transform: rotate(90deg);
    box-shadow: 0 6px 15px rgba(255, 140, 0, 0.4);
}

.title {
    font-family: 'Uncial Antiqua', cursive;
    font-size: clamp(2rem, 6vw, 4rem);
    color: #ffcc66;
    text-shadow: 0 0 20px rgba(255, 140, 0, 0.6),
                 2px 2px 4px rgba(0, 0, 0, 0.9);
    margin-bottom: clamp(5px, 1vh, 10px);
}

.subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    color: #d4a574;
    font-style: italic;
}

.sloubi-counter {
    background: linear-gradient(135deg, rgba(50, 30, 15, 0.9), rgba(70, 40, 20, 0.9));
    border: 3px solid #8b6914;
    border-radius: 15px;
    padding: clamp(15px, 3vh, 25px);
    text-align: center;
    margin-bottom: clamp(20px, 3vh, 30px);
    box-shadow: 
        inset 0 2px 8px rgba(0, 0, 0, 0.6),
        0 4px 15px rgba(255, 140, 0, 0.3);
}

.counter-label {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: #d4a574;
    margin-bottom: clamp(8px, 1.5vh, 15px);
}

.counter-value {
    font-family: 'Uncial Antiqua', cursive;
    font-size: clamp(3rem, 10vw, 6rem);
    color: #ffcc66;
    text-shadow: 0 0 30px rgba(255, 140, 0, 0.8),
                 0 0 60px rgba(255, 100, 0, 0.4);
    font-weight: bold;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { 
        text-shadow: 0 0 30px rgba(255, 140, 0, 0.8),
                     0 0 60px rgba(255, 100, 0, 0.4);
    }
    50% { 
        text-shadow: 0 0 40px rgba(255, 140, 0, 1),
                     0 0 80px rgba(255, 100, 0, 0.6);
    }
}

.cheat-button {
    margin-bottom: clamp(10px, 1.5vh, 15px);
    text-align: center;
    animation: slideIn 0.3s ease-out;
}

.quick-sloubi-btn {
    background: linear-gradient(135deg, #ff8c00, #ff6600);
    border: 2px solid #ffcc66;
    border-radius: 8px;
    padding: clamp(10px, 1.5vh, 14px) clamp(20px, 4vw, 30px);
    color: #fff;
    font-family: 'MedievalSharp', cursive;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(255, 140, 0, 0.5);
    font-weight: bold;
}

.quick-sloubi-btn:hover {
    background: linear-gradient(135deg, #ff9d1a, #ff7700);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 140, 0, 0.7);
}

.quick-sloubi-btn:active {
    transform: translateY(0) scale(1);
}

.chat-area {
    flex: 1;
    background: rgba(20, 10, 5, 0.8);
    border: 2px solid #6b4423;
    border-radius: 10px;
    padding: clamp(15px, 2vh, 20px);
    overflow: hidden;
    margin-bottom: clamp(15px, 2vh, 20px);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
}

.chat-messages {
    height: 100%;
    overflow-y: auto;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.5vh, 15px);
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #8b6914;
    border-radius: 4px;
}

.message {
    background: rgba(70, 40, 20, 0.6);
    padding: clamp(10px, 1.5vh, 15px);
    border-radius: 8px;
    border-left: 3px solid #8b6914;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.system-message {
    background: rgba(139, 105, 20, 0.3);
    padding: clamp(10px, 1.5vh, 15px);
    border-radius: 8px;
    border: 1px dashed #8b6914;
    text-align: center;
    font-style: italic;
    color: #d4a574;
    font-size: clamp(0.85rem, 2.2vw, 1rem);
}

.sloubi-message {
    background: rgba(255, 140, 0, 0.2);
    border-left-color: #ff8c00;
    font-weight: bold;
    color: #ffcc66;
}

.chat-input-container {
    display: flex;
    gap: clamp(10px, 2vw, 15px);
}

.chat-input {
    flex: 1;
    background: rgba(30, 20, 10, 0.9);
    border: 2px solid #6b4423;
    border-radius: 8px;
    padding: clamp(12px, 2vh, 16px);
    color: #f4e4c1;
    font-family: 'MedievalSharp', cursive;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    outline: none;
    transition: all 0.3s ease;
}

.chat-input:focus {
    border-color: #8b6914;
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.3);
}

.chat-input::placeholder {
    color: #8b6914;
}

.send-button {
    background: linear-gradient(135deg, #8b6914, #6b4423);
    border: 2px solid #d4a574;
    border-radius: 8px;
    padding: clamp(12px, 2vh, 16px) clamp(20px, 4vw, 30px);
    color: #f4e4c1;
    font-family: 'MedievalSharp', cursive;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.send-button:hover {
    background: linear-gradient(135deg, #a67c1a, #7b5428);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 140, 0, 0.4);
}

.send-button:active {
    transform: translateY(0);
}

.ambient-elements {
    position: absolute;
    pointer-events: none;
}

.candle {
    position: absolute;
    width: clamp(8px, 1.5vw, 15px);
    height: clamp(25px, 4vh, 40px);
    background: linear-gradient(180deg, #ff8c00, #ff6600);
    border-radius: 50% 50% 0 0;
    box-shadow: 0 0 20px rgba(255, 140, 0, 0.6);
}

.candle::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(6px, 1vw, 10px);
    height: clamp(15px, 3vh, 25px);
    background: radial-gradient(ellipse, #fff, #ff8c00);
    border-radius: 50% 50% 0 0;
    animation: candleFlicker 2s ease-in-out infinite;
}

@keyframes candleFlicker {
    0%, 100% { 
        opacity: 1;
        transform: translateX(-50%) scaleY(1);
    }
    25% { 
        opacity: 0.8;
        transform: translateX(-50%) scaleY(0.95);
    }
    50% { 
        opacity: 0.9;
        transform: translateX(-50%) scaleY(1.05);
    }
    75% { 
        opacity: 0.85;
        transform: translateX(-50%) scaleY(0.98);
    }
}

.candle-1 {
    top: 15%;
    left: 10%;
    animation-delay: 0s;
}

.candle-2 {
    top: 15%;
    right: 10%;
    animation-delay: 0.7s;
}

.candle-3 {
    bottom: 20%;
    left: 5%;
    animation-delay: 1.4s;
}

@media (max-width: 768px) {
    .candle {
        display: none;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .tavern-header {
        margin-bottom: 15px;
    }
    
    .sloubi-counter {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .counter-value {
        font-size: clamp(2rem, 8vw, 4rem);
    }
}

.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.settings-modal.active {
    display: flex;
}

.settings-content {
    background: linear-gradient(135deg, #2a1810, #1a0f08);
    border: 3px solid #8b6914;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(15px, 3vh, 25px);
    border-bottom: 2px solid #6b4423;
}

.settings-header h2 {
    font-family: 'Uncial Antiqua', cursive;
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    color: #ffcc66;
    margin: 0;
}

.close-settings {
    background: rgba(139, 105, 20, 0.3);
    border: 2px solid #8b6914;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.3rem;
    color: #f4e4c1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-settings:hover {
    background: rgba(139, 105, 20, 0.6);
    transform: rotate(90deg);
}

.settings-body {
    padding: clamp(15px, 3vh, 25px);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(15px, 2vh, 20px);
    background: rgba(50, 30, 15, 0.5);
    border-radius: 10px;
    margin-bottom: 15px;
}

.setting-label {
    font-size: clamp(0.95rem, 2.8vw, 1.15rem);
    color: #d4a574;
}

.install-button {
    background: linear-gradient(135deg, #8b6914, #6b4423);
    border: 2px solid #d4a574;
    border-radius: 8px;
    padding: clamp(8px, 1.5vh, 12px) clamp(15px, 3vw, 20px);
    color: #f4e4c1;
    font-family: 'MedievalSharp', cursive;
    font-size: clamp(0.85rem, 2.3vw, 1rem);
    cursor: pointer;
    transition: all 0.3s ease;
}

.install-button:hover {
    background: linear-gradient(135deg, #a67c1a, #7b5428);
    transform: translateY(-2px);
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(50, 30, 15, 0.8);
    border: 2px solid #6b4423;
    transition: 0.4s;
    border-radius: 30px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #8b6914;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #8b6914;
    border-color: #ffcc66;
}

input:checked + .toggle-slider:before {
    transform: translateX(30px);
    background-color: #ffcc66;
}

.nickname-input {
    background: rgba(30, 20, 10, 0.9);
    border: 2px solid #6b4423;
    border-radius: 6px;
    padding: clamp(8px, 1.5vh, 12px) clamp(10px, 2vw, 15px);
    color: #f4e4c1;
    font-family: 'MedievalSharp', cursive;
    font-size: clamp(0.85rem, 2.3vw, 1rem);
    outline: none;
    transition: all 0.3s ease;
    width: 180px;
}

.nickname-input:focus {
    border-color: #8b6914;
    box-shadow: 0 0 10px rgba(255, 140, 0, 0.3);
}

.nickname-input::placeholder {
    color: #8b6914;
}

.message-nickname {
    color: #ff8c00;
    font-weight: bold;
    margin-right: 5px;
}
