* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1a1a1a;
    color: #eff2f6;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #282828;
    border: 1px solid #3e3e3e;
    border-radius: 8px;
    padding: 12px 14px 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    max-width: min(92vw, 480px);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    color: #ffffff;
    flex-shrink: 0;
}

.toast .toast-message {
    color: #eff2f6;
    font-size: 14px;
    font-weight: 400;
    white-space: normal;
    word-break: break-word;
    flex: 1;
}

.toast-actions {
    display: flex;
    flex-shrink: 0;
}

.toast-action-btn {
    background: #3670ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.toast-action-btn:hover {
    background: #4f80ff;
}

.toast-close {
    background: transparent;
    border: none;
    color: #9a9a9a;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    padding: 2px 4px;
    transition: color 0.15s ease;
}

.toast-close:hover {
    color: #eff2f6;
}

.navbar {
    background-color: #282828;
    border-bottom: 1px solid #3e3e3e;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    position: fixed;
    top: var(--site-banner-height, 0px);
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
}

.navbar-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 0;
    margin-right: 2px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.navbar-hamburger:hover {
    background: rgba(255, 255, 255, 0.06);
}

.navbar-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: #eff2f6;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

body.light-theme .navbar-hamburger span {
    background: #1a1a1a;
}

.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
}

.mobile-menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: #202020;
    border-right: 1px solid #3e3e3e;
    z-index: 2001;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
}

.mobile-menu.open {
    transform: translateX(0);
}

body.light-theme .mobile-menu {
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 8px 10px 16px;
    border-bottom: 1px solid #3e3e3e;
    flex-shrink: 0;
}

body.light-theme .mobile-menu-header {
    border-bottom: 1px solid #e0e0e0;
}

.mobile-menu-header .logo {
    display: flex;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    height: 44px;
}

.mobile-menu-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #b3b8bf;
    cursor: pointer;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #eff2f6;
}

.mobile-menu-body {
    flex: 1;
    padding: 12px 8px;
}

.mobile-menu-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 13px 12px;
    border-radius: 8px;
    color: #eff2f6;
    text-decoration: none;
    font-size: 15px;
    font-weight: 400;
    min-height: 44px;
}

.mobile-menu-link:hover,
.mobile-menu-link.active {
    background: rgba(255, 255, 255, 0.06);
}

body.light-theme .mobile-menu-link {
    color: #1a1a1a;
}

.mobile-menu-divider {
    height: 1px;
    background: #3e3e3e;
    margin: 10px 4px;
}

body.light-theme .mobile-menu-divider {
    background: #e0e0e0;
}

.mobile-menu-account {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid #3e3e3e;
    flex-shrink: 0;
}

body.light-theme .mobile-menu-account {
    border-top: 1px solid #e0e0e0;
}

.mobile-menu-account .navbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
}

