:root {
  --bg: #0b1118;
  --panel: #121c27;
  --panel-2: #172331;
  --line: rgba(255,255,255,.09);
  --text: #f5f7f9;
  --muted: #91a0ae;
  --accent: #ef3f4c;
  --accent-2: #ff5964;
  --rest: #09364a;
  --rest-bright: #0b5260;
  --green: #35d29a;
  --shadow: 0 22px 60px rgba(0,0,0,.35);
  --radius: 20px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background:
  radial-gradient(circle at 70% -20%, rgba(37,80,108,.24), transparent 42%), var(--bg); }
button, input, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }

.topbar { min-height: 98px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { min-height: 34px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: #b9c5ce; background: rgba(255,255,255,.025); font-size: 12px; font-weight: 750; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; background: linear-gradient(145deg, var(--accent-2), #b8122d); box-shadow: 0 7px 22px rgba(239,63,76,.28); font-weight: 900; letter-spacing: -.08em; padding-right: 3px; }
.brand h1 { font-size: 19px; margin: 0 0 3px; letter-spacing: -.02em; }
.brand p { color: var(--muted); font-size: 13px; margin: 0; }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--line); background: var(--panel); border-radius: 13px; display: grid; place-items: center; cursor: pointer; transition: .2s; }
.icon-button:hover { background: var(--panel-2); transform: translateY(-1px); }
.icon-button svg { width: 20px; fill: #bdc7d0; }

.hero { padding: 64px 0 30px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.eyebrow { display: block; color: var(--accent-2); font-weight: 800; letter-spacing: .16em; font-size: 11px; margin-bottom: 10px; }
.hero h2 { margin: 0 0 7px; font-size: clamp(32px, 5vw, 48px); letter-spacing: -.045em; line-height: 1; }
.hero p { color: var(--muted); margin: 0; font-size: 16px; }

.button { border: 0; border-radius: 13px; min-height: 48px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 750; cursor: pointer; transition: transform .16s, background .16s, opacity .16s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.primary { background: var(--accent); color: white; box-shadow: 0 10px 24px rgba(239,63,76,.22); }
.button.primary:hover { background: var(--accent-2); }
.button.ghost { background: var(--panel-2); border: 1px solid var(--line); color: #dce3e8; box-shadow: none; }
.button.small { min-height: 38px; border-radius: 10px; padding: 0 13px; font-size: 13px; }
.button.large { min-width: 180px; min-height: 56px; font-size: 17px; }

/* Authentication */
.auth-view { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; background: radial-gradient(circle at 50% 8%, rgba(239,63,76,.12), transparent 32%), var(--bg); }
.auth-card { width: min(470px, 100%); padding: 30px; border: 1px solid rgba(255,255,255,.11); border-radius: 24px; background: linear-gradient(145deg, rgba(23,35,49,.98), rgba(13,22,31,.98)); box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 15px; padding-bottom: 25px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.auth-brand h1 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.025em; }
.auth-brand p, .auth-copy { color: var(--muted); font-size: 13px; line-height: 1.55; margin: 0; }
.auth-card h2 { margin: 0 0 10px; font-size: 31px; letter-spacing: -.04em; }
.auth-copy { margin-bottom: 21px; }
.auth-form .button { width: 100%; margin-top: 3px; }
.auth-link { display: block; margin: 19px auto 0; border: 0; background: transparent; color: #b8c5cf; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.security-warning { margin-top: 19px; padding: 11px 13px; border: 1px solid rgba(255,190,78,.25); border-radius: 10px; background: rgba(255,190,78,.075); color: #f1cb83; font-size: 11px; line-height: 1.5; }

.connection-banner { padding: 12px 16px; border: 1px solid rgba(255,189,67,.25); background: rgba(255,189,67,.08); color: #ffd47d; border-radius: 12px; margin-bottom: 18px; font-size: 14px; }
.workout-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 8px 0 70px; }
.workout-card { background: linear-gradient(145deg, rgba(24,37,51,.95), rgba(15,25,35,.96)); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; min-height: 220px; display: flex; flex-direction: column; box-shadow: 0 12px 30px rgba(0,0,0,.14); transition: border .2s, transform .2s; }
.workout-card:hover { border-color: rgba(255,255,255,.16); transform: translateY(-2px); }
.card-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.workout-card h3 { margin: 0 0 8px; font-size: 22px; letter-spacing: -.025em; }
.workout-duration { color: #8fa0ad; font-size: inherit; font-weight: 650; white-space: nowrap; }
.card-meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px; }
.card-meta span + span::before { content: "•"; margin-right: 8px; color: #4c5c6a; }
.exercise-preview { margin: 20px 0 22px; color: #c5cdd4; font-size: 14px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-actions { display: flex; align-items: center; gap: 9px; margin-top: auto; }
.card-actions .start { flex: 1; }
.card-menu { display: flex; gap: 6px; }
.mini-button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.035); color: #9eacb8; display: grid; place-items: center; cursor: pointer; }
.mini-button:hover { color: white; background: rgba(255,255,255,.08); }
.mini-button.delete:hover { color: #ff7780; border-color: rgba(255,82,96,.3); }
.empty-state { margin: 15px auto 70px; max-width: 560px; text-align: center; padding: 64px 20px; border: 1px dashed rgba(255,255,255,.16); border-radius: 24px; background: rgba(255,255,255,.018); }
.empty-icon { width: 62px; height: 62px; margin: 0 auto 20px; border-radius: 18px; display: grid; place-items: center; font-size: 30px; color: var(--accent-2); background: rgba(239,63,76,.1); }
.empty-state h3 { margin: 0 0 8px; font-size: 24px; }
.empty-state p { color: var(--muted); margin: 0 0 24px; }

/* Active workout */
.active-view { min-height: 100vh; min-height: 100dvh; width: 100%; padding: max(18px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left)); display: grid; grid-template-rows: auto auto 1fr auto auto auto; justify-items: center; background:
  radial-gradient(circle at 50% 37%, rgba(255,70,80,.17), transparent 31%),
  linear-gradient(150deg, #240e15 0%, #110d13 52%, #0a1016 100%); overflow: hidden; position: relative; }
.active-view.phase-rest { background: radial-gradient(circle at 50% 37%, rgba(26,154,177,.17), transparent 33%), linear-gradient(150deg, #082b3a 0%, #071c2a 52%, #081119 100%); }
.active-view.phase-break { background: radial-gradient(circle at 50% 37%, rgba(157,116,255,.18), transparent 34%), linear-gradient(150deg, #28203e 0%, #17142a 52%, #0b1119 100%); }
.active-view.rest-urgent { animation: urgent-bg 1s ease-in-out infinite; }
@keyframes urgent-bg { 50% { background-color: #164351; filter: saturate(1.28) brightness(1.15); } }
.active-topline { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.active-topline > div { display: flex; align-items: center; gap: 14px; }
.active-top-actions { gap: 8px !important; }
.active-workout-name { font-size: 16px; font-weight: 700; color: rgba(255,255,255,.82); }
.sync-indicator { color: #9eb0bd; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; display: inline-flex; align-items: center; gap: 6px; }
.sync-indicator i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px var(--green); }
.active-close { width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.1); background: rgba(0,0,0,.15); border-radius: 50%; cursor: pointer; font-size: 24px; color: rgba(255,255,255,.65); }
.active-utility-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.1); background: rgba(0,0,0,.15); border-radius: 50%; cursor: pointer; color: rgba(255,255,255,.68); }
.active-utility-button:hover, .active-close:hover { color: white; background: rgba(255,255,255,.08); }
.active-utility-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.workout-time-metrics { position: absolute; z-index: 2; top: max(68px, calc(env(safe-area-inset-top) + 58px)); left: max(28px, env(safe-area-inset-left)); right: max(28px, env(safe-area-inset-right)); display: flex; justify-content: space-between; pointer-events: none; }
.workout-time-metric { display: flex; flex-direction: column; gap: 2px; }
.workout-time-metric span { color: rgba(255,255,255,.46); font-size: 10px; letter-spacing: .15em; font-weight: 850; }
.workout-time-metric strong { font-size: clamp(24px, 3vw, 38px); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.remaining-metric { align-items: flex-end; text-align: right; }
.workout-time-metric small { min-height: 16px; color: #ffcf78; font-size: 11px; font-weight: 750; }
.phase-pill { margin-top: 2.5vh; background: var(--accent); box-shadow: 0 8px 28px rgba(239,63,76,.35); border-radius: 999px; padding: 8px 24px 7px; font-size: clamp(18px, 2.5vw, 28px); letter-spacing: .18em; font-weight: 950; text-indent: .18em; }
.phase-rest .phase-pill { background: #20a6af; box-shadow: 0 8px 28px rgba(32,166,175,.28); }
.phase-break .phase-pill { background: #8c68e8; box-shadow: 0 8px 28px rgba(140,104,232,.32); }
.timer { align-self: center; font-variant-numeric: tabular-nums; font-size: clamp(112px, 24vw, 310px); line-height: .86; font-weight: 900; letter-spacing: -.075em; text-shadow: 0 10px 50px rgba(0,0,0,.35); margin-left: -.06em; }
.paused-label { position: absolute; top: 43%; color: #ffdc84; background: rgba(8,12,16,.85); border: 1px solid rgba(255,220,132,.3); border-radius: 999px; padding: 10px 25px; font-weight: 900; letter-spacing: .15em; }
.active-details { text-align: center; margin-top: -1vh; }
.active-details h2 { font-size: clamp(28px, 4.6vw, 54px); letter-spacing: -.04em; margin: 0 0 8px; }
.set-weight-line { color: #cad4db; font-size: clamp(17px, 2.1vw, 24px); display: flex; justify-content: center; gap: 12px; }
.dot { color: rgba(255,255,255,.27); }
.progress-wrap { width: min(740px, 88vw); margin: 2vh 0 1.4vh; }
.progress-labels { display: flex; justify-content: space-between; color: rgba(255,255,255,.55); font-size: 11px; letter-spacing: .12em; margin-bottom: 9px; }
.progress-labels strong { color: rgba(255,255,255,.8); font-weight: 700; letter-spacing: 0; }
.progress-track { height: 6px; background: rgba(255,255,255,.12); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: inherit; background: var(--accent-2); transition: width .3s; }
.phase-rest .progress-bar { background: #38cad0; }
.next-card { width: min(560px, 88vw); display: flex; gap: 20px; align-items: center; padding: 14px 20px; border-radius: 15px; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.08); }
.next-label { color: rgba(255,255,255,.44); font-size: 10px; letter-spacing: .15em; font-weight: 800; }
.next-card div { flex: 1; display: flex; justify-content: space-between; gap: 15px; }
.next-card strong { font-size: 14px; }
.next-card div span { font-size: 13px; color: #9aaab6; }
.active-controls { display: flex; flex-direction: column; align-items: center; margin-top: 1.6vh; gap: 8px; }
.pause-button { min-width: 220px; min-height: 58px; border: 0; border-radius: 16px; color: #11171e; background: white; font-weight: 850; font-size: 17px; display: flex; align-items: center; justify-content: center; gap: 12px; cursor: pointer; box-shadow: 0 12px 35px rgba(0,0,0,.24); }
.pause-icon { font-weight: 950; letter-spacing: -.16em; }
.secondary-controls { display: flex; align-items: center; justify-content: center; gap: 4px; }
.secondary-controls button { border: 0; background: transparent; color: rgba(255,255,255,.55); font-size: 12px; padding: 8px 12px; cursor: pointer; }
.secondary-controls button:hover { color: white; }
.secondary-controls .danger-text:hover { color: #ff8d94; }

#rest-over-flash { position: fixed; inset: 0; z-index: 1000; pointer-events: none; opacity: 0; background: white; }
#rest-over-flash.go { animation: full-flash var(--flash-time, 2s) ease-out; }
@keyframes full-flash { 0%, 18%, 38% { opacity: .93; } 9%, 28%, 52% { opacity: .05; } 100% { opacity: 0; } }

.complete-view { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; background: radial-gradient(circle, rgba(53,210,154,.16), transparent 42%), #09131a; }
.complete-burst { width: 112px; height: 112px; border-radius: 50%; background: var(--green); color: #072218; display: grid; place-items: center; font-size: 58px; font-weight: 900; box-shadow: 0 0 0 14px rgba(53,210,154,.08), 0 0 80px rgba(53,210,154,.25); margin-bottom: 40px; animation: arrive .55s cubic-bezier(.16,1.4,.5,1); }
@keyframes arrive { from { transform: scale(.3) rotate(-18deg); opacity: 0; } }
.complete-view .eyebrow { color: var(--green); }
.complete-view h2 { font-size: clamp(50px, 9vw, 100px); line-height: 1; letter-spacing: -.06em; margin: 5px 0 15px; }
.complete-view p { color: var(--muted); font-size: 18px; margin: 0 0 36px; }

.fullscreen-help-panel { width: min(470px, 100%); padding: 32px; overflow: visible; }
.fullscreen-help-close { position: absolute; top: 16px; right: 16px; }
.fullscreen-help-icon { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 17px; color: #e7dcff; background: rgba(140,104,232,.18); }
.fullscreen-help-icon svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fullscreen-help-panel h2 { margin: 0 36px 10px 0; font-size: 30px; letter-spacing: -.04em; }
.fullscreen-help-panel > p { margin: 0 0 21px; color: var(--muted); line-height: 1.5; }
.fullscreen-help-panel ol { margin: 0 0 25px; padding-left: 23px; color: #cbd5dc; }
.fullscreen-help-panel li { padding: 5px 0 5px 4px; line-height: 1.45; }
.fullscreen-help-panel .button { width: 100%; }

/* Modals and forms */
.modal { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 22px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(1,5,9,.79); backdrop-filter: blur(8px); }
.modal-panel { position: relative; z-index: 1; width: min(760px, 100%); max-height: calc(100vh - 44px); overflow: auto; background: #101a24; border: 1px solid rgba(255,255,255,.12); border-radius: 22px; box-shadow: var(--shadow); }
.editor-panel { width: min(860px, 100%); }
.modal-header { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 25px 28px 20px; background: rgba(16,26,36,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.modal-header h2 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.modal-header .eyebrow { margin-bottom: 6px; }
.modal-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255,255,255,.06); color: #aeb9c2; font-size: 27px; cursor: pointer; }
form { margin: 0; }
#workout-form, #settings-form { padding: 24px 28px 0; }
.form-row, .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 17px; }
.field > span { font-size: 12px; color: #b5c0c8; font-weight: 750; letter-spacing: .02em; }
.field small { color: #657582; font-size: 11px; line-height: 1.45; }
input, select { width: 100%; min-height: 47px; border: 1px solid rgba(255,255,255,.1); border-radius: 11px; background: #0a131c; color: var(--text); padding: 0 13px; outline: none; }
input:focus, select:focus { border-color: rgba(255,89,100,.58); box-shadow: 0 0 0 3px rgba(239,63,76,.1); }
.suffix-input { position: relative; }
.suffix-input input { padding-right: 48px; }
.suffix-input i { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: #637481; font-size: 12px; font-style: normal; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 14px 0 13px; }
.section-heading h3, .settings-section h3 { margin: 0 0 4px; font-size: 16px; }
.section-heading p, .settings-section > p, .toggle-line p { color: var(--muted); margin: 0; font-size: 12px; }
.exercise-list { display: flex; flex-direction: column; gap: 11px; }
.workout-break-line { min-height: 48px; display: grid; grid-template-columns: 1fr auto 125px 1fr; align-items: center; gap: 11px; padding: 1px 8px; }
.workout-break-line > span { color: #b69cf5; font-size: 10px; font-weight: 900; letter-spacing: .15em; white-space: nowrap; }
.workout-break-line .suffix-input input { min-height: 38px; border-color: rgba(182,156,245,.22); background: rgba(140,104,232,.07); }
.break-rule { height: 1px; background: linear-gradient(90deg, transparent, rgba(182,156,245,.32)); }
.break-rule:last-child { background: linear-gradient(90deg, rgba(182,156,245,.32), transparent); }
.exercise-row { border: 1px solid var(--line); background: rgba(255,255,255,.022); border-radius: 14px; padding: 15px; }
.exercise-row.is-grouped { border-left: 3px solid #34c2c9; background: linear-gradient(90deg, rgba(52,194,201,.07), rgba(255,255,255,.022) 34%); }
.exercise-row.is-grouped + .exercise-row.is-grouped { margin-top: -7px; }
.group-label { display: flex; align-items: center; gap: 10px; margin: -15px -15px 14px -13px; padding: 10px 14px; border-radius: 11px 13px 0 0; background: rgba(52,194,201,.09); border-bottom: 1px solid rgba(52,194,201,.18); }
.group-label span { color: #55d8de; font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.group-label strong { color: #9ab7bd; font-size: 11px; font-weight: 650; }
.exercise-main { display: grid; grid-template-columns: 40px minmax(150px, 1.8fr) .55fr .7fr .55fr 42px; gap: 10px; align-items: end; }
.exercise-main .field { margin: 0; }
.order-buttons { display: flex; flex-direction: column; gap: 4px; align-self: center; }
.order-buttons button, .remove-exercise { width: 32px; height: 25px; border: 0; border-radius: 7px; background: rgba(255,255,255,.06); color: #82929f; cursor: pointer; }
.remove-exercise { height: 42px; width: 42px; font-size: 19px; color: #a9787e; }
.order-buttons button:hover, .remove-exercise:hover { color: white; background: rgba(255,255,255,.1); }
.exercise-tools { min-height: 30px; display: flex; align-items: center; gap: 15px; padding: 11px 0 0 41px; }
.more-options { border: 0; background: none; color: #8fa2b0; font-size: 12px; padding: 0; cursor: pointer; }
.more-options:hover { color: white; }
.group-toggle { border: 1px solid rgba(255,255,255,.09); border-radius: 8px; background: rgba(255,255,255,.035); color: #91a3b0; min-height: 28px; padding: 0 10px; font-size: 11px; cursor: pointer; }
.group-toggle:hover { color: white; background: rgba(255,255,255,.07); }
.group-toggle.linked { color: #65dce1; border-color: rgba(52,194,201,.28); background: rgba(52,194,201,.08); }
.group-toggle:disabled { opacity: .42; cursor: not-allowed; }
.group-hint { color: #5f707d; font-size: 10px; }
.exercise-extra { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; padding: 13px 0 0 41px; }
.exercise-extra .field { margin-bottom: 0; }
.set-weights-panel { grid-column: 1 / -1; padding: 13px; border: 1px solid rgba(255,255,255,.075); border-radius: 11px; background: rgba(0,0,0,.13); }
.set-weights-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.set-weights-heading strong { font-size: 12px; color: #c5d0d7; }
.set-weights-heading span { color: #6f818f; font-size: 10px; line-height: 1.4; text-align: right; }
.set-weights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(115px, 1fr)); gap: 9px; }
.set-weights-grid .field { min-width: 0; }
.set-weights-grid input { min-height: 41px; font-size: 13px; }
.override-wrap { position: relative; }
.override-wrap input { padding-right: 72px; }
.override-wrap i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #5e7180; font-style: normal; font-size: 11px; }
.modal-footer { position: sticky; bottom: 0; z-index: 4; margin: 24px -28px 0; padding: 18px 28px; display: flex; justify-content: flex-end; gap: 10px; background: rgba(16,26,36,.97); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
.settings-section { padding: 5px 0 22px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.settings-section > p { margin-bottom: 17px; }
.settings-grid.compact { width: 70%; }
.toggle-line { display: flex; justify-content: space-between; align-items: center; margin-bottom: 17px; }
.switch { position: relative; width: 48px; height: 28px; }
.switch input { opacity: 0; width: 1px; height: 1px; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #293744; cursor: pointer; transition: .2s; }
.switch span::after { content: ""; width: 20px; height: 20px; position: absolute; top: 4px; left: 4px; border-radius: 50%; background: white; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.test-result { font-size: 12px; color: var(--green); margin-left: 10px; }
.account-section h4 { margin: 18px 0 11px; font-size: 13px; color: #c8d2da; }
.invite-result { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-top: 12px; padding: 13px; border: 1px solid rgba(53,210,154,.18); border-radius: 11px; background: rgba(53,210,154,.055); }
.invite-result span { grid-column: 1 / -1; color: #9badb8; font-size: 11px; }
.invite-result input { min-height: 39px; font-size: 11px; }
.change-password { padding-top: 2px; }
.account-section #logout-button { margin-top: 10px; }

.toast { position: fixed; z-index: 2000; left: 50%; bottom: 28px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; background: #eef3f5; color: #101820; border-radius: 12px; padding: 12px 18px; font-weight: 700; font-size: 13px; box-shadow: var(--shadow); transition: .24s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { color: #8e1724; background: #ffe7e9; }

@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 1120px); }
  .topbar { min-height: 82px; }
  .hero { padding: 42px 0 24px; align-items: start; flex-direction: column; }
  .hero .button { width: 100%; }
  .workout-grid { grid-template-columns: 1fr; gap: 12px; }
  .workout-card { min-height: 205px; }
  .modal { padding: 0; align-items: end; }
  .modal-panel { max-height: 94vh; border-radius: 22px 22px 0 0; border-bottom: 0; }
  .modal-header, #workout-form, #settings-form { padding-left: 18px; padding-right: 18px; }
  .modal-footer { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }
  .exercise-main { grid-template-columns: 32px minmax(0, 1fr) 74px 42px; }
  .exercise-main .weight-field { grid-column: 2 / 3; }
  .exercise-main .unit-field { grid-column: 3 / 4; }
  .exercise-main .remove-exercise { grid-column: 4 / 5; grid-row: 1 / 2; }
  .exercise-main .sets-field { grid-column: 3 / 4; grid-row: 1 / 2; }
  .exercise-tools, .exercise-extra { padding-left: 32px; }
  .exercise-tools { align-items: flex-start; flex-direction: column; gap: 9px; }
  .group-label { align-items: flex-start; flex-direction: column; gap: 3px; }
  .form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-row.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workout-time-metrics { left: 16px; right: 16px; }
  .active-view { padding-left: 16px; padding-right: 16px; grid-template-rows: auto auto 1fr auto auto auto; }
  .active-top-actions { gap: 5px !important; }
  .active-utility-button, .active-close { width: 39px; height: 39px; }
  .phase-pill { margin-top: 2.5vh; }
  .timer { font-size: clamp(96px, 31vw, 170px); }
  .active-details h2 { font-size: clamp(27px, 9vw, 42px); }
  .progress-wrap { margin-top: 2.2vh; }
  .next-card { width: 94vw; }
  .pause-button { min-height: 55px; }
  .active-controls { margin-top: 2vh; }
  .fullscreen-help-panel { padding: 28px 22px max(28px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; }
}

@media (min-width: 761px) and (max-height: 800px) {
  .active-view { height: 100dvh; min-height: 0; padding-top: 12px; padding-bottom: 8px; }
  .phase-pill { margin-top: 1.2vh; padding-top: 7px; padding-bottom: 7px; }
  .timer { font-size: clamp(106px, 18vw, 220px); }
  .active-details h2 { font-size: clamp(28px, 4vw, 46px); }
  .progress-wrap { margin-top: .7vh; margin-bottom: .7vh; }
  .next-card { padding-top: 9px; padding-bottom: 9px; }
  .active-controls { margin-top: .7vh; gap: 2px; }
  .pause-button { min-height: 48px; }
  .secondary-controls button { padding-top: 5px; padding-bottom: 5px; }
}

@media (max-width: 470px) {
  .brand p { display: none; }
  .user-chip { max-width: 94px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .brand h1 { font-size: 17px; }
  .hero h2 { font-size: 36px; }
  .form-row, .form-row.three, .form-row.four, .settings-grid, .exercise-extra { grid-template-columns: 1fr; }
  .workout-break-line { grid-template-columns: 1fr 115px; gap: 8px; padding-left: 2px; padding-right: 2px; }
  .workout-break-line .break-rule { display: none; }
  .workout-break-line > span { grid-column: auto; text-align: left; margin: 0; }
  .workout-time-metric span { font-size: 8px; }
  .workout-time-metric strong { font-size: 23px; }
  .set-weights-heading { align-items: flex-start; flex-direction: column; }
  .set-weights-heading span { text-align: left; }
  .invite-result { grid-template-columns: 1fr; }
  .invite-result span { grid-column: auto; }
  .settings-grid.compact { width: 100%; }
  .section-heading { align-items: start; gap: 10px; }
  .section-heading p { display: none; }
  .active-topline .sync-indicator { display: none; }
  .timer { font-size: 30vw; }
  .next-card div { flex-direction: column; gap: 2px; }
  .secondary-controls button { padding: 7px 8px; font-size: 11px; }
}

@media (orientation: landscape) and (max-height: 650px) {
  .active-view { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto 1fr auto; column-gap: 35px; }
  .active-topline { grid-column: 1 / 3; }
  .phase-pill { grid-column: 1; margin-top: 2vh; }
  .timer { grid-column: 1; grid-row: 3; font-size: 18vw; }
  .active-details { grid-column: 2; grid-row: 2; align-self: end; }
  .progress-wrap { grid-column: 2; grid-row: 3; align-self: start; width: 44vw; }
  .next-card { grid-column: 2; grid-row: 3; align-self: center; width: 44vw; }
  .active-controls { grid-column: 1 / 3; grid-row: 4; margin-top: 0; flex-direction: row; }
}

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