/* ==========================================================================
   Nasze miejsce — design system
   Ruch: krótko (150–300 ms), ease-out, tylko transform/opacity.
   ========================================================================== */

:root {
    --bg: #fbf7f4;
    --bg-elev: #ffffff;
    --surface: #ffffff;
    --surface-2: #f5efea;
    --surface-3: #ede5df;
    --border: rgba(70, 35, 25, 0.09);
    --border-strong: rgba(70, 35, 25, 0.16);
    --text: #1f1816;
    --text-2: #6c605a;
    --text-3: #a3968f;
    --accent: #e5466b;
    --accent-hover: #d63a5e;
    --accent-soft: #fde9ee;
    --accent-text: #c22a50;
    --on-accent: #ffffff;
    --danger: #e5484d;
    --success: #30a46c;
    --overlay: rgba(28, 18, 16, 0.42);

    --tint-amber: #fff1df;  --tint-amber-fg: #c26a0a;
    --tint-green: #e6f6ec;  --tint-green-fg: #218358;
    --tint-yellow: #fff7d6; --tint-yellow-fg: #a87b00;
    --tint-rose: #fde9ee;   --tint-rose-fg: #c22a50;
    --tint-violet: #f1ecfd; --tint-violet-fg: #6e4fd1;
    --tint-blue: #e6f1fe;   --tint-blue-fg: #1f6fd1;

    --shadow-xs: 0 1px 2px rgba(60, 30, 20, 0.06);
    --shadow-sm: 0 1px 2px rgba(60, 30, 20, 0.05), 0 2px 6px rgba(60, 30, 20, 0.05);
    --shadow-md: 0 2px 4px rgba(60, 30, 20, 0.04), 0 8px 24px rgba(60, 30, 20, 0.08);
    --shadow-lg: 0 4px 8px rgba(40, 20, 15, 0.06), 0 24px 64px rgba(40, 20, 15, 0.18);

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;

    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
    --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
    --ease-spring: cubic-bezier(0.34, 1.36, 0.64, 1);

    --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;

    --container: 1080px;
    --gutter: 20px;
    --topbar-h: 60px;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #141011;
        --bg-elev: #1c1718;
        --surface: #1d1819;
        --surface-2: #262021;
        --surface-3: #312a2b;
        --border: rgba(255, 238, 232, 0.08);
        --border-strong: rgba(255, 238, 232, 0.15);
        --text: #f6efeb;
        --text-2: #b6a9a3;
        --text-3: #7f726c;
        --accent: #f0577a;
        --accent-hover: #f56f8e;
        --accent-soft: rgba(240, 87, 122, 0.14);
        --accent-text: #ff94ad;
        --overlay: rgba(0, 0, 0, 0.6);

        --tint-amber: rgba(255, 166, 43, 0.12);  --tint-amber-fg: #ffb55c;
        --tint-green: rgba(48, 164, 108, 0.14);  --tint-green-fg: #4cc38a;
        --tint-yellow: rgba(255, 214, 10, 0.11); --tint-yellow-fg: #f5d90a;
        --tint-rose: rgba(240, 87, 122, 0.14);   --tint-rose-fg: #ff94ad;
        --tint-violet: rgba(142, 115, 240, 0.15);--tint-violet-fg: #b5a1ff;
        --tint-blue: rgba(59, 142, 245, 0.14);   --tint-blue-fg: #70b8ff;

        --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
        --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.3), 0 24px 64px rgba(0, 0, 0, 0.55);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
        --bg: #141011;
        --bg-elev: #1c1718;
        --surface: #1d1819;
        --surface-2: #262021;
        --surface-3: #312a2b;
        --border: rgba(255, 238, 232, 0.08);
        --border-strong: rgba(255, 238, 232, 0.15);
        --text: #f6efeb;
        --text-2: #b6a9a3;
        --text-3: #7f726c;
        --accent: #f0577a;
        --accent-hover: #f56f8e;
        --accent-soft: rgba(240, 87, 122, 0.14);
        --accent-text: #ff94ad;
        --overlay: rgba(0, 0, 0, 0.6);

        --tint-amber: rgba(255, 166, 43, 0.12);  --tint-amber-fg: #ffb55c;
        --tint-green: rgba(48, 164, 108, 0.14);  --tint-green-fg: #4cc38a;
        --tint-yellow: rgba(255, 214, 10, 0.11); --tint-yellow-fg: #f5d90a;
        --tint-rose: rgba(240, 87, 122, 0.14);   --tint-rose-fg: #ff94ad;
        --tint-violet: rgba(142, 115, 240, 0.15);--tint-violet-fg: #b5a1ff;
        --tint-blue: rgba(59, 142, 245, 0.14);   --tint-blue-fg: #70b8ff;

        --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
        --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.3), 0 24px 64px rgba(0, 0, 0, 0.55);
        color-scheme: dark;
}


/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 64px); }
body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-tap-highlight-color: transparent;
    min-height: 100dvh;
    overflow-x: hidden;
}
img, video, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); color: var(--accent-text); }

