/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5e6d3 0%, #e8d5c4 100%);
    min-height: 100vh;
    padding: 20px;
    color: #3d2817;
    overflow-x: hidden;
}

/* Screen Management */
.screen {
    display: none;
    max-width: 100%;
    width: 100%;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

/* Header Banner */
.header-banner {
    background: #8b4513;
    color: white;
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.header-banner h1 {
    font-size: 28px;
    font-weight: bold;
    margin: 0;
}

/* Content Card */
.content-card {
    background: white;
    border-radius: 20px;
    padding: 30px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.quiz-card {
    padding: 25px 20px;
}

/* Illustration */
.illustration {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
    height: 200px;
    position: relative;
}

.cigar-illustration {
    position: relative;
    width: 150px;
    height: 150px;
}

.cigar {
    position: absolute;
    width: 60px;
    height: 12px;
    background: linear-gradient(90deg, #654321 0%, #8b4513 50%, #654321 100%);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cigar-1 {
    top: 50px;
    left: 20px;
    transform: rotate(-15deg);
}

.cigar-2 {
    top: 70px;
    left: 30px;
    transform: rotate(10deg);
}

.leaves {
    position: absolute;
    width: 100%;
    height: 100%;
}

.leaf {
    position: absolute;
    width: 40px;
    height: 40px;
    background: #d4a574;
    border-radius: 50% 0 50% 0;
    opacity: 0.7;
}

.leaf-1 {
    top: 10px;
    left: 10px;
    transform: rotate(45deg);
}

.leaf-2 {
    top: 30px;
    right: 20px;
    transform: rotate(-30deg);
}

.leaf-3 {
    bottom: 20px;
    left: 50px;
    transform: rotate(60deg);
}

.glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(255, 235, 59, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
}

/* Typography */
.welcome-title {
    font-size: 24px;
    font-weight: bold;
    color: #3d2817;
    text-align: center;
    margin: 20px 0 15px;
}

.welcome-description {
    font-size: 16px;
    color: #5a4a3a;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 30px;
}

.question-header {
    margin-bottom: 15px;
}

.question-number {
    font-size: 14px;
    font-weight: 600;
    color: #8b4513;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-text {
    font-size: 20px;
    font-weight: bold;
    color: #2c1810;
    margin-bottom: 25px;
    line-height: 1.4;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: #8b4513;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.btn-primary:hover {
    background: #6b3410;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 69, 19, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    flex: 1;
    padding: 14px 20px;
    background: #f5e6d3;
    color: #3d2817;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e8d5c4;
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Answer Options */
.answer-options {
    margin-bottom: 20px;
}

/* Radio buttons (select) */
.radio-option {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 12px;
    background: #faf8f5;
    border: 2px solid #e8d5c4;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.radio-option:hover {
    background: #f5e6d3;
    border-color: #d4a574;
}

.radio-option.selected {
    background: #f5e6d3;
    border-color: #8b4513;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.2);
}

.radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #8b4513;
}

.radio-option label {
    flex: 1;
    font-size: 16px;
    color: #3d2817;
    cursor: pointer;
    margin: 0;
}

/* Checkboxes (multi_select) */
.checkbox-option {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 12px;
    background: #faf8f5;
    border: 2px solid #e8d5c4;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkbox-option:hover {
    background: #f5e6d3;
    border-color: #d4a574;
}

.checkbox-option.selected {
    background: #f5e6d3;
    border-color: #8b4513;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.2);
}

.checkbox-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #8b4513;
}

.checkbox-option label {
    flex: 1;
    font-size: 16px;
    color: #3d2817;
    cursor: pointer;
    margin: 0;
}

/* Custom answer container with categories */
.custom-answer-container {
    width: 100%;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--tg-theme-hint-color, #999999);
    padding-bottom: 8px;
}

.category-tab {
    padding: 10px 16px;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border: none;
    border-radius: 8px 8px 0 0;
    color: var(--tg-theme-text-color, #000000);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.category-tab:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.category-tab.active {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #ffffff);
    opacity: 1;
    font-weight: 600;
}

.category-content {
    position: relative;
    min-height: 200px;
}

.category-panel {
    display: none;
    animation: fadeInPanel 0.3s ease;
}

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

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

/* Input field (input type) */
.input-container {
    margin-bottom: 20px;
}

.answer-input {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    color: #3d2817;
    background: #faf8f5;
    border: 2px solid #e8d5c4;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.answer-input:focus {
    background: #ffffff;
    border-color: #8b4513;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.2);
}

.answer-input::placeholder {
    color: #9a8a7a;
}

/* Question Hint */
.question-hint {
    background: #faf8f5;
    border-left: 4px solid #d4a574;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.question-hint p {
    font-size: 14px;
    color: #5a4a3a;
    line-height: 1.6;
    margin: 0;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Loading Spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e8d5c4;
    border-top-color: #8b4513;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

#loading-screen {
    text-align: center;
}

#loading-screen p {
    color: #5a4a3a;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 480px) {
    body {
        padding: 15px;
    }
    
    .content-card {
        padding: 25px 15px;
    }
    
    .welcome-title {
        font-size: 22px;
    }
    
    .question-text {
        font-size: 18px;
    }
    
    .illustration {
        height: 150px;
    }
}

/* Telegram Web App Theme Support */
@media (prefers-color-scheme: dark) {
    body {
        background: var(--tg-theme-bg-color, linear-gradient(135deg, #f5e6d3 0%, #e8d5c4 100%));
        color: var(--tg-theme-text-color, #3d2817);
    }
    
    .content-card {
        background: var(--tg-theme-secondary-bg-color, white);
    }
    
    .btn-primary {
        background: var(--tg-theme-button-color, #8b4513);
        color: var(--tg-theme-button-text-color, white);
    }
}

/* Welcome Card Styles */
.welcome-card {
    padding: 25px 20px;
}

/* News Section */
.news-section {
    background: linear-gradient(135deg, #fff8f0 0%, #f5e6d3 100%);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
    border: 2px solid #e8d5c4;
    position: relative;
    overflow: hidden;
}

.news-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(139, 69, 19, 0.05) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 0.8;
    }
}

.news-badge {
    display: inline-block;
    background: #8b4513;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.news-title {
    font-size: 20px;
    font-weight: bold;
    color: #3d2817;
    margin-bottom: 12px;
    line-height: 1.3;
}

.news-text {
    font-size: 15px;
    color: #5a4a3a;
    line-height: 1.6;
    margin-bottom: 16px;
}

.news-features {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 14px;
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-width: 100px;
}

.feature-icon {
    font-size: 18px;
}

.feature-text {
    font-size: 13px;
    color: #3d2817;
    font-weight: 500;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    margin: 25px 0;
}

.welcome-message .welcome-title {
    font-size: 26px;
    margin-bottom: 12px;
}

.welcome-message .welcome-description {
    font-size: 16px;
    color: #5a4a3a;
    line-height: 1.6;
    margin-bottom: 0;
}

/* Enhanced Buttons */
.btn-large {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 24px;
    font-size: 18px;
    min-height: 56px;
}

.btn-icon {
    font-size: 24px;
}

.btn-text {
    font-weight: 600;
}

.welcome-actions {
    flex-direction: column;
    gap: 12px;
    margin-top: 30px;
}

.welcome-actions .btn-secondary {
    width: 100%;
    background: white;
    border: 2px solid #e8d5c4;
    color: #3d2817;
}

.welcome-actions .btn-secondary:hover {
    background: #f5e6d3;
    border-color: #d4a574;
}

/* Enhanced Cigar Illustration */
.cigar-3 {
    top: 90px;
    left: 50px;
    transform: rotate(25deg);
    opacity: 0.8;
}

.leaf-4 {
    top: 50px;
    right: 10px;
    transform: rotate(-45deg);
    opacity: 0.6;
}

.smoke {
    position: absolute;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, rgba(200, 200, 200, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: smokeRise 3s ease-in-out infinite;
}

.smoke-1 {
    top: 40px;
    left: 25px;
    animation-delay: 0s;
}

.smoke-2 {
    top: 60px;
    left: 45px;
    animation-delay: 1.5s;
}

@keyframes smokeRise {
    0% {
        opacity: 0.4;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 0.6;
        transform: translateY(-20px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) scale(1.5);
    }
}

/* Statistics Screen */
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e8d5c4;
}

.stats-header h2 {
    font-size: 24px;
    color: #3d2817;
    margin: 0;
}

.btn-back {
    background: #f5e6d3;
    color: #3d2817;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: #e8d5c4;
}

.stats-content {
    padding: 20px 0;
}

.stats-placeholder {
    text-align: center;
    color: #5a4a3a;
    font-size: 16px;
    padding: 40px 20px;
    background: #faf8f5;
    border-radius: 12px;
}

/* Responsive adjustments for welcome screen */
@media (max-width: 480px) {
    .news-section {
        padding: 16px;
    }
    
    .news-title {
        font-size: 18px;
    }
    
    .news-text {
        font-size: 14px;
    }
    
    .feature-item {
        min-width: auto;
        flex: 1 1 calc(50% - 6px);
    }
    
    .welcome-message .welcome-title {
        font-size: 22px;
    }
    
    .btn-large {
        padding: 16px 20px;
        font-size: 16px;
    }
}
