/* ===================== Базовые переменные / темы ===================== */
:root {
    --accent: #7c5cff;
    --accent-2: #36c5ff;
    --accent-grad: linear-gradient(135deg, var(--accent), var(--accent-2));

    --font: "Manrope", system-ui, sans-serif;

    /* Жидкое стекло (управляется ползунком в настройках) */
    --glass-blur: 0px;
    --glass-pct: 100%;
    --glass-pct2: 100%;
    --glass-sat: 1;
    --glass-bright: 1;

    /* Тёмная тема (по умолчанию) */
    --bg: #0b0b12;
    --bg-2: #12121d;
    --surface: rgba(255, 255, 255, 0.05);
    --surface-2: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.09);
    --text: #f4f4fb;
    --muted: #9a9ab0;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    --off: #2bd47d;   /* выходной */
    --work: #3b82f6;  /* график 5/2 */
    --day: #f59e0b;   /* дневная смена */
    --night: #6366f1; /* ночная смена */
    --nav-bg: #12121d;
    --panel-bg: rgba(18, 18, 29, 0.94);
}

[data-theme="light"] {
    --bg: #f3f4fb;
    --bg-2: #ffffff;
    --surface: rgba(20, 20, 40, 0.04);
    --surface-2: rgba(20, 20, 40, 0.07);
    --border: rgba(20, 20, 40, 0.10);
    --text: #14142b;
    --muted: #6b6b85;
    --shadow: 0 10px 40px rgba(60, 60, 120, 0.15);
    --nav-bg: #ffffff;
    --panel-bg: rgba(255, 255, 255, 0.94);
}

[data-font="grotesk"] { --font: "Space Grotesk", system-ui, sans-serif; }
[data-font="system"]  { --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

/* ---- Жидкое стекло включено: прозрачные поверхности + блик по краю ---- */
[data-glass="on"] {
    --surface: color-mix(in srgb, var(--bg-2) var(--glass-pct), transparent);
    --surface-2: color-mix(in srgb, var(--bg-2) var(--glass-pct2), transparent);
    --border: rgba(255, 255, 255, 0.28);
}
[data-glass="on"][data-theme="light"] {
    --surface: color-mix(in srgb, #ffffff var(--glass-pct), transparent);
    --surface-2: color-mix(in srgb, #ffffff var(--glass-pct2), transparent);
    --border: rgba(255, 255, 255, 0.75);
}
/* Поверхности, которые «застекляем» */
[data-glass="on"] .profile-card,
[data-glass="on"] .settings-group,
[data-glass="on"] .edit-toolbar,
[data-glass="on"] .cell,
[data-glass="on"] .strip-chip,
[data-glass="on"] .friend-row,
[data-glass="on"] .sheet {
    background: var(--panel-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)) brightness(var(--glass-bright));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)) brightness(var(--glass-bright));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05),
        0 8px 24px rgba(0, 0, 0, 0.18);
}
[data-glass="on"] .bottom-nav {
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)) brightness(var(--glass-bright));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)) brightness(var(--glass-bright));
}
/* Шапка: только размытие, без inset-линии и тени */
[data-glass="on"] .brandbar {
    background: transparent;
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)) brightness(var(--glass-bright));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)) brightness(var(--glass-bright));
}
[data-glass="on"] .cell.today {
    box-shadow: inset 0 0 0 2px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

html {
    /* Полоса прокрутки не сдвигает контент при переходе на длинные экраны */
    scrollbar-gutter: stable;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
    scrollbar-width: none;
}
body::-webkit-scrollbar { display: none; }

/* Фон вынесен в фиксированный слой — не «рвётся» при скролле */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(700px 500px at 78% 8%, color-mix(in srgb, var(--accent) 42%, transparent), transparent 60%),
        radial-gradient(650px 520px at 10% 22%, color-mix(in srgb, var(--accent-2) 38%, transparent), transparent 58%),
        radial-gradient(600px 500px at 85% 75%, color-mix(in srgb, var(--accent-2) 30%, transparent), transparent 60%),
        radial-gradient(620px 520px at 20% 92%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 60%),
        var(--bg);
}

.app {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    /* верхний отступ под фиксированную шапку */
    padding: calc(env(safe-area-inset-top) + 56px) 14px 0;
}

/* ===================== Брендовая шапка (фиксирована сверху) ===================== */
.brandbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    padding: max(8px, env(safe-area-inset-top)) 0 8px;
    /* Стекло выкл: ровный фон страницы, без размытия — шапка видна, контент не просвечивает */
    background: var(--bg);
    pointer-events: none;
}
.brandbar-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 0 10px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    min-height: 36px;
    pointer-events: auto;
}
.brandbar-left {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 0;
    min-width: 0;
    max-width: calc(50% - 44px);
}
.brand-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    z-index: 2;
    pointer-events: none;
}
.brand-support {
    font-size: 12px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    line-height: 1;
    font: inherit;
    flex-shrink: 0;
}
.brand-support:active { transform: scale(.96); }
.brandbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 0;
    min-width: 0;
    max-width: calc(50% - 44px);
    justify-content: flex-end;
}
.brand-shop {
    font-size: 12px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: transform .2s ease, background .2s ease;
}
.brand-shop-ico { font-size: 13px; line-height: 1; }
.brand-shop-text { font-size: 12px; }
.brand-shop:active { transform: scale(.96); }
.brand-admin {
    font-size: 11px;
    font-weight: 800;
    padding: 4px 7px;
    border-radius: 999px;
    background: color-mix(in srgb, #f59e0b 18%, var(--surface-2));
    border: 1px solid color-mix(in srgb, #f59e0b 35%, var(--border));
    color: var(--text);
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
    transition: transform .2s ease, background .2s ease;
}
.brand-admin:active { transform: scale(.96); }
.brand-kabachok {
    font-size: 11px;
    font-weight: 800;
    padding: 4px 7px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    white-space: nowrap;
    line-height: 1;
    flex-shrink: 0;
    transition: transform .2s ease, background .2s ease, border-color .2s ease;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    position: relative;
}
.brand-kabachok:active { transform: scale(.96); }
.brand-kabachok.has-claim {
    border-color: color-mix(in srgb, var(--off) 55%, var(--border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--off) 25%, transparent);
    animation: streakPulse 2s ease-in-out infinite;
}
.brand-kabachok.has-claim::after {
    content: "";
    position: absolute;
    top: -2px;
    right: -2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2ecc71;
    border: 1.5px solid var(--bg);
}
@keyframes streakPulse {
    0%, 100% { background: var(--surface-2); }
    50% { background: color-mix(in srgb, var(--off) 18%, var(--surface-2)); }
}
.brand-kabachok.bump {
    animation: kabBump .45s ease;
}
@keyframes kabBump {
    0% { transform: scale(1); }
    40% { transform: scale(1.08); background: color-mix(in srgb, var(--off) 25%, var(--surface-2)); }
    100% { transform: scale(1); }
}
.brand-logo {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: var(--accent-grad);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 45%, transparent),
                inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.brand-logo svg { width: 17px; height: 17px; }
.brand-name {
    font-family: "Space Grotesk", system-ui, sans-serif;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.01em;
    /* Зацикленный градиент: начинается и заканчивается одним цветом — шов незаметен */
    background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent), var(--accent-2), var(--accent));
    background-size: 250% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--accent);
    animation: brand-flow 5s linear infinite;
}
@keyframes brand-flow {
    to { background-position: -250% center; }
}
@media (max-width: 440px) {
    .brand-shop-text { display: none; }
    .brand-shop { padding: 4px 6px; gap: 0; }
}
@media (max-width: 360px) {
    .brand-name { font-size: 16px; }
    .brand-logo { width: 24px; height: 24px; border-radius: 8px; }
    .brand-logo svg { width: 14px; height: 14px; }
    .brandbar-left,
    .brandbar-right { max-width: calc(50% - 38px); }
}
@media (prefers-reduced-motion: reduce) {
    .brand-name { animation: none; }
}

/* ===================== Переходы между экранами ===================== */
.screen {
    transition: opacity .28s ease, transform .28s cubic-bezier(.2, .8, .2, 1);
}
.screen.is-hidden {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    inset: 0;
    pointer-events: none;
    transform: translateY(8px);
}
.screen.is-active {
    opacity: 1;
    visibility: visible;
    position: relative;
    transform: none;
}

.screen-enter { animation: screen-in .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes screen-in {
    from { transform: translateY(10px); }
    to   { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .screen, .screen-enter { animation: none; transition: none; }
}

.topbar,
.today-strip {
    transition: opacity .26s ease, transform .26s ease, max-height .26s ease, margin .26s ease, padding .26s ease;
    max-height: 160px;
    opacity: 1;
    transform: none;
}
.topbar.is-hidden,
.today-strip.is-hidden {
    opacity: 0;
    max-height: 0;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden;
    pointer-events: none;
    transform: translateY(-4px);
}

/* ===================== Верхняя панель ===================== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 2px 12px;
}

.topbar-left { display: flex; align-items: center; gap: 6px; }

.month-title { text-align: center; min-width: 150px; }
.month-title h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-transform: capitalize;
}
.screen-hint { font-size: 12px; color: var(--muted); }

.icon-btn {
    width: 38px; height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 22px; line-height: 1;
    cursor: pointer;
    transition: transform .08s, background .15s;
}
.icon-btn:active { transform: scale(.9); }

.today-btn {
    border: none;
    border-radius: 12px;
    padding: 9px 14px;
    font: inherit; font-weight: 700; font-size: 13px;
    color: #fff;
    background: var(--accent-grad);
    cursor: pointer;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
    transition: transform .08s;
}
.today-btn:active { transform: scale(.95); }

.cal-mode-bar {
    display: flex;
    justify-content: center;
    padding: 0 2px 10px;
}
.cal-mode-bar[hidden] { display: none !important; }
.cal-mode-seg {
    width: 100%;
    max-width: 320px;
}
.cal-mode-seg button {
    flex: 1;
    font-size: 12px;
    padding: 8px 6px;
}

/* ===================== Полоса «сегодня отдыхают» ===================== */
.today-strip {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    padding: 4px 2px 12px;
    scrollbar-width: none;
}
.today-strip::-webkit-scrollbar { display: none; }
.today-strip .strip-label {
    font-size: 12px; color: var(--muted);
    white-space: nowrap; flex-shrink: 0; margin-right: 2px;
}
.strip-chip {
    display: flex; align-items: center; gap: 7px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 5px 11px 5px 5px;
    border-radius: 999px;
    flex-shrink: 0;
    font-size: 13px; font-weight: 600;
    min-height: 36px;
    max-width: min(100%, 200px);
}
.strip-chip > .strip-chip-name,
.strip-chip > .name-with-title,
.strip-chip .person-name {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.25;
    max-width: 130px;
}

/* ===================== Контент ===================== */
/* Прокрутка на уровне документа (не внутри .content) — иначе backdrop-filter
   стекла оставляет артефакт-полосу при прокрутке внутреннего контейнера */
.content { flex: 1; padding-bottom: 88px; position: relative; }

/* ===================== Аватар (общий вид) ===================== */
.avatar {
    position: relative;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
    user-select: none;
    box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18);
}

/* ===================== Календарь ===================== */
.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 6px;
}
.weekdays span {
    text-align: center;
    font-size: 11px; font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.cell {
    position: relative;
    aspect-ratio: 1 / 1.28;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--panel-bg);
    padding: 6px 5px 7px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform .08s, border-color .15s;
    overflow: hidden;
}
.cell:active { transform: scale(.96); }
.cell.empty { background: transparent; border: none; cursor: default; }
.cell.empty:active { transform: none; }

