:root {
    --content-max-width: 430px;
    --page-gutter: 16px;
    --bg-main: #1C1C1D;
    --bg-secondary: #D3D3D3;

    --card: #2C2C2E;
    --card-hover: #353537;
    --card-active: #00C57B;

    --accent: #2C2C2E;

    --text-main: #FFFFFF;
    --text-secondary: #FFFFFF;
    --text-muted: #FFFFFF;
    

    --border-line: #000000;
    --border: #000000;

    --circle-bg: #D4D4D4;

    --shadow-main: 0 10px 24px 4px rgba(0, 0, 0, 0.244),
                   0 4px 6px -2px rgba(0, 0, 0, 0.244);
    --tg-safe-top: 0px;
    --tg-safe-bottom: 0px;
}

:root[data-theme="light"] {
    --bg-main: #f2f2f7;
    --bg-secondary: #ffffff;
    --card: #ffffff;
    --card-hover: #e9e9ee;
    --accent: #ffffff;
    --text-main: #1c1c1e;
    --text-secondary: #1c1c1e;
    --text-muted: #6e6e73;
    --border-line: rgba(60, 60, 67, 0.12);
    --border: rgba(60, 60, 67, 0.12);
    --circle-bg: #e5e5ea;
    --shadow-main: 0 8px 20px rgba(0, 0, 0, 0.09);
}

:root[data-theme="light"] .statistics-periods {
    background: rgba(60, 60, 67, 0.08);
}

:root[data-theme="light"] .statistics-periods::before,
:root[data-theme="light"] .statistics-highlight-bars i,
:root[data-theme="light"] .statistics-category-track,
:root[data-theme="light"] .streak-bars span,
:root[data-theme="light"] .repeat-wheel-highlight {
    background: rgba(60, 60, 67, 0.14);
}

:root[data-theme="light"] .statistics-period,
:root[data-theme="light"] .statistics-summary-copy small,
:root[data-theme="light"] .statistics-dynamics-heading span,
:root[data-theme="light"] .statistics-chart-y-axis,
:root[data-theme="light"] .statistics-chart-days,
:root[data-theme="light"] .statistics-highlight-label,
:root[data-theme="light"] .statistics-highlight small,
:root[data-theme="light"] .statistics-category-caption,
:root[data-theme="light"] .statistics-top-category-copy > span,
:root[data-theme="light"] .statistics-top-category-copy small,
:root[data-theme="light"] .category-progress-count,
:root[data-theme="light"] .streak-goal,
:root[data-theme="light"] .form-subtitle,
:root[data-theme="light"] .repeat-days-card summary small,
:root[data-theme="light"] .detail-description,
:root[data-theme="light"] .selection-panel small,
:root[data-theme="light"] #repeatCountTrigger #repeat-value {
    color: rgba(28, 28, 30, 0.62);
}

:root[data-theme="light"] .task-link.done .title { color: rgba(28, 28, 30, 0.45); }
:root[data-theme="light"] .task-link.done .subtitle { color: rgba(28, 28, 30, 0.38); }
:root[data-theme="light"] .repeat-wheel-item { color: rgba(28, 28, 30, 0.3); }

:root[data-theme="light"] .statistics-category-row + .statistics-category-row {
    border-color: rgba(60, 60, 67, 0.1);
}

:root[data-theme="light"] .color-choice,
:root[data-theme="light"] .delete-warning-slot:not(:empty),
:root[data-theme="light"] .removal-choice {
    background: rgba(60, 60, 67, 0.07);
}

:root[data-theme="light"] .bottom-panel-button img,
:root[data-theme="light"] .circle img {
    filter: brightness(0);
}

:root[data-theme="light"] .nav-item.is-active img {
    filter: brightness(0) saturate(100%) invert(63%) sepia(85%) saturate(540%) hue-rotate(104deg) brightness(89%) contrast(101%);
}

:root[data-theme="light"] .add-nav-button img {
    filter: none;
}

:root[data-theme="light"] .header-action img {
    filter: brightness(0);
}

:root[data-theme="light"] .muted-action,
:root[data-theme="light"] .danger-action {
    color: rgba(28, 28, 30, 0.62);
}

body {
    background-color: var(--bg-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    margin: 0;
    padding: var(--tg-safe-top) 0 var(--tg-safe-bottom);
}

#mainView {
    padding-bottom: 100px;
}

#placeholderView {
    min-height: calc(100vh - 96px);
    padding: 0 var(--page-gutter) 100px;
    box-sizing: border-box;
}

.development-view {
    width: min(100%, var(--content-max-width));
    margin: 0 auto;
    padding-top: 88px;
    text-align: center;
}

.development-view h1 {
    margin: 0;
    color: var(--text-main);
    font-size: 24px;
}

.development-view p {
    margin: 12px auto 0;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.45;
}

.development-view .development-label {
    margin-bottom: 8px;
    color: var(--card-active);
    font-size: 13px;
    font-weight: 700;
}

.settings-view {
    width: min(100%, var(--content-max-width));
    margin: 0 auto;
    padding-top: 30px;
}

.settings-header {
    display: grid;
    min-height: 44px;
    place-items: center;
}

.settings-header h1 {
    margin: 0;
    color: var(--text-main);
    font-size: 17px;
    font-weight: 600;
}

.settings-group {
    margin-top: 22px;
}

.settings-group h2 {
    margin: 0 0 8px 4px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 68px;
    box-sizing: border-box;
    padding: 12px 16px;
    border-radius: 20px;
    background: var(--card);
    color: var(--text-main);
    box-shadow: var(--shadow-main);
    cursor: pointer;
}

.settings-row > span { display: grid; gap: 4px; }
.settings-row strong { font-size: 16px; font-weight: 600; }
.settings-row small { color: var(--text-muted); font-size: 13px; line-height: 1.25; }
.settings-toggle { position: absolute; opacity: 0; pointer-events: none; }

.settings-row i {
    position: relative;
    flex: 0 0 48px;
    width: 48px;
    height: 30px;
    border-radius: 999px;
    background: rgba(120, 120, 128, 0.3);
    transition: background 220ms ease;
}