.mobile-menu-account .navbar-username {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-menu-signin,
.mobile-menu-register {
    flex: 1;
    text-align: center;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #3e3e3e;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.light-theme .mobile-menu-signin,
body.light-theme .mobile-menu-register {
    border: 1px solid #e0e0e0;
}

body.mobile-menu-open {
    overflow: hidden;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    height: 100%;
    padding: 0;
    gap: -5px;
}

.logo-icon {
    width: 50px;
    height: 50px;
    position: relative;
    margin-right: -5px;
    background-image: url('../OTHER/iconb.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.logo-icon::before,
.logo-icon::after {
    display: none;
}

.logo-text {
    color: #eff2f6;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    align-items: center;
    height: 100%;
    margin-left: 8px;
}

.nav-link {
    color: #b3b8bf;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    padding: 0 12px;
    height: 100%;
    display: flex;
    align-items: center;
    position: relative;
    transition: color 0.15s ease;
}

.nav-link:hover {
    color: #eff2f6;
}

.nav-link.active {
    color: #ffffff;
    font-weight: 600;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #ffffff;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.btn-signin {
    color: #b3b8bf;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    padding: 6px 12px;
    border-radius: 4px;
    transition: color 0.15s ease;
    cursor: pointer;
    border: none;
    background: transparent;
}

.btn-signin:hover {
    color: #eff2f6;
}

.btn-register {
    color: #b3b8bf;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    padding: 6px 12px;
    border-radius: 4px;
    transition: color 0.15s ease;
    cursor: pointer;
    border: none;
    background: transparent;
}

.btn-register:hover {
    color: #eff2f6;
}

.main-content {
    margin: 0;
    padding: 0;
    display: flex;
    min-height: calc(100vh - 50px);
    position: relative;
    padding-top: calc(50px + var(--site-banner-height, 0px));
    margin-left: 200px;
}

.sidebar {
    position: fixed;
    top: calc(50px + var(--site-banner-height, 0px));
    left: 0;
    bottom: 0;
    width: 200px;
    flex-shrink: 0;
    background: #282828;
    border-right: 1px solid #3e3e3e;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 0;
    border-right: none;
}

.sidebar.collapsed .sidebar-nav,
.sidebar.collapsed .sidebar-history {
    opacity: 0;
    pointer-events: none;
}

.sidebar-nav {
    padding: 8px;
    transition: opacity 0.2s ease;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    color: #b3b8bf;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.sidebar-nav-item:hover {
    color: #eff2f6;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav-item.active {
    color: #eff2f6;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-icon {
    flex-shrink: 0;
    color: #b3b8bf;
    transition: color 0.15s ease;
}

.sidebar-nav-item:hover .sidebar-icon {
    color: #eff2f6;
}

.sidebar-nav-item.active .sidebar-icon {
    color: #eff2f6;
}

.sidebar-history {
    margin-top: 16px;
    padding: 12px 8px 0;
    border-top: 1px solid #3e3e3e;
    transition: opacity 0.2s ease;
}

.sidebar-history-title {
    font-size: 12px;
    font-weight: 600;
    color: #8a8f98;
    margin-bottom: 6px;
    padding: 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.sidebar-history-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-history-check {
    flex-shrink: 0;
    color: #00c896;
}

.sidebar-history-link {
    color: #b3b8bf;
    text-decoration: none;
    font-size: 12px;
    transition: color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-history-item:hover .sidebar-history-link {
    color: #eff2f6;
}

.sidebar-login-message {
    font-size: 12px;
    color: #8a8f98;
    line-height: 1.4;
    margin-bottom: 12px;
    padding: 0 12px;
}

.sidebar-signin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 12px;
    height: 32px;
    border: 1px solid #3e3e3e;
    border-radius: 6px;
    color: #eff2f6;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.sidebar-signin-btn:hover {
    color: #ffffff;
    border-color: #555;
    background: #2f2f2f;
}

.sidebar-collapse-btn {
    position: fixed;
    top: calc(60px + var(--site-banner-height, 0px));
    left: 200px;
    width: 24px;
    height: 24px;
    background: #282828;
    border: 1px solid #3e3e3e;
    border-radius: 50%;
    color: #b3b8bf;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    padding: 0;
}

.sidebar-collapse-btn:hover {
    color: #eff2f6;
    border-color: #555;
    background: #2f2f2f;
}

.sidebar:hover + .sidebar-collapse-btn,
.sidebar-collapse-btn:hover {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-collapse-btn.show-near-edge {
    opacity: 1;
    pointer-events: auto;
}

.content-area {
    flex: 1;
    min-width: 0;
    padding: 20px;
}

.hero-section {
    text-align: center;
    padding: 60px 0;
}

.hero-title {
    font-size: 32px;
    font-weight: 500;
    color: #eff2f6;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: 14px;
    color: #b3b8bf;
    margin-bottom: 32px;
    line-height: 1.6;
}

.cta-button {
    display: inline-block;
    background: #ffffff;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.cta-button:hover {
    background: #e0e0e0;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-top: 60px;
    padding: 30px 0;
    border-top: 1px solid #3e3e3e;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 24px;
    font-weight: 500;
    color: #eff2f6;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: #8a8f98;
}

.page-title {
    font-size: 24px;
    font-weight: 500;
    color: #eff2f6;
    margin-bottom: 24px;
    letter-spacing: -0.3px;
}

.page-description {
    font-size: 14px;
    color: #b3b8bf;
    margin-bottom: 32px;
    line-height: 1.6;
}

.problems-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.problems-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-input {
    background: #282828;
    color: #eff2f6;
    border: 1px solid #3e3e3e;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    width: 250px;
    transition: border-color 0.15s ease;
}

.search-input:focus {
    border-color: #ffffff;
}

.filter-select {
    background: #282828;
    color: #eff2f6;
    border: 1px solid #3e3e3e;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease;
}

.filter-select:focus {
    border-color: #ffffff;
}

.problems-table {
    width: 100%;
    border-collapse: collapse;
    background: #282828;
    border-radius: 8px;
    overflow: hidden;
}

.problems-table thead {
    background: #2a2a2a;
    border-bottom: 1px solid #3e3e3e;
}

.problems-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #8a8f98;
    border-bottom: 1px solid #3e3e3e;
}

.problems-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: #eff2f6;
    border-bottom: 1px solid #2a2a2a;
}

.problems-table tbody tr {
    transition: background 0.15s ease;
    cursor: pointer;
}

.problems-table tbody tr:hover {
    background: #2f2f2f;
}

.problems-table tbody tr:last-child td {
    border-bottom: none;
}

.problem-link {
    color: #eff2f6;
    text-decoration: none;
    transition: color 0.15s ease;
}

.problem-link:hover {
    color: #ffffff;
}

.difficulty {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
}

.difficulty.easy {
    color: #00c896;
    background: rgba(0, 200, 150, 0.15);
}

.difficulty.medium {
    color: #ffa116;
    background: rgba(255, 161, 22, 0.1);
}

.difficulty.hard {
    color: #ff375f;
    background: rgba(255, 55, 95, 0.1);
}

.difficulty.olympiad {
    color: #a970ff;
    background: rgba(169, 112, 255, 0.12);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.page-btn {
    background: #282828;
    color: #b3b8bf;
    border: 1px solid #3e3e3e;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.page-btn:hover {
    color: #eff2f6;
    border-color: #555;
}

.page-btn.active {
    background: #ffffff;
    color: #1a1a1a;
    border-color: #ffffff;
}

.settings-container {
    max-width: 600px;
}

.settings-section {
    background: #282828;
    border: 1px solid #3e3e3e;
    border-radius: 8px;
    padding: 20px;
}

.settings-title {
    font-size: 16px;
    font-weight: 500;
    color: #eff2f6;
    margin-bottom: 16px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-label {
    font-size: 14px;
    font-weight: 500;
    color: #eff2f6;
}

.setting-description {
    font-size: 13px;
    color: #8a8f98;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #3e3e3e;
    border-radius: 24px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: #ffffff;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 50px - var(--site-banner-height, 0px));
    margin-top: var(--site-banner-height, 0px);
    padding: 20px;
}

.auth-card {
    background: #282828;
    border: 1px solid #3e3e3e;
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.auth-title {
    font-size: 24px;
    font-weight: 500;
    color: #eff2f6;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.auth-subtitle {
    font-size: 14px;
    color: #8a8f98;
    margin-bottom: 24px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: #b3b8bf;
}

.form-input {
    background: #1a1a1a;
    border: 1px solid #3e3e3e;
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 14px;
    color: #eff2f6;
    outline: none;
    transition: border-color 0.15s ease;
}

.form-input:focus {
    border-color: #ffffff;
}

.form-input::placeholder {
    color: #666;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.checkbox-input {
    width: 16px;
    height: 16px;
    accent-color: #ffffff;
    cursor: pointer;
}

.checkbox-label {
    font-size: 13px;
    color: #b3b8bf;
}

.form-link {
    color: #4da3ff;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.15s ease;
}

.form-link:hover {
    color: #80bfff;
}

.auth-btn {
    background: #ffffff;
    color: #1a1a1a;
    border: none;
    border-radius: 4px;
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.auth-btn:hover {
    background: #e0e0e0;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #666;
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #3e3e3e;
}

.auth-footer {
    text-align: center;
    font-size: 13px;
    color: #8a8f98;
}

.rules-content {
    max-width: 800px;
}

.rules-content h2 {
    font-size: 20px;
    font-weight: 500;
    color: #eff2f6;
    margin-top: 24px;
    margin-bottom: 12px;
}

.rules-content h3 {
    font-size: 16px;
    font-weight: 500;
    color: #eff2f6;
    margin-top: 16px;
    margin-bottom: 8px;
}

.rules-content p {
    font-size: 14px;
    color: #b3b8bf;
    line-height: 1.6;
    margin-bottom: 8px;
}

.rules-content a {
    color: #4da3ff;
    text-decoration: none;
    transition: color 0.15s ease;
}

.rules-content a:hover {
    color: #80bfff;
}

body.light-theme {
    background-color: #f5f5f5;
    color: #1a1a1a;
}

body.light-theme .navbar {
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
}

body.light-theme .logo-icon {
    background-image: url('../OTHER/iconw.png');
}

body.light-theme .logo-text {
    color: #1a1a1a;
}

body.light-theme .nav-link {
    color: #666;
}

body.light-theme .nav-link:hover {
    color: #1a1a1a;
}

body.light-theme .nav-link.active {
    color: #1a1a1a;
}

body.light-theme .nav-link.active::after {
    background: #1a1a1a;
}

body.light-theme .btn-signin {
    color: #666;
}

body.light-theme .btn-signin:hover {
    color: #1a1a1a;
}

body.light-theme .btn-register {
    color: #666;
}

body.light-theme .btn-register:hover {
    color: #1a1a1a;
}

body.light-theme .sidebar {
    background-color: #ffffff;
    border-right: 1px solid #e0e0e0;
}

body.light-theme .sidebar-nav-item {
    color: #666;
}

body.light-theme .sidebar-nav-item:hover {
    color: #1a1a1a;
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .sidebar-nav-item.active {
    color: #1a1a1a;
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .sidebar-icon {
    color: #666;
}

body.light-theme .sidebar-nav-item:hover .sidebar-icon {
    color: #1a1a1a;
}

body.light-theme .sidebar-nav-item.active .sidebar-icon {
    color: #1a1a1a;
}

body.light-theme .sidebar-history {
    border-top: 1px solid #e0e0e0;
}

body.light-theme .sidebar-history-title {
    color: #888;
}

body.light-theme .sidebar-history-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .sidebar-history-link {
    color: #666;
}

body.light-theme .sidebar-history-item:hover .sidebar-history-link {
    color: #1a1a1a;
}

body.light-theme .sidebar-history-check {
    color: #00b894;
}

body.light-theme .sidebar-login-message {
    color: #888;
}

body.light-theme .sidebar-signin-btn {
    color: #1a1a1a;
    border-color: #e0e0e0;
}

body.light-theme .sidebar-signin-btn:hover {
    border-color: #ccc;
    background: #f0f0f0;
}

body.light-theme .sidebar-collapse-btn {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    color: #666;
}

body.light-theme .sidebar-collapse-btn:hover {
    color: #1a1a1a;
    border-color: #ccc;
    background: #f0f0f0;
}

body.light-theme .problems-table {
    background: #ffffff;
}

body.light-theme .problems-table thead {
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
}

body.light-theme .problems-table th {
    color: #666;
    border-bottom: 1px solid #e0e0e0;
}

body.light-theme .problems-table td {
    color: #1a1a1a;
    border-bottom: 1px solid #f0f0f0;
}

body.light-theme .problems-table tbody tr:hover {
    background: #f5f5f5;
}

body.light-theme .problem-link {
    color: #1a1a1a;
}

body.light-theme .problem-link:hover {
    color: #1a1a1a;
}

body.light-theme .search-input,
body.light-theme .filter-select {
    background: #ffffff;
    color: #1a1a1a;
    border: 1px solid #e0e0e0;
}

body.light-theme .search-input:focus,
body.light-theme .filter-select:focus {
    border-color: #1a1a1a;
}

body.light-theme .page-title {
    color: #1a1a1a;
}

body.light-theme .page-description {
    color: #666;
}

body.light-theme .hero-title {
    color: #1a1a1a;
}

body.light-theme .hero-subtitle {
    color: #666;
}

body.light-theme .stat-number {
    color: #1a1a1a;
}

body.light-theme .stat-label {
    color: #888;
}

body.light-theme .stats {
    border-top: 1px solid #e0e0e0;
}

body.light-theme .toast {
    background: #ffffff;
    border: 1px solid #e0e0e0;
}

body.light-theme .toast .toast-message {
    color: #1a1a1a;
}

body.light-theme .toast-icon {
    color: #1a1a1a;
}

body.light-theme .toast-close {
    color: #7a7a7a;
}

body.light-theme .toast-close:hover {
    color: #1a1a1a;
}

body.light-theme .page-btn {
    background: #ffffff;
    color: #666;
    border: 1px solid #e0e0e0;
}

body.light-theme .page-btn:hover {
    color: #1a1a1a;
    border-color: #ccc;
}

body.light-theme .page-btn.active {
    background: #1a1a1a;
    color: #ffffff;
    border-color: #1a1a1a;
}

body.light-theme .settings-section {
    background: #ffffff;
    border: 1px solid #e0e0e0;
}

body.light-theme .settings-title {
    color: #1a1a1a;
}

body.light-theme .setting-label {
    color: #1a1a1a;
}

body.light-theme .setting-description {
    color: #888;
}

body.light-theme .toggle-slider {
    background: #e0e0e0;
}

body.light-theme .toggle-slider::before {
    background: #ffffff;
}

body.light-theme .toggle-switch input:checked + .toggle-slider {
    background: #1a1a1a;
}

body.light-theme .auth-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
}

body.light-theme .auth-title {
    color: #1a1a1a;
}

body.light-theme .auth-subtitle {
    color: #888;
}

body.light-theme .form-label {
    color: #666;
}

body.light-theme .form-input {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    color: #1a1a1a;
}

body.light-theme .form-input:focus {
    border-color: #1a1a1a;
}

body.light-theme .form-input::placeholder {
    color: #999;
}

body.light-theme .checkbox-label {
    color: #666;
}

body.light-theme .form-link {
    color: #0066cc;
}

body.light-theme .form-link:hover {
    color: #004d99;
}

body.light-theme .auth-btn {
    background: #1a1a1a;
    color: #ffffff;
}

body.light-theme .auth-btn:hover {
    background: #333;
}

body.light-theme .auth-divider {
    color: #999;
}

body.light-theme .auth-divider::before,
body.light-theme .auth-divider::after {
    background: #e0e0e0;
}

body.light-theme .auth-footer {
    color: #888;
}

body.light-theme .rules-content h2,
body.light-theme .rules-content h3 {
    color: #1a1a1a;
}

body.light-theme .rules-content p {
    color: #666;
}

body.light-theme .rules-content a {
    color: #0066cc;
}

body.light-theme .rules-content a:hover {
    color: #004d99;
}

.btn-logout {
    background: transparent;
    border: none;
    color: #b3b8bf;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    transition: color 0.15s ease;
    display: flex;
    align-items: center;
}

.btn-logout:hover {
    color: #ff375f;
}

body.light-theme .btn-logout {
    color: #666;
}

body.light-theme .btn-logout:hover {
    color: #ff375f;
}

.auth-btn-github {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #24292e;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
    width: 100%;
}

.auth-btn-github:hover {
    background: #2f363d;
}

body.light-theme .auth-btn-github {
    background: #24292e;
    color: #ffffff;
}

body.light-theme .auth-btn-github:hover {
    background: #2f363d;
}

.trial-task-card {
    background: #282828;
    border: 1px solid #3e3e3e;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
}

.trial-task-card h2 {
    font-size: 18px;
    font-weight: 500;
    color: #eff2f6;
    margin-bottom: 12px;
}

.trial-task-card p {
    font-size: 14px;
    color: #b3b8bf;
    margin-bottom: 16px;
}

body.light-theme .trial-task-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
}

body.light-theme .trial-task-card h2 {
    color: #1a1a1a;
}

body.light-theme .trial-task-card p {
    color: #666;
}

.trial-rules-card {
    background: #282828;
    border: 1px solid #3e3e3e;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
}

.trial-rules-card p {
    font-size: 14px;
    color: #b3b8bf;
    margin-bottom: 12px;
}

.trial-rules-list {
    list-style: none;
    padding: 0;
    margin-bottom: 16px;
}

.trial-rules-list li {
    font-size: 14px;
    color: #eff2f6;
    padding: 8px 0;
    border-bottom: 1px solid #3e3e3e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.trial-rules-list li::before {
    content: '•';
    color: #ff375f;
    font-size: 18px;
}

.trial-warning {
    color: #ff375f !important;
    font-size: 13px !important;
    margin-bottom: 16px !important;
}

.trial-timer {
    font-size: 48px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    margin-bottom: 16px;
}

body.light-theme .trial-rules-card,
body.light-theme .trial-task-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
}

body.light-theme .trial-rules-card p,
body.light-theme .trial-task-card p {
    color: #666;
}

body.light-theme .trial-rules-list li {
    color: #1a1a1a;
    border-bottom: 1px solid #e0e0e0;
}

body.light-theme .trial-timer {
    color: #1a1a1a;
}

body.light-theme .trial-task-card h2 {
    color: #1a1a1a;
}

.trial-tools {
    margin-top: 20px;
    max-width: none;
}

.tool-window {
    position: fixed;
    min-width: 300px;
    min-height: 200px;
    z-index: 100;
    background: #282828;
    border: 1px solid #3e3e3e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.tool-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #1a1a1a;
    cursor: move;
    user-select: none;
    border-bottom: 1px solid #3e3e3e;
}

.tool-window-title {
    font-size: 13px;
    color: #b3b8bf;
    font-weight: 500;
}

.tool-window-close {
    background: transparent;
    border: none;
    color: #b3b8bf;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.tool-window-close:hover {
    color: #ff375f;
    background: rgba(255, 55, 95, 0.1);
}

.tool-window-content {
    height: calc(100% - 37px);
    display: flex;
    flex-direction: column;
}

#paintWindow {
    width: 600px;
    height: 400px;
    top: 100px;
    left: 100px;
}

#notepadWindow {
    width: 350px;
    height: 350px;
    top: 150px;
    left: 200px;
}

#paintCanvas {
    flex: 1;
    border: none;
    border-radius: 0;
    cursor: crosshair;
    width: 100%;
    height: calc(100% - 45px);
}

.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: se-resize;
}

.resize-handle::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 10px;
    height: 10px;
    border-right: 2px solid #555;
    border-bottom: 2px solid #555;
}

body.light-theme .tool-window {
    background: #ffffff;
    border: 1px solid #e0e0e0;
}

body.light-theme .tool-window-header {
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}

body.light-theme .tool-window-title {
    color: #666;
}

.tool-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.tool-tab {
    background: #282828;
    border: 1px solid #3e3e3e;
    color: #b3b8bf;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s ease;
}

.tool-tab:hover {
    color: #eff2f6;
    border-color: #555;
}

.tool-tab.active {
    background: #ffffff;
    color: #1a1a1a;
    border-color: #ffffff;
}

.tool-panel {
    display: none;
}

.tool-panel.active {
    display: block;
}

.paint-toolbar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    align-items: center;
}

.paint-btn {
    background: #282828;
    border: 1px solid #3e3e3e;
    color: #b3b8bf;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    transition: all 0.15s ease;
}

.paint-btn:hover {
    border-color: #555;
}

.paint-btn.active {
    border-color: #ffffff;
}

#paintCanvas {
    border: 1px solid #3e3e3e;
    border-radius: 4px;
    cursor: crosshair;
    width: 100%;
    height: auto;
}

