* {
    box-sizing: border-box;
}

:root {

    --bg: #f4f4f5;
    --surface: #ffffff;
    --surface-secondary: #f0f1f2;

    --text: #222222;
    --text-secondary: #707579;

    --border: #dedfe1;

    --accent: #1976d2;
    --accent-soft: #e7f1fc;

    --danger: #e53935;

    --radius: 14px;
}

body[data-theme="dark"] {

    --bg: #17212b;
    --surface: #202b36;
    --surface-secondary: #263544;

    --text: #f1f1f1;
    --text-secondary: #a8b2bb;

    --border: #384653;

    --accent: #64b5f6;
    --accent-soft: #233d55;
}

html {
    margin: 0;
    padding: 0;
}

html {
    scrollbar-gutter: stable;
}

body {

    margin: 0;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: var(--bg);
    color: var(--text);

    min-height: 100vh;
    display: flex;
    flex-direction: column;

    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

html,
body {
    overflow-x: clip;
    touch-action: pan-y;
}

html,
body {
    overscroll-behavior-x: none;
}

button,
input {
    font: inherit;
}

.page {

    width: 100%;
    max-width: 760px;

    margin: 0 auto;

    padding: 20px;
}

.settings-card {

    background: var(--surface);

    border-radius: 16px;

    padding: 24px;

    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.05);
}

.page-title {

    margin: 0 0 8px;

    font-size: 28px;
    line-height: 1.2;
}

.page-subtitle {

    margin: 0 0 28px;

    color: var(--text-secondary);

    line-height: 1.4;
}

.settings-section {

    margin-bottom: 28px;
}

.set-sect-bord {
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
}

.section-title {

    margin: 0 0 10px;

    font-size: 18px;
    line-height: 1.3;
}

.section-description {

    margin: 0 0 10px;

    color: var(--text-secondary);

    font-size: 14px;
}

.options {

    display: flex;
    flex-direction: column;

    gap: 6px;
}

.option {

    display: flex;
    align-items: center;

    gap: 12px;

    min-height: 48px;

    padding: 9px 12px;

    border-radius: 12px;

    cursor: pointer;
}

.option:hover {

    background: var(--surface-secondary);
}

.option input {

    width: 20px;
    height: 20px;

    margin: 0;

    flex: 0 0 auto;
}

.option-text {

    flex: 1;
}

.option-name {

    display: block;

    font-size: 16px;
}

.option-description {

    display: block;

    margin-top: 2px;

    color: var(--text-secondary);

    font-size: 13px;
}

.disabled-option {

    opacity: 0.5;

    cursor: default;
}

.disabled-option:hover {

    background: transparent;
}

.future-radio {

    width: 20px;

    flex: 0 0 20px;

    text-align: center;

    font-size: 20px;
}

.soon {

    padding: 4px 8px;

    border-radius: 8px;

    background: var(--surface-secondary);

    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 600;

    white-space: nowrap;
}

.theme-options {

    display: flex;

    gap: 10px;
}

.theme-option {

    position: relative;

    flex: 1;
}

.theme-option input {

    position: absolute;

    opacity: 0;

    pointer-events: none;
}

.theme-label {

    display: block;

    padding: 13px 16px;

    text-align: center;

    border: 1px solid var(--border);

    border-radius: 12px;

    cursor: pointer;
}

.theme-option input:checked
+ .theme-label {

    border-color: var(--accent);

    background: var(--accent-soft);

    color: var(--accent);

    font-weight: 600;
}

.save-button {

    width: 100%;

    margin-top: 5px;

    padding: 14px 18px;

    border: 0;
    border-radius: 12px;

    background: var(--accent);
    color: #ffffff;

    font-size: 17px;
    font-weight: 600;

    cursor: pointer;
}

.save-button:hover {

    opacity: 0.92;
}

.app {

    width: 100%;
    max-width: 900px;

    margin: 0 auto;
}

.app-header {

    position: sticky;

    top: 0;

    z-index: 100;

    padding:
        12px 16px
        10px;

    background: var(--bg);

    border-bottom: 1px solid var(--border);

    backdrop-filter: blur(10px);
}

.header-row {

    display: flex;

    align-items: center;

    gap: 12px;
}