.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
.serif em, em.serif { font-style: italic; }
.muted { color: var(--text-2); }
.center { text-align: center; }
.hint { font-size: 13px; color: var(--text-3); }
.link { color: var(--accent-text); font-weight: 500; cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
.stack > * + * { margin-top: 14px; }

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- Przyciski ---------- */
.btn {
    --h: 40px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: var(--h); padding: 0 16px;
    border-radius: 999px;
    font-weight: 550; font-size: 14.5px; letter-spacing: -0.005em;
    white-space: nowrap; user-select: none;
    transition: transform 160ms var(--ease-out), background-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { --h: 34px; padding: 0 14px; font-size: 13.5px; }
.btn-lg { --h: 48px; padding: 0 22px; font-size: 15.5px; }
.btn-block { width: 100%; }
.btn-primary {
    background: var(--accent); color: var(--on-accent);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(194, 42, 80, 0.3), 0 4px 12px rgba(229, 70, 107, 0.25);
}
.btn-secondary { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong) inset, var(--shadow-xs); }
.btn-ghost { color: var(--text-2); }
.btn-danger { background: var(--danger); color: #fff; }
@media (hover: hover) and (pointer: fine) {
    .btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
    .btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
    .btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
    .btn-danger:hover { filter: brightness(1.06); }
}
.btn.is-loading { pointer-events: none; }
.btn.is-loading > * { opacity: 0; }
.btn.is-loading { position: relative; }
.btn.is-loading::after {
    content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent; animation: spin 600ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 38px; height: 38px; border-radius: 999px;
    color: var(--text-2);
    transition: background-color 150ms ease, color 150ms ease, transform 150ms var(--ease-out);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn-sm { width: 30px; height: 30px; }
.icon-btn-sm .ic { width: 16px; height: 16px; }
.icon-btn-spacer { width: 38px; }
@media (hover: hover) and (pointer: fine) {
    .icon-btn:hover { background: var(--surface-2); color: var(--text); }
}

/* Tooltip — tylko na desktopie, bez opóźnienia przy kolejnych */
@media (hover: hover) and (pointer: fine) {
    [data-tooltip] { position: relative; }
    [data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute; left: 50%; top: calc(100% + 8px);
        transform: translate(-50%, -2px) scale(0.97); transform-origin: top center;
        padding: 5px 9px; border-radius: 8px;
        background: var(--text); color: var(--bg);
        font-size: 12px; font-weight: 500; white-space: nowrap;
        opacity: 0; pointer-events: none;
        transition: opacity 120ms ease, transform 120ms var(--ease-out);
        z-index: 50;
    }
    [data-tooltip]:hover::after { opacity: 1; transform: translate(-50%, 0) scale(1); transition-delay: 400ms; }
}

/* ---------- Pola ---------- */
input[type="text"], input[type="password"], input[type="date"], textarea {
    width: 100%; display: block;
    padding: 11px 14px;
    border-radius: 12px;
    background: var(--surface);
    border: 0;
    box-shadow: 0 0 0 1px var(--border-strong) inset, var(--shadow-xs);
    font-size: 16px; /* brak zoomu na iOS */
    line-height: 1.4;
    transition: box-shadow 150ms ease;
    outline: none;
    -webkit-appearance: none; appearance: none;
}
input[type="date"] { min-height: 46px; }
textarea { resize: vertical; min-height: 48px; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, textarea:focus { box-shadow: 0 0 0 1px var(--accent) inset, 0 0 0 4px var(--accent-soft); }
.field { display: block; }
.field-label { display: block; font-size: 13px; font-weight: 550; color: var(--text-2); margin-bottom: 7px; }

/* ---------- Avatary ---------- */
.avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.avatar-xs { width: 26px; height: 26px; }
.avatar-fallback { display: grid; place-items: center; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); }

/* ---------- Topbar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 40;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(1.6) blur(16px);
    -webkit-backdrop-filter: saturate(1.6) blur(16px);
    border-bottom: 1px solid transparent;
    transition: border-color 200ms ease;
    padding-top: env(safe-area-inset-top);
}
.topbar.is-scrolled { border-bottom-color: var(--border); }
.topbar-inner {
    max-width: var(--container); margin: 0 auto;
    height: var(--topbar-h); padding: 0 var(--gutter);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 22px; line-height: 1; }
.page-upload .brand { font-family: var(--font); font-size: 15px; font-weight: 600; }
.brand-heart {
    width: 18px; height: 18px; flex: none; display: inline-block;
    background: var(--accent);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7.5-4.6-9.6-9.3C.9 8.3 3 4.5 6.7 4.5c2.1 0 3.6 1.1 4.3 2.6h2c.7-1.5 2.2-2.6 4.3-2.6 3.7 0 5.8 3.8 4.3 7.2C19.5 16.4 12 21 12 21z'/%3E%3C/svg%3E") center/contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7.5-4.6-9.6-9.3C.9 8.3 3 4.5 6.7 4.5c2.1 0 3.6 1.1 4.3 2.6h2c.7-1.5 2.2-2.6 4.3-2.6 3.7 0 5.8 3.8 4.3 7.2C19.5 16.4 12 21 12 21z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.topbar-right { display: flex; align-items: center; gap: 6px; }
.presence {
    display: inline-flex; align-items: center; gap: 8px;
    height: 36px; padding: 0 12px 0 5px; border-radius: 999px;
    background: var(--surface); box-shadow: 0 0 0 1px var(--border) inset;
    font-size: 13px; position: relative;
}
.presence .avatar-xs { width: 26px; height: 26px; }
.presence-dot {
    position: absolute; left: 24px; bottom: 6px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--text-3); box-shadow: 0 0 0 2px var(--surface);
}
.presence[data-state="on"] .presence-dot { background: var(--success); }
.presence[data-state="on"] .presence-dot::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--success);
    animation: ping 2s var(--ease-out) infinite;
}
@keyframes ping { 0% { transform: scale(1); opacity: 0.7; } 80%, 100% { transform: scale(2.4); opacity: 0; } }
.presence-text { color: var(--text-2); white-space: nowrap; }
.presence-text strong { color: var(--text); font-weight: 600; }

/* ---------- Layout ---------- */
.home { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter) calc(48px + env(safe-area-inset-bottom)); }
.section-title { font-family: var(--serif); font-weight: 400; font-size: 30px; letter-spacing: -0.01em; line-height: 1.1; }

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
}

/* Wejście sekcji przy przewijaniu */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 40px 0 28px; display: flex; flex-direction: column; align-items: center; }
.couple { display: flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.couple-avatar { position: relative; border-radius: 50%; padding: 3px; background: var(--bg); box-shadow: var(--shadow-md); }
.couple-avatar .avatar { width: 68px; height: 68px; }
.couple-avatar:first-child { transform: rotate(-4deg); margin-right: -14px; z-index: 1; }
.couple-avatar:last-child { transform: rotate(4deg); margin-left: -14px; z-index: 1; }
.couple-heart {
    position: relative; z-index: 2;
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--surface); box-shadow: var(--shadow-md);
}
.couple-heart svg { width: 18px; height: 18px; fill: var(--accent); animation: beat 2.4s var(--ease-out) infinite; }
@keyframes beat {
    0%, 100% { transform: scale(1); }
    10% { transform: scale(1.18); }
    20% { transform: scale(1); }
    30% { transform: scale(1.12); }
    45% { transform: scale(1); }
}
.hero-hello { color: var(--text-2); font-size: 15px; margin-bottom: 2px; }
.counter {
    display: flex; flex-direction: column; align-items: center;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
    touch-action: manipulation; cursor: default;
    transition: transform 400ms var(--ease-out);
}
.counter.is-pressing { transform: scale(0.97); transition-duration: 3s; }
.counter-num {
    font-size: clamp(96px, 22vw, 152px); line-height: 0.95;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, var(--text) 30%, color-mix(in srgb, var(--accent) 70%, var(--text)) 130%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    padding: 0 6px;
}
.counter-label { font-family: var(--serif); font-style: italic; font-size: 26px; color: var(--accent-text); margin-top: -4px; }
.hero-sub { margin-top: 10px; color: var(--text-2); font-size: 14.5px; }

