/* StrengthLogix — Tap less. Lift more.
   Dark chalk-and-iron palette, big targets, readable at arm's length with sweaty hands. */

:root {
    --bg: #0f100e;
    --surface: #1a1b18;
    --surface-2: #242521;
    --line: #34362f;
    --text: #f2f1ea;
    --muted: #9a9b90;
    --accent: #c6ff3d;      /* ready / go */
    --accent-ink: #141a00;
    --warn: #ffb547;
    --danger: #ff5a4e;
    --radius: 14px;
    --gutter: 16px;
    --display: "Bahnschrift Condensed", "Bahnschrift", "DIN Condensed", "Roboto Condensed", "sans-serif-condensed", "Arial Narrow", system-ui, sans-serif;
    --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: dark;
}

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

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.shell {
    max-width: 560px;
    margin: 0 auto;
    min-height: 100dvh;
    padding: max(env(safe-area-inset-top), 12px) var(--gutter) max(env(safe-area-inset-bottom), 24px);
    display: flex;
    flex-direction: column;
}

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.accent { color: var(--accent); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.display {
    font-family: var(--display);
    font-weight: 700;
    font-stretch: condensed;
    text-transform: uppercase;
    letter-spacing: .01em;
    line-height: .95;
    font-size: clamp(2.6rem, 13vw, 4rem);
    margin: 0;
}

.eyebrow {
    font-family: var(--display);
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .85rem;
    color: var(--muted);
    margin: 0 0 .4rem;
}

/* ---------- Top bar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    margin-bottom: 8px;
}
.topbar-title {
    font-family: var(--display);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 1.35rem;
    margin: 0;
}
.topbar-actions { display: flex; gap: 4px; }

/* Home brand header: title, slogan, then the day */
.brand { padding-top: 6px; margin-bottom: 18px; }
.brand-mark, .boot-mark {
    margin: 0;
    font-family: var(--display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    line-height: 1;
}
.brand-mark { font-size: clamp(1.7rem, 9.4vw, 2.6rem); white-space: nowrap; }
.brand-mark span, .boot-mark span { color: var(--accent); }
.brand-tag, .boot-tag {
    margin: 6px 0 0;
    font-family: var(--display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .28em;
    font-size: .78rem;
    color: var(--muted);
}

.dayrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.today { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.today-dow {
    font-family: var(--display);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 1.6rem;
    line-height: 1;
}
.today-date { color: var(--muted); font-size: .95rem; }

.icon { width: 24px; height: 24px; flex: none; }
.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 0;
    background: var(--surface);
    color: var(--text);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn-quiet { background: transparent; color: var(--muted); }
.icon-btn-spacer { width: 48px; }

/* ---------- Home ---------- */
.headline { margin: 8px 0 14px; color: var(--muted); font-size: 1.05rem; }
.headline b { font-family: var(--display); font-size: 1.4rem; }

.muscle-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }

.muscle {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "main weight" "meta meta";
    gap: 6px 12px;
    padding: 14px 16px 14px 20px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    overflow: hidden;
    transition: transform .08s ease;
}
.muscle:active { transform: scale(.985); }

.muscle-bar { position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--line); }
.muscle-main { grid-area: main; display: flex; flex-direction: column; min-width: 0; }
.muscle-name {
    font-family: var(--display);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 1.6rem;
    line-height: 1;
}
.muscle-ex { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.muscle-weight { grid-area: weight; text-align: right; align-self: start; }
.muscle-weight b { font-family: var(--display); font-size: 1.9rem; line-height: 1; }
.muscle-weight small { color: var(--muted); margin-left: 3px; }
.muscle-last { display: block; margin-top: 4px; font-size: .75rem; color: #6f7067; white-space: nowrap; }
.muscle-meta { grid-area: meta; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muscle-days { color: var(--muted); font-size: .85rem; }

.chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-family: var(--display);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: .8rem;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--muted);
}

.muscle.is-ready { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.muscle.is-ready .muscle-bar { background: var(--accent); }
.muscle.is-ready .chip { background: var(--accent); color: var(--accent-ink); }

.muscle.is-resting { opacity: .78; }
.muscle.is-done .muscle-bar { background: var(--text); }
.muscle.is-done .chip { color: var(--text); }
.muscle.is-failed .muscle-bar { background: var(--danger); }
.muscle.is-failed .chip { color: var(--danger); }
.muscle.is-done, .muscle.is-failed { opacity: .6; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 18px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    font-family: var(--display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: 1rem;
    text-align: center;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.btn-block { width: 100%; }
.btn-huge { width: 100%; min-height: 84px; font-size: 1.7rem; letter-spacing: .1em; }

.action-stack { display: grid; gap: 12px; margin-top: auto; padding-top: 20px; }

/* ---------- Test ---------- */
.test { display: flex; flex-direction: column; padding-top: 8px; }
.test-ex { margin: 8px 0 0; color: var(--muted); font-size: 1.1rem; }
.test-load { margin: 28px 0 8px; }
.test-load b { font-family: var(--display); font-size: clamp(4.5rem, 26vw, 7rem); line-height: .9; }
.test-load small { font-size: 1.3rem; color: var(--muted); margin-left: 6px; }

.test-target {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border-left: 6px solid var(--accent);
}
.target-label { font-family: var(--display); text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-size: .95rem; }
.target-value { font-family: var(--display); font-size: 2.6rem; line-height: 1; font-weight: 700; }
.target-value small { font-size: 1rem; color: var(--muted); margin-left: 6px; }

.warn { color: var(--warn); margin: 14px 0 0; }
.note-strong { color: var(--accent); margin: 14px 0 0; font-weight: 600; }

.stepper {
    display: grid;
    grid-template-columns: 80px 1fr 80px;
    gap: 10px;
    align-items: center;
    margin-top: 32px;
}
.stepper-btn {
    height: 80px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    display: grid;
    place-items: center;
}
.stepper-btn .icon { width: 34px; height: 34px; }
.stepper-btn:active { background: var(--surface-2); }
.stepper-value {
    width: 100%;
    min-width: 0;
    text-align: center;
    background: transparent;
    border: 0;
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(4.5rem, 24vw, 6.5rem);
    line-height: 1;
    -moz-appearance: textfield;
    appearance: textfield;
}
.stepper-value::-webkit-outer-spin-button, .stepper-value::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-value:focus { outline: none; color: var(--accent); }

/* ---------- Finale (after logging) ---------- */
.finale {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    margin: 0 calc(-1 * var(--gutter));
    padding: 24px var(--gutter);
    cursor: pointer;
    animation: rise .25s ease-out;
}
.finale-title {
    font-family: var(--display);
    font-weight: 700;
    text-transform: uppercase;
    font-size: clamp(3.4rem, 17vw, 5.5rem);
    line-height: .9;
    margin: 0;
}
.finale-body { font-size: 1.25rem; margin: 6px 0 0; max-width: 28ch; }
.finale-bump {
    align-self: flex-start;
    margin: 10px 0 0;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--accent-ink);
    color: var(--accent);
    font-family: var(--display);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 700;
}
.finale.is-pass { background: var(--accent); color: var(--accent-ink); }
.finale.is-pass .eyebrow, .finale.is-pass .muted { color: color-mix(in srgb, var(--accent-ink) 70%, transparent); }
.finale.is-fail .finale-title { color: var(--muted); }

.countdown {
    height: 6px;
    border-radius: 3px;
    margin-top: 24px;
    background: color-mix(in srgb, currentColor 20%, transparent);
    overflow: hidden;
    position: relative;
}
.countdown::after {
    content: "";
    position: absolute;
    inset: 0;
    background: currentColor;
    transform-origin: left;
    animation: drain var(--secs, 5s) linear forwards;
}
@keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Settings / forms ---------- */
.panel {
    display: grid;
    gap: 14px;
    padding: 16px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
}
.panel-title {
    margin: 0;
    font-family: var(--display);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 1rem;
    color: var(--muted);
}

.setting-list { list-style: none; margin: 0; padding: 0; display: grid; }
.setting-row { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row.is-off { opacity: .5; }
.setting-link { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 12px 0; }
.setting-main { display: flex; flex-direction: column; min-width: 0; }
.setting-main b { font-size: 1.05rem; }
.setting-main .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reorder { display: flex; }
.reorder .icon-btn { width: 40px; height: 44px; }

.field { display: grid; gap: 6px; font-size: .95rem; color: var(--muted); }
.field input, .field select {
    width: 100%;
    min-height: 50px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--text);
    font-size: 1.1rem;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field-inline { display: flex; align-items: center; gap: 10px; color: var(--text); }
.field-inline input { width: 84px; flex: none; }
.field-check { grid-template-columns: auto 1fr; align-items: center; color: var(--text); }
.field-check input { width: 26px; min-height: 26px; height: 26px; accent-color: var(--accent); }

.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 360px) { .button-grid { grid-template-columns: 1fr; } }
.button-grid .btn { font-size: .9rem; padding: 0 10px; }

/* ---------- Account & sync ---------- */
.account { display: flex; align-items: center; gap: 12px; }
.account-main { display: flex; flex-direction: column; min-width: 0; }
.account-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--muted); }
.sync-dot.is-ok { background: var(--accent); }
.sync-dot.is-busy { background: var(--accent); animation: pulse 1s ease-in-out infinite alternate; }
.sync-dot.is-offline { background: var(--warn); }
.sync-dot.is-problem { background: var(--danger); }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }

/* ---------- History ---------- */
.day-head {
    margin: 18px 0 6px;
    font-family: var(--display);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .95rem;
    color: var(--muted);
}
.history-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.history-row {
    display: flex;
    min-height: 56px;
    align-items: center;
    gap: 10px;
    padding: 8px 4px 8px 14px;
    border-radius: 12px;
    background: var(--surface);
    border-left: 4px solid var(--accent);
}
.history-row.is-fail { border-left-color: var(--danger); }
.history-row.is-fail .chip { color: var(--danger); }
.history-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.history-main .muted { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-result { text-align: right; white-space: nowrap; }
.history-result b { font-family: var(--display); font-size: 1.5rem; }
.history-row:active { background: var(--surface-2); }
.history-go { color: #5d5e56; display: grid; place-items: center; padding-right: 6px; }
.history-go .icon { width: 18px; height: 18px; }

/* ---------- Entry edit ---------- */
.entry-ex { margin: 0; font-size: 1.15rem; }
.field input[type="date"] { color-scheme: dark; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.segmented button {
    min-height: 46px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-family: var(--display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.segmented button.is-on { background: var(--accent); color: var(--accent-ink); }
.segmented button.is-on.is-fail { background: var(--danger); color: #1a0000; }
.stepper-compact { margin-top: 0; grid-template-columns: 64px 1fr 64px; }
.stepper-compact .stepper-btn { height: 64px; }
.stepper-compact .stepper-value { font-size: 3.2rem; color: var(--text); }

.empty { display: grid; gap: 16px; justify-items: center; text-align: center; padding: 48px 0; }

/* ---------- Boot + error UI ---------- */
.boot {
    min-height: 100dvh;
    display: grid;
    place-content: center;
    gap: 14px;
    text-align: center;
}
.boot-mark { font-size: 2.4rem; }
.boot-tag { margin: 0 0 6px; }
.boot-bar { width: 160px; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin: 0 auto; }
.boot-bar::after {
    content: "";
    display: block;
    height: 100%;
    width: var(--blazor-load-percentage, 10%);
    background: var(--accent);
    transition: width .2s;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 12px; right: 12px; bottom: 12px;
    z-index: 1000;
    padding: 14px 44px 14px 16px;
    border-radius: 12px;
    background: var(--danger);
    color: #1a0000;
    font-weight: 600;
}
#blazor-error-ui .reload { text-decoration: underline; margin-left: 6px; }
#blazor-error-ui .dismiss { position: absolute; right: 14px; top: 12px; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; }
    .countdown::after { animation-duration: var(--secs, 5s) !important; }
}
