/* ============================================================
   Status ON/OFF — dark glassmorphism theme
   ============================================================ */

:root {
    --bg:            #070a12;
    --bg-2:          #0d1220;

    --glass:         rgba(255, 255, 255, .045);
    --glass-strong:  rgba(255, 255, 255, .075);
    --stroke:        rgba(255, 255, 255, .1);
    --stroke-strong: rgba(255, 255, 255, .18);

    --text:          #f2f5ff;
    --text-dim:      rgba(226, 232, 255, .62);
    --text-faint:    rgba(226, 232, 255, .38);

    --on:            #2ce6a4;
    --on-2:          #22d3ee;
    --off:           #64748b;
    --danger:        #ff6b81;
    --warn:          #facc15;

    --radius:        26px;
    --radius-sm:     14px;

    --ease:          cubic-bezier(.22, 1, .36, 1);
    --dur:           .45s;
}

* { box-sizing: border-box; }

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

body {
    font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(20px, 5vw, 56px) clamp(16px, 4vw, 40px);
    padding-bottom: max(clamp(20px, 5vw, 56px), env(safe-area-inset-bottom));
    min-height: 100dvh;
}

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* ---------- animated background ---------- */

.bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(1200px 800px at 15% -10%, #16223d 0%, transparent 60%),
        radial-gradient(1000px 700px at 100% 100%, #131f38 0%, transparent 55%),
        linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
}

.grid {
    position: absolute;
    inset: -50%;
    background-image:
        linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 70%);
    -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 70%);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .45;
    will-change: transform;
}

.orb-1 {
    width: 42vmax; height: 42vmax;
    top: -14vmax; left: -10vmax;
    background: radial-gradient(circle, #1e7bff 0%, transparent 70%);
    animation: drift-1 22s var(--ease) infinite alternate;
}

.orb-2 {
    width: 36vmax; height: 36vmax;
    bottom: -12vmax; right: -8vmax;
    background: radial-gradient(circle, #2ce6a4 0%, transparent 70%);
    animation: drift-2 26s var(--ease) infinite alternate;
    opacity: .3;
}

.orb-3 {
    width: 28vmax; height: 28vmax;
    top: 45%; left: 55%;
    background: radial-gradient(circle, #a855f7 0%, transparent 70%);
    animation: drift-3 30s var(--ease) infinite alternate;
    opacity: .22;
}

@keyframes drift-1 { to { transform: translate3d(14vmax, 10vmax, 0) scale(1.15); } }
@keyframes drift-2 { to { transform: translate3d(-12vmax, -8vmax, 0) scale(1.1); } }
@keyframes drift-3 { to { transform: translate3d(-16vmax, 12vmax, 0) scale(.85); } }

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

.shell {
    width: 100%;
    max-width: 880px;
    animation: rise .8s var(--ease) both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- header ---------- */

.head {
    text-align: center;
    margin-bottom: clamp(28px, 5vw, 44px);
}

.head-left {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 15px 7px 12px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--stroke);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    margin-bottom: 18px;
}

.live-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--on);
    box-shadow: 0 0 0 0 rgba(44, 230, 164, .55);
    animation: pulse 2.2s ease-out infinite;
}

.live-dot.stale { background: var(--danger); animation: none; box-shadow: none; }

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(44, 230, 164, .5); }
    70%  { box-shadow: 0 0 0 9px rgba(44, 230, 164, 0); }
    100% { box-shadow: 0 0 0 0 rgba(44, 230, 164, 0); }
}

.eyebrow {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.title {
    margin: 0 0 10px;
    font-size: clamp(30px, 7vw, 50px);
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.05;
}

.hl {
    background: linear-gradient(100deg, var(--on) 0%, var(--on-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle {
    margin: 0;
    font-size: clamp(13.5px, 2.4vw, 15.5px);
    font-weight: 300;
    color: var(--text-dim);
}

/* ---------- cards ---------- */

.container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(16px, 3vw, 26px);
}

.card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: clamp(20px, 3.4vw, 30px);
    border-radius: var(--radius);
    background: var(--glass);
    border: 1px solid var(--stroke);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    box-shadow: 0 20px 50px -24px rgba(0, 0, 0, .8),
                inset 0 1px 0 rgba(255, 255, 255, .07);
    transition: transform var(--dur) var(--ease),
                border-color var(--dur) var(--ease),
                background var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease);
}

.card-glow {
    position: absolute;
    inset: -40% -20% auto -20%;
    height: 75%;
    background: radial-gradient(closest-side, rgba(44,230,164,.5), transparent);
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
    z-index: -1;
    filter: blur(28px);
}

/* OFF reads as clearly dormant: flatter, dimmer, desaturated. */
.card:not(.active) {
    background: rgba(255, 255, 255, .028);
    border-color: rgba(255, 255, 255, .07);
    filter: saturate(.55);
    opacity: .8;
}

.card.active {
    background:
        linear-gradient(150deg, rgba(44, 230, 164, .16), rgba(34, 211, 238, .07) 55%, transparent),
        var(--glass-strong);
    border-color: rgba(44, 230, 164, .55);
    filter: none;
    opacity: 1;
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .9),
                0 0 60px -10px rgba(44, 230, 164, .45),
                inset 0 1px 0 rgba(255, 255, 255, .14);
}