.next-milestone { width: min(320px, 100%); margin-top: 22px; }
.next-milestone-text { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.next-milestone-text strong { color: var(--text); font-weight: 600; }

.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress-thin { height: 4px; }
.progress > span {
    display: block; height: 100%; border-radius: inherit; background: var(--accent);
    width: var(--p, 0%);
    transition: width 700ms var(--ease-out);
}
.hero .progress > span { transform-origin: left; animation: grow 1200ms 300ms var(--ease-out) both; }
@keyframes grow { from { transform: scaleX(0); } }

.hero-actions { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; justify-content: center; }

/* ---------- Dziś ---------- */
.today { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 8px; }
@media (min-width: 760px) { .today { grid-template-columns: 1fr 240px; } }

.qa-card { padding: 20px 20px 18px; }
.card-eyebrow {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--tint-blue-fg);
}
.card-eyebrow .ic { width: 14px; height: 14px; }
.qa-question { font-size: 26px; line-height: 1.2; margin: 10px 0 16px; text-wrap: balance; }
.qa-body .qa-answers { display: none; }
.qa-body[data-state="answered"] .qa-form { display: none; }
.qa-body[data-state="answered"] .qa-answers { display: grid; gap: 8px; }
.qa-body[data-state="answered"].just-answered .qa-answer { animation: rise 420ms var(--ease-out) both; }
.qa-body[data-state="answered"].just-answered .qa-answer + .qa-answer { animation-delay: 80ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.qa-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.qa-answer { display: flex; gap: 10px; align-items: flex-start; }
.qa-answer p {
    padding: 9px 13px; border-radius: 4px 16px 16px 16px;
    background: var(--surface-2); font-size: 14.5px; line-height: 1.45; max-width: 100%;
}
.qa-mine p { background: var(--accent-soft); }
.qa-answer.is-waiting p { color: var(--text-3); font-style: italic; display: flex; align-items: center; gap: 8px; }
.typing { display: inline-flex; gap: 3px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-3px); opacity: 1; } }

.hug-card {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: 22px 16px; text-align: center;
    background: linear-gradient(160deg, var(--tint-violet) 0%, var(--tint-rose) 100%), var(--surface);
    transition: transform 200ms var(--ease-out), box-shadow 200ms ease;
}
.hug-card:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) { .hug-card:hover .hug-emoji { transform: rotate(-8deg) scale(1.08); } }
.hug-emoji { font-size: 44px; line-height: 1.1; transition: transform 300ms var(--ease-spring); }
.hug-title { font-weight: 600; font-size: 15px; margin-top: 6px; }
.hug-sub { font-size: 13px; color: var(--text-2); }
.hug-card.is-sent .hug-emoji { animation: squeeze 700ms var(--ease-out); }
@keyframes squeeze {
    0% { transform: scale(1); }
    25% { transform: scale(0.82, 1.1); }
    50% { transform: scale(1.15, 0.92); }
    75% { transform: scale(0.97, 1.03); }
    100% { transform: scale(1); }
}
.float-heart {
    position: absolute; pointer-events: none; font-size: 18px; color: var(--accent);
    animation: floatUp 1100ms var(--ease-out) forwards;
}
@keyframes floatUp {
    from { opacity: 0; transform: translate(0, 0) scale(0.6); }
    15% { opacity: 1; }
    to { opacity: 0; transform: translate(var(--dx), -110px) scale(1.1) rotate(var(--rot)); }
}

/* ---------- Narzędzia ---------- */
.tools { margin-top: 40px; }
.tools .section-title { margin-bottom: 14px; }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 760px) { .tool-grid { grid-template-columns: repeat(6, 1fr); } }
.tool {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 14px; border-radius: var(--radius);
    background: var(--surface); box-shadow: 0 0 0 1px var(--border), var(--shadow-xs);
    text-align: left;
    transition: transform 200ms var(--ease-out), box-shadow 200ms ease;
}
.tool:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
    .tool:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-md); }
    .tool:hover .tool-icon { transform: scale(1.06); }
}
.tool-icon {
    width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
    background: var(--tint); margin-bottom: 10px;
    transition: transform 250ms var(--ease-spring);
}
.tool[style*="amber"]  .tool-icon { color: var(--tint-amber-fg); }
.tool[style*="green"]  .tool-icon { color: var(--tint-green-fg); }
.tool[style*="yellow"] .tool-icon { color: var(--tint-yellow-fg); }
.tool[style*="rose"]   .tool-icon { color: var(--tint-rose-fg); }
.tool[style*="violet"] .tool-icon { color: var(--tint-violet-fg); }
.tool[style*="blue"]   .tool-icon { color: var(--tint-blue-fg); }
.tool-name { font-weight: 600; font-size: 14px; }
.tool-meta { font-size: 12px; color: var(--text-3); }

/* ---------- Wspomnienia ---------- */
.memories { margin-top: 48px; }
.memories-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

.chips {
    position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top)); z-index: 30;
    margin: 0 calc(var(--gutter) * -1);
    padding: 8px var(--gutter);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(1.6) blur(16px);
    -webkit-backdrop-filter: saturate(1.6) blur(16px);
    overflow-x: auto; scrollbar-width: none;
    mask-image: linear-gradient(90deg, transparent 0, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent 100%);
}
.chips::-webkit-scrollbar { display: none; }
.chips-track { position: relative; display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface-2); }
.chip {
    position: relative; z-index: 1;
    display: inline-flex; align-items: center; gap: 5px;
    height: 32px; padding: 0 13px; border-radius: 999px;
    font-size: 13.5px; font-weight: 550; color: var(--text-2); white-space: nowrap;
    transition: color 200ms ease;
}
.chip .ic { width: 13px; height: 13px; color: var(--accent); }
.chip-year { color: var(--text-3); font-weight: 450; }
.chip.is-active { color: var(--text); }
.chips-indicator {
    position: absolute; z-index: 0; top: 3px; left: 0; height: 32px; width: 0;
    border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm);
    transition: transform 350ms var(--ease-out), width 350ms var(--ease-out);
}

.month { border-bottom: 1px solid var(--border); }
.month-head {
    width: 100%; display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "title stack chev" "meta stack chev";
    align-items: center; column-gap: 14px;
    padding: 22px 0 20px; text-align: left;
}
.month-title { grid-area: title; font-size: 34px; line-height: 1.05; }
.month-year { font-family: var(--serif); color: var(--text-3); }
.month-meta { grid-area: meta; font-size: 13px; color: var(--text-2); margin-top: 4px; }
.month-chevron {
    grid-area: chev; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface-2); color: var(--text-2);
    transition: transform 300ms var(--ease-out), background-color 150ms ease;
}
.month.is-open .month-chevron { transform: rotate(180deg); }
@media (hover: hover) and (pointer: fine) { .month-head:hover .month-chevron { background: var(--surface-3); color: var(--text); } }
.month-stack { grid-area: stack; display: flex; padding-right: 6px; }
.month-stack img {
    width: 40px; height: 40px; border-radius: 10px; object-fit: cover;
    box-shadow: 0 0 0 2px var(--bg), var(--shadow-sm);
    margin-left: -14px;
    transform: rotate(calc((var(--i) - 1) * 7deg));
    transition: transform 300ms var(--ease-out), opacity 200ms ease;
}
.month.is-open .month-stack img { opacity: 0; transform: rotate(0) scale(0.9); }
@media (hover: hover) and (pointer: fine) {
    .month:not(.is-open) .month-head:hover .month-stack img { transform: rotate(calc((var(--i) - 1) * 12deg)) translateY(-2px); }
}

