/* Mushfind: единая высококонтрастная палитра для аудитории 50+. */
:root {
    --mf-page: #f3efe4;
    --mf-surface: #fffdf7;
    --mf-surface-alt: #edf3e9;
    --mf-surface-strong: #dce8d8;
    --mf-text: #1f2f24;
    --mf-muted: #526258;
    --mf-primary: #2d5b3a;
    --mf-primary-hover: #1f452b;
    --mf-primary-soft: #dfead9;
    --mf-accent: #9a3f20;
    --mf-accent-hover: #783017;
    --mf-accent-soft: #fff0e5;
    --mf-border: #aebaaa;
    --mf-border-strong: #7f9182;
    --mf-header: #203f2a;
    --mf-header-border: #d0af61;
    --mf-danger: #8f2424;
    --mf-danger-soft: #fde8e8;
    --mf-success: #245f3a;
    --mf-success-soft: #e5f2e8;
    --mf-warning: #744800;
    --mf-warning-soft: #fff3cf;
    --mf-info: #285b6b;
    --mf-info-soft: #e6f2f5;
    --mf-shadow: 0 8px 22px rgba(31, 47, 36, .13);
}

html {
    color-scheme: light;
    background: var(--mf-page) !important;
}

body,
.app-container,
.main-content,
.auth-container,
.wrap,
.map-section,
.chat-messages,
.profile-main {
    background: var(--mf-page) !important;
    color: var(--mf-text) !important;
}

body {
    min-height: 100vh;
}

body::before,
body::after,
.background,
.background::before,
.background::after,
.background video {
    display: none !important;
    background: none !important;
}

/* Убираем прозрачные градиентные надписи, которые на светлом фоне исчезали. */
h1, h2, h3, h4, h5, h6,
.logo,
.section-title,
.chat-title,
.popup-title,
.auth-header h1,
.auth-header h2,
.mushroom-name,
.tariff-name,
.price {
    background: none !important;
    color: var(--mf-text) !important;
    -webkit-background-clip: border-box !important;
    background-clip: border-box !important;
    -webkit-text-fill-color: currentColor !important;
    text-shadow: none !important;
}

p, li, dt, dd, label, small,
.description,
.lead,
.quiet,
.meta-text,
.report-comment,
.report-date,
.report-meta,
.stat-label,
.feature-text,
.faq-answer,
.section-subtitle,
.footer-note,
.auth-footer,
.social-login-title {
    color: var(--mf-text) !important;
}

.quiet,
.message-time,
.report-date,
.meta-text,
.footer-note,
.auth-footer,
.social-login-title,
.section-subtitle {
    color: var(--mf-muted) !important;
}

a {
    color: var(--mf-primary) !important;
    text-decoration-color: currentColor;
    text-underline-offset: .16em;
}

a:hover,
a:focus-visible {
    color: var(--mf-primary-hover) !important;
}

/* Шапка и нижнее меню — единственные крупные тёмные поверхности. */
.main-header,
.main-footer,
.footer,
.mobile-menu {
    background: var(--mf-header) !important;
    color: #fff !important;
    border-color: var(--mf-header-border) !important;
    box-shadow: 0 4px 16px rgba(20, 43, 28, .25) !important;
}

.main-header :is(.logo, .user-status, .user-details, .user-info, .username),
.main-footer,
.main-footer *,
.footer,
.footer *,
.mobile-menu,
.mobile-menu a,
.mobile-menu i,
.mobile-menu .menu-label {
    color: #fff !important;
    -webkit-text-fill-color: currentColor !important;
}

.main-header a:not(.header-btn) {
    color: #fff !important;
}

.mobile-menu a:hover,
.mobile-menu a.active {
    color: #182d20 !important;
    background: #f7e8b9 !important;
}

/* Светлые карточки и панели. */
:is(
    .auth-card,
    .card,
    .feature-card,
    .pricing-card,
    .faq-item,
    .special-offer,
    .user-current-tariff,
    .chat-form-container,
    .chat-messages-container,
    .report-item,
    .popup,
    .filters-section,
    .action-card,
    .stat-card,
    .premium-upsell,
    .upload-section,
    .result-card,
    .backup-section,
    .weather-box,
    .question,
    .metric,
    .report,
    .item,
    .hero,
    .drawing-controls
) {
    background: var(--mf-surface) !important;
    color: var(--mf-text) !important;
    border: 2px solid var(--mf-border) !important;
    box-shadow: var(--mf-shadow) !important;
}

:is(
    .auth-card,
    .card,
    .feature-card,
    .pricing-card,
    .faq-item,
    .special-offer,
    .user-current-tariff,
    .chat-form-container,
    .chat-messages-container,
    .report-item,
    .popup,
    .filters-section,
    .action-card,
    .stat-card,
    .premium-upsell,
    .upload-section,
    .result-card,
    .backup-section,
    .weather-box,
    .question,
    .metric,
    .report,
    .item,
    .hero,
    .drawing-controls
) :is(h1, h2, h3, h4, h5, h6, p, span, strong, small, label, li, div) {
    color: var(--mf-text) !important;
    -webkit-text-fill-color: currentColor !important;
    text-shadow: none !important;
}