.card.active .card-glow { opacity: 1; }

/* soft breathing ring so the live card is unmistakable */
.card.active::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(44, 230, 164, .5);
    pointer-events: none;
    animation: ring 2.6s ease-in-out infinite;
}

@keyframes ring {
    0%, 100% { opacity: .25; transform: scale(1); }
    50%      { opacity: .8;  transform: scale(1.004); }
}

/* accent bar down the left edge of the active card */
.card.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 18%;
    bottom: 18%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(var(--on), var(--on-2));
    box-shadow: 0 0 14px rgba(44, 230, 164, .9);
}

@media (hover: hover) {
    .card:hover { transform: translateY(-4px); border-color: var(--stroke-strong); }
}

.card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.avatar {
    width: 46px; height: 46px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 15px;
    font-size: 19px;
    font-weight: 600;
    color: var(--text-dim);
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--stroke);
    transition: all var(--dur) var(--ease);
}

.card.active .avatar {
    color: #04150e;
    background: linear-gradient(140deg, var(--on), var(--on-2));
    border-color: transparent;
    box-shadow: 0 8px 22px -8px rgba(44, 230, 164, .8);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--text-faint);
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--stroke);
    transition: all var(--dur) var(--ease);
}

/* fixed width so the badge doesn't jump between Online/Offline */
.badge-text {
    display: inline-block;
    min-width: 48px;
    text-align: center;
}

.badge-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--off);
    transition: all var(--dur) var(--ease);
}

.card.active .badge {
    color: #04150e;
    font-weight: 700;
    background: linear-gradient(100deg, var(--on), var(--on-2));
    border-color: transparent;
    box-shadow: 0 6px 18px -8px rgba(44, 230, 164, .9);
}

.card.active .badge-dot {
    background: #04150e;
    box-shadow: none;
}

.name {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: clamp(19px, 3.2vw, 24px);
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--dur) var(--ease);
}

.card.active .name { color: var(--text); }

/* ---------- meta ---------- */

.meta {
    display: grid;
    gap: 8px;
    padding: 14px 15px;
    margin-bottom: 20px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, .22);
    border: 1px solid rgba(255, 255, 255, .05);
}

.meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.meta-label {
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.meta-value {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    transition: color var(--dur) var(--ease);
}

.card.active .meta-value { color: var(--text); }
.card.active .meta-value.mono { color: var(--on); }

.meta-value.warn { color: var(--warn) !important; }
.meta-value.urgent { color: var(--danger) !important; animation: blink 1.4s ease-in-out infinite; }

@keyframes blink { 50% { opacity: .45; } }

/* progress bar for a timed session */
.bar {
    height: 5px;
    margin-top: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    overflow: hidden;
}

.bar[hidden] { display: none; }

.bar span {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--on), var(--on-2));
    box-shadow: 0 0 12px rgba(44, 230, 164, .6);
    transition: width 1s linear, background .4s var(--ease);
}

.bar.warn span   { background: linear-gradient(90deg, var(--warn), #fbbf24); box-shadow: 0 0 12px rgba(250,204,21,.5); }
.bar.urgent span { background: linear-gradient(90deg, var(--danger), #f97316); box-shadow: 0 0 12px rgba(255,107,129,.6); }

/* ---------- switch (full-width segmented toggle) ---------- */

.card-foot {
    display: block;
}

.switch {
    --track-h: 58px;
    --pad: 5px;

    position: relative;
    display: block;
    width: 100%;
    height: var(--track-h);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

/* The input covers the whole track — the entire bar is the tap target. */
.switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    margin: 0;
    cursor: pointer;
    z-index: 3;
}

.slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--stroke);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, .42);
    overflow: hidden;
    transition: background var(--dur) var(--ease),
                border-color var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease);
}

