/* App shell — iOS tab root layout */

.app-main {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.app-view {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.app-view.is-active {
  opacity: 1;
  pointer-events: auto;
}

.app-nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-h);
  padding: calc(8px + var(--safe-top)) 12px 8px;
  background: color-mix(in srgb, var(--bg-app) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border-glass) 60%, transparent);
}

.app-nav-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
  margin: 0;
  padding: 0 8px;
}

.app-nav--title-only {
  justify-content: center;
}

.app-nav--title-only .app-nav-title {
  flex: 0 1 auto;
}

.app-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 4px;
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.app-nav-btn:hover { background: var(--bg-glass-hover); }

.app-nav-btn--text {
  font-size: 15px;
  font-weight: 500;
  padding: 0 8px;
  min-width: auto;
}

.app-scroll {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--app-gutter) 16px;
}

.app-tab-bar {
  flex-shrink: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 10px 8px calc(10px + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg-app) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-glass);
}

.app-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.app-tab.is-active { color: var(--accent); }

.app-tab-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 18px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-app);
}

.history-day-date.has-unlock-dot::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
  transform: translateY(-1px);
}

.history-unlock-list {
  padding-bottom: 8px;
}

.theme-toggle-row--wrap {
  flex-wrap: wrap;
}

.app-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-app);
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.app-loading.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.app-loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-glass);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.workout-tabs-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  min-width: 0;
  padding: 0 var(--app-gutter) 12px;
  scrollbar-width: none;
}

.history-tabs-scroll {
  padding-top: 10px;
}

.workout-tab-pill.has-unseen-items:not(.is-active) {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.workout-tabs-scroll::-webkit-scrollbar { display: none; }

.workout-tab-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--text-main) 8%, transparent);
  color: var(--text-main);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.workout-tab-pill.is-active {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
}

.workout-tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.view-empty {
  text-align: center;
  padding: 40px 24px 48px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.view-empty strong {
  display: block;
  color: var(--text-main);
  font-size: 16px;
  margin-bottom: 6px;
}

.view-empty-msg {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  max-width: 280px;
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  box-shadow: var(--shadow-card);
}

.stat-card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.app-nav--workouts {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.app-nav-brand {
  grid-column: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.app-nav--workouts .app-nav-btn {
  grid-column: 3;
  justify-self: end;
}

.app-nav-logo {
  height: 36px;
  width: min(168px, 46vw);
  flex-shrink: 1;
  background: var(--accent);
  mask-image: url('../../assets/TrackMySet_Logo.svg');
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url('../../assets/TrackMySet_Logo.svg');
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.first-run-logo-mark {
  height: 56px;
  width: min(240px, 72vw);
  margin: 0 auto;
  background: var(--accent);
  mask-image: url('../../assets/TrackMySet_Logo.svg');
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url('../../assets/TrackMySet_Logo.svg');
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.workout-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 0 14px;
}

.workout-title-btn {
  flex: 1;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  padding: 0;
  color: inherit;
}

.glass-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  text-align: left;
  color: var(--text-main);
}

.glass-action-row-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-main);
}

.workout-footer {
  margin-top: 8px;
  padding-bottom: 24px;
}

.workout-cancel-link {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 15px;
  cursor: pointer;
  text-align: center;
}

.workout-delete-wrap {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.workout-delete-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 8px;
}

.exercise-module-row {
  margin-bottom: 0;
}

.glass-module-row {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 56px;
  padding: 0;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.glass-module-row.is-dragging {
  opacity: 0.55;
}

.glass-module-row.is-drag-over {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: -2px;
}

.exercise-module-list {
  padding: 0 0 6px;
}

.exercise-module-row-main {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px 8px 0;
  color: inherit;
  cursor: pointer;
}

.exercise-module-row-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.exercise-module-row-title {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-main);
}

.exercise-module-draft-badge {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-muted);
}

.exercise-module-row-delete {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--border-glass) 80%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg-glass-hover) 90%, transparent);
  color: var(--text-muted);
  cursor: pointer;
}

.exercise-module-row-delete:hover {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.exercise-module-row-drag {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: grab;
  touch-action: none;
}

.exercise-module-row-drag:active {
  cursor: grabbing;
}

.exercise-module-row-drag:hover {
  color: var(--accent);
}

.hold-finish-btn {
  position: relative;
  overflow: hidden;
  margin-top: 12px;
}

.hold-finish-label {
  position: relative;
  z-index: 1;
}

.hold-finish-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: color-mix(in srgb, var(--text-on-accent, #fff) 22%, transparent);
  pointer-events: none;
  transition: width 0.05s linear;
}

.hold-finish-btn.is-holding .hold-finish-progress {
  transition: none;
}

.exercise-module-row-body {
  gap: 0;
}

.exercise-row-progress-group {
  margin-top: 4px;
  width: 100%;
}

.exercise-row-progress-group .exercise-row-progress {
  margin-top: 0;
}

.exercise-row-progress-group--multi {
  display: flex;
  gap: 6px;
}

.exercise-row-progress-group--multi .exercise-row-progress {
  flex: 1;
  min-width: 0;
}

.exercise-module-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text-main);
}