:is(.mf-daily-card, .mf-action) {
    background: var(--mf-surface) !important;
    color: var(--mf-text) !important;
    border-color: var(--mf-border) !important;
}

.mf-action:hover {
    background: var(--mf-primary-soft) !important;
    border-color: var(--mf-primary) !important;
}

.mf-guide {
    background: #fff3cf !important;
    color: #2b352d !important;
    border-bottom-color: #bd9b42 !important;
}

.mf-guide *,
.mf-guide a,
.mf-guide button {
    color: #2b352d !important;
}

/* Формы. */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea,
.form-input,
.form-select,
.form-textarea {
    background: #fff !important;
    color: #17251b !important;
    border: 2px solid var(--mf-border-strong) !important;
    box-shadow: none !important;
}

input:focus,
select:focus,
textarea:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    background: #fff !important;
    color: #17251b !important;
    border-color: var(--mf-primary) !important;
    box-shadow: 0 0 0 4px rgba(45, 91, 58, .18) !important;
}

input::placeholder,
textarea::placeholder {
    color: #667269 !important;
    opacity: 1 !important;
}

select option {
    background: #fff !important;
    color: #17251b !important;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: #17251b !important;
    -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
}

.form-label,
.filter-label,
.report-label {
    color: #26382b !important;
    font-weight: 700 !important;
}

/* Кнопки: белый текст только на тёмном фоне. */
.btn,
.primary-btn,
.header-btn,
.upload-btn,
.backup-btn,
.draw-btn,
.file-upload-label,
.file-input-label,
.social-btn,
button,
input[type="submit"] {
    text-shadow: none !important;
}

:is(.btn-primary, .primary-btn, .upload-btn, button[type="submit"], input[type="submit"], .draw-btn.complete) {
    background: var(--mf-primary) !important;
    color: #fff !important;
    border: 2px solid var(--mf-primary-hover) !important;
    box-shadow: 0 4px 12px rgba(31, 69, 43, .25) !important;
}

:is(.btn-primary, .primary-btn, .upload-btn, button[type="submit"], input[type="submit"], .draw-btn.complete) * {
    color: #fff !important;
    -webkit-text-fill-color: currentColor !important;
}

:is(.btn-primary, .primary-btn, .upload-btn, button[type="submit"], input[type="submit"], .draw-btn.complete):hover {
    background: var(--mf-primary-hover) !important;
}

:is(.btn-secondary, .header-btn.secondary, .backup-btn, .draw-btn.cancel, .draw-btn.back, .file-upload-label, .file-input-label) {
    background: #fff !important;
    color: var(--mf-primary-hover) !important;
    border: 2px solid var(--mf-primary) !important;
}

:is(.btn-secondary, .header-btn.secondary, .backup-btn, .draw-btn.cancel, .draw-btn.back, .file-upload-label, .file-input-label) * {
    color: var(--mf-primary-hover) !important;
}

:is(.btn-secondary, .header-btn.secondary, .backup-btn, .draw-btn.cancel, .draw-btn.back, .file-upload-label, .file-input-label):hover {
    background: var(--mf-primary-soft) !important;
}

.btn-danger {
    background: var(--mf-danger) !important;
    color: #fff !important;
    border: 2px solid #6f1818 !important;
}

.btn-danger * {
    color: #fff !important;
}

.btn-disabled,
button:disabled,
.btn:disabled {
    background: #d9ddd8 !important;
    color: #4f5a52 !important;
    border-color: #aeb5af !important;
    opacity: 1 !important;
}

.social-btn.yandex,
.social-btn.webik {
    background: #fff !important;
    color: #26382b !important;
    border: 2px solid var(--mf-border-strong) !important;
}

.social-btn.yandex *,
.social-btn.webik * {
    color: #26382b !important;
}

/* Уведомления и подсказки. */
.error-message,
.notification.error {
    background: var(--mf-danger-soft) !important;
    color: #6f1818 !important;
    border: 2px solid #c67575 !important;
}

.error-message *,
.notification.error * {
    color: #6f1818 !important;
}

.notification.success {
    background: var(--mf-success-soft) !important;
    color: #173d26 !important;
    border: 2px solid #77a988 !important;
}

.notification.warning,
.mf-safe-note,
.limit-info {
    background: var(--mf-warning-soft) !important;
    color: #553500 !important;
    border-color: #c7a34b !important;
}

.notification.info {
    background: var(--mf-info-soft) !important;
    color: #173f4c !important;
    border-color: #7ca7b5 !important;
}

/* Карта и всплывающие окна. */
.map-container,
#map {
    background: #dfe8da !important;
    border: 3px solid var(--mf-border-strong) !important;
    box-shadow: var(--mf-shadow) !important;
}

.popup-overlay {
    background: rgba(20, 35, 25, .68) !important;
}

.popup-header {
    border-bottom: 2px solid var(--mf-border) !important;
}

.close-popup {
    background: #fff !important;
    color: #6f1818 !important;
    border: 2px solid #b86b6b !important;
}