#notepad {
    width: 100%;
    height: 300px;
    background: #1a1a1a;
    border: 1px solid #3e3e3e;
    border-radius: 4px;
    color: #eff2f6;
    padding: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    resize: none;
    outline: none;
}

#notepad:focus {
    border-color: #ffffff;
}

body.light-theme .tool-tab {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    color: #666;
}

body.light-theme .tool-tab:hover {
    color: #1a1a1a;
    border-color: #ccc;
}

body.light-theme .tool-tab.active {
    background: #1a1a1a;
    color: #ffffff;
    border-color: #1a1a1a;
}

body.light-theme .paint-btn {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    color: #666;
}

body.light-theme .paint-btn:hover {
    border-color: #ccc;
}

body.light-theme #paintCanvas {
    border: 1px solid #e0e0e0;
}

body.light-theme #notepad {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    color: #1a1a1a;
}

.profile-ban {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 55, 95, 0.1);
    border: 1px solid rgba(255, 55, 95, 0.3);
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 20px;
    width: fit-content;
}

.profile-ban-text {
    color: #ff375f;
    font-size: 13px;
    font-weight: 500;
}

.profile-ban-link {
    color: #ff375f;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
}

.profile-ban-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.profile-ban-details {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #282828;
    border: 1px solid #3e3e3e;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
    color: #b3b8bf;
    z-index: 10;
    min-width: 250px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.profile-ban-tooltip:hover .profile-ban-details {
    display: block;
}

body.light-theme .profile-ban {
    background: rgba(255, 55, 95, 0.05);
    border: 1px solid rgba(255, 55, 95, 0.2);
}

body.light-theme .profile-ban-text,
body.light-theme .profile-ban-link {
    color: #ff375f;
}

body.light-theme .profile-ban-details {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    color: #666;
}

.profile-header {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    align-items: center;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: #00b8a9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
}

.profile-username {
    font-size: 24px;
    font-weight: 500;
    color: #eff2f6;
    margin-bottom: 4px;
}

.profile-description {
    font-size: 14px;
    color: #b3b8bf;
}

.profile-stats {
    display: flex;
    gap: 40px;
}

.profile-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-stat-value {
    font-size: 20px;
    font-weight: 600;
    color: #eff2f6;
}

.profile-stat-label {
    font-size: 13px;
    color: #8a8f98;
}

body.light-theme .profile-username {
    color: #1a1a1a;
}

body.light-theme .profile-description {
    color: #666;
}

body.light-theme .profile-stat-value {
    color: #1a1a1a;
}

body.light-theme .profile-stat-label {
    color: #888;
}

.navbar-user {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.navbar-user:hover {
    opacity: 0.8;
}

.navbar-avatar {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.navbar-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3e3e3e;
    color: #eff2f6;
    font-size: 13px;
    font-weight: 600;
}

.navbar-username {
    font-size: 14px;
    color: #eff2f6;
    font-weight: 500;
    text-decoration: none;
}

body.light-theme .navbar-username {
    color: #1a1a1a;
}

.activity-grid {
    display: grid;
    grid-template-columns: repeat(53, 1fr);
    grid-template-rows: repeat(7, 1fr);
    gap: 4px;
    max-width: 800px;
    grid-auto-flow: column;
}

.activity-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.1s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 12px;
    min-height: 12px;
}

.activity-cell:hover {
    transform: scale(1.4);
    border-color: rgba(255, 255, 255, 0.3);
}

.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    background: #3b82f6;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    padding: 0 5px;
    margin-left: auto;
    line-height: 1;
}

