/* ==========================================================================
   Gold Star — one stylesheet, no build step.
   Dark is the default; [data-theme="light"] on <html> swaps the tokens.
   ========================================================================== */

:root {
    --bg:          #0b0f14;
    --surface:     #141a22;
    --surface-2:   #1b2430;
    --surface-3:   #222e3d;
    --border:      #26313f;
    --border-soft: #1e2733;
    --text:        #e6edf3;
    --muted:       #8b98a8;
    --faint:       #5a6673;

    --gold:        #ffd24a;
    --gold-dim:    rgba(255, 210, 74, 0.16);
    --gold-line:   rgba(255, 210, 74, 0.55);
    --silver:      #c9d4e0;
    --silver-dim:  rgba(201, 212, 224, 0.12);
    --silver-line: rgba(201, 212, 224, 0.42);
    --bronze:      #d08a52;
    --bronze-dim:  rgba(208, 138, 82, 0.16);
    --bronze-line: rgba(208, 138, 82, 0.50);

    --accent:      #6ea8ff;
    --accent-ink:  #08111f;
    --danger:      #ff6b6b;
    --success:     #4ade80;

    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --radius: 14px;
    --radius-sm: 10px;
    --tap: 44px;
}

[data-theme="light"] {
    --bg:          #f4f7fb;
    --surface:     #ffffff;
    --surface-2:   #eef2f8;
    --surface-3:   #e3eaf3;
    --border:      #d8e0ea;
    --border-soft: #e6ecf4;
    --text:        #0f1720;
    --muted:       #5c6875;
    --faint:       #8d98a5;

    --gold:        #c99700;
    --gold-dim:    rgba(217, 164, 0, 0.16);
    --gold-line:   rgba(217, 164, 0, 0.5);
    --silver:      #7e8b9a;
    --silver-dim:  rgba(126, 139, 154, 0.14);
    --silver-line: rgba(126, 139, 154, 0.4);
    --bronze:      #a25f2c;
    --bronze-dim:  rgba(162, 95, 44, 0.15);
    --bronze-line: rgba(162, 95, 44, 0.45);

    --accent:      #2563eb;
    --accent-ink:  #ffffff;
    --danger:      #d63b3b;
    --success:     #17913f;

    --shadow: 0 10px 30px rgba(15, 23, 32, 0.12);
}


/* ==========================================================================
   Colour themes.

   These layer on top of the dark/light mode rather than replacing it, so the
   two settings stay independent: every palette has a dark and a light variant.
   Two attribute selectors give (0,2,0) specificity, which beats both the :root
   defaults and the [data-theme="light"] block below them.

   Deliberately NOT overridden: --gold, --silver and --bronze. The stars have to
   read as metal in every theme or they stop meaning anything. Slate is the
   base palette and needs no block.

   Keep the --bg values in step with src/Palettes.php, which repeats them for
   the <meta name="theme-color"> tag.
   ========================================================================== */

[data-theme="dark"][data-palette="pink"] {
    --bg:          #150b10;
    --surface:     #211520;
    --surface-2:   #2c1d29;
    --surface-3:   #382534;
    --border:      #442e3f;
    --border-soft: #31212d;
    --text:        #f7eaf2;
    --muted:       #bb95aa;
    --faint:       #856275;
    --accent:      #f472b6;
    --accent-ink:  #2a0c1b;
}

[data-theme="light"][data-palette="pink"] {
    --bg:          #fdf2f7;
    --surface:     #ffffff;
    --surface-2:   #fbe9f2;
    --surface-3:   #f6dbe9;
    --border:      #efc8dd;
    --border-soft: #f7e2ee;
    --text:        #2a1120;
    --muted:       #7d5468;
    --faint:       #a9829a;
    --accent:      #db2777;
    --accent-ink:  #ffffff;
}

[data-theme="dark"][data-palette="butter"] {
    --bg:          #14100a;
    --surface:     #201a12;
    --surface-2:   #2b231a;
    --surface-3:   #372d22;
    --border:      #43372a;
    --border-soft: #2f271d;
    --text:        #f7f0e2;
    --muted:       #bfae90;
    --faint:       #8a7b60;
    /* Deliberately more orange than --gold, so "today" cannot be mistaken
       for a gold star cell. */
    --accent:      #e0952f;
    --accent-ink:  #241505;
}