.cell .num {
    font-size: 13px; font-weight: 700;
    color: var(--text);
    line-height: 1;
}
.cell.dim .num { color: var(--muted); }

.cell.today {
    border-color: transparent;
    /* inset-обводка — не срезается краями календаря */
    box-shadow: inset 0 0 0 2px var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}
.cell.today .num {
    color: #fff;
    background: var(--accent-grad);
    width: 22px; height: 22px;
    border-radius: 7px;
    display: grid; place-items: center;
}

/* мини-аватарки в ячейке: сверху выходные, снизу все работающие */
.cell-stack {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}
.cell-people {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    min-height: 12px;
}
.cell-people .avatar { width: 18px; height: 18px; font-size: 9px; flex-shrink: 0; }
.cell-people .avatar.avatar-off { box-shadow: 0 0 0 1.5px var(--off); }
.cell-people .avatar.avatar-day { box-shadow: 0 0 0 1.5px var(--day); }
.cell-people .avatar.avatar-night { box-shadow: 0 0 0 1.5px var(--night); }
.cell-people .avatar.avatar-work { box-shadow: 0 0 0 1.5px var(--work); }
.cell-people .more {
    font-size: 10px; font-weight: 800; color: var(--muted);
    line-height: 1;
    flex-shrink: 0;
}
.cell-people .name-tag {
    font-size: 9px; font-weight: 700;
    padding: 1px 5px; border-radius: 6px;
    background: var(--surface-2);
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100%;
}
.cell-people .dot-mark {
    width: 8px; height: 8px; border-radius: 50%;
    flex-shrink: 0;
}
.dot-mark-off { background: var(--off); }
.dot-mark-working { background: #ef4444; }

/* режим редактирования */
.cell.my-off  { background: color-mix(in srgb, var(--off) 22%, var(--surface)); border-color: color-mix(in srgb, var(--off) 45%, transparent); }
.cell.my-work { background: color-mix(in srgb, var(--work) 18%, var(--surface)); border-color: color-mix(in srgb, var(--work) 40%, transparent); }
.cell.my-day  { background: color-mix(in srgb, var(--day) 20%, var(--surface)); border-color: color-mix(in srgb, var(--day) 45%, transparent); }
.cell.my-night { background: color-mix(in srgb, var(--night) 20%, var(--surface)); border-color: color-mix(in srgb, var(--night) 45%, transparent); }
.cell .status-ico { position: absolute; top: 5px; right: 6px; font-size: 11px; }

.cell-event-pin {
    position: absolute;
    top: 4px;
    right: 5px;
    font-size: 11px;
    line-height: 1;
    z-index: 2;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.15));
}
.cell-event-pin.ended { opacity: .45; filter: grayscale(.6); }

.edit-toolbar {
    margin-top: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
}
.edit-legend { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.edit-legend .dot { width: 12px; height: 12px; border-radius: 50%; margin-left: 6px; }
.dot-off { background: var(--off); }
.dot-work { background: var(--work); }
.dot-day { background: var(--day); }
.dot-night { background: var(--night); }
.edit-tip { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ===================== Настройки ===================== */
.profile-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 16px;
}
.profile-avatar {
    width: 64px; height: 64px;
    border-radius: 20px;
    border: none; cursor: pointer;
    display: grid; place-items: center;
    font-size: 30px; color: #fff;
    position: relative;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.18);
}
.profile-avatar::after {
    content: "✎"; position: absolute; right: -4px; bottom: -4px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: 11px; display: grid; place-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.profile-meta { flex: 1; min-width: 0; }
.name-input {
    width: 100%; background: transparent; border: none;
    color: var(--text); font: inherit; font-size: 19px; font-weight: 800;
    padding: 2px 0; outline: none;
    border-bottom: 1.5px solid var(--border);
}
.code-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.code-label { font-size: 12px; color: var(--muted); }
.code-pill {
    font-family: "Space Grotesk", monospace; font-weight: 700;
    background: var(--surface-2); padding: 3px 9px; border-radius: 8px;
    letter-spacing: .06em;
}
.profile-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.profile-name-row .name-input { flex: 1; min-width: 120px; }
.profile-title-live { flex-shrink: 0; }

.name-with-title {
    display: inline-flex;
    align-items: center;
    gap: 4px 6px;
    flex-wrap: wrap;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.title-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    padding: 3px 7px;
    border-radius: 6px;
    border: 1px solid transparent;
    white-space: nowrap;
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
    vertical-align: middle;
}
.title-badge::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.35;
    pointer-events: none;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255, 255, 255, 0.55) 50%,
        transparent 70%
    );
    transform: translateX(-120%);
    animation: titleShine 3.2s ease-in-out infinite;
}
@keyframes titleShine {
    0%, 65% { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
}
.title-glow-gold {
    color: #3d2e00;
    background: linear-gradient(135deg, #ffe566, #ffb800);
    border-color: rgba(255, 200, 0, 0.55);
    box-shadow: 0 0 10px rgba(255, 196, 0, 0.45);
    animation: titlePulseGold 2.4s ease-in-out infinite;
}
.title-glow-emerald {
    color: #0a2e1c;
    background: linear-gradient(135deg, #6bffb0, #1ecf7a);
    border-color: rgba(30, 207, 122, 0.5);
    box-shadow: 0 0 10px rgba(30, 207, 122, 0.4);
    animation: titlePulseEmerald 2.6s ease-in-out infinite;
}
.title-glow-ruby {
    color: #3a0810;
    background: linear-gradient(135deg, #ff8a9b, #e63950);
    border-color: rgba(230, 57, 80, 0.5);
    box-shadow: 0 0 10px rgba(230, 57, 80, 0.42);
    animation: titlePulseRuby 2.2s ease-in-out infinite;
}
.title-glow-ice {
    color: #0a2538;
    background: linear-gradient(135deg, #b8f0ff, #5ec8ff);
    border-color: rgba(94, 200, 255, 0.5);
    box-shadow: 0 0 10px rgba(94, 200, 255, 0.38);
    animation: titlePulseIce 2.8s ease-in-out infinite;
}
.title-glow-violet {
    color: #1f0a38;
    background: linear-gradient(135deg, #d4b4ff, #9b5cff);
    border-color: rgba(155, 92, 255, 0.5);
    box-shadow: 0 0 10px rgba(155, 92, 255, 0.42);
    animation: titlePulseViolet 2.5s ease-in-out infinite;
}
.title-glow-fire {
    color: #3a1500;
    background: linear-gradient(135deg, #ffc266, #ff6a00);
    border-color: rgba(255, 106, 0, 0.5);
    box-shadow: 0 0 12px rgba(255, 106, 0, 0.45);
    animation: titlePulseFire 1.9s ease-in-out infinite;
}
.title-glow-sky {
    color: #0a2240;
    background: linear-gradient(135deg, #9ed4ff, #4a9fff);
    border-color: rgba(74, 159, 255, 0.5);
    box-shadow: 0 0 10px rgba(74, 159, 255, 0.38);
    animation: titlePulseSky 2.7s ease-in-out infinite;
}
.title-glow-rose {
    color: #3a1028;
    background: linear-gradient(135deg, #ffb8d9, #ff5ca8);
    border-color: rgba(255, 92, 168, 0.5);
    box-shadow: 0 0 10px rgba(255, 92, 168, 0.4);
    animation: titlePulseRose 2.3s ease-in-out infinite;
}
.title-glow-amber {
    color: #3a2200;
    background: linear-gradient(135deg, #ffd080, #ff9f1a);
    border-color: rgba(255, 159, 26, 0.5);
    box-shadow: 0 0 10px rgba(255, 159, 26, 0.42);
    animation: titlePulseAmber 2.4s ease-in-out infinite;
}
.title-glow-shadow {
    color: #e8ecf4;
    background: linear-gradient(135deg, #4a5068, #2a2e42);
    border-color: rgba(180, 190, 220, 0.25);
    box-shadow: 0 0 10px rgba(120, 130, 170, 0.35);
    animation: titlePulseShadow 3s ease-in-out infinite;
}
@keyframes titlePulseGold {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 196, 0, 0.35); }
    50% { box-shadow: 0 0 16px rgba(255, 196, 0, 0.65); }
}
@keyframes titlePulseEmerald {
    0%, 100% { box-shadow: 0 0 8px rgba(30, 207, 122, 0.3); }
    50% { box-shadow: 0 0 16px rgba(30, 207, 122, 0.58); }
}
@keyframes titlePulseRuby {
    0%, 100% { box-shadow: 0 0 8px rgba(230, 57, 80, 0.32); }
    50% { box-shadow: 0 0 16px rgba(230, 57, 80, 0.6); }
}
@keyframes titlePulseIce {
    0%, 100% { box-shadow: 0 0 8px rgba(94, 200, 255, 0.3); }
    50% { box-shadow: 0 0 16px rgba(94, 200, 255, 0.55); }
}
@keyframes titlePulseViolet {
    0%, 100% { box-shadow: 0 0 8px rgba(155, 92, 255, 0.32); }
    50% { box-shadow: 0 0 16px rgba(155, 92, 255, 0.58); }
}
@keyframes titlePulseFire {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 106, 0, 0.35); filter: brightness(1); }
    50% { box-shadow: 0 0 18px rgba(255, 106, 0, 0.7); filter: brightness(1.08); }
}
@keyframes titlePulseSky {
    0%, 100% { box-shadow: 0 0 8px rgba(74, 159, 255, 0.3); }
    50% { box-shadow: 0 0 16px rgba(74, 159, 255, 0.55); }
}
@keyframes titlePulseRose {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 92, 168, 0.32); }
    50% { box-shadow: 0 0 16px rgba(255, 92, 168, 0.58); }
}
@keyframes titlePulseAmber {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 159, 26, 0.34); }
    50% { box-shadow: 0 0 16px rgba(255, 159, 26, 0.62); }
}
@keyframes titlePulseShadow {
    0%, 100% { box-shadow: 0 0 8px rgba(120, 130, 170, 0.28); }
    50% { box-shadow: 0 0 14px rgba(180, 190, 220, 0.45); }
}

.titles-hint { margin-bottom: 8px; }
.titles-progress {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 10px;
}
#titles-settings-group.collapsible[data-open="true"] .group-body {
    max-height: min(68vh, 620px);
}
.titles-scroll {
    max-height: min(52vh, 440px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    margin: 0 -2px;
    padding: 2px 2px 4px;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent;
}
.titles-scroll::-webkit-scrollbar {
    width: 5px;
}
.titles-scroll::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--muted) 42%, transparent);
    border-radius: 6px;
}
.titles-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.title-pick-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: var(--surface-2);
    cursor: pointer;
    text-align: left;
    width: 100%;
    font: inherit;
    color: inherit;
    transition: border-color .15s, background .15s, transform .08s;
}
.title-pick-card:active { transform: scale(.99); }
.title-pick-card.active {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
    background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}
