/* ==========================================================================
   Stamease - shared UI stylesheet
   Single source of truth for palette (light + dark), navigation, footer,
   completion overlay, settings panel, fonts, text size and motion.
   ========================================================================== */

/* ==========================================================================
   SELF-HOSTED FONT (privacy-safe: served locally, no CDN / no tracking)
   Inter variable font, Latin subset, all weights 100–900 in one file.
   ========================================================================== */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../fonts/inter.woff2") format("woff2");
}


/* ==========================================================================
   DESIGN TOKENS
   Dark is the default (bare :root). Light is applied when the visitor
   chooses it (:root[data-theme="light"]) or chooses "system" on a light OS.
   Change a colour here and the whole site follows.
   ========================================================================== */

:root,
:root[data-theme="dark"] {
    /* Surfaces */
    --theme-bg:          #0f172a;
    --theme-surface:     #111c31;
    --theme-surface-2:   #16233a;
    --theme-surface-3:   #0b1324;
    --theme-border:      #263752;

    /* Text */
    --theme-text:        #f8fafc;
    --theme-muted:       #94a3b8;

    /* Brand accent (purple) - the one primary accent across the site */
    --theme-primary:        #a78bfa;
    --theme-primary-soft:    rgba(167, 139, 250, 0.12);
    --theme-primary-border:  rgba(167, 139, 250, 0.28);
    --theme-primary-strong:  #ddd6fe;   /* readable accent text on tint */

    /* Secondary / status colours */
    --theme-green:        #34d399;
    --theme-green-soft:   rgba(52, 211, 153, 0.12);
    --theme-green-strong: #bbf7d0;
    --theme-orange:        #fb923c;
    --theme-orange-soft:   rgba(251, 146, 60, 0.12);
    --theme-orange-strong: #fdba74;
    --theme-yellow:       #fbbf24;
    --theme-yellow-soft:  rgba(251, 191, 36, 0.12);
    --theme-pink:         #f472b6;
    --theme-red:          #fb7185;
    --theme-red-strong:   #fda4af;

    /* Tinted panels (soft coloured backgrounds behind accent content) */
    --theme-tint-primary: #170d2c;
    --theme-tint-green:   #06210f;
    --theme-tint-neutral: #18253b;

    /* Chrome */
    --theme-nav-bg:   rgba(15, 23, 42, 0.94);
    --theme-menu-bg:  rgba(17, 28, 49, 0.98);
    --theme-shadow:   0 20px 60px rgba(0, 0, 0, 0.28);

    /* On-accent text (text sitting on a filled primary button) */
    --theme-on-primary: #0b1020;

    color-scheme: dark;

    /* -------- Legacy aliases (used by index.html + progress tracker) -------- */
    --bg:         var(--theme-bg);
    --surface:    var(--theme-surface);
    --surface-2:  var(--theme-surface-2);
    --surface-3:  var(--theme-surface-3);
    --border:     var(--theme-border);
    --text:       var(--theme-text);
    --muted:      var(--theme-muted);
    --blue:       var(--theme-primary);        /* unified: brand accent = purple */
    --blue-soft:  var(--theme-primary-soft);
    --green:      var(--theme-green);
    --shadow:     var(--theme-shadow);
}

/* -------- LIGHT THEME -------- */
:root[data-theme="light"] {
    --theme-bg:          #f6f7fb;
    --theme-surface:     #ffffff;
    --theme-surface-2:   #f0f2f8;
    --theme-surface-3:   #e9edf5;
    --theme-border:      #d9dfea;

    --theme-text:        #1e293b;
    --theme-muted:       #5b6472;

    --theme-primary:        #7c3aed;
    --theme-primary-soft:    rgba(124, 58, 237, 0.10);
    --theme-primary-border:  rgba(124, 58, 237, 0.28);
    --theme-primary-strong:  #6d28d9;

    --theme-green:        #059669;
    --theme-green-soft:   rgba(5, 150, 105, 0.12);
    --theme-green-strong: #15803d;
    --theme-orange:        #ea580c;
    --theme-orange-soft:   rgba(234, 88, 12, 0.12);
    --theme-orange-strong: #c2410c;
    --theme-yellow:       #ca8a04;
    --theme-yellow-soft:  rgba(202, 138, 4, 0.12);
    --theme-pink:         #db2777;
    --theme-red:          #e11d48;
    --theme-red-strong:   #be123c;

    --theme-tint-primary: #f2ecfd;
    --theme-tint-green:   #e7f7ef;
    --theme-tint-neutral: #eef1f7;

    --theme-nav-bg:   rgba(255, 255, 255, 0.92);
    --theme-menu-bg:  rgba(255, 255, 255, 0.99);
    --theme-shadow:   0 18px 44px rgba(2, 6, 23, 0.12);

    --theme-on-primary: #ffffff;

    color-scheme: light;
}