/* Płynne zwijanie (grid 0fr → 1fr) */
.collapse { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 420ms var(--ease-out); }
.collapse > div { overflow: hidden; min-height: 0; }
.month.is-open > .collapse, .collapse.is-open { grid-template-rows: 1fr; }
.month > .collapse > div { opacity: 0; transition: opacity 250ms ease; }
.month.is-open > .collapse > div { opacity: 1; transition-delay: 60ms; }

.day { padding-bottom: 26px; }
.day-label { display: flex; align-items: baseline; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.day-label .muted { font-weight: 400; font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 6px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(5, 1fr); } }
.grid-favs { padding-bottom: 26px; }

.tile {
    position: relative; aspect-ratio: 1; overflow: hidden;
    border-radius: 6px; background: var(--surface-2);
    isolation: isolate;
    transition: transform 200ms var(--ease-out);
}
@media (min-width: 600px) { .tile { border-radius: 10px; } }
.tile:active { transform: scale(0.97); }
.tile img, .tile video {
    width: 100%; height: 100%; object-fit: cover;
    opacity: 0; transform: scale(1.04);
    transition: opacity 400ms ease, transform 600ms var(--ease-out);
}
.tile.is-loaded img, .tile.is-loaded video { opacity: 1; transform: scale(1); }
@media (hover: hover) and (pointer: fine) {
    .tile::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,0.0); transition: background-color 200ms ease; }
    .tile:hover::after { background: rgba(0,0,0,0.08); }
    .tile.is-loaded:hover img { transform: scale(1.03); }
}
.tile-badge, .tile-fav, .tile-comments {
    position: absolute; z-index: 2; display: inline-flex; align-items: center; gap: 3px;
    color: #fff; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.45));
}
.tile-badge { top: 7px; right: 7px; }
.tile-badge .ic { width: 15px; height: 15px; }
.tile-fav { left: 7px; bottom: 7px; }
.tile-fav .ic { width: 15px; height: 15px; color: #fff; }
.tile-comments { right: 7px; bottom: 6px; font-size: 12px; font-weight: 600; }
.tile-comments .ic { width: 13px; height: 13px; }
.tile.is-removing { animation: tileOut 260ms var(--ease-out) forwards; }
@keyframes tileOut { to { opacity: 0; transform: scale(0.85); } }

/* Notatki */
.note {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: 0 0 0 1px var(--border), var(--shadow-xs);
    padding: 14px 16px; margin-bottom: 10px;
}
.note-head { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.note-head .note-delete { margin-left: auto; opacity: 0.5; }
@media (hover: hover) and (pointer: fine) { .note-head .note-delete { opacity: 0; } .note:hover .note-delete { opacity: 1; } }
.note-text { margin-top: 10px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.note.is-removing { animation: noteOut 280ms var(--ease-out) forwards; }
@keyframes noteOut { to { opacity: 0; transform: translateX(-12px); } }

/* Głosówka */
.voice { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 8px 14px 8px 8px; border-radius: 999px; background: var(--accent-soft); }
.voice-play {
    width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center;
    background: var(--accent); color: #fff;
    transition: transform 150ms var(--ease-out);
}
.voice-play:active { transform: scale(0.92); }
.voice-play .ic { width: 15px; height: 15px; }
.voice .ic-pause, .voice.is-playing .ic-play { display: none; }
.voice.is-playing .ic-pause { display: block; }
.voice-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; cursor: pointer; }
.voice-wave i { flex: 1; height: var(--h); min-width: 2px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 35%, transparent); transition: background-color 120ms ease; }
.voice-wave i.is-played { background: var(--accent); }
.voice-time { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--accent-text); min-width: 32px; text-align: right; }

.empty { padding: 40px 20px; text-align: center; margin-top: 20px; }
.empty .serif { font-size: 24px; margin-bottom: 16px; }

.footer { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 48px 0 16px; color: var(--text-3); font-size: 13px; }
.footer .brand-heart { width: 13px; height: 13px; }

/* ==========================================================================
   Modale — desktop: okno, mobile: arkusz od dołu (z przeciąganiem)
   ========================================================================== */
.modal {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: flex-end; justify-content: center;
}
.modal-backdrop {
    position: absolute; inset: 0; background: var(--overlay);
    opacity: 0; transition: opacity 300ms ease;
}
.modal-panel {
    position: relative; width: 100%;
    max-height: calc(100dvh - 40px - env(safe-area-inset-top));
    display: flex; flex-direction: column;
    background: var(--bg-elev);
    border-radius: 22px 22px 0 0;
    box-shadow: var(--shadow-lg);
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(100%);
    transition: transform 420ms var(--ease-drawer);
    will-change: transform;
    overflow: hidden;
}
.modal.is-open .modal-backdrop { opacity: 1; }
.modal.is-open .modal-panel { transform: translateY(var(--drag, 0px)); }
.modal.is-dragging .modal-panel { transition: none; }
.modal.is-closing .modal-panel { transition-duration: 260ms; }
.modal.is-closing .modal-backdrop { transition-duration: 220ms; }

.sheet-handle { width: 36px; height: 5px; border-radius: 9px; background: var(--border-strong); margin: 8px auto 0; flex: none; }
.modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px 4px 20px; flex: none;
    touch-action: none;
}
.modal-head h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.15; }
.modal-body { padding: 12px 20px 22px; overflow-y: auto; overscroll-behavior: contain; }

@media (min-width: 640px) {
    .modal { align-items: center; padding: 24px; }
    .modal-panel {
        max-width: 460px; border-radius: 22px; padding-bottom: 0;
        transform: translateY(8px) scale(0.96); opacity: 0;
        transition: transform 260ms var(--ease-out), opacity 200ms ease;
    }
    .modal.is-open .modal-panel { transform: none; opacity: 1; }
    .modal.is-closing .modal-panel { transform: scale(0.97); opacity: 0; transition-duration: 160ms; }
    .modal-wide .modal-panel { max-width: 1000px; height: min(760px, calc(100dvh - 48px)); }
    .sheet-handle { display: none; }
    .modal-head { padding-top: 16px; }
}