.header-main {

    min-width: 0;

    flex: 1;
}

.app-title {

    margin: 0;

    font-size: 22px;

    line-height: 1.2;
}

.app-context {

    margin-top: 0px;

    color: var(--text-secondary);

    font-size: 15px;
}

.context-separator {

    padding:
        0 4px;
}

.settings-button {

    display: flex;

    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    border-radius: 50%;

    color: var(--text);

    text-decoration: none;

    font-size: 22px;
}

.settings-button:hover {

    background: var(--surface-secondary);
}

.search-container {

    display: flex;

    width: 50%;

    align-items: center;

    gap: 8px;

    margin-top: 10px;

    padding:
        0 12px;

    min-height: 42px;

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: 12px;
}

.search-icon {

    flex: 0 0 auto;

    font-size: 15px;
}

.search-input {

    width: 100%;

    min-width: 0;

    padding: 10px 0;

    border: 0;

    outline: 0;

    background: transparent;

    color: var(--text);

    font-size: 16px;
}

.search-input::placeholder {

    color: var(--text-secondary);
}

.refresh-status {

    min-height: 0;

    margin-top: 4px;

    color: var(--text-secondary);

    font-size: 12px;

    text-align: right;
}

.events-container {

    padding:
        0 16px
        24px;
}

.loading-events {

    padding: 35px 15px;

    color: var(--text-secondary);

    text-align: center;
}

.empty-events {

    margin-top: 20px;

    padding: 25px 20px;

    background: var(--surface);

    border-radius: var(--radius);

    color: var(--text-secondary);

    text-align: center;
}

.month-divider {

    margin:
        18px 0 10px;

    padding:
        10px 12px;

    background: var(--surface-secondary);

    border-radius: 11px;

    font-size: 14px;

    font-weight: 700;
}

.date-block {

    margin-bottom: 26px;
}

.date-title {

    margin:
        12px 0 10px;

    color: var(--text-secondary);

    font-size: 15px;

    font-weight: 700;

    text-align: center;
}

.event-card {

    display: flex;

    align-items: flex-start;

    gap: 12px;

    margin-bottom: 8px;

    padding: 14px;

    background: var(--surface);

    border-radius: var(--radius);

    cursor: pointer;

    color: var(--text);

    text-decoration: none;

    transition:
        background 0.15s ease,
        transform 0.15s ease;
}

.event-card:hover {

    transform: translateY(-1px);
}

.event-time {

    min-width: 64px;

    flex: 0 0 64px;

    font-size: 18px;

    font-weight: 700;

    line-height: 1.25;
}

.time-unknown {

    display: block;

    color: var(--text-secondary);

    font-size: 11px;

    font-weight: 500;

    line-height: 1.2;

    text-align: center;
}

.event-content {

    min-width: 0;

    flex: 1;
}

.event-arrow {

    flex: 0 0 auto;

    align-self: center;

    margin-left: 4px;

    color: var(--text-secondary);

    font-size: 25px;

    line-height: 1;
}

.event-title {

    font-size: 17px;

    line-height: 1.35;
}

.event-title-text {

    overflow-wrap: anywhere;
}

.category-badge {

    display: inline-block;

    vertical-align: middle;

    margin:
        0 6px 4px 0;

    padding:
       5px 8px 4px 8px;

    border-radius: 8px;

    color: #ffffff;

    font-size: 13px;

    font-weight: 700;

    line-height: 1.2;

    white-space: nowrap;

}

.event-location {

    margin-top: 7px;

    color: var(--text-secondary);

    font-size: 14px;

    line-height: 1.35;
}

.event-card.event-cancelled {

    opacity: 0.6;

    filter: grayscale(25%);

    background: var(--surface-secondary);
}

.event-card.event-cancelled
.event-title-text,
.event-card.event-cancelled
.event-location {

    text-decoration:
        line-through;

    text-decoration-color:
        #999999;
}

.cancellation-label {

    margin-top: 4px;

    color: var(--danger);

    font-size: 12px;

    font-weight: 700;
}


.event-page {

    width: 100%;
    max-width: 760px;

    margin: 0 auto;
}