body.light-theme .notification-badge {
    background: #3b82f6;
    color: #ffffff;
}

/* ===== Планшеты и мобильные: навигация ===== */
@media (max-width: 900px) {
    .nav-links {
        display: none;
    }

    .navbar-hamburger {
        display: flex;
    }

    /* Сайдбар превращается в выезжающее меню (см. .mobile-menu),
       поэтому фиксированную колонку убираем с обычного потока. */
    .sidebar,
    .sidebar-collapse-btn {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .navbar-username {
        max-width: 110px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (min-width: 901px) {
    .mobile-menu,
    .mobile-menu-overlay {
        display: none !important;
    }
}

/* ===== Общая адаптивная сетка контента ===== */
@media (max-width: 900px) {
    body .content-area {
        padding: 16px !important;
    }

    body .settings-container,
    body .create-task-container,
    body .stats-container,
    body .discuss-container,
    body .post-container,
    body .rules-content {
        max-width: 100% !important;
    }

    .hero-section {
        padding: 48px 16px !important;
    }

    .hero-section h1,
    body .hero-title {
        font-size: 28px !important;
    }

    .hero-section p {
        font-size: 14px !important;
    }

    .features-section {
        padding: 40px 16px !important;
    }

    .features-section h2 {
        font-size: 24px !important;
    }

    .stats {
        gap: 24px;
        flex-wrap: wrap;
    }

    .problems-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-input {
        width: 100%;
    }

    .tasks-header,
    .search-row {
        flex-wrap: wrap;
    }

    .search-row-left {
        width: 100%;
    }

    .search-wrapper {
        width: 100%;
    }

    /* Профиль: не даём шапке и статистике вылезать за экран */
    body .profile-header {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
        gap: 14px;
    }

    body .profile-info {
        order: 2;
        width: 100%;
        text-align: center;
    }

    body .faceit-level-container {
        order: 1;
        margin-left: 0;
    }

    body .profile-stats {
        flex-wrap: wrap;
        gap: 20px 32px;
        justify-content: center;
        text-align: center;
    }

    body .profile-stat {
        align-items: center;
    }

    /* График активности: горизонтальный скролл вместо сжатия в кашу */
    body .profile-activity {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
    }

    body .activity-grid {
        min-width: 640px;
    }

    .setting-item {
        gap: 12px;
    }

    .setting-info {
        flex: 1;
        min-width: 0;
    }

    .toggle-switch {
        flex-shrink: 0;
    }

    body .auth-card {
        padding: 28px 20px;
    }

    .charts-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 20px;
    }

    body .profile-avatar {
        width: 64px;
        height: 64px;
    }

    body .faceit-level-container {
        width: 76px;
        height: 76px;
    }

    body .profile-username {
        font-size: 20px;
    }

    .task-item {
        flex-wrap: wrap;
        gap: 10px !important;
    }

    .task-right {
        width: 100%;
        justify-content: space-between !important;
    }
}

/* ===== Плавающие инструменты (Paint / Блокнот / Калькулятор) ===== */
@media (max-width: 700px) {
    .tool-window {
        width: min(94vw, 420px) !important;
        height: min(70vh, 480px) !important;
        top: 56px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        max-width: 94vw;
        max-height: 78vh;
    }

    .resize-handle {
        display: none;
    }
}

.faceit-level-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin-left: auto;
    flex-shrink: 0;
}

.progress-ring {
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.progress-ring__background {
    stroke: #222222;
}

.progress-ring__circle {
    stroke: #ff5500;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.35s ease-in-out;
}

.level-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #ffffff;
}

.level-number {
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
}

.level-label {
    font-size: 10px;
    color: #8a8a8a;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

body.light-theme .progress-ring__background {
    stroke: #e0e0e0;
}

body.light-theme .level-number {
    color: #1a1a1a;
}

body.light-theme .level-label {
    color: #888;
}

body.light-theme .profile-level-progress-bar {
    background: #e0e0e0;
}

body.light-theme .profile-activity-title {
    color: #1a1a1a;
}

body.light-theme .activity-cell {
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-theme .activity-cell:hover {
    border-color: rgba(0, 0, 0, 0.2);
}

html.app-gate-pending .content-area { visibility: hidden; }
html.app-gate-pending .navbar { visibility: visible; }
html.app-gate-pending body { overflow-x: hidden; }
.navbar-right.navbar-loading { visibility: hidden; }
.navbar-right.navbar-ready { visibility: visible; }
.site-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    width: 100%;
    padding: 10px 16px;
    background: #2f6fed;
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    box-sizing: border-box;
}

/* ===== Общая модалка confirm()/prompt() вместо нативных браузерных ===== */
.site-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.68);
    backdrop-filter: blur(2px);
}