/* Okna centralne (potwierdzenie, przytulas, data) — na telefonie też jako okno */
.modal-center { align-items: center; padding: 20px; }
.modal-center .modal-panel {
    max-width: 380px; border-radius: 22px; padding-bottom: 0;
    transform: translateY(8px) scale(0.95); opacity: 0;
    transition: transform 280ms var(--ease-out), opacity 200ms ease;
}
.modal-center.is-open .modal-panel { transform: none; opacity: 1; }
.modal-center.is-closing .modal-panel { transform: scale(0.97); opacity: 0; transition-duration: 150ms; }

.confirm { padding: 22px; }
.confirm h2 { font-size: 18px; font-weight: 600; }
.confirm p { margin-top: 6px; font-size: 14.5px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }

.celebrate { padding: 28px 22px 22px; text-align: center; }
.celebrate h2 { font-size: 32px; line-height: 1.1; margin-bottom: 8px; }
.celebrate p { margin-bottom: 20px; }
.celebrate-emoji { font-size: 64px; line-height: 1; margin-bottom: 10px; }
.modal.is-open .celebrate-emoji { animation: hugIn 900ms var(--ease-spring) both 120ms; }
@keyframes hugIn { 0% { transform: scale(0.4) rotate(-20deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
.celebrate-title { font-size: 40px !important; color: var(--accent-text); }
.ann-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 20px; max-height: 42vh; overflow-y: auto; }
.ann-grid figure { position: relative; margin: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; }
.modal.is-open .ann-grid figure { animation: rise 420ms var(--ease-out) both; animation-delay: calc(150ms + var(--i) * 50ms); }
.ann-grid img { width: 100%; height: 100%; object-fit: cover; }
.ann-grid figcaption { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(0,0,0,0.4); padding: 2px 7px; border-radius: 99px; backdrop-filter: blur(4px); }

.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.inline-form .btn { --h: 46px; }

/* Mapa */
.map-wrap { position: relative; flex: 1; min-height: 60dvh; margin: 8px 12px 12px; border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 1px var(--border); }
#map { position: absolute; inset: 0; background: var(--surface-2); }
.map-empty { position: absolute; inset: auto 16px 16px; z-index: 500; padding: 12px 14px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-md); font-size: 13.5px; }
.map-pin { width: 46px !important; height: 46px !important; border-radius: 12px; overflow: hidden; border: 2px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.3); background: var(--surface-2); transition: transform 200ms var(--ease-out); }
.map-pin:hover { transform: scale(1.08); z-index: 1000 !important; }
.map-pin img { width: 100%; height: 100%; object-fit: cover; }
.map-person { width: 48px !important; height: 48px !important; }
.map-person img { position: relative; width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 3px solid var(--success); background: var(--surface); }
.map-person::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--success); animation: ping 2s var(--ease-out) infinite; }
.leaflet-popup-content-wrapper { border-radius: 14px !important; box-shadow: var(--shadow-lg) !important; }
.leaflet-popup-content { margin: 10px !important; font-family: var(--font); }
.map-popup img { width: 180px; height: 180px; object-fit: cover; border-radius: 9px; margin-bottom: 8px; cursor: pointer; }
.map-popup strong { display: block; font-size: 13px; }
.map-popup span { font-size: 12px; color: #6c605a; }
.map-popup p { margin: 6px 0 0 !important; font-size: 13px; }

/* Radar */
.radar-visual { position: relative; width: 120px; height: 120px; margin: 4px auto 0; display: grid; place-items: center; }
.radar-visual span { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--tint-green-fg); opacity: 0; animation: radar 2.4s var(--ease-out) infinite; }
.radar-visual span:nth-child(2) { animation-delay: 0.8s; }
.radar-visual span:nth-child(3) { animation-delay: 1.6s; }
@keyframes radar { from { transform: scale(0.45); opacity: 0.8; } to { transform: scale(1); opacity: 0; } }
.radar-visual .avatar { width: 54px; height: 54px; position: relative; box-shadow: 0 0 0 3px var(--bg-elev), 0 0 0 5px var(--tint-green-fg); }

/* Słoik */
.jar-note { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 450ms var(--ease-out); }
.jar-note > .jar-note-paper { overflow: hidden; min-height: 0; }
.jar-note[data-state="open"] { grid-template-rows: 1fr; }
.jar-note-paper p {
    margin: 4px 2px 6px; padding: 22px 20px;
    font-family: var(--serif); font-size: 22px; line-height: 1.35; text-align: center;
    background:
        repeating-linear-gradient(180deg, transparent 0 31px, color-mix(in srgb, var(--tint-yellow-fg) 18%, transparent) 31px 32px),
        var(--tint-yellow);
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
    transform: rotate(-1.2deg);
}
.jar-note[data-state="open"] .jar-note-paper p { animation: unfold 520ms var(--ease-out) both; }
@keyframes unfold { from { transform: rotate(-6deg) scale(0.9) translateY(10px); opacity: 0; } to { transform: rotate(-1.2deg); opacity: 1; } }

/* Ruletka */
.reel { padding: 6px 0; }
.reel-window {
    position: relative; height: 72px; overflow: hidden; border-radius: 16px;
    background: var(--surface-2);
    box-shadow: 0 0 0 1px var(--border) inset;
    mask-image: linear-gradient(180deg, transparent, #000 28%, #000 72%, transparent);
}
.reel-window::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.reel-strip { will-change: transform; }
.reel-item {
    height: 72px; display: flex; align-items: center; justify-content: center; padding: 0 16px;
    font-family: var(--serif); font-size: 26px; text-align: center; line-height: 1.1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reel-item.is-placeholder { font-family: var(--font); font-size: 14px; color: var(--text-3); }
.reel.is-landed .reel-window { box-shadow: 0 0 0 2px var(--accent) inset; transition: box-shadow 200ms ease; }
.roulette-actions > * + * { margin-top: 8px; }
.roulette-list { border-radius: 14px; background: var(--surface-2); }
.roulette-list summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px;
    padding: 12px 14px; font-weight: 550; font-size: 14px;
}
.roulette-list summary::-webkit-details-marker { display: none; }
.roulette-list summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg) translateY(-2px); transition: transform 200ms var(--ease-out); }
.roulette-list[open] summary::after { transform: rotate(225deg) translateY(-2px); }
.roulette-list ul { list-style: none; padding: 0 6px 6px; max-height: 220px; overflow-y: auto; }
.roulette-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border-radius: 10px; font-size: 14px; }
.roulette-list li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roulette-list li:nth-child(odd) { background: var(--surface); }