.event-header {

    position: sticky;

    top: 0;

    z-index: 100;

    padding:
        10px 16px;

    background: var(--bg);

    border-bottom:
        1px solid var(--border);

    backdrop-filter:
        blur(10px);
}

.event-back {

    display: inline-flex;

    align-items: center;

    min-height: 42px;

    color: var(--accent);

    text-decoration: none;

    font-size: 16px;

    font-weight: 600;
}

.event-article {

    padding:
        16px;
}

.event-image-cancelled
.event-image {

    filter:
        brightness(0.5);
}

.event-cancel-overlay {

    position: absolute;

    top: 50%;
    left: 50%;

    transform:
        translate(-50%, -50%);

    width: max-content;

    max-width: 90%;

    padding:
        14px 20px;

    border-radius: 12px;

    background:
        rgba(255,255,255,0.94);

    color:
        #d32f2f;

    text-align: center;

    font-size: 18px;

    font-weight: 700;
}

.event-page-title {

    margin:
        0 0 12px;

    font-size: 28px;

    line-height: 1.25;
}

.event-page-category {

    display: inline-block;

    margin-bottom: 20px;

    padding:
        5px 10px;

    border-radius: 8px;

    color: #ffffff;

    font-size: 13px;

    font-weight: 700;
}

.event-info {

    display: flex;

    flex-direction: column;

    gap: 12px;

    margin-bottom: 22px;
}

.event-info-row {

    display: flex;

    align-items: flex-start;

    gap: 12px;

    padding:
        12px 14px;

    background:
        var(--surface);

    border-radius:
        12px;
}

.event-info-icon {

    width: 24px;

    flex: 0 0 24px;

    font-size: 18px;

    text-align: center;
}

.event-info-row strong {

    display: block;

    margin-bottom: 2px;

    font-size: 13px;

    color:
        var(--text-secondary);
}

.event-info-row > div {

    line-height: 1.4;
}

.schedule-box {

    margin:
        18px 0;

    padding:
        14px 16px;

    background:
        var(--surface-secondary);

    border-radius:
        12px;

    line-height: 1.5;
}

.event-period {

    margin-top: 6px;

    color:
        var(--text-secondary);

    font-size: 14px;
}

.event-info-block {

    margin:
        18px 0;

    padding:
        16px;

    background:
        var(--surface);

    border-radius:
        14px;
}

.event-info-block h2 {

    margin:
        0 0 10px;

    font-size: 18px;
}

.event-info-block p {

    margin:
        7px 0;

    line-height: 1.4;
}

.event-description {

    margin:
        24px 0;

    font-size: 16px;

    line-height: 1.55;

    overflow-wrap:
        anywhere;
}

.event-source {

    padding-top:
        10px;

    text-align: center;
}

.source-button {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    min-height: 46px;

    padding:
        0 18px;

    border-radius:
        12px;

    background:
        var(--accent);

    color:
        #ffffff;

    text-decoration:
        none;

    font-weight:
        600;
}

.event-qr {

    display: block;

    width: 150px;

    height: 150px;

    margin:
        24px auto 10px;

}

.qr-text {

    color:
        var(--text-secondary);

    font-size:
        13px;

    line-height:
        1.4;
}

.event-info-content {
    min-width: 0;
    flex: 1;
}

.event-info-value {
    line-height: 1.45;
}

.event-repeat {
    margin-top: 5px;

    color: var(--text-secondary);

    font-size: 14px;

    line-height: 1.45;
}

.event-page {

   /* touch-action: pan-y;

    will-change: transform;

    transform:
        translate3d(0, 0, 0);*/
}

body.event-swipe-active {

    user-select: none;

    -webkit-user-select: none;

    /* overflow-x: hidden; */
}



.event-view {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: var(--bg);
    transform: translate3d(100%, 0, 0);
    will-change: transform;
    /* явно задаём размеры даже для мобильного */
    width: 100%;
    height: 100%;
    height: 100dvh;   /* современные браузеры */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;  
    visibility: hidden;
    touch-action: pan-y;
    pointer-events: none;    
}

