:root {
    --note-brand: #168665;
    --note-brand-strong: #0f6f57;
    --note-brand-soft: #e9f5ef;
    --note-canvas: #f7f5f0;
    --note-surface: #ffffff;
    --note-text: #1f2933;
    --note-muted: #697386;
    --note-line: #e8e4dc;
    --note-danger: #c2415d;
    --note-radius: 20px;
    --note-shadow: 0 18px 44px -34px rgba(31, 41, 51, .35);
    --mobile-nav-height: 76px;
    --mobile-nav-gap: 18px;
    --mobile-nav-clearance: calc(
        var(--mobile-nav-height) + var(--mobile-nav-gap) +
        env(safe-area-inset-bottom, 0px)
    );
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

body {
    background: var(--note-canvas);
    color: var(--note-text);
}

.app-content {
    width: 100%;
    min-width: 0;
    max-width: 1120px;
    padding-inline: clamp(12px, 2.5vw, 28px);
}

.app-content > * {
    min-width: 0;
    max-width: 100%;
}

.page-stack,
.recommend-page {
    gap: 20px;
}

.page-intro,
.toolbar-shell {
    border: 1px solid var(--note-line) !important;
    background: rgba(255, 255, 255, .94) !important;
    box-shadow: var(--note-shadow) !important;
}

.soft-panel,
.metric-tile,
.recommend-card,
.result-card {
    border-color: var(--note-line) !important;
    box-shadow: var(--note-shadow) !important;
}

.secondary-button {
    border-color: var(--note-brand) !important;
    background: var(--note-brand) !important;
    color: #fff !important;
}

.secondary-button:hover {
    background: var(--note-brand-strong) !important;
}

.note-page {
    display: grid;
    gap: 20px;
    padding: 24px 16px 112px;
}

.note-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.note-header__eyebrow {
    margin: 0 0 6px;
    color: var(--note-brand-strong);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
}

.note-header h1 {
    margin: 0;
    color: var(--note-text);
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 850;
    letter-spacing: -.035em;
}

.note-header p {
    margin: 8px 0 0;
    color: var(--note-muted);
    line-height: 1.65;
}

.note-panel {
    border: 1px solid var(--note-line);
    border-radius: var(--note-radius);
    background: var(--note-surface);
    box-shadow: var(--note-shadow);
}

.note-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--note-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, .82);
}

.note-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 14px;
    background: var(--note-brand);
    color: #fff;
    padding: 10px 16px;
    font-weight: 800;
    transition: background-color .16s ease, transform .16s ease;
}

.note-button:hover {
    background: var(--note-brand-strong);
    transform: translateY(-1px);
}

.note-button--quiet {
    border: 1px solid var(--note-line);
    background: var(--note-surface);
    color: var(--note-text);
}

.note-empty {
    padding: 56px 24px;
    border: 1px dashed #d8d2c8;
    border-radius: var(--note-radius);
    background: rgba(255, 255, 255, .66);
    color: var(--note-muted);
    text-align: center;
}

.note-skeleton {
    min-height: 96px;
    border-radius: var(--note-radius);
    background: linear-gradient(90deg, #eeeae3 25%, #f8f6f2 50%, #eeeae3 75%);
    background-size: 200% 100%;
    animation: note-shimmer 1.4s infinite;
}

.note-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    background: var(--note-brand-soft);
    color: var(--note-brand-strong);
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 800;
}

.note-more {
    position: relative;
}

.note-more summary {
    cursor: pointer;
    list-style: none;
}

.note-more summary::-webkit-details-marker {
    display: none;
}

.note-more__menu {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    z-index: 80;
    display: grid;
    min-width: 210px;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--note-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 24px 60px -28px rgba(15, 23, 42, .45);
}

.note-more__menu a {
    border-radius: 12px;
    color: var(--note-text);
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 700;
}

.note-more__menu a:hover {
    background: var(--note-brand-soft);
    color: var(--note-brand-strong);
}

@keyframes note-shimmer {
    to { background-position: -200% 0; }
}

@media (min-width: 768px) {
    .note-page {
        padding: 38px 24px 80px;
    }
}