.exercise-module-detail--superset {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.exercise-module-detail.is-goal {
  color: var(--text-muted);
}

.exercise-module-detail-sep {
  color: var(--text-muted);
}

.exercise-row-progress-fill--beats-goal {
  filter: brightness(1.08);
}

.calendar-month-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 24px;
}

.calendar-month-placeholder {
  min-height: 280px;
}

.calendar-month-card {
  padding: 14px;
}

.calendar-month-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 10px;
}

.sheet-action-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}


.workout-summary-title {
  display: block;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
}

.workout-summary-meta {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.profile-header-body {
  flex: 1;
  min-width: 0;
}

.more-legal {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 28px;
}

.more-emoji-icon {
  font-size: 28px;
  line-height: 1;
}

/* ——— More tab (iOS MoreView parity) ——— */

#view-more .app-scroll {
  padding-top: calc(12px + var(--safe-top));
}

.more-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 8px;
  min-width: 0;
}

.more-modules,
.more-danger-zone {
  min-width: 0;
}

.more-danger-label {
  margin-top: 4px;
  margin-bottom: 0;
}

.more-version-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.more-version-name {
  margin: 0;
  font-size: var(--type-module-name);
  font-weight: 600;
  color: var(--text-main);
}

.more-version-copy {
  margin: 0;
  font-size: var(--type-caption);
  line-height: 1.45;
  color: var(--text-muted);
}

.more-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 4px;
}

.more-legal-links a {
  font-size: var(--type-caption);
  color: var(--accent);
  text-decoration: none;
}

.more-legal-links a:hover {
  text-decoration: underline;
}

.more-external-link-copy {
  margin: 0;
  line-height: 1.45;
}

.more-external-link-sheet {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding-top: 4px;
}

.more-link-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(100%, 280px);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.more-link-btn:hover {
  transform: translateY(-1px);
}

.more-link-btn:active {
  transform: translateY(0) scale(0.98);
}

.more-link-btn--app-store {
  gap: 2px;
  padding: 12px 20px 14px;
  border-radius: 12px;
  background: #000;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.more-link-btn-kicker {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  opacity: 0.92;
}

.more-link-btn-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.more-link-btn--paypal {
  flex-direction: row;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0070ba, #003087);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 112, 186, 0.35);
}

.more-link-btn--paypal:hover {
  filter: brightness(1.05);
}