[data-theme="light"][data-palette="butter"] {
    --bg:          #fdf8e7;
    --surface:     #fffdf6;
    --surface-2:   #faf2d9;
    --surface-3:   #f5e9c4;
    --border:      #e8d9a8;
    --border-soft: #f2e8cb;
    --text:        #2a2310;
    --muted:       #7a6a3f;
    --faint:       #a89772;
    --accent:      #b45309;
    --accent-ink:  #ffffff;
}

[data-theme="dark"][data-palette="purple"] {
    --bg:          #100c18;
    --surface:     #1a1526;
    --surface-2:   #241d33;
    --surface-3:   #2e2541;
    --border:      #392e4e;
    --border-soft: #281f38;
    --text:        #eee9f8;
    --muted:       #a798c4;
    --faint:       #776a91;
    --accent:      #a78bfa;
    --accent-ink:  #170b2b;
}

[data-theme="light"][data-palette="purple"] {
    --bg:          #f6f2fd;
    --surface:     #ffffff;
    --surface-2:   #efe8fb;
    --surface-3:   #e5daf8;
    --border:      #d3c2f0;
    --border-soft: #eae0fa;
    --text:        #1c1330;
    --muted:       #61508a;
    --faint:       #8d7cb0;
    --accent:      #6d28d9;
    --accent-ink:  #ffffff;
}

[data-theme="dark"][data-palette="powder"] {
    --bg:          #0a1016;
    --surface:     #131c25;
    --surface-2:   #1b2733;
    --surface-3:   #243342;
    --border:      #2b3d4e;
    --border-soft: #1f2c39;
    --text:        #e4eef6;
    --muted:       #90a7ba;
    --faint:       #627687;
    --accent:      #7dd3fc;
    --accent-ink:  #06202e;
}

[data-theme="light"][data-palette="powder"] {
    --bg:          #eef6fc;
    --surface:     #ffffff;
    --surface-2:   #e3f0fa;
    --surface-3:   #d3e6f6;
    --border:      #bcd8ec;
    --border-soft: #dceaf6;
    --text:        #0d1c28;
    --muted:       #4f6b80;
    --faint:       #7e97a9;
    --accent:      #0369a1;
    --accent-ink:  #ffffff;
}

/* ------------------------------------------------------------------ reset */

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

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button { cursor: pointer; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }

a { color: var(--accent); }

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

/* ------------------------------------------------------------ auth screens */

.auth {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    box-shadow: var(--shadow);
}

.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand h1 { font-size: 22px; margin-top: 8px; }
.auth-tagline { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

.brand-star {
    color: var(--gold);
    font-size: 28px;
    line-height: 1;
    display: inline-block;
    filter: drop-shadow(0 2px 8px var(--gold-dim));
}

.auth-alt {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin: 18px 0 0;
}

.stack { display: grid; gap: 14px; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }

.field input, .select {
    width: 100%;
    min-height: var(--tap);
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    /* 16px keeps iOS Safari from zooming in on focus */
    font-size: 16px;
}

.field input:focus, .select:focus {
    border-color: var(--accent);
    outline: none;
}

.hint { color: var(--faint); font-size: 12px; }

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--muted);
    min-height: var(--tap);
}

.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.alert {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
    color: var(--danger);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin: 0 0 16px;
}

/* ---------------------------------------------------------------- buttons */

.btn {
    min-height: var(--tap);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-weight: 600;
    font-size: 15px;
    transition: filter 0.15s ease, transform 0.05s ease;
}

.btn:active { transform: scale(0.985); }
.btn:hover { filter: brightness(1.12); }

.btn-primary {
    background: var(--gold);
    border-color: var(--gold);
    color: #1a1400;
}

.btn-ghost { background: transparent; }

.btn-danger {
    background: transparent;
    border-color: color-mix(in srgb, var(--danger) 50%, transparent);
    color: var(--danger);
}

.btn-sm { min-height: 34px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }

.btn-block { width: 100%; }

/* -------------------------------------------------------------- app shell */

