/* Full Rep / One more rep.
   Presentation layer only. Screen state, IDs and workout geometry are owned
   by the original application. Keep this stylesheet after its base styles. */
@import url('./fonts.css');

:root {
  --bg: #111217;
  --surface: #272838;
  --surface2: #303142;
  --line: #444657;
  --border: var(--line);
  --text: #eafff5;
  --dim: #b8bacb;
  --faint: #b8bacb;
  --accent: #e4ff1a;
  --energy: #e4ff1a;
  --ink: #111217;
  --radius: 24px;
  --brand-font: 'Nunito Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: dark;
}
html, body, button, input, textarea, select,
.btn, .tab, .setup-toggle, .lb-viewall, .lb-back-btn, .lb-search,
.lb-tab-btn, .follow-btn, .challenge-btn, .duel-mode-card, .duel-target-btn,
.duel-decline-btn, .voice-toggle, .auth-input, .auth-link, .account-btn,
#nameInput, #reminderTime, #resumeBtn, #restEndBtn, .fr-cta-btn {
  font-family: var(--brand-font);
}
body { background: var(--bg); }
button, a, input, textarea { touch-action: manipulation; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid #e4ff1a; outline-offset: 4px;
}
input, textarea, select { font-size: 16px; }
.screen { background: var(--bg); }
/* Preserve the native shell's light status icons above a dark safe area. */
.screen::after {
  content: ''; position: fixed; top: 0; left: 0; right: 0;
  height: env(safe-area-inset-top); background: var(--ink);
  pointer-events: none; z-index: 70;
}
#workoutScreen::after { display: none; }
#startScreen, #historyScreen, #profileScreen, #leaderboardScreen,
#userScreen, #notifScreen, #userListScreen {
  background: var(--bg);
  padding-top: calc(22px + env(safe-area-inset-top));
}
#startScreen::before, #historyScreen::before, #profileScreen::before,
#leaderboardScreen::before { display: none; }
#startScreen, #historyScreen, #profileScreen { padding-left: 22px; padding-right: 22px; }
#startScreen { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
#startScreen > *, #historyScreen > *, #profileScreen > * { max-width: 520px; }
#historyScreen > *, #profileScreen > * { flex-shrink: 0; }
.top-row { gap: 10px; }
.wordmark { gap: 8px !important; font-size: 28px; font-style: normal; font-weight: 900; letter-spacing: -1.5px; white-space: nowrap; }
.wordmark img { height: 32px !important; width: 32px !important; border-radius: 10px; }
.wordmark .brand-name { color: var(--text); font-weight: 900; }
.avatar, .bell-btn { width: 42px; height: 42px; flex-shrink: 0; background: var(--surface); border: 1px solid var(--line); }
.bell-btn { margin: 0 0 0 auto; color: var(--text); }
.bell-btn svg { width: 19px; height: 19px; }
.avatar { overflow: hidden; }
.avatar img:not(.user-photo) { border-radius: 6px; }
.notif-badge { background: var(--energy); color: var(--text); border: 2px solid var(--bg); height: 20px; min-width: 20px; }
.micro, .section-h, .field-label { font-size: 11px; font-weight: 800; letter-spacing: .09em; }
.hero { margin-top: 32px; }
.hero .micro { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: #b8bacb; }
.hero .micro::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #e4ff1a; }
.hero h1 { font-size: clamp(42px, 12vw, 62px); font-weight: 900; letter-spacing: -.055em; line-height: .99; }
.hero h1 em { font-style: italic; }
.hero-copy { max-width: 290px; color: var(--dim); font-size: 15px; line-height: 1.5; margin-top: 14px; }
.hero .pr-inline { font-size: 13px !important; margin-top: 12px !important; }
.hero .pr-inline b { color: var(--text); }

/* Today is the visual anchor; its local tokens keep every dynamic label legible. */
.today-card {
  --surface: #303142; --line: #444657; --text: #eafff5;
  --dim: #b8bacb; --faint: #b8bacb; --accent: var(--energy);
  background: var(--ink); color: var(--text); border: 0;
  padding: 23px; margin-top: 26px; border-radius: 26px;
}
.today-row { gap: 12px; }
.today-row .micro { font-size: 10px; }
.today-stats { display: grid; grid-template-columns: 1.12fr 1fr 1fr; gap: 12px; margin-top: 22px; }
.today-stat .num { font-size: 36px; line-height: 1; letter-spacing: -.04em; }
.today-stat:first-child .num { color: var(--energy); }
.today-stat .lbl { font-size: 10px; letter-spacing: .01em; text-transform: none; font-weight: 700; margin-top: 7px; }
.goal-bar-outer { height: 8px; margin-top: 22px; }
.goal-caption { margin-top: 10px; font-size: 12px; }
.lb-preview { padding: 20px; margin-top: 16px; border: 1px solid var(--line); border-radius: 22px; }
.lb-viewall { color: var(--text); font-size: 11px; letter-spacing: 0; text-transform: none; min-height: 32px; white-space: nowrap; }
.lb-row { padding: 13px 0; }
.lb-reps { font-size: 18px; }
.lb-name, .lb-entry-name { font-weight: 800; }
.lb-title { opacity: 1; color: var(--dim); line-height: 1.5; font-weight: 600; }
.lb-loading, .lb-empty { text-transform: none; letter-spacing: 0; padding: 22px 0; line-height: 1.5; }
.lb-rank.gold, .lb-entry-rank.gold { color: #e4ff1a; }
.lb-rank.silver, .lb-entry-rank.silver { color: #bbb8d5; }
.lb-rank.bronze, .lb-entry-rank.bronze { color: #e6a87e; }
.setup-list { margin-top: 24px; }
.setup-toggle { text-transform: none; letter-spacing: 0; color: var(--text); font-size: 15px; padding: 17px 0; border-top: none; }
.setup-item { gap: 12px; padding: 18px 0; }
.setup-item .n { color: #e4ff1a; background: #303142; border-radius: 8px; padding: 5px 0; text-align: center; flex-basis: 28px; }
.setup-item p { font-size: 13px; }
.setup-item img { width: 96px; flex-basis: 96px; border-radius: 12px; background: var(--ink); filter: none; }
#loadStatus { font-size: 12px; line-height: 1.4; }
.home-spacer { height: 12px; }

/* Fixed actions retain the same event hooks and screen visibility rules. */
.btn { font-size: 16px; font-weight: 900; letter-spacing: -.01em; border-radius: 18px; min-height: 56px; padding: 17px 22px; }
.btn-primary, .btn-auth-primary, #duelSendBtn, #duelResultDone {
  background: var(--energy); color: var(--text); border: 1px solid transparent;
}
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.cta-dock { width: calc(100% - 44px); max-width: 520px; bottom: calc(92px + env(safe-area-inset-bottom)); }
#startScreen > .cta-dock { width: calc(100% - 44px); }
.cta-dock::before { content: ''; position: absolute; inset: -18px -22px -14px; background: linear-gradient(transparent, var(--bg) 35%); z-index: -1; pointer-events: none; }
.cta-dock .btn-primary { box-shadow: 0 4px 12px #11121712; text-align: left; padding-left: 23px; }
#startBtn::after { content: '↗'; float: right; font-size: 24px; line-height: 22px; font-weight: 700; }
.tabbar {
  left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
  max-width: 540px; margin: 0 auto; padding: 8px 6px;
  background: var(--ink); border: 0; border-radius: 24px; box-shadow: 0 5px 20px #11121718;
  backdrop-filter: none;
}
.tab { flex: 1; min-width: 0; padding: 8px 2px; color: #b8bacb; gap: 4px; font-size: 10px; border-radius: 17px; }
.tab svg { width: 21px; height: 21px; }
.tab.active { background: var(--energy); color: var(--text); }
.tab:focus-visible { outline-color: var(--energy); }

/* Progress and personal profile */
.screen-title { font-size: 38px; letter-spacing: -.045em; line-height: 1.15; }
.screen-kicker { font-size: 11px; font-weight: 800; color: var(--dim); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 9px; }
.history-totals { line-height: 1.6; margin-top: 10px; margin-bottom: 28px; }
.week-chart { height: 166px; padding: 18px 12px 12px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); margin: 8px 0 24px; gap: 8px; }
.week-bar { max-width: 36px; border-radius: 7px 7px 3px 3px; background: #444657; }
.week-bar.filled { background: var(--energy); }
.week-bar.today-bar { outline: none; background: var(--ink); }
.week-day, .week-num { color: var(--dim); font-size: 10px; }
.week-col { position: relative; padding-top: 20px; padding-bottom: 20px; }
.week-bar, .week-num { flex-shrink: 0; }
.week-day { position: absolute; bottom: 0; }
.session-row { background: var(--surface); padding: 18px; border: 1px solid var(--line); border-radius: 18px; margin-top: 10px; gap: 12px; }
.session-row:first-child { border-top: 1px solid var(--line); }
.session-row .reps { background: #303142; padding: 4px 12px; border-radius: 12px; font-size: 25px; }
.empty-msg { padding: 24px; background: var(--surface); border: 1px dashed #444657; border-radius: 22px; text-align: center; }
.profile-head { margin-top: 24px; }
.profile-avatar, .up-avatar, .ep-avatar { background: #303142; border: 0; }
.profile-avatar img:not(.user-photo), .up-avatar .fr { border-radius: 10px; }
.profile-name { font-size: 26px; font-weight: 900; }
.profile-name, .up-name { overflow-wrap: anywhere; }
.profile-head > div:last-child, .up-head > div:last-child { min-width: 0; }
.profile-bio { line-height: 1.6; }
.section-h { margin-top: 30px; margin-bottom: 12px; }
.account-card { padding: 18px; gap: 12px; border-radius: 20px; }
.account-card > div { min-width: 0; }
#profileScreen > .account-card:has(#reminderTime) { flex-wrap: wrap; }
#profileScreen > .account-card:has(#reminderTime) > div:last-child { width: 100%; justify-content: space-between; }
.account-email { overflow-wrap: anywhere; font-weight: 800; }
.account-state { font-size: 12px; line-height: 1.5; margin-top: 5px; }
.account-btn { min-height: 44px; padding: 11px 16px; border-radius: 13px; flex-shrink: 0; font-weight: 800; }
.account-btn.hot { background: #303142; border-color: #53576a; color: #e4ff1a; }
.account-btn.danger { color: #ff9da4; border-color: #9b596b; }
#editProfileBtn { width: auto; align-self: flex-start; }
.rank-card { background: var(--ink); --text: #eafff5; --dim: #b8bacb; --accent: var(--energy); --line: #444657; padding: 22px; border: none; }
.rank-row { gap: 14px; }
.rank-next { text-align: right; line-height: 1.5; }
.rank-name { font-size: 24px; }
.rank-bar-outer { height: 8px; margin-top: 18px; }
.stat-grid { margin-top: 0; gap: 10px; }
.stat-card { padding: 18px 12px; border-radius: 18px; }
.stat-card .num { font-size: 28px; line-height: 1.15; overflow-wrap: anywhere; }
.stat-card .lbl { text-transform: none; letter-spacing: 0; font-size: 11px; line-height: 1.35; }
.badge { border-radius: 18px; padding: 18px 6px; }
.badge .b-lbl { letter-spacing: 0; text-transform: none; font-size: 11px; line-height: 1.3; }
.badge.locked { opacity: .55; background: #272838; }

/* Leaderboards, social profiles and challenges */
.lb-screen-header { padding: 0 22px 18px; gap: 12px; align-items: center; flex-wrap: wrap; }
.lb-back-btn { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; width: 44px; height: 44px; color: var(--text); padding: 0; }
.lb-screen-title { font-size: 25px; letter-spacing: -.035em; font-weight: 900; }
.lb-screen-sub { flex-basis: 100%; padding-left: 56px; text-align: left; font-size: 11px; letter-spacing: 0; text-transform: none; line-height: 1.5; }
.lb-screen-sub:empty { display: none; }
.lb-toolbar { padding: 16px 22px 12px; gap: 12px; }
.lb-search { background: var(--surface); border-radius: 16px; padding: 14px 16px; font-size: 16px; }
.lb-tabs { background: #303142; padding: 5px; gap: 4px; border-radius: 16px; }
.lb-tab-btn { min-height: 42px; border: 0; border-radius: 12px; text-transform: none; letter-spacing: 0; font-size: 14px; }
.lb-tab-btn.active { background: var(--ink); color: var(--energy); }
.lb-full-list { padding: 0 22px; }
.lb-entry { padding: 17px 2px; gap: 12px; }
.lb-entry.lb-you { background: #303142; margin: 4px 0; padding: 17px 12px; border-radius: 16px; border-color: transparent; }
.lb-entry-reps { font-size: 24px; }
.lb-your-rank-banner { border-radius: 16px; padding: 14px; }
.sr-avatar, .ul-avatar { background: #303142; border: 0; width: 42px; height: 42px; }
.up-body { padding: 24px 22px; }
.up-name { font-size: 28px; }
.up-title-badge { letter-spacing: .05em; line-height: 1.4; }
.up-counts { margin-top: 12px; line-height: 1.6; }
.follow-btn { background: var(--energy); border: 0; border-radius: 16px; min-height: 48px; color: var(--text); }
.follow-btn.following { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.challenge-btn { background: var(--surface); color: var(--text); border-color: var(--line); border-radius: 16px; min-height: 48px; }
.up-lock { border-radius: 22px; background: var(--surface); }
.notif-row, .ul-row { padding: 18px 22px; }
.notif-ico { background: #303142; width: 42px; height: 42px; }
.notif-row.unread { background: #303142; }
.notif-row.unread::before { left: 7px; }
.notif-text { font-size: 14px; line-height: 1.5; }
.notif-time { font-size: 12px; margin-top: 5px; }
.ul-name { font-size: 15px; }
#duelSetupScreen { padding-top: calc(22px + env(safe-area-inset-top)); overflow-y: auto; }
.duel-setup { width: 100%; max-width: 564px; margin: 0 auto; padding: 0 22px calc(32px + env(safe-area-inset-bottom)); }
.duel-mode-card { background: var(--surface); border-radius: 22px; padding: 22px; border: 2px solid transparent; }
.duel-mode-card.selected { background: #303142; border-color: #e4ff1a; }
.duel-mode-card .dm-name { font-size: 21px; letter-spacing: -.025em; }
.duel-mode-card .dm-desc { font-size: 13px; margin-top: 7px; }
.duel-target-btn { border-radius: 16px; min-height: 64px; background: var(--surface); }
.duel-target-btn.selected { background: var(--ink); color: var(--energy); border-color: var(--text); }
.duel-lobby { max-width: 500px; }
.duel-vs { background: var(--ink); color: #eafff5; border-radius: 24px; padding: 26px 12px; }
.duel-vs-x { color: var(--energy); }
.duel-decline-btn { min-height: 48px; border-radius: 16px; }
.duel-countdown { color: #e4ff1a; font-style: italic; }
.duel-result-verdict { font-size: clamp(38px, 12vw, 60px); letter-spacing: -.04em; }
.duel-result-score { background: var(--ink); border-radius: 24px; padding: 28px 12px; --text: #eafff5; --dim: #b8bacb; --accent: var(--energy); color: var(--text); }
.duel-result-score .drs-reps { font-size: 54px; }

/* Camera stays dark and full-bleed; no changes to canvas, mirroring or bounds. */
#workoutScreen {
  --text: #eafff5; --dim: #c3c9d4; --faint: #b8bacb;
  --accent: var(--energy); --line: #425044; color: var(--text); background: var(--ink);
}
.stat-chip { background: #111217db; border: 1px solid #eafff526; border-radius: 16px; padding: 11px 13px; }
.stat-chip .label { letter-spacing: .06em; font-size: 9px; }
.stat-chip .value { font-size: 17px; }
#repCount { color: var(--energy); font-size: clamp(110px, 36vw, 220px); letter-spacing: -.065em; }
#formMsg { letter-spacing: .04em; font-size: 13px; }
.voice-toggle { min-height: 44px; border-radius: 14px; }
.voice-toggle.on { color: var(--text); background: var(--energy); border-color: var(--energy); }
#endBtn { background: var(--energy); color: var(--text); border: 0; min-height: 48px; border-radius: 16px; }
#discardBtn, #restDiscardBtn { min-height: 44px; letter-spacing: .03em; }
#trackingWarn { max-width: calc(100% - 36px); white-space: normal; text-align: center; line-height: 1.5; letter-spacing: 0; background: #eafff5; color: var(--text); }
#restingOverlay { background: #111217e8; }
#restingOverlay .rest-label { color: var(--energy); text-shadow: none; font-size: 42px; font-style: italic; letter-spacing: -.035em; }
#restingOverlay .rest-sub { color: #c3c9d4; text-transform: none; letter-spacing: 0; font-size: 15px; }
#resumeBtn { background: var(--energy); color: var(--text); min-height: 48px; border-radius: 16px; letter-spacing: 0; }
#restEndBtn { min-height: 44px; color: #eafff5; letter-spacing: 0; }
#duelHud { background: #111217eb; border-radius: 20px; }
#duelStall { background: #111217bb; }
#countdownNum { color: #eafff5; font-style: italic; }
#countdownNum.go { color: var(--energy); }

/* Completion and launch */
#summaryScreen { overflow-y: auto; padding-top: calc(30px + env(safe-area-inset-top)); padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
#summaryScreen > img { width: 66px !important; border-radius: 20px; }
#summaryReps { font-size: clamp(110px, 34vw, 190px); font-style: italic; letter-spacing: -.065em; color: var(--text); }
#summaryDetail { font-size: 15px; line-height: 1.6; }
#newPR { color: #e4ff1a; background: #303142; padding: 10px 18px; border-radius: 12px; letter-spacing: .03em; }
#summaryScreen .btn-primary { margin-top: 28px; }
#bootSplash { background: #101013 url('splash.jpg') center / cover no-repeat; }

/* Account sheets and first-use guidance */
.auth-sheet { background: var(--bg); border: 0; border-radius: 30px 30px 0 0; padding: 28px 24px calc(26px + env(safe-area-inset-bottom)); max-height: 90dvh; overflow-y: auto; }
.auth-sheet::before { content: ''; display: block; width: 38px; height: 4px; border-radius: 4px; background: #818699; margin: -14px auto 22px; }
.auth-title { font-size: 29px; line-height: 1.15; letter-spacing: -.04em; }
.auth-sub { font-size: 14px; line-height: 1.55; margin-top: 10px; }
.auth-input { background: var(--surface); padding: 16px; font-size: 16px; border-radius: 15px; }
.auth-link { min-height: 44px; font-size: 13px; }
.auth-row { align-items: center; gap: 12px; margin-top: 8px; }
.btn-apple { background: #000; color: #fff; }
.ep-avatar { background: #303142; }
.field-label { letter-spacing: .06em; }
.char-count { font-size: 11px; }
.goal-step-btn { width: 46px; height: 46px; border-radius: 14px; background: #303142; }
.goal-step-btn, .ep-avatar .ph { font-family: -apple-system, BlinkMacSystemFont, Arial, sans-serif; }
textarea.auth-input { font-family: var(--brand-font); }
#epGoalInput { margin-top: 0; }
#reminderTime { color-scheme: dark; background: #eafff5; min-height: 44px; border-radius: 12px; font-size: 14px; }
.fr-modal-overlay { background: #111217a6; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.fr-modal-card { background: var(--bg); border: none; border-radius: 28px; max-width: 380px; max-height: calc(100dvh - 48px); overflow-y: auto; padding: 26px; }
.fr-corner { display: none; }
.fr-eyebrow { color: #e4ff1a; font-family: var(--brand-font); font-size: 11px; letter-spacing: .06em; font-weight: 900; }
.fr-skip-btn { color: var(--dim); min-height: 44px; padding-left: 12px; }
.fr-skip-btn:hover { color: var(--text); }
.fr-modal-title { color: var(--text); font-size: 34px; font-weight: 900; line-height: 1.05; letter-spacing: -.04em; }
.fr-tip { border-color: var(--line); padding: 15px 0; }
.fr-tip-icon { background: #303142; border-radius: 12px; width: 40px; height: 40px; min-width: 40px; }
.fr-tip-icon svg { color: #e4ff1a; }
.fr-tip-label { color: var(--text); font-size: 14px; font-weight: 900; }
.fr-tip-desc { color: var(--dim); font-size: 13px; line-height: 1.5; }
.fr-cta-btn { background: var(--energy); color: var(--text); min-height: 52px; font-size: 16px; letter-spacing: 0; border-radius: 16px; }

@media (max-width: 374px) {
  #startScreen, #historyScreen, #profileScreen { padding-left: 16px; padding-right: 16px; }
  .wordmark { font-size: 24px; }
  .wordmark img { width: 28px !important; height: 28px !important; }
  .hero h1 { font-size: 43px; }
  .today-card { padding: 20px; }
  .today-stat .num { font-size: 30px; }
  .today-stats { gap: 8px; }
  .stat-grid { gap: 6px; }
  .stat-card { padding: 15px 9px; }
  .stat-card .num { font-size: 23px; }
  .account-card { flex-wrap: wrap; }
  .account-card > div:last-child:not(:first-child) { flex-wrap: wrap; }
  .setup-item img { width: 76px; flex-basis: 76px; }
  .lb-screen-header { padding-left: 16px; padding-right: 16px; }
  .lb-screen-title { font-size: 22px; }
}
@media (max-height: 700px) {
  #summaryScreen, #duelResultScreen, #duelLobbyScreen { justify-content: flex-start; overflow-y: auto; }
  #summaryReps { font-size: 110px; }
  #summaryScreen > img { width: 48px !important; margin-bottom: 12px !important; }
  #summaryScreen .btn { padding: 12px 20px; min-height: 46px; }
  #summaryScreen .btn-primary { margin-top: 20px; }
  .duel-result, .duel-lobby { margin: auto; padding-top: calc(24px + env(safe-area-inset-top)); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