/* OFF / ON labels — one per half, sitting above the knob */
.slider::before,
.slider::after {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    display: grid;
    place-items: center;
    z-index: 2;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .18em;
    pointer-events: none;
    transition: color var(--dur) var(--ease),
                opacity var(--dur) var(--ease);
}

.slider::after {
    content: "OFF";
    left: 0;
    color: #0b1220;          /* sits on the knob when off */
    opacity: 1;
}

.slider::before {
    content: "ON";
    right: 0;
    color: var(--text-faint); /* dim half when off */
    opacity: .6;
}

/* The knob is a half-width pill that slides across the track. */
.knob {
    position: absolute;
    top: var(--pad);
    left: var(--pad);
    z-index: 1;
    width: calc(50% - var(--pad));
    height: calc(var(--track-h) - var(--pad) * 2);
    border-radius: 999px;
    /* muted slate when OFF so the green ON state clearly wins the eye */
    background: linear-gradient(180deg, #8f9bb0, #64748b);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .5),
                inset 0 -2px 5px rgba(0, 0, 0, .2),
                inset 0 2px 3px rgba(255, 255, 255, .28);
    transition: transform var(--dur) var(--ease),
                background var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease),
                filter var(--dur) var(--ease);
}

/* grip lines — reads as a physical thumb pad */
.knob::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    width: 11px;
    height: 14px;
    background: linear-gradient(90deg, rgba(15, 23, 42, .3) 2px, transparent 2px) 0 0 / 4px 100%;
    opacity: .7;
}

/* ---- ON state ---- */

.switch input:checked + .slider {
    background: linear-gradient(100deg, rgba(44, 230, 164, .22), rgba(34, 211, 238, .22));
    border-color: rgba(44, 230, 164, .45);
    box-shadow: 0 0 30px -8px rgba(44, 230, 164, .7),
                inset 0 2px 8px rgba(0, 0, 0, .2);
}

.switch input:checked + .slider .knob {
    transform: translateX(100%);
    background: linear-gradient(100deg, var(--on), var(--on-2));
    box-shadow: 0 6px 20px -4px rgba(44, 230, 164, .8),
                inset 0 2px 3px rgba(255, 255, 255, .5);
}

.switch input:checked + .slider::before { color: #04150e; opacity: 1; }
.switch input:checked + .slider::after  { color: var(--text-faint); opacity: .6; }

/* ---- press feedback ---- */

.switch input:active + .slider .knob { filter: brightness(.94); }

.switch input:focus-visible + .slider {
    outline: 2px solid var(--on-2);
    outline-offset: 3px;
}

/* Redundant now that the track spells out ON/OFF, but kept for screen readers. */
.state-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- summary ---------- */

.summary {
    margin-top: clamp(22px, 4vw, 32px);
    text-align: center;
}

.summary-text {
    display: inline-block;
    padding: 11px 22px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-dim);
    background: var(--glass);
    border: 1px solid var(--stroke);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.summary-text b { color: var(--text); font-weight: 600; }
.summary-text .t { color: var(--on); font-family: "JetBrains Mono", monospace; }

/* ============================================================
   Picker sheet
   ============================================================ */

.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(4, 7, 14, .68);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fade-in .3s var(--ease) both;
}

.sheet-backdrop[hidden] { display: none; }
.sheet-backdrop.closing { animation: fade-out .25s var(--ease) both; }

@keyframes fade-in  { from { opacity: 0; } }
@keyframes fade-out { to   { opacity: 0; } }

.sheet {
    width: min(100%, 480px);
    max-height: min(88dvh, 720px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 26px;
    border-radius: 28px;
    background: linear-gradient(165deg, rgba(24, 32, 52, .96), rgba(13, 18, 32, .97));
    border: 1px solid var(--stroke-strong);
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .95),
                inset 0 1px 0 rgba(255, 255, 255, .09);
    animation: sheet-in .48s var(--ease) both;
}

.closing .sheet { animation: sheet-out .25s var(--ease) both; }

@keyframes sheet-in  { from { opacity: 0; transform: translateY(28px) scale(.97); } }
@keyframes sheet-out { to   { opacity: 0; transform: translateY(16px) scale(.98); } }

.sheet-handle { display: none; }

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.sheet-title {
    margin: 0;
    font-size: clamp(18px, 4vw, 21px);
    font-weight: 600;
    letter-spacing: -.02em;
}

.sheet-close {
    width: 38px; height: 38px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    font-size: 24px;
    line-height: 1;
    color: var(--text-dim);
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--stroke);
    border-radius: 12px;
    cursor: pointer;
    transition: all .25s var(--ease);
}