.app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 560px;
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-soft);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand .brand-star { font-size: 18px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.streak {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 650;
    color: var(--gold);
    background: var(--gold-dim);
    border: 1px solid var(--gold-line);
    border-radius: 999px;
    padding: 4px 10px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 16px;
}

.view {
    flex: 1;
    padding: 16px 16px 96px;
    outline: none;
}

.loading { color: var(--muted); text-align: center; padding: 48px 0; }

/* ----------------------------------------------------------------- tabbar */

.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-soft);
    max-width: 560px;
    margin: 0 auto;
}

.tab {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 6px 4px;
    min-height: 52px;
    border: 0;
    background: transparent;
    border-radius: 10px;
    color: var(--faint);
    font-size: 11px;
    font-weight: 600;
}

.tab-icon { font-size: 18px; line-height: 1.1; }
.tab.is-active { color: var(--gold); }

/* ------------------------------------------------------------ today's note */

.today-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    background:
        linear-gradient(150deg, color-mix(in srgb, var(--accent) 13%, var(--surface)), var(--surface));
}

.today-note-mark {
    color: var(--gold);
    font-size: 15px;
    line-height: 1.45;
    flex: 0 0 auto;
}

.today-note p {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text);
}

/* --------------------------------------------------------------- calendar */

.month-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}

.month-title { font-size: 18px; font-weight: 700; }
.month-nav { display: flex; gap: 6px; }

.nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    display: grid;
    place-items: center;
}

.nav-btn[disabled] { opacity: 0.35; cursor: default; }

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 6px;
}

.weekdays span {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.cal-cell {
    aspect-ratio: 1;
    display: grid;
    grid-template-rows: auto 1fr;
    padding: 5px 5px 4px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    text-align: left;
    transition: transform 0.06s ease, border-color 0.15s ease, background 0.15s ease;
}

.cal-cell:active { transform: scale(0.94); }

.cal-cell.is-blank {
    background: transparent;
    border-color: transparent;
    pointer-events: none;
}

.cal-cell.is-future {
    opacity: 0.32;
    pointer-events: none;
}

.cal-cell.is-today {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.cal-cell.is-gold {
    background: linear-gradient(155deg, var(--gold-dim), transparent 70%), var(--surface);
    border-color: var(--gold-line);
}

.cal-cell.is-silver {
    background: linear-gradient(155deg, var(--silver-dim), transparent 70%), var(--surface);
    border-color: var(--silver-line);
}

.cal-cell.is-bronze {
    background: linear-gradient(155deg, var(--bronze-dim), transparent 70%), var(--surface);
    border-color: var(--bronze-line);
}

.cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    line-height: 1;
}

.cal-day { font-size: 12px; font-weight: 600; color: var(--muted); }
.cal-cell.is-today .cal-day { color: var(--accent); }
.cal-cell.is-gold .cal-day,
.cal-cell.is-silver .cal-day,
.cal-cell.is-bronze .cal-day { color: var(--text); }

.cal-badge { font-size: 11px; line-height: 1; }
.cal-cell.is-gold .cal-badge { color: var(--gold); }
.cal-cell.is-silver .cal-badge { color: var(--silver); }
.cal-cell.is-bronze .cal-badge { color: var(--bronze); }

.cal-dots {
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    gap: 3px;
    padding-top: 2px;
    overflow: hidden;
}

.cal-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--c, var(--muted));
    display: block;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
    font-size: 12px;
    color: var(--muted);
}

.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }

/* ------------------------------------------------------------ bottom sheet */

.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.sheet-backdrop.is-open { opacity: 1; }

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    max-height: 88dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-radius: 22px 22px 0 0;
    padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
    box-shadow: var(--shadow);
    transform: translateY(100%);
    transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
    max-width: 560px;
    margin: 0 auto;
}

.sheet.is-open { transform: translateY(0); }

.sheet-grip {
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--surface-3);
    margin: 6px auto 12px;
}

.sheet-head { margin-bottom: 14px; }
.sheet-head h2 { font-size: 17px; }
.sheet-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* --------------------------------------------------------- progress meter */

.meter {
    height: 6px;
    border-radius: 999px;
    background: var(--surface-3);
    overflow: hidden;
    margin-top: 10px;
}