.title-pick-card.locked {
    opacity: 0.55;
    cursor: default;
}
.title-pick-card.locked:active { transform: none; }
.title-pick-meta {
    flex: 1;
    min-width: 0;
}
.title-pick-meta b {
    display: block;
    font-size: 14px;
    margin-bottom: 3px;
}
.title-pick-meta small {
    display: block;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.35;
}
.title-pick-status {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    flex-shrink: 0;
    padding-top: 2px;
}

.avatar-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.upload-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

.settings-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    margin-bottom: 12px;
    overflow: hidden;
}
.group-title {
    font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); margin-bottom: 12px; font-weight: 700;
}

/* ---- Свёрнутые категории (аккордеон) ---- */
.group-header {
    width: 100%;
    display: flex; align-items: center; gap: 12px;
    background: transparent; border: none; cursor: pointer;
    padding: 16px; color: var(--text); font: inherit;
    text-align: left;
}
.group-header .gh-ico { font-size: 18px; }
.group-header .gh-text { flex: 1; }
.group-header .gh-text b { display: block; font-size: 15px; font-weight: 700; }
.group-header .gh-text small { color: var(--muted); font-size: 12px; }
.group-header .chevron {
    color: var(--muted); font-size: 13px; transition: transform .25s ease;
}
.collapsible[data-open="true"] .chevron { transform: rotate(180deg); }

.group-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s ease;
}
.collapsible[data-open="true"] .group-body { max-height: 760px; }
.group-body-inner { padding: 0 16px 16px; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field label { font-size: 14px; font-weight: 600; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

.segmented {
    display: flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 3px;
    gap: 3px;
}
.segmented button {
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 11px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s, background .15s, border-color .15s, box-shadow .15s;
}
.segmented button:not(.active) {
    border-color: color-mix(in srgb, var(--border) 70%, transparent);
    background: color-mix(in srgb, var(--bg-2) 55%, transparent);
}
.segmented button.active {
    background: var(--accent-grad);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 32%, transparent);
}

.slider-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.slider-val { font-weight: 800; font-size: 15px; font-family: "Space Grotesk", monospace; }
.glass-slider {
    width: 100%; -webkit-appearance: none; appearance: none;
    height: 8px; border-radius: 999px; outline: none; cursor: pointer;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.glass-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 24px; height: 24px; border-radius: 50%;
    background: #fff; cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,.45);
    border: 3px solid color-mix(in srgb, var(--accent) 70%, #fff);
}
.glass-slider::-moz-range-thumb {
    width: 24px; height: 24px; border-radius: 50%;
    background: #fff; cursor: pointer; border: 3px solid var(--accent);
}

.swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.swatch {
    width: 34px; height: 34px; border-radius: 11px; cursor: pointer;
    border: 2px solid transparent; transition: transform .08s;
}
.swatch:active { transform: scale(.9); }
.swatch.active { border-color: var(--text); }

.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin-bottom: 16px; }
.emoji-grid button {
    aspect-ratio: 1; border-radius: 11px; border: 1px solid var(--border);
    background: var(--surface-2); font-size: 20px; cursor: pointer;
    transition: transform .08s;
}
.emoji-grid button.active { background: var(--accent-grad); border-color: transparent; }
.emoji-grid button:active { transform: scale(.88); }

.add-friend { display: flex; gap: 8px; margin-bottom: 12px; }
.add-friend input, .friend-code-input { flex: 1; }
.add-friend input, #friend-code {
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: 11px;
    padding: 11px 12px;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.add-friend input:focus, #friend-code:focus {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.mini-btn {
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.mini-btn:active { transform: scale(.97); }
.mini-btn.primary {
    background: var(--accent-grad);
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}

[data-theme="light"] .mini-btn:not(.primary) {
    background: #fff;
    border: 1.5px solid color-mix(in srgb, #14142b 16%, transparent);
    box-shadow: 0 1px 4px rgba(20, 20, 40, 0.07);
}
[data-theme="light"] .mini-btn:not(.primary):active {
    background: #f0f1f8;
    border-color: color-mix(in srgb, #14142b 24%, transparent);
}

/* Светлая тема — контуры переключателей и полей */
[data-theme="light"] .segmented {
    background: #e9ebf4;
    border: 1.5px solid color-mix(in srgb, #14142b 12%, transparent);
}
[data-theme="light"] .segmented button:not(.active) {
    background: #fff;
    border: 1.5px solid color-mix(in srgb, #14142b 14%, transparent);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(20, 20, 40, 0.06);
}
[data-theme="light"] .segmented button.active {
    border-color: transparent;
    color: #fff;
}

[data-theme="light"] .add-friend input,
[data-theme="light"] #friend-code {
    background: #fff;
    border: 1.5px solid color-mix(in srgb, #14142b 16%, transparent);
    box-shadow: 0 1px 4px rgba(20, 20, 40, 0.06);
}
[data-theme="light"] .add-friend input::placeholder,
[data-theme="light"] #friend-code::placeholder {
    color: color-mix(in srgb, var(--muted) 85%, transparent);
}

[data-theme="light"] .code-pill {
    background: #fff;
    border: 1.5px solid color-mix(in srgb, #14142b 12%, transparent);
    box-shadow: 0 1px 3px rgba(20, 20, 40, 0.05);
}

.friends-list { display: flex; flex-direction: column; gap: 8px; }
.friend-row {
    display: flex; align-items: center; gap: 11px;
    padding: 9px; border-radius: 13px; background: var(--surface-2);
}
.friend-row .avatar { width: 40px; height: 40px; font-size: 18px; }
.friend-row .f-name { font-weight: 700; font-size: 14px; }
.friend-row .f-status { font-size: 12px; color: var(--muted); }
.friend-row .f-remove { margin-left: auto; color: var(--muted); background: none; border: none; font-size: 18px; cursor: pointer; }

.about-block {
    text-align: center;
    padding: 8px 4px 16px;
    margin-top: 4px;
}
.about-domain {
    font-family: "Space Grotesk", system-ui, sans-serif;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.02em;
    color: var(--muted);
    margin-bottom: 10px;
    opacity: 0.9;
}
.about-text {
    font-size: 12px;
    line-height: 1.45;
    color: var(--muted);
    margin-bottom: 10px;
}
.about-brand {
    font-family: "Space Grotesk", system-ui, sans-serif;
    font-weight: 700;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--accent);
}
.about-credits {
    font-size: 11px;
    line-height: 1.5;
    color: var(--muted);
    opacity: 0.85;
}

/* ===================== Нижнее меню ===================== */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0;
    max-width: 520px; margin: 0 auto;
    display: flex;
    align-items: stretch;
    gap: 3px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--nav-bg);
    border-top: 1px solid var(--border);
    isolation: isolate;
    z-index: 20;
}
.nav-btn {
    flex: 1 1 0;
    min-width: 0;
    border: none; background: transparent; color: var(--muted);
    font: inherit; font-size: 10px; font-weight: 700;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    padding: 6px 2px; border-radius: 12px; cursor: pointer;
    transition: color .12s, background .12s;
}
.nav-btn .nav-ico {
    font-size: 17px;
    line-height: 1;
    filter: grayscale(.35);
    transition: filter .12s;
}
.nav-btn .nav-lbl {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.15;
}
#nav-pepper .nav-lbl {
    font-size: 8px;
    white-space: normal;
    line-height: 1.05;
    letter-spacing: -0.02em;
}
.nav-btn.active { color: var(--text); background: var(--surface-2); }
.nav-btn.active .nav-ico { filter: grayscale(0); }

/* ===================== Шторка дня ===================== */
.sheet-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    backdrop-filter: blur(2px); z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: opacity .24s ease, visibility .24s;
}
.sheet-backdrop.open { opacity: 1; visibility: visible; }
.sheet-backdrop.closing { opacity: 0; visibility: visible; }

.sheet {
    position: fixed; left: 0; right: 0; bottom: 0;
    max-width: 520px; margin: 0 auto;
    background: var(--bg-2);
    border-radius: 24px 24px 0 0;
    border-top: 1px solid var(--border);
    padding: 12px 18px calc(24px + env(safe-area-inset-bottom));
    z-index: 50; box-shadow: var(--shadow);
    transform: translateY(100%);
    visibility: hidden;
    transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility .28s;
    touch-action: pan-y;
    will-change: transform;
}
.sheet.open { transform: translateY(0); visibility: visible; }
.sheet.closing { transform: translateY(100%); visibility: visible; }

.sheet-handle {
    width: 40px; height: 4px; border-radius: 2px;
    background: var(--border); margin: 2px auto 14px;
    cursor: grab;
}
.sheet-handle:active { cursor: grabbing; }
.sheet-title { font-size: 18px; font-weight: 800; margin-bottom: 14px; text-transform: capitalize; }
.sheet-section { margin-bottom: 16px; }
.sheet-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.sheet-people {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sheet-person {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    column-gap: 12px;
    align-items: center;
    width: 100%;
}
.sheet-person .avatar {
    width: 48px;
    height: 48px;
    font-size: 20px;
    grid-row: 1 / -1;
}
.sheet-person-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 4px;
    min-width: 0;
    width: 100%;
}
.sheet-person-name,
.sheet-person-info .person-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.sheet-person-info > .name-with-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    max-width: 100%;
}
.sheet-person-info > .name-with-title .person-name {
    flex: 0 1 auto;
    max-width: 100%;
}
.sheet-person-info > .name-with-title .title-badge {
    flex-shrink: 0;
}
.sheet-person-desc {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.3;
}
.sheet-empty { color: var(--muted); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
    .sheet, .sheet-backdrop { transition-duration: .01ms; }
}

/* ===================== Загрузка / ошибки / тост ===================== */
body.booting .app { opacity: 0.45; pointer-events: none; }

.boot-error {
    min-height: 60dvh;
    display: grid;
    place-content: center;
    text-align: center;
    padding: 24px;
    gap: 10px;
}
.boot-error p { color: var(--text); font-weight: 700; font-size: 16px; }
.boot-hint { color: var(--muted) !important; font-weight: 500 !important; font-size: 13px !important; }

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(88px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(12px);
    max-width: min(92vw, 420px);
    padding: 11px 16px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--bg-2) 88%, transparent);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 60;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===================== Страница для браузера ===================== */
.browser-landing {
    display: none;
    min-height: 100dvh;
    padding: 28px 16px calc(32px + env(safe-area-inset-bottom));
    overflow-y: auto;
}
.browser-landing-inner {
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
}

.browser-hero { text-align: center; margin-bottom: 28px; }
.browser-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    border-radius: 20px;
    background: var(--accent-grad);
    display: grid;
    place-items: center;
    box-shadow: 0 8px 28px color-mix(in srgb, var(--accent) 45%, transparent);
}
.browser-logo svg { width: 38px; height: 38px; }
.browser-title {
    font-family: "Space Grotesk", system-ui, sans-serif;
    font-size: 34px;
    font-weight: 800;
    margin-bottom: 8px;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.browser-tagline {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.5;
    max-width: 360px;
    margin: 0 auto;
}

.browser-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px 16px;
    margin-bottom: 14px;
}
.browser-h2 {
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 12px;
}
.browser-p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 10px;
}
.browser-p:last-child { margin-bottom: 0; }
.browser-muted { color: var(--muted); font-size: 13px; }

.browser-features {
    list-style: none;
    display: grid;
    gap: 10px;
}
.browser-features li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.45;
}
.bf-ico {
    font-size: 20px;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}
.browser-features b { font-weight: 700; }

.browser-steps {
    margin: 0;
    padding-left: 1.2rem;
    display: grid;
    gap: 10px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
}
.browser-steps li::marker { color: var(--accent); }

.browser-why-list {
    list-style: none;
    display: grid;
    gap: 8px;
    margin: 12px 0;
    font-size: 14px;
}
.browser-why-list li {
    padding-left: 22px;
    position: relative;
    line-height: 1.45;
}
.browser-why-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--off);
    font-weight: 800;
}

.browser-footer {
    text-align: center;
    margin-top: 22px;
    padding-top: 8px;
}
.browser-cta {
    display: block;
    width: 100%;
    padding: 15px 18px;
    border-radius: 14px;
    background: var(--accent-grad);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    text-decoration: none;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent);
    margin-bottom: 8px;
}
.browser-cta:active { transform: scale(.98); }
.browser-cta-hint {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 14px;
    line-height: 1.4;
}
.browser-cta-secondary {
    display: inline-block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.browser-cta-secondary:hover { color: var(--text); }

/* ===================== Обучалка ===================== */
.onboarding-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(4px);
    z-index: 80;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
}
.onboarding-backdrop.open { opacity: 1; visibility: visible; }

.onboarding {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 20px 16px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
}
.onboarding.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.onboarding-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 22px 20px 18px;
    box-shadow: var(--shadow);
}
.onboarding-progress {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 18px;
}
.onboarding-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border);
    transition: background .2s, transform .2s;
}
.onboarding-dot.active {
    background: var(--accent);
    transform: scale(1.2);
}
.onboarding-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 10px;
}
.onboarding-title {
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 10px;
}
.onboarding-text {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
    text-align: center;
    min-height: 66px;
    margin-bottom: 18px;
}
.onboarding-nav {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}
.onboarding-nav .onboarding-next { flex: 1; }
.onboarding-nav .onboarding-next.final {
    font-size: 14px;
    padding: 11px 14px;
}

/* ===================== Игры / Кости ===================== */
.games-hero {
    text-align: center;
    padding: 8px 4px 12px;
}
.games-hero-ico { font-size: 42px; margin-bottom: 6px; }
.games-hero h2 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.games-hero p { color: var(--muted); font-size: 13px; }
.games-tabs-wrap { display: flex; justify-content: center; margin-bottom: 14px; }
.segmented-games button {
    min-width: 44px;
    font-size: 18px;
    padding: 8px 10px;
}