.site-modal-overlay.open {
    display: flex;
}

.site-modal-window {
    position: relative;
    width: 100%;
    max-width: 440px;
    box-sizing: border-box;
    background: #282828;
    border: 1px solid #454545;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    animation: siteModalShow 0.16s ease-out;
}

@keyframes siteModalShow {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.site-modal-header {
    padding: 18px 20px 4px;
}

.site-modal-title {
    margin: 0;
    color: #f1f3f5;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.site-modal-body {
    padding: 10px 20px 4px;
}

.site-modal-message {
    color: #c2c6cc;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin: 0 0 10px;
}

.site-modal-input {
    width: 100%;
    box-sizing: border-box;
    background: #1f1f1f;
    border: 1px solid #454545;
    border-radius: 6px;
    color: #eff2f6;
    font-size: 14px;
    font-family: inherit;
    padding: 10px 12px;
    resize: vertical;
}

.site-modal-input:focus {
    outline: none;
    border-color: #3670ff;
}

.site-modal-error {
    color: #ff6b6b;
    font-size: 12px;
    margin-top: 6px;
    min-height: 14px;
}

.site-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px 20px;
}

.site-modal-btn {
    border: none;
    border-radius: 6px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.site-modal-btn-cancel {
    background: #3a3a3a;
    color: #eff2f6;
}

.site-modal-btn-cancel:hover {
    background: #454545;
}

.site-modal-btn-confirm {
    background: #3670ff;
    color: #fff;
}

.site-modal-btn-confirm:hover {
    background: #4f80ff;
}

.site-modal-btn-confirm.danger {
    background: #e5484d;
}

.site-modal-btn-confirm.danger:hover {
    background: #ff5c60;
}

body.light-theme .site-modal-window {
    background: #ffffff;
    border-color: #e0e0e0;
}

body.light-theme .site-modal-title {
    color: #1a1a1a;
}

body.light-theme .site-modal-message {
    color: #444444;
}

body.light-theme .site-modal-input {
    background: #f5f5f5;
    border-color: #dddddd;
    color: #1a1a1a;
}

body.light-theme .site-modal-btn-cancel {
    background: #eaeaea;
    color: #1a1a1a;
}

body.light-theme .site-modal-btn-cancel:hover {
    background: #dcdcdc;
}

.profile-badge{display:inline-flex;align-items:center;padding:3px 8px;border:1px solid #555;border-radius:999px;font-size:11px;font-weight:600}

.navbar-search {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
    padding: 0 10px;
}

.navbar-lang-switch {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #3e3e3e;
    border-radius: 17px;
    padding: 3px;
    margin-right: 12px;
    flex-shrink: 0;
}

.navbar-lang-btn {
    background: transparent;
    border: none;
    color: #9a9a9a;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 5px 10px;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.navbar-lang-btn:hover {
    color: #eff2f6;
}

.navbar-lang-btn.active {
    background: #3670ff;
    color: #fff;
}

body.light-theme .navbar-lang-switch {
    background: #f0f2f5;
    border-color: #e0e0e0;
}

body.light-theme .navbar-lang-btn {
    color: #6a6a6a;
}

body.light-theme .navbar-lang-btn.active {
    color: #fff;
}

@media (max-width: 900px) {
    .navbar-lang-switch {
        margin-right: 6px;
    }
}

.navbar-search-box {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 160px;
    height: 34px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #3e3e3e;
    border-radius: 17px;
    padding: 0 12px;
    cursor: text;
    transition: width 0.25s ease, background 0.2s ease, border-color 0.2s ease, border-radius 0.2s ease;
}

.navbar-search-box:hover {
    border-color: #555;
}

.navbar-search.active .navbar-search-box {
    width: min(420px, 55vw);
    background: #1f1f1f;
    border-color: #ffffff;
}

.navbar-search-icon {
    flex-shrink: 0;
    color: #8a8f98;
}

.navbar-search-placeholder-text {
    color: #8a8f98;
    font-size: 14px;
    white-space: nowrap;
}

.navbar-search.active .navbar-search-placeholder-text {
    display: none;
}

.navbar-search-input {
    display: none;
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: #eff2f6;
    font-size: 14px;
}

.navbar-search-input::placeholder {
    color: #8a8f98;
}

.navbar-search.active .navbar-search-input {
    display: block;
}

.navbar-search-clear {
    flex-shrink: 0;
    display: none;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #b3b8bf;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}

.navbar-search-clear.show {
    display: flex;
}

.navbar-search-clear:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #eff2f6;
}

.navbar-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #282828;
    border: 1px solid #3e3e3e;
    border-radius: 10px;
    padding: 8px;
    max-height: 60vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 1200;
}

.navbar-search-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.navbar-search-section + .navbar-search-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #3e3e3e;
}