.sheet-close:hover { color: var(--text); background: rgba(255, 255, 255, .12); }

/* ---------- tabs ---------- */

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 5px;
    margin-bottom: 20px;
    border-radius: 16px;
    background: rgba(0, 0, 0, .3);
    border: 1px solid rgba(255, 255, 255, .05);
}

.tab {
    padding: 11px 10px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-faint);
    background: transparent;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    transition: all .3s var(--ease);
}

.tab:hover { color: var(--text-dim); }

.tab.active {
    color: #04150e;
    font-weight: 600;
    background: linear-gradient(100deg, var(--on), var(--on-2));
    box-shadow: 0 6px 18px -8px rgba(44, 230, 164, .8);
}

/* ---------- panes ---------- */

.pane { display: none; }
.pane.active { display: block; animation: fade-in .3s var(--ease) both; }

.chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
    margin-bottom: 18px;
}

.chip {
    padding: 13px 8px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-dim);
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--stroke);
    border-radius: 14px;
    cursor: pointer;
    transition: all .28s var(--ease);
    -webkit-tap-highlight-color: transparent;
}

.chip:hover { border-color: var(--stroke-strong); color: var(--text); }
.chip:active { transform: scale(.96); }

.chip.active {
    color: var(--on);
    font-weight: 600;
    background: rgba(44, 230, 164, .14);
    border-color: rgba(44, 230, 164, .5);
    box-shadow: 0 0 20px -8px rgba(44, 230, 164, .7);
}

.chip.sm { padding: 10px 6px; font-size: 13px; font-family: "JetBrains Mono", monospace; }

.quick {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 7px;
    margin-top: 14px;
}

/* ---------- fields ---------- */

.custom {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(0, 0, 0, .26);
    border: 1px solid rgba(255, 255, 255, .05);
}

.field { display: flex; flex-direction: column; gap: 7px; flex: 1 1 auto; }

.field label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.field input {
    width: 100%;
    padding: 13px 14px;
    font-family: "JetBrains Mono", monospace;
    font-size: 19px;
    font-weight: 600;
    text-align: center;
    color: var(--text);
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--stroke);
    border-radius: 13px;
    outline: none;
    transition: all .25s var(--ease);
    -webkit-appearance: none;
    appearance: none;
}

.field input:focus {
    border-color: rgba(44, 230, 164, .55);
    background: rgba(44, 230, 164, .07);
    box-shadow: 0 0 0 3px rgba(44, 230, 164, .12);
}

.field-time input { font-size: 24px; letter-spacing: .04em; }

/* dark time/number controls */
.field input[type="time"] { color-scheme: dark; }
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button { opacity: .4; }

.colon {
    padding-bottom: 15px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-faint);
}

/* ---------- preview + footer ---------- */

.preview {
    margin: 18px 0 20px;
    padding: 13px 16px;
    text-align: center;
    font-size: 14px;
    color: var(--text-dim);
    background: rgba(44, 230, 164, .07);
    border: 1px solid rgba(44, 230, 164, .2);
    border-radius: 14px;
}

.preview b {
    color: var(--on);
    font-family: "JetBrains Mono", monospace;
    font-weight: 600;
}

.preview.invalid {
    background: rgba(255, 107, 129, .08);
    border-color: rgba(255, 107, 129, .3);
}

.preview.invalid b { color: var(--danger); }

.sheet-foot {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 10px;
}

.btn {
    padding: 15px 16px;
    font: inherit;
    font-size: 14.5px;
    font-weight: 600;
    border-radius: 15px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .28s var(--ease);
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(.98); }

.btn.ghost {
    color: var(--text-dim);
    background: rgba(255, 255, 255, .05);
    border-color: var(--stroke);
}

.btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, .1); }

.btn.primary {
    color: #04150e;
    background: linear-gradient(100deg, var(--on), var(--on-2));
    box-shadow: 0 12px 28px -12px rgba(44, 230, 164, .9);
}

.btn.primary:hover { filter: brightness(1.07); }

.btn.primary:disabled {
    opacity: .4;
    cursor: not-allowed;
    box-shadow: none;
    filter: none;
}

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

.toast-wrap {
    position: fixed;
    left: 50%;
    bottom: max(24px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    z-index: 50;
    width: min(92vw, 400px);
    pointer-events: none;
}

.toast {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 18px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: rgba(20, 26, 42, .82);
    border: 1px solid var(--stroke-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 18px 42px -16px rgba(0, 0, 0, .9);
    animation: toast-in .45s var(--ease) both;
}

.toast.out { animation: toast-out .3s var(--ease) both; }

.toast::before {
    content: "";
    width: 8px; height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--on);
    box-shadow: 0 0 10px var(--on);
}

.toast.error { border-color: rgba(255, 107, 129, .4); }
.toast.error::before { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

@keyframes toast-in  { from { opacity: 0; transform: translateY(18px) scale(.96); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 640px) {
    /* Everything below is tuned to fit one phone screen without scrolling. */

    body { padding: 14px 14px max(14px, env(safe-area-inset-bottom)); }

    .container { grid-template-columns: 1fr; gap: 12px; }

    /* header trimmed to a single line */
    .head { margin-bottom: 16px; }
    .head-left { margin-bottom: 10px; padding: 5px 12px 5px 10px; }
    .eyebrow { font-size: 10.5px; }
    .title { font-size: 26px; margin-bottom: 0; }
    .subtitle { display: none; }

    .card { padding: 14px 16px; border-radius: 20px; }

    .card-top { margin-bottom: 10px; gap: 10px; }

    .avatar { width: 38px; height: 38px; border-radius: 12px; font-size: 16px; }

    .name { font-size: 18px; }

    /* three stats side by side instead of stacked rows */
    .meta {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 10px 12px;
        margin-bottom: 12px;
    }

    .meta-row {
        flex-direction: column;
        align-items: center;
        gap: 3px;
        text-align: center;
    }

    .meta-label { font-size: 9.5px; letter-spacing: .06em; }
    .meta-value { font-size: 13px; white-space: nowrap; }

    .bar { grid-column: 1 / -1; margin-top: 2px; }

    .summary { margin-top: 14px; }
    .summary-text { padding: 9px 16px; font-size: 12.5px; }

    .orb { filter: blur(70px); }

    .switch { --track-h: 52px; }
    .slider::before, .slider::after { font-size: 13px; }

    /* sheet docks to the bottom edge like a native action sheet */
    .sheet-backdrop { align-items: flex-end; padding: 0; }

    .sheet {
        width: 100%;
        max-width: none;
        max-height: 92dvh;
        padding: 12px 20px calc(22px + env(safe-area-inset-bottom));
        border-radius: 28px 28px 0 0;
        border-bottom: 0;
        animation: sheet-up .45s var(--ease) both;
    }

    .closing .sheet { animation: sheet-down .25s var(--ease) both; }

    @keyframes sheet-up   { from { transform: translateY(100%); } }
    @keyframes sheet-down { to   { transform: translateY(100%); } }

    .sheet-handle {
        display: block;
        width: 42px;
        height: 4px;
        margin: 0 auto 14px;
        border-radius: 999px;
        background: rgba(255, 255, 255, .22);
    }

    .tab { font-size: 12.5px; padding: 12px 6px; }
    .chips { gap: 8px; }
    .chip { padding: 14px 6px; }
    .quick { grid-template-columns: repeat(3, 1fr); }
    .btn { padding: 16px; }
}

@media (max-width: 380px) {
    .badge { padding: 5px 8px; font-size: 9.5px; }
    .badge-text { min-width: 40px; }
    .meta-value { font-size: 12.5px; }
    .name { font-size: 17px; }
    .switch { --track-h: 50px; }
    .knob::after { right: 12px; }
    .chips { grid-template-columns: repeat(2, 1fr); }
    .sheet-foot { grid-template-columns: 1fr; }
}

/* Very short viewports (small phones, or Safari with its toolbars showing) —
   drop the header chrome entirely so the two cards still fit. */
@media (max-width: 640px) and (max-height: 720px) {
    .head-left { display: none; }
    .head { margin-bottom: 12px; }
    .title { font-size: 23px; }
    .card { padding: 12px 14px; }
    .card-top { margin-bottom: 8px; }
    .avatar { width: 34px; height: 34px; border-radius: 11px; font-size: 15px; }
    .meta { padding: 8px 10px; margin-bottom: 10px; }
    .switch { --track-h: 48px; }
    .summary { margin-top: 10px; }
}

/* short landscape phones */
@media (max-height: 560px) and (orientation: landscape) {
    body { align-items: flex-start; }
    .head { margin-bottom: 20px; }
    .subtitle { display: none; }
    .sheet-backdrop { align-items: center; padding: 12px; }
    .sheet { border-radius: 24px; max-height: 94dvh; }
}

@media (min-width: 1100px) {
    .shell { max-width: 940px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