@media (min-width: 900px) {
    .event-view {
        inset: 0;
        width: min(97vw, 900px);
        height: min(94vh, 950px);
        height: min(94dvh, 950px);
        margin: auto;
        border-radius: 16px;
        box-shadow: 0 20px 80px rgba(0,0,0,.45),
                    0 40px 23px -10px rgba(0,0,0,.7);
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--bg) var(--surface-secondary);
    }
}

@media (min-width: 900px) and (max-height: 700px) {
    .event-view {
        height: calc(100dvh - 24px);  /* почти на всю высоту */
        border-radius: 12px;
    }
}

@media (min-width: 1280px) {
    .event-view {
        width: min(900px, 92vw);
        height: min(97dvh, 950px);
    }
}

.event-view.is-visible {

    visibility: visible;

    pointer-events: auto;
}

/*.event-view.is-animating {

    transition:
        transform 280ms
        cubic-bezier(0.22, 1, 0.36, 1);
}*/

.event-view-content {

    width: 100%;
    height: 100%;

}

.event-view .event-page {

    width: 100%;

    max-width: 760px;

    height: 100%;

    margin: 0 auto;

    overflow-y: auto;

    background: var(--bg);
}

.event-view.event-dragging {

    transition: none;

    user-select: none;

    -webkit-user-select: none;
}

/* Блокировка скролла списка под карточкой */
body.event-open {
    /* overflow: hidden;
    touch-action: none; */
}

/* страховка: часто скроллится html, а не body */
html:has(body.event-open) {
    overflow: hidden;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
}

.event-header {
    position: sticky;
    top: 0;
    z-index: 110;
    background: var(--bg);
}

.event-view .event-page {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: clip;
}

.events-dim-overlay {
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(0, 0, 0, 0.9);
    opacity: 0;
    pointer-events: none;
    will-change: opacity;
}

.event-image-wrapper {

    position: relative;

    aspect-ratio: 728 / 520;

    width: 100%;
    max-width: 728px;
    height: auto;
    max-height: 520px;

    margin: 0 auto 20px;

    overflow: hidden;

    border-radius: 16px;

    background: var(--surface-secondary);
}

.event-image {

    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
    background: var(--surface-secondary);

    filter: blur(20px);
    transform: scale(1.03);

    transition:
        filter 400ms ease,
        transform 400ms ease;
}

.event-image.is-loaded {

    filter: blur(0);
    transform: scale(1);
}

.event-image-cancelled .event-image {

    filter: brightness(0.5);
    transform: scale(1);
}

.section-title.is-collapsible {

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 8px;

    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.section-title.is-collapsible::after {

    content: "▾";

    color: var(--text-secondary);

    font-size: 30px;
    line-height: 1;

    transition: transform 0.18s ease;
}

.section-title.is-collapsible.is-collapsed::after {

    transform: rotate(-90deg);
}

.options.is-collapsed {

    display: none;
}

.option-bigcategory input[type="checkbox"] {

    accent-color: #2e7d32;

    width: 22px;
    height: 22px;
}

#sportCategoriesOptions .option {
    align-items: flex-start;
}

#sportCategoriesOptions .option input[type="checkbox"] {
    margin-top: 2px;
}

.search-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
}

.search-toolbar .search-container {
    flex: 0 1 100%;
    width: 100%;
    min-width: 0;
    margin-top: 0;
    box-sizing: border-box;
}

.date-filter {
    position: relative;
    flex: 0 0 auto;
}

.filter-date {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 13px;

    color: var(--text);
    font: inherit;
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: 12px;
}

