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

:root {
    /* Светлая тема с красно-розовыми акцентами */
    --bg-dark: #ffffff;
    --bg-darker: #f8f9fa;
    --bg-card: #f0f0f0;
    --bg-secondary: #e9ecef;
    --border-color: #dee2e6;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --accent-primary: #c40552;
    --accent-secondary: #e4735c;
    --accent-hover: #a00442;
    --success: #28a745;
    --danger: #dc3545;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    position: relative; /* create stacking context for overlays */
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1; /* grid above vignette, below content */
    background:
        /* grid */
        linear-gradient(0deg, rgba(0,0,0,0.03) 1px, transparent 1px) repeat-y,
        linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px) repeat-x,
        /* glows under the grid - красно-розовые */
        radial-gradient(1200px 800px at 10% -10%, rgba(196,5,82,0.04), transparent 60%),
        radial-gradient(1200px 800px at 120% 110%, rgba(228,115,92,0.03), transparent 60%);
    background-size: 24px 24px, 24px 24px, auto, auto;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0; /* vignette below the grid */
    box-shadow: inset 0 0 120px rgba(0,0,0,0.05);
}

/* Loader */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-darker);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

@keyframes pulse-badge {
    0%, 100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateY(-50%) scale(1.1);
        opacity: 0.9;
    }
}

.loader p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Layout */
.app {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 2; /* ensure content sits above grid overlay */
}

/* Top Header */
.header {
    position: fixed;
    top: 0;
    right: 0;
    left: 72px; /* sidebar width */
    height: 70px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 20px;
    z-index: 100;
}

.sidebar {
    width: 72px !important; /* Уменьшенная ширина - только иконки */
    min-width: 72px !important;
    max-width: 72px !important;
    background: var(--bg-darker);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 10px;
    overflow-x: hidden;
    overflow-y: auto;
    transition: none !important; /* Отключаем анимации расширения */
}

.sidebar::-webkit-scrollbar {
    width: 0px;
    display: none;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: transparent;
}

/* Скрываем все скроллбары */
*::-webkit-scrollbar {
    width: 0px;
    height: 0px;
    display: none;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: transparent;
}

* {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.sidebar.expanded {
    width: 72px !important; /* Всегда остается 72px даже с классом expanded */
    min-width: 72px !important;
    max-width: 72px !important;
}

.logo { display: flex; align-items: center; justify-content: center; gap: 12px; }
.logo h1 { font-size: 20px; margin-bottom: 2px; }
.logo p { color: var(--text-secondary); font-size: 12px; }
.logo .logo-icon { width: 32px; height: 32px; fill: var(--accent-primary); flex: 0 0 auto; }
.logo-text { display: none; } /* Всегда скрыт */

nav {
    margin-top: 40px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 10px;
    transition: all 0.2s;
    position: relative;
}

.nav-icon { width: 24px; height: 24px; stroke: var(--text-secondary); fill: none; }
.nav-text { display: none; } /* Всегда скрыт */

.nav-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}
.nav-link.active .nav-icon { stroke: #ffffff; }

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.sidebar-footer .time {
    color: var(--text-primary);
    font-size: 14px;
    margin-top: 5px;
}

/* Content */
.content {
    flex: 1;
    padding: 40px;
    padding-top: 110px; /* 70px header + 40px spacing */
    overflow-y: auto;
    margin-left: 72px; /* sidebar width */
}

/* Dev notice (Messages page) */
.dev-notice {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 16px;
    justify-content: center;
}

.building-animation {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.building-svg {
    width: 100%;
    height: 100%;
}

.build-part {
    animation: buildAppear 0.4s ease-out forwards;
}

.hammer {
    animation: hammerHit 0.3s ease-in-out infinite;
    transform-origin: 100px 45px;
}

.hammer-head {
    animation: hammerHit 0.3s ease-in-out infinite;
}

.spark {
    animation: sparkFlash 0.2s ease-out forwards;
    opacity: 0;
}

.sparks {
    opacity: 0;
}

.sparks-walls {
    opacity: 0;
}

.sparks-roof {
    opacity: 0;
}

.foundation {
    animation-delay: 0s;
}

.sparks .spark1 {
    animation-delay: 0.1s;
}

.sparks .spark2 {
    animation-delay: 0.15s;
}

.sparks .spark3 {
    animation-delay: 0.2s;
}

.sparks .spark4 {
    animation-delay: 0.25s;
}

.sparks {
    animation: sparksShow 0.4s ease-out forwards;
    animation-delay: 0s;
}

.walls {
    animation-delay: 0.8s;
}

.spark-w1 {
    animation-delay: 0.9s;
}

.spark-w2 {
    animation-delay: 0.95s;
}

.spark-w3 {
    animation-delay: 1s;
}

.sparks-walls {
    animation: sparksShow 0.4s ease-out forwards;
    animation-delay: 0.8s;
}

.window1 {
    animation-delay: 1.5s;
}

.window2 {
    animation-delay: 1.6s;
}

.door {
    animation-delay: 1.7s;
}

.roof {
    animation-delay: 2s;
}

.spark-r1 {
    animation-delay: 2.1s;
}

.spark-r2 {
    animation-delay: 2.15s;
}

.spark-r3 {
    animation-delay: 2.2s;
}

.sparks-roof {
    animation: sparksShow 0.4s ease-out forwards;
    animation-delay: 2s;
}

.smoke1 {
    animation-delay: 2.5s;
}

.smoke2 {
    animation-delay: 2.7s;
}

.smoke3 {
    animation-delay: 2.9s;
}

.hammer {
    animation: hammerSequence 3.5s ease-in-out infinite;
}

@keyframes buildAppear {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        opacity: 0.9;
        transform: scale(1);
    }
}

@keyframes hammerHit {
    0%, 100% {
        transform: rotate(0deg) translateY(0);
    }
    50% {
        transform: rotate(25deg) translateY(8px);
    }
}

@keyframes hammerSequence {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg);
    }
    15% {
        opacity: 1;
        transform: translate(10px, 15px) rotate(25deg);
    }
    20% {
        transform: translate(10px, 15px) rotate(25deg);
    }
    25% {
        transform: translate(0, 0) rotate(0deg);
    }
    45% {
        opacity: 0;
        transform: translate(0, 0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: translate(-10px, 15px) rotate(-25deg);
    }
    55% {
        transform: translate(-10px, 15px) rotate(-25deg);
    }
    60% {
        transform: translate(0, 0) rotate(0deg);
    }
    80% {
        opacity: 0;
        transform: translate(0, 0) rotate(0deg);
    }
    85% {
        opacity: 1;
        transform: translate(0, 10px) rotate(0deg);
    }
    90% {
        transform: translate(0, 10px) rotate(0deg);
    }
    95% {
        transform: translate(0, 0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(0, 0) rotate(0deg);
    }
}

@keyframes sparkFlash {
    0% {
        opacity: 0;
        transform: scale(0) translate(0, 0);
    }
    50% {
        opacity: 1;
        transform: scale(1.5) translate(var(--spark-x, 0), var(--spark-y, -5px));
    }
    100% {
        opacity: 0;
        transform: scale(0.5) translate(var(--spark-x2, 5px), var(--spark-y2, -10px));
    }
}

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

.spark1 {
    --spark-x: -5px;
    --spark-y: -8px;
    --spark-x2: -8px;
    --spark-y2: -12px;
}

.spark2 {
    --spark-x: 5px;
    --spark-y: -10px;
    --spark-x2: 8px;
    --spark-y2: -15px;
}

.spark3 {
    --spark-x: -3px;
    --spark-y: -6px;
    --spark-x2: -5px;
    --spark-y2: -10px;
}

.spark4 {
    --spark-x: 3px;
    --spark-y: -7px;
    --spark-x2: 5px;
    --spark-y2: -11px;
}

.spark-w1 {
    --spark-x: -8px;
    --spark-y: -5px;
    --spark-x2: -12px;
    --spark-y2: -8px;
}

.spark-w2 {
    --spark-x: 0;
    --spark-y: -8px;
    --spark-x2: 0;
    --spark-y2: -12px;
}

.spark-w3 {
    --spark-x: 8px;
    --spark-y: -5px;
    --spark-x2: 12px;
    --spark-y2: -8px;
}

.spark-r1 {
    --spark-x: -6px;
    --spark-y: -8px;
    --spark-x2: -10px;
    --spark-y2: -12px;
}

.spark-r2 {
    --spark-x: 6px;
    --spark-y: -8px;
    --spark-x2: 10px;
    --spark-y2: -12px;
}

.spark-r3 {
    --spark-x: 0;
    --spark-y: -10px;
    --spark-x2: 0;
    --spark-y2: -15px;
}

.dev-notice h3 { margin: 0 0 8px 0; }
.dev-notice p { margin: 0; color: var(--text-secondary); }

/* Pipette */
.pipette-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
}

.pipette-upload {
    display: block;
}

.pipette-drop {
    display: grid;
    place-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 32px;
    color: var(--text-secondary);
}

.pipette-canvas-wrap {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    max-height: 70vh;
}

#pipette-canvas {
    width: 100%;
    height: auto;
    max-height: 70vh;
    display: block;
}

#pipette-magnifier {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.75);
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    pointer-events: none;
}

.pipette-preview {
    position: absolute;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.7);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    pointer-events: none;
    transform: translate(12px, 12px);
}

.pipette-right h3 { margin: 0 0 12px 0; }
.pipette-result-color {
    height: 44px;
    border-radius: 8px;
    background: #3b9bf9;
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.pipette-results { display: grid; gap: 10px; }
.pipette-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pipette-row span { color: var(--text-secondary); width: 70px; }
.pipette-value { display: flex; gap: 8px; flex: 1; }
.pipette-value input { flex: 1; padding: 10px 12px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-primary); }
.copy-btn { 
    padding: 10px; 
    border-radius: 8px; 
    background: var(--bg-darker); 
    border: 1px solid var(--border-color); 
    color: var(--text-secondary); 
    cursor: pointer; 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.copy-btn:hover { 
    border-color: var(--accent-primary); 
    background: var(--accent-primary);
    color: #fff; 
}
.copy-btn svg {
    display: block;
}

/* Toast */
.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    min-width: 200px;
    max-width: 400px;
    background: linear-gradient(135deg, #2d2d2d 0%, #1f1f1f 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-weight: 600;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05) inset;
    opacity: 0;
    transform: translateX(100px) scale(0.9);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10001;
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.toast.show { 
    opacity: 1; 
    transform: translateX(0) scale(1);
    animation: toast-pulse 0.3s ease-out;
}

@keyframes toast-pulse {
    0%, 100% { transform: translateX(0) scale(1); }
    50% { transform: translateX(0) scale(1.02); }
}

.toast.success { 
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 40px rgba(16, 185, 129, 0.3), 0 0 0 1px rgba(255,255,255,0.1) inset;
}

.toast.success::before {
    content: '✓';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
}

.pipette-help {
    margin-top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 20px;
}
.pipette-help h3 { margin: 0 0 10px 0; }
.pipette-help ul { margin: 0; padding-left: 18px; color: var(--text-secondary); }
.pipette-help code { background: var(--bg-darker); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border-color); }

.page {
    display: none;
    animation: fadeOut 0.2s ease-out;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h2 {
    font-size: 32px;
    display: flex;
    align-items: center;
}

.h2-icon {
    width: 28px;
    height: 28px;
    vertical-align: -6px;
    margin-right: 8px;
}

.header-controls {
    display: flex;
    gap: 15px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
}

.stat-icon {
    font-size: 40px;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.stat-icon svg {
    width: 35px;
    height: 35px;
    fill: white;
}

.stat-info {
    flex: 1;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--accent-primary);
}

/* Chart */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    position: relative;
    overflow: hidden;
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    opacity: 0.5;
}

.chart-container h3 {
    margin-bottom: 20px;
    font-size: 20px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Form */
.message-form {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    max-width: 800px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-actions {
    display: flex;
    gap: 15px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-secondary);
    transform: translateY(-2px);
}

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

.period-select {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

/* Message Status */
.message-status {
    margin-top: 20px;
    padding: 16px;
    border-radius: 8px;
    display: none;
}

.message-status.success {
    display: block;
    background: rgba(0, 210, 106, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.message-status.error {
    display: block;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

/* Channels List */
.channels-list {
    display: grid;
    gap: 15px;
}

.channel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.channel-info h4 {
    margin-bottom: 5px;
}

.channel-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.channel-timer {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-primary);
}

.channel-timer.warning {
    color: var(--accent-secondary);
}

.channel-timer.danger {
    color: var(--danger);
}

/* Demo Button */
.btn-demo {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-demo:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 155, 249, 0.35);
}

/* Chart Tabs */
.chart-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.chart-tab {
    padding: 10px 18px;
    background: linear-gradient(180deg, #232323 0%, #1a1a1a 100%);
    border: 1px solid #333;
    border-radius: 999px;
    color: #c9c9c9;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.chart-tab:hover {
    transform: translateY(-1px);
    color: #fff;
    border-color: var(--accent-primary);
}

.chart-tab.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(59, 155, 249, 0.25);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.demo-modal-content {
    max-width: 1000px;
    width: 95%;
    max-height: 85vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 24px;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-darker);
    color: var(--text-primary);
}

.demo-chart-wrapper {
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
}

.demo-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.demo-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.demo-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--success);
}

.demo-range-tabs {
    display: flex;
    gap: 8px;
}

.demo-range {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
}

.demo-range.active {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

.demo-type-tabs {
    display: flex;
    gap: 10px;
    padding: 10px 0 16px 0;
    flex-wrap: wrap;
}

.demo-type {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
}

.demo-type.active {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

.demo-chart-canvas {
    height: 360px;
}

.demo-section {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-darker);
    border-radius: 8px;
}

.demo-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--accent-primary);
}

.demo-section p {
    margin: 5px 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Messages List */
.messages-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 15px;
    background: var(--bg-darker);
    border-radius: 8px;
    margin-top: 20px;
}

.message-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.message-author {
    font-weight: 600;
    color: var(--accent-primary);
}

.message-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.message-content {
    color: var(--text-primary);
    line-height: 1.5;
}

.read-messages-btn {
    background: var(--accent-secondary);
    color: white;
}

.read-messages-btn:hover {
    background: var(--accent-primary);
}

/* Maps Hosting */
.maps-upload-section {
    margin-bottom: 40px;
}

.maps-upload {
    display: block;
}

.maps-drop {
    display: grid;
    place-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 48px 32px;
    color: var(--text-secondary);
    transition: all 0.3s;
    cursor: pointer;
}

.maps-drop:hover {
    border-color: var(--accent-primary);
    background: rgba(59, 155, 249, 0.05);
}

.maps-upload-icon {
    width: 64px;
    height: 64px;
    stroke: var(--accent-primary);
    stroke-width: 2;
}

.maps-drop-text {
    font-size: 16px;
    margin: 0;
    color: var(--text-secondary);
}

.maps-upload-progress {
    margin-top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-darker);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 999px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
    text-align: center;
}

.maps-list-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
}

.maps-list-section h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
}

.maps-list {
    display: grid;
    gap: 16px;
}

.maps-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    margin: 0;
}

.map-card {
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.map-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.map-info {
    flex: 1;
}

.map-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.map-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.map-link-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.map-link-input {
    min-width: 300px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Courier New', monospace;
}

.map-link-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.map-link-btn {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    white-space: nowrap;
}

.map-link-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.map-link-btn.copy-success {
    border-color: var(--success);
    color: var(--success);
}

.map-delete-btn {
    padding: 10px 16px;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--danger);
    border-radius: 8px;
    color: var(--danger);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.map-delete-btn:hover {
    background: rgba(255, 71, 87, 0.2);
}

/* Map Preview Styles */
.map-preview-container {
    width: 100%;
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-darker);
    border-radius: 12px;
    border: 2px solid var(--accent-primary);
}

.map-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px;
}

.map-preview-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.map-preview-image-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.map-preview-image {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
}

.map-preview-info {
    text-align: center;
}

.map-preview-info h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: var(--text-primary);
}

.map-preview-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.map-preview-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.map-preview-basic {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    text-align: center;
    align-items: center;
}

.map-preview-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 80px;
    height: 80px;
    background: rgba(196, 5, 82, 0.1);
    border-radius: 12px;
    margin-bottom: 8px;
}

.map-preview-error {
    padding: 20px;
    text-align: center;
    color: var(--danger);
    background: rgba(220, 53, 69, 0.1);
    border-radius: 8px;
    border: 1px solid var(--danger);
}

/* Confirm Delete Modal */
.confirm-modal-content {
    max-width: 450px;
    padding: 0;
}

.confirm-modal-body {
    padding: 32px;
    text-align: center;
}

.confirm-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    stroke: var(--danger);
    fill: none;
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