/* -------- "System" follows the operating-system preference -------- */
@media (prefers-color-scheme: light) {
    :root[data-theme="system"] {
        --theme-bg:          #f6f7fb;
        --theme-surface:     #ffffff;
        --theme-surface-2:   #f0f2f8;
        --theme-surface-3:   #e9edf5;
        --theme-border:      #d9dfea;
        --theme-text:        #1e293b;
        --theme-muted:       #5b6472;
        --theme-primary:        #7c3aed;
        --theme-primary-soft:    rgba(124, 58, 237, 0.10);
        --theme-primary-border:  rgba(124, 58, 237, 0.28);
        --theme-primary-strong:  #6d28d9;
        --theme-green:        #059669;
        --theme-green-soft:   rgba(5, 150, 105, 0.12);
        --theme-green-strong: #15803d;
        --theme-orange:        #ea580c;
        --theme-orange-soft:   rgba(234, 88, 12, 0.12);
        --theme-orange-strong: #c2410c;
        --theme-yellow:       #ca8a04;
        --theme-yellow-soft:  rgba(202, 138, 4, 0.12);
        --theme-pink:         #db2777;
        --theme-red:          #e11d48;
        --theme-red-strong:   #be123c;
        --theme-tint-primary: #f2ecfd;
        --theme-tint-green:   #e7f7ef;
        --theme-tint-neutral: #eef1f7;
        --theme-nav-bg:   rgba(255, 255, 255, 0.92);
        --theme-menu-bg:  rgba(255, 255, 255, 0.99);
        --theme-shadow:   0 18px 44px rgba(2, 6, 23, 0.12);
        --theme-on-primary: #ffffff;
        color-scheme: light;
    }
}

html { scroll-behavior: smooth; }
* { box-sizing: border-box; }

/* Hidden compatibility elements for legacy per-tool navigation scripts. */
.legacy-nav-stub { display: none !important; }

/* Keyboard focus visibility */
button:focus-visible,
a:focus-visible {
    outline: 3px solid var(--theme-primary-border);
    outline-offset: 3px;
}


/* ==========================================================================
   TEXT SIZE  (rem-based, so the whole UI scales proportionally)
   ========================================================================== */

:root[data-textsize="s"]  { font-size: 93.75%; }   /* 15px */
:root[data-textsize="l"]  { font-size: 112.5%; }   /* 18px */
:root[data-textsize="xl"] { font-size: 125%; }     /* 20px */


/* ==========================================================================
   NAVIGATION
   ========================================================================== */