.navbar-search-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8a8f98;
    padding: 4px 8px;
}

.navbar-search-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    color: #eff2f6;
    text-decoration: none;
    font-size: 13px;
}

.navbar-search-result:hover {
    background: rgba(255, 255, 255, 0.06);
}

.navbar-search-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.navbar-search-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3e3e3e;
    color: #eff2f6;
    font-size: 12px;
    font-weight: 600;
}

.navbar-search-result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 12px;
    flex-shrink: 0;
}

.navbar-search-loading,
.navbar-search-empty {
    padding: 14px 8px;
    text-align: center;
    font-size: 13px;
    color: #8a8f98;
}

body.light-theme .navbar-search-box {
    background: rgba(0, 0, 0, 0.04);
    border-color: #e0e0e0;
}

body.light-theme .navbar-search.active .navbar-search-box {
    background: #ffffff;
    border-color: #1a1a1a;
}

body.light-theme .navbar-search-input {
    color: #1a1a1a;
}

body.light-theme .navbar-search-dropdown {
    background: #ffffff;
    border-color: #e0e0e0;
}

body.light-theme .navbar-search-result {
    color: #1a1a1a;
}

body.light-theme .navbar-search-result:hover {
    background: rgba(0, 0, 0, 0.05);
}

@media (max-width: 900px) {
    .navbar-search {
        flex: 0 0 auto;
        padding: 0 4px;
    }

    .navbar-search-box {
        width: 34px;
        overflow: hidden;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }

    .navbar-search-box .navbar-search-placeholder-text,
    .navbar-search-box .navbar-search-input {
        display: none;
    }

    .navbar-search.active .navbar-search-box {
        position: fixed;
        top: calc(8px + var(--site-banner-height, 0px));
        left: 8px;
        right: 8px;
        width: auto;
        overflow: visible;
        border-radius: 17px;
        z-index: 1300;
        padding: 0 12px;
        justify-content: flex-start;
    }

    .navbar-search.active .navbar-search-box .navbar-search-input {
        display: block;
    }
}