.filter-date:focus-visible {
    outline: 2px solid var(--accent-color, #4285f4);
    outline-offset: 2px;
}

.filter-date-arrow {
    font-size: 12px;
    opacity: 0.7;
}

.date-filter-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 200;
    width: 230px;
    padding: 8px;
    border: 1px solid var(--border-color, #dddddd);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    box-sizing: border-box;
}

.date-filter-menu[hidden] {
    display: none !important;
}

.date-filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.date-filter-option:hover {
    background: var(--surface-secondary);
}

.date-filter-option input {
    flex: 0 0 auto;
    margin: 0;
    accent-color: var(--accent-color, #4285f4);
}

.date-filter-custom {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
    padding: 12px 10px 6px;
    border-top: 1px solid var(--border-color, #dddddd);
}

.date-filter-custom label {
    font-size: 13px;
    opacity: 0.8;
}

.date-filter-custom input[type="date"] {
    width: 100%;
    min-height: 38px;
    padding: 6px 8px;

    border: 1px solid var(--border);
    border-radius: 8px;

    background: var(--surface);
    color: var(--text);

    font: inherit;
    font-size: 14px;

    box-sizing: border-box;

    color-scheme: light;
}

body[data-theme="dark"] .date-filter-custom input[type="date"] {
    color-scheme: dark;
}

body[data-theme="dark"]
.date-filter-custom input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

.date-filter-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--muted-color, #777777);
    font-size: 15px;
}


.app-directions {

    margin-top: 2px;

    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;

    color: var(--text-secondary);

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.anons643-footer[hidden] {
    display: none !important;
}

.anons643-footer {
    margin-top: 32px;
    background: #202b36;
    color: #a8b2bb;
    border-top: 1px solid #384653;
    font-size: 14px;
}

.anons643-footer,
.anons643-footer * {
    box-sizing: border-box;
}

.anons643-footer__inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 22px 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.anons643-footer__social {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 11px;
    /* max-width: 1000px; */
    /* width: 100%; */
}

.anons643-footer__social-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #d6dde4;
    text-decoration: none;
    transition: color 0.2s ease;
}

.anons643-footer__social-link:hover {
    color: #64b5f6;
}

.anons643-footer__vk-icon,
.anons643-footer__max-icon {
    width: 25px;
    height: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
}

.anons643-footer__vk-icon {
    background: #0077ff;
    color: #ffffff;
}

.anons643-footer__max-icon {
    background: #ffffff;
    color: #202b36;
}

.anons643-footer__telegram-icon {
    width: 25px;
    height: 25px;
    flex-shrink: 0;
    fill: #64b5f6;
}

.anons643-footer__nav {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 22px;
}

.anons643-footer__nav a {
    color: #a8b2bb;
    text-decoration: none;
    transition: color 0.2s ease;
}

.anons643-footer__nav a:hover {
    color: #64b5f6;
}

.anons643-footer__copyright {
    width: 100%;
    padding-top: 13px;
    border-top: 1px solid #384653;
    color: #8493a1;
    font-size: 12px;
    text-align: center;
}


@media (prefers-reduced-motion: reduce) {
    .anons643-footer__social-link,
    .anons643-footer__nav a {
        transition: none;
    }
}

.app {
    flex: 1 0 auto;
}

.anons643-footer {
    flex-shrink: 0;
    margin-top: 0px;
}

body.event-open {

}

.event-view.is-visible  { transform: translate3d(0, 0, 0); }
.event-view.is-animating { transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1); }

.event-view.is-animating,
.event-view.event-dragging {
    will-change: transform;
}

@media (min-width: 701px) {

    .event-view::-webkit-scrollbar { width: 0px; }
    .event-view::-webkit-scrollbar-track { background: var(--surface-secondary); }
    .event-view::-webkit-scrollbar-thumb {
        box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.9);
        background: #ec0c71;
        border-radius: 4px;
    }


    .event-view .event-page {

    width: 100%;

    max-width: 760px;

    height: 100%;

    margin: 0 auto;

    overflow-y: auto;
    overflow-x: hidden;

    background: var(--bg);
}

}

/* Разделитель: конец рекламного блока / недели */
.anons643-ad-separator {
    display: block;
    box-sizing: border-box;
    width: 280px;
    margin: 12px auto;
    border: 0;
    border-top: 1px solid var(--border-color, #ccc);
}

.anons643-ad-separator[hidden] {
    display: none;
}


/* ==================================================
   TOGGLE-SWITCH для чекбоксов настроек
   Работает без изменения PHP-разметки
   ================================================== */

/* 1. Превращаем .option в flex, но только если внутри чекбокс */
.option:has(> input[type="checkbox"]) {
    display: flex;
    align-items: flex-start;     /* текст может быть многострочным */
    gap: 12px;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background-color .15s ease;
}

.option:has(> input[type="checkbox"]):hover {
    background: rgba(0, 0, 0, .04);
}

/* 2. Сам чекбокс становится видимым «треком» */
.option > input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;

    position: relative;          /* для ползунка ::after */
    flex: 0 0 auto;              /* не сжимать */
    align-self: center;          /* ВАЖНО: центр по вертикали строки */

    width: 46px;
    height: 24px;
    margin: 0;
    background: #cfd4dc;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .25s ease;

    /* сбрасываем возможные глобальные стили для input */
    border: none;
    box-shadow: none;
    outline: none;
}