.site-nav {
    position: sticky;
    top: 0;
    z-index: 9999;
    width: 100%;
    background: var(--theme-nav-bg);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.site-nav-inner {
    position: relative;
    max-width: 1250px;
    min-height: 68px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
}

.site-brand {
    flex-shrink: 0;
    color: var(--theme-text);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 850;
    letter-spacing: -0.04em;
}

.site-brand span { color: var(--theme-primary); }


/* -------- Desktop nav -------- */

.site-nav-desktop {
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-nav-desktop > a,
.site-tools-button,
.site-settings-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 13px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--theme-muted);
    text-decoration: none;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.site-nav-desktop > a:hover,
.site-tools-button:hover,
.site-settings-button:hover,
.site-nav-desktop > a.active,
.site-tools-button.active {
    color: var(--theme-text);
    background: var(--theme-primary-soft);
    border-color: var(--theme-primary-border);
}

.site-settings-button { padding: 9px 11px; }
.site-settings-button svg { width: 18px; height: 18px; display: block; }

.tools-arrow {
    display: inline-block;
    font-size: 0.8rem;
    transition: transform 0.25s ease;
}

.site-tools-dropdown.open .tools-arrow { transform: rotate(180deg); }


/* -------- Tools dropdown -------- */

.site-tools-dropdown { position: relative; }

.site-tools-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(720px, 90vw);
    padding: 18px;
    border: 1px solid var(--theme-border);
    border-radius: 18px;
    background: var(--theme-menu-bg);
    box-shadow: var(--theme-shadow);
    backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.site-tools-dropdown.open .site-tools-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.site-tools-menu-header {
    margin-bottom: 14px;
    color: var(--theme-primary);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.site-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.site-tool-link {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--theme-border);
    border-radius: 11px;
    background: var(--theme-surface-2);
    color: var(--theme-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 650;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.site-tool-link:hover {
    transform: translateY(-1px);
    background: var(--theme-primary-soft);
    border-color: var(--theme-primary-border);
    color: var(--theme-text);
}

.site-tool-link.active {
    color: var(--theme-primary-strong);
    background: var(--theme-primary-soft);
    border-color: var(--theme-primary-border);
}


/* -------- Mobile toggle -------- */

.site-mobile-toggle {
    display: none;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    background: var(--theme-primary-soft);
    cursor: pointer;
}

.site-mobile-toggle span {
    display: block;
    width: 19px;
    height: 2px;
    margin: 4px auto;
    border-radius: 999px;
    background: var(--theme-text);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Animate hamburger into an X when open */
.site-mobile-toggle.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.site-mobile-toggle.active span:nth-child(2) { opacity: 0; }
.site-mobile-toggle.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }


/* -------- Mobile menu -------- */

.site-mobile-menu { display: none; }


/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
    margin: 3rem auto 0;
    padding: 0;
    color: var(--theme-muted);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    border-top: 1px solid var(--theme-border);
    background: var(--theme-surface);
}
.site-footer .sf-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.4rem 1.2rem 1.6rem;
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: 1.6rem 1.2rem;
}
.site-footer .sf-brand { max-width: 320px; }
.site-footer .sf-logo {
    font-weight: 900;
    font-size: 1.25rem;
    color: var(--theme-text);
    text-decoration: none;
    letter-spacing: -.01em;
}
.site-footer .sf-logo span { color: var(--theme-primary); }
.site-footer .sf-tag { margin: .6rem 0 .5rem; line-height: 1.55; font-size: .9rem; color: var(--theme-muted); }
.site-footer .sf-promise { margin: 0; font-size: .85rem; font-weight: 700; color: var(--theme-green); }
.site-footer .sf-col { display: flex; flex-direction: column; }
.site-footer .sf-col h4 {
    margin: 0 0 .7rem;
    font-size: .76rem;
    font-weight: 850;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--theme-text);
}
.site-footer .sf-col a {
    color: var(--theme-muted);
    text-decoration: none;
    font-size: .9rem;
    padding: .3rem 0;
    transition: color .15s ease;
}
.site-footer .sf-col a:hover { color: var(--theme-primary); }
.site-footer .sf-bottom {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.1rem 1.2rem 2.6rem;
    border-top: 1px solid var(--theme-border);
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.site-footer .sf-disclaimer { margin: 0; font-size: .8rem; line-height: 1.55; color: var(--theme-muted); }
.site-footer .sf-copy { margin: 0; font-size: .8rem; color: var(--theme-muted); opacity: .85; }
.site-footer .sf-copy a { color: var(--theme-primary-strong, var(--theme-primary)); font-weight: 700; text-decoration: none; }
.site-footer .sf-copy a:hover { text-decoration: underline; }

@media (max-width: 760px) {
    .site-footer .sf-inner { grid-template-columns: 1fr 1fr; }
    .site-footer .sf-brand { grid-column: 1 / -1; max-width: none; }
}
@media (max-width: 440px) {
    .site-footer .sf-inner { grid-template-columns: 1fr; gap: 1.3rem; }
}


/* ==========================================================================
   TABLET / MOBILE
   ========================================================================== */

@media (max-width: 760px) {
    .site-nav-inner {
        min-height: 62px;
        padding: 0 16px;
    }

    .site-nav-desktop { display: none; }
    .site-mobile-toggle { display: block; }

    .site-mobile-menu {
        display: block;
        position: absolute;
        top: calc(100% + 1px);
        left: 0;
        right: 0;
        max-height: 0;
        overflow: hidden;
        padding: 0 16px;
        background: var(--theme-menu-bg);
        border-bottom: 1px solid var(--theme-border);
        opacity: 0;
        transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
    }

    .site-mobile-menu.open {
        max-height: calc(100vh - 62px); /* fill the screen below the nav bar */
        overflow-y: auto;               /* menu gets its OWN scrollbar */
        -webkit-overflow-scrolling: touch; /* smooth momentum scroll on iOS */
        padding: 10px 16px 20px;
        opacity: 1;
    }

    .site-mobile-menu > a,
    .site-mobile-menu .site-mobile-settings > button {
        display: block;
        width: 100%;
        text-align: left;
        padding: 13px 12px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: var(--theme-muted);
        text-decoration: none;
        font-family: inherit;
        font-size: 0.9rem;
        font-weight: 750;
        cursor: pointer;
    }

    .site-mobile-menu > a.active { color: var(--theme-primary-strong); background: var(--theme-primary-soft); }

    .site-mobile-tools-title {
        margin: 18px 0 10px;
        padding-top: 15px;
        border-top: 1px solid var(--theme-border);
        color: var(--theme-primary);
        font-size: 0.72rem;
        font-weight: 850;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .site-mobile-tools {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .site-mobile-tools .site-tool-link { min-height: 50px; }
}


/* -------- Small phones -------- */

@media (max-width: 440px) {
    .site-mobile-tools { grid-template-columns: 1fr; }
    .site-brand { font-size: 1.1rem; }
}


/* ==========================================================================
   SETTINGS PANEL
   ========================================================================== */

.sb-settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 21000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(2, 6, 23, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.sb-settings-overlay.show { opacity: 1; visibility: visible; pointer-events: auto; }

.sb-settings-card {
    width: min(100%, 520px);
    max-height: 88vh;
    overflow-y: auto;
    padding: 24px 24px 22px;
    border: 1px solid var(--theme-border);
    border-radius: 20px;
    background: var(--theme-surface);
    box-shadow: var(--theme-shadow);
    transform: translateY(14px) scale(0.99);
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sb-settings-overlay.show .sb-settings-card { transform: translateY(0) scale(1); }

.sb-settings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.sb-settings-head h2 {
    margin: 0;
    color: var(--theme-text);
    font-size: 1.25rem;
}

.sb-settings-sub {
    margin: 0 0 18px;
    color: var(--theme-muted);
    font-size: 0.86rem;
    line-height: 1.5;
}

.sb-settings-close {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    background: transparent;
    color: var(--theme-muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.sb-settings-close:hover {
    background: var(--theme-primary-soft);
    border-color: var(--theme-primary-border);
    color: var(--theme-text);
}

.sb-setting {
    padding: 16px 0;
    border-top: 1px solid var(--theme-border);
}

.sb-setting:first-of-type { border-top: 0; }

.sb-setting-title {
    margin: 0 0 3px;
    color: var(--theme-text);
    font-size: 0.95rem;
    font-weight: 750;
}

.sb-setting-desc {
    margin: 0 0 11px;
    color: var(--theme-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.sb-segment {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--theme-border);
    border-radius: 12px;
    background: var(--theme-surface-2);
}

.sb-segment button {
    min-width: 62px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--theme-muted);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.sb-segment button:hover { color: var(--theme-text); }

.sb-segment button[aria-pressed="true"] {
    background: var(--theme-primary-soft);
    border-color: var(--theme-primary-border);
    color: var(--theme-primary-strong);
}

.sb-settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.sb-btn {
    flex: 1;
    min-width: 130px;
    padding: 11px 14px;
    border-radius: 11px;
    border: 1px solid var(--theme-border);
    background: var(--theme-surface-2);
    color: var(--theme-text);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 750;
    cursor: pointer;
    text-align: center;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.sb-btn:hover { transform: translateY(-1px); border-color: var(--theme-primary-border); }

.sb-btn-primary {
    background: var(--theme-primary);
    border-color: var(--theme-primary);
    color: var(--theme-on-primary);
}

.sb-btn-danger { color: var(--theme-red); }
.sb-btn-danger:hover { border-color: var(--theme-red); background: rgba(225, 29, 72, 0.08); }

.sb-settings-status {
    margin: 12px 0 0;
    min-height: 1.1em;
    color: var(--theme-green);
    font-size: 0.82rem;
    font-weight: 650;
}


/* ==========================================================================
   SESSION COMPLETE OVERLAY
   ========================================================================== */

.sb-completion-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 24px;
    background: rgba(2, 6, 23, 0.34);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.sb-completion-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sb-completion-card {
    position: relative;
    width: min(100%, 560px);
    padding: 24px 26px 22px;
    border: 1px solid var(--theme-primary-border);
    border-radius: 22px;
    background: var(--theme-surface);
    box-shadow: var(--theme-shadow);
    transform: translateY(22px) scale(0.985);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
}

.sb-completion-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at top right, var(--theme-primary-soft), transparent 42%);
}

.sb-completion-overlay.show .sb-completion-card {
    transform: translateY(0) scale(1);
}

.sb-completion-check {
    position: relative;
    z-index: 1;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border: 1px solid var(--theme-green-soft);
    border-radius: 50%;
    background: var(--theme-green-soft);
    color: var(--theme-green);
    font-size: 1.5rem;
    font-weight: 900;
}

.sb-completion-eyebrow {
    position: relative;
    z-index: 1;
    margin-bottom: 6px;
    color: var(--theme-primary);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.sb-completion-card h2 {
    position: relative;
    z-index: 1;
    margin: 0 44px 8px 0;
    color: var(--theme-text);
    font-size: clamp(1.3rem, 3vw, 1.7rem);
    line-height: 1.2;
}

.sb-completion-card p {
    position: relative;
    z-index: 1;
    max-width: 48ch;
    margin: 0 0 18px;
    color: var(--theme-muted);
    font-size: 0.95rem;
    line-height: 1.65;
}

.sb-completion-close {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 2;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    background: transparent;
    color: var(--theme-muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.sb-completion-close:hover {
    background: var(--theme-primary-soft);
    border-color: var(--theme-primary-border);
    color: var(--theme-text);
}

.sb-completion-continue {
    position: relative;
    z-index: 1;
    min-width: 130px;
    padding: 11px 18px;
    border: 1px solid var(--theme-primary);
    border-radius: 11px;
    background: var(--theme-primary);
    color: var(--theme-on-primary);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
}

.sb-completion-continue:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

@media (max-width: 600px) {
    .sb-completion-overlay {
        align-items: flex-end;
        padding: 14px;
    }
    .sb-completion-card {
        padding: 22px 20px 18px;
        border-radius: 18px;
    }
    .sb-completion-card p { font-size: 0.92rem; }
    .sb-completion-continue { width: 100%; }
}


/* ==========================================================================
   COMPLETION TOAST - subtle, non-blocking acknowledgement.
   ========================================================================== */

.sb-toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%) translateY(14px);
    z-index: 20000;
    display: flex;
    align-items: center;
    gap: 11px;
    max-width: min(92vw, 440px);
    padding: 12px 16px;
    border: 1px solid var(--theme-primary-border);
    border-radius: 14px;
    background: var(--theme-surface);
    color: var(--theme-text);
    box-shadow: var(--theme-shadow);
    font: 600 0.9rem/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease;
}

.sb-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
    cursor: pointer;
}

.sb-toast-check {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--theme-green-soft);
    color: var(--theme-green);
    font-size: 0.95rem;
    font-weight: 900;
}

.sb-toast-text { min-width: 0; }

@media (max-width: 600px) {
    .sb-toast {
        left: 12px;
        right: 12px;
        bottom: 14px;
        max-width: none;
        transform: translateY(14px);
    }
    .sb-toast.show { transform: translateY(0); }
}


/* ==========================================================================
   VOICE RECORDER - optional, private, in-memory. Floating mic (bottom-right).
   ========================================================================== */

.sb-rec-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 15000;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--theme-primary-border);
    background: var(--theme-primary);
    color: var(--theme-on-primary);
    box-shadow: var(--theme-shadow);
    cursor: pointer;
    transition: transform 0.18s ease, filter 0.18s ease;
}

.sb-rec-fab:hover { transform: translateY(-2px); filter: brightness(1.06); }
.sb-rec-fab svg { width: 24px; height: 24px; display: block; }

.sb-rec-fab.recording {
    background: var(--theme-red);
    border-color: var(--theme-red);
    color: #ffffff;
    animation: sb-rec-pulse 1.6s ease-in-out infinite;
}

@keyframes sb-rec-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.45); }
    50%      { box-shadow: 0 0 0 10px rgba(225, 29, 72, 0); }
}

.sb-rec-panel {
    position: fixed;
    right: 22px;
    bottom: 88px;
    z-index: 15000;
    width: min(330px, calc(100vw - 32px));
    padding: 16px 16px 14px;
    border: 1px solid var(--theme-border);
    border-radius: 16px;
    background: var(--theme-surface);
    color: var(--theme-text);
    box-shadow: var(--theme-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    font: 400 0.9rem/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.sb-rec-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.sb-rec-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: var(--theme-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
}
.sb-rec-close:hover { background: var(--theme-primary-soft); color: var(--theme-text); }

.sb-rec-title { margin: 0 26px 4px 0; font-size: 0.95rem; font-weight: 750; color: var(--theme-text); }
.sb-rec-note  { margin: 0 0 12px; font-size: 0.8rem; color: var(--theme-muted); line-height: 1.5; }
.sb-rec-timer { margin: 2px 0 12px; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.25rem; color: var(--theme-text); }
.sb-rec-row   { display: flex; flex-wrap: wrap; gap: 8px; }

.sb-rec-btn {
    flex: 1;
    min-width: 84px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--theme-border);
    background: var(--theme-surface-2);
    color: var(--theme-text);
    font: inherit;
    font-weight: 700;
    font-size: 0.83rem;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.sb-rec-btn:hover { transform: translateY(-1px); border-color: var(--theme-primary-border); }
.sb-rec-btn-primary { background: var(--theme-primary); border-color: var(--theme-primary); color: var(--theme-on-primary); }
.sb-rec-btn-danger  { background: var(--theme-red); border-color: var(--theme-red); color: #ffffff; }

.sb-rec-audio { width: 100%; margin: 10px 0 4px; }
.sb-rec-msg   { margin: 8px 0 0; font-size: 0.8rem; color: var(--theme-muted); line-height: 1.5; }

@media (max-width: 600px) {
    .sb-rec-fab { right: 16px; bottom: 16px; }
    .sb-rec-panel { right: 16px; left: 16px; width: auto; bottom: 80px; }
}


/* ==========================================================================
   REDUCED MOTION - honour the system preference AND the in-app toggle.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    :root:not([data-motion="full"]) *,
    :root:not([data-motion="full"]) *::before,
    :root:not([data-motion="full"]) *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

:root[data-motion="reduced"] *,
:root[data-motion="reduced"] *::before,
:root[data-motion="reduced"] *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}


/* ==========================================================================
   Stamease - My Toolkit star controls
   ========================================================================== */
.card { position: relative; }

.sb-star {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    cursor: pointer;
    border: 1px solid var(--theme-border, var(--border));
    background: var(--theme-surface, var(--surface));
    color: var(--theme-muted, var(--muted));
    border-radius: 999px;
    font: inherit;
    font-weight: 700;
    line-height: 1;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.sb-star .sb-star-ico { font-size: 1rem; color: var(--theme-muted, var(--muted)); line-height: 1; }
.sb-star:hover { border-color: var(--theme-primary, var(--blue)); color: var(--theme-primary, var(--blue)); }
.sb-star.saved {
    border-color: var(--theme-primary, var(--blue));
    color: var(--theme-primary, var(--blue));
    background: var(--theme-primary-soft, var(--blue-soft));
}
.sb-star.saved .sb-star-ico { color: #f5b301; }

/* star tucked into the corner of a homepage / toolkit card */
.card .sb-star {
    position: absolute;
    top: .7rem;
    right: .7rem;
    padding: .3rem .6rem;
    font-size: .78rem;
}
.card h3 { padding-right: 4.5rem; }

/* star sitting in the shared nav on a tool page */
.sb-star-nav { padding: .4rem .75rem; font-size: .85rem; }
.site-mobile-menu .sb-star-nav { width: 100%; justify-content: flex-start; margin-top: .4rem; }

/* ==========================================================================
   Stamease - Calm anchor button + zen breathing space (site-wide)
   ========================================================================== */
.sb-calm-fab {
    position: fixed;
    left: 1.15rem;
    bottom: 1.15rem;
    z-index: 900;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(145deg, var(--theme-primary, #3b82f6), var(--theme-green, #22c55e));
    color: #fff;
    box-shadow: 0 6px 20px rgba(16, 74, 120, .35);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .18s ease, box-shadow .18s ease;
}
.sb-calm-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(16, 74, 120, .45); }
.sb-calm-fab:focus-visible { outline: 3px solid var(--theme-primary, #3b82f6); outline-offset: 3px; }

.sb-calm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    color: #eaf3f4;
    background:
        radial-gradient(1100px 800px at 50% 32%, rgba(59, 130, 246, .16), transparent 60%),
        linear-gradient(160deg, #0b1e2b 0%, #0e2733 48%, #0d1f2c 100%);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: background 1.6s ease;
}
.sb-calm-overlay.open { display: flex; }
.sb-calm-overlay.bg-in  { background: radial-gradient(1100px 900px at 50% 34%, rgba(59, 130, 246, .30), transparent 62%), linear-gradient(160deg, #0e2a3a, #123243, #0e2636); }
.sb-calm-overlay.bg-out { background: radial-gradient(1000px 820px at 50% 46%, rgba(34, 197, 94, .22), transparent 60%), linear-gradient(160deg, #0a1c26, #0d222c, #0b1a24); }
.sb-calm-overlay.bg-hold{ background: radial-gradient(1000px 820px at 50% 40%, rgba(148, 197, 253, .16), transparent 60%), linear-gradient(160deg, #0c2331, #0f2937, #0c1f2b); }

.sb-calm-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    background: none;
    border: none;
    color: #eaf3f4;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    opacity: .8;
}
.sb-calm-close:hover { opacity: 1; }
.sb-calm-close:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 6px; }

.sb-calm-stage { text-align: center; max-width: 460px; width: 100%; }

.sb-calm-orbwrap {
    position: relative;
    width: clamp(200px, 60vw, 288px);
    aspect-ratio: 1;
    margin: 0 auto 1.5rem;
}

.sb-calm-orb {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 82%;
    height: 82%;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(.5);
    background: radial-gradient(circle at 50% 36%, var(--theme-primary, #3b82f6), var(--theme-green, #22c55e) 94%);
    box-shadow: 0 0 55px rgba(59, 130, 246, .5), 0 0 100px rgba(34, 197, 94, .22);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 4s ease-in-out;
}
.sb-calm-orb.big   { transform: translate(-50%, -50%) scale(1); }
.sb-calm-orb.small { transform: translate(-50%, -50%) scale(.5); }
.sb-calm-count { font-size: clamp(2rem, 8vw, 2.7rem); font-weight: 300; color: #fff; letter-spacing: .02em; }
.sb-calm-mark { margin-top: .15em; font-size: .62rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.62); }

.sb-calm-phase { font-size: 1.35rem; font-weight: 700; letter-spacing: .03em; margin: .2rem 0 .35rem; color: #fff; }
.sb-calm-cue { color: #c7d6dc; line-height: 1.6; margin: 0 auto 1.25rem; max-width: 340px; min-height: 1.5em; font-size: 1rem; }

.sb-calm-patterns { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.1rem; }
.sb-calm-pat {
    background: rgba(255, 255, 255, .08);
    color: #dbe7ea;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    padding: .42rem .85rem;
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.sb-calm-pat:hover { background: rgba(255, 255, 255, .14); }
.sb-calm-pat.active { background: var(--theme-primary, #3b82f6); border-color: var(--theme-primary, #3b82f6); color: #fff; }

.sb-calm-startstop { min-width: 150px; }
.sb-calm-exit-note { margin: 1.1rem 0 0; font-size: .8rem; color: rgba(255,255,255,.5); letter-spacing: .02em; }

@media (max-width: 480px) {
    .sb-calm-phase { font-size: 1.2rem; }
    .sb-calm-cue { font-size: .95rem; }
}

@media (prefers-reduced-motion: reduce) {
    .sb-calm-orb { transition: none !important; transform: translate(-50%, -50%) scale(.8) !important; }
    .sb-calm-overlay { transition: none !important; }
    .sb-calm-fab:hover { transform: none; }
}


/* ==========================================================================
   Stamease - "Start here" homepage chip
   ========================================================================== */
.sb-starthere-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1.6rem;
    padding: .7rem 1rem;
    background: var(--theme-primary-soft);
    border: 1px solid var(--theme-primary-border);
    border-radius: 12px;
    color: var(--theme-text);
    font-size: .95rem;
}
.sb-starthere-chip a { color: var(--theme-primary); font-weight: 800; text-decoration: none; }
.sb-starthere-chip a:hover { text-decoration: underline; }
.sb-starthere-x {
    background: none; border: none; color: var(--theme-muted);
    font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 .3rem; flex: none;
}
.sb-starthere-x:hover { color: var(--theme-text); }