.navbar-account {
    position: relative;
    margin-right: 4px;
}

.navbar-account-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    background: #282828;
    border: 1px solid #3e3e3e;
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 1200;
}

.navbar-account-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.navbar-account-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
}

.navbar-account-profile:hover {
    background: rgba(255, 255, 255, 0.06);
}

.navbar-account-avatar-lg {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.navbar-account-avatar-lg-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3e3e3e;
    color: #eff2f6;
    font-weight: 600;
}

.navbar-account-name {
    font-size: 14px;
    font-weight: 600;
    color: #eff2f6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 170px;
}

.navbar-account-sub {
    font-size: 12px;
    color: #8a8f98;
}

.navbar-account-divider {
    height: 1px;
    background: #3e3e3e;
    margin: 6px 4px;
}

.navbar-account-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.navbar-account-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: #eff2f6;
    text-decoration: none;
    font-size: 13px;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.navbar-account-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.navbar-account-item svg {
    flex-shrink: 0;
    color: #b3b8bf;
}

.navbar-account-item-badge {
    margin-left: auto;
}

.navbar-account-theme {
    cursor: default;
}

.navbar-account-theme:hover {
    background: transparent;
}

.theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 44px;
    height: 24px;
    margin-left: auto;
    cursor: pointer;
    flex-shrink: 0;
}

.theme-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-toggle-track {
    position: relative;
    width: 100%;
    height: 100%;
    background: #3e3e3e;
    border-radius: 24px;
    transition: background 0.3s ease;
}

.theme-toggle-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    transition: opacity 0.2s ease;
}

.theme-toggle-icon-moon {
    left: 5px;
    color: #cfd6de;
    opacity: 1;
}

.theme-toggle-icon-sun {
    right: 5px;
    color: #ffcf5c;
    opacity: 0.35;
}

.theme-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
    z-index: 1;
}

.theme-toggle input:checked ~ .theme-toggle-track {
    background: #bcd4ff;
}

.theme-toggle input:checked ~ .theme-toggle-track .theme-toggle-thumb {
    transform: translateX(20px);
}

.theme-toggle input:checked ~ .theme-toggle-track .theme-toggle-icon-sun {
    opacity: 1;
}

.theme-toggle input:checked ~ .theme-toggle-track .theme-toggle-icon-moon {
    opacity: 0.35;
}

body.light-theme .theme-toggle-track {
    background: #e0e0e0;
}

.navbar-account-logout {
    color: #ff6b6b;
}

.navbar-account-logout svg {
    color: #ff6b6b;
}

.navbar-account-logout:hover {
    background: rgba(255, 55, 95, 0.1);
}

body.light-theme .navbar-account-menu {
    background: #ffffff;
    border-color: #e0e0e0;
}

body.light-theme .navbar-account-item,
body.light-theme .navbar-account-name {
    color: #1a1a1a;
}

body.light-theme .navbar-account-sub {
    color: #666;
}

body.light-theme .navbar-account-divider {
    background: #e0e0e0;
}

.error-code-badge {
    display: inline-block;
    padding: 4px 14px;
    margin-bottom: 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #ff375f;
    background: rgba(255, 55, 95, 0.12);
    border: 1px solid rgba(255, 55, 95, 0.3);
}

body.light-theme .error-code-badge {
    color: #d9364f;
    background: rgba(217, 54, 79, 0.08);
    border-color: rgba(217, 54, 79, 0.25);
}