.confirm-message {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.confirm-submessage {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.confirm-modal-actions {
    display: flex;
    gap: 12px;
    padding: 20px 32px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.btn-cancel {
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.btn-cancel:hover {
    background: var(--bg-card);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #ff6b7a);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff3742, var(--danger));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

/* Changelog Page */
.changelog-filters {
    margin-top: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-label {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.changelog-grid {
    display: grid;
    grid-template-columns: repeat(40, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-image: 
        radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px),
        radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    position: relative;
}

.changelog-square {
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    position: relative;
}

.changelog-square:hover {
    transform: scale(1.1);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.changelog-square.added {
    background: #00d26a;
    border-color: #00d26a;
}

.changelog-square.fixed {
    background: #ff6b35;
    border-color: #ff6b35;
}

.changelog-square.changed {
    background: #3b9bf9;
    border-color: #3b9bf9;
}

.changelog-square.empty {
    background: var(--bg-darker);
    border-color: var(--border-color);
    cursor: default;
}

.changelog-square.empty:hover {
    transform: none;
    box-shadow: none;
}

.changelog-legend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    gap: 20px;
}

.changelog-legend-items {
    display: flex;
    gap: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 20px;
}

.changelog-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.changelog-legend-square {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.changelog-legend-square.added {
    background: #00d26a;
    border: 1px solid #00d26a;
}

.changelog-legend-square.fixed {
    background: #ff6b35;
    border: 1px solid #ff6b35;
}

.changelog-legend-square.changed {
    background: #3b9bf9;
    border: 1px solid #3b9bf9;
}

.changelog-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 20px;
}

.changelog-pagination-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.changelog-pagination-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.changelog-pagination-dot {
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.changelog-pagination-dot.active {
    background: var(--border-color);
    border-color: var(--text-secondary);
}

.changelog-timeline-wrapper {
    margin-top: 40px;
    padding: 0 20px;
}

.changelog-timeline {
    position: relative;
    padding-left: 60px;
}

.changelog-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.changelog-entry {
    position: relative;
    margin-bottom: 32px;
}

.changelog-entry::before {
    content: '';
    position: absolute;
    left: -52px;
    top: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff6b9d;
    border: 2px solid var(--bg-dark);
    z-index: 10;
}

.changelog-entry-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    position: relative;
    background-image: 
        radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px),
        radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

.changelog-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.changelog-entry-title-group {
    flex: 1;
}

.changelog-entry-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.changelog-entry-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.changelog-read-more {
    background: transparent;
    border: none;
    color: #ff6b9d;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.changelog-read-more:hover {
    background: rgba(255, 107, 157, 0.1);
}

.changelog-entry-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.changelog-entry-time {
    font-weight: 500;
}

.changelog-entry-date {
    color: var(--text-secondary);
}

.changelog-entry-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.changelog-entry-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

.changelog-entry-item-bullet {
    flex-shrink: 0;
    color: var(--text-secondary);
    font-weight: 500;
}

.changelog-entry-item-bullet.added {
    color: #00d26a;
}

.changelog-entry-item-bullet.fixed {
    color: #ff6b35;
}

.changelog-entry-item-bullet.changed {
    color: #3b9bf9;
}

.changelog-entry-item-text {
    flex: 1;
}

.changelog-entry-more {
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
    margin-top: 4px;
}

.changelog-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 16px;
}

/* Changelog Detail Page */
.btn-back {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.2s;
    margin-right: 16px;
}

.btn-back:hover {
    background: var(--bg-card);
    border-color: var(--accent-primary);
}

.changelog-detail-page {
    margin-top: 20px;
}

.changelog-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 12px 12px 0 0;
    background-image: 
        radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px),
        radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

.changelog-detail-body {
    padding: 32px;
    background: var(--bg-card);
    border-radius: 0 0 12px 12px;
    border: 1px solid var(--border-color);
    border-top: none;
}

.changelog-date-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.changelog-header-icon {
    width: 20px;
    height: 20px;
    stroke: var(--text-secondary);
    stroke-width: 2;
    fill: none;
}

.changelog-date {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.changelog-time-ago {
    font-size: 13px;
    color: var(--text-secondary);
}

.changelog-views-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.changelog-detail-body {
    padding: 32px;
    max-height: 60vh;
    overflow-y: auto;
}

.changelog-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.changelog-section {
    display: block;
}

.changelog-section-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--text-primary);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.changelog-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.changelog-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

.changelog-item-bullet {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
    margin-top: 6px;
}

.changelog-item-bullet.added {
    background: #00d26a;
}

.changelog-item-bullet.fixed {
    background: #ff6b35;
}

.changelog-item-bullet.changed {
    background: #3b9bf9;
}

.changelog-item-text {
    flex: 1;
}

/* Admin Page */
.admin-content {
    margin-top: 20px;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-changelog-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.admin-changelog-info {
    flex: 1;
}

.admin-changelog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.admin-changelog-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.admin-changelog-views {
    color: var(--text-secondary);
    font-size: 14px;
}

.admin-changelog-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 0 12px 0;
}

.admin-changelog-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-secondary);
}

.admin-changelog-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.admin-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 16px;
}

.admin-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Admin Modal */
.admin-modal-content {
    max-width: 700px;
    padding: 0;
}

.admin-modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.admin-modal-actions {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.admin-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.admin-item-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-item-input {
    flex: 1;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

.btn-secondary {
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--text-secondary);
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-cancel:hover {
    background: var(--bg-card);
}


