:root {
    /* Палитра: премиальный темно-синий/серый */
    --bg: #0f1218;
    --surface: #181c25;
    --surface-hover: #1e242f;
    --border: rgba(255, 255, 255, 0.06);
    --text: #ffffff;
    --text-dim: #94a3b8;
    --accent: #3b82f6;
    --success: #10b981;
    --error: #ef4444;
    --radius: 12px;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f1f5f9;
        --surface: #ffffff;
        --surface-hover: #f8fafc;
        --border: rgba(0, 0, 0, 0.08);
        --text: #0f172a;
        --text-dim: #64748b;
        --accent: #2563eb;
    }
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }

body {
    margin: 0;
    /* Используем системные шрифты, которые гарантированно поддерживают кириллицу */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 16px;
}

/* Элегантные блоки-полоски */
.group-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dim);
    margin: 32px 0 12px 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.group-title:first-child, #main > .group-title:first-child {
    margin-top: 0;
}

.card-stack {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.strip-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px; /* Slightly more compact padding */
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.strip-item:hover {
    transform: translateY(-2px); /* Vertical hover feels better in grid */
    border-color: var(--accent);
    background: var(--surface-hover);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0; /* Foundation for text truncation if needed */
}

.emoji-icon {
    font-size: 18px;
    opacity: 0.9;
}

.item-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.item-title {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-subtitle {
    font-size: 11px;
    color: var(--text-dim);
}

.item-chart {
    width: 60px; /* More compact chart for 2-column layout */
    height: 24px;
    margin: 0 12px;
    opacity: 0.8;
}

.item-right {
    text-align: right;
    flex-shrink: 0;
}

.item-price {
    font-weight: 700;
    font-size: 14px;
}

.spath {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawSparkline 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.3s;
    opacity: 0;
}

@keyframes drawSparkline {
    from { opacity: 0; stroke-dashoffset: 200; }
    to { opacity: 1; stroke-dashoffset: 0; }
}

.strip-item {
    opacity: 0;
    animation: fadeInRow 0.5s ease-out forwards;
}

@keyframes fadeInRow {
    to { opacity: 1; }
}

@media (max-width: 768px) {
    .card-stack {
        grid-template-columns: 1fr;
    }
}

/* Page: Chart */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 32px;
    transition: all 0.2s;
}

.back-btn:hover {
    color: var(--text);
    background: var(--surface-hover);
}

/* Page: Chart - Compact & Elegant 2025 */
.chart-header {
    margin-bottom: 24px;
    animation: fadeInUp 0.4s ease-out;
}

.price-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.price-main {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text); /* Использовать переменную текста вместо жесткого белого */
}

.price-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.05);
}

.bg-up { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.bg-down { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

.chart-module {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    position: relative;
}

.interval-tabs {
    display: flex;
    gap: 4px;
    background: rgba(0,0,0,0.15);
    padding: 4px;
    border-radius: 8px;
    width: fit-content;
    margin-bottom: 24px;
}

.tab-item {
    border: none;
    background: none;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-item.active {
    background: #475569; /* Нейтральный Slate-600 */
    color: white;
}

.svg-canvas {
    width: 100%;
    height: 280px; /* More compact height */
}

#chartPath {
    animation: drawPath 1s ease-out forwards;
}

@keyframes drawPath {
    to { stroke-dashoffset: 0; }
}

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

.custom-tooltip {
    position: absolute;
    display: none;
    background: rgba(15, 18, 24, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    color: white;
    pointer-events: none;
    z-index: 100;
    transform: translate(-50%, -120%);
}

.tooltip-value { font-weight: 800; font-size: 14px; display: block; }
.tooltip-date { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

.chart-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.stat-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
.stat-value { font-size: 14px; font-weight: 700; }

.item-diff {
    font-size: 10px;
    font-weight: 700;
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
}

.up { color: var(--success); }
.down { color: var(--error); }

.item-diff.up { background: rgba(16, 185, 129, 0.1); }
.item-diff.down { background: rgba(239, 68, 68, 0.1); }