/* 3. Ползунок */
.option > input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 17px;
    height: 17px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .25s ease;
}

/* 4. Включённое состояние */
.option > input[type="checkbox"]:checked {
    background: #3b82f6;
}

.option > input[type="checkbox"]:checked::after {
    transform: translateX(22px);   /* 46 − 18 − 3 − 3 = 22 */
}

/* 5. Фокус с клавиатуры */
.option > input[type="checkbox"]:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* 6. Тёмная тема */
body[data-theme="dark"] .option:has(> input[type="checkbox"]):hover {
    background: rgba(255, 255, 255, .06);
}

body[data-theme="dark"] .option > input[type="checkbox"] {
    background: #3a4250;
}

body[data-theme="dark"] .option > input[type="checkbox"]:checked {
    background: #4f8ef7;
}

/* CSS-галочка: одинаковый цвет на Android и iOS */
/* .anons643-reaction-check {
    display: inline-block;
    position: relative;
    width: 15px;
    height: 15px;
    margin-right: 3px;
    flex: 0 0 15px;
    vertical-align: -2px;
    color: #16a34a;
}

.anons643-reaction-check::before {
    content: "";
    position: absolute;
    left: 2px;
    top: -6px;
    width: 8px;
    height: 13px;
    border-right: 4px solid #16a34a;
    border-bottom: 6px solid #16a34a;
    transform: rotate(45deg);
} */

@media (max-width: 700px) {

    .event-view .event-page {

        max-width: none;

        width: 100%;
    }

}

@media (max-width: 700px) {

    .event-arrow {

        font-size: 23px;

        margin-left: 2px;
    }

    .page {

        padding:
            10px;
    }

    .settings-card {

        padding:
            18px;

        border-radius:
            14px;
    }

    .page-title {

        font-size:
            24px;
    }

    .app-header {

        padding:
            10px 10px 8px;
    }

    .app-title {

        font-size:
            20px;
    }

    .events-container {

        padding:
            0 10px
            20px;
    }

    .event-card {

        gap: 11px;

        padding:
            13px 12px;

        border-radius:
            12px;

         touch-action: pan-y;    
    }

    .event-time {

        min-width:
            55px;

        flex-basis:
            55px;

        font-size:
            17px;
    }

    .event-title {

        font-size:
            16px;
    }

    .event-location {

        font-size:
            13px;
    }

    .event-header {

        padding:
            8px 10px;
    }

    .event-article {

        padding:
            12px 10px 24px;
    }

    .event-page-title {

        font-size:
            23px;
    }

    .event-image-wrapper {

        border-radius:
            12px;
    }

    .event-info-row {

        padding:
            11px 12px;
    }

    .event-description {

        font-size:
            16px;
    }

    .event-image-wrapper {

        border-radius: 12px;

        max-height: none;
    }

    .search-toolbar {
        gap: 8px;
    }

    .search-toolbar .search-container {
        flex: 1 1 auto;
        width: auto;
    }

    .filter-date {
        min-height: 42px;
        gap: 5px;
        padding: 0 9px;
        font-size: 13px;
    }

    .date-filter-menu {
        width: min(230px, calc(100vw - 20px));
    }

    .app-directions {

        font-size: 12px;
    }

    .anons643-footer {
        margin-top: 24px;
    }

    .anons643-footer__inner {
        padding: 20px 14px 14px;
        gap: 17px;
    }

    .anons643-footer__social {
        gap: 12px 10px;
        font-size: 11px;
    }

    .anons643-footer__nav {
        gap: 12px 18px;
    }
}

@media (max-width: 360px) {

    .event-time {

        min-width:
            50px;

        flex-basis:
            50px;

        font-size:
            16px;
    }

}