/* Marzenia */
.bucket-progress { display: grid; gap: 8px; font-size: 13px; color: var(--text-2); }
.bucket-list { list-style: none; padding: 0; display: grid; gap: 6px; }
.bucket-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 8px 10px 12px; border-radius: 14px; background: var(--surface-2);
    transition: opacity 250ms ease, background-color 200ms ease;
}
.bucket-item.is-new { animation: rise 360ms var(--ease-out) both; }
.bucket-item.is-removing { animation: noteOut 260ms var(--ease-out) forwards; }
.bucket-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bucket-text span { font-weight: 550; font-size: 14.5px; position: relative; width: fit-content; max-width: 100%; }
.bucket-text span::after {
    content: ""; position: absolute; left: 0; right: 0; top: 52%; height: 1.5px; background: currentColor;
    transform: scaleX(0); transform-origin: left; transition: transform 350ms var(--ease-out);
}
.bucket-text small { font-size: 12px; color: var(--text-3); }
.bucket-item.is-done { opacity: 0.6; }
.bucket-item.is-done .bucket-text span::after { transform: scaleX(1); }
.check {
    width: 24px; height: 24px; flex: none; border-radius: 8px;
    box-shadow: 0 0 0 1.5px var(--border-strong) inset; background: var(--surface);
    display: grid; place-items: center;
    transition: background-color 200ms ease, box-shadow 200ms ease, transform 150ms var(--ease-out);
}
.check:active { transform: scale(0.88); }
.check svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset 300ms var(--ease-out) 60ms; }
.check[aria-checked="true"] { background: var(--success); box-shadow: none; }
.check[aria-checked="true"] svg { stroke-dashoffset: 0; }

/* Nagrywanie */
.recorder {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px 10px 10px; border-radius: 16px;
    background: var(--surface); box-shadow: 0 0 0 1px var(--border-strong) inset;
}
.rec-btn {
    position: relative; width: 44px; height: 44px; flex: none; border-radius: 50%;
    display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text);
    transition: transform 150ms var(--ease-out), background-color 200ms ease;
}
.rec-btn:active { transform: scale(0.92); }
.rec-stop { display: none; width: 14px; height: 14px; border-radius: 3px; background: #fff; }
.recorder[data-state="recording"] .rec-btn { background: var(--danger); color: #fff; }
.recorder[data-state="recording"] .rec-btn::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--danger); animation: ping 1.4s var(--ease-out) infinite; z-index: -1; }
.recorder[data-state="recording"] .ic-mic { display: none; }
.recorder[data-state="recording"] .rec-stop { display: block; }
.recorder[data-state="done"] .rec-btn { background: var(--tint-green); color: var(--tint-green-fg); }
.rec-info { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; line-height: 1.35; }
.rec-info .muted { font-size: 13px; }
.rec-time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-2); }
#rec-preview { width: 100%; margin-top: 10px; height: 40px; }

/* Sejf */
.letter { animation: rise 600ms var(--ease-out) both; }
.letter h3 { font-size: 32px; line-height: 1.1; text-align: center; margin-bottom: 18px; color: var(--accent-text); }
.letter p { font-size: 15.5px; line-height: 1.7; margin-bottom: 14px; }
.letter-sign { text-align: right; font-size: 22px; line-height: 1.3; color: var(--accent-text); margin-top: 8px; }
.safe-form.is-wrong { animation: shake 400ms var(--ease-out); }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }

/* ==========================================================================
   Lightbox / podgląd
   ========================================================================== */