.roulette-countdown {
    position: relative;
    height: 34px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 12px;
}
.roulette-countdown-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    background: linear-gradient(90deg, #e74c3c, #ff6b6b);
    transition: width 0.25s linear;
}
.roulette-countdown.is-spinning .roulette-countdown-fill {
    background: linear-gradient(90deg, #7c5cff, #36c5ff);
    animation: roulette-pulse 1s ease-in-out infinite;
}
.roulette-countdown.is-revealed .roulette-countdown-fill {
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    animation: none;
}
.roulette-countdown.is-revealed .roulette-countdown-text {
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
@keyframes roulette-pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}
.roulette-countdown-text {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.roulette-wheel-wrap {
    position: relative;
    margin-bottom: 10px;
}
.roulette-wheel-viewport {
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #12121c;
    height: 64px;
}
.roulette-wheel-pointer {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    margin-left: -1.5px;
    background: #fff;
    box-shadow: 0 0 8px rgba(255,255,255,.8);
    z-index: 2;
    border-radius: 2px;
}
.roulette-wheel-track {
    display: flex;
    gap: 4px;
    padding: 8px 0;
    will-change: transform;
}
.roulette-wheel-cell {
    flex: 0 0 48px;
    height: 48px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 900;
    color: #fff;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,.25);
}
.roulette-wheel-cell.is-red { background: #c0392b; }
.roulette-wheel-cell.is-black { background: #2c2c3a; }
.roulette-wheel-cell.is-green { background: #27ae60; }

.roulette-history {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0 10px;
    margin-bottom: 8px;
    scrollbar-width: none;
}
.roulette-history::-webkit-scrollbar { display: none; }
.roulette-history-dot {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
}
.roulette-history-dot.is-red { background: #c0392b; }
.roulette-history-dot.is-black { background: #2c2c3a; }
.roulette-history-dot.is-green { background: #27ae60; }

.roulette-controls {
    margin-bottom: 12px;
}
.roulette-balance {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 8px;
}
.roulette-bet-input {
    width: 100%;
    margin-bottom: 8px;
}
.roulette-bet-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.roulette-quick-btn {
    flex: 1 1 calc(25% - 6px);
    min-width: 52px;
    padding: 8px 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.roulette-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.roulette-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px;
}
.roulette-col-bet {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 10px 6px;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    margin-bottom: 8px;
}
.roulette-col-bet:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.roulette-col-bet-red { background: #c0392b; }
.roulette-col-bet-green { background: #27ae60; }
.roulette-col-bet-black { background: #2c2c3a; }
.roulette-col-mine {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
}
.roulette-col-total {
    font-size: 10px;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 8px;
}
.roulette-col-players {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 140px;
    overflow-y: auto;
}
.roulette-player {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: start;
    gap: 6px;
    font-size: 10px;
}
.roulette-player .avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
    margin-top: 2px;
}
.roulette-player-name,
.roulette-player .name-with-title {
    font-weight: 700;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.25;
    min-width: 0;
    min-height: 26px;
}
.roulette-player-amt {
    align-self: center;
    font-weight: 800;
    color: var(--off);
    white-space: nowrap;
}
.roulette-player-delta,
.roulette-mine-delta {
    font-weight: 800;
    margin-left: 2px;
}
.roulette-player-delta.is-win,
.roulette-mine-delta.is-win,
.roulette-col-mine.is-win {
    color: #2ecc71;
}
.roulette-player-delta.is-loss,
.roulette-mine-delta.is-loss,
.roulette-col-mine.is-loss {
    color: #e74c3c;
}

/* ===================== Колесо ×2–×10 (Majestic-style) ===================== */
.wheel-history {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    min-height: 22px;
}
.wheel-history-dot {
    min-width: 28px;
    height: 22px;
    padding: 0 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    display: grid;
    place-items: center;
}
.wheel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 10px;
}
.wheel-meta span:last-child { margin-left: auto; }
.wheel-columns {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.wheel-col .roulette-col-mine,
.wheel-col .roulette-col-total {
    font-size: 10px;
}
.wheel-slot-picks {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 8px 0;
}
.wheel-slot-pick,
.wheel-col-bet {
    border: none;
    border-radius: 10px;
    padding: 8px 4px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    color: #fff;
}
.wheel-slot-pick:active,
.wheel-col-bet:active { transform: scale(.96); }
.wheel-slot-pick.is-selected {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px color-mix(in srgb, var(--accent) 70%, transparent);
}
.wheel-wheel-track .roulette-wheel-cell.is-x2 {
    background: #cbd5e1;
    color: #0f172a;
}
.wheel-wheel-track .roulette-wheel-cell.is-x3 {
    background: #ec4899;
    color: #fff;
}
.wheel-wheel-track .roulette-wheel-cell.is-x5 {
    background: #22c55e;
    color: #fff;
}
.wheel-wheel-track .roulette-wheel-cell.is-x10 {
    background: #eab308;
    color: #1a1200;
}
.wheel-col-bet.is-x2, .wheel-slot-pick.is-x2, .wheel-history-dot.is-x2 { background: #94a3b8; color: #0f172a; }
.wheel-col-bet.is-x3, .wheel-slot-pick.is-x3, .wheel-history-dot.is-x3 { background: #ec4899; }
.wheel-col-bet.is-x5, .wheel-slot-pick.is-x5, .wheel-history-dot.is-x5 { background: #22c55e; }
.wheel-col-bet.is-x10, .wheel-slot-pick.is-x10, .wheel-history-dot.is-x10 { background: #eab308; color: #1a1200; }
.wheel-col-bet:disabled, .wheel-slot-pick:disabled { opacity: .45; cursor: not-allowed; }

/* компактные строки игроков в 4 колонках колеса */
.wheel-col .roulette-col-players {
    max-height: 120px;
    gap: 4px;
}
.wheel-col .roulette-player {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    grid-template-areas:
        "av name"
        "av amt";
    gap: 1px 4px;
    align-items: center;
}
.wheel-col .roulette-player .avatar {
    grid-area: av;
    width: 22px;
    height: 22px;
    font-size: 10px;
    margin-top: 0;
    align-self: center;
}
.wheel-col .roulette-player-name,
.wheel-col .roulette-player > .name-with-title {
    grid-area: name;
    min-width: 0;
    min-height: 0;
}
.wheel-col .roulette-player > .name-with-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    flex-wrap: nowrap;
}
.wheel-col .roulette-player-name,
.wheel-col .roulette-player .person-name {
    display: block;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    word-break: normal;
    overflow-wrap: normal;
}
.wheel-col .roulette-player .title-badge {
    font-size: 7px;
    padding: 1px 3px;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wheel-col .roulette-player-amt {
    grid-area: amt;
    justify-self: start;
    align-self: start;
    font-size: 9px;
    line-height: 1.1;
}

/* ===================== Джекпот ===================== */
.jackpot-pot {
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #f59e0b, #eab308, #f59e0b);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: brand-flow 4s linear infinite;
}
.jackpot-bet-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin: 8px 0;
}
.jackpot-bet-row .mini-btn { white-space: nowrap; }
.jackpot-hint { margin: 8px 0 0; font-size: 11px; }
.jackpot-entries {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}
.jackpot-entry {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.jackpot-entry.is-me {
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.jackpot-entry.is-winner {
    border-color: color-mix(in srgb, #eab308 55%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, #eab308 35%, transparent);
}
.jackpot-entry .avatar { width: 32px; height: 32px; font-size: 14px; }
.jackpot-entry-info { min-width: 0; }
.jackpot-entry-name {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jackpot-entry-amt {
    font-size: 12px;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}
.jackpot-entry-chance {
    font-size: 10px;
    color: var(--muted);
    font-weight: 600;
}
.jackpot-wheel-wrap .roulette-wheel-viewport { height: 72px; }
.jackpot-wheel-cell {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    margin-right: 6px;
}
.jackpot-wheel-cell .jackpot-wheel-avatar,
.jackpot-wheel-cell .avatar {
    width: 48px;
    height: 48px;
    font-size: 18px;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
}

.dice-toolbar { margin-bottom: 12px; }
.dice-toolbar-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.dice-toolbar .mini-btn { width: 100%; }

.dice-history-back { width: 100%; margin-bottom: 12px; }
.dice-history-list { display: flex; flex-direction: column; gap: 10px; }

.dice-history-card {
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 12px;
}
.dice-history-card.is-win {
    border-color: color-mix(in srgb, var(--off) 45%, transparent);
}
.dice-history-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}
.dice-history-date { font-size: 12px; font-weight: 700; }
.dice-history-meta { font-size: 11px; color: var(--muted); text-align: right; }
.dice-history-players {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dice-history-player {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 10px;
}
.dice-history-player .avatar { width: 36px; height: 36px; font-size: 16px; }
.dice-history-pname {
    font-size: 13px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.dice-history-pname small { display: block; font-size: 10px; font-weight: 600; color: var(--muted); }
.dice-history-pname .person-name,
.dice-history-pname .name-with-title {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.25;
}
.dice-history-roll {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: #fff;
    color: #14142b;
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.dice-history-roll.winner {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--off) 65%, transparent);
}

[data-theme="light"] .dice-history-card {
    background: #fff;
    border: 1.5px solid color-mix(in srgb, #14142b 14%, transparent);
}

.dice-room-card {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.dice-room-card .avatar { width: 40px; height: 40px; font-size: 18px; flex-shrink: 0; align-self: center; }
.dice-room-meta { flex: 1; min-width: 0; min-height: 36px; display: flex; flex-direction: column; justify-content: center; }
.dice-room-meta b,
.dice-room-meta b .name-with-title,
.dice-room-meta b .person-name {
    display: block;
    font-size: 14px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.dice-room-meta small { color: var(--muted); font-size: 11px; }
.dice-room-card > .mini-btn { align-self: center; flex-shrink: 0; }

.dice-active {
    margin-bottom: 14px;
    padding: 16px 14px;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    text-align: center;
}
.dice-active-title { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.dice-active-sub { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.dice-countdown {
    font-size: 42px;
    font-weight: 800;
    font-family: "Space Grotesk", system-ui, sans-serif;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 8px 0 14px;
}

.dice-players {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin: 12px 0;
}
.dice-player {
    display: grid;
    grid-template-rows: auto 56px auto;
    align-items: center;
    justify-items: center;
    gap: 6px;
    width: 88px;
}
.dice-player .avatar { width: 48px; height: 48px; font-size: 22px; }
.dice-player-name {
    font-size: 11px;
    font-weight: 700;
    max-width: 100%;
    width: 100%;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    overflow: hidden;
}
.dice-player-name .person-name {
    max-width: 100%;
    width: 100%;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
}
.dice-player-name .title-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}
.dice-cube {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: #fff;
    color: #14142b;
    display: grid;
    place-items: center;
    font-size: 32px;
    font-weight: 800;
    box-shadow: 0 6px 20px rgba(0,0,0,.22), inset 0 0 0 2px rgba(0,0,0,.06);
}
.dice-cube.rolling {
    animation: diceRoll 0.12s linear infinite;
}
.dice-cube.reveal {
    animation: dicePop 0.45s cubic-bezier(.2,.8,.2,1);
}
.poker-player .poker-cards {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 6px;
}
.poker-card {
    width: 34px;
    height: 46px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #1a1a28;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.poker-card.red { color: #ff6b6b; }
.poker-card.back {
    background: linear-gradient(135deg, #2a3a5c, #1a2540);
    color: rgba(255, 255, 255, 0.35);
    font-size: 14px;
}
.poker-card.winner-glow {
    box-shadow: 0 0 12px rgba(255, 214, 10, 0.55);
    border-color: rgba(255, 214, 10, 0.65);
}
.poker-hand-label {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
    text-align: center;
    min-height: 14px;
}
.poker-players {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
}
.poker-player {
    display: grid;
    grid-template-rows: auto 56px auto;
    align-items: center;
    justify-items: center;
    gap: 6px;
    min-width: 120px;
}
.poker-player .avatar { width: 48px; height: 48px; font-size: 22px; }
.poker-player-name {
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    width: 100%;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    overflow: hidden;
}
.poker-player-name .person-name {
    max-width: 100%;
    width: 100%;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
}
.poker-player-name .title-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}
.poker-history-cards {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.poker-history-cards .poker-card {
    width: 26px;
    height: 34px;
    font-size: 9px;
}
.poker-history-hand {
    font-size: 11px;
    color: var(--muted);
    text-align: right;
}

.dice-cube.winner-glow {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--off) 70%, transparent),
                0 8px 24px color-mix(in srgb, var(--off) 35%, transparent);
}
@keyframes diceRoll {
    0% { transform: rotate(-8deg) scale(1); }
    50% { transform: rotate(8deg) scale(1.06); }
    100% { transform: rotate(-8deg) scale(1); }
}
@keyframes dicePop {
    0% { transform: scale(.3) rotate(-20deg); opacity: 0; }
    70% { transform: scale(1.08) rotate(4deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); }
}

.dice-result-win { color: var(--off); font-weight: 800; font-size: 15px; margin-top: 8px; }
.dice-result-lose { color: var(--muted); font-size: 14px; margin-top: 8px; }

.dice-create-backdrop {
    position: fixed; inset: 0; z-index: 95;
    background: rgba(0,0,0,.6);
    opacity: 0; visibility: hidden;
    transition: opacity .25s, visibility .25s;
}
.dice-create-backdrop.open { opacity: 1; visibility: visible; }
.dice-create-modal {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-items: center; padding: 20px;
    opacity: 0; visibility: hidden;
    transition: opacity .25s, visibility .25s;
    pointer-events: none;
}
.dice-create-modal.open { opacity: 1; visibility: visible; pointer-events: auto; }
.dice-create-card {
    width: 100%; max-width: 360px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 20px 18px;
    box-shadow: var(--shadow);
}
.dice-create-card h2 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.dice-create-hint { font-size: 13px; color: var(--muted); margin-bottom: 14px; line-height: 1.4; }
.dice-bet-input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    padding: 10px 12px;
}
.dice-create-submit { width: 100%; margin-top: 8px; }
.dice-create-cancel { width: 100%; margin-top: 8px; }

.segmented-games {
    width: 100%;
    max-width: 340px;
}
.segmented-games button {
    font-size: 11px;
    padding: 8px 6px;
    white-space: nowrap;
}

.rps-choices {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 14px 0 8px;
}
.rps-choices-modal {
    margin: 8px 0 4px;
}
.rps-choice-btn.selected {
    border-color: var(--off);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--off) 45%, transparent),
                0 6px 18px rgba(0,0,0,.18);
    transform: scale(1.04);
}
.admin-hint { margin-bottom: 10px; }
.admin-divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0 12px;
}
.admin-grant-mode {
    width: 100%;
}
.admin-grant-mode button {
    font-size: 11px;
    padding: 8px 6px;
}
.admin-result {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--off);
    line-height: 1.45;
}
.admin-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}
.admin-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    flex-shrink: 0;
}
.admin-user-pick {
    position: relative;
}
.admin-user-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
    font-size: 13px;
    font-weight: 700;
}
.transfer-user-selected {
    justify-content: flex-start;
}
.transfer-user-selected #transfer-user-selected-label {
    flex: 1;
}
.transfer-user-selected #transfer-user-selected-avatar .avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
    flex-shrink: 0;
}
.transfer-user-selected .admin-user-clear {
    margin-left: auto;
}
.admin-user-clear {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
}
.admin-user-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 30;
    max-height: 220px;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}
.admin-user-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
}
.admin-user-option + .admin-user-option {
    border-top: 1px solid var(--border);
}
.admin-user-option:active {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.admin-user-option-main {
    flex: 1;
    min-width: 0;
}
.admin-user-option-name {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-user-option-meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}
.friend-row .f-code {
    font-weight: 600;
    font-size: 12px;
    color: var(--muted);
    margin-left: 4px;
}
.rps-choice-btn {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    border: 2px solid var(--border);
    background: var(--surface);
    font-size: 34px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
    transition: transform .12s, box-shadow .12s;
}
.rps-choice-btn:active {
    transform: scale(.9);
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.rps-hand {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: #fff;
    color: #14142b;
    display: grid;
    place-items: center;
    font-size: 32px;
    box-shadow: 0 6px 20px rgba(0,0,0,.22), inset 0 0 0 2px rgba(0,0,0,.06);
}
.rps-hand.reveal {
    animation: dicePop 0.45s cubic-bezier(.2,.8,.2,1);
}
.rps-hand.winner-glow {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--off) 70%, transparent),
                0 8px 24px color-mix(in srgb, var(--off) 35%, transparent);
}
.rps-tie-msg {
    font-size: 14px;
    font-weight: 700;
    color: var(--muted);
    margin: 8px 0;
}

.clicker-hint {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 10px;
}
.clicker-passive-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 88%, var(--off) 12%);
    border: 1px solid var(--border);
    margin-bottom: 6px;
}
.clicker-passive-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.clicker-passive-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.clicker-passive-amount {
    font-size: 17px;
    font-weight: 800;
}
.clicker-passive-rate {
    font-size: 11px;
    color: var(--muted);
}
.clicker-claim-btn {
    flex-shrink: 0;
    min-width: 96px;
}
.clicker-claim-btn:disabled {
    opacity: 0.45;
}
.clicker-stage {
    display: flex;
    justify-content: center;
    padding: 20px 0 8px;
}
.clicker-ring-wrap {
    position: relative;
    width: 220px;
    height: 220px;
}
.clicker-fx {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
    z-index: 2;
}
.clicker-fly {
    position: absolute;
    left: 50%;
    top: 54%;
    font-size: 22px;
    line-height: 1;
    pointer-events: none;
    animation: clickerFly 0.8s ease-out forwards;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    z-index: 3;
}
@keyframes clickerFly {
    0% {
        opacity: 1;
        transform: translate(calc(-50% + var(--fly-x, 0px)), 0) scale(0.65) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--fly-x, 0px)), -88px) scale(1.05) rotate(var(--fly-rot, 0deg));
    }
}
.clicker-ring {
    --progress: 0;
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        var(--off) calc(var(--progress) * 1%),
        color-mix(in srgb, var(--border) 80%, transparent) 0
    );
    padding: 7px;
    transition: transform .35s ease;
}
.clicker-ring.reward-pulse {
    animation: clickerReward .65s cubic-bezier(.2,.8,.2,1);
}
.clicker-btn {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: none;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px var(--border);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.clicker-btn.pop {
    animation: clickerPop .18s ease;
}
.clicker-kab {
    font-size: 88px;
    line-height: 1;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.18));
    pointer-events: none;
}
.clicker-progress-text {
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--muted);
    margin: 0 0 6px;
}
.clicker-reward {
    text-align: center;
    font-size: 18px;
    font-weight: 800;
    color: var(--off);
    margin-top: 4px;
    animation: clickerRewardText .5s ease;
}
.clicker-upgrades {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}
.clicker-upgrade-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.clicker-upgrade-ico {
    font-size: 26px;
    line-height: 1;
    flex-shrink: 0;
}
.clicker-upgrade-meta {
    flex: 1;
    min-width: 0;
}
.clicker-upgrade-meta b {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
}
.clicker-upgrade-meta small {
    display: block;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.35;
}
.clicker-upgrade-buy {
    flex-shrink: 0;
    min-width: 78px;
}
.clicker-upgrade-buy:disabled {
    opacity: 0.45;
}
@keyframes clickerPop {
    0% { transform: scale(1); }
    50% { transform: scale(.94); }
    100% { transform: scale(1); }
}
@keyframes clickerReward {
    0% { transform: scale(1); filter: brightness(1); }
    40% { transform: scale(1.06); filter: brightness(1.15); }
    100% { transform: scale(1); filter: brightness(1); }
}
@keyframes clickerRewardText {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

[data-theme="light"] .dice-room-card,
[data-theme="light"] .dice-active,
[data-theme="light"] .dice-create-card {
    background: #fff;
    border: 1.5px solid color-mix(in srgb, #14142b 14%, transparent);
}

/* ===================== Мероприятия ===================== */
.events-hero {
    text-align: center;
    padding: 8px 4px 14px;
}
.events-hero-ico { font-size: 42px; margin-bottom: 6px; }
.events-hero h2 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.events-hero p { color: var(--muted); font-size: 13px; line-height: 1.45; }

.event-compose {
    display: grid;
    gap: 8px;
    padding: 12px;
    margin-bottom: 14px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.event-day-input,
.event-text-input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    padding: 10px 12px;
}
.event-text-input { resize: vertical; min-height: 52px; }
.event-day-input:focus,
.event-text-input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

.events-list { display: flex; flex-direction: column; gap: 10px; }
.events-group-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    margin: 6px 2px 2px;
}

.event-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.event-card.is-mine {
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.event-card-body { padding: 12px 12px 10px; }
.event-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.event-card-head .avatar { width: 32px; height: 32px; font-size: 15px; flex-shrink: 0; }
.event-card-meta { min-width: 0; flex: 1; }
.event-card-author { font-size: 13px; font-weight: 800; }
.event-card-date { font-size: 11px; color: var(--muted); }
.event-card-tap {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.event-card-tap:active { opacity: .88; }
.event-card-hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}
.event-card-text { font-size: 14px; line-height: 1.45; margin-bottom: 4px; }
.event-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.event-vote-btn {
    border: 1.5px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.event-vote-btn.active-like {
    border-color: color-mix(in srgb, var(--off) 55%, transparent);
    background: color-mix(in srgb, var(--off) 14%, var(--surface));
}
.event-vote-btn.active-dislike {
    border-color: color-mix(in srgb, #ff6b8a 55%, transparent);
    background: color-mix(in srgb, #ff6b8a 12%, var(--surface));
}
.event-delete-btn {
    margin-left: auto;
    border: none;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 6px;
}
.event-ended-bar {
    display: block;
    text-align: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    background: color-mix(in srgb, var(--muted) 12%, var(--surface));
    border-top: 1px solid var(--border);
    padding: 5px 8px;
}

.sheet-events { display: flex; flex-direction: column; gap: 8px; }
.sheet-event {
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
}
.sheet-event-body { padding: 10px 10px 8px; }
.sheet-event-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.sheet-event-head .avatar { width: 28px; height: 28px; font-size: 13px; }
.sheet-event-author { font-size: 12px; font-weight: 800; }
.sheet-event-text { font-size: 13px; line-height: 1.4; margin-bottom: 4px; }
.sheet-event-hint { font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.sheet-event-votes { display: flex; gap: 6px; }

.event-voters-backdrop {
    position: fixed; inset: 0; z-index: 110;
    background: rgba(0,0,0,.6);
    opacity: 0; visibility: hidden;
    transition: opacity .25s, visibility .25s;
}
.event-voters-backdrop.open { opacity: 1; visibility: visible; }
.event-voters-modal {
    position: fixed; inset: 0; z-index: 115;
    display: grid; place-items: end center;
    padding: 0 0 env(safe-area-inset-bottom);
    opacity: 0; visibility: hidden;
    transition: opacity .25s, visibility .25s;
    pointer-events: none;
}
.event-voters-modal.open { opacity: 1; visibility: visible; pointer-events: auto; }
.event-voters-card {
    width: 100%;
    max-width: 520px;
    max-height: min(82vh, 640px);
    overflow-y: auto;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 22px 22px 0 0;
    padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
    box-shadow: var(--shadow);
}
.event-voters-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.event-voters-date {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 2px;
}
.event-voters-title { font-size: 20px; font-weight: 800; }
.event-voters-close {
    width: 34px; height: 34px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}
.event-voters-text {
    font-size: 15px;
    line-height: 1.45;
    margin-bottom: 10px;
}
.event-voters-author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.event-voters-author .avatar { width: 30px; height: 30px; font-size: 14px; }
.event-voters-author-label { font-size: 11px; color: var(--muted); }
.event-voters-author-name { font-size: 13px; font-weight: 800; }
.event-voters-section { margin-bottom: 14px; }
.event-voters-section h3 {
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 8px;
}
.event-voters-section h3 span {
    color: var(--muted);
    font-weight: 700;
}
.event-voters-list { display: flex; flex-direction: column; gap: 6px; }
.event-voter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.event-voter-row .avatar { width: 34px; height: 34px; font-size: 16px; flex-shrink: 0; }
.event-voter-name { font-size: 14px; font-weight: 700; min-width: 0; }
.event-voters-empty {
    font-size: 13px;
    color: var(--muted);
    padding: 6px 2px;
}
.event-voters-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 4px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

/* ===================== Рейтинг ===================== */
.rating-hero {
    text-align: center;
    padding: 8px 4px 18px;
}
.rating-hero-ico { font-size: 42px; margin-bottom: 6px; }
.rating-hero h2 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.rating-hero p { color: var(--muted); font-size: 13px; }
.rating-type-wrap { display: flex; justify-content: center; margin-bottom: 10px; }
.rating-scope-wrap { display: flex; justify-content: center; margin-bottom: 14px; }
.segmented.segmented-inline {
    width: auto;
    display: inline-flex;
}
.rating-list { display: flex; flex-direction: column; gap: 8px; }
.rating-row {
    display: grid;
    grid-template-columns: 36px 44px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.rating-row.rating-podium-1 {
    border-color: color-mix(in srgb, #f5c542 60%, transparent);
    background: color-mix(in srgb, #f5c542 10%, var(--surface));
    box-shadow: 0 0 0 1px color-mix(in srgb, #f5c542 25%, transparent);
}
.rating-row.rating-podium-2 {
    border-color: color-mix(in srgb, #c0c8d4 55%, transparent);
    background: color-mix(in srgb, #c0c8d4 9%, var(--surface));
    box-shadow: 0 0 0 1px color-mix(in srgb, #c0c8d4 22%, transparent);
}
.rating-row.rating-podium-3 {
    border-color: color-mix(in srgb, #b87333 55%, transparent);
    background: color-mix(in srgb, #b87333 9%, var(--surface));
    box-shadow: 0 0 0 1px color-mix(in srgb, #b87333 22%, transparent);
}
.rating-row.rating-podium.is-me {
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.rating-row > .rating-name,
.rating-row > .name-with-title {
    min-width: 0;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.rating-row > .name-with-title .person-name {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.rating-row.is-me {
    border-color: color-mix(in srgb, var(--accent) 50%, transparent);
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.rating-rank { font-weight: 800; font-size: 13px; color: var(--muted); }
.rating-rank-1 { font-size: 20px; line-height: 1; }
.rating-rank-2 { font-size: 18px; line-height: 1; }
.rating-rank-3 { font-size: 18px; line-height: 1; }
.rating-row .rating-avatar.cos-frame-gold {
    box-shadow: 0 0 0 2.5px #f5c542, 0 0 16px rgba(245, 197, 66, .6);
}
.rating-row .rating-avatar.cos-frame-silver {
    box-shadow: 0 0 0 2.5px #c0c8d4, 0 0 14px rgba(192, 200, 212, .55);
}
.rating-row .rating-avatar.cos-frame-bronze {
    box-shadow: 0 0 0 2.5px #b87333, 0 0 12px rgba(184, 115, 51, .5);
}
.rating-name { font-weight: 700; font-size: 14px; }
.rating-kab { font-weight: 800; font-size: 13px; white-space: nowrap; align-self: center; }

/* ===================== Модалки: серия и график ===================== */
.streak-backdrop, .worktype-backdrop {
    position: fixed; inset: 0; z-index: 95;
    background: rgba(0,0,0,.6);
    opacity: 0; visibility: hidden;
    transition: opacity .25s, visibility .25s;
}
.streak-backdrop.open, .worktype-backdrop.open { opacity: 1; visibility: visible; }

.streak-modal, .worktype-modal {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-items: center; padding: 20px;
    opacity: 0; visibility: hidden;
    transition: opacity .25s, visibility .25s;
    pointer-events: none;
}
.streak-modal.open, .worktype-modal.open { opacity: 1; visibility: visible; pointer-events: auto; }

.streak-card, .worktype-card {
    width: 100%; max-width: 360px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 22px 18px;
    text-align: center;
    box-shadow: var(--shadow);
}
.streak-ico { font-size: 52px; margin-bottom: 8px; }
.streak-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.streak-text { font-size: 15px; margin-bottom: 6px; }
.streak-desc { font-size: 14px; line-height: 1.45; margin-bottom: 10px; }
.streak-hint { font-size: 12px; color: var(--muted); line-height: 1.4; margin-bottom: 16px; }
.streak-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
body.session-kicked #app { pointer-events: none; opacity: 0.35; }
body.session-kicked #session-kicked-modal,
body.session-kicked #session-kicked-backdrop { pointer-events: auto; }

.app-update-bar[hidden] { display: none !important; }

.app-update-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px calc(10px + env(safe-area-inset-top, 0px));
    background: linear-gradient(135deg, #c0392b 0%, #e67e22 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}
.app-update-bar-text { max-width: 520px; }
.app-update-reload-btn {
    border: 0;
    border-radius: 10px;
    padding: 6px 12px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    color: #c0392b;
    background: #fff;
    cursor: pointer;
}
body.app-update-pending #app { pointer-events: none; }
body.app-update-pending .app-update-bar { pointer-events: auto; }
body.app-update-pending.tg-app #brandbar { margin-top: 44px; }
.streak-btn { width: 100%; }
.streak-cal-card { max-width: 380px; text-align: left; }
.streak-cal-head {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.streak-cal-title-wrap { text-align: center; min-width: 0; }
.streak-cal-title-wrap .streak-title { margin-bottom: 2px; font-size: 18px; }
.streak-cal-month { margin-bottom: 0 !important; font-size: 12px !important; }
.streak-cal-nav { width: 36px; height: 36px; padding: 0; }
.streak-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin: 10px 0 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-align: center;
}
.streak-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.streak-cal-cell {
    aspect-ratio: 1;
    min-height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 2px;
    font-size: 11px;
    line-height: 1.1;
}
.streak-cal-cell.empty { visibility: hidden; border: none; background: transparent; }
.streak-cal-cell.future { opacity: .35; }
.streak-cal-cell.missed { opacity: .5; color: var(--muted); }
.streak-cal-cell.claimed {
    border-color: color-mix(in srgb, var(--off) 40%, var(--border));
    background: color-mix(in srgb, var(--off) 12%, var(--surface-2));
}
.streak-cal-cell.claimable {
    border-color: #2ecc71;
    background: color-mix(in srgb, #2ecc71 18%, var(--surface-2));
    cursor: pointer;
    animation: streakPulse 2s ease-in-out infinite;
}
.streak-cal-cell.claimable:active { transform: scale(.94); }
.streak-cal-day { font-weight: 800; font-size: 12px; }
.streak-cal-reward { font-size: 9px; font-weight: 700; color: var(--off); }
.streak-cal-cell.missed .streak-cal-reward,
.streak-cal-cell.future .streak-cal-reward { display: none; }
.streak-cal-cell.claimed .streak-cal-reward::before { content: "+"; }
.streak-cal-close { margin-top: 8px; background: var(--surface-2) !important; }
.streak-btn + .streak-btn { margin-top: 8px; }

.donate-backdrop {
    position: fixed; inset: 0; z-index: 95;
    background: rgba(0,0,0,.6);
    opacity: 0; visibility: hidden;
    transition: opacity .25s, visibility .25s;
}
.donate-backdrop.open { opacity: 1; visibility: visible; }

.donate-modal {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-items: center; padding: 20px;
    opacity: 0; visibility: hidden;
    transition: opacity .25s, visibility .25s;
    pointer-events: none;
}
.donate-modal.open { opacity: 1; visibility: visible; pointer-events: auto; }

.donate-card {
    width: 100%; max-width: 360px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 22px 18px;
    text-align: center;
    box-shadow: var(--shadow);
}
.donate-ico { font-size: 48px; margin-bottom: 8px; }
.donate-title { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.donate-text { font-size: 13px; color: var(--muted); line-height: 1.45; margin-bottom: 16px; }
.donate-amounts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.donate-amt {
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    padding: 11px 6px;
    border-radius: 12px;
    cursor: pointer;
}
.donate-amt:active { transform: scale(.97); }
.donate-amt:disabled { opacity: .5; cursor: wait; }
.donate-close { width: 100%; }

.worktype-card h2 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.worktype-card > p { font-size: 13px; color: var(--muted); margin-bottom: 14px; line-height: 1.45; }
.worktype-opt {
    width: 100%;
    display: flex; align-items: center; gap: 12px;
    text-align: left;
    border: 1.5px solid var(--border);
    background: var(--surface);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 10px;
    cursor: pointer;
    color: var(--text);
    font: inherit;
}
.worktype-opt:active { transform: scale(.98); }
.wo-ico { font-size: 26px; }
.worktype-opt b { display: block; font-size: 15px; }
.worktype-opt small { color: var(--muted); font-size: 12px; }

[data-theme="light"] .donate-card,
[data-theme="light"] .donate-amt,
[data-theme="light"] .worktype-opt,
[data-theme="light"] .rating-row,
[data-theme="light"] .event-card,
[data-theme="light"] .event-compose,
[data-theme="light"] .sheet-event {
    background: #fff;
    border: 1.5px solid color-mix(in srgb, #14142b 14%, transparent);
}
[data-theme="light"] .event-day-input,
[data-theme="light"] .event-text-input,
[data-theme="light"] .event-vote-btn {
    background: #f6f7fb;
    border: 1.5px solid color-mix(in srgb, #14142b 12%, transparent);
}

/* ===================== Магазин ===================== */
.shop-backdrop {
    position: fixed; inset: 0; z-index: 88;
    background: rgba(0,0,0,.65);
    opacity: 0; visibility: hidden;
    transition: opacity .25s, visibility .25s;
}
.shop-backdrop.open { opacity: 1; visibility: visible; }
.shop-screen {
    position: fixed; inset: 0; z-index: 90;
    background: var(--bg);
    display: flex; flex-direction: column;
    padding: max(8px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
    overflow: hidden;
    opacity: 0; visibility: hidden;
    transform: translateY(12px);
    transition: opacity .25s, visibility .25s, transform .25s;
}
.shop-screen.open { opacity: 1; visibility: visible; transform: translateY(0); }
.shop-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
    flex-shrink: 0;
}
.shop-top {
    flex-shrink: 0;
}
.shop-catalog-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    margin: 0 -2px;
    padding: 2px 2px 4px;
}
.shop-footer {
    flex-shrink: 0;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.shop-head h2 { font-size: 20px; font-weight: 800; }
.shop-close {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    -webkit-tap-highlight-color: transparent;
}
.shop-close:active {
    background: color-mix(in srgb, var(--text) 12%, var(--surface-2));
}
:root:not([data-theme="light"]) .shop-close {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #f4f4fb;
}
.shop-balance-line { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.shop-balance-line b { color: var(--text); }
.shop-preview {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 10px 12px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 8px;
}
.shop-preview-avatar { display: flex; justify-content: center; margin-bottom: 0; flex-shrink: 0; }
.shop-preview-meta { min-width: 0; }
.shop-preview-name { font-size: 17px; font-weight: 800; margin-bottom: 4px; line-height: 1.2; }
.shop-preview-desc {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.shop-preview-price { font-size: 13px; font-weight: 800; margin-top: 6px; color: var(--off); }
.shop-tabs, .shop-durations { margin-bottom: 8px; justify-content: center; }
.shop-search {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
}
.shop-search::placeholder { color: var(--muted); }
.shop-catalog {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-content: start;
    margin-bottom: 12px;
}
.shop-item-card {
    border: 1.5px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    padding: 10px 8px;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: var(--text);
    min-width: 0;
}
.shop-item-card.active {
    border-color: color-mix(in srgb, var(--off) 55%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--off) 35%, transparent);
}
.shop-item-card.owned { opacity: .92; }
.shop-item-card b { display: block; font-size: 13px; margin-bottom: 4px; }
.shop-item-card small { font-size: 11px; color: var(--muted); line-height: 1.35; display: block; }
.shop-item-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    margin-top: 6px;
    margin-right: 4px;
    padding: 2px 6px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--off) 18%, transparent);
}
.shop-item-badge.shop-tier {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
}
.shop-item-badge.is-forever {
    background: color-mix(in srgb, var(--off) 28%, transparent);
    color: var(--off);
}
.shop-equip-status {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.shop-equip-status span {
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
}
.shop-equip-status small {
    color: var(--muted);
    font-size: 10px;
}
.shop-buy-btn { width: 100%; margin-bottom: 0; }

/* ===================== Админ-панель ===================== */
.admin-backdrop {
    position: fixed; inset: 0; z-index: 88;
    background: rgba(0,0,0,.65);
    opacity: 0; visibility: hidden;
    transition: opacity .25s, visibility .25s;
}
.admin-backdrop.open { opacity: 1; visibility: visible; }
.admin-screen {
    position: fixed; inset: 0; z-index: 90;
    background: var(--bg);
    display: flex; flex-direction: column;
    padding: max(8px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
    overflow: hidden;
    opacity: 0; visibility: hidden;
    transform: translateY(12px);
    transition: opacity .25s, visibility .25s, transform .25s;
}
.admin-screen.open { opacity: 1; visibility: visible; transform: translateY(0); }
.admin-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px; flex-shrink: 0;
}
.admin-head h2 { font-size: 20px; font-weight: 800; }
.admin-close {
    width: 36px; height: 36px; border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 18px; font-weight: 700;
    cursor: pointer;
    display: grid; place-items: center;
}
.admin-scroll {
    flex: 1; overflow-y: auto; min-height: 0;
    display: flex; flex-direction: column; gap: 14px;
}
.admin-section {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    padding: 14px 12px;
}
.admin-section h3 {
    font-size: 15px; font-weight: 800;
    margin-bottom: 10px;
}
.admin-game-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 10px;
    background: var(--surface-2);
}
.admin-game-card h4 {
    font-size: 13px; font-weight: 800;
    margin-bottom: 8px;
    display: flex; align-items: center; justify-content: space-between;
}
.admin-game-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.admin-game-fields .field { margin: 0; }
.admin-game-fields .field.full { grid-column: 1 / -1; }
.admin-economy-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.admin-economy-grid .field { margin: 0; }
.admin-economy-grid .field.full { grid-column: 1 / -1; }

.shop-equipped {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.shop-equipped h3 { font-size: 14px; font-weight: 800; margin-bottom: 8px; }
.shop-equip-grid { display: flex; flex-direction: column; gap: 8px; }
.shop-equip-row {
    display: grid;
    grid-template-columns: 72px 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 12px;
}
.shop-equip-row b { display: block; font-size: 13px; }
.shop-equip-row span { color: var(--muted); font-size: 11px; }
.shop-equip-row .mini-btn { padding: 6px 10px; font-size: 11px; }
.shop-equip-row select {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 11px;
    padding: 6px 8px;
    max-width: 110px;
}
.shop-preview-av { width: 72px !important; height: 72px !important; font-size: 32px !important; }
.shop-stack-hint {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    margin: -4px 0 10px;
    line-height: 1.35;
}

@media (max-height: 720px), (max-width: 390px) {
    .shop-preview { padding: 8px 10px; margin-bottom: 6px; gap: 10px; }
    .shop-preview-name { font-size: 15px; }
    .shop-preview-desc { font-size: 10px; -webkit-line-clamp: 1; }
    .shop-preview-av { width: 52px !important; height: 52px !important; font-size: 24px !important; }
    .shop-stack-hint { display: none; }
    .shop-tabs, .shop-durations { margin-bottom: 6px; }
    .shop-balance-line { margin-bottom: 6px; }
    .shop-search { margin-bottom: 6px; padding: 8px 10px; }
}

/* ===================== Косметика: рамки (стакаются) ===================== */
.avatar.cos-frame-bronze {
    box-shadow: 0 0 0 2px #b87333, 0 0 10px rgba(184, 115, 51, .45);
}
.avatar.cos-frame-silver {
    box-shadow: 0 0 0 2px #c0c8d4, 0 0 12px rgba(192, 200, 212, .5);
}
.avatar.cos-frame-gold {
    box-shadow: 0 0 0 2px #f5c542, 0 0 14px rgba(245, 197, 66, .55);
}
.avatar.cos-frame-neon {
    box-shadow: 0 0 0 2px var(--accent), 0 0 18px color-mix(in srgb, var(--accent) 65%, transparent);
    animation: cosNeonFrame 1.4s ease-in-out infinite;
}
.avatar.cos-frame-ice {
    box-shadow: 0 0 0 2px #6ee7ff, 0 0 16px rgba(80, 200, 255, .55);
}
.avatar.cos-frame-flame {
    box-shadow: 0 0 0 2px #ff6b2c, 0 0 16px rgba(255, 90, 20, .7);
    animation: cosFlameFrame .8s ease-in-out infinite alternate;
}
.avatar.cos-frame-diamond {
    box-shadow: 0 0 0 2px #e8f4ff, 0 0 20px rgba(180, 220, 255, .75);
    animation: cosDiamondFrame 2s ease-in-out infinite;
}

/* ===================== Косметика: шрифты (стакаются) ===================== */
.cos-font-clean {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-weight: 500;
    letter-spacing: .01em;
}
.cos-font-round {
    font-family: "Manrope", system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: .02em;
}
.cos-font-bold {
    font-family: "Manrope", system-ui, sans-serif;
    font-weight: 900;
    letter-spacing: -.01em;
}
.cos-font-cyber {
    font-family: "Space Grotesk", system-ui, sans-serif;
    letter-spacing: .06em;
    text-transform: uppercase;
    font-size: .9em;
}
.cos-font-elegant {
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    letter-spacing: .03em;
}
.cos-font-retro {
    font-family: "Courier New", Courier, monospace;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-size: .88em;
}
.cos-font-mono {
    font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
    font-weight: 600;
    letter-spacing: -.02em;
    font-size: .94em;
}

/* ===================== Косметика: анимации (стакаются) ===================== */
.avatar.cos-anim-pulse::before {
    content: "";
    position: absolute; inset: -5px;
    border-radius: inherit;
    border: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
    animation: cosPulse 1.6s ease-in-out infinite;
    pointer-events: none;
}
.avatar.cos-anim-sparkle::after {
    content: "✦";
    position: absolute;
    top: -2px; right: -2px;
    font-size: 12px;
    color: #ffe566;
    animation: cosSparkle 1.2s ease-in-out infinite;
    pointer-events: none;
}
.avatar.cos-anim-flame-aura {
    animation: cosFlameAura .9s ease-in-out infinite alternate;
}
.cos-anim-glow {
    text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 80%, transparent),
                 0 0 16px color-mix(in srgb, var(--accent-2) 50%, transparent);
}
.cos-anim-flame-text {
    background: linear-gradient(90deg, #ff4500, #ffae00, #ff4500);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: cosFlameText 1.2s linear infinite;
}
.cos-anim-rainbow {
    background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #ff6b6b);
    background-size: 300% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: cosRainbow 2.5s linear infinite;
}
.cos-anim-glitch {
    position: relative;
    animation: cosGlitch 2.5s steps(2, end) infinite;
    text-shadow: 2px 0 #ff3b3b, -2px 0 #3b9eff;
}

@keyframes cosPulse {
    0%, 100% { transform: scale(1); opacity: .75; }
    50% { transform: scale(1.08); opacity: 1; }
}
@keyframes cosSparkle {
    0%, 100% { opacity: .4; transform: scale(.8) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.2) rotate(20deg); }
}
@keyframes cosFlameFrame {
    0% { box-shadow: 0 0 0 2px #ff6b2c, 0 0 12px rgba(255, 90, 20, .5); }
    100% { box-shadow: 0 0 0 3px #ffae00, 0 0 22px rgba(255, 140, 0, .85); }
}
@keyframes cosDiamondFrame {
    0%, 100% { filter: hue-rotate(0deg) brightness(1); }
    50% { filter: hue-rotate(25deg) brightness(1.15); }
}
@keyframes cosNeonFrame {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.25); }
}
@keyframes cosFlameAura {
    0% { filter: drop-shadow(0 0 4px rgba(255, 100, 0, .5)); }
    100% { filter: drop-shadow(0 0 10px rgba(255, 160, 0, .9)); }
}
@keyframes cosFlameText {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}
@keyframes cosRainbow {
    0% { background-position: 0% center; }
    100% { background-position: 300% center; }
}
@keyframes cosGlitch {
    0%, 92%, 100% { transform: translate(0); }
    93% { transform: translate(-1px, 1px); }
    95% { transform: translate(1px, -1px); }
    97% { transform: translate(-1px, 0); }
}

/* Шашки 8×8 */
.checkers-hint {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
    margin: 8px 0 4px;
}
.checkers-status {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    justify-content: center;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 10px;
}
.checkers-status strong { color: var(--text); }
.checkers-board-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
    position: relative;
}
.checkers-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: min(100%, 320px);
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.checkers-board.is-animating .checkers-cell {
    pointer-events: none;
}
.checkers-status.is-animating {
    color: var(--text);
    animation: checkersStatusPulse 1.2s ease-in-out infinite;
}
@keyframes checkersStatusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}
.checkers-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
}
.checkers-cell.light {
    background: #d8c9a8;
}
.checkers-cell.dark {
    background: #6b4f2d;
}
.checkers-cell.dark.is-playable {
    cursor: pointer;
}
.checkers-cell.is-selected {
    box-shadow: inset 0 0 0 3px #ffd54f;
}
.checkers-cell.is-target {
    box-shadow: inset 0 0 0 3px #4fc3f7;
    animation: checkersTargetPulse 1.1s ease-in-out infinite;
}
@keyframes checkersTargetPulse {
    0%, 100% { box-shadow: inset 0 0 0 3px #4fc3f7; }
    50% { box-shadow: inset 0 0 0 3px #81d4fa, inset 0 0 12px rgba(79, 195, 247, 0.45); }
}
.checkers-cell.is-path {
    box-shadow: inset 0 0 0 2px rgba(255, 213, 79, 0.65);
}
.checkers-cell.is-last-move {
    background: #5d7a3a !important;
}
.checkers-cell.is-bot-move {
    background: #4a3d6b !important;
}
.checkers-piece {
    width: 72%;
    height: 72%;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.25);
    box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.35), 0 2px 4px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    position: relative;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.checkers-flyer {
    position: absolute;
    z-index: 6;
    margin: 0;
    pointer-events: none;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}
.checkers-piece.is-pulse {
    animation: checkersPiecePulse 1s ease-in-out infinite;
}
.checkers-piece.is-capturing {
    animation: checkersCapture 0.26s ease-in forwards;
}
@keyframes checkersPiecePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}
@keyframes checkersCapture {
    0% { transform: scale(1); opacity: 1; }
    40% { transform: scale(1.15); opacity: 0.85; }
    100% { transform: scale(0); opacity: 0; }
}
.checkers-piece.is-white {
    background: radial-gradient(circle at 35% 30%, #fff 0%, #e8e8e8 55%, #bdbdbd 100%);
}
.checkers-piece.is-black {
    background: radial-gradient(circle at 35% 30%, #555 0%, #2a2a2a 55%, #111 100%);
    border-color: rgba(255, 255, 255, 0.15);
}
.checkers-piece.is-king::after {
    content: "♔";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 55%;
    color: rgba(255, 215, 0, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.checkers-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}
.checkers-result {
    margin-top: 12px;
    padding: 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}
.checkers-result.is-win { border-color: #27ae60; color: #2ecc71; }
.checkers-result.is-lose { border-color: #c0392b; color: #e74c3c; }
.checkers-result.is-draw { border-color: #f39c12; color: #f1c40f; }

/* ===================== Цех (idle factory) ===================== */
.factory-top {
    text-align: center;
    padding: 4px 0 10px;
}
.factory-top-row {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 2px;
}
.factory-top-row h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}
.factory-faq-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}
.factory-faq-btn:active { transform: translateY(-50%) scale(.96); }
.factory-faq-card {
    max-width: 400px;
    text-align: center;
    position: relative;
    padding-top: 18px;
}
.factory-faq-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.factory-faq-body {
    text-align: left;
    max-height: min(58vh, 420px);
    overflow-y: auto;
    margin: 0 0 14px;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
}
.factory-faq-section {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.factory-faq-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.factory-faq-section h3 {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 6px;
}
.factory-faq-section p,
.factory-faq-section ul {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    margin: 0;
}
.factory-faq-section ul {
    padding-left: 18px;
}
.factory-faq-section b { color: var(--text); }
.factory-top h2 { font-size: 20px; font-weight: 800; margin-bottom: 2px; }
.factory-season {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 8px;
}
.factory-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.factory-stats-compact { gap: 6px; }
.factory-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 6px;
}
.factory-stat-val {
    display: block;
    font-size: 17px;
    font-weight: 800;
    font-family: "Space Grotesk", sans-serif;
}
.factory-stat-lbl {
    font-size: 10px;
    color: var(--muted);
}
.factory-hero {
    text-align: center;
    padding: 8px 0 16px;
}
.factory-hero-ico { font-size: 42px; margin-bottom: 6px; }
.factory-hero h2 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.factory-warehouse-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
}
.factory-warehouse-card.is-full {
    border-color: #e67e22;
    background: color-mix(in srgb, #e67e22 8%, var(--surface));
}
.factory-wh-head {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}
.factory-wh-bar {
    height: 10px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
    margin-bottom: 8px;
}
.factory-wh-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7f8c8d, #bdc3c7);
    transition: width .3s ease;
}
.factory-warehouse-card.is-full .factory-wh-fill {
    background: linear-gradient(90deg, #e67e22, #f39c12);
}
.factory-wh-hint {
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 10px;
}
.factory-online-hint {
    font-size: 12px;
    color: #27ae60;
    margin: 8px 0 0;
    font-weight: 600;
}
.factory-section-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 10px;
}
.factory-lines {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.factory-line-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
}
.factory-line-card.is-locked { opacity: .85; }
.factory-line-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.factory-line-ico { font-size: 28px; }
.factory-line-head b { display: block; font-size: 14px; }
.factory-line-head small { color: var(--muted); font-size: 11px; }
.factory-line-progress {
    height: 6px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
    margin-bottom: 6px;
}
.factory-line-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: inherit;
    transition: width .4s linear;
}
.factory-line-timer {
    font-size: 11px;
    color: var(--muted);
    margin: 0 0 8px;
}
.factory-line-locked {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
}
.factory-max { font-size: 12px; color: var(--muted); }
.factory-upgrades {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.factory-upgrade-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.factory-upgrade-card.is-owned {
    opacity: .6;
}
.factory-upgrade-ico { font-size: 24px; }
.factory-upgrade-meta { flex: 1; min-width: 0; }
.factory-upgrade-meta b { display: block; font-size: 13px; }
.factory-upgrade-meta small { font-size: 11px; color: var(--muted); }
.factory-exchange-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
}
.factory-exchange-hint {
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 10px;
}
.factory-exchange-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.factory-exchange-row input { flex: 1; min-width: 0; }
.factory-exchange-quick {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.factory-rating-me {
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 10px;
}
.factory-modal-card { text-align: center; }
.factory-modal-ico { font-size: 48px; margin-bottom: 8px; }
.factory-onboard-list {
    text-align: left;
    font-size: 13px;
    color: var(--muted);
    padding-left: 18px;
    margin: 0 0 16px;
    line-height: 1.5;
}
.factory-onboard-list b { color: var(--text); }
.rating-row .rating-gears { margin-left: auto; font-weight: 700; font-size: 13px; }

.factory-energy-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
}
.factory-energy-card.is-empty {
    border-color: #3498db;
    background: color-mix(in srgb, #3498db 8%, var(--surface));
}
.factory-energy-fill {
    background: linear-gradient(90deg, #2980b9, #3498db);
}
.factory-pending-card {
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
}
.factory-pending-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}
.factory-pending-fill {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.factory-help-sent {
    font-size: 11px;
    color: var(--muted);
    margin: 8px 0 0;
    text-align: center;
}
.factory-help-section { margin-bottom: 14px; }
.factory-help-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.factory-help-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.factory-help-meta { flex: 1; min-width: 0; }
.factory-help-meta b { display: block; font-size: 13px; }
.factory-help-meta small { font-size: 11px; color: var(--muted); }
.factory-line-upgrading {
    font-size: 12px;
    color: var(--accent-2);
    margin: 0 0 8px;
    font-weight: 600;
}