.settings-row i::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
    content: '';
    transition: transform 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.settings-toggle:checked + i { background: #00c57b; }
.settings-toggle:checked + i::after { transform: translateX(18px); }

.statistics-view {
    width: min(100%, var(--content-max-width));
    margin: 0 auto;
    padding-top: 30px;
}

.statistics-header {
    display: grid;
    min-height: 44px;
    place-items: center;
}

.statistics-header h1 {
    margin: 0;
    color: var(--text-main);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.2;
}

.statistics-periods {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    margin-top: 14px;
    padding: 4px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.07);
}

.statistics-periods::before {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc((100% - 14px) / 3);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.14);
    content: '';
    transition: transform 330ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

.statistics-periods[data-active-period="month"]::before {
    transform: translateX(calc(100% + 3px));
}

.statistics-periods[data-active-period="year"]::before {
    transform: translateX(calc(200% + 6px));
}

.statistics-period {
    position: relative;
    z-index: 1;
    min-height: 42px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: rgba(255, 255, 255, 0.58);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    transition: transform 180ms ease, background-color 220ms ease, color 220ms ease;
}

.statistics-period.is-active {
    color: var(--text-main);
}

.statistics-period:active {
    transform: scale(0.96);
}

.statistics-summary,
.statistics-categories {
    box-sizing: border-box;
    margin-top: 16px;
    overflow: hidden;
    border-radius: 20px;
    background: var(--card);
    box-shadow: var(--shadow-main);
}

.statistics-summary {
    position: relative;
    min-height: 224px;
    padding: 20px;
}

.statistics-summary-copy {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.statistics-summary-copy > span {
    color: var(--text-main);
    font-size: 15px;
    font-weight: 700;
}

.statistics-summary-copy strong {
    margin-top: 4px;
    color: var(--text-main);
    font-size: 54px;
    font-weight: 700;
    line-height: 1;
    display: inline-block;
}

.statistics-summary-copy small {
    margin-top: 7px;
    color: rgba(255, 255, 255, 0.56);
    font-size: 13px;
}

.statistics-cube-field {
    position: absolute;
    right: 8px;
    bottom: 66px;
    width: min(58%, 208px);
    height: 128px;
}

.statistics-cube-field canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none;
}

.stats-cube {
    position: absolute;
    width: 19px;
    height: 19px;
    border-radius: 5px;
    opacity: 0;
    transform: scale(0.72);
    transition: opacity 220ms ease, transform 220ms ease;
}

.stats-cube-a { background: #ff6168; }
.stats-cube-b { background: #f3c95d; }
.stats-cube-c { background: #39d98a; }

.stats-cube.is-filled {
    opacity: 0.24;
    transform: scale(1);
}

.cube-a-1 { left: 0; bottom: 0; }.cube-a-2 { left: 22px; bottom: 0; }.cube-a-3 { left: 44px; bottom: 0; }.cube-a-4 { left: 22px; bottom: 23px; }.cube-a-5 { left: 44px; bottom: 23px; }.cube-a-6 { left: 44px; bottom: 46px; }
.cube-b-1 { left: 69px; bottom: 0; }.cube-b-2 { left: 91px; bottom: 0; }.cube-b-3 { left: 113px; bottom: 0; }.cube-b-4 { left: 91px; bottom: 23px; }.cube-b-5 { left: 113px; bottom: 23px; }.cube-b-6 { left: 113px; bottom: 46px; }
.cube-c-1 { left: 138px; bottom: 0; }.cube-c-2 { left: 160px; bottom: 0; }.cube-c-3 { left: 182px; bottom: 0; }.cube-c-4 { left: 160px; bottom: 23px; }.cube-c-5 { left: 182px; bottom: 23px; }.cube-c-6 { left: 182px; bottom: 46px; }

.statistics-action {
    position: absolute;
    z-index: 2;
    right: 16px;
    bottom: 16px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(0, 197, 123, 0.58);
    border-radius: 14px;
    background: rgba(0, 197, 123, 0.1);
    color: #00c57b;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.statistics-action:active {
    transform: scale(0.96) translateY(1px);
}

@media (hover: hover) {
    .statistics-action:hover {
        background: rgba(0, 197, 123, 0.16);
        box-shadow: 0 5px 15px rgba(0, 197, 123, 0.14);
    }
}

.statistics-categories {
    padding: 20px;
}

.statistics-dynamics {
    box-sizing: border-box;
    min-height: 226px;
    margin-top: 16px;
    padding: 20px;
    overflow: hidden;
    border-radius: 20px;
    background: var(--card);
    box-shadow: var(--shadow-main);
}

.statistics-dynamics-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.statistics-dynamics h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 17px;
    line-height: 1.2;
}

.statistics-dynamics-heading span {
    color: rgba(255, 255, 255, 0.52);
    font-size: 13px;
    white-space: nowrap;
}

.statistics-line-chart {
    position: relative;
    height: 156px;
    margin-top: 18px;
}

.statistics-chart-y-axis {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    width: 20px;
    height: 132px;
    padding: 12px 0 8px;
    box-sizing: border-box;
    flex-direction: column;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.42);
    font-size: 10px;
    line-height: 1;
    text-align: center;
}

.statistics-chart-plot {
    height: 100%;
    margin-left: 30px;
    min-width: 0;
}

.statistics-chart-plot svg {
    display: block;
    width: 100%;
    height: 132px;
    overflow: visible;
}

.statistics-chart-grid {
    fill: none;
    stroke: rgba(255, 255, 255, 0.07);
    stroke-width: 1;
}

.statistics-chart-area {
    fill: rgba(0, 197, 123, 0.08);
    animation: statistics-chart-area-in 560ms ease-out both;
}

.statistics-chart-line {
    fill: none;
    stroke: #00c57b;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: statistics-chart-line-in 680ms cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

.statistics-chart-point-halo {
    fill: rgba(0, 197, 123, 0.16);
}

.statistics-chart-point {
    fill: #d9ffef;
    stroke: #00c57b;
    stroke-width: 2.5;
}

.statistics-chart-point-wrap {
    transform-box: fill-box;
    transform-origin: center;
    animation: statistics-chart-point-in 260ms cubic-bezier(0.22, 0.8, 0.28, 1) both;
    animation-delay: calc(280ms + var(--point-delay));
}

.statistics-chart-days {
    position: relative;
    height: 16px;
    margin-top: 5px;
    color: rgba(255, 255, 255, 0.48);
    font-size: 12px;
}

.statistics-chart-days span {
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
}

.statistics-chart-days.is-dense {
    font-size: 10px;
}

.statistics-chart-days .is-first { transform: none; }
.statistics-chart-days .is-last { transform: translateX(-100%); }

.statistics-highlights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.statistics-highlight {
    display: flex;
    min-height: 168px;
    padding: 16px;
    box-sizing: border-box;
    flex-direction: column;
    align-items: flex-start;
    overflow: hidden;
    border-radius: 20px;
    background: var(--card);
    box-shadow: var(--shadow-main);
}

.statistics-highlight-icon {
    width: 30px;
    height: 30px;
    background: currentColor;
    -webkit-mask: var(--highlight-icon) center / contain no-repeat;
    mask: var(--highlight-icon) center / contain no-repeat;
}

.statistics-highlight-label {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.statistics-highlight strong {
    margin-top: 12px;
    color: var(--text-main);
    font-size: 23px;
    line-height: 1.05;
}

.statistics-highlight small {
    margin-top: auto;
    color: rgba(255, 255, 255, 0.45);
    font-size: 11px;
    line-height: 1.3;
}

.statistics-highlight-bars {
    display: grid;
    width: 100%;
    margin-top: auto;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.statistics-highlight-bars i {
    display: block;
    height: 24px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    transition: background-color 300ms ease, box-shadow 300ms ease;
}

.statistics-highlight-bars i.is-active {
    background: #ff6168;
    box-shadow: 0 0 7px rgba(255, 97, 104, 0.42);
}

.statistics-highlight-streak .statistics-highlight-icon { color: #ff6168; filter: drop-shadow(0 0 5px rgba(255, 97, 104, 0.32)); }
.statistics-highlight-record .statistics-highlight-icon { color: #f3c95d; filter: drop-shadow(0 0 5px rgba(243, 201, 93, 0.28)); }
.statistics-highlight-average .statistics-highlight-icon { color: #39d98a; filter: drop-shadow(0 0 5px rgba(57, 217, 138, 0.3)); }
.statistics-highlight-best .statistics-highlight-icon { color: #f3c95d; filter: drop-shadow(0 0 5px rgba(243, 201, 93, 0.28)); }

.statistics-categories h2 {
    margin: 0 0 16px;
    color: var(--text-main);
    font-size: 17px;
}

.statistics-category-row {
    display: grid;
    grid-template-columns: 9px minmax(0, 1fr) auto auto;
    column-gap: 8px;
    align-items: center;
    padding: 14px 0;
}

.statistics-category-row + .statistics-category-row {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.statistics-category-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.statistics-category-row .statistics-category-dot {
    background: var(--statistics-category-color);
    box-shadow: 0 0 7px var(--statistics-category-color);
}

.statistics-category-a .statistics-category-dot { background: #ff6168; box-shadow: 0 0 7px rgba(255, 97, 104, 0.48); }
.statistics-category-b .statistics-category-dot { background: #f3c95d; box-shadow: 0 0 7px rgba(243, 201, 93, 0.42); }
.statistics-category-c .statistics-category-dot { background: #39d98a; box-shadow: 0 0 7px rgba(57, 217, 138, 0.4); }

.statistics-category-name {
    color: var(--text-main);
    font-size: 15px;
    font-weight: 650;
}

.statistics-category-row strong {
    color: var(--text-main);
    font-size: 17px;
    display: inline-block;
}

.statistics-category-caption {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

.statistics-category-track {
    grid-column: 2 / -1;
    height: 7px;
    margin-top: 10px;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.11);
}

.statistics-category-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    transition: width 600ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

.statistics-category-row .statistics-category-track span { background: var(--statistics-category-color); }

.statistics-category-empty { margin: 0; color: var(--text-muted); font-size: 14px; }

.statistics-category-a .statistics-category-track span { background: #ff6168; }
.statistics-category-b .statistics-category-track span { background: #f3c95d; }
.statistics-category-c .statistics-category-track span { background: #39d98a; }

.statistics-top-category {
    --top-category-color: #8e8e93;
    position: relative;
    display: flex;
    min-height: 126px;
    margin-top: 16px;
    padding: 18px 20px;
    box-sizing: border-box;
    align-items: center;
    overflow: hidden;
    border-radius: 20px;
    background: var(--card);
    box-shadow: var(--shadow-main);
}

.statistics-top-category-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    margin-right: 14px;
    background: var(--top-category-color);
    -webkit-mask: var(--top-category-icon) center / contain no-repeat;
    mask: var(--top-category-icon) center / contain no-repeat;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.16));
}

.statistics-top-category-copy {
    position: relative;
    z-index: 1;
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.statistics-top-category.has-data .statistics-top-category-copy {
    padding-right: 100px;
}

.statistics-top-category-copy > span {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    line-height: 1.2;
}

.statistics-top-category-copy strong {
    margin-top: 5px;
    color: var(--top-category-color);
    font-size: 24px;
    line-height: 1;
}

.statistics-top-category-copy small {
    margin-top: 7px;
    color: rgba(255, 255, 255, 0.56);
    font-size: 12px;
    line-height: 1.2;
}

.statistics-top-category-cubes {
    position: absolute;
    right: 16px;
    top: 50%;
    width: 120px;
    height: 78px;
    background: var(--top-category-color);
    -webkit-mask: var(--top-category-cubes) center / contain no-repeat;
    mask: var(--top-category-cubes) center / contain no-repeat;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.24));
    opacity: 0.76;
    transform: translateY(-50%);
    transition: opacity 180ms ease;
}

.statistics-top-category:not(.has-data) .statistics-top-category-cubes {
    opacity: 0;
}

@media (max-width: 360px) {
    .statistics-top-category { min-height: 116px; padding: 16px; }
    .statistics-top-category-cubes { right: 8px; transform: translateY(-50%) scale(0.82); transform-origin: right center; }
    .statistics-top-category-copy strong { font-size: 21px; }
    .statistics-top-category-copy > span { font-size: 12px; }
    .statistics-top-category.has-data .statistics-top-category-copy { padding-right: 78px; }
}

@keyframes statistics-chart-line-in {
    from { stroke-dashoffset: 1; }
    to { stroke-dashoffset: 0; }
}

@keyframes statistics-chart-area-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes statistics-chart-point-in {
    from { opacity: 0; transform: scale(0.35); }
    to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .statistics-period,
    .statistics-action,
    .statistics-category-track span {
        transition: none;
    }

    .statistics-chart-area,
    .statistics-chart-line,
    .statistics-chart-point-wrap {
        animation: none;
    }
}

@media (max-width: 360px) {
    .statistics-summary { min-height: 208px; }
    .statistics-cube-field { transform: scale(0.86); transform-origin: right bottom; }
    .statistics-action { padding: 0 10px; font-size: 11px; }
    .statistics-highlight { min-height: 156px; padding: 14px; }
    .statistics-highlight strong { font-size: 20px; }
    .statistics-highlight-bars i { height: 20px; }
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    display: flex;
    flex-direction: column;
    width: min(calc(100% - (var(--page-gutter) + var(--page-gutter))), var(--content-max-width));
    margin: 16px auto;
    border-radius: 20px;
    overflow: hidden;
}

.container.shadow {
    box-shadow: var(--shadow-main);
}

.date-navigation {
    display: grid;
    grid-template-columns: 44px auto 44px;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
}

html.is-tg-sheet .date-navigation {
    position: relative;
    min-height: 196px;
    padding-top: 54px;
    box-sizing: border-box;
}

html.is-tg-sheet .date-button {
    position: static;
}

.date {
    color: var(--text-main);
    font-size: 17px;
    font-weight: 600;
    text-align: center;
}

.date-button {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-main);
    font-size: 34px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.date-button:hover {
    opacity: 0.65;
}

.date-button:active {
    transform: scale(0.9);
}

.date-button:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
}

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

#world {
    width: 100%;
    height: 100%;
    background: transparent;
    overflow: visible;
    border: 0;
    outline: 0;
    background: transparent !important;
    box-shadow: none;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28px, #000 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 28px, #000 100%);
}

#world canvas {
    display: block;
    border: 0;
    outline: 0;
    background: transparent !important;
}

.world-container {
    width: min(calc(100% - (var(--page-gutter) + var(--page-gutter))), var(--content-max-width));
    height: 130px;
    margin: 20px auto;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    transition: height 360ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.world-shell {
    overflow: visible;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: minmax(132px, 0.78fr) minmax(0, 1.22fr);
    gap: 0;
    width: min(calc(100% - (var(--page-gutter) + var(--page-gutter))), var(--content-max-width));
    margin: 0 auto 20px;
    overflow: hidden;
    border-radius: 20px;
    background: var(--card);
    color: var(--text-main);
    box-shadow: var(--shadow-main);
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 170px;
    box-sizing: border-box;
    padding: 16px;
}

.dashboard-card-title {
    font-size: 14px;
    font-weight: 700;
}

.progress-card {
    align-items: center;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.progress-card .dashboard-card-title {
    align-self: stretch;
    text-align: center;
}

.progress-line {
    --progress-length: 0;
    position: relative;
    display: grid;
    width: 92px;
    height: 92px;
    margin-top: auto;
    place-items: center;
    border-radius: 50%;
}

.progress-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    transform: rotate(-90deg);
}

.progress-ring-track,
.progress-ring-value {
    fill: none;
    stroke-width: 6;
}

.progress-ring-track {
    stroke: rgba(255, 255, 255, 0.13);
}

.progress-ring-glow {
    fill: none;
    stroke: rgba(0, 197, 123, 0.46);
    stroke-width: 7;
    stroke-linecap: round;
    stroke-dasharray: var(--progress-length) 100;
    opacity: 0;
    transition: stroke-dasharray 220ms ease, opacity 180ms ease;
}

.progress-ring-value {
    stroke: #00c57b;
    stroke-linecap: round;
    stroke-dasharray: var(--progress-length) 100;
    opacity: 0;
    transition: stroke-dasharray 220ms ease, opacity 180ms ease;
}

.progress-line.has-progress .progress-ring-glow,
.progress-line.has-progress .progress-ring-value {
    opacity: 1;
}

.progress-value {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.progress-value strong {
    font-size: 29px;
    font-weight: 500;
    line-height: 1;
}

.progress-value small {
    font-size: 15px;
    font-weight: 700;
}

.progress-percent {
    margin-top: 8px;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 700;
}

.streak-value {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
}

.streak-flame {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    background: #ff6168;
    -webkit-mask: var(--streak-icon) center / contain no-repeat;
    mask: var(--streak-icon) center / contain no-repeat;
    filter: drop-shadow(0 0 5px rgba(255, 97, 104, 0.36));
    transition: color 220ms ease, background-color 220ms ease, filter 220ms ease, transform 220ms ease;
}

.streak-value strong {
    font-size: 23px;
    line-height: 1;
}

.streak-value span:last-child {
    font-size: 12px;
    font-weight: 600;
}

.streak-bars {
    display: grid;
    grid-template-columns: repeat(14, minmax(4px, 10px));
    justify-content: space-between;
    gap: 0;
    align-items: end;
    height: 30px;
    margin-top: 14px;
}

.streak-bars span {
    display: block;
    height: 100%;
    min-width: 3px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.12);
}

.streak-bars .is-active {
    background: #00c57b;
    box-shadow: 0 0 8px rgba(0, 197, 123, 0.45);
}

.streak-goal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: auto;
    color: rgba(255, 255, 255, 0.76);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.15;
}

.streak-goal span {
    min-width: 0;
}

.streak-goal strong {
    flex: 0 0 auto;
    padding: 4px 6px;
    border: 1px solid rgba(0, 197, 123, 0.5);
    border-radius: 20px;
    color: #00c57b;
    font-size: 10px;
}

@media (max-width: 360px) {
    .dashboard-card {
        padding: 13px;
    }

    .progress-line {
        width: 82px;
        height: 82px;
    }

    .streak-bars {
        grid-template-columns: repeat(14, minmax(3px, 8px));
    }
}

.bottom-panel {
    position: fixed; /* фиксированное позиционирование */
    left: 50%; /* центрирование по горизонтали */
    bottom: 16px; /* отступ от нижнего края */
    transform: translateX(-50%); /* центрирование по горизонтали */
    display: block;
    width: min(calc(100% - (var(--page-gutter) + var(--page-gutter))), var(--content-max-width));
    height: 68px;
    padding: 10px;
    box-sizing: border-box;
    margin: 0;
    z-index: 1000; /* чтобы панель была поверх других элементов */
    background-color: var(--card); 
    border-radius: 20px;
    box-shadow: var(--shadow-main);
}

.bottom-panel-button {
    position: relative;
    z-index: 1;
    flex: 1;              /* кнопка растягивается */     /* минимальная ширина */
    max-width: 40px;     /* максимальная ширина для 5 кнопок */
    height: 40px;
    background-color: var(--accent);
    border-radius: 20px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    box-shadow: var(--shadow-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0;
    border: 0;
}

.bottom-panel-button img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.bottom-panel-button:not(.add-nav-button) {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.nav-item {
    position: absolute;
    top: 10px;
    left: 10%;
    width: 64px;
    max-width: 64px;
    height: 48px;
    transform: translateX(-50%);
    flex-direction: column;
    gap: 3px;
    color: var(--text-main);
    font-size: 10px;
    line-height: 1;
    overflow: visible;
    transition: left 420ms cubic-bezier(0.22, 0.61, 0.36, 1), color 180ms ease;
}

.nav-item[data-nav-view="stats"] {
    left: 30%;
}

.nav-item[data-nav-view="challenges"] {
    left: 70%;
}

.nav-item[data-nav-view="settings"] {
    left: 90%;
}

.bottom-panel.is-secondary-nav .nav-item[data-nav-view="main"] {
    left: 12.5%;
}

.bottom-panel.is-secondary-nav .nav-item[data-nav-view="stats"] {
    left: 37.5%;
}

.bottom-panel.is-secondary-nav .nav-item[data-nav-view="challenges"] {
    left: 62.5%;
}

.bottom-panel.is-secondary-nav .nav-item[data-nav-view="settings"] {
    left: 87.5%;
}

.nav-item span {
    display: block;
    white-space: nowrap;
}

.nav-item.is-active {
    color: var(--card-active);
}

.nav-item.is-active img {
    filter: brightness(0) saturate(100%) invert(63%) sepia(85%) saturate(540%) hue-rotate(104deg) brightness(89%) contrast(101%);
}

.add-nav-button {
    position: absolute;
    top: 10px;
    left: 50%;
    box-sizing: border-box;
    flex: 0 0 48px;
    width: 48px;
    max-width: 48px;
    height: 48px;
    margin: 0;
    background: #00C57B;
    border: 3px solid var(--card);
    border-radius: 50%;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
    overflow: visible;
    z-index: 1;
    transform: translateX(-50%) scale(1);
    transform-origin: center;
    transition: transform 360ms cubic-bezier(0.22, 0.61, 0.36, 1), opacity 220ms ease;
}

.bottom-panel.is-secondary-nav .add-nav-button {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) scale(0.35);
}

.add-nav-button img {
    width: 24px;
    height: 24px;
    filter: none;
}


.right-panel-text {
    margin-left: auto;
    margin-right: 6px;
    font-weight: bold;
    font-size: 13px;
     color: var(--text-muted);
}

.left-panel-text {
    margin-right: auto;
    margin-left: 6px;
    font-weight: bold;
    font-size: 13px;
     color: var(--text-muted);
}

.bottom-container {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: min(calc(100% - (var(--page-gutter) + var(--page-gutter))), var(--content-max-width));
    margin: 16px auto;  /* центрирование */

    gap: 16px;

}

.add {
    flex: 1;              /* кнопка растягивается */
    max-width: 200px;    /* чтобы не стала огромной */
    height: 40px;
    background-color: var(--accent);
    border-radius: 20px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-main);
}

.panel-button {
    display: flex;
    width: 118px;
    height: 40px;
    padding: 0 12px;
    align-items: center;
    background-color: var(--accent);
    border-radius: 20px;
    gap: 10px;
}

.nameContainer {
    margin-right: auto;
    padding-left: 14px;
    font-weight: bold;
    font-size: 14px;
     color: var(--text-muted);
}

.box,
.box1 {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 64px;
    padding: 10px 15px;
    background-color: var(--card);
    transition: 0.3s;
    box-sizing: border-box;
    gap: 10px;
}

.task-link.done .box1 {
    background-color: var(--card);
}

.task-link.done .task-icon {
    background: #a5a5ac;
}

.task-link.done .title {
    color: rgba(255, 255, 255, 0.46);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.task-link.done .subtitle {
    color: rgba(255, 255, 255, 0.38);
}

.task-link.done .right-text {
    color: #00c57b;
}

.box1::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 48px;
    width: calc(100% - 58px);
    height: 1px;
    background: var(--border-line);
    opacity: 0.3;
}

#taskAll .task-link:last-child .box1::after,
#taskA .task-link:last-child .box1::after,
#taskB .task-link:last-child .box1::after,
#taskC .task-link:last-child .box1::after,
.custom-task-category .task-link:last-child .box1::after {
    display: none;
}

.category-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 64px;
    padding: 10px 15px;
    border: 0;
    background: var(--card);
    color: var(--text-main);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 180ms ease;
}

.task-list-heading {
    cursor: default;
}

.add-category-container {
    display: flex;
    justify-content: center;
    margin-top: 14px;
}

.add-category-action {
    min-height: 42px;
    padding: 0 17px;
    border: 1px solid rgba(0, 197, 123, 0.44);
    border-radius: 20px;
    background: var(--bg-main);
    color: rgba(0, 197, 123, 0.9);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
}

.category-cube-preview {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    flex: 0 0 18px;
}

.category-management-list { width: min(calc(100% - (var(--page-gutter) * 2)), var(--content-max-width)); margin: 16px auto; display: grid; gap: 10px; }
.category-management-item { min-height: 64px; width: 100%; padding: 12px 15px; border: 0; border-radius: 20px; background: var(--card); color: var(--text-main); display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; box-shadow: var(--shadow-main); }
.category-management-item > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.category-management-item strong { font-size: 16px; }
.category-management-item small { color: var(--text-muted); font-size: 13px; }
.category-management-item .category-chevron { margin-left: auto; }
.category-transfer-group { margin: 4px 0 0; }
.category-transfer-group .selection-panel { min-height: 58px; }

.drawer-add-category {
    color: #00c57b;
}

.category-marker {
    display: inline-flex;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.category-color-dot {
    display: block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.category-color-a {
    background: #ff6168;
    box-shadow: 0 0 8px rgba(255, 97, 104, 0.65);
}

.category-color-b {
    background: #f3c95d;
    box-shadow: 0 0 8px rgba(243, 201, 93, 0.65);
}

.category-color-c {
    background: #39d98a;
    box-shadow: 0 0 8px rgba(57, 217, 138, 0.65);
}

.category-progress-label {
    font-size: 16px;
    font-weight: 600;
}

.category-progress-count {
    margin-left: auto;
    margin-right: 18px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    font-weight: 600;
}

.category-chevron {
    width: 10px;
    height: 10px;
    margin-right: 3px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.category-toggle.is-collapsed .category-chevron {
    transform: rotate(-135deg);
}

.circle {
    width: 24px;
    height: 24px;
    background-color: transparent;
    border-radius: 20px;
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;
}

.circle img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.task-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    background: var(--task-icon-color, #00c57b);
    -webkit-mask: var(--task-icon-mask) center / contain no-repeat;
    mask: var(--task-icon-mask) center / contain no-repeat;
}

.form-icon-preview {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
}

svg {
    fill: red;
}

.text-block {
    display: flex;
    flex-direction: column;
}

.text-block.right {
    margin-left: auto;
    text-align: center;
    color: var(--text-muted);
    flex: 0 0 auto;
}

.title {
    font-weight: bold;
    font-size: 16px;
     color: var(--text-muted);
}

.subtitle {
    font-weight: lighter;
    font-size: 13px;
    color: var(--text-muted);
}

.right-text {
    font-weight: bold;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Category task lists animate their measured height in app.js. */
.task-list {
    overflow: hidden;
    background: var(--card);
    will-change: height;
    transition: height 420ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.task-list.hidden {
    height: 0 !important;
}

.task-list > * {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 240ms ease, transform 340ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.task-list.hidden > * {
    opacity: 0;
    transform: translateY(-3px);
}

.empty-message {
    display: flex;
    align-items: center;
    min-height: 64px;
    box-sizing: border-box;
    padding: 10px 15px;
    background: var(--card);
    text-align: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
}

.is-hidden {
    display: none !important;
}

.task-link {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.task-link .box1 {
    border: 0;
}

.onboarding-task-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 6px 15px 0;
    box-sizing: border-box;
    color: #00c57b;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
    animation: onboarding-hint-in 360ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.onboarding-task-hint i {
    display: block;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    animation: onboarding-arrow 1.3s ease-in-out infinite;
}

.task-link.is-onboarding-target .box1 {
    box-shadow: inset 3px 0 0 #00c57b;
}

@keyframes onboarding-hint-in {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes onboarding-arrow {
    0%, 100% { transform: rotate(45deg) translate(-2px, -2px); }
    50% { transform: rotate(45deg) translate(1px, 1px); }
}

.view-header,
.form-view,
.detail-view {
    width: min(calc(100% - (var(--page-gutter) + var(--page-gutter))), var(--content-max-width));
    margin: 20px auto;
}

.view-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

html.is-tg-sheet .view-header {
    min-height: 196px;
    padding-top: 54px;
    box-sizing: border-box;
    align-items: flex-start;
}

html.is-tg-sheet .bottom-panel {
    bottom: calc(22px + var(--tg-safe-bottom));
}

.view-header h1 {
    margin: 0;
    color: var(--text-main);
    font-size: 17px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-action {
    display: grid;
    width: 36px;
    min-width: 36px;
    height: 36px;
    margin-left: 6px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.header-action img {
    width: 21px;
    height: 21px;
    object-fit: contain;
}

.header-action:active {
    transform: scale(0.9);
}

.category-create-action {
    color: var(--text-main);
    font-size: 28px;
    line-height: 1;
}

.form-view,
.detail-view {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field-label {
    display: block;
}

.field-label input,
.field-label textarea {
    width: 100%;
    min-height: 58px;
    box-sizing: border-box;
    border: 0;
    border-radius: 20px;
    padding: 12px;
    background: var(--card);
    color: var(--text-main);
    font: inherit;
    outline: none;
    font-size: 16px;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex="0"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.field-label textarea {
    max-height: 132px;
    resize: none;
    overflow-y: hidden;
    line-height: 24px;
    padding: 17px 15px;
}

.task-visual-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.task-visual-row-single {
    grid-template-columns: minmax(0, 1fr);
}

.task-visual-trigger {
    min-width: 0;
    justify-content: space-between;
    gap: 8px;
}

.task-visual-label {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
}

.visual-chevron {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-right: 2px solid rgba(255, 255, 255, 0.65);
    border-bottom: 2px solid rgba(255, 255, 255, 0.65);
    transform: rotate(-45deg);
}

.color-preview {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 50%;
    background: #00c57b;
    box-shadow: 0 0 8px rgba(0, 197, 123, 0.55);
}

.form-card {
    box-sizing: border-box;
    padding: 15px;
    border: 0;
    border-radius: 20px;
    background: var(--card);
    color: var(--text-main);
}

.form-title {
    font-size: 16px;
    font-weight: 700;
}

.form-subtitle {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 13px;
}

.repeat-box {
    display: block;
}

.repeat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.repeats-counter {
    min-width: 42px;
    padding: 7px 10px;
    border-radius: 999px;
    background: #3a3a3c;
    text-align: center;
}

#repeat-value {
    font-size: 17px;
    font-weight: 700;
}

.repeat-wheel {
    position: relative;
    height: 176px;
    margin-top: 14px;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    scrollbar-width: none;
    border-radius: 20px;
    background: transparent;
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 25%, black 75%, transparent);
    mask-image: linear-gradient(to bottom, transparent, black 25%, black 75%, transparent);
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.repeat-wheel::-webkit-scrollbar { display: none; }

.repeat-wheel-highlight {
    position: sticky;
    top: 66px;
    z-index: 1;
    height: 44px;
    margin: 0 38px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.11);
    pointer-events: none;
}

.repeat-wheel-list {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 66px 0;
    margin-top: -44px;
}

.repeat-wheel-item {
    width: 100%;
    height: 44px;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.24);
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    transition: color 150ms ease, opacity 150ms ease, transform 180ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

.repeat-wheel-item.selected { color: var(--text-main); opacity: 1; transform: scale(1.04); }

.selection-group {
    overflow: hidden;
    border-radius: 20px;
    background: var(--card);
}

.selection-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 58px;
    padding: 12px 15px;
    border: 0;
    border-radius: 20px;
    background: var(--card);
    color: var(--text-main);
    font: inherit;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: border-radius 420ms cubic-bezier(0.22, 0.61, 0.36, 1), background-color 180ms ease;
}

.selection-panel strong,
.selection-panel small {
    color: rgba(255, 255, 255, 0.65);
    font-size: 14px;
    font-weight: 500;
}

.selection-panel strong { color: var(--text-main); }

.selection-group.is-expanded #reminderSummary {
    opacity: 0;
}

.reminder-wheel-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr);
    align-items: center;
    padding: 0 22px 10px;
}

.reminder-wheel {
    min-width: 0;
    margin-top: 0;
}

.reminder-wheel .repeat-wheel-highlight {
    margin: 0 4px;
}

.reminder-time-separator {
    color: var(--text-main);
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    transform: translateY(-1px);
}

#repeatCountTrigger #repeat-value {
    color: rgba(255, 255, 255, 0.65);
    font-size: 14px;
    font-weight: 500;
    transition: opacity 220ms ease;
}

.selection-group.is-expanded #repeatCountTrigger #repeat-value {
    opacity: 0;
}

.selection-drawer {
    background: var(--card);
    overflow: hidden;
    box-sizing: border-box;
    will-change: height;
    transition: height 420ms cubic-bezier(0.22, 0.61, 0.36, 1), padding 420ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.selection-drawer.drawer-collapsed {
    height: 0 !important;
}

.repeat-count-drawer.drawer-collapsed {
    padding-bottom: 0;
}

.selection-drawer > * {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 240ms ease, transform 340ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.selection-drawer.drawer-collapsed > * {
    opacity: 0;
    transform: translateY(-3px);
}

.selection-group.is-expanded .selection-panel {
    border-radius: 20px 20px 0 0;
}

.selection-group.is-expanded .selection-drawer {
    border-radius: 0 0 20px 20px;
}

.drawer-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    padding: 0 15px;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: var(--text-main);
    font: inherit;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
}

.option-check::before {
    content: "✓";
    color: #00c57b;
    font-size: 17px;
    opacity: 0;
}

.drawer-option.is-selected .option-check::before { opacity: 1; }

.repeat-count-drawer { padding: 0 15px 12px; }

.repeat-count-drawer .repeat-wheel {
    margin-top: 0;
    border-radius: 20px;
    background: transparent !important;
}

.visual-picker-modal {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    transition: opacity 180ms ease;
}

.visual-picker-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.62);
}

.visual-picker-dialog {
    position: relative;
    z-index: 1;
    width: min(calc(100vw - 32px), var(--content-max-width));
    max-height: min(78dvh, 640px);
    overflow-y: auto;
    scrollbar-width: none;
    padding: 16px;
    border-radius: 20px;
    background: var(--card);
    box-shadow: var(--shadow-main);
    box-sizing: border-box;
    animation: modal-scale-in 250ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.visual-picker-dialog::-webkit-scrollbar { display: none; }

.visual-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.visual-picker-header h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 18px;
}

.visual-picker-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-main);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.visual-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
    gap: 8px;
}

.visual-picker-grid.is-color-picker {
    grid-template-columns: repeat(auto-fit, 44px);
    justify-content: center;
    grid-auto-rows: 44px;
}

.icon-choice,
.color-choice {
    display: flex;
    min-width: 0;
    aspect-ratio: 1;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    border-radius: 14px;
    background: #242426;
    cursor: pointer;
}

.icon-choice.is-selected,
.color-choice.is-selected {
    border-color: var(--card-active);
    background: rgba(0, 197, 123, 0.12);
}

.icon-choice .task-icon {
    width: clamp(22px, 6vw, 30px);
    height: clamp(22px, 6vw, 30px);
    flex-basis: clamp(22px, 6vw, 30px);
}

.color-choice {
    width: 44px;
    height: 44px;
    min-height: 44px;
    justify-self: center;
    align-self: center;
    aspect-ratio: auto;
    border-radius: 50%;
    padding: 4px;
    background: rgba(255, 255, 255, 0.06);
}

.color-choice span {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--choice-color);
    box-shadow: 0 0 8px color-mix(in srgb, var(--choice-color), transparent 35%);
}

.picker-sheet {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: flex-end;
}

.sheet-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.52);
}

.sheet-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    max-height: 70vh;
    margin: 0 auto;
    padding: 14px 16px 28px;
    border-radius: 20px;
    background: var(--card);
    box-sizing: border-box;
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 36px;
    color: var(--text-main);
    font-size: 16px;
    font-weight: 700;
}

.sheet-header strong { font-size: 17px; }

.sheet-content .repeat-wheel {
    margin-top: 8px;
    border-radius: 20px;
    background: transparent !important;
}

.repeat-days-card {
    overflow: hidden;
    border-radius: 20px;
    background: var(--card);
    color: var(--text-main);
}

.repeat-days-card summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    box-sizing: border-box;
    padding: 12px 15px;
    cursor: pointer;
    list-style: none;
}

.repeat-days-card summary::-webkit-details-marker { display: none; }
.repeat-days-card summary span:first-child { display: flex; flex-direction: column; gap: 4px; }
.repeat-days-card summary strong { font-size: 16px; }
.repeat-days-card summary small { color: rgba(255, 255, 255, 0.62); font-size: 13px; }
.summary-chevron { font-size: 25px; transition: transform 0.2s ease; }
.repeat-days-card[open] .summary-chevron { transform: rotate(90deg); }

.repeat-days-list {
    display: flex;
    flex-direction: column;
    padding: 0 15px 10px;
}

.repeat-days-list label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    font-size: 16px;
    cursor: pointer;
}

.repeat-days-list input { accent-color: #00a968; }

.type-selector {
    display: flex;
    gap: 18px;
}

.type-selector legend { padding: 0 0 10px; font-size: 13px; font-weight: 700; }
.type-selector label { display: flex; gap: 6px; align-items: center; font-size: 16px; }

.repeat-toggle {
    display: flex;
    align-items: center;
    gap: 18px;
}

.repeat-toggle legend {
    width: 100%;
    padding: 0 0 10px;
    font-size: 16px;
    font-weight: 700;
}

.repeat-toggle label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
}

.primary-action,
.secondary-action,
.danger-action {
    min-height: 46px;
    border: 0;
    border-radius: 20px;
    color: var(--text-main);
    font-size: 16px;
    cursor: pointer;
}

.primary-action { background: #00a968; }
.secondary-action { background: var(--card); }
.danger-action { background: var(--card); }
.muted-action,
.danger-action {
    color: #f5f5f7;
    opacity: 0.78;
}
.muted-action:disabled {
    opacity: 0.42;
    cursor: default;
}
.primary-action:disabled { opacity: 0.55; cursor: default; }

.detail-row { display: flex; align-items: center; justify-content: space-between; }
.detail-description { margin: 8px 0 0; line-height: 1.45; color: rgba(255, 255, 255, 0.78); }

/* Modal actions for removing or hiding a task. */
.task-removal-modal {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.62);
    transition: opacity 180ms ease;
}

.task-removal-dialog {
    width: min(calc(100vw - 32px), var(--content-max-width));
    padding: 20px;
    border-radius: 20px;
    background: var(--card);
    box-shadow: var(--shadow-main);
    box-sizing: border-box;
    animation: modal-scale-in 250ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.visual-picker-modal.is-closing,
.task-removal-modal.is-closing {
    opacity: 0;
}

.visual-picker-modal.is-closing .visual-picker-dialog,
.task-removal-modal.is-closing .task-removal-dialog {
    animation: modal-scale-out 180ms ease-in forwards;
}

@keyframes modal-scale-in {
    from { opacity: 0; transform: scale(0.86); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes modal-scale-out {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.86); }
}

.task-removal-dialog h2 {
    margin: 0 0 16px;
    color: var(--text-main);
    font-size: 18px;
    line-height: 1.3;
}

.task-removal-dialog .removal-warning {
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.45;
}

.task-removal-dialog .category-transfer-group .selection-panel {
    color: var(--text-main);
}

.task-removal-dialog .category-transfer-group .selection-panel small {
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}

.category-transfer-value {
    display: inline-flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.category-transfer-value small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-transfer-group.is-expanded {
    margin-bottom: 12px;
}

/* A short first-run flow that keeps the full task form out of the way. */
.onboarding-modal {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid;
    place-items: center;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

.onboarding-dialog {
    width: min(100%, 360px);
    padding: 30px 24px 24px;
    border-radius: 20px;
    box-sizing: border-box;
    background: var(--card);
    box-shadow: var(--shadow-main);
    text-align: center;
    animation: modal-scale-in 250ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.onboarding-cube {
    display: block;
    width: 52px;
    height: 52px;
    margin: 0 auto 22px;
    border-radius: 12px;
    background: #00c57b;
    box-shadow: 0 8px 20px rgba(0, 197, 123, 0.24);
    transform: rotate(7deg);
}

.onboarding-eyebrow {
    margin: 0 0 8px;
    color: #00c57b;
    font-size: 12px;
    font-weight: 700;
}

.onboarding-dialog h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 24px;
    line-height: 1.18;
}

.onboarding-dialog > p:not(.onboarding-eyebrow) {
    margin: 12px auto 24px;
    color: var(--text-muted);
    line-height: 1.45;
}

.onboarding-action {
    width: 100%;
    min-height: 52px;
}

.onboarding-skip {
    margin-top: 14px;
    padding: 8px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 14px;
}

.onboarding-complete-mark {
    display: grid;
    width: 52px;
    height: 52px;
    margin: 0 auto 22px;
    place-items: center;
    border-radius: 50%;
    background: #00c57b;
    color: #fff;
    font-size: 30px;
    font-weight: 700;
}

.onboarding-experience-dialog {
    padding-top: 26px;
}

.onboarding-world {
    position: relative;
    height: 148px;
    margin: 20px 0 18px;
    overflow: hidden;
    isolation: isolate;
}

.onboarding-world::before {
    content: '';
    position: absolute;
    z-index: 0;
    right: 20px;
    bottom: 12px;
    left: 20px;
    height: 2px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.22);
}

.onboarding-world canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none;
}

:root[data-theme="light"] .onboarding-world {
    --onboarding-floor: rgba(28, 28, 30, 0.16);
}

:root[data-theme="light"] .onboarding-world::before {
    background: var(--onboarding-floor);
}

body.is-onboarding-create .selection-group {
    display: none;
}

body.is-onboarding-create .form-view::before {
    content: 'Выбери иконку и цвет для первой задачи.';
    display: block;
    margin: -2px 0 2px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.4;
}


.delete-warning-slot:empty { display: none; }

.delete-warning-slot:not(:empty) {
    margin: 0 0 12px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.4;
}

.removal-choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    min-height: 70px;
    margin: 0 0 10px;
    padding: 13px 15px;
    border: 0;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

.removal-choice span { font-size: 16px; font-weight: 700; }
.removal-choice small { margin-top: 4px; color: var(--text-muted); font-size: 14px; }
.removal-hide-choice {
    border: 1px solid rgba(0, 197, 123, 0.65);
    background: rgba(0, 197, 123, 0.07);
    box-shadow: 0 0 12px rgba(0, 197, 123, 0.2);
}
.task-removal-dialog .secondary-action { width: 100%; margin-top: 2px; }

/* Hover is reserved for mouse/trackpad devices so touch taps do not leave a bright state. */
@media (hover: hover) and (pointer: fine) {
    .box1:hover,
    .category-toggle:hover,
    .selection-panel:hover,
    .removal-choice:hover {
        background-color: var(--card-hover);
    }

    .icon-choice:hover,
    .color-choice:hover {
        background-color: var(--card-hover);
    }

    .removal-hide-choice:hover {
        background: rgba(0, 197, 123, 0.1);
    }
}