/* ==================================================
   SOURCE BADGE поверх картинки (правый нижний угол)
   ================================================== */

.event-image-source-badge {

    position: absolute;

    /* Правый нижний угол */
    bottom: 10px;
    right: 10px;

    z-index: 2;

    /* По ширине блока: от левого отступа до правого края */
    left: 10px;
    max-width: 100%;

    box-sizing: border-box;

    /* Белый текст, 10px, чёрная тень для читаемости */
    color: #ffffff;
    font-size: 10px;
    line-height: 1.25;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);

    text-align: right;

    /* Не мешать кликам/свайпу по картинке */
    pointer-events: none;

    overflow: hidden;
}

.event-image-source-label {

    font-weight: 700;

    margin-bottom: 2px;

    /* Прижат к правому краю */
    text-align: right;

    white-space: nowrap;

    overflow: hidden;
    text-overflow: ellipsis;
}

.event-image-source-url {

    /* Прижат к правому краю */
    text-align: right;

    /* Одна строка, длинная ссылка обрезается */
    white-space: nowrap;

    overflow: hidden;
    text-overflow: ellipsis;

    /* Занимает всю доступную ширину блока */
    width: 100%;

    max-width: 100%;
}


/* ==================================================
   SOURCE BUTTON — две строки (метка + URL)
   ================================================== */

.event-source {
    padding-top: 10px;
    text-align: center;
}

.source-button {

    display: inline-flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 2px;

    /* Растягивается по высоте при длинной ссылке */
    min-height: 46px;

    max-width: 100%;

    padding: 8px 18px;

    box-sizing: border-box;

    border-radius: 12px;

    background: var(--accent);

    color: #ffffff;

    text-decoration: none;

    font-weight: 600;

    /* Длинные ссылки переносятся, а не обрезаются */
    white-space: normal;

    overflow-wrap: anywhere;
    word-break: break-word;
}

.source-button-label {

    line-height: 1.2;
}

.source-button-url {

    /* font-size = 50% от базового */
    font-size: 80%;

    font-weight: 400;

    line-height: 1.25;

    opacity: 0.9;

    max-width: 100%;

    /* Перенос длинной ссылки */
    overflow-wrap: anywhere;
    word-break: break-word;

    text-align: center;
}


/* ==================================================
   Адаптив
   ================================================== */

@media (max-width: 700px) {

     .event-image-source-badge {

        bottom: 8px;
        right: 8px;
        left: 8px;
    }
}

    .source-button {

        padding: 7px 14px;
    }
}

@media (max-width: 360px) {

    .event-image-source-badge {

        font-size: 9px;
    }
}

/* ==================================================
   IMAGE VIEWER (в стиле Telegram)
   ================================================== */

.image-viewer {
    position: fixed;
    inset: 0;
    z-index: 600; /* выше event-view (500) */
    /* background: #000; */
    background: var(--surface-secondary);
    display: flex;
    flex-direction: column;

    visibility: hidden;
    opacity: 0;
    pointer-events: none;

    transition:
        opacity 0.2s ease,
        visibility 0.2s;

    /* JS полностью управляет жестами */
    touch-action: none;
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
}

.image-viewer.is-visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.image-viewer-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 10px 16px;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.95),
        transparent
    );
    pointer-events: none;
}

.image-viewer-back {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

.image-viewer-back:hover {
    background: rgba(255, 255, 255, 0.2);
}

.image-viewer-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.image-viewer-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transform-origin: center center;
    will-change: transform;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
    transition: none;
}

.image-viewer-img.is-animating {
    transition: transform 250ms cubic-bezier(0.22, 1, 0.36, 1);
}

.image-viewer-footer {
    padding: 14px 16px 18px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.95),
        transparent
    );
    color: #fff;
    text-align: center;
    pointer-events: none;
}

.image-viewer-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}

.image-viewer-source {
    font-size: 13px;
    line-height: 1.35;
    opacity: 0.8;
    overflow-wrap: anywhere;
}

/* Плавное «затухание» интерфейса при свайпе вверх/вниз */
.image-viewer.is-closing-swipe .image-viewer-header,
.image-viewer.is-closing-swipe .image-viewer-footer {
    opacity: 0;
    transition: opacity 0.15s ease;
}

@media (max-width: 700px) {
    .image-viewer-header {
        padding: 8px 10px;
    }

    .image-viewer-footer {
        padding: 12px 10px 16px;
    }

    .image-viewer-title {
        font-size: 15px;
    }

    .image-viewer-source {
        font-size: 12px;
    }
}

body.image-viewer-open {
    overflow: hidden;
    touch-action: none;
}

/* ==================================================
   SKELETON загрузки карточки мероприятия
   ================================================== */

.event-skeleton-image {
    position: relative;
    overflow: hidden;
    background: var(--surface-secondary);
}

.event-skeleton-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.25) 50%,
        transparent 100%
    );
    animation: eventSkeletonShimmer 1.4s infinite linear;
}

@keyframes eventSkeletonShimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.event-skeleton-line {
    height: 16px;
    margin: 12px 0;
    border-radius: 8px;
    background: var(--surface-secondary);
    animation: eventSkeletonPulse 1.4s infinite ease-in-out;
}

.event-skeleton-title {
    height: 28px;
    width: 80%;
    margin-top: 16px;
}

.event-skeleton-badge {
    height: 24px;
    width: 30%;
    margin-bottom: 16px;
}

.event-skeleton-row {
    height: 56px;
    margin: 12px 0;
    border-radius: 12px;
    background: var(--surface-secondary);
    animation: eventSkeletonPulse 1.4s infinite ease-in-out;
}

.event-skeleton-short {
    width: 60%;
}

.event-skeleton-status {
    margin: 24px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

@keyframes eventSkeletonPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.6; }
}

@media (prefers-reduced-motion: reduce) {
    .event-skeleton-shimmer,
    .event-skeleton-line,
    .event-skeleton-row {
        animation: none;
    }
}

/* Скрытие пустого бейджа — важно, иначе display:flex перебьёт hidden */
.event-content > .anons643-reaction-summary[hidden] {
    display: none !important;
}

/* 1. Сам бейдж — по ширине контента */
.event-content > .anons643-reaction-summary {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    align-self: flex-start;        /* если .event-content — flex-колонка */
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 1px 8px;
    background: var(--surface-secondary);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.3;
    pointer-events: none;
}

/* Каждый счётчик */
.event-content > .anons643-reaction-summary .anons643-reaction-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* Разделитель между счётчиками (когда их 2–3) */
.event-content > .anons643-reaction-summary .anons643-reaction-count + .anons643-reaction-count {
    padding-left: 6px;
    border-left: 1px solid var(--border-subtle, rgba(0,0,0,.12));
}

/* Эмодзи и число */
.event-content > .anons643-reaction-summary .anons643-reaction-emoji {
    font-size: 14px;
    line-height: 1;
}

.event-content > .anons643-reaction-summary .anons643-reaction-num {
    font-variant-numeric: tabular-nums; /* ровные цифры */
    font-weight: 600;
}

/* Галочка «участник» — рисуем CSS-ом, чтобы не зависеть от шрифта */
.event-content > .anons643-reaction-summary .anons643-reaction-check {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-secondary);
    position: relative;
    margin-right: 2px;    /* ← отлепляем от числа */
    vertical-align: middle;
}
.event-content > .anons643-reaction-summary .anons643-reaction-check::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 2px;
    width: 4px;
    height: 7px;
    border: solid var(--surface-secondary, #fff);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.date-title {
    display: flex;
    align-items: center;
    gap: 12px;

    margin: 12px 0 10px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 700;
    text-align: center;
}

/* Левая полоска */
.date-title::before,
/* Правая полоска */
.date-title::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background-color: currentColor; /* цвет линии = цвет текста */
    opacity: 0.35;                  /* тонкая, приглушённая линия */
}

/* Небольшой отступ от текста до полосок (можно убрать gap и оставить margin) */
.date-title::before {
    margin-right: 4px;
}

.date-title::after {
    margin-left: 4px;
}

.event-original-post {
    margin: 18px 0 24px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.event-original-post-title {
    font-weight: 600;
}

.event-original-post-date {
    margin-top: 2px;
}