.meter-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    transition: width 0.3s ease, background 0.3s ease;
}

.meter-fill.is-gold { background: var(--gold); }
.meter-fill.is-silver { background: var(--silver); }
.meter-fill.is-bronze { background: var(--bronze); }

.sheet-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

/* -------------------------------------------------------- category toggles */

.tick-list { display: grid; gap: 8px; margin-top: 4px; }

.tick {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 56px;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    background: var(--surface-2);
    text-align: left;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.tick:active { transform: scale(0.99); }

.tick.is-done {
    border-color: color-mix(in srgb, var(--c) 55%, transparent);
    background: color-mix(in srgb, var(--c) 12%, var(--surface-2));
}

.tick-box {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--c) 60%, transparent);
    display: grid;
    place-items: center;
    color: transparent;
    font-size: 14px;
    font-weight: 700;
    transition: background 0.15s ease, color 0.15s ease;
}

.tick.is-done .tick-box {
    background: var(--c);
    border-color: var(--c);
    color: #0b0f14;
}

.tick-name { flex: 1; font-weight: 550; }

.tick-flag {
    font-size: 11px;
    color: var(--faint);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
}

/* ------------------------------------------------------------ habits list */

.section-title {
    font-size: 13px;
    font-weight: 650;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 22px 0 10px;
}

.section-title:first-child { margin-top: 0; }

.habit-list { display: grid; gap: 8px; }

.habit {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    background: var(--surface);
    text-align: left;
}

.habit-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.habit-name { font-weight: 550; }
.habit-meta { font-size: 12px; color: var(--faint); margin-top: 2px; }
.habit-strip { display: flex; gap: 3px; }

.habit-strip i {
    width: 8px;
    height: 18px;
    border-radius: 3px;
    background: var(--surface-3);
    display: block;
}

.habit-strip i.on { background: var(--c); }

/* --------------------------------------------------------------- heatmap  */

.heatmap-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
}

.heatmap {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 1fr);
    gap: 3px;
    width: max-content;
}

.heat {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    padding: 0;
}

.heat.on { background: var(--c); border-color: var(--c); }
.heat.is-future { opacity: 0.25; pointer-events: none; }
.heat.is-today { box-shadow: 0 0 0 2px var(--accent); }
.heat.is-blank { visibility: hidden; pointer-events: none; }

.stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 16px 0;
}

.stat {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 10px 8px;
    text-align: center;
}

.stat-value { font-size: 19px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }

/* --------------------------------------------------------------- settings */

.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.card h3 { font-size: 15px; margin-bottom: 4px; }
.card-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
}

.row:last-child { border-bottom: 0; }
.row-label { font-size: 14px; }
.row-hint { font-size: 12px; color: var(--faint); margin-top: 2px; }

.cat-admin { display: grid; gap: 8px; }

.cat-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    background: var(--surface-2);
}

.cat-item.is-archived { opacity: 0.55; }

.cat-swatch {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: var(--c);
    padding: 0;
}

.cat-actions { display: flex; gap: 4px; }

.mini-btn {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 13px;
}

.mini-btn[disabled] { opacity: 0.3; cursor: default; }

/* ---------------------------------------------------------- colour picker */

.swatches {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin: 12px 0;
}

.swatch {
    aspect-ratio: 1;
    border-radius: 9px;
    border: 2px solid transparent;
    background: var(--c);
    padding: 0;
}

.swatch.is-picked {
    border-color: var(--text);
    box-shadow: 0 0 0 2px var(--bg) inset;
}

.hex-row { display: flex; align-items: center; gap: 8px; }

.hex-row input {
    flex: 1;
    min-height: var(--tap);
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 15px;
    text-transform: uppercase;
}

.hex-preview {
    width: var(--tap);
    height: var(--tap);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--c);
    flex: 0 0 auto;
}

/* ---------------------------------------------------------------- toasts  */

