:root {
  --black: #0A0A0A;
  --black-2: #151515;
  --card: #1B1B1D;
  --card-2: #202024;
  --orange: #FF6A00;
  --orange-dim: #B84C00;
  --blue: #1E6FE0;
  --blue-dim: #123E82;
  --white: #FFFFFF;
  --gray: #8C8C93;
  --gray-line: #2B2B2F;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
}
* { box-sizing: border-box; }
html { scroll-padding-top: var(--safe-top); }
html, body {
  height: 100%;
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
h1, h2, h3, .display {
  font-family: 'Barlow Condensed', 'Inter', sans-serif;
  font-weight: 800;
  letter-spacing: 0.01em;
  margin: 0;
}
button { font-family: inherit; }
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}
header.topbar {
  padding: calc(18px + var(--safe-top)) 20px 16px;
  background: linear-gradient(180deg, #131315 0%, #0A0A0A 100%);
  border-bottom: 1px solid var(--gray-line);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-navigation { position: relative; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-mark:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }
.brand-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  width: min(220px, calc(100vw - 36px));
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card-2);
  border: 1px solid var(--gray-line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
}
.brand-menu[hidden] { display: none; }
.brand-menu-btn {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--gray);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.brand-menu-btn svg { width: 19px; height: 19px; flex-shrink: 0; }
.brand-menu-btn.active { background: rgba(255,106,0,0.12); color: var(--orange); }
.brand-menu-btn:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }
.brand-title { font-size: 22px; line-height: 1; text-transform: uppercase; }
.brand-title span { color: var(--orange); }
main {
  flex: 1;
  padding: 18px 18px calc(96px + var(--safe-bottom));
}
.screen { display: none; animation: fadein 0.25s ease; }
.screen.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.hero-card {
  background: linear-gradient(135deg, var(--blue-dim) 0%, #0d2c5c 60%, var(--black-2) 100%);
  border: 1px solid var(--gray-line);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -30px; top: -30px;
  width: 140px; height: 140px;
  background: var(--orange);
  opacity: 0.18;
  border-radius: 50%;
}
.hero-eyebrow { color: var(--gray); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.hero-title { font-size: 34px; text-transform: uppercase; color: var(--white); }
.hero-title .accent { color: var(--orange); }
.hero-sub { color: #C7CEDC; font-size: 14px; margin-top: 6px; }
.hero-cta {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--orange);
  color: var(--black);
  font-weight: 700;
  font-size: 15px;
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}
.hero-cta:active { transform: scale(0.98); }
.usage-count {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9FB3D6;
  font-size: 12px;
  font-weight: 600;
}

.section-title {
  font-size: 20px;
  text-transform: uppercase;
  color: var(--white);
  margin: 22px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .bar { width: 4px; height: 18px; background: var(--orange); border-radius: 2px; display: inline-block; }

.dev-credit {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-line);
  text-align: center;
}
.dev-credit .made-by {
  font-size: 11px;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.dev-credit .dev-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 10px;
}
.dev-credit .dev-links {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dev-credit .dev-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card-2);
  border: 1px solid var(--gray-line);
  color: var(--gray);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 20px;
  text-decoration: none;
}
.dev-credit .dev-link svg { width: 14px; height: 14px; flex-shrink: 0; }
.dev-credit .dev-link.wpp { color: #25D366; border-color: rgba(37,211,102,0.35); }
.dev-credit .dev-link.wpp svg { stroke: #25D366; }
.dev-credit .dev-link.insta { color: #E1306C; border-color: rgba(225,48,108,0.35); }
.dev-credit .dev-link.insta svg { stroke: #E1306C; }

.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--gray-line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}
.check-item.done { border-color: var(--orange); background: #201510; }
.check-box {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 2px solid var(--gray);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.check-item.done .check-box { background: var(--orange); border-color: var(--orange); }
.check-box svg { width: 14px; height: 14px; display: none; }
.check-item.done .check-box svg { display: block; }
.check-text { flex: 1; }
.check-time { font-size: 12px; color: var(--gray); font-weight: 600; }
.check-label { font-size: 15px; font-weight: 600; }
.check-detail { font-size: 12.5px; color: var(--gray); margin-top: 2px; }
.check-item.done .check-label { text-decoration: line-through; color: var(--gray); }

.progress-strip {
  height: 6px;
  background: var(--gray-line);
  border-radius: 4px;
  overflow: hidden;
  margin: 10px 0 4px;
}
.progress-strip-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), #FF9A4D);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.progress-label { font-size: 12.5px; color: var(--gray); }

.tabs-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.tab-pill {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 10px 5px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--gray-line);
  color: var(--gray);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  letter-spacing: 0.02em;
  line-height: 1.15;
  white-space: normal;
}
.tab-pill.active { background: var(--orange); color: var(--black); border-color: var(--orange); }
.tab-pill-wrap { position: relative; flex: 1; display: flex; }
.tab-pill-wrap .tab-pill { width: 100%; }
.tab-del {
  position: absolute;
  top: -7px; right: -7px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #FF6A6A;
  border: 2px solid var(--black);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.tab-del svg { width: 10px; height: 10px; stroke: var(--black); }
.workout-type-edit {
  position: absolute;
  top: -7px;
  left: -7px;
  z-index: 1;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}
.workout-type-edit svg { width: 10px; height: 10px; stroke: var(--white); }
.workout-manage-hint { margin: -5px 0 12px; }
.tab-add {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--card);
  border: 1.5px dashed var(--gray-line);
  color: var(--gray);
  cursor: pointer;
}
.tab-add svg { width: 18px; height: 18px; }

.exercise-card {
  background: var(--card);
  border: 1px solid var(--gray-line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
}
.exercise-card.manage-mode { cursor: default; }
.exercise-remove-btn { margin-top: 12px; }
.exercise-open-hint { font-size: 12px; color: var(--gray); }
.exercise-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.exercise-name { font-weight: 700; font-size: 15.5px; }
.exercise-meta { font-size: 12.5px; color: var(--gray); white-space: nowrap; }
.exercise-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.load-input-wrap {
  display: flex;
  align-items: center;
  background: var(--card-2);
  border: 1px solid var(--gray-line);
  border-radius: 10px;
  overflow: hidden;
  flex: 1;
}
.load-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 16px;
  font-weight: 700;
  padding: 10px 4px 10px 12px;
  width: 100%;
  outline: none;
  font-family: 'Inter', sans-serif;
}
.load-input-wrap span {
  color: var(--gray);
  font-size: 13px;
  padding-right: 12px;
}
.step-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--gray-line);
  background: var(--card-2);
  color: var(--white);
  font-size: 18px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.step-btn:active { background: var(--blue-dim); }
.last-load { font-size: 12px; color: var(--gray); margin-top: 6px; }
.last-load b { color: #9FC1FF; }

.finish-bar {
  position: sticky;
  bottom: calc(14px + var(--safe-bottom));
  margin-top: 18px;
}
.btn-primary {
  width: 100%;
  background: var(--orange);
  color: var(--black);
  border: none;
  border-radius: 14px;
  padding: 15px 0;
  font-weight: 800;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255,106,0,0.25);
}
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
  width: 100%;
  background: transparent;
  color: var(--blue-dim);
  border: 1px solid var(--blue-dim);
  border-radius: 14px;
  padding: 13px 0;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  color: #6FA3F5;
  border-color: var(--blue-dim);
}
.exercise-exit {
  width: auto;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.exercise-detail-card {
  background: var(--card);
  border: 1px solid var(--gray-line);
  border-radius: 16px;
  padding: 18px;
}
.exercise-detail-image,
.exercise-detail-video {
  display: block;
  width: 100%;
  max-height: 230px;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  margin-bottom: 18px;
}

.exercise-detail-image[hidden],
.exercise-detail-video[hidden] { display: none; }

.exercise-detail-workout {
  color: var(--orange);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.exercise-detail-title {
  margin-top: 5px;
  font-size: 30px;
  line-height: 1.1;
}
.exercise-detail-meta {
  margin-top: 8px;
  color: var(--gray);
  font-size: 14px;
}
.exercise-detail-description {
  margin: 12px 0 0;
  color: #C7CEDC;
  font-size: 14px;
  line-height: 1.6;
}
.exercise-metric-group { margin-top: 22px; }
.exercise-value-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 18px;
  font-weight: 700;
  padding: 12px;
  outline: none;
  font-family: 'Inter', sans-serif;
}
.exercise-detail-last-load { min-height: 18px; }
.exercise-complete-btn { margin-top: 16px; }
body.exercise-detail-open nav.bottom-nav { display: none; }

.timer-card {
  background: var(--card);
  border: 1px solid var(--gray-line);
  border-radius: 16px;
  padding: 18px;
}
.timer-card .field-group { margin-bottom: 14px; }
.timer-card .select-wrap { margin: 0; }
.timer-duration {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.timer-duration .field-input {
  background: var(--card-2);
}
.timer-clock {
  --timer-progress: 0%;
  width: min(72vw, 280px);
  aspect-ratio: 1;
  margin: 14px auto;
  padding: 10px;
  border-radius: 50%;
  background: conic-gradient(var(--orange) var(--timer-progress), var(--gray-line) var(--timer-progress));
  display: grid;
  place-items: center;
  transition: background 0.2s linear;
}
.timer-clock-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--black-2);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.timer-clock-label {
  color: var(--gray);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.timer-clock-inner > strong {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(52px, 16vw, 72px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.timer-clock-elapsed-label {
  margin-top: 8px;
  color: var(--gray);
  font-size: 12px;
}
.timer-clock-elapsed-label b {
  color: var(--white);
  font-variant-numeric: tabular-nums;
}
.timer-status {
  min-height: 18px;
  margin: 8px 0 14px;
  color: var(--gray);
  text-align: center;
  font-size: 13px;
}
.timer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.timer-actions .btn-secondary {
  width: 100%;
}
.timer-notification-btn {
  width: 100%;
  margin-top: 10px;
}
.timer-notification-btn[hidden] { display: none; }

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.week-day {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--gray-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--gray);
  gap: 4px;
}
.week-day .dow { font-weight: 700; text-transform: uppercase; font-size: 10px; }
.week-day .tag { font-size: 11px; font-weight: 800; line-height: 1.1; text-align: center; overflow-wrap: anywhere; }
.week-day.a { border-color: var(--orange); }
.week-day.a .tag { color: var(--orange); }
.week-day.b { border-color: var(--blue); }
.week-day.b .tag { color: #6FA3F5; }
.week-day.today { box-shadow: 0 0 0 2px var(--white) inset; }

.select-wrap {
  background: var(--card);
  border: 1px solid var(--gray-line);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 14px;
}
select {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 8px;
  outline: none;
  font-family: 'Inter', sans-serif;
}
select option { background: var(--card); color: var(--white); }

.chart-card {
  background: var(--card);
  border: 1px solid var(--gray-line);
  border-radius: 14px;
  padding: 16px 14px 10px;
  margin-bottom: 16px;
}
.chart-title { font-size: 13px; color: var(--gray); font-weight: 600; margin-bottom: 6px; }
.empty-state {
  text-align: center;
  padding: 30px 16px;
  color: var(--gray);
  font-size: 14px;
}
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th {
  text-align: left;
  color: var(--gray);
  font-weight: 600;
  padding: 8px 6px;
  border-bottom: 1px solid var(--gray-line);
  font-size: 12px;
  text-transform: uppercase;
}
.history-table td { padding: 9px 6px; border-bottom: 1px solid #202024; }
.history-table tr:last-child td { border-bottom: none; }

nav.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(15,15,17,0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--gray-line);
  display: flex;
  padding: 8px 6px calc(8px + var(--safe-bottom));
  z-index: 20;
}
.nav-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--gray);
  font-size: 10.5px;
  font-weight: 600;
  padding: 6px 0 2px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-align: center;
}
.nav-btn svg { width: 21px; height: 21px; }
.nav-btn.active { color: var(--orange); }
.nav-btn.active svg { stroke: var(--orange); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + var(--safe-bottom));
  transform: translateX(-50%) translateY(20px);
  background: var(--white);
  color: var(--black);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 100px;
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 40;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.install-banner {
  background: var(--card);
  border: 1px solid var(--orange);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
  display: none;
}
.install-banner.show { display: block; }
.install-banner-title { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.install-banner-text { font-size: 12.5px; color: var(--gray); line-height: 1.5; }
.install-banner button {
  margin-top: 10px;
  background: var(--orange);
  color: var(--black);
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.dismiss-x {
  float: right;
  color: var(--gray);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 10px;
}
.section-title-row .section-title { margin: 0; }
.manage-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--gray-line);
  color: var(--gray);
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 100px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.manage-btn svg { width: 14px; height: 14px; }
.manage-btn.active { background: var(--orange); color: var(--black); border-color: var(--orange); }

.item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--gray-line);
  background: var(--card-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn.edit svg { stroke: #6FA3F5; }
.icon-btn.delete svg { stroke: #FF6A6A; }
.icon-btn:active { transform: scale(0.94); }

.check-item.manage-mode, .exercise-card.manage-mode { cursor: default; }

.add-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed var(--gray-line);
  border-radius: 12px;
  padding: 14px;
  color: var(--gray);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  margin-top: 4px;
}
.add-card:active { background: var(--card); }
.add-card svg { width: 16px; height: 16px; }

.predefined-exercise-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.predefined-exercise-card {
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--gray-line);
  border-radius: 14px;
}
.predefined-media-wrap { position: relative; }
.predefined-exercise-gif,
.predefined-gif-placeholder,
.predefined-exercise-video {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: var(--black-2);
}
.predefined-gif-placeholder {
  display: grid;
  place-items: center;
  padding: 16px;
  border-bottom: 1px dashed var(--orange-dim);
  color: var(--orange);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}
.predefined-gif-placeholder[hidden],
.predefined-exercise-gif[hidden],
.predefined-exercise-video[hidden] { display: none; }
.predefined-video-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(10,10,10,0.72);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 100px;
  letter-spacing: 0.02em;
}
.predefined-video-badge[hidden] { display: none; }
.predefined-exercise-content { padding: 14px; }
.predefined-exercise-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.predefined-exercise-description {
  color: #C7CEDC;
  font-size: 13px;
  line-height: 1.5;
  margin: 8px 0 14px;
}
.predefined-exercise-actions {
  display: flex;
  gap: 10px;
}
.predefined-exercise-actions .btn-secondary,
.catalog-delete-btn {
  flex: 1;
  width: auto;
  padding: 9px;
  font-size: 12px;
}
.catalog-delete-btn {
  background: transparent;
  border: 1px solid #4A2323;
  border-radius: 10px;
  color: #FF7777;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}
.gif-url-group {
  padding: 12px;
  background: rgba(255, 106, 0, 0.08);
  border: 1px solid var(--orange);
  border-radius: 12px;
}
.gif-url-group .field-label { color: var(--orange); }
.gif-url-group .field-input { border-color: var(--orange-dim); }
.gif-url-group .media-url-label { margin-top: 14px; }
.media-clear-option {
  display: flex;
  align-items: center;
  gap: 8px;
}
.media-clear-option[hidden] { display: none; }
.field-textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.5;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.modal-overlay.show { display: flex; }
.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--black-2);
  border-top: 1px solid var(--gray-line);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + var(--safe-bottom));
  animation: slideup 0.22s ease;
}
@keyframes slideup { from { transform: translateY(30px); opacity:0; } to { transform: translateY(0); opacity:1; } }
.modal-title { font-size: 20px; text-transform: uppercase; margin-bottom: 16px; }
.field-group { margin-bottom: 14px; }
.field-label { font-size: 12.5px; color: var(--gray); font-weight: 600; margin-bottom: 6px; display: block; text-transform: uppercase; letter-spacing: 0.02em; }
.field-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--gray-line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--white);
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  outline: none;
}
.field-input:focus { border-color: var(--orange); }
.field-row { display: flex; gap: 10px; }
.field-row .field-group { flex: 1; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn-primary { box-shadow: none; }
.btn-delete {
  width: 100%;
  background: transparent;
  color: #FF6A6A;
  border: 1px solid #4A2323;
  border-radius: 14px;
  padding: 13px 0;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  margin-top: 10px;
}
.day-toggle-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.day-toggle {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--gray-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-weight: 700;
  color: var(--gray);
  cursor: pointer;
  user-select: none;
}
.day-toggle .dt-dow { font-size: 10px; text-transform: uppercase; opacity: 0.85; }
.day-toggle .dt-tag { font-size: 11px; font-weight: 800; line-height: 1.1; text-align: center; overflow-wrap: anywhere; }
.day-toggle.a { background: rgba(255,106,0,0.14); border-color: var(--orange); color: var(--orange); }
.day-toggle.b { background: rgba(30,111,224,0.16); border-color: var(--blue); color: #6FA3F5; }
.field-hint { font-size: 12px; color: var(--gray); margin-top: 10px; line-height: 1.5; }

/* ---------- Responsividade ---------- */

/* Telas bem estreitas (celulares pequenos, ex: iPhone SE, Galaxy A) */
@media (max-width: 359px) {
  main { padding: 14px 14px calc(96px + var(--safe-bottom)); }
  .hero-card { padding: 16px; }
  .hero-title { font-size: 28px; }
  .hero-sub { font-size: 12.5px; }
  .section-title { font-size: 17px; }
  .day-toggle .dt-dow { font-size: 8.5px; }
  .day-toggle .dt-tag { font-size: 11px; }
  .week-day { font-size: 9.5px; }
  .week-day .tag { font-size: 11px; }
  .tab-pill { font-size: 12.5px; padding: 9px 0; }
  .exercise-name { font-size: 14px; }
  .step-btn { width: 34px; height: 34px; }
  .field-row { flex-direction: column; gap: 0; }
}

/* Tablets e telas maiores: evita que o app fique esticado feito celular gigante,
   dá mais respiro ao redor e deixa o cartão com cara de app mesmo em desktop. */
@media (min-width: 640px) {
  body { background: var(--black-2); }
  #app {
    max-width: 480px;
    min-height: calc(100vh - 40px);
    margin: 20px auto;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid var(--gray-line);
  }
  header.topbar { border-radius: 24px 24px 0 0; }
  nav.bottom-nav {
    bottom: 20px;
    border-radius: 0 0 24px 24px;
  }
}

/* Telas muito baixas (celular deitado): evita que o cabeçalho e o rodapé
   fixos comam espaço demais da área útil. */
@media (max-height: 480px) and (orientation: landscape) {
  header.topbar { padding-top: calc(10px + var(--safe-top)); padding-bottom: 10px; }
  main { padding-bottom: calc(80px + var(--safe-bottom)); }
  nav.bottom-nav { padding-top: 4px; }
  .nav-btn { padding: 4px 0 2px; }
}

/* Evita qualquer estouro horizontal em qualquer largura */
html, body { overflow-x: hidden; }
img, svg { max-width: 100%; }