.more-link-btn-paypal-word {
  display: inline-flex;
  align-items: baseline;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.more-link-btn-paypal-pay {
  color: #fff;
}

.more-link-btn-paypal-pal {
  color: #ffc439;
}

.more-link-btn-paypal-action {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.more-theme-swatch {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
}

.more-theme-preview-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.more-theme-sheet {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.more-theme-intro {
  margin-top: 0;
}

.more-theme-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.more-theme-preview-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.more-theme-preview-title {
  margin: 0;
  font-size: var(--type-module-name);
  font-weight: 600;
  color: var(--text-main);
}

.more-theme-preview-detail {
  margin: 0;
  font-size: var(--type-caption);
  line-height: 1.4;
  color: var(--text-muted);
}


.life-tile-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-day-row {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  min-height: 56px;
}

.history-day-row-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 10px 8px 12px;
}

.history-day-marker {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-sizing: border-box;
}

.history-day-marker--workout {
  background: color-mix(in srgb, var(--accent) 40%, transparent);
}

.history-day-marker--tracker {
  border: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: transparent;
}

.history-day-row-main {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

.history-day-date {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
}

.history-day-workouts {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.history-day-ev-col {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 56px;
  border: none;
  background: transparent;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
}

.history-ev-head {
  display: flex;
  align-items: center;
  gap: 4px;
}

.history-ev-value {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.history-ev-trend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  color: var(--bg-glass, #1a1a1f);
}

.history-ev-trend--improved {
  background: var(--success, #34d399);
}

.history-ev-trend--declined {
  background: var(--danger, #f87171);
}

.history-ev-trend--neutral {
  background: color-mix(in srgb, var(--text-muted) 40%, transparent);
}

.history-ev-trend .tms-icon {
  color: var(--text-on-accent, #fff);
}

.history-spark-wrap {
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--border-glass) 40%, transparent);
  background: color-mix(in srgb, var(--bg-glass) 80%, transparent);
  color: var(--accent);
}

.history-spark-svg {
  display: block;
}

.history-day-expanded {
  border-top: 1px solid var(--border-glass);
  padding: 4px 12px 8px;
}

.history-workout-subrow {
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 0;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.history-workout-subrow + .history-workout-subrow {
  border-top: 1px solid var(--border-glass);
}

.history-workout-subrow-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-workout-subrow-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.history-workout-subrow-ev {
  margin-top: 2px;
  font-size: 12px;
  color: var(--accent);
}

.history-day-summary-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-main);
  line-height: 1.6;
}

/* ——— Workout summary sheets (HistoryDetailSheet parity) ——— */

.history-detail-sheet,
.history-day-summary-sheet {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 8px;
}

.history-detail-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-detail-date {
  margin: 0;
  font-size: var(--type-caption);
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.history-detail-ev-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-detail-ev-label {
  font-size: var(--type-body);
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.history-detail-empty {
  margin: 0;
  font-size: var(--type-caption);
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0;
}

.history-trend-chart-host {
  width: 100%;
}

.history-exercise-list {
  display: flex;
  flex-direction: column;
}

.history-exercise-divider {
  height: 1px;
  margin: 8px 0;
  background: var(--border-glass);
}

.history-exercise-row-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.history-exercise-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-exercise-name {
  font-size: var(--type-module-name);
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.25;
}

.history-exercise-meta {
  font-size: var(--type-caption);
  color: var(--text-muted);
  line-height: 1.35;
}

.history-exercise-details-toggle {
  align-self: flex-start;
  margin-top: 2px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: var(--type-caption);
  font-weight: 600;
  cursor: pointer;
}

.history-exercise-ev-col {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 56px;
}

.history-ev-value--exercise {
  font-size: var(--type-body);
}

.history-exercise-chart {
  margin-top: 8px;
  overflow: hidden;
}

.history-exercise-chart[hidden] {
  display: none;
}

.history-spark-wrap--large {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--border-glass) 40%, transparent);
  background: color-mix(in srgb, var(--bg-glass) 80%, transparent);
  color: var(--accent);
}

.history-spark-wrap--large .history-spark-svg {
  width: 100%;
  height: auto;
  display: block;
}

.history-spark-goal-line {
  stroke: var(--text-muted);
  stroke-opacity: 0.85;
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.history-spark-block-label {
  margin: 0 0 6px;
  font-size: var(--type-caption);
  color: var(--text-muted);
}

.history-spark-expanded {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-spark-period-toggle {
  display: flex;
  align-self: flex-start;
  gap: 2px;
  padding: 2px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
}

.history-spark-period-btn {
  min-width: 44px;
  min-height: 28px;
  padding: 0 10px;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.history-spark-period-btn.is-active {
  background: var(--accent);
  color: var(--text-on-accent, #fff);
}

.history-spark-chart-host {
  width: 100%;
}

.history-total-score-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  min-height: 56px;
}

.history-total-score-label {
  font-size: var(--type-body);
  color: var(--text-muted);
}

.history-total-score-value {
  font-size: var(--type-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.history-summary-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 8px 0 4px;
}

.history-summary-hero--compact {
  align-items: flex-start;
  text-align: left;
  padding-top: 0;
}

.history-summary-hero-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.history-summary-hero-title {
  margin: 0;
  font-size: var(--type-title);
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.history-summary-hero-subtitle {
  margin: 0;
  font-size: var(--type-caption);
  color: var(--text-muted);
}

.history-summary-score-list {
  display: flex;
  flex-direction: column;
}

.life-metric-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0;
}

.life-metric-row-main,
.life-metric-row-goal {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.life-metric-label {
  font-size: var(--type-module-name);
  font-weight: 600;
  color: var(--text-main);
}

.life-metric-value {
  font-size: var(--type-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-align: right;
}

.life-metric-goal-label,
.life-metric-goal-value {
  font-size: var(--type-caption);
  color: var(--text-muted);
}

.life-metric-goal-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.history-summary-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}

.history-summary-score-label {
  font-size: var(--type-body);
  color: var(--text-main);
}

.history-summary-score-value {
  font-size: var(--type-body);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.history-day-summary-sheet .history-day-list {
  padding: 0;
}

.history-detail-sheet .glass-section,
.history-day-summary-sheet .glass-section {
  margin-bottom: 0;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin-bottom: 8px;
}

/* ——— Profile tab (iOS ProfileView parity) ——— */

.app-view--profile {
  position: relative;
}

.app-view--profile .app-scroll--profile {
  padding-top: calc(12px + var(--safe-top));
}

.profile-support-btn {
  position: absolute;
  top: calc(10px + var(--safe-top));
  right: max(12px, var(--app-gutter));
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--border-glass) 70%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg-glass) 92%, transparent);
  color: var(--danger);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, transform 0.12s ease;
}

.profile-support-btn:hover {
  background: var(--bg-glass-hover);
}

.profile-support-btn:active {
  transform: scale(0.94);
}

.profile-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 8px;
  min-width: 0;
  max-width: 100%;
}

.profile-card {
  padding: 16px;
  display: flex;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
}

.profile-wheel {
  position: relative;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  margin: 0 auto;
  touch-action: none;
}

.profile-wheel-ring-host {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: none;
}

.profile-wheel-ring-host.is-dragging {
  cursor: grabbing;
}

.profile-wheel-ring-inner {
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;
  will-change: transform;
  transition: transform 0.14s ease-out;
}

.profile-wheel-ring-host.is-dragging .profile-wheel-ring-inner {
  transition: none;
}

.profile-wheel-slots {
  width: 100%;
  height: 100%;
  display: block;
}

.profile-wheel-slot {
  fill: color-mix(in srgb, var(--bg-input) 58%, var(--text-muted) 42%);
  stroke: none;
}

.profile-wheel-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 54%;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  text-align: center;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.profile-wheel-center:active {
  opacity: 0.88;
}

.profile-wheel-emoji {
  font-size: 46px;
  line-height: 1;
}

.profile-wheel-name {
  font-size: var(--type-module-name);
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.profile-wheel-xp-bar {
  width: 100%;
  margin-top: 2px;
}

.profile-wheel-meta {
  margin: 0;
  font-size: var(--type-caption);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.profile-tracker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
  width: 100%;
}

.profile-tracker-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 0.82;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
}

.profile-tracker-ring-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  padding: 2px;
  pointer-events: none;
}

.profile-tracker-ring-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.profile-tracker-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 6px 10px;
  pointer-events: none;
}

.profile-tracker-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-tracker-label {
  font-size: var(--type-body);
  color: var(--text-main);
  line-height: 1.1;
  white-space: nowrap;
}

.profile-tracker-done-wrap {
  position: absolute;
  left: 50%;
  top: 94%;
  display: flex;
  justify-content: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.profile-tracker-done {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--text-muted) 35%, transparent);
  background: var(--bg-app);
}

.profile-tracker-done.is-done {
  border-color: color-mix(in srgb, var(--success, #34d399) 55%, transparent);
}

.profile-tracker-done-check {
  color: var(--success, #34d399);
}

.profile-page .profile-action-row {
  margin-top: 0;
}

.profile-header-card {
  margin-top: 4px;
}

.profile-emoji {
  font-size: 44px;
  line-height: 1;
}

.profile-name {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
}

.profile-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.xp-bar-track {
  height: 10px;
  border-radius: var(--radius-sm);
  background: var(--border-glass);
  overflow: hidden;
  margin-top: 12px;
}

.xp-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  transition: width 0.3s ease;
}

.life-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.life-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  text-align: left;
  min-height: 88px;
}

.life-tile-icon {
  font-size: 22px;
}

.life-tile-title {
  font-size: 14px;
  font-weight: 600;
}

.life-tile-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.life-tile-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin: 16px 0 8px;
}

.section-label:first-child { margin-top: 0; }

.dev-tools-status {
  font-size: 13px;
  color: var(--text-main);
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
}

.dev-tools-intro {
  margin: 0 0 12px;
}

.dev-tools-sheet {
  max-height: min(72vh, 560px);
  overflow-y: auto;
  padding-bottom: 4px;
}

.dev-tools-section .section-label {
  margin: 14px 0 6px;
}

.dev-tools-section:first-of-type .section-label {
  margin-top: 0;
}

.dev-tools-actions {
  flex-direction: column;
  gap: 8px;
}

/* iPhone 13 mini (375px) and narrower */
@media (max-width: 390px) {
  :root {
    --app-gutter: 12px;
  }

  .workout-tabs-scroll {
    padding: 0 var(--app-gutter) 10px;
  }

  .app-nav {
    padding-left: 8px;
    padding-right: 8px;
  }

  .app-tab {
    padding: 6px 2px;
    font-size: 9px;
  }

  .profile-card {
    padding: 10px;
  }

  .profile-tracker-grid {
    gap: 6px;
  }

  .profile-tracker-label {
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .profile-tracker-center {
    padding: 0 4px 8px;
  }

  .profile-action-row {
    gap: 6px;
  }

  .profile-action-btn {
    padding: 8px 4px;
    min-height: 64px;
    font-size: 12px;
  }

  .life-metric-value {
    font-size: 24px;
  }
}