.viewer { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-columns: 1fr; grid-template-rows: auto 1fr; color: #fff; }
.viewer-backdrop { position: absolute; inset: 0; background: #0b0909; opacity: 0; transition: opacity 280ms ease; }
.viewer.is-open .viewer-backdrop { opacity: var(--bg-o, 1); }
.viewer.is-dragging .viewer-backdrop { transition: none; }
.viewer-top {
    position: relative; z-index: 3;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: calc(10px + env(safe-area-inset-top)) 10px 10px 18px;
    opacity: 0; transition: opacity 220ms ease;
}
.viewer.is-open .viewer-top, .viewer.is-open .viewer-toggle, .viewer.is-open .v-nav { opacity: 1; }
.viewer-count { font-size: 13px; color: rgba(255,255,255,0.65); font-variant-numeric: tabular-nums; }
.viewer-actions { display: flex; gap: 2px; }
.v-btn {
    width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
    color: rgba(255,255,255,0.85);
    transition: background-color 150ms ease, transform 150ms var(--ease-out), color 150ms ease;
}
.v-btn:active { transform: scale(0.9); }
@media (hover: hover) and (pointer: fine) { .v-btn:hover { background: rgba(255,255,255,0.12); color: #fff; } }
.v-btn[data-act="fav"].is-on { color: var(--accent); }
.v-btn[data-act="fav"].is-on svg { fill: currentColor; }
.v-btn[data-act="fav"].pop svg { animation: pop 400ms var(--ease-spring); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.v-btn.is-busy svg { animation: spin 700ms linear infinite; }
.viewer .v-btn[data-tooltip]::after { top: calc(100% + 4px); background: #fff; color: #111; }

.viewer-stage { position: relative; z-index: 2; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: none; overflow: hidden; }
.viewer-media { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 0 0 72px; }
.viewer-media img, .viewer-media video {
    max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none;
    border-radius: 2px;
    transition: transform 360ms var(--ease-out), opacity 220ms ease;
}
.viewer.is-dragging .viewer-media img, .viewer.is-dragging .viewer-media video { transition: none; }
.viewer-media .is-entering { opacity: 0; }
.v-nav {
    position: absolute; top: 50%; z-index: 3; width: 44px; height: 44px; margin-top: -58px; border-radius: 50%;
    display: none; place-items: center; background: rgba(255,255,255,0.1); color: #fff;
    backdrop-filter: blur(8px); opacity: 0;
    transition: opacity 200ms ease, background-color 150ms ease, transform 150ms var(--ease-out);
}
.v-nav:active { transform: scale(0.92); }
.v-prev { left: 16px; } .v-next { right: 16px; }
.v-nav:disabled { opacity: 0 !important; pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
    .v-nav { display: grid; }
    .v-nav:hover { background: rgba(255,255,255,0.2); }
}

/* Panel z opisem i komentarzami — mobile: arkusz */
.viewer-panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
    max-height: 72dvh; display: flex; flex-direction: column;
    background: var(--bg-elev); color: var(--text);
    border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(105%);
    transition: transform 420ms var(--ease-drawer);
}
.viewer.show-panel .viewer-panel { transform: translateY(var(--drag, 0px)); }
.viewer-panel.is-dragging { transition: none; }
.viewer-info { padding: 10px 18px 12px; border-bottom: 1px solid var(--border); }
.viewer-date { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.viewer-desc { margin-top: 2px; font-size: 15px; cursor: text; border-radius: 8px; padding: 2px 4px; margin-left: -4px; }
.viewer-desc:empty::before { content: "Dodaj opis…"; color: var(--text-3); }
.viewer-desc[contenteditable="true"] { background: var(--surface-2); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.comments { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; overscroll-behavior: contain; }
.comments-empty { margin: auto; color: var(--text-3); font-size: 14px; text-align: center; padding: 14px; }
.bubble { max-width: 82%; display: flex; flex-direction: column; gap: 2px; }
.bubble-meta { font-size: 11.5px; color: var(--text-3); padding: 0 6px; display: flex; gap: 6px; align-items: center; }
.bubble-text { padding: 8px 13px; border-radius: 18px; background: var(--surface-2); font-size: 14.5px; line-height: 1.4; word-wrap: break-word; }
.bubble.is-me { align-self: flex-end; align-items: flex-end; }
.bubble.is-me .bubble-text { background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.bubble:not(.is-me) .bubble-text { border-bottom-left-radius: 6px; }
.bubble.is-new { animation: bubbleIn 320ms var(--ease-out) both; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px) scale(0.96); } }
.bubble-del { color: var(--text-3); font-size: 11.5px; }
.bubble-del:hover { color: var(--danger); }
.comment-form { display: flex; gap: 6px; padding: 10px 10px 12px 14px; border-top: 1px solid var(--border); }
.comment-form input { flex: 1; border-radius: 999px; padding: 10px 16px; }
.comment-form .icon-btn { width: 44px; height: 44px; background: var(--accent); color: #fff; }

.viewer-toggle {
    position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 3;
    transform: translateX(-50%);
    display: inline-flex; align-items: center; gap: 7px;
    height: 42px; padding: 0 18px; border-radius: 999px;
    background: rgba(255,255,255,0.14); color: #fff; backdrop-filter: blur(12px);
    font-size: 14px; font-weight: 550;
    opacity: 0; transition: opacity 200ms ease, transform 150ms var(--ease-out), background-color 150ms ease;
    max-width: calc(100% - 40px);
}
.viewer-toggle:active { transform: translateX(-50%) scale(0.96); }
.viewer-toggle .ic { width: 16px; height: 16px; }
#viewer-toggle-count:empty { display: none; }

@media (min-width: 900px) {
    .viewer { grid-template-columns: 1fr 360px; }
    .viewer-top { grid-column: 1; }
    .viewer-stage { grid-column: 1; grid-row: 2; }
    .viewer-media { padding: 0 72px 24px; }
    .viewer-panel {
        position: relative; grid-column: 2; grid-row: 1 / span 2; max-height: none;
        border-radius: 0; transform: translateX(100%); opacity: 1;
        transition: transform 360ms var(--ease-out);
    }
    .viewer.is-open .viewer-panel { transform: none; }
    .viewer-panel .sheet-handle { display: none; }
    .viewer-info { padding-top: 22px; }
    .viewer-toggle { display: none; }
}

/* Klon miniatury do animacji otwierania */
.zoom-clone { position: fixed; z-index: 95; object-fit: cover; pointer-events: none; border-radius: 10px; transition: transform 380ms var(--ease-out), border-radius 380ms var(--ease-out); transform-origin: 0 0; will-change: transform; }

/* ==========================================================================
   Toasty (w stylu Sonner)
   ========================================================================== */
.toaster {
    position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 200;
    width: min(380px, calc(100% - 32px)); transform: translateX(-50%);
    pointer-events: none;
}
.toast {
    position: absolute; left: 0; right: 0; bottom: 0;
    display: flex; align-items: center; gap: 10px;
    padding: 13px 16px; border-radius: 14px;
    background: var(--text); color: var(--bg);
    box-shadow: var(--shadow-lg);
    font-size: 14px; font-weight: 500;
    pointer-events: auto;
    transform: translateY(calc(var(--y, 0px) * -1)) scale(var(--s, 1));
    opacity: var(--o, 1);
    transition: transform 400ms var(--ease-out), opacity 300ms ease;
}
.toast.is-entering { transform: translateY(100%); opacity: 0; }
.toast.is-leaving { transform: translateY(calc(var(--y, 0px) * -1 + 20px)) scale(0.96); opacity: 0; transition-duration: 220ms; }
.toast .ic { width: 18px; height: 18px; }
.toast[data-type="success"] .ic { color: var(--success); }
.toast[data-type="error"] .ic { color: #ff6b70; }
.toaster[data-count] .toast { }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #2a2324; color: var(--text); box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-lg); } }
:root[data-theme="dark"] .toast { background: #2a2324; color: var(--text); box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-lg); }

/* ==========================================================================
   Logowanie
   ========================================================================== */
.page-login { display: grid; place-items: center; padding: 24px; overflow: hidden; }
.login-glow {
    position: fixed; inset: -20%; z-index: -1; pointer-events: none;
    background:
        radial-gradient(40% 35% at 30% 30%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
        radial-gradient(35% 30% at 72% 68%, color-mix(in srgb, var(--tint-violet-fg) 14%, transparent), transparent 70%);
    animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate(3%, -2%) rotate(6deg); } }
.login { width: min(380px, 100%); text-align: center; animation: rise 700ms var(--ease-out) both; }
.login-heart {
    width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 20px;
    display: grid; place-items: center;
    background: var(--surface); box-shadow: 0 0 0 1px var(--border), var(--shadow-md);
}
.login-heart svg { width: 28px; height: 28px; fill: var(--accent); animation: beat 2.4s var(--ease-out) infinite; }
.login h1 { font-size: 46px; line-height: 1; }
.login > .muted { margin-top: 8px; }
.login-form { margin-top: 28px; text-align: left; display: grid; gap: 14px; }
.login-form .btn { margin-top: 6px; }
.login-form.has-error { animation: shake 420ms var(--ease-out); }
.form-error { color: var(--danger); font-size: 13.5px; font-weight: 500; }

/* ==========================================================================
   Upload
   ========================================================================== */
.upload-page { max-width: 720px; margin: 0 auto; padding: 8px var(--gutter) calc(130px + env(safe-area-inset-bottom)); }
.dropzone {
    position: relative; border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
    transition: box-shadow 200ms ease, transform 200ms var(--ease-out);
}
.dropzone::before {
    content: ""; position: absolute; inset: 8px; border-radius: 18px; pointer-events: none;
    border: 1.5px dashed var(--border-strong); transition: border-color 200ms ease, inset 200ms var(--ease-out);
}
.dropzone[data-state="files"]::before { display: none; }
.dropzone.is-over { box-shadow: 0 0 0 2px var(--accent), var(--shadow-md); transform: scale(1.01); }
.dropzone.is-over::before { border-color: var(--accent); inset: 12px; }
.dropzone-empty { padding: 48px 24px 40px; text-align: center; }
.dropzone[data-state="files"] .dropzone-empty { display: none; }
.dropzone[data-state="empty"] .dropzone-files { display: none; }
.dropzone-empty h1 { font-size: 34px; line-height: 1.1; margin-top: 22px; text-wrap: balance; }
.dropzone-empty p { margin-top: 8px; }
.dz-actions { display: flex; gap: 10px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.dz-stack { position: relative; width: 92px; height: 80px; margin: 0 auto; }
.dz-card { position: absolute; inset: 6px 14px; border-radius: 14px; background: var(--surface-2); box-shadow: 0 0 0 1px var(--border), var(--shadow-sm); transition: transform 400ms var(--ease-spring); }
.dz-card-1 { transform: rotate(-12deg) translateX(-10px); background: var(--tint-amber); }
.dz-card-2 { transform: rotate(10deg) translateX(10px); background: var(--tint-violet); }
.dz-card-3 { display: grid; place-items: center; background: var(--accent); color: #fff; }
.dz-card-3 .ic { width: 26px; height: 26px; stroke-width: 2.4; }
@media (hover: hover) and (pointer: fine) {
    .dropzone:hover .dz-card-1 { transform: rotate(-18deg) translateX(-18px) translateY(-2px); }
    .dropzone:hover .dz-card-2 { transform: rotate(16deg) translateX(18px) translateY(-2px); }
}
.dropzone.is-over .dz-card-1 { transform: rotate(-20deg) translateX(-22px); }
.dropzone.is-over .dz-card-2 { transform: rotate(18deg) translateX(22px); }
@media (pointer: coarse) { .hide-touch { display: none; } }

.dropzone-files { padding: 14px; }
.files-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 2px 12px; }
.files-head .muted { font-size: 13px; margin-left: 6px; }
.file-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (min-width: 560px) { .file-grid { grid-template-columns: repeat(4, 1fr); } }
.file {
    position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2);
    animation: fileIn 380ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 25ms);
}
@keyframes fileIn { from { opacity: 0; transform: scale(0.9); } }
.file img, .file video { width: 100%; height: 100%; object-fit: cover; }
.file.is-removing { animation: tileOut 220ms var(--ease-out) forwards; }
.file-remove {
    position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; background: rgba(0,0,0,0.5); color: #fff; backdrop-filter: blur(6px);
    transition: transform 150ms var(--ease-out), opacity 150ms ease;
}
.file-remove .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.file-remove:active { transform: scale(0.88); }
.file-kind { position: absolute; left: 6px; bottom: 6px; color: #fff; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)); }
.file-kind .ic { width: 15px; height: 15px; }
.file-overlay {
    position: absolute; inset: 0; display: grid; place-items: center;
    background: rgba(0,0,0,0.38); opacity: 0; transition: opacity 250ms ease;
}
.file[data-status] .file-overlay { opacity: 1; }
.file[data-status] .file-remove { opacity: 0; pointer-events: none; }
.file[data-status="done"] .file-overlay { background: rgba(0,0,0,0.18); }
.ring { width: 40px; height: 40px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.5; }
.ring .ring-bg { stroke: rgba(255,255,255,0.3); }
.ring .ring-fg { stroke: #fff; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p, 0)); transition: stroke-dashoffset 200ms linear; }
.file-check, .file-err { display: none; width: 36px; height: 36px; border-radius: 50%; place-items: center; color: #fff; }
.file[data-status="done"] .ring, .file[data-status="error"] .ring { display: none; }
.file[data-status="done"] .file-check { display: grid; background: var(--success); animation: pop 420ms var(--ease-spring); }
.file[data-status="error"] .file-err { display: grid; background: var(--danger); }
.file-check svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw 360ms var(--ease-out) 120ms forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.file-err .ic { width: 18px; height: 18px; stroke-width: 2.6; }

.upload-options { margin-top: 12px; padding: 18px; display: grid; gap: 18px; }
.upload-options .hint { margin-top: 8px; }
.segmented {
    position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 12px; background: var(--surface-2);
}
.segmented button { position: relative; z-index: 1; height: 36px; border-radius: 9px; font-size: 14px; font-weight: 550; color: var(--text-2); transition: color 200ms ease; }
.segmented button[aria-checked="true"] { color: var(--text); }
.segmented-pill {
    position: absolute; top: 3px; left: 3px; width: calc(50% - 3px); height: 36px; border-radius: 9px;
    background: var(--surface); box-shadow: var(--shadow-sm);
    transition: transform 300ms var(--ease-out);
}
.segmented[data-value="custom"] .segmented-pill { transform: translateX(100%); }
#custom-date-wrap > div > input { margin-top: 10px; }
.gps-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; padding: 8px 12px; border-radius: 99px; background: var(--surface-2); width: fit-content; }
.gps-pill[data-state="ok"] { background: var(--tint-green); color: var(--tint-green-fg); }
.gps-pill[data-state="err"] { background: var(--tint-rose); color: var(--tint-rose-fg); }

.upload-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent, var(--bg) 35%);
}
.upload-bar-inner { max-width: 720px; margin: 0 auto; }
.upload-progress { margin-bottom: 12px; animation: rise 300ms var(--ease-out); }
.upload-progress-text { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-bottom: 7px; font-variant-numeric: tabular-nums; }
.upload-progress .progress > span { transition: width 250ms var(--ease-out); }

/* ==========================================================================
   Dostępność: ograniczony ruch
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 1ms !important; animation-iteration-count: 1 !important;
        transition-duration: 1ms !important; transition-delay: 0ms !important;
    }
    .reveal { opacity: 1; transform: none; }
}

/* ---------- Drobne poprawki dla małych ekranów ---------- */
.brand { white-space: nowrap; }
@media (max-width: 480px) {
    .brand { font-size: 20px; }
    .presence { padding-right: 10px; }
    .presence-text > span { display: none; }
    .v-nav { display: none !important; }
}
@media (max-width: 340px) {
    .presence-text { display: none; }
    .presence { padding: 0 5px; }
}

/* Mapa w ciemnym motywie — przyciemnione kafelki OSM */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) #map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9) saturate(0.6); }
}
:root[data-theme="dark"] #map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9) saturate(0.6); }

/* ---------- Przełącznik motywu ---------- */
.theme-btn { position: relative; overflow: hidden; }
.theme-btn .ic {
    position: absolute; inset: 0; margin: auto;
    opacity: 0; transform: rotate(-90deg) scale(0.6);
    transition: opacity 200ms ease, transform 350ms var(--ease-out);
}
:root:not([data-theme]) .theme-btn .ic-auto,
:root[data-theme="light"] .theme-btn .ic-sun,
:root[data-theme="dark"] .theme-btn .ic-moon { opacity: 1; transform: none; }

/* Animacja zmiany motywu (View Transitions) — rozlewające się koło */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }
