/* General body styling for a clean and professional look */
body {
    font-family: 'Roboto', sans-serif; /* Use a modern, clean font */
    background-color: #f8f9fa; /* Light gray background for a professional feel */
    color: #212529; /* Dark gray text for readability */
    margin: 0px; /* Remove all margins */
    line-height: 1.6;
}

/* ===== SOCIAL PROFILE STYLES ===== */
/* Social Profile specific styles following the app's design system */
.social-profile-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0;
}

/* Profile header card matching main-task styling */
.profile-header {
    background-color: #ffffff;
    padding: 1.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.profile-header:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.profile-header-content {
    display: flex;
    align-items: center;
    padding-bottom: 1rem;
    position: relative;
}

.profile-name {
    font-size: 2.8rem;
    font-weight: bold;
    color: #343a40;
    margin: 0;
    padding-bottom: 0.5rem;
    flex: 1;
    text-align: center;
    display: flex;
    justify-content: center;
}

.profile-name-text {
    border-bottom: 2px solid #fb6b00;
    padding-bottom: 0.5rem;
    display: inline-block;
}

.profile-name .copy-profile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #FB6B00;
    color: white;
    border: 2px solid #FB6B00;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin-left: 16px;
    vertical-align: middle;
    box-shadow: 0 2px 4px rgba(251, 107, 0, 0.3);
}

.profile-name .copy-profile-btn:hover {
    background: #e55a00;
    border-color: #e55a00;
    transform: scale(1.15);
    box-shadow: 0 4px 8px rgba(251, 107, 0, 0.4);
}

.profile-name .copy-profile-btn:active {
    transform: scale(0.95);
    background: #20c997;
}

/* Profile share link section */
.profile-share-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    flex-shrink: 0;
}

.share-link-text {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: #495057;
    background: white;
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    flex: 1;
    text-align: center;
    word-break: break-all;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-share-link .copy-profile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #FB6B00;
    color: white;
    border: 2px solid #FB6B00;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(251, 107, 0, 0.3);
}

.profile-share-link .copy-profile-btn:hover {
    background: #e55a00;
    border-color: #e55a00;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(251, 107, 0, 0.4);
}

.profile-share-link .copy-profile-btn:active {
    transform: scale(0.95);
    background: #28a745;
}

/* Social sharing buttons */
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 2px solid;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.telegram-btn {
    background: #FB6B00;
    color: white;
    border-color: #FB6B00;
}

.telegram-btn:hover {
    background: #e55a00;
    border-color: #e55a00;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(251, 107, 0, 0.4);
}

.telegram-logo {
    width: 32px;
    height: 32px;
    transition: all 0.2s ease;
    background: white;
    border-radius: 50%;
    padding: 2px;
}

.telegram-btn:hover .telegram-logo {
    transform: scale(1.1);
}

.share-btn:active {
    transform: scale(0.95);
}

/* Stats grid for 4 columns */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    display: grid;
    grid-template-rows: 60px 1fr;
    min-height: 120px;
    gap: 0.5rem;
}

.stat-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.stat-number {
    font-size: 1.8rem;
    font-weight: bold;
    color: #FB6B00;
    line-height: 1.2;
    margin: 0;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-label {
    color: #6c757d;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.6;
    margin: 0;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Plagiarism notice matching auxiliary text */
.plagiarism-notice {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.plagiarism-notice:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.plagiarism-text {
    font-size: 1rem;
    font-style: italic;
    color: #6c757d;
    margin: 0;
}

/* Current position card */
.current-position {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.current-position:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.position-label {
    font-size: 1rem;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.position-title {
    font-size: 2rem;
    font-weight: bold;
    color: #343a40;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.position-desc {
    font-size: 1.1rem;
    color: #6c757d;
    font-style: italic;
    line-height: 1.6;
}

/* Assignment groups matching result block styling */
.assignments-section {
    margin-bottom: 2rem;
}

.assignments-group {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.assignments-group:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.group-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
    font-weight: bold;
    font-size: 1.2rem;
    color: #343a40;
}

.group-assignments {
    padding: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-start;
    align-items: center;
}

.assignment-status {
    font-size: 1.5rem;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid transparent;
}

.assignment-status:hover {
    transform: scale(1.15);
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border-color: #dee2e6;
}

.assignment-status:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Tablet responsive design */
@media (max-width: 1024px) and (min-width: 768px) {
    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* Mobile responsive design */
@media (max-width: 767.98px) {
    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .profile-name {
        font-size: 2rem;
    }

    .position-title {
        font-size: 1.5rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .social-profile-container {
        padding: 0;
    }

    .profile-header,
    .stat-card,
    .plagiarism-notice,
    .current-position,
    .assignments-group {
        margin-left: 0;
        margin-right: 0;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .group-assignments {
        padding: 1rem;
    }

    .profile-header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .profile-name {
        font-size: 2rem;
        text-align: center;
    }

    .profile-share-link {
        padding: 10px;
    }

    .share-link-text {
        font-size: 0.9rem;
        padding: 8px;
        white-space: normal;
        word-break: break-all;
    }

    .profile-share-link .copy-profile-btn,
    .share-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* QA Position and token text styling in header - consistent underlines */
.header-underlined-text {
    border-bottom: 1px solid #6c757d;
    padding-bottom: 2px;
    display: inline-block;
    text-decoration: none;
}

/* Note: Social profile page specific styles like .main-task display:none should be in template-specific CSS */

/* CSS Variables for consistent theming */
:root {
    --bg-primary: #f0f0f3;
    --bg-card: rgba(255, 255, 255, 0.4);
    --bg-card-hover: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --accent-color: #667eea;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --shadow-soft: rgba(0, 0, 0, 0.1);
}

/* Main title: large, bold, and centered */
.page-title {
    text-align: center;
    color: #343a40; /* Darker gray for emphasis */
    font-size: 2.8rem;
    font-weight: bold;
    margin-bottom: 1rem;
    border-bottom: 2px solid #fb6b00; 
    padding-bottom: 0.5rem;
}

/* Auxiliary information: smaller, muted, and italic */
.auxiliary-text {
    font-size: 1rem;
    font-style: italic;
    color: #6c757d; /* Muted gray for secondary information */
    margin-bottom: 1.5rem;
    text-align: left; /* Align to the left */
}

/* Style links in auxiliary text */
.auxiliary-text a {
    color: inherit; /* Same color as surrounding text */
    text-decoration: underline;
    text-decoration-color: inherit; /* Same color as text */
}

/* Horizontal line under task_name */
.task-divider {
    border: 0;
    height: 1px;
    background-color: #fb6b00; /* Same color as the "Clear" button */
    margin: 0.5rem 0 1rem 0;
}

/* Main task: prominent and engaging */
.main-task {
    font-size: 1.3rem;
    font-weight: 500;
    color: #212529; /* Dark gray for focus */
    margin-top: 1rem;
    margin-bottom: 2rem;
    text-align: left !important; /* Explicitly align text to the left */
    line-height: 1.8;
    background-color: #ffffff; /* White background for emphasis */
    padding: 1rem 1.5rem;
    border: 1px solid #dee2e6; /* Subtle border for focus */
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Light shadow for depth */
    white-space: pre-line;  /* Preserve line breaks */
    width: 100%;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    transition: all 0.3s ease;
}

/* Ensure task content is always left-aligned unless explicitly centered */
.main-task:not(.text-center) {
    text-align: left !important;
}

/* Orange checkmarks for homepage content */
.main-task .checkmark {
    color: #ff8c00;
    font-weight: bold;
    margin-right: 8px;
}

/* Orange checkmarks for call-to-action blocks */
.checkmark {
    color: #ff8c00;
    font-weight: bold;
}

/* Footer links styling */
#version-info a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: #ff8c00;
}

/* Call to action text sizing to match main-task on desktop */
.result-block .call-to-action-text {
    font-size: 1.2em !important;
}

@media (max-width: 767px) {
    .welcome-text {
        font-size: 1.1em !important;
        line-height: 1.8 !important;
    }
}

/* Mobile override for call-to-action text */
@media (max-width: 767.98px) {
    .result-block .call-to-action-text {
        font-size: 1rem !important;
        line-height: 1.6;
    }
}

/* Test page info styling - same as main-task but without JavaScript interaction */
.test-page-info {
    font-size: 1.3rem;
    font-weight: 500;
    color: #212529;
    line-height: 1.8;
    background-color: #ffffff;
    padding: 1rem 1.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: pre-line;
    width: 100%;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    transition: all 0.3s ease;
}



/* Ensure other content blocks use proper left alignment */
.result-block .fade-in.text-start {
    text-align: left !important;
}

/* Blinking button animation for homepage */
.blinking-button {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* Green hover effect for buttons */
.btn-hover-green:hover {
    background-color: #218838 !important;
    border-color: #218838 !important;
}

/* Orange button styling */
.btn-orange {
    background-color: #ff6600 !important;
    border-color: #ff6600 !important;
    color: white !important;
}

.btn-orange:hover {
    background-color: #e05d00 !important;
    border-color: #e05d00 !important;
    color: white !important;
}

.main-task:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* Result block styling */
.result-block {
    background-color: #ffffff; /* White background for emphasis */
    padding: 1rem;
    border: 1px solid #dee2e6; /* Subtle border for focus */
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Light shadow for depth */
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    text-align: left; /* Align content to the left */
    line-height: 1.6;
    margin-left: auto; /* Center-align horizontally */
    margin-right: auto; /* Center-align horizontally */
    width: 100%; /* Restore full width */
    max-width: none; /* Remove width restriction */
    padding-left: 1.5rem; /* Add consistent left padding */
    padding-right: 1.5rem; /* Add consistent right padding */
    transition: all 0.3s ease;
}

.result-block:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* Form styling - matching other blocks */
form.mb-4 {
    background-color: #ffffff; /* White background for emphasis */
    border: 1px solid #dee2e6; /* Subtle border for focus */
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Light shadow for depth */
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    transition: all 0.3s ease;
    position: relative; /* For absolute positioning of loading indicator */
}

form.mb-4:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* Section title styling for "Результат проверки:" and "Твое решение:" */
.section-title {
    font-size: 1.5rem; /* Same size for both titles */
    font-weight: bold;
    color: #343a40; /* Dark gray for emphasis */
    margin-bottom: 0.5rem;
    text-align: left; /* Align text to the left */
}

/* Form styling for a clean and structured layout */
form {
    margin-bottom: 20px;
    background-color: #ffffff;
    padding: 1.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Input fields styling */
input[type="text"], textarea {
    width: 100%;
    max-width: none;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
    font-weight: 500;
}

/* Ensure textarea matches main-task width */
textarea.form-control {
    width: 100% !important;
    max-width: none !important;
}

/* Buttons: revert to previous styles */
button[type="submit"], .btn-clear {
    background-color: #28a745; /* Green color */
    border-color: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    width: auto; /* Allow buttons to size dynamically */
    margin: 0; /* Remove auto centering */
    display: inline-block; /* Align buttons inline */
}

button[type="submit"]:hover, .btn-clear:hover {
    background-color: #218838; /* Darker green for hover */
    border-color: #218838;
    color: white; /* Ensure text remains white on hover */
}

/* Ensure "Очистить" button is visible */
.btn-clear {
    background-color: #FB6B00; /* Orange color */
    border-color: #FB6B00;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    width: auto; /* Allow buttons to size dynamically */
    margin: 0; /* Remove auto centering */
    display: inline-block; /* Align buttons inline */
}

.btn-clear:hover {
    background-color: #e05d00; /* Darker orange for hover */
    border-color: #e05d00;
}

.btn-custom {
    background-color: #007bff; /* Bootstrap primary blue */
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    width: 200px;
    margin: 0 auto;
    display: block;
}

.btn-custom:hover {
    background-color: #0056b3; /* Darker blue for hover */
}

/* File input styling */
.custom-file-label {
    display: inline-block;
    padding: 0.5rem 1rem;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border-radius: 0.25rem;
    width: 200px;
    text-align: center;
    border: 1px solid #007bff;
}

.custom-file-label.green {
    background-color: #28a745; /* Green for success */
    border-color: #28a745;
}

.custom-file-label.green:hover {
    background-color: #218838;
    border-color: #218838;
    color: white;
}

/* Loading indicator */
#loading-indicator {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5em;
    color: #333;
}

/* My loading indicator - center it directly over the textarea */
#my-loading {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

/* Mobile specific positioning for loading indicator */
@media (max-width: 768px) {
    #my-loading {
        position: fixed;
        top: 45%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 1001;
        background: rgba(255, 255, 255, 0.95);
        padding: 20px;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

/* Version info: subtle and professional */
#version-info {
    position: static;
    margin: 20px 10px;
    font-size: 0.8em;
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 10px;
}

/* Fade-in animation for response content */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#response-content.fade-in {
    animation: fadeIn 1s ease-out;
}

/* Table styling for structured data */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 1rem;
    text-align: left;
}

/* Preserve whitespace and tabs in task descriptions */
.main-task {
    white-space: pre-wrap;
}

table th, table td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
}

table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

/* Add subtle hover effect for rows */
table tr:hover {
    background-color: #f1f3f5;
}

/* Minimal mobile CSS - only helpful rules */
@media (max-width: 767.98px) {
    /* Version info positioning */
    #version-info {
        position: static !important;
        margin: 10px 5px !important;
        font-size: 0.7em !important;
        text-align: center !important;
        padding: 8px !important;
    }

    /* Mobile typography */
    p.main-task.text-center {
        font-size: 1rem !important;
        padding: 0.75rem 0.5rem !important; /* Reduced horizontal padding */
        margin: 1rem 0 !important; /* Consistent top and bottom margin */
    }

    /* Force consistent spacing for mobile content blocks */
    p.main-task.text-center + div.task-image-container,
    div.task-image-container + p.main-task.text-center {
        margin-top: 1rem !important;
    }

    /* Reduce margins for all content blocks */
    .result-block {
        margin-top: 1rem !important; /* Reduced from 1.5rem */
        margin-bottom: 1rem !important; /* Reduced from 2rem */
        padding: 0.75rem 0.5rem !important; /* Reduced padding */
    }

    form.mb-4 {
        padding: 0.75rem 0.5rem !important; /* Reduced padding */
        margin-bottom: 1rem !important; /* Reduced margin */
    }

    /* Reduce form element margins */
    input[type="text"], textarea {
        margin-bottom: 0.5rem !important; /* Reduced from 10px */
        padding: 8px !important; /* Reduced padding */
    }

    /* Button container spacing */
    .d-flex.justify-content-between.align-items-center {
        margin-top: 0.5rem !important;
        gap: 5px !important;
    }

    /* Reduce page title margins */
    .page-title {
        margin-bottom: 0.5rem !important;
        font-size: 1.4rem !important; /* Slightly smaller for mobile */
    }

    .auxiliary-text {
        margin-bottom: 0.75rem !important; /* Reduced from 1.5rem */
    }

    /* Position logo to the right of menu button */
    .mb-4.d-flex.align-items-center.flex-wrap {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 2px !important;
    }

    .menu-wrapper {
        order: 1 !important;
    }

    .logo-container {
        order: 2 !important;
        display: flex !important;
        align-items: center !important;
    }

    .title-wrapper {
        order: 3 !important;
        width: 100% !important;
        margin-top: 10px !important;
    }

    /* Reduce page title margins */
    .page-title {
        margin-bottom: 0.5rem !important;
        font-size: 1.4rem !important; /* Slightly smaller for mobile */
    }

    .auxiliary-text {
        margin-bottom: 0.75rem !important; /* Reduced from 1.5rem */
    }

    /* Mobile container override */
    .container {
        padding-left: 5px !important; /* Set to 5px to match base.html */
        padding-right: 5px !important; /* Set to 5px to match base.html */
    }

    /* Mobile-specific body padding */
    body {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

@media (max-width: 768px) {
    .menu-wrapper {
        padding: 0;
        margin: 0;
        padding-left: 15px;
    }
    
    .menu-button {
        margin-left: 15px;
        margin: 0 !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 24px !important;
    }
    
    .custom-menu {
        position: fixed;
        top: 60px;
        left: 15px;
        width: calc(100vw - 30px); /* Leave margin on both sides */
        max-width: 350px; /* Set maximum width */
        max-height: 95vh; /* Limit height to 95% of viewport */
        margin: 0;
        /* Base mobile styling without glass effect */
        background: rgba(255, 255, 255, 0.95);
        overflow-y: auto; /* Enable vertical scrolling */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        z-index: 9999; /* Ensure menu is above everything */
        padding: 8px; /* Reduced padding */
        border-radius: 8px; /* Normal rounded corners */
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .menu-item {
        margin: 4px 0; /* Small vertical margin */
        padding: 10px 12px; /* Comfortable padding */
        font-size: 14px; /* Font size */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis; /* Handle long text */
        border-radius: 8px; /* Rounded corners */
        background: rgba(248, 249, 250, 0.9);
        border: none;
        cursor: pointer;
        transition: all 0.3s ease;
        font-weight: 500;
        color: rgba(0, 0, 0, 0.85);
    }
    
    .submenu {
        margin: 0;
        background: transparent;
        padding-left: 0; /* Remove left padding */
    }
    
    .submenu-item {
        margin: 2px 8px; /* Small margins */
        padding: 8px 12px; /* Comfortable padding */
        font-size: 13px; /* Smaller font for submenu items */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis; /* Handle long text */
        border-radius: 6px; /* Rounded corners */
        background: rgba(255, 255, 255, 0.8);
        border: none;
        cursor: pointer;
        transition: all 0.2s ease;
        font-weight: 400;
        color: rgba(0, 0, 0, 0.8);
    }
    
    .container {
        padding-left: 5px !important;
        padding-right: 5px !important;
        margin-left: 0px !important;
        margin-right: 0px !important;
        max-width: 100% !important;
    }
    
    .mb-4.d-flex.align-items-center.flex-wrap {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 5px !important;
        position: relative !important;
    }

    /* Remove the pseudo-element spacing */
    .mb-4.d-flex.align-items-center.flex-wrap::before {
        display: none !important;
    }

    .menu-wrapper {
        position: static !important;
        order: 1 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .logo-container {
        position: static !important;
        order: 2 !important;
        z-index: 10;
        display: flex !important;
        align-items: center !important;
    }

    .logo-container .logo-image {
        margin: 0 !important;
        max-width: 80px !important;
        height: auto !important;
    }

    /* Balance display as separate flex item */
    .balance-display {
        order: 3 !important;
        margin: 0 !important;
        font-size: 14px !important;
        text-align: center !important;
        position: static;
        transform: none;
        white-space: nowrap;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 80px !important;
        padding: 0 5px !important;
        flex: 1 !important;
    }

    /* Additional mobile-specific rule to override any inherited styles */
    .balance-display.low-balance,
    .balance-display.normal-balance {
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Title section flows normally below */
    .title-wrapper {
        width: 100% !important;
        margin-top: 10px !important;
        position: relative;
        z-index: 5;
        order: 3 !important;
    }
    
    /* Mobile glass effect applied only when menu is shown */
    .custom-menu.show {
        background: rgba(255, 255, 255, 0.15) !important;
        backdrop-filter: blur(25px) saturate(200%) !important;
        -webkit-backdrop-filter: blur(25px) saturate(200%) !important;
        border-radius: 20px !important;
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.15),
            0 2px 8px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
        padding: 12px !important;
    }

    /* Allow body scroll when menu is open since menu is now compact */
    body.menu-open {
        /* Remove overflow restrictions to allow normal page scrolling */
    }
}

.menu-wrapper {
    position: relative;
    z-index: 1000;
}

.menu-button {
    width: 60px;
    height: 60px;
    font-size: 32px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.menu-button:hover {
    background: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: scale(1.05);  /* Добавлен такой же эффект как у логотипа */
}

.custom-menu {
    position: absolute;
    top: 70px;
    left: 0;
    min-width: 320px;
    /* Base styling without glass effect */
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(221, 221, 221, 0.5);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
    display: block !important;
}

.custom-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    /* Glass effect applied only when menu is shown */
    background: rgba(255, 255, 255, 0.25) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 16px !important;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
    padding: 12px !important;
}

.menu-item {
    padding: 12px 16px;
    margin: 4px 0;
    cursor: pointer;
    border-radius: 8px;
    background: rgba(248, 249, 250, 0.9);
    border: none;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
    font-weight: 500;
    color: rgba(0, 0, 0, 0.8);
}

.custom-menu.show .menu-group:nth-child(1) .menu-item { transition-delay: 0.1s; }
.custom-menu.show .menu-group:nth-child(2) .menu-item { transition-delay: 0.15s; }
.custom-menu.show .menu-group:nth-child(3) .menu-item { transition-delay: 0.2s; }
.custom-menu.show .menu-group:nth-child(4) .menu-item { transition-delay: 0.25s; }
.custom-menu.show .menu-group:nth-child(5) .menu-item { transition-delay: 0.3s; }

.custom-menu.show .menu-item {
    opacity: 1;
    transform: translateY(0);
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    color: rgba(0, 0, 0, 0.9);
}

.logo-image {
    transition: transform 0.2s ease;
}

.logo-image:hover {
    transform: scale(1.05);
}

/* Specific styles for different logos - higher specificity to override existing rules */
.logo-container .logo-image.mentorpiece-logo {
    width: 95px !important;
    max-width: 95px !important;
    height: auto !important;
    margin: 20px;
}

.logo-container .logo-image.mentorpiece-sim-logo {
    width: 280px !important;
    max-width: 280px !important;
    height: auto !important;
}

/* Mobile-specific logo sizing */
@media (max-width: 767.98px) {
    .logo-container .logo-image.mentorpiece-logo {
        width: 75px !important;
        max-width: 75px !important;
        margin: 10px !important;
    }
}

.submenu {
    padding-left: 20px;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, max-height 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.submenu-item {
    padding: 10px 16px;
    margin: 2px 8px;
    cursor: pointer;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    transition: all 0.2s ease;
    opacity: 0;
    transform: translateY(-10px);
    font-weight: 400;
    color: rgba(0, 0, 0, 0.75);
}

.menu-group.active .submenu {
    opacity: 1;
    visibility: visible;
    max-height: 800px;
}

.menu-group.active .submenu-item {
    opacity: 1;
    transform: translateY(0);
}

/* Add delay for every next item */
.menu-group.active .submenu-item:nth-child(1) { transition-delay: 0.1s; }
.menu-group.active .submenu-item:nth-child(2) { transition-delay: 0.15s; }
.menu-group.active .submenu-item:nth-child(3) { transition-delay: 0.2s; }
.menu-group.active .submenu-item:nth-child(4) { transition-delay: 0.25s; }
.menu-group.active .submenu-item:nth-child(5) { transition-delay: 0.3s; }
.menu-group.active .submenu-item:nth-child(6) { transition-delay: 0.35s; }
.menu-group.active .submenu-item:nth-child(7) { transition-delay: 0.4s; }
.menu-group.active .submenu-item:nth-child(8) { transition-delay: 0.45s; }
.menu-group.active .submenu-item:nth-child(9) { transition-delay: 0.5s; }
.menu-group.active .submenu-item:nth-child(10) { transition-delay: 0.55s; }
.menu-group.active .submenu-item:nth-child(11) { transition-delay: 0.6s; }
.menu-group.active .submenu-item:nth-child(12) { transition-delay: 0.65s; }
.menu-group.active .submenu-item:nth-child(13) { transition-delay: 0.7s; }
.menu-group.active .submenu-item:nth-child(14) { transition-delay: 0.75s; }
.menu-group.active .submenu-item:nth-child(15) { transition-delay: 0.8s; }

.submenu-item:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
    color: rgba(0, 0, 0, 0.85);
}

/* Desktop styles */
@media (min-width: 769px) {
    .title-wrapper {
        margin-top: 30px !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
        height: 100%;
    }
    
    .page-title {
        margin-bottom: 0.25rem !important;
        font-size: 1.75rem !important;
        line-height: 1.2;
    }
    
    .auxiliary-text {
        margin-bottom: 0;
    }

    /* Add padding at the bottom of the page for version info */
    body {
        padding-bottom: 10px !important; /* Space above version info on desktop */
    }
    
    /* Ensure the container respects this padding */
    .container {
        margin-bottom: 0 !important;
    }
}


/* Limit container width for all screen sizes */
.container {
    max-width: 1000px !important; /* Fixed maximum width of 1000px instead of percentage */
    padding-left: 15px !important;
    padding-right: 15px !important;
    margin: 0 auto !important; /* Ensure it stays centered */
}

/* Mobile container override */
@media (max-width: 767.98px) {
    .container {
        padding-left: 5px !important; /* Set to 5px to match base.html */
        padding-right: 5px !important; /* Set to 5px to match base.html */
    }
}

/* Align menu button with content blocks on desktop */
@media (min-width: 769px) {
    .mb-4.d-flex.align-items-center.flex-wrap {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .menu-wrapper {
        margin-left: 0px !important;
        padding-left: 0px !important;
    }
}

/* ========================================
   BALANCE PAGE STYLES (UNIFIED)
   ======================================== */

.back-button {
    display: none;
}

/* Balance-specific content styles */
.balance-content {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 35px;
    margin: 0;
}

.balance-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    border: none;
    border-radius: 12px;
    padding: 4px 20px;
    justify-content: center;
}

.balance-main-amount {
    font-size: 3.2rem;
    font-weight: 200;
    margin: 0;
    color: #000000 !important;
    line-height: 0.9;
}

.balance-token-label {
    font-size: 1rem;
    font-weight: 300;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1;
    text-align: center;
}

/* Stats on the right */
.balance-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    background: none;
    border: none;
    margin: 0;
}

.balance-stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 3px 16px;
    min-width: 160px;
    gap: 12px;
}

.balance-stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
    line-height: 1;
    flex-shrink: 0;
}

.balance-stat-value {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1;
    text-align: right;
}

.balance-stat-item:first-child .balance-stat-value {
    color: #22c55e;
}

.balance-stat-item:last-child .balance-stat-value {
    color: #dc3545;
}

/* Token bonus message styling */
.token-bonus-message {
    text-align: center;
}

/* Glassmorphic Promo Input */
.promo-input-group {
    display: flex;
    gap: 15px;
    align-items: stretch;
}

.promo-input-group .form-control {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 15px 20px;
    font-size: 1rem;
    font-weight: 300;
    color: var(--text-primary);
    text-transform: none;
    letter-spacing: 0px;
    margin-bottom: 0;
    flex: 1;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.promo-input-group .form-control:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--accent-color);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.1),
        0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* Override glassmorphic styling to match index.html form-control styling */
.promo-input-group .form-control.form-control-lg {
    background: #ffffff !important;
    backdrop-filter: none !important;
    border: 1px solid #ced4da !important;
    border-radius: 0.375rem !important;
    box-shadow: none !important;
    font-weight: 500 !important;
}

.promo-input-group .form-control.form-control-lg:focus {
    background: #ffffff !important;
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

/* Glassmorphic Button */
.neo-button {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 400;
    color: var(--accent-color);
    width: auto;
    min-width: 120px;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.neo-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

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

.neo-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Glassmorphic Transaction Items */
.transaction-item {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.transaction-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.transaction-item:last-child {
    margin-bottom: 0;
}

.transaction-description {
    font-size: 1rem;
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.transaction-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.transaction-amount {
    font-size: 1.2rem;
    font-weight: 400;
    padding: 8px 16px;
    border-radius: 12px;
    min-width: 80px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.transaction-earned {
    color: var(--success-color);
}

.transaction-spent {
    color: var(--danger-color);
}

.transaction-inactive {
    color: var(--text-secondary);
}

.transaction-unauthenticated {
    opacity: 0.6;
    color: var(--text-secondary) !important;
}

.transaction-unauthenticated .transaction-description,
.transaction-unauthenticated .transaction-date {
    color: var(--text-secondary);
}

.unauthenticated-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-style: italic;
    margin-left: 8px;
}

/* Minimalist Empty State */
.empty-state {
    text-align: center;
    padding: 10px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    opacity: 0.4;
}

.empty-state h4 {
    font-size: 1.2rem;
    font-weight: 300;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 450px;
    margin: 0 auto;
    font-weight: 300;
}

/* Glassmorphic Promo Result */
.promo-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 12px;
    font-weight: 300;
    text-align: center;
    display: none;
    animation: softSlideIn 0.4s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.promo-success {
    background: rgba(74, 222, 128, 0.1);
    color: var(--success-color);
}

.promo-error {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(248, 113, 113, 0.3);
    min-height: 20px;
    padding: 15px !important;
    font-size: 14px;
    line-height: 1.4;
}

/* Rate Limit Warning Styles */
.rate-limit-warning {
    background: linear-gradient(135deg, #fffbf0 0%, #fff8e1 100%);
    border: 1px solid #fff3cd;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.rate-limit-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.rate-limit-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}

.rate-limit-text {
    flex: 1;
    line-height: 1.4;
}

.rate-limit-title {
    font-weight: bold;
    color: #856404;
    font-size: 0.95em;
    margin-bottom: 2px;
}

.rate-limit-message {
    color: #6c5a00;
    font-size: 0.9em;
    line-height: 1.3;
}

.rate-limit-retry {
    display: block;
    color: #6c757d;
    font-size: 0.85em;
    margin-top: 4px;
}

/* Balance page mobile responsive design */
@media (max-width: 767.98px) {
    .balance-content {
        flex-direction: column;
        gap: 20px;
    }

    .balance-main {
        align-self: stretch;
        text-align: center;
        align-items: center;
    }

    .balance-main-amount {
        font-size: 2.8rem;
    }

    .balance-stats {
        align-self: stretch;
    }

    .balance-stat-item {
        min-width: auto;
    }

    .transaction-item {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        gap: 10px;
    }

    .transaction-amount {
        margin-top: 0;
        align-self: flex-start;
        flex-shrink: 0;
    }
}

/* Balance page specific background */
body.balance-page {
    background: var(--bg-primary);
    min-height: 100vh;
}

/* ========================================
   BASE TEMPLATE STYLES 
   ======================================== */

/* Common menu styles */
.menu-group {
    border-bottom: 1px solid #eee;
}

.menu-item {
    padding: 8px 15px;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    padding-right: 25px;
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #f8f9fa;
    padding: 0;
}

.menu-group.active .submenu {
    max-height: 1500px;
    padding: 4px 0;
    transition: max-height 0.5s ease-in, padding 0.3s ease-in;
}

.submenu-item {
    padding: 8px 15px 8px 30px;
    cursor: pointer;
    white-space: nowrap;
    margin: 4px 8px;
    border-radius: 4px;
    background: white;
    opacity: 0.95;
}

.submenu-item:hover {
    background-color: #e9ecef;
}

.menu-wrapper {
    position: relative;
}

.menu-button {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.menu-button:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.custom-menu {
    position: absolute;
    top: 100%;
    left: 15px;
    width: 300px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: none;
    z-index: 1000;
}

.custom-menu.show {
    display: block !important;
}

.balance-display {
    cursor: pointer;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.balance-display.low-balance .balance-tokens {
    color: #dc3545;
}
.balance-display.low-balance .balance-qa-level {
    color: #6c757d;
}

.balance-display.normal-balance {
    color: #6c757d;
}

/* Base template responsive styles */
@media (min-width: 769px) {
    .logo-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0px;
        position: relative;
        margin-right: 20px;
    }
    
    /* Make logo slightly bigger on desktop and add margins */
    .logo-container .logo-image {
        max-width: 120px !important;
        margin-left: 20px !important;
        margin-right: 20px !important;
    }
    
    /* Position balance display relative to menu wrapper on desktop */
    .menu-wrapper {
        position: relative !important;
    }

    .balance-display {
        position: absolute !important;
        bottom: -10px !important;
        left: -55px !important;
        transform: none !important;
        order: unset !important;
        flex: unset !important;
        text-align: left !important;
        margin-top: 0 !important;
        white-space: nowrap;
        font-size: 14px !important;
        text-decoration: underline !important;
        text-decoration-color: rgba(108, 117, 125, 0.4) !important;
        text-underline-offset: 2px !important;
    }
}

@media (max-width: 768px) {
    .menu-wrapper {
        padding: 0;
        margin: 0;
        padding-left: 15px;
    }
    
    .menu-button {
        margin-left: 15px;
        margin: 0 !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 24px !important;
    }
    
    .custom-menu {
        position: fixed;
        top: 60px;
        left: 15px;
        width: calc(100vw - 30px); /* Leave margin on both sides */
        max-width: 350px; /* Set maximum width */
        max-height: 95vh; /* Limit height to 95% of viewport */
        margin: 0;
        /* Base mobile styling without glass effect */
        background: rgba(255, 255, 255, 0.95);
        overflow-y: auto; /* Enable vertical scrolling */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        z-index: 9999; /* Ensure menu is above everything */
        padding: 8px; /* Reduced padding */
        border-radius: 8px; /* Normal rounded corners */
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .menu-item {
        margin: 4px 0; /* Small vertical margin */
        padding: 10px 12px; /* Comfortable padding */
        font-size: 14px; /* Font size */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis; /* Handle long text */
        border-radius: 8px; /* Rounded corners */
        background: rgba(248, 249, 250, 0.9);
        border: none;
        cursor: pointer;
        transition: all 0.3s ease;
        font-weight: 500;
        color: rgba(0, 0, 0, 0.85);
    }
    
    .submenu {
        margin: 0;
        background: transparent;
    }
    
    .submenu-item {
        margin: 2px 8px; /* Small margins */
        padding: 8px 12px; /* Comfortable padding */
        font-size: 13px; /* Smaller font for submenu items */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis; /* Handle long text */
        border-radius: 6px; /* Rounded corners */
        background: rgba(255, 255, 255, 0.8);
        border: none;
        cursor: pointer;
        transition: all 0.2s ease;
        font-weight: 400;
        color: rgba(0, 0, 0, 0.8);
    }
    
    .container {
        padding-left: 5px !important;
        padding-right: 5px !important;
        margin-left: 0px !important;
        margin-right: 0px !important;
        max-width: 100% !important;
    }
    
    .mb-4.d-flex.align-items-center.flex-wrap {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 5px !important;
        position: relative !important;
    }

    /* Remove the pseudo-element spacing */
    .mb-4.d-flex.align-items-center.flex-wrap::before {
        display: none !important;
    }

    .menu-wrapper {
        position: static !important;
        order: 1 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .logo-container {
        position: static !important;
        order: 2 !important;
        z-index: 10;
        display: flex !important;
        align-items: center !important;
    }

    .logo-container .logo-image {
        margin: 0 !important;
        max-width: 80px !important;
        height: auto !important;
    }

    /* Balance display as separate flex item */
    .balance-display {
        order: 3 !important;
        margin: 0 !important;
        font-size: 14px !important;
        text-align: center !important;
        position: static;
        transform: none;
        white-space: nowrap;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-decoration: underline !important;
        min-width: 80px !important;
        padding: 0 5px !important;
        flex: 1 !important;
    }

    /* Additional mobile-specific rule to override any inherited styles */
    .balance-display.low-balance,
    .balance-display.normal-balance {
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Title section flows normally below */
    .title-wrapper {
        width: 100% !important;
        margin-top: 10px !important;
        position: relative;
        z-index: 5;
        order: 3 !important;
    }
    
    /* Mobile glass effect applied only when menu is shown */
    .custom-menu.show {
        background: rgba(255, 255, 255, 0.15) !important;
        backdrop-filter: blur(25px) saturate(200%) !important;
        -webkit-backdrop-filter: blur(25px) saturate(200%) !important;
        border-radius: 20px !important;
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.15),
            0 2px 8px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
        padding: 12px !important;
    }

    /* Allow body scroll when menu is open since menu is now compact */
    body.menu-open {
        /* Remove overflow restrictions to allow normal page scrolling */
    }
}
/* Anonymous user styles for restricted tasks */
.restricted-task {
    opacity: 0.5;
    color: #999 !important;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.4) !important;
}

.restricted-task:hover {
    opacity: 0.7;
    color: #777 !important;
    background: rgba(255, 255, 255, 0.6) !important;
}

/* Authorization Modal Styles */
#auth-modal .modal-dialog {
    max-width: 350px;
}

#auth-modal .modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

#auth-modal .modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 20px 24px 16px;
}

#auth-modal .modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

#auth-modal .modal-body {
    padding: 20px 24px 24px;
    text-align: center;
}

.auth-option {
    margin-bottom: 0;
}

.auth-option-btn {
    padding: 16px 20px;
    border-radius: 8px;
    border: 2px solid #fb6b00;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.auth-option-btn:hover {
    background: #fb6b00;
    border-color: #fb6b00;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(251, 107, 0, 0.3);
}

.auth-option-content {
    position: relative;
    z-index: 2;
}

.auth-option-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    transition: color 0.2s ease;
}

.auth-option-description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 6px;
    transition: color 0.2s ease;
    text-align: center;
}

.auth-option-btn:hover .auth-option-title {
    color: white;
}

.auth-option-btn:hover .auth-option-description {
    color: rgba(255, 255, 255, 0.9);
}

.auth-option-bonus {
    font-size: 0.85rem;
    color: white;
    background: rgba(251, 107, 0, 0.8);
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    margin-top: 8px;
    width: 240px;
    text-align: center;
}

.auth-option-btn:hover .auth-option-bonus {
    background: rgba(251, 107, 0, 0.9);
    color: white;
    border: 1px solid white;
}

/* ========================================
   USER PROFILE SECTION STYLES
   ======================================== */
.user-profile-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    margin: 0 10px;
    transition: all 0.2s ease;
}

.user-profile-section:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    border-color: #FB6B00;
}

.user-name {
    font-weight: 500;
    color: #343a40;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.profile-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #f8f9fa;
    border-radius: 4px;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.2s ease;
    border: 1px solid #dee2e6;
}

.profile-link:hover {
    background: #FB6B00;
    color: white;
    border-color: #FB6B00;
    text-decoration: none;
    transform: scale(1.1);
}

.copy-profile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.copy-profile-btn:hover {
    background: #28a745;
    color: white;
    border-color: #28a745;
    transform: scale(1.1);
}

.copy-profile-btn:active {
    transform: scale(0.95);
    background: #20c997;
}

/* Mobile responsive */
@media (max-width: 767.98px) {
    .user-profile-section {
        margin: 5px 0;
        order: 4;
        align-self: flex-start;
    }

    .user-name {
        max-width: 120px;
        font-size: 13px;
    }

    .profile-link,
    .copy-profile-btn {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
}

/* Task Image Container Styles */
.task-image-container {
    position: relative;
    display: inline-block;
    margin: 1rem auto 1rem;
    text-align: center;
    background-color: #ffffff;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    width: 100%;
    max-width: none;
}

.task-image-container:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.task-image {
    height: 100px;
    max-width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

.task-image.enlarged {
    height: 500px;
    max-width: 100%;
    object-fit: contain;
}

.image-toggle-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #dee2e6;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-toggle-btn:hover {
    background: rgba(251, 107, 0, 0.9);
    color: white;
    border-color: #FB6B00;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(251, 107, 0, 0.3);
}

.image-toggle-btn:active {
    transform: scale(0.95);
}

.expand-icon, .collapse-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    transition: all 0.2s ease;
}

/* Mobile responsive for task image */
@media (max-width: 767.98px) {
    div.task-image-container {
        margin: 1rem auto 1rem !important;
        padding: 0.75rem !important;
    }

    .task-image {
        height: 80px;
        object-fit: contain;
    }

    .task-image.enlarged {
        height: 300px;
        object-fit: contain;
    }

    .image-toggle-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
        top: 8px;
        right: 8px;
    }
}

/* Balance display content structure */
.balance-display-content {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.balance-tokens {
    display: inline-block;
}

.balance-qa-level {
    display: inline-block;
    margin-left: 12px;
}

/* Base template responsive styles */
@media (min-width: 769px) {
    .logo-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0px;
        position: relative;
    }
    
    /* Make logo slightly bigger on desktop and add margins */
    .logo-container .logo-image {
        max-width: 120px !important;
        margin-left: 20px !important;
        margin-right: 20px !important;
    }
    
    /* Position balance display relative to menu wrapper on desktop */
    .menu-wrapper {
        position: relative !important;
    }

    .balance-display {
        position: absolute !important;
        bottom: -10px !important;
        left: -55px !important;
        transform: none !important;
        order: unset !important;
        flex: unset !important;
        text-align: left !important;
        margin-top: 0 !important;
        white-space: nowrap;
        font-size: 14px !important;
        text-decoration: underline !important;
        text-decoration-color: rgba(108, 117, 125, 0.4) !important;
        text-underline-offset: 2px !important;
    }
}

/* Mobile responsive styles for balance display */
@media (max-width: 768px) {
    /* Allow balance display to wrap on narrow screens */
    .balance-display-content {
        flex-direction: column;
        white-space: normal;
        line-height: 1.2;
        gap: 8px; /* Increased from 2px to 4px for better spacing */
    }
    
    .balance-tokens {
        order: 1;
    }
    
    .balance-qa-level {
        order: 2;
        margin-left: 0;
        font-size: 13px;
    }

    
    /* Adjust balance display container for mobile */
    .balance-display {
        min-width: 90px !important;
        padding: 0 8px !important;
        text-align: center !important;
    }

    /* Full-width modal on mobile */
    #auth-modal .modal-dialog {
        max-width: 100vw !important;
        margin: 0 !important;
        width: 100% !important;
    }

    #auth-modal .modal-content {
        margin: 0 !important;
        border-radius: 0 !important;
        min-height: auto !important;
        height: auto !important;
    }
}

/* ===== FEATURE CARDS STYLES ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
    padding: 0;
}

.feature-card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: #ff8c00;
    border-radius: 0 0 2px 2px;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.feature-icon {
    background: transparent;
    color: #ff8c00;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #ff8c00;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.5rem auto;
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
}

.feature-card h3 {
    color: #2c3e50;
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    line-height: 1.3;
}

.feature-card p {
    color: #5a6c7d;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

.feature-card a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: #ff8c00;
    font-weight: 500;
}

.feature-card a:hover {
    color: inherit;
    text-decoration-color: #e67e00;
}

@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin: 1rem 0;
    }

    .feature-card {
        padding: 1.5rem;
    }

    .feature-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .feature-card h3 {
        font-size: 1.2rem;
    }
}

/* ===== HOMEPAGE NEXT BUTTON STYLES ===== */
#homepage-next-button {
    width: 250px !important;
    height: 65px !important;
    border: 4px solid #ff8c00 !important;
    border-radius: 16px !important;
    background-color: white !important;
    box-shadow: 0 0 25px rgba(255, 140, 0, 0.5) !important;
    transition: all 0.3s ease !important;
    animation: orange-glow 2s infinite !important;
    margin-bottom: 20px !important;
}

/* Thinking warning for enhanced token usage */
.thinking-warning {
    background-color: #ffebee;
    color: #c62828;
    padding: 6px 10px;
    border: 1px solid #ef9a9a;
    border-radius: 4px;
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: 0.7rem;
    text-align: left;
    display: inline-block;
    max-width: fit-content;
    cursor: help;
    position: relative;
}

.thinking-tooltip {
    position: absolute;
    bottom: 100%;
    left: 0;
    background-color: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: pre-wrap;
    max-width: 300px;
    width: max-content;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    margin-bottom: 5px;
    line-height: 1.3;
}

.thinking-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 15px;
    border: 5px solid transparent;
    border-top-color: #333;
}

.thinking-tooltip.show {
    opacity: 1;
    visibility: visible;
}

#homepage-next-button:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 0 30px rgba(255, 140, 0, 0.6) !important;
}

#homepage-next-button span {
    border-left: 20px solid #ff8c00 !important;
    border-top: 15px solid transparent !important;
    border-bottom: 15px solid transparent !important;
    animation: triangle-blink 1.5s infinite !important;
}

@keyframes orange-glow {
    0% {
        box-shadow: 0 0 20px rgba(255, 140, 0, 0.4) !important;
        border-color: #ff8c00 !important;
    }
    50% {
        box-shadow: 0 0 35px rgba(255, 140, 0, 0.8) !important;
        border-color: #ffaa33 !important;
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 140, 0, 0.4) !important;
        border-color: #ff8c00 !important;
    }
}

@keyframes triangle-blink {
    0% {
        border-left-color: #ff8c00 !important;
        opacity: 1;
    }
    50% {
        border-left-color: #ffaa33 !important;
        opacity: 0.6;
    }
    100% {
        border-left-color: #ff8c00 !important;
        opacity: 1;
    }
}