.toast-host {
    position: fixed;
    left: 50%;
    bottom: calc(80px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 60;
    display: grid;
    gap: 8px;
    width: min(92vw, 420px);
    pointer-events: none;
}

.toast {
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    text-align: center;
    box-shadow: var(--shadow);
    animation: toast-in 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

.toast.is-gold {
    background: linear-gradient(160deg, #ffd24a, #f0a800);
    border-color: #ffd24a;
    color: #1a1400;
    font-weight: 650;
    font-size: 15px;
}

.toast.is-silver {
    background: linear-gradient(160deg, #dde5ee, #aab8c7);
    border-color: #dde5ee;
    color: #10161d;
    font-weight: 600;
}

.toast.is-bronze {
    background: linear-gradient(160deg, #e0a878, #c07a3e);
    border-color: #e0a878;
    color: #1c1006;
    font-weight: 600;
}

.toast.is-error {
    background: color-mix(in srgb, var(--danger) 20%, var(--surface-3));
    border-color: var(--danger);
}

.toast.is-leaving { animation: toast-out 0.25s ease forwards; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateY(10px) scale(0.98); }
}

/* -------------------------------------------------------------- confetti  */

.confetti-host {
    position: fixed;
    inset: 0;
    z-index: 55;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -14px;
    width: 8px;
    height: 12px;
    border-radius: 2px;
    opacity: 0;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
    100% { opacity: 0; transform: translateY(102vh) rotate(720deg); }
}

/* ---------------------------------------------------------------- misc    */

.empty {
    text-align: center;
    color: var(--muted);
    padding: 40px 16px;
    font-size: 14px;
}

.empty strong { display: block; color: var(--text); margin-bottom: 6px; font-size: 15px; }

.inline-form { display: grid; gap: 10px; margin-top: 12px; }

.split { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 0;
    padding: 6px 0;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 8px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}


/* ----------------------------------------------------------- theme picker */

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
    gap: 8px;
    margin-top: 4px;
}

.palette-chip {
    display: grid;
    justify-items: center;
    gap: 7px;
    padding: 12px 6px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-soft);
    background: var(--chip-bg, var(--surface-2));
    color: var(--chip-text, var(--text));
    font-size: 12px;
    font-weight: 600;
    transition: border-color 0.15s ease, transform 0.06s ease;
}

.palette-chip:active { transform: scale(0.97); }
.palette-chip.is-picked { border-color: var(--chip-ac); }

.chip-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--chip-ac);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

/* Each chip previews its own palette, in whichever mode is currently active.
   Keeping the values here means the picker never duplicates colours in JS. */
[data-theme="dark"]  .palette-chip[data-palette="slate"]  { --chip-bg: #0b0f14; --chip-ac: #6ea8ff; --chip-text: #e6edf3; }
[data-theme="light"] .palette-chip[data-palette="slate"]  { --chip-bg: #f4f7fb; --chip-ac: #2563eb; --chip-text: #0f1720; }
[data-theme="dark"]  .palette-chip[data-palette="pink"]   { --chip-bg: #150b10; --chip-ac: #f472b6; --chip-text: #f7eaf2; }
[data-theme="light"] .palette-chip[data-palette="pink"]   { --chip-bg: #fdf2f7; --chip-ac: #db2777; --chip-text: #2a1120; }
[data-theme="dark"]  .palette-chip[data-palette="butter"] { --chip-bg: #14100a; --chip-ac: #e0952f; --chip-text: #f7f0e2; }
[data-theme="light"] .palette-chip[data-palette="butter"] { --chip-bg: #fdf8e7; --chip-ac: #b45309; --chip-text: #2a2310; }
[data-theme="dark"]  .palette-chip[data-palette="purple"] { --chip-bg: #100c18; --chip-ac: #a78bfa; --chip-text: #eee9f8; }
[data-theme="light"] .palette-chip[data-palette="purple"] { --chip-bg: #f6f2fd; --chip-ac: #6d28d9; --chip-text: #1c1330; }
[data-theme="dark"]  .palette-chip[data-palette="powder"] { --chip-bg: #0a1016; --chip-ac: #7dd3fc; --chip-text: #e4eef6; }
[data-theme="light"] .palette-chip[data-palette="powder"] { --chip-bg: #eef6fc; --chip-ac: #0369a1; --chip-text: #0d1c28; }

.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }

.mode-btn {
    min-height: var(--tap);
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-soft);
    background: var(--surface-2);
    font-weight: 600;
    font-size: 14px;
}

.mode-btn.is-picked { border-color: var(--accent); }