@media (max-width: 767px) {
    .page-transition {
        animation: none !important;
        filter: none !important;
        transform: none !important;
    }

    .app-content {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        margin-inline: auto;
    }

    .mobile-safe-page {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        min-inline-size: 0;
        max-inline-size: 100%;
        margin-right: auto;
        margin-left: auto;
    }

    .mobile-safe-page,
    .mobile-safe-page *,
    .mobile-safe-page *::before,
    .mobile-safe-page *::after {
        box-sizing: border-box;
    }

    .mobile-safe-page > *,
    .mobile-safe-page .grid > *,
    .mobile-safe-page .flex > * {
        min-width: 0;
        min-inline-size: 0;
        max-width: 100%;
        max-inline-size: 100%;
    }

    .mobile-safe-page img,
    .mobile-safe-page video,
    .mobile-safe-page canvas {
        max-width: 100%;
    }

    .mobile-safe-page input,
    .mobile-safe-page select,
    .mobile-safe-page textarea {
        min-width: 0;
        max-width: 100%;
    }

    .mobile-safe-page .leaflet-container {
        width: 100% !important;
        min-width: 0;
        max-width: 100%;
    }

    .mobile-safe-page h1,
    .mobile-safe-page h2,
    .mobile-safe-page h3,
    .mobile-safe-page p,
    .mobile-safe-page a,
    .mobile-safe-page button {
        overflow-wrap: anywhere;
    }

    .mobile-safe-page > .sticky {
        position: relative;
        top: auto;
    }

    .mobile-safe-page .page-intro,
    .mobile-safe-page .section-card,
    .mobile-safe-page .toolbar-shell,
    .mobile-safe-page .note-panel {
        border-radius: 22px;
    }

    .mobile-safe-page .overflow-x-auto {
        max-width: 100%;
        overscroll-behavior-inline: contain;
    }

    .mobile-safe-page button,
    .mobile-safe-page [role="button"],
    .mobile-safe-page input,
    .mobile-safe-page select {
        min-height: 44px;
    }

    .recommend-controls label,
    .recommend-button {
        width: 100%;
        min-width: 0;
    }

    #reviewCards {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .app-content,
    .note-page,
    .page-stack {
        min-width: 0;
        max-width: 100%;
    }

    .note-page {
        gap: 14px;
        padding-inline: 0;
    }

    .note-header {
        align-items: stretch;
        flex-direction: column;
    }

    .note-header .note-button {
        width: 100%;
    }

    .home-page {
        gap: 18px !important;
    }

    .home-mobile-hero {
        margin-bottom: 20px !important;
        padding: 22px 18px !important;
    }

    .home-mobile-hero .note-header {
        gap: 18px;
        margin-bottom: 20px !important;
    }

    .home-mobile-hero h1 {
        font-size: clamp(1.72rem, 8vw, 2.1rem);
        line-height: 1.18;
        overflow-wrap: anywhere;
    }

    .home-mobile-hero p {
        font-size: .94rem;
        line-height: 1.55;
    }

    .home-mobile-hero [data-home-quick-register] {
        min-height: 50px;
        width: 100%;
        padding: 12px 16px;
    }

    .home-metrics {
        gap: 10px;
    }

    .home-metrics .metric-tile {
        min-width: 0;
        padding: 14px;
        border-radius: 18px;
    }

    .home-metrics .metric-tile > div {
        min-width: 0;
        gap: 10px;
    }

    .home-metrics .metric-tile > div > div:last-child {
        min-width: 0;
    }

    .home-metrics .metric-tile .text-2xl {
        font-size: 1.35rem;
        line-height: 1.2;
    }

    .home-metrics .metric-tile .tracking-widest {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        letter-spacing: .08em;
    }

    .home-recent-scroller {
        max-width: calc(100vw - 32px);
        overscroll-behavior-inline: contain;
        scrollbar-width: none;
    }

    .home-recent-scroller::-webkit-scrollbar {
        display: none;
    }

    .home-recent-scroller > * {
        width: min(82vw, 280px) !important;
        max-width: 100%;
    }
}