.filter-tag,
.tariff-badge,
.badge,
.counter-badge,
.current-badge {
    background: var(--mf-primary-soft) !important;
    color: #193023 !important;
    border: 1px solid #7f9a82 !important;
}

.point-counter,
.drawing-hint {
    background: var(--mf-header) !important;
    color: #fff !important;
    border: 2px solid var(--mf-header-border) !important;
}

.point-counter *,
.drawing-hint * {
    color: #fff !important;
}

.upgrade-banner {
    background: var(--mf-accent-soft) !important;
    color: #6d2b16 !important;
    border: 2px solid #c9825d !important;
}

.upgrade-banner * {
    color: #6d2b16 !important;
}

[class*="balloon__layout"],
[class*="balloon__content"],
[class*="balloon__tail"]::after {
    background: var(--mf-surface) !important;
    color: var(--mf-text) !important;
}

[class*="balloon__content"] * {
    color: var(--mf-text) !important;
}

/* Чат. */
.chat-messages-container {
    background: #fff !important;
}

.message {
    background: var(--mf-surface-alt) !important;
    color: var(--mf-text) !important;
    border: 2px solid #b9c8b7 !important;
}

.message.ai-message {
    background: #e3efe0 !important;
    border-color: #8ead8a !important;
}

.message :is(.message-text, .message-text-content, .message-username, .message-username a, .location-meta) {
    color: var(--mf-text) !important;
}

.message-time {
    color: var(--mf-muted) !important;
}

.location-link {
    color: var(--mf-primary-hover) !important;
    background: #fff !important;
    border: 1px solid var(--mf-border) !important;
}

/* Профиль. */
.profile-header,
.statistics-grid,
.reports-grid,
.profile-stats,
.stat-list,
.report-list {
    color: var(--mf-text) !important;
}

.stat-bar {
    background: #d9e0d7 !important;
}

.stat-bar-fill {
    background: var(--mf-primary) !important;
}

.premium-upsell,
.pricing-card.pro,
.special-offer {
    background: var(--mf-accent-soft) !important;
    color: #632711 !important;
    border-color: #c9825d !important;
}

.premium-upsell *,
.pricing-card.pro *,
.special-offer * {
    color: #632711 !important;
    -webkit-text-fill-color: currentColor !important;
}

.btn-upgrade {
    background: var(--mf-accent) !important;
    color: #fff !important;
    border: 2px solid var(--mf-accent-hover) !important;
}

.btn-upgrade * {
    color: #fff !important;
}

.tariff-badge-large,
.tariff-pro {
    background: var(--mf-accent) !important;
    color: #fff !important;
}

.tariff-badge-large *,
.tariff-pro * {
    color: #fff !important;
}

/* Страница подписки и ежедневные сводки. */
.feature.available .feature-icon,
.feature.available i {
    color: var(--mf-success) !important;
}

.feature.unavailable,
.feature.unavailable * {
    color: #69746c !important;
}

.faq-question {
    color: var(--mf-primary-hover) !important;
}

.brief-label,
.tag {
    background: var(--mf-primary-soft) !important;
    color: #193023 !important;
    border: 1px solid #8da68f !important;
}

.share-row {
    background: var(--mf-surface-alt) !important;
    border: 2px solid var(--mf-border) !important;
}

/* Фото и загрузка. */
.upload-label {
    background: var(--mf-primary-soft) !important;
    color: #193023 !important;
    border: 3px dashed var(--mf-primary) !important;
}

.upload-label * {
    color: #193023 !important;
}

.recommendations {
    background: var(--mf-warning-soft) !important;
    color: #553500 !important;
    border: 2px solid #c7a34b !important;
}

/* Гарантируем читаемость текста внутри светлых таблиц и сторонних виджетов. */
table,
th,
td,
dialog,
[role="dialog"] {
    color: var(--mf-text);
}

/* На тёмных кнопках и панелях белый текст восстанавливается последним правилом. */
:is(
    .main-header,
    .main-footer,
    .footer,
    .point-counter,
    .drawing-hint,
    .btn-primary,
    .primary-btn,
    .upload-btn,
    .btn-danger,
    .btn-upgrade,
    button[type="submit"],
    input[type="submit"]
),
:is(
    .main-header,
    .main-footer,
    .footer,
    .point-counter,
    .drawing-hint,
    .btn-primary,
    .primary-btn,
    .upload-btn,
    .btn-danger,
    .btn-upgrade,
    button[type="submit"],
    input[type="submit"]
) * {
    color: #fff !important;
    -webkit-text-fill-color: currentColor !important;
}

@media (max-width: 760px) {
    :is(.auth-card, .card, .popup, .pricing-card, .feature-card, .faq-item) {
        border-radius: 14px !important;
    }

    .main-content,
    .auth-container,
    .wrap {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}

@media (prefers-contrast: more) {
    :root {
        --mf-border: #758478;
        --mf-border-strong: #59695c;
    }

    a {
        text-decoration-thickness: 2px;
        text-decoration-line: underline;
    }
}
