/*
  RatLab app visual contract
  THESIS: social fitness utility with precise retro-futurist instrumentation, never ornamental sci-fi chrome.
  OWN-WORLD: near-black surfaces, hairline cyan structure, functional red actions, restrained radii and fine typography.
  STORY: scan the day, act quickly, return to training, food and community without visual friction.
  FIRST VIEWPORT: compact brand bar, unframed task content, stable bottom navigation and one obvious action.
  FORM: mobile operating surface extending the established RatLab.pro visual system.
*/

.block-slot-sets .block-slot-set-row > .exercise-modal-set-body { grid-column:2; grid-row:1; }
.block-slot-sets .block-slot-set-row .block-slot-set-fields input { min-width:0; padding:0 3px; }
@container (max-width:300px) {
  .block-slot-sets .block-slot-set-row { --editor-set-control:32px; }
}
@container (max-width:240px) {
  .block-slot-sets .block-slot-set-row { --editor-set-control:28px; }
}

.session-extra-meta { display:flex; align-items:center; gap:10px; min-width:0; }
.session-extra-meta small { flex:1; min-width:0; margin-top:0; overflow-wrap:anywhere; }
.session-extra-meta [data-configure-session-exercise] { flex:0 0 auto; white-space:nowrap; }
.session-extra-meta [data-configure-session-exercise] span { position:relative; display:inline-block; padding-bottom:3px; }
.session-extra-meta [data-configure-session-exercise] span::after { content:""; position:absolute; left:0; right:0; bottom:0; height:2px; background:linear-gradient(100deg,#79838c 0%,#eef4f7 24%,#9ba6af 45%,#ffffff 62%,#76818c 82%,#d7e0e5 100%); box-shadow:0 1px 0 #303841; }
@media (max-width:380px) {
  .session-extra-result:has(.session-extra-meta) { grid-template-columns:40px minmax(0,1fr); }
  .session-extra-result:has(.session-extra-meta) > .session-extra-actions { grid-column:2; justify-content:flex-end; }
}

.topbar-menu-head .topbar-menu-back,
.topbar-menu-head .topbar-menu-back:hover,
.topbar-menu-head .topbar-menu-back:active {
  border: 0;
  background: transparent;
  box-shadow: none;
}

:root {
  --red: #f01f39;
  --red-strong: #ff4056;
  --green: #4cdb98;
  --yellow: #f0b84c;
  --bg: #08090b;
  --panel: #101216;
  --panel-2: #0c0e12;
  --panel-3: #151820;
  --border: rgba(126, 232, 255, .14);
  --border-strong: rgba(126, 232, 255, .3);
  --text: #f5f7fa;
  --muted: #9ba3af;
  --subtle: #6f7785;
  --cyan: #7ee8ff;
  --surface-shadow: 0 14px 32px rgba(0, 0, 0, .22);
  --app-radius: 8px;
  --app-ease: cubic-bezier(.16, 1, .3, 1);
}

html, body, #app { background: #050608; }

.app-loading-screen {
  box-sizing: border-box;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
}

.app-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: min(100%, 320px);
  text-align: center;
}

.app-loading-logo { display: block; width: 180px; max-width: 100%; height: auto; object-fit: contain; }
.app-loading-logo.app-wordmark { width:280px; height:64px; object-fit:cover; object-position:center 47%; }
.brand .brand-logo.app-wordmark { width:120px; max-width:100%; height:30px; max-height:30px; object-fit:cover; object-position:center 47%; transform:none; filter:none; }
.app-loading-content p { margin: 0; color: #b8c3cd; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
body { color: var(--text); font-family: "Bahnschrift", "Arial Narrow", "Segoe UI", sans-serif; font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { letter-spacing: 0; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:is(button, a, input, select, textarea):focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
::selection { color: #fff; background: rgba(126, 232, 255, .25); }
.shell, .auth-screen, .app-fatal-error { background: radial-gradient(circle at 110% -8%, rgba(240, 31, 57, .09), transparent 290px), linear-gradient(180deg, #090a0d 0%, #07080a 100%); }
.shell { border-color: rgba(126, 232, 255, .09); box-shadow: 0 0 70px rgba(0, 0, 0, .42); }
.screen { padding-inline: 16px; }
.screen.stack { gap: 12px; }

/* Application chrome */
.topbar { min-height: calc(64px + var(--safe-top)); padding: calc(7px + var(--safe-top)) 12px 7px; border-color: var(--border); background: rgba(10, 12, 15, .94); backdrop-filter: blur(18px); box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.brand { height: 48px; }
.brand-logo { width: 150px; max-height: 46px; transform: translate(-2px, 2px) scale(1.56); filter: drop-shadow(0 7px 16px rgba(0, 0, 0, .4)); }
.topbar-actions { gap: 3px; }
.icon-btn, .rat-icon-btn, .topbar-menu-button { color: #dfe4e9; transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s var(--app-ease); }
.rat-icon-btn, .topbar-menu-button { width: 38px; height: 38px; border: 1px solid rgba(126, 232, 255, .13); border-radius: 50%; background: rgba(16, 18, 22, .88); }
.rat-icon-btn:active, .topbar-menu-button:active { transform: scale(.94); }
.topbar-menu-button.open { border-color: rgba(240, 31, 57, .55); background: rgba(240, 31, 57, .1); }
.top-level-chip { width: 86px; min-height: 34px; border-color: rgba(126, 232, 255, .18); border-radius: 6px; background: #0d1014; }
.rpg-xp-bar { height: 4px; background: rgba(126, 232, 255, .09); }
.rpg-xp-bar span { background: linear-gradient(90deg, var(--red), var(--red-strong)); box-shadow: none; }
.bottom-nav { min-height: var(--bottom-nav-total); padding-top: 5px; border-color: var(--border); background: rgba(12, 14, 18, .97); backdrop-filter: blur(18px); box-shadow: 0 -16px 34px rgba(0, 0, 0, .25); }
.bottom-nav button { min-height: 47px; color: #8f98a4; opacity: 1; transition: color .18s ease, transform .18s var(--app-ease); }
.bottom-nav button.active { color: #fff; }
.bottom-nav button.active :is(.bottom-nav-icon, .bottom-nav-home-icon, .bottom-nav-app-icon) { transform: translateY(-2px); filter: drop-shadow(0 5px 8px rgba(240, 31, 57, .22)); }
.bottom-nav button.active::after { bottom: 3px; width: 16px; height: 2px; border-radius: 0; background: var(--red); }

/* Surfaces and hierarchy */
.card, .diet-meal-card, .profile-privacy-card, .profile-settings-panel, .exercise-editor-panel, .diet-floating-panel, .topbar-menu-panel { border: 1px solid var(--border); border-radius: var(--app-radius); background: rgba(16, 18, 22, .96); box-shadow: none; }
.card { padding: 13px; }
.card:hover { border-color: rgba(126, 232, 255, .2); }
:is(h1, h2, h3, h4, strong, b) { letter-spacing: 0; }
.screen h1 { font-size: clamp(25px, 8vw, 31px); line-height: 1.04; font-weight: 850; }
.profile-settings-screen .profile-settings-page-head h1 { font-size: 20.15px; }
.training-day-detail .training-step-title h1 { font-size: 21.7px; }
.training-plan-edit-screen .training-step-title h1 { font-size: 21.7px; }
.screen .training-edit-day-header h1 { font-size: 21.7px; line-height: 1.2; overflow-wrap: anywhere; }
.session-extra-page:has([data-close-session-exercise-replacement]) .exercise-detail-header h1 { font-size: 21.7px; }

.running-plan-mark { position: relative; overflow: hidden; flex-shrink: 0; }
.running-plan-mark .running-plan-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.running-plan-photo-field .training-division-photo-select {
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
}
.running-plan-photo-field .training-division-photo-select > .running-plan-mark { display: grid; }
.running-detail > .training-step-header {
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: center;
  column-gap: 10px;
}
.running-detail .training-step-title h1 { font-size: 20px; line-height: 1.15; }
.running-detail > .training-step-header > button { inline-size: 46px; block-size: 46px; }
.running-detail .training-step-title p { font-size: 11px; line-height: 1.35; margin-top: 3px; }
.screen h2 { line-height: 1.12; font-weight: 820; }
.screen h3, .card h3 { font-weight: 780; }
.muted, small, .field label { color: var(--muted); }
.field label, .topbar-menu-section-label, .diet-section-title, .rpg-hero-stat span { font-size: 10px; font-weight: 750; letter-spacing: .02em; }

/* Controls */
.primary, .secondary, .btn, .wide, .tabs button, .social-feed-tabs button, .diet-mode-tabs button, .diet-subtabs button { min-height: 40px; border-radius: 6px; font-weight: 760; transition: transform .18s var(--app-ease), border-color .18s ease, background .18s ease, color .18s ease; }
.primary, button.primary { border: 1px solid var(--red); background: var(--red); box-shadow: 0 8px 18px rgba(240, 31, 57, .16); }
.primary:hover, button.primary:hover { border-color: var(--red-strong); background: var(--red-strong); }
.primary:active, .secondary:active, .btn:active, .wide:active { transform: translateY(1px) scale(.985); }
.secondary, button.secondary, .btn:not(.primary) { border-color: var(--border); background: #0d0f13; color: #edf1f5; }
.secondary:hover, button.secondary:hover { border-color: var(--border-strong); background: #12161b; }
.field input, .field select, .field textarea, input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-height: 42px; border: 1px solid var(--border); border-radius: 6px; background-color: #0b0d10; color: var(--text); }
:is(input, select, textarea)::placeholder { color: #68717d; }
.field :is(input, select, textarea):focus, :is(input, select, textarea):focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(126, 232, 255, .07); outline: none; }
.tabs, .social-feed-tabs, .diet-mode-tabs, .diet-subtabs { gap: 5px; }
.tabs button, .social-feed-tabs button, .diet-mode-tabs button, .diet-subtabs button { border-color: var(--border); background: #0e1014; color: #929ba7; }
.tabs button.active, .social-feed-tabs button.active, .diet-mode-tabs button.active, .diet-subtabs button.active { border-color: rgba(240, 31, 57, .55); background: rgba(240, 31, 57, .11); color: #fff; box-shadow: inset 0 -1px 0 var(--red); }

/* Social feed */
.social-feed { gap: 12px; }
.social-post { border: 0; border-radius: var(--app-radius); background: #0e1013; box-shadow: none; }
.social-post header { padding: 10px 11px; }
.social-avatar { border-color: rgba(240, 31, 57, .75); background: #090a0d; }
.social-post header strong { font-size: 12.5px; font-weight: 760; }
.social-post header small { color: #7e8793; }
.social-post-manage { border-radius: 5px; border-color: var(--border); background: #0b0d10; }
.social-post-media { background: #050608; }
.social-post-meta span { border-color: rgba(126, 232, 255, .11); border-radius: 5px; background: #090b0e; font-size: 9.5px; font-weight: 720; }
.social-post-actions { border-top: 1px solid rgba(126, 232, 255, .07); margin-top: 10px; padding-top: 8px; }
.social-post-actions button { height: 36px; border-radius: 5px; color: #d7dce2; }
.social-post-actions button.active { border-color: rgba(240, 31, 57, .3); background: rgba(240, 31, 57, .08); color: var(--red-strong); }
.social-post-bottom { padding-bottom: 12px; }

/* Profile */
.profile-clean { gap: 12px; }
.profile-photo, .profile-avatar-preview { border-color: var(--red); box-shadow: 0 0 0 4px rgba(240, 31, 57, .06); }
.profile-clean-actions { gap: 7px; }
.profile-clean-actions button { border-radius: 6px; }
.profile-highlights, .profile-achievement-row { border-color: var(--border); border-radius: var(--app-radius); background: #0f1115; }
.profile-icon-tabs button { color: #89929d; transition: color .18s ease, transform .18s var(--app-ease); }
.profile-icon-tabs button.active { color: #fff; }
.profile-icon-tabs button.active::after { background: var(--red); }

/* Diet and training work surfaces */
.diet-header, .session-top { border-bottom-color: var(--border); }
.diet-title-block p, .diet-header p, .session-top-title span { color: var(--muted); }
.diet-header-action-btn { border-color: rgba(240, 31, 57, .36); border-radius: 6px; background: rgba(240, 31, 57, .08); }
.diet-today-card, .diet-comparison-card, .diet-water-card, .history-session-card, .session-exercise-card { border-color: var(--border); background: #101216; }
.hero-card, .training-session-hero { border: 1px solid rgba(240, 31, 57, .5); border-radius: var(--app-radius); background: linear-gradient(130deg, rgba(240, 31, 57, .08), transparent 42%), #101216; text-align: left; }
.training-session-stats, .session-summary { border-color: rgba(126, 232, 255, .12); background: #0b0d10; }
.training-session-stats strong, .session-summary strong { font-variant-numeric: tabular-nums; }
.session-player-btn { border-color: var(--border); background: #0c0e12; }
.exercise-editor-modal, .diet-floating, .social-comments-modal { backdrop-filter: blur(9px); background: rgba(0, 0, 0, .76); }
.exercise-editor-panel, .diet-floating-panel { border-color: rgba(126, 232, 255, .2); box-shadow: 0 26px 70px rgba(0, 0, 0, .52); }
.exercise-picker-open-btn, .diet-food-select-button { border-radius: 6px; border-color: rgba(126, 232, 255, .18); background: #0b0d10; }
.visual-exercise-card, .exercise-picker-result { border-color: rgba(126, 232, 255, .11); border-radius: 6px; background: #0c0e12; }
.visual-exercise-card:hover, .exercise-picker-result:hover, .visual-exercise-card.selected, .exercise-picker-result.selected { border-color: rgba(240, 31, 57, .5); background: rgba(240, 31, 57, .06); }

/* Challenges: category colors become signals instead of competing surfaces. */
.challenges-home .challenge-main-card, .challenge-main-card { border-color: var(--border); border-radius: var(--app-radius); background: #101216; box-shadow: none; }
.challenges-home :is(.challenge-card-progresso, .challenge-card-conquistas-hub, .challenge-card-clubes, .challenge-card-ratpass) { background: #101216; }
.challenge-card-icon { border-radius: 6px; }
.challenge-card-progress { height: 4px; background: rgba(126, 232, 255, .08); }
.challenge-academy, .challenges-home .challenge-academy { border-color: rgba(240, 184, 76, .22); border-radius: var(--app-radius); background: #111214; }

/* Menus, notifications and messages */
.topbar-menu-panel, .notification-item, .chat-list-item, .conversation-row { border-color: var(--border); background: #0f1115; }
.topbar-menu-item { border-radius: 5px; }
.topbar-menu-item:hover { border-color: rgba(126, 232, 255, .2); background: rgba(126, 232, 255, .035); }
.notification-item.unread { border-color: rgba(240, 31, 57, .32); background: rgba(240, 31, 57, .055); }

@media (hover: hover) {
  .card, .social-post, .challenge-main-card { transition: border-color .18s ease, transform .22s var(--app-ease); }
  .social-post:hover, .challenge-main-card:hover { transform: translateY(-1px); }
}

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

/* Keep the soft-light theme functional with the same geometry. */
:root[data-theme="light"] { --red: #c9273b; --red-strong: #ad1f32; --bg: #edf0f2; --panel: #f7f8f9; --panel-2: #e9edef; --panel-3: #ffffff; --border: rgba(33, 55, 67, .16); --border-strong: rgba(33, 55, 67, .3); --text: #182027; --muted: #5d6872; --subtle: #7a858e; --cyan: #167b92; }
html[data-theme="light"] :is(.shell, .auth-screen, .app-fatal-error) { background: linear-gradient(180deg, #f5f6f7, #e9edef); }
html[data-theme="light"] :is(.topbar, .bottom-nav) { background: rgba(247, 248, 249, .96); }
html[data-theme="light"] :is(.card, .social-post, .diet-meal-card, .profile-highlights, .profile-achievement-row, .challenge-main-card, .exercise-editor-panel, .diet-floating-panel) { background: #f7f8f9; }
html[data-theme="light"] :is(.secondary, button.secondary, .tabs button, .social-feed-tabs button, .training-session-stats, .session-summary) { background: #e9edef; color: var(--text); }

@media (max-width: 380px) {
  .screen { padding-inline: 12px; }
  .brand-logo { width: 132px; transform: translate(-2px, 2px) scale(1.48); }
  .top-level-chip { display: none; }
}

/* Full-screen communication and focused sheets */
.chat-fullscreen { background: #08090b; }
.chat-header { border-color: var(--border); background: rgba(10, 12, 15, .96); backdrop-filter: blur(18px); }
.chat-header > button, .chat-header nav button { border-color: var(--border); background: #0c0e12; color: #dfe4e9; }
.chat-search input, .chat-compose input { border-color: var(--border); border-radius: 6px; background: #0b0d10; }
.chat-tabs { border-bottom-color: var(--border); }
.chat-tabs button { color: #8f98a4; }
.chat-tabs button.active { color: var(--text); box-shadow: none; }
.chat-row { border-bottom-color: rgba(126, 232, 255, .08); background: transparent; }
.chat-row:active { background: rgba(126, 232, 255, .035); }
.chat-bubble { border-radius: 8px; background: #151820; }
.chat-message.mine .chat-bubble { background: rgba(240, 31, 57, .17); }
.chat-compose { border-color: var(--border); background: rgba(10, 12, 15, .97); }
.chat-compose .send { background: var(--red); box-shadow: none; }
.notification-list { background: #08090b; }
.notification-list h3 { color: #707986; letter-spacing: .04em; }
.notification-row { border-color: rgba(126, 232, 255, .1); border-radius: 6px; background: #0e1014; }
.notification-row.unread { border-color: rgba(240, 31, 57, .32); background: rgba(240, 31, 57, .055); }
.social-comments-backdrop, .exercise-picker-floating { background: rgba(0, 0, 0, .76); backdrop-filter: blur(9px); }
.social-comments-panel, .exercise-picker-panel { border: 1px solid rgba(126, 232, 255, .2); border-radius: 8px; background: #101216; box-shadow: 0 26px 70px rgba(0, 0, 0, .52); }
.social-comments-panel-head, .exercise-picker-panel-head { border-bottom-color: var(--border); }
.session-rest-float { border-color: rgba(240, 31, 57, .5); border-radius: 8px; background: rgba(12, 14, 18, .98); box-shadow: 0 20px 48px rgba(0, 0, 0, .42); }
.session-rest-actions button { border-radius: 5px; }

html[data-theme="light"] :is(.chat-fullscreen, .notification-list) { background: #edf0f2; }
html[data-theme="light"] :is(.chat-header, .chat-compose, .social-comments-panel, .exercise-picker-panel, .notification-row, .chat-bubble) { background: #f7f8f9; color: var(--text); }
html[data-theme="light"] .chat-message.mine .chat-bubble { background: rgba(201, 39, 59, .12); }

/* Button and icon integrity system
   Shared geometry for browser, Capacitor and small mobile screens. */
:root {
  --tap-target: 44px;
  --control-icon: 22px;
  --control-icon-small: 18px;
}

button,
[role="button"] {
  box-sizing: border-box;
}

.icon-button,
.icon-btn,
.rat-icon-btn,
.topbar-menu-button,
.topbar-menu-close,
.training-back,
.social-post-manage,
.history-session-menu-btn,
.trash-set,
.trash-session-set,
.seq-del,
.session-player-btn,
.diet-cal-nav,
.chat-header > button,
.chat-header nav button,
.exercise-picker-panel-head > button,
.social-comments-panel-head > button {
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
  flex-shrink: 0;
}

.icon-button,
.rat-icon-btn,
.topbar-menu-button,
.training-back,
.session-player-btn,
.diet-cal-nav,
.chat-header > button,
.chat-header nav button {
  display: inline-flex;
  min-inline-size: var(--tap-target);
  min-block-size: var(--tap-target);
  padding: 0;
}

.icon-button {
  inline-size: var(--tap-target);
  block-size: var(--tap-target);
  aspect-ratio: 1;
}

.icon-button__icon,
.control-icon,
.button-with-icon__icon,
.nav-icon {
  display: block;
  inline-size: var(--control-icon);
  block-size: var(--control-icon);
  max-inline-size: 100%;
  max-block-size: 100%;
  object-fit: contain;
  flex: 0 0 auto;
  pointer-events: none;
}

.button-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-block-size: var(--tap-target);
}

:is(
  .icon-button,
  .icon-btn,
  .rat-icon-btn,
  .topbar-menu-button,
  .topbar-menu-close,
  .training-back,
  .social-post-manage,
  .history-session-menu-btn,
  .trash-set,
  .trash-session-set,
  .seq-del,
  .session-player-btn,
  .diet-cal-nav,
  .chat-header > button,
  .chat-header nav button,
  .exercise-picker-panel-head > button,
  .social-comments-panel-head > button
) > :is(svg, img, .control-icon) {
  display: block;
  inline-size: var(--control-icon);
  block-size: var(--control-icon);
  max-inline-size: var(--control-icon);
  max-block-size: var(--control-icon);
  object-fit: contain;
  flex: 0 0 auto;
  overflow: visible;
  pointer-events: none;
}

.rat-icon-btn,
.topbar-menu-button {
  inline-size: var(--tap-target);
  block-size: var(--tap-target);
  min-inline-size: var(--tap-target);
  min-block-size: var(--tap-target);
  aspect-ratio: 1;
  border-radius: 50%;
}

.topbar-menu-close,
.social-post-manage,
.history-session-menu-btn,
.trash-set,
.trash-session-set {
  position: relative;
  display: inline-flex;
  inline-size: 40px;
  block-size: 40px;
  min-inline-size: 40px;
  min-block-size: 40px;
  padding: 0;
}

.topbar-menu-close::after,
.social-post-manage::after,
.history-session-menu-btn::after,
.trash-set::after,
.trash-session-set::after,
.seq-del::after {
  content: "";
  position: absolute;
  inset: -2px;
}

.training-back {
  inline-size: 46px;
  block-size: 46px;
  aspect-ratio: 1;
  border-radius: 50%;
}

.training-back > svg {
  inline-size: 24px;
  block-size: 24px;
  transform: none;
}

.training-step-header > .training-back,
.training-step-header > .training-back:hover,
.training-step-header > .training-back:active {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
}
.training-step-header > .training-back:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  box-shadow: none;
}

.social-post-manage {
  border-radius: 50%;
  font-size: 0;
  letter-spacing: 0;
}

.social-post-manage > svg,
.history-session-menu-btn > svg {
  inline-size: 20px;
  block-size: 20px;
}

.social-post-actions button {
  min-inline-size: var(--tap-target);
  min-block-size: var(--tap-target);
  block-size: var(--tap-target);
  padding: 0 6px;
  overflow: visible;
}

.social-post-actions button > svg,
.social-post-actions button:first-child > svg,
.social-post-actions button:nth-child(3) > svg,
.social-post-actions button:last-child > svg {
  inline-size: var(--control-icon);
  block-size: var(--control-icon);
  transform: none;
  overflow: visible;
}

.bottom-nav {
  padding-bottom: max(var(--safe-bottom), env(safe-area-inset-bottom, 0px));
}

.bottom-nav button {
  min-inline-size: var(--tap-target);
  min-block-size: 52px;
  padding: 4px 6px 7px;
  line-height: 1;
}

.bottom-nav :is(.bottom-nav-icon, .bottom-nav-home-icon, .bottom-nav-app-icon) {
  display: grid;
  place-items: center;
  inline-size: 28px;
  block-size: 28px;
  min-inline-size: 28px;
  min-block-size: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.bottom-nav button.active :is(.bottom-nav-icon, .bottom-nav-home-icon, .bottom-nav-app-icon) {
  transform: translateY(-1px);
}

.bottom-nav img.bottom-nav-profile-photo,
html[data-theme="light"] .bottom-nav button img.bottom-nav-profile-photo,
html[data-theme="light"] .bottom-nav button.active img.bottom-nav-profile-photo {
  object-fit: cover;
  border-radius: 50%;
  filter: none;
}

.community-progress-summary .community-challenge-card:has(.community-card-arrow) { grid-template-columns:minmax(0,1fr) 44px; column-gap:8px; }
.community-progress-summary .community-challenge-card:has(.community-card-arrow)>header { grid-column:1; grid-row:1; }
.community-progress-summary .community-challenge-card:has(.community-card-arrow)>.community-card-content { grid-column:1 / -1; }
.community-progress-summary .community-card-action.community-card-arrow { grid-column:2; grid-row:1; align-self:center; justify-self:end; display:grid; place-items:center; width:44px; height:44px; padding:0; border:0; background:transparent; box-shadow:none; }
.community-card-arrow svg { width:20px; height:20px; }

.profile-icon-tabs button {
  min-inline-size: 54px;
  min-block-size: 50px;
  padding: 4px;
  line-height: 1;
}

.profile-icon-tabs :is(img, svg, .profile-tab-svg) {
  display: block;
  inline-size: 24px;
  block-size: 24px;
  max-inline-size: 24px;
  max-block-size: 24px;
  object-fit: contain;
  flex: 0 0 auto;
  overflow: visible;
}

.home-quick-add {
  inline-size: 56px;
  block-size: 56px;
  min-inline-size: 56px;
  min-block-size: 56px;
  aspect-ratio: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: visible;
}

.exercise-picker-open-btn {
  min-block-size: 56px;
  overflow: visible;
}

.exercise-picker-open-btn > span {
  overflow: hidden;
}

.exercise-picker-open-btn > i {
  position: relative;
  display: block;
  inline-size: 40px;
  block-size: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
}

.exercise-picker-open-btn > i,
.exercise-picker-open-btn:hover > i,
.exercise-picker-open-btn:focus-visible > i {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.exercise-picker-open-btn > i::before {
  top: 10px;
  left: 10px;
  inline-size: 11px;
  block-size: 11px;
}

.exercise-picker-open-btn > i::after {
  top: 23px;
  left: 22px;
  inline-size: 8px;
  block-size: 2px;
}

.exercise-picker.open .exercise-picker-open-btn > i::before,
.exercise-picker.open .exercise-picker-open-btn > i::after {
  top: 19px;
  left: 10px;
  inline-size: 18px;
  block-size: 2px;
}

.exercise-picker-panel-head > button,
.social-comments-panel-head > button {
  inline-size: var(--tap-target);
  block-size: var(--tap-target);
  min-inline-size: var(--tap-target);
  min-block-size: var(--tap-target);
  padding: 0;
}

.trash-set,
.trash-session-set {
  color: #ff6676;
}

.trash-set > svg,
.trash-session-set > svg,
.icon-btn > svg {
  inline-size: var(--control-icon-small);
  block-size: var(--control-icon-small);
}

.seq-del {
  position: relative;
  display: inline-flex;
  inline-size: 36px;
  block-size: 36px;
  min-inline-size: 36px;
  min-block-size: 36px;
  padding: 0;
}

.session-player-btn {
  inline-size: var(--tap-target);
  block-size: var(--tap-target);
  aspect-ratio: 1;
}

.session-player-btn > svg,
.session-player-btn.playing > svg {
  inline-size: 20px;
  block-size: 20px;
}

.diet-cal-nav {
  inline-size: var(--tap-target);
  block-size: var(--tap-target);
  aspect-ratio: 1;
}

.chat-header > button,
.chat-header nav button {
  inline-size: var(--tap-target);
  block-size: var(--tap-target);
  aspect-ratio: 1;
  padding: 0;
}
.top-streak,
.top-messages,
.learning-manual-shortcut {
  min-block-size: var(--tap-target);
  block-size: var(--tap-target);
  padding-block: 0;
}

.top-messages,
.learning-manual-shortcut {
  min-inline-size: var(--tap-target);
  inline-size: var(--tap-target);
}

:is(button, [role="button"]):disabled {
  cursor: not-allowed;
}

:is(button, [role="button"]):active:not(:disabled) {
  transform-origin: center;
}

@media (max-width: 360px) {
  .topbar-actions {
    gap: 2px;
  }

  .profile-icon-tabs {
    gap: 2px;
  }

  .profile-icon-tabs button {
    flex-basis: 52px;
  }

  .social-post-actions {
    gap: 6px;
    padding-inline: 9px;
  }

  .exercise-picker-open-btn {
    gap: 8px;
    padding-inline: 10px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .bottom-nav button {
    min-block-size: 46px;
  }

  .exercise-picker-panel {
    max-block-size: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 16px);
  }
}

/* Composed light mode: mineral surfaces, retained graphite navigation and RatLab signal red. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #dce4e9;
  --panel: #edf2f5;
  --panel-2: #e1e9ee;
  --panel-3: #f3f6f8;
  --border: rgba(32, 54, 66, .20);
  --border-strong: rgba(26, 107, 127, .48);
  --text: #13232d;
  --muted: #536773;
  --subtle: #70818c;
  --red: #c81d31;
  --red-strong: #a91428;
  --cyan: #087f9a;
  --surface-shadow: 0 12px 28px rgba(20, 39, 50, .13);
}
html[data-theme="light"], html[data-theme="light"] body, html[data-theme="light"] #app { background: #cfd9df; }
html[data-theme="light"] body { color: var(--text); }
html[data-theme="light"] .shell,
html[data-theme="light"] .auth-screen,
html[data-theme="light"] .app-fatal-error {
  background: radial-gradient(circle at 112% -8%, rgba(200, 29, 49, .10), transparent 290px), linear-gradient(180deg, #e9eff2 0%, #dce4e9 100%);
  border-color: rgba(32, 54, 66, .16);
  box-shadow: 0 0 56px rgba(20, 39, 50, .15);
}
/* Navigation remains dark for orientation and brand contrast. */
html[data-theme="light"] :is(.topbar, .bottom-nav) { background: rgba(20, 27, 33, .98); border-color: rgba(126, 232, 255, .18); color: #edf3f6; }
html[data-theme="light"] :is(.topbar, .bottom-nav) :is(button, span, small, strong) { color: inherit; }
html[data-theme="light"] :is(.rat-icon-btn, .topbar-menu-button, .top-level-chip) { background: #202a32; border-color: rgba(126, 232, 255, .22); color: #edf3f6; }
html[data-theme="light"] :is(.card, .social-post, .diet-meal-card, .profile-highlights, .profile-achievement-row, .challenge-main-card, .exercise-editor-panel, .diet-floating-panel, .topbar-menu-panel, .profile-settings-screen, .profile-settings-page-body .profile-settings-content) {
  background: #edf2f5;
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--surface-shadow);
}
html[data-theme="light"] .social-post { --surface-shadow:none; border:0; box-shadow:none; }
html[data-theme="light"] :is(.profile-settings-page-head, .profile-settings-page-body, .profile-settings-page-body .profile-settings-nav) { background: #e2e9ee; border-color: var(--border); }
html[data-theme="light"] :is(.profile-settings-nav-item, .topbar-menu-item, .notification-row, .notification-item, .chat-list-item, .conversation-row) { color: var(--text); }
html[data-theme="light"] :is(.secondary, button.secondary, .tabs button, .social-feed-tabs button, .diet-mode-tabs button, .diet-subtabs button, .training-session-stats, .session-summary, .social-post-meta span, .visual-exercise-card, .exercise-picker-result) {
  background: #e1e9ee;
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="light"] :is(input, select, textarea, .field input, .field select, .field textarea, .chat-search input, .chat-compose input) { background: #f3f6f8; color: var(--text); border-color: rgba(32, 54, 66, .25); }
html[data-theme="light"] :is(input, select, textarea)::placeholder { color: #667984; }
html[data-theme="light"] :is(.training-session-hero, .hero-card, .session-exercise-card, .session-summary, .exercise-preview-panel, .exercise-picker-panel, .social-comments-panel, .chat-header, .chat-compose) { background-color: #172129; color: #edf3f6; border-color: rgba(126, 232, 255, .22); }
html[data-theme="light"] :is(.training-session-hero, .hero-card, .session-exercise-card, .session-summary, .exercise-preview-panel, .exercise-picker-panel, .social-comments-panel, .chat-header, .chat-compose) :is(h1, h2, h3, h4, strong, b) { color: #f7fafb; }
html[data-theme="light"] :is(.training-session-hero, .hero-card, .session-exercise-card, .session-summary, .exercise-preview-panel, .exercise-picker-panel, .social-comments-panel, .chat-header, .chat-compose) :is(p, small, .muted) { color: #b8c6ce; }
html[data-theme="light"] :is(.chat-fullscreen, .notification-list) { background: #dce4e9; }
html[data-theme="light"] :is(.chat-bubble, .notification-row) { background: #edf2f5; border-color: var(--border); color: var(--text); }
html[data-theme="light"] .chat-message.mine .chat-bubble { background: #f1dce1; color: #52202a; }
html[data-theme="light"] :is(.primary, button.primary) { background: var(--red); border-color: var(--red); color: #fff; }
html[data-theme="light"] .bottom-nav button.active { color: #fff; }
html[data-theme="light"] .bottom-nav button:not(.active) { color: #aebdc6; }
html[data-theme="light"] :is(.bottom-nav img, .bottom-nav svg, .bottom-nav-app-icon, .bottom-nav-home-icon) { filter: brightness(0) saturate(100%) invert(83%) sepia(10%) saturate(463%) hue-rotate(159deg) brightness(91%) contrast(89%); }
html[data-theme="light"] .bottom-nav button.active :is(img, svg, .bottom-nav-app-icon, .bottom-nav-home-icon) { filter: brightness(0) invert(1); }

/* Light theme composition: readable mineral surfaces with the dark RatLab chrome retained. */
html[data-theme="light"] :is(.screen, .stack, .profile-clean, .diet-screen, .training-screen, .social-screen) {
  color: var(--text);
}
html[data-theme="light"] :is(.card, .social-post, .diet-meal-card, .profile-highlights, .profile-achievement-row, .challenge-main-card) :is(p, small, .muted, .helper, .field-help) {
  color: var(--muted);
}
html[data-theme="light"] :is(.card, .social-post, .diet-meal-card, .profile-highlights, .profile-achievement-row, .challenge-main-card) :is(h1, h2, h3, h4, strong, b, .title) {
  color: var(--text);
}
html[data-theme="light"] :is(.tabs button, .social-feed-tabs button, .diet-mode-tabs button, .diet-subtabs button, .profile-settings-nav-item, .topbar-menu-item) {
  background: #e4ecef;
  color: #38505c;
}
html[data-theme="light"] :is(.tabs button.active, .social-feed-tabs button.active, .diet-mode-tabs button.active, .diet-subtabs button.active, .profile-settings-nav-item.active, .topbar-menu-item.active) {
  background: #f4e0e4;
  color: #7f1d2c;
  border-color: var(--red);
}
html[data-theme="light"] :is(.notification-row, .notification-item, .chat-list-item, .conversation-row, .visual-exercise-card, .exercise-picker-result) {
  background: #f1f5f6;
  border-color: rgba(26, 107, 127, .21);
}
html[data-theme="light"] :is(.notification-row, .notification-item, .chat-list-item, .conversation-row, .visual-exercise-card, .exercise-picker-result) :is(p, small, .muted) {
  color: #536773;
}
html[data-theme="light"] :is(.notification-row.unread, .notification-item.unread) {
  background: #f7e8eb;
  border-color: rgba(200, 29, 49, .48);
}
html[data-theme="light"] :is(.empty, .empty-state, .social-empty, .diet-empty, .training-empty) {
  color: #536773;
  border-color: rgba(26, 107, 127, .24);
}
html[data-theme="light"] :is(.success, .status-active, .completed, .done) { color: #146b43; }
html[data-theme="light"] :is(.warning, .pending) { color: #8d5a05; }
html[data-theme="light"] :is(.danger, .error, .destructive) { color: #a91428; }
html[data-theme="light"] :is(.rat-icon, .quick-add-icon) { filter: none; }


/* Social composer and story containment: one focused layer inside the app viewport. */
.social-home, .social-post, .social-post-media { isolation: isolate; }
.social-composer-backdrop.diet-floating { z-index: 230; align-items: end; padding: max(12px, var(--safe-top)) max(12px, var(--safe-right)) max(12px, var(--safe-bottom)) max(12px, var(--safe-left)); }
.social-composer-panel.diet-floating-panel { width: min(100%, 520px); max-width: calc(100dvw - 24px - var(--safe-left) - var(--safe-right)); max-height: min(780px, calc(100dvh - 24px - var(--safe-top) - var(--safe-bottom))); display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; padding: 0; }
.social-composer-head { min-height: 68px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.social-composer-head > div { min-width: 0; }
.social-composer-head span { display: block; color: var(--red-strong); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.social-composer-head h3 { margin: 2px 0; font-size: 18px; }
.social-composer-head small { color: var(--muted); font-size: 11px; }
.social-composer-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px calc(18px + var(--safe-bottom)); }
.social-composer-body > form { margin: 0; }
.social-composer-form { display: grid; gap: 13px; }
.social-composer-form-title { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 10px; }
.social-composer-form-title > div { min-width: 0; }
.social-composer-form-title strong, .social-composer-form-title small { display: block; }
.social-composer-form-title small { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.social-composer-back { inline-size: 42px; block-size: 42px; min-inline-size: 42px; min-block-size: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 9px; border: 1px solid var(--border); border-radius: 7px; background: #0b0d10; color: var(--text); }
.social-composer-back svg { inline-size: 20px; block-size: 20px; }
.social-composer-form .field { display: grid; gap: 6px; min-width: 0; }
.social-composer-form .field > span, .social-composer-form .field > label { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .045em; text-transform: uppercase; }
.social-composer-form textarea { min-height: 104px; resize: vertical; }
.social-composer-form .native-media-field { display: grid; gap: 7px; padding: 12px; border: 1px dashed rgba(126, 232, 255, .32); border-radius: 8px; background: rgba(126, 232, 255, .035); }
.social-composer-form .native-media-field input[type="file"] { min-height: 44px; padding: 9px; font-size: 12px; }
.social-composer-form .native-media-field > small, .social-composer-form .field > small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.social-composer-form .native-media-preview { overflow: hidden; border-radius: 7px; }
.social-composer-form .native-media-preview :is(img, video) { display: block; width: 100%; max-height: 280px; object-fit: cover; }
.social-story-toggle { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 9px; min-height: 62px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: rgba(126, 232, 255, .035); cursor: pointer; }
.social-story-toggle input { inline-size: 20px; block-size: 20px; accent-color: var(--red); }
.social-story-toggle span { min-width: 0; }
.social-story-toggle strong, .social-story-toggle small { display: block; }
.social-story-toggle strong { font-size: 12px; }
.social-story-toggle small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.social-composer-actions { display: grid; grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); gap: 9px; padding-top: 3px; }
.social-composer-actions :is(button, .primary, .secondary) { min-height: 46px; margin: 0; }
.social-story-viewer { z-index: 240; padding: max(8px, var(--safe-top)) max(8px, var(--safe-right)) max(8px, var(--safe-bottom)) max(8px, var(--safe-left)); }
.social-story-frame { width: min(100%, var(--app-max-width)); height: min(900px, calc(100dvh - 16px - var(--safe-top) - var(--safe-bottom))); max-height: 100%; border-radius: 12px; box-shadow: 0 28px 80px rgba(0, 0, 0, .62); }
.social-story-top { min-height: 64px; align-items: center; padding: 10px 12px; }
.social-story-author { min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 8px; border: 0; background: transparent; color: #fff; padding: 0; text-align: left; }
.social-story-author > :first-child { inline-size: 34px; block-size: 34px; border-radius: 50%; overflow: hidden; }
.social-story-author strong, .social-story-author small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social-story-author strong { font-size: 12px; }
.social-story-author small { margin-top: 2px; color: rgba(255,255,255,.65); font-size: 10px; }
.social-story-close { inline-size: 42px; block-size: 42px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; background: rgba(8,9,11,.46); color: #fff; padding: 10px; }
.social-story-close svg { inline-size: 18px; block-size: 18px; }
.social-story-overlay { display: grid; gap: 8px; padding: 78px 15px 16px; }
.social-story-overlay > strong { font-size: 17px; overflow-wrap: anywhere; }
.social-story-overlay p { margin: 0; color: rgba(255,255,255,.86); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.social-story-metrics { display: flex; flex-wrap: wrap; gap: 6px; }
.social-story-metrics span { min-height: 26px; display: inline-flex; align-items: center; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(7,8,10,.45); padding: 0 9px; color: #fff; font-size: 10px; font-weight: 800; }
.social-story-actions { display: flex; gap: 8px; }
.social-story-actions button { min-height: 40px; margin: 0; }
@media (max-width: 480px) { .social-composer-backdrop.diet-floating { padding: 0; align-items: end; } .social-composer-panel.diet-floating-panel { width: 100%; max-width: 100%; max-height: min(88dvh, calc(100dvh - var(--safe-top))); border-right: 0; border-bottom: 0; border-left: 0; border-radius: 14px 14px 0 0; } .social-composer-body { padding: 13px 14px calc(16px + var(--safe-bottom)); } .social-story-viewer { padding: 0; } .social-story-frame { width: 100%; height: 100dvh; border: 0; border-radius: 0; } }
@media (prefers-reduced-motion: no-preference) { .social-composer-panel { animation: social-composer-enter 180ms cubic-bezier(.22, 1, .36, 1) both; } .social-story-frame { animation: social-story-enter 180ms cubic-bezier(.22, 1, .36, 1) both; } }
@keyframes social-composer-enter { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes social-story-enter { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: scale(1); } }
html[data-theme="light"] .social-composer-panel.diet-floating-panel { background: #edf2f5; }
html[data-theme="light"] .social-composer-back, html[data-theme="light"] .social-story-toggle { background: #e1e9ee; color: var(--text); }
html[data-theme="light"] .social-composer-form .native-media-field { background: #e7eef1; border-color: rgba(26, 107, 127, .34); }


/* Full-screen record viewer: the performance cover owns the title; details follow in a stable reading order. */
.social-reel-post.is-record { display: grid; grid-template-rows: minmax(260px, 44dvh) minmax(0, 1fr); min-height: calc(100dvh - 142px); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; background: #090b0f; }
.social-reel-post.is-record .social-reel-media { position: relative; inset: auto; min-height: 260px; height: 44dvh; }
.social-reel-post.is-record .social-reel-media .social-performance-cover { min-height: 100%; padding: 28px 20px 20px; }
.social-reel-post.is-record .social-reel-overlay { position: relative; inset: auto; display: grid; align-content: start; gap: 12px; padding: 14px 16px calc(20px + var(--safe-bottom)); background: #090b0f; }
.social-reel-post.is-record .social-reel-overlay .social-post-head { position: relative; inset: auto; display: grid; min-height: 44px; padding: 0; }
.social-reel-post.is-record .social-reel-copy { display: grid; gap: 7px; }
.social-reel-post.is-record .social-reel-copy h2 { display: none; }
.social-reel-post.is-record .social-reel-copy p { max-width: none; margin: 0; color: var(--text); font-size: 14px; line-height: 1.5; text-shadow: none; }
.social-reel-post.is-record .social-post-tags { margin-top: 0; }
.social-reel-post.is-record .social-post-context { display: none; }
.social-reel-post.is-record .social-reel-actions { padding: 4px 0 0; border-top: 1px solid var(--border); }
.social-reel-post.is-record .social-reel-actions button { background: transparent; }
.social-reel-post.is-record .social-reel-footer { align-items: center; gap: 5px 12px; color: var(--text); }
.social-reel-post.is-record .social-reel-footer button { color: var(--muted); }
.social-reel-post.is-record .social-reel-footer time { color: var(--muted); }
@media (max-width: 480px) {
  .social-reel-post.is-record { grid-template-rows: minmax(238px, 39dvh) minmax(0, 1fr); }
  .social-reel-post.is-record .social-reel-media { min-height: 238px; height: 39dvh; }
  .social-reel-post.is-record .social-reel-overlay { padding-right: 14px; padding-left: 14px; }
}
html[data-theme="light"] .social-reel-post.is-record { background: #edf1f3; }
html[data-theme="light"] .social-reel-post.is-record .social-reel-overlay { background: #edf1f3; }
html[data-theme="light"] .social-reel-post.is-record .social-reel-copy p,
html[data-theme="light"] .social-reel-post.is-record .social-reel-footer { color: #17191d; }


/* Direct thread header: identity is a flexible region, never an icon-sized button. */
.chat-header.thread { grid-template-columns: var(--tap-target) minmax(0, 1fr) auto; column-gap: 8px; padding-right: max(12px, var(--safe-right)); padding-left: max(12px, var(--safe-left)); }
.chat-header.thread > [data-chat-back] { inline-size: var(--tap-target); block-size: var(--tap-target); min-inline-size: var(--tap-target); min-block-size: var(--tap-target); }
.chat-header.thread > .chat-header-id { inline-size: auto; block-size: auto; min-inline-size: 0; min-block-size: var(--tap-target); aspect-ratio: auto; display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; justify-items: start; gap: 10px; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; overflow: hidden; }
.chat-header.thread > .chat-header-id .chat-avatar.small { inline-size: 36px; block-size: 36px; min-inline-size: 36px; min-block-size: 36px; }
.chat-header.thread > .chat-header-id { justify-content: start; justify-self: stretch; }
.chat-header.thread > .chat-header-id > div { inline-size: 100%; min-inline-size: 0; margin: 0; grid-column: 2; justify-self: start; align-items: flex-start; text-align: left; overflow: hidden; }
.chat-header.thread > .chat-header-id :is(strong, small) { inline-size: 100%; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header.thread > .chat-header-id strong { font-size: 15px; line-height: 1.15; }
.chat-header.thread > .chat-header-id small { margin-top: 2px; line-height: 1.2; }
.chat-header.thread > nav { display: flex; align-items: center; justify-content: end; min-inline-size: 0; gap: 6px; }
.chat-header.thread > nav button { inline-size: var(--tap-target); block-size: var(--tap-target); min-inline-size: var(--tap-target); min-block-size: var(--tap-target); }
@media (max-width: 360px) { .chat-header.thread { column-gap: 4px; padding-right: max(8px, var(--safe-right)); padding-left: max(8px, var(--safe-left)); } .chat-header.thread > .chat-header-id { gap: 7px; } }

/* Direct attachments: one stable composer action and contained mobile sheets. */
.history-chart { border: 0; padding: 12px 0 0; background: transparent; --history-plot-surface: var(--bg); --history-bar: #d62d46; }
.history-chart-latest { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; padding: 2px 0 12px; }
.history-chart-latest strong { font-size: 26px; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--text); }
.history-chart-latest span { color: var(--muted); font-size: 12px; }
.history-chart svg { height: 190px; }
.history-chart .history-bar-track { fill: transparent; stroke: transparent; }
.history-chart .history-bar-sheen, .history-chart .history-bar-cap, .history-chart .history-trend-shadow { display: none; }
.history-chart .history-bar { opacity: .65; filter: none; }
.history-chart .history-trend { stroke-width: 2; filter: none; }
.history-chart .history-trend-halo { fill: var(--bg); }
.history-chart .history-chart-y { background: transparent; color: var(--muted); font-size: 10px; padding: 0; }
.history-chart .history-chart-axis { height: 26px; margin-inline: 10px; }
.history-chart .history-chart-axis span { color: var(--muted); font-size: 10px; text-transform: none; }
.history-chart .history-chart-summary { padding-block: 12px 2px; flex-wrap: wrap; gap: 8px 16px; }
.history-chart .history-chart-key span { font-size: 10px; color: var(--muted); text-transform: none; }
.history-chart .history-chart-summary strong { color: var(--text); font-size: 11px; text-transform: none; }
@media (max-width: 400px) { .history-chart svg { height: 156px; } .history-chart-latest strong { font-size: 22px; } }
.club-hub-nav { display: flex; flex-wrap: wrap; gap: 6px; padding-block: 10px; border-bottom: 1px solid var(--border); }
.club-hub-nav button { min-height: 44px; padding: 8px 14px; border: 0; border-radius: 4px; background: transparent; color: var(--text); }
.club-hub-nav button[aria-pressed="true"] { background: rgba(225,27,34,.15); color: var(--red); }
.club-member-directory h2 { font-size: 18px; }
.club-member-directory article { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 12px; align-items: center; padding-block: 14px; border-bottom: 1px solid var(--border); }
.club-member-directory article strong,.club-member-directory article small { display: block; overflow-wrap: anywhere; }
.club-member-directory article small { color: var(--muted); margin-top: 4px; }
.club-member-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.club-member-actions button { min-height: 44px; padding: 8px 10px; border-radius: 4px; border: 1px solid var(--border); background: transparent; color: var(--text); }
@media (max-width: 600px) { .club-member-directory article { grid-template-columns: 40px minmax(0,1fr); } .club-member-actions { grid-column: 2; } }
.social-reply-form[hidden] { display: none; }
.social-reply-form input::placeholder { font-size: 13px; font-weight: 400; }
.chat-inbox-loading { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 24px; color: var(--muted); }
.chat-inbox-loading > span { width: 20px; height: 20px; flex-shrink: 0; border: 2px solid var(--border); border-top-color: var(--red); border-radius: 50%; animation: chatInboxSpin 1s linear infinite; }
@keyframes chatInboxSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .chat-inbox-loading > span { animation: none; } }
.chat-compose--shared { display: grid; grid-template-columns: var(--tap-target) minmax(0, 1fr) var(--tap-target); align-items: center; gap: 8px; padding: 8px max(12px, var(--safe-right)) calc(8px + var(--safe-bottom)) max(12px, var(--safe-left)); }
.chat-fullscreen--shared > .chat-compose--shared { z-index: 3; isolation: isolate; }
.chat-fullscreen--shared > .chat-compose--shared::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -8px -9px calc(-9px - var(--safe-bottom));
  background: #08090b;
  border-top: 1px solid var(--border);
  pointer-events: none;
}
html[data-theme="light"] .chat-fullscreen--shared > .chat-compose--shared::before { background: #dce4e9; }
.chat-compose--shared .chat-compose-attach, .chat-compose--shared .send { inline-size: var(--tap-target); block-size: var(--tap-target); min-inline-size: var(--tap-target); min-block-size: var(--tap-target); display: inline-flex; align-items: center; justify-content: center; aspect-ratio: 1; padding: 0; line-height: 1; overflow: visible; }
.chat-compose--shared input { min-inline-size: 0; inline-size: 100%; block-size: 42px; }
.chat-share-icon { display: block; inline-size: 21px; block-size: 21px; flex: 0 0 auto; }
.chat-compose--shared .send .chat-share-icon { inline-size: 20px; block-size: 20px; transform: translateX(1px); }
.chat-shared-card { inline-size: min(100%, 288px); display: grid; grid-template-columns: 44px minmax(0, 1fr) 20px; align-items: center; gap: 10px; padding: 9px; color: var(--text); border: 1px solid var(--border); border-radius: 8px; background: rgba(7, 12, 17, .58); text-align: left; }
.chat-message.mine .chat-shared-card { border-color: rgba(255, 52, 72, .35); background: rgba(86, 17, 28, .28); }
.chat-shared-card-icon { display: inline-flex; inline-size: 44px; block-size: 44px; align-items: center; justify-content: center; color: var(--cyan); border: 1px solid rgba(80, 214, 255, .32); border-radius: 7px; overflow: hidden; background: #0e151b; }
.chat-shared-card--workout .chat-shared-card-icon, .chat-shared-card--exercise .chat-shared-card-icon { color: #ff6072; border-color: rgba(255, 56, 78, .42); }
.chat-shared-card--running .chat-shared-card-icon { color: #7af0ce; border-color: rgba(122, 240, 206, .4); }
.chat-shared-card--diet .chat-shared-card-icon, .chat-shared-card--recipe .chat-shared-card-icon { color: #ffc35a; border-color: rgba(255, 195, 90, .4); }
.chat-shared-card-icon { position: relative; }
.chat-shared-card-icon img { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: cover; }
.chat-shared-card-icon[data-chat-media-loaded="true"] .chat-share-icon { display: none; }
.chat-shared-card-copy { min-inline-size: 0; display: grid; gap: 2px; }
.chat-shared-card-copy small, .chat-shared-card-copy em { overflow: hidden; color: var(--muted); font-size: 10px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.chat-shared-card-copy small { color: var(--cyan); letter-spacing: .08em; }
.chat-shared-card-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.chat-message .chat-bubble:has(.chat-shared-card) { border-radius: 8px; }
.chat-message .chat-bubble > .chat-shared-card {
  inline-size: 100%;
  max-inline-size: 340px;
  margin: 0;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  grid-template-columns: 40px minmax(0, 1fr) 16px;
}
.chat-message .chat-shared-card .chat-shared-card-icon {
  inline-size: 40px;
  block-size: 40px;
  border: 0;
  background: transparent;
}
.chat-message .chat-shared-card-copy :is(small, strong, em) {
  margin: 0;
  text-align: left;
  letter-spacing: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.chat-message .chat-shared-card-copy strong { font-size: 13px; line-height: 1.4; }
.chat-message .chat-shared-card-copy { gap: 4px; }
.chat-message .chat-shared-card:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }
.chat-shared-card-open { color: var(--muted); transform: rotate(180deg); }
.chat-shared-card-open .chat-share-icon { inline-size: 16px; block-size: 16px; }
.chat-media-preview { position: relative; inline-size: min(100%, 288px); aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 0; overflow: hidden; color: var(--cyan); border: 1px solid rgba(80, 214, 255, .3); border-radius: 8px; background: #05080b; }
.chat-message .chat-bubble:has(> .chat-media-preview) { padding: 4px; border-radius: 8px; }
.chat-message .chat-bubble > .chat-media-preview { border: 0; border-radius: 5px; margin: 0; padding: 0; }
.chat-message .chat-bubble:has(> .chat-media-preview) > small { padding: 0 5px 2px; }
.chat-media-preview :is(img, video) { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; display: block; object-fit: contain; background: #05080b; }
.chat-thread .chat-message:has(.chat-media-preview) { inline-size: min(50%, 480px); min-inline-size: 0; flex-shrink: 0; }
.chat-thread .chat-message.theirs:has(.chat-media-preview) { inline-size: min(calc(50% + 33px), 513px); }
.chat-thread .chat-message .chat-bubble:has(> .chat-media-preview) { min-inline-size: 0; box-sizing: border-box; }
.chat-thread .chat-bubble > .chat-media-preview { inline-size: 100%; width: 100%; max-inline-size: 100%; box-sizing: border-box; aspect-ratio: 4 / 3; }
.chat-media-preview :is(img, video)[hidden] { display: none; }
.chat-media-preview video { object-fit: contain; }
.chat-bubble .chat-own-actions{display:flex;justify-content:flex-end;gap:4px;margin-top:4px}
.chat-bubble .chat-own-actions button{display:grid;place-items:center;width:32px;height:32px;min-height:32px;margin:0;padding:6px;border:0;border-radius:4px;background:transparent;color:var(--muted);font-size:20px}
.chat-bubble .chat-own-actions button:hover{color:var(--text);background:var(--panel)}
.chat-own-actions svg{width:18px;height:18px}
.chat-share-icon>.training-running-icon{display:block;width:100%;height:100%}
.chat-message.mine .chat-reaction-picker{left:auto;right:0}
.chat-thread .chat-bubble:has(> .chat-reaction-picker){min-inline-size:min(240px,70vw)}
.chat-thread .chat-reaction-picker{position:static;flex-wrap:wrap;margin-top:6px;border-radius:8px;box-shadow:none}
@media (max-width:640px) {
  .chat-thread .chat-message:has(.chat-media-preview--image) { inline-size:calc(75vw + 10px); max-width:100%; }
  .chat-thread .chat-message.theirs:has(.chat-media-preview--image) { inline-size:calc(75vw + 43px); }
  .chat-thread .chat-bubble > .chat-media-preview--image[data-chat-media-loaded="true"] { aspect-ratio:auto; }
  .chat-thread .chat-media-preview--image[data-chat-media-loaded="true"] img { position:static; inline-size:100%; block-size:auto; object-fit:contain; }
}
.chat-media-preview-placeholder { display: grid; place-items: center; color: var(--muted); }
.chat-media-preview-placeholder .chat-share-icon { inline-size: 28px; block-size: 28px; }
.chat-media-preview[data-chat-media-loaded="true"] .chat-media-preview-placeholder { display: none; }
.chat-media-preview-expand { position: absolute; z-index: 1; inset-block-start: 8px; inset-inline-end: 8px; inline-size: 36px; block-size: 36px; display: grid; place-items: center; padding: 0; color: #fff; border: 1px solid rgba(255, 255, 255, .3); border-radius: 50%; background: rgba(5, 8, 11, .76); backdrop-filter: blur(5px); }
.chat-media-preview-expand .chat-share-icon { inline-size: 18px; block-size: 18px; }
.chat-share-backdrop { position: fixed; z-index: 1100; inset: 0; display: grid; align-items: end; background: rgba(0, 0, 0, .62); backdrop-filter: blur(5px); }
.chat-share-sheet { inline-size: 100%; max-block-size: min(78dvh, 620px); display: grid; gap: 14px; padding: 16px max(16px, var(--safe-right)) calc(16px + var(--safe-bottom)) max(16px, var(--safe-left)); overflow: auto; border: 1px solid var(--border); border-bottom: 0; border-radius: 16px 16px 0 0; background: #11161d; box-shadow: 0 -18px 42px rgba(0, 0, 0, .42); animation: chat-sheet-in .2s ease-out; }
@keyframes chat-sheet-in { from { transform: translateY(22px); opacity: .2; } to { transform: translateY(0); opacity: 1; } }
.chat-share-sheet > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-share-sheet h3 { margin: 0; font-size: 18px; }
.chat-share-sheet header small { display: block; margin-top: 3px; color: var(--muted); }
.chat-sheet-close { inline-size: var(--tap-target); block-size: var(--tap-target); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: #151a20; color: var(--text); }
.chat-share-options, .chat-share-source-list { display: grid; gap: 9px; }
.chat-share-options > button, .chat-share-source-list > button { min-block-size: 62px; display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 11px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: #0c1117; color: var(--text); text-align: left; }
.chat-share-options > button:hover, .chat-share-source-list > button:hover { border-color: rgba(255, 44, 66, .65); background: rgba(104, 16, 28, .24); }
.chat-share-options > button > .chat-share-icon, .chat-share-source-list > button > span:first-child { inline-size: 38px; block-size: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(80, 214, 255, .32); border-radius: 7px; color: var(--cyan); }
.chat-share-options strong, .chat-share-source-list strong { display: block; font-size: 14px; }
.chat-share-options small, .chat-share-source-list small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.chat-share-source-list > button { grid-template-columns: 38px minmax(0, 1fr) 18px; }
.chat-share-source-list i { color: var(--muted); transform: rotate(180deg); }
.chat-share-source-list i .chat-share-icon { inline-size: 17px; block-size: 17px; }
.chat-share-search input, .chat-share-media-form input { inline-size: 100%; min-block-size: 44px; box-sizing: border-box; }
.chat-share-inline { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-block-size: 40px; color: var(--cyan); border: 0; background: transparent; text-align: left; }
.chat-share-inline .chat-share-icon { inline-size: 17px; block-size: 17px; transform: rotate(180deg); }
.chat-share-media-form { display: grid; gap: 12px; }
.chat-share-media-form label { display: grid; gap: 7px; color: var(--text); font-size: 12px; }
.chat-file-drop { min-block-size: 148px; align-content: center; justify-items: center; padding: 16px; border: 1px dashed rgba(80, 214, 255, .5); border-radius: 8px; background: rgba(11, 18, 25, .7); text-align: center; }
.chat-file-drop .chat-share-icon { inline-size: 30px; block-size: 30px; color: var(--cyan); }
.chat-file-drop small { color: var(--muted); }
.chat-file-drop input { max-inline-size: 280px; min-block-size: auto; color: var(--muted); }
.chat-shared-viewer { position: fixed; z-index: 1110; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #090d12; animation: chat-viewer-in .2s ease-out; }
@keyframes chat-viewer-in { from { transform: translateY(16px); opacity: .2; } to { transform: translateY(0); opacity: 1; } }
.chat-shared-viewer > header { min-block-size: 64px; display: grid; grid-template-columns: var(--tap-target) minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px max(14px, var(--safe-right)) 8px max(14px, var(--safe-left)); border-bottom: 1px solid var(--border); }
.chat-shared-viewer > header > button { inline-size: var(--tap-target); block-size: var(--tap-target); display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: #10161d; color: var(--text); }
.chat-shared-viewer header div { min-inline-size: 0; display: grid; gap: 2px; }
.chat-shared-viewer header small { color: var(--cyan); font-size: 10px; letter-spacing: .08em; }
.chat-shared-viewer header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-shared-viewer > main { display: grid; align-content: start; gap: 16px; min-block-size: 0; padding: 18px max(16px, var(--safe-right)) calc(22px + var(--safe-bottom)) max(16px, var(--safe-left)); overflow: auto; }
.chat-viewer-media { display: grid; place-items: center; min-block-size: min(58dvh, 500px); border-radius: 9px; background: #05070a; overflow: hidden; }
.chat-viewer-media :is(img, video) { display: block; max-inline-size: 100%; max-block-size: min(58dvh, 500px); object-fit: contain; }
.chat-viewer-media a { display: inline-flex; align-items: center; gap: 9px; padding: 12px; color: var(--cyan); border: 1px solid rgba(80, 214, 255, .45); border-radius: 7px; }
.chat-shared-viewer ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chat-shared-viewer li, .chat-viewer-exercise { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--border); border-radius: 7px; background: #10161c; }
.chat-shared-viewer li small, .chat-viewer-exercise span, .chat-viewer-exercise p { margin: 0; color: var(--muted); }
.chat-shared-viewer--media > main { align-content: stretch; padding: 0; background: #020406; }
.chat-shared-viewer--media .chat-viewer-media { min-block-size: 100%; border-radius: 0; }
.chat-shared-viewer--media .chat-viewer-media :is(img, video) { inline-size: 100%; block-size: 100%; max-block-size: calc(100dvh - 64px); object-fit: contain; }
.chat-viewer-stack { display: grid; gap: 14px; min-inline-size: 0; }
.chat-viewer-section { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: #0d1319; }
.chat-viewer-section > header, .chat-viewer-exercise > header, .chat-diet-meal > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chat-viewer-section > header > div, .chat-viewer-exercise > header > div { display: grid; gap: 2px; }
.chat-viewer-section h3 { margin: 0; font-size: 16px; }
.chat-viewer-section header :is(small, span), .chat-viewer-exercise header :is(span, em) { color: var(--muted); font-size: 11px; font-style: normal; }
.chat-viewer-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #0b1117; }
.chat-viewer-metrics > div { display: grid; gap: 3px; min-block-size: 72px; align-content: center; padding: 10px 12px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.chat-viewer-metrics small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.chat-viewer-metrics strong { font-size: 15px; }
.chat-viewer-metrics span { color: var(--muted); font-size: 10px; }
.chat-viewer-exercise.compact { padding: 12px; }
.chat-viewer-set-head, .chat-viewer-sets > div { display: grid; grid-template-columns: 24px minmax(86px, 1fr) minmax(72px, .8fr) minmax(56px, .7fr); gap: 8px; align-items: center; }
.chat-viewer-set-head { padding: 7px 8px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.chat-viewer-sets { display: grid; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.chat-viewer-sets > div { position: relative; min-block-size: 38px; padding: 7px 8px; border-bottom: 1px solid var(--border); font-size: 11px; }
.chat-viewer-sets > div:last-child { border-bottom: 0; }
.chat-viewer-sets > div > small { grid-column: 2 / -1; color: var(--muted); }
.chat-viewer-exercise ol { display: grid; gap: 6px; margin: 4px 0 0; padding-left: 22px; color: var(--muted); font-size: 11px; }
.chat-running-blocks { display: grid; gap: 10px; }
.chat-running-blocks > div { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 10px; }
.chat-running-blocks i { inline-size: 8px; block-size: 8px; margin-top: 5px; border-radius: 50%; background: #7af0ce; box-shadow: 0 0 10px rgba(122, 240, 206, .45); }
.chat-running-blocks div > div { display: grid; gap: 3px; }
.chat-running-blocks :is(small, p) { margin: 0; color: var(--muted); font-size: 11px; }
.chat-diet-meal { display: grid; gap: 10px; padding: 12px; border-left: 2px solid rgba(255, 195, 90, .65); background: #10161c; }
.chat-diet-meal > header span { color: var(--muted); font-size: 11px; }
.chat-diet-option { display: grid; gap: 7px; padding-top: 8px; border-top: 1px solid var(--border); }
.chat-diet-option > div { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.chat-diet-option > div span { color: var(--text); }
.chat-viewer-note, .chat-recipe-instructions { margin: 0; padding: 12px 14px; color: var(--muted); border-left: 2px solid var(--cyan); background: #0c1319; white-space: pre-wrap; }
.chat-recipe-instructions { line-height: 1.6; }
.chat-import-panel { display: grid; gap: 9px; padding: 12px; border: 1px solid rgba(80, 214, 255, .35); border-radius: 8px; background: #0c1319; }
.chat-import-panel > div { display: grid; gap: 3px; }
.chat-import-panel small { color: var(--muted); }
.chat-import-panel > button:not(.primary):not(.secondary) { display: grid; gap: 3px; padding: 11px; border: 1px solid var(--border); border-radius: 6px; background: #121920; color: var(--text); text-align: left; }
@media (min-width: 680px) { .chat-share-sheet { inline-size: min(100%, 520px); justify-self: center; border-bottom: 1px solid var(--border); border-radius: 14px; margin-bottom: 5dvh; } .chat-share-backdrop { align-items: center; } }
@media (min-width: 760px) { .chat-shared-viewer:not(.chat-shared-viewer--media) > main { inline-size: min(100%, 820px); justify-self: center; } }
@media (max-width: 480px) { .chat-shared-viewer > main { gap: 12px; padding-inline: max(12px, var(--safe-left)); } .chat-viewer-section { padding: 11px; } .chat-viewer-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .chat-viewer-set-head, .chat-viewer-sets > div { grid-template-columns: 20px minmax(72px, 1fr) minmax(60px, .75fr) minmax(48px, .55fr); gap: 5px; } .chat-viewer-set-head { font-size: 8px; } .chat-shared-viewer--media > main { padding: 0; } }
@media (max-width: 360px) { .chat-compose--shared { gap: 5px; padding-inline: max(8px, var(--safe-left)); } .chat-shared-card { grid-template-columns: 40px minmax(0, 1fr) 16px; padding: 8px; } .chat-shared-card-icon { inline-size: 40px; block-size: 40px; } }
html[data-theme="light"] .chat-share-sheet, html[data-theme="light"] .chat-shared-viewer { background: #edf2f5; color: #152028; }
html[data-theme="light"] :is(.chat-share-options > button, .chat-share-source-list > button, .chat-shared-card, .chat-file-drop, .chat-import-panel, .chat-shared-viewer li, .chat-viewer-exercise) { background: #f8fafb; color: #152028; border-color: rgba(32, 54, 66, .25); }
html[data-theme="light"] :is(.chat-viewer-section, .chat-viewer-metrics, .chat-diet-meal) { background: #f8fafb; color: #152028; border-color: rgba(32, 54, 66, .25); }
html[data-theme="light"] .chat-viewer-note, html[data-theme="light"] .chat-recipe-instructions { background: #f1f6f8; }

/* Direct stories: a contained 9:16 editor with persistent visual treatment. */
.social-story-media { position: relative; min-height: 0; overflow: hidden; background: #06080b; }
.social-story-media-object { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform-origin: center; }
.social-story-media-object.filter-mono { filter: grayscale(1) contrast(1.08); }.social-story-media-object.filter-warm { filter: sepia(.22) saturate(1.18) contrast(1.04); }.social-story-media-object.filter-cool { filter: saturate(.9) hue-rotate(12deg) contrast(1.06); }.social-story-media-object.filter-contrast { filter: contrast(1.22) saturate(1.1); }
.social-story-text { position: absolute; z-index: 2; inset: auto 20px 38%; font-weight: 900; line-height: 1.06; letter-spacing: 0; text-shadow: 0 2px 18px rgba(0,0,0,.78); overflow-wrap: anywhere; pointer-events: none; }.social-story-text.story-align-center { text-align: center; }.social-story-text.story-align-right { text-align: right; }
.social-story-empty-media { min-height: 100%; display: grid; place-content: center; gap: 7px; padding: 24px; color: var(--text); text-align: center; }.social-story-empty-media small { color: var(--muted); }
.social-story-composer { position: fixed; z-index: 260; inset: 0; display: grid; place-items: center; padding: max(8px,var(--safe-top)) max(8px,var(--safe-right)) max(8px,var(--safe-bottom)) max(8px,var(--safe-left)); background: rgba(2,4,7,.78); backdrop-filter: blur(10px); }.social-story-composer-frame { width: min(100%,480px); height: min(900px,calc(100dvh - 16px - var(--safe-top) - var(--safe-bottom))); display: grid; grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; border: 1px solid rgba(78,218,255,.3); border-radius: 12px; background: #0b0f14; box-shadow: 0 28px 80px rgba(0,0,0,.66); }
.social-story-composer-head { min-height: 62px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }.social-story-composer-head div { min-width: 0; }.social-story-composer-head strong,.social-story-composer-head small { display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }.social-story-composer-head strong { font-size:15px; }.social-story-composer-head small { margin-top:2px;color:var(--muted);font-size:10px; }.social-story-publish { min-height:38px;padding:0 12px;font-size:12px; }
.social-story-canvas { position:relative;min-height:0;overflow:hidden;background:#06080b; }.social-story-canvas .social-story-empty-media { min-height:100%; }.social-story-canvas .social-story-text { inset:auto 18px 36%; }.social-story-placeholder-text { position:absolute;inset:auto 18px 36%;color:rgba(255,255,255,.58);font-size:20px;font-weight:800;line-height:1.1;pointer-events:none; }.social-story-media-picker { position:absolute;inset:auto 16px 16px;z-index:3;min-height:44px;display:inline-flex;align-items:center;justify-content:center;padding:0 14px;overflow:hidden;border:1px solid rgba(255,255,255,.35);border-radius:8px;background:rgba(4,7,10,.72);color:#fff;font-size:12px;font-weight:800;cursor:pointer; }.social-story-media-picker input { position:absolute;inset:0;opacity:0;cursor:pointer; }
.social-story-tools { display:grid;gap:10px;max-height:45dvh;padding:12px;overflow:auto;border-top:1px solid var(--border);background:#10151c; }.social-story-tools label { display:grid;gap:5px;min-width:0; }.social-story-tools label > span { color:var(--muted);font-size:9px;font-weight:900;letter-spacing:.06em;text-transform:uppercase; }.social-story-tools :is(input,select) { min-height:40px;margin:0; }.social-story-tool-row { display:grid;grid-template-columns:1fr 1fr;gap:10px; }.social-story-colors { display:flex;align-items:center;gap:10px; }.social-story-colors button { width:30px;height:30px;min-width:30px;min-height:30px;aspect-ratio:1;padding:0;border:2px solid transparent;border-radius:50%;background:var(--story-color);box-shadow:inset 0 0 0 1px rgba(0,0,0,.45); }.social-story-colors button.active { border-color:var(--cyan);transform:scale(1.08); }
@media (max-width:480px) { .social-story-composer { padding:0; }.social-story-composer-frame { width:100%;height:100dvh;border:0;border-radius:0; }.social-story-tools { max-height:40dvh;padding-bottom:calc(14px + var(--safe-bottom)); }.social-story-text { inset-inline:16px; } }
html[data-theme="light"] :is(.social-story-composer-frame,.social-story-tools) { background:#edf2f5; }.social-story-composer-head { background:inherit; }.social-story-composer-frame .social-story-media-picker { background:rgba(12,20,27,.78); }
/* Direct: remote avatars render as media, never as text. */
.chat-avatar :is(img, span), .chat-mini-avatar :is(img, span) { display: block; inline-size: 100%; block-size: 100%; min-inline-size: 0; min-block-size: 0; border-radius: inherit; }
.chat-avatar img, .chat-mini-avatar img { object-fit: cover; }
.chat-avatar.small img { inline-size: 36px; block-size: 36px; }
.chat-avatar .chat-avatar-content { position: relative; overflow: hidden; }
.chat-avatar .chat-avatar-placeholder { display: grid; place-items: center; color: var(--muted, #9baab2); }
.chat-avatar-placeholder .chat-share-icon { inline-size: 22px; block-size: 22px; margin: 0; }
.chat-avatar.small .chat-avatar-placeholder .chat-share-icon { inline-size: 18px; block-size: 18px; }
.chat-avatar .chat-avatar-content > img { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: cover; }

/* Stories use a single horizontal rail and an immersive, sequenced viewer. */
.shell > .screen:is(.social-home, :has(> .training-hub-actions), :has(> .diet-header-clean)) { padding-top: 6px; }
.social-home .social-stories { gap: 12px; margin-inline: -2px; padding: 0 2px 14px; scroll-snap-type: x proximity; overscroll-behavior-inline: contain; }
.social-home .social-story { position: relative; flex: 0 0 72px; min-width: 72px; min-height: 98px; align-content: start; scroll-snap-align: start; }
.social-home .social-story > .social-story-thumb { inline-size: 64px; block-size: 64px; display: grid; place-items: center; overflow: hidden; border: 2px solid var(--red); border-radius: 50%; background: #11161d; color: var(--red-strong); font-size: 24px; line-height: 1; }
.social-home .social-story > .social-story-thumb :is(img, .avatar-fallback, .profile-avatar) { inline-size: 100%; block-size: 100%; display: block; object-fit: cover; }
.social-home .social-story > .social-story-thumb img { object-fit: cover; }
.social-home .social-story small { width: 72px; max-width: 72px; color: var(--text); font-size: 10px; font-weight: 750; line-height: 1.2; }
.social-home .social-story.seen > .social-story-thumb { border-color: rgba(151, 164, 176, .54); }
.social-home .social-story--create > .social-story-thumb { border-color: rgba(126, 232, 255, .68); background: #101922; color: var(--cyan); }
.social-story-viewer { display: grid; place-items: center; background: rgba(1, 3, 6, .94); backdrop-filter: blur(10px); }
.social-story-frame { display: grid; grid-template-rows: minmax(0, 1fr); isolation: isolate; background: #06080b; }
.social-story-progress { position: absolute; z-index: 5; inset: max(10px, var(--safe-top)) 12px auto; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.social-story-progress span { block-size: 3px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.28); }
.social-story-progress span.done { background: rgba(255,255,255,.9); }
.social-story-progress span.active { background: linear-gradient(90deg, #fff 0 16%, rgba(255,255,255,.28) 16%); }
.social-story-top { z-index: 4; top: 16px; }
.social-story-media { min-block-size: 100%; }
.social-story-tap-zones { position: absolute; z-index: 3; inset: 0; display: grid; grid-template-columns: 1fr 1fr; }
.social-story-tap-zones button { min-width: 0; min-height: 0; border: 0; background: transparent; cursor: pointer; }
.social-story-overlay { z-index: 4; pointer-events: none; }
.social-story-overlay :is(button, a) { pointer-events: auto; }
@media (max-width: 480px) { .social-home .social-stories { padding-inline: 4px; } .social-story-progress { inset-inline: 12px; top: calc(10px + var(--safe-top)); } .social-story-top { top: calc(16px + var(--safe-top)); } .social-story-overlay { padding-bottom: calc(18px + var(--safe-bottom)); } }
/* Unified quick actions: compact, quiet controls with one precise active signal. */
:where(.home-quick-add, .diet-quick-fab-main) {
  inline-size: 52px;
  block-size: 52px;
  min-inline-size: 52px;
  min-block-size: 52px;
  aspect-ratio: 1;
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  border: 1px solid color-mix(in srgb, var(--red) 68%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface-2) 92%, #000);
  color: var(--red-strong);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .32);
  font-size: 0;
  line-height: 1;
  overflow: visible;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

:where(.home-quick-add, .diet-quick-fab-main)::before,
.social-home .social-story--create > .social-story-thumb::before {
  content: '+';
  display: grid;
  place-items: center;
  inline-size: 18px;
  block-size: 18px;
  color: currentColor;
  font-family: Arial, sans-serif;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

.home-quick-add .quick-add-icon { display: none; }

:where(.home-quick-add, .diet-quick-fab-main):is(:hover, :focus-visible) {
  border-color: var(--red-strong);
  background: color-mix(in srgb, var(--surface-2) 80%, var(--red) 20%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .4);
}

:where(.home-quick-add, .diet-quick-fab-main):active { transform: scale(.94); }
:where(.home-quick-add, .diet-quick-fab-main):focus-visible,
.social-home .social-story--create:focus-visible > .social-story-thumb { outline: 2px solid var(--cyan); outline-offset: 3px; }

.social-home .social-story--create > .social-story-thumb {
  border-color: color-mix(in srgb, var(--red) 66%, var(--cyan));
  background: color-mix(in srgb, var(--surface-2) 94%, #000);
  color: var(--red-strong);
  box-shadow: none;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.social-home .social-story--create > .social-story-thumb::before { inline-size: 22px; block-size: 22px; font-size: 26px; }
.social-home .social-story--create:is(:hover, :focus-visible) > .social-story-thumb { border-color: var(--red-strong); background: color-mix(in srgb, var(--surface-2) 78%, var(--red) 22%); }
.social-home .social-story--create:active > .social-story-thumb { transform: scale(.94); }

.diet-quick-fab { gap: 8px; }
.diet-quick-fab-main { box-shadow: 0 8px 22px rgba(0, 0, 0, .32); }
.diet-quick-fab.open .diet-quick-fab-main { transform: rotate(45deg); }
.diet-quick-fab.open .diet-quick-fab-main:active { transform: rotate(45deg) scale(.94); }

@media (prefers-reduced-motion: reduce) {
  :where(.home-quick-add, .diet-quick-fab-main),
  .social-home .social-story--create > .social-story-thumb { transition: none; }
}

/* Legacy Story markup remains visually equivalent while cached clients transition. */
:where(.home-quick-add, .diet-quick-fab-main),
.social-home .social-story--create > .social-story-thumb,
.social-story.own > span {
  isolation: isolate;
}

:where(.home-quick-add, .diet-quick-fab-main)::before,
:where(.home-quick-add, .diet-quick-fab-main)::after,
.social-home .social-story--create > .social-story-thumb::before,
.social-home .social-story--create > .social-story-thumb::after,
.social-story.own > span::before,
.social-story.own > span::after {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 50% auto auto 50%;
  display: block;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

:where(.home-quick-add, .diet-quick-fab-main)::before,
.social-home .social-story--create > .social-story-thumb::before,
.social-story.own > span::before { inline-size: 18px; block-size: 2px; }
:where(.home-quick-add, .diet-quick-fab-main)::after,
.social-home .social-story--create > .social-story-thumb::after,
.social-story.own > span::after { inline-size: 2px; block-size: 18px; }

.social-story.own > span {
  inline-size: 58px;
  block-size: 58px;
  position: relative;
  border: 1px solid color-mix(in srgb, var(--red) 66%, var(--cyan));
  background: color-mix(in srgb, var(--surface-2) 94%, #000);
  color: var(--red-strong);
  font-size: 0;
  font-weight: 400;
  box-shadow: none;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.social-story.own:is(:hover, :focus-visible) > span {
  border-color: var(--red-strong);
  background: color-mix(in srgb, var(--surface-2) 78%, var(--red) 22%);
}
.social-story.own:active > span { transform: scale(.94); }
.social-story.own:focus-visible > span { outline: 2px solid var(--cyan); outline-offset: 3px; }
/* Anchor the geometric add mark to each control, never to its floating wrapper. */
.home-quick-add { position: fixed; }
.diet-quick-fab-main,
.social-home .social-story--create > .social-story-thumb { position: relative; }
/* Diet quick action must inherit the same visual contract as the social composer trigger. */
.home-quick-add,
.diet-quick-fab-main {
  inline-size: 52px;
  block-size: 52px;
  min-inline-size: 52px;
  min-block-size: 52px;
  aspect-ratio: 1;
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--red) 68%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface-2) 92%, #000);
  color: var(--red-strong);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .32);
  font-size: 0;
  font-weight: 400;
  line-height: 1;
  overflow: visible;
}
.diet-quick-fab-main::before,
.diet-quick-fab-main::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  display: block;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.diet-quick-fab-main::before { inline-size: 18px; block-size: 2px; }
.diet-quick-fab-main::after { inline-size: 2px; block-size: 18px; }
.diet-quick-fab-main:is(:hover, :focus-visible) {
  border-color: var(--red-strong);
  background: color-mix(in srgb, var(--surface-2) 80%, var(--red) 20%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .4);
}
/* Compact set editor: keep stimulus, rest, and RIR readable on narrow phones. */
.exercise-modal-set-row {
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  grid-template-areas: "type body remove";
  align-items: stretch;
  gap: 8px;
}

.exercise-modal-set-row > .set-type-letter {
  grid-area: type;
  align-self: center;
}

.exercise-modal-set-row > .exercise-modal-set-body {
  grid-area: body;
  display: grid;
  gap: 7px;
  min-inline-size: 0;
}

.exercise-modal-set-row > .trash-set {
  grid-area: remove;
  align-self: center;
}

.exercise-modal-set-body > .exercise-modal-set-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.exercise-modal-set-body > .exercise-modal-set-fields.treadmill {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.exercise-modal-set-body > .exercise-modal-set-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  min-inline-size: 0;
}

.exercise-modal-set-options label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  inline-size: auto;
  min-inline-size: 0;
  min-block-size: 34px;
  padding: 4px 5px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel, #101216) 88%, #000);
}

.exercise-modal-set-options span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.exercise-modal-set-options input {
  block-size: 28px;
  min-block-size: 28px;
  padding: 0 4px;
  border: 0;
  border-radius: 5px;
  background: #090b0e;
  text-align: center;
}

@media (max-width: 360px) {
  .exercise-modal-set-row {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    gap: 6px;
  }

  .exercise-modal-set-body > .exercise-modal-set-fields.treadmill {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .exercise-modal-set-options label {
    grid-template-columns: 1fr;
    gap: 3px;
    padding: 4px;
  }

  .exercise-modal-set-options span {
    text-align: center;
  }
}
/* The diet trigger intentionally mirrors the social composer, including its open state. */
.diet-quick-fab-main {
  inline-size: 50px;
  block-size: 50px;
  min-inline-size: 50px;
  min-block-size: 50px;
  border: 0;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  box-shadow: 0 12px 35px rgba(225, 27, 34, .35);
}

.diet-quick-fab-main:is(:hover, :focus-visible) {
  border: 0;
  background: var(--red);
  color: #fff;
  box-shadow: 0 14px 38px rgba(225, 27, 34, .42);
}

.diet-quick-fab.open .diet-quick-fab-main {
  transform: none;
}

.diet-quick-fab.open .diet-quick-fab-main:active,
.diet-quick-fab-main:active {
  transform: scale(.94);
}
/* One geometric add mark is shared by the social, story, and diet entry points. */
:where(.home-quick-add, .diet-quick-fab-main) > .ratlab-add-mark,
.social-home .social-story--create > .social-story-thumb > .ratlab-add-mark {
  position: relative;
  display: block;
  inline-size: 18px;
  block-size: 18px;
  color: currentColor;
  flex: 0 0 auto;
}

.ratlab-add-mark::before,
.ratlab-add-mark::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  display: block;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.ratlab-add-mark::before { inline-size: 18px; block-size: 2px; }
.ratlab-add-mark::after { inline-size: 2px; block-size: 18px; }

:where(.home-quick-add, .diet-quick-fab-main)::before,
:where(.home-quick-add, .diet-quick-fab-main)::after,
.social-home .social-story--create > .social-story-thumb::before,
.social-home .social-story--create > .social-story-thumb::after {
  content: none;
}

.social-home .social-story--create > .social-story-thumb {
  inline-size: 50px;
  block-size: 50px;
  min-inline-size: 50px;
  min-block-size: 50px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  box-shadow: 0 12px 35px rgba(225, 27, 34, .35);
}

.social-home .social-story--create:is(:hover, :focus-visible) > .social-story-thumb {
  border: 0;
  background: var(--red);
  color: #fff;
  box-shadow: 0 14px 38px rgba(225, 27, 34, .42);
}

/* Social creation controls: one compact hierarchy for publish and Stories. */
.social-home .social-stories {
  gap: 14px;
  align-items: start;
  padding: 8px 4px 4px;
}

.social-home .social-story {
  flex: 0 0 76px;
  min-inline-size: 76px;
  min-block-size: 0;
  align-self: start;
  gap: 7px;
}

.social-home .social-story > .social-story-thumb {
  inline-size: 60px;
  block-size: 60px;
  min-inline-size: 60px;
  min-block-size: 60px;
  border: 2px solid color-mix(in srgb, var(--red) 72%, var(--cyan));
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--bg);
}

.social-home .social-story:not(.social-story--create).seen > .social-story-thumb {
  border-color: color-mix(in srgb, var(--muted) 65%, var(--border));
}

.social-home .social-story small {
  inline-size: 76px;
  max-inline-size: 76px;
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

.social-home .social-story--create > .social-story-thumb,
.social-story.own > span {
  border: 1px solid color-mix(in srgb, var(--red) 70%, var(--border));
  background: var(--surface-2);
  color: var(--red-strong);
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--red) 10%, transparent);
}

.social-home .social-story--create > .social-story-thumb {
  inline-size: 60px;
  block-size: 60px;
  min-inline-size: 60px;
  min-block-size: 60px;
}

.social-home .social-story--create > .social-story-thumb > .ratlab-add-mark {
  inline-size: 16px;
  block-size: 16px;
}

.social-home .social-story--create > .social-story-thumb > .ratlab-add-mark::before {
  inline-size: 16px;
  block-size: 2px;
}

.social-home .social-story--create > .social-story-thumb > .ratlab-add-mark::after {
  inline-size: 2px;
  block-size: 16px;
}

.social-home .social-story--create:is(:hover, :focus-visible) > .social-story-thumb,
.social-story.own:is(:hover, :focus-visible) > span {
  border-color: var(--red-strong);
  background: color-mix(in srgb, var(--surface-2) 84%, var(--red) 16%);
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--red) 14%, transparent);
}

.home-quick-add {
  left: auto;
  right: max(calc(18px + var(--safe-right)), calc((100vw - var(--app-max-width)) / 2 + 18px + var(--safe-right)));
  bottom: calc(84px + var(--safe-bottom));
  inline-size: 50px;
  block-size: 50px;
  min-inline-size: 50px;
  min-block-size: 50px;
  border: 0;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  box-shadow: 0 12px 35px rgba(225, 27, 34, .35);
}

.home-quick-add > .ratlab-add-mark {
  inline-size: 18px;
  block-size: 18px;
}

.home-quick-add:is(:hover, :focus-visible) {
  border: 0;
  background: var(--red);
  box-shadow: 0 14px 38px rgba(225, 27, 34, .42);
}

@media (max-width: 360px) {
  .social-home .social-stories { gap: 10px; }
  .social-home .social-story { flex-basis: 68px; min-inline-size: 68px; }
  .social-home .social-story small { inline-size: 68px; max-inline-size: 68px; }
}
.social-story-loading {
  flex: 0 0 68px;
  width: 68px;
  height: 82px;
  border: 0;
  background: transparent;
  position: relative;
}

.social-story-loading::before,
.social-story-loading::after,
.social-feed-skeleton :is(span, i),
.social-skeleton-media {
  content: "";
  display: block;
  background: #1a1e23;
  animation: ratlab-social-loading 1.1s ease-in-out infinite alternate;
}

.social-story-loading::before {
  width: 58px;
  height: 58px;
  margin: 2px auto 0;
  border: 1px solid #29313a;
  border-radius: 50%;
}

.social-story-loading::after {
  width: 42px;
  height: 7px;
  margin: 7px auto 0;
  border-radius: 3px;
}

.social-feed-skeleton {
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--app-radius);
  background: #0e1013;
}

.social-skeleton-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.social-skeleton-head > span {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
}

.social-skeleton-head > div {
  display: grid;
  flex: 1;
  gap: 7px;
}

.social-skeleton-head i:first-child { width: 42%; height: 9px; border-radius: 3px; }
.social-skeleton-head i:last-child { width: 28%; height: 7px; border-radius: 3px; }
.social-skeleton-media { width: 100%; aspect-ratio: 4 / 5; max-height: 430px; }
.social-skeleton-lines { display: grid; gap: 8px; padding: 12px; }
.social-skeleton-lines i { height: 8px; border-radius: 3px; }
.social-skeleton-lines i:last-child { width: 64%; }

.social-feed-more {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--app-radius);
  background: #0e1013;
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 760;
}

.social-feed-refreshing {
  min-height: 36px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

@keyframes ratlab-social-loading {
  from { opacity: .48; }
  to { opacity: .92; }
}

html[data-theme="light"] :is(.social-feed-skeleton, .social-feed-more) {
  background: #f7f8f9;
}

html[data-theme="light"] :is(.social-story-loading::before, .social-story-loading::after, .social-feed-skeleton span, .social-feed-skeleton i, .social-skeleton-media) {
  background: #dfe5e8;
}

@media (prefers-reduced-motion: reduce) {
  .social-story-loading::before,
  .social-story-loading::after,
  .social-feed-skeleton :is(span, i),
  .social-skeleton-media {
    animation: none;
  }
}


/* Fullscreen reel compatibility override */
.social-reel-track > .social-reel-post,
.social-reel-track > .social-reel-post.is-record { display:block; min-height:100dvh; height:100dvh; overflow:hidden; }
.social-reel-track > .social-reel-post.is-record .social-reel-media { position:absolute; inset:0; width:100%; height:100%; min-height:100%; }
.social-reel-track > .social-reel-post.is-record .social-reel-overlay { position:absolute; inset:0; display:flex; align-content:normal; background:linear-gradient(180deg,rgba(0,0,0,.62),transparent 26%),linear-gradient(0deg,rgba(0,0,0,.86),transparent 62%); }
.social-reel-track > .social-reel-post.is-record .social-reel-overlay .social-post-head { position:absolute; top:calc(12px + env(safe-area-inset-top,0px)); right:max(12px,env(safe-area-inset-right,0px)); left:calc(64px + env(safe-area-inset-left,0px)); }
.social-reel-track > .social-reel-post.is-record .social-reel-copy h2 { display:block; }
.social-reel-track > .social-reel-post.is-record .social-post-context { display:grid; }


/* Story composer lives in the viewport, outside the constrained app shell. */
html.social-story-composer-active,
html.social-story-composer-active body {
  width: 100%;
  height: 100%;
  overflow: hidden !important;
  overscroll-behavior: none;
}

body.social-story-composer-active > .social-story-composer {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1000;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  margin: 0;
  overflow: hidden;
  isolation: isolate;
}

@media (max-width: 767px) {
  body.social-story-composer-active > .social-story-composer {
    display: block;
    padding: 0;
    background: #0b0f14;
    backdrop-filter: none;
  }

  body.social-story-composer-active .social-story-composer-frame {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  body.social-story-composer-active .social-story-composer-head {
    min-height: calc(62px + env(safe-area-inset-top, 0px));
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
  }

  body.social-story-composer-active .social-story-tools {
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    overscroll-behavior: contain;
  }
}


/* Any visible RatLab modal owns interaction until it is closed. */
html.app-modal-active,
html.app-modal-active body {
  width: 100%;
  height: 100%;
  overflow: hidden !important;
  overscroll-behavior: none;
}

body.app-modal-active :is(
  .diet-floating-panel,
  .diet-substitute-panel,
  .exercise-picker-panel,
  .modal-set-type-sheet,
  .session-extra-exercise-sheet,
  .chat-share-sheet,
  .chat-members-panel,
  .chat-shared-viewer,
  .social-story-frame,
  .social-story-composer-frame
) {
  overscroll-behavior: contain;
}

/* Adaptive viewport system
   Mobile keeps the native app density. Tablets and desktops receive more
   workspace without stretching reading surfaces or allowing media overflow. */
:root {
  --adaptive-shell-max: 1280px;
  --adaptive-page-max: 1040px;
  --adaptive-reading-max: 680px;
  --adaptive-chat-max: 1120px;
  --adaptive-gutter: 16px;
  --desktop-nav-width: 76px;
}

html,
body,
#app,
.shell {
  min-inline-size: 0;
  max-inline-size: 100%;
}

:where(
  .screen,
  .screen > *,
  .card,
  .stack,
  .row,
  .field,
  .form-grid,
  .training-flow,
  .diet-dashboard,
  .social-feed,
  .social-post,
  .profile-clean,
  .profile-settings-page-body,
  .profile-settings-content,
  .chat-fullscreen,
  .chat-thread
) {
  min-inline-size: 0;
}

.screen :is(input, select, textarea, fieldset),
.chat-fullscreen :is(input, select, textarea, fieldset) {
  max-inline-size: 100%;
  min-inline-size: 0;
}

:where(
  .training-step-title,
  .training-plan-main,
  .training-exercise-card-head > div,
  .diet-header-copy,
  .diet-meal-card,
  .social-post-copy,
  .social-post-caption,
  .profile-settings-section-copy,
  .learning-post-card,
  .chat-header-id > div
) :is(h1, h2, h3, h4, strong, p, small, span) {
  max-inline-size: 100%;
  overflow-wrap: anywhere;
}

:where(
  .social-post-media,
  .social-media-frame,
  .social-reel-media,
  .exercise-preview-media,
  .exercise-preview-media-steps,
  .profile-avatar-preview,
  .chat-shared-viewer-media,
  .story-canvas
) {
  max-inline-size: 100%;
  overflow: hidden;
}

:where(
  .social-post-media,
  .social-media-frame,
  .social-reel-media,
  .exercise-preview-media,
  .profile-avatar-preview,
  .chat-shared-viewer-media,
  .story-canvas
) :is(img, video, canvas) {
  display: block;
  max-inline-size: 100%;
  max-block-size: 100%;
}

.social-post-media :is(img, video),
.social-media-frame :is(img, video),
.social-reel-media :is(img, video) {
  inline-size: 100%;
  object-fit: cover;
}

.exercise-preview-media :is(img, video),
.chat-shared-viewer-media :is(img, video) {
  object-fit: contain;
}

/* Fullscreen publication: safe-area aware identity, media and action zones. */
.social-reel-screen {
  --reel-inline-gutter: clamp(12px, 3.8vw, 20px);
  --reel-top-gap: max(10px, var(--safe-top));
  --reel-bottom-gap: max(12px, var(--safe-bottom));
  --reel-header-height: 44px;
  --reel-back-clearance: 54px;
}

.screen.social-reel-screen { padding: 0; }

.social-reel-screen .social-reel-back {
  top: var(--reel-top-gap);
  left: max(var(--reel-inline-gutter), var(--safe-left));
  width: 44px;
  height: 44px;
}

.social-reel-screen .social-reel-overlay {
  inset: 0;
  display: grid;
  grid-template-rows: var(--reel-header-height) minmax(0, 1fr);
  align-items: start;
  gap: clamp(10px, 2dvh, 18px);
  padding:
    var(--reel-top-gap)
    max(var(--reel-inline-gutter), var(--safe-right))
    var(--reel-bottom-gap)
    max(var(--reel-inline-gutter), var(--safe-left));
}

.social-reel-screen .social-reel-overlay .social-post-head {
  position: static;
  inset: auto;
  width: auto;
  min-width: 0;
  min-height: var(--reel-header-height);
  margin-left: var(--reel-back-clearance);
  padding: 0;
}

.social-reel-details {
  align-self: end;
  display: grid;
  grid-template-rows: minmax(0, auto) auto auto;
  width: min(100%, 580px);
  max-height: min(54dvh, calc(100dvh - var(--safe-top) - var(--safe-bottom) - 82px));
  min-height: 0;
  overflow: hidden;
}

.social-reel-description {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .22) transparent;
  padding: 12px 2px 8px;
}

.social-reel-description::-webkit-scrollbar { width: 3px; }
.social-reel-description::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); }
.social-reel-screen .social-reel-copy h2 { max-width: min(18ch, 100%); font-size: 38px; overflow-wrap: anywhere; }
.social-reel-screen .social-reel-copy p { max-width: 46ch; overflow-wrap: anywhere; }
.social-reel-screen .social-reel-actions { flex: 0 0 auto; min-height: 52px; padding: 4px 0 0; }
.social-reel-screen .social-reel-actions button { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
.social-reel-screen .social-reel-footer { flex: 0 0 auto; padding-top: 2px; }

.social-reel-screen .social-reel-post.is-record {
  display: grid;
  grid-template-rows: minmax(220px, 44dvh) minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.social-reel-screen .social-reel-post.is-record .social-reel-media {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.social-reel-screen .social-reel-post.is-record .social-reel-overlay {
  position: relative;
  inset: auto;
  grid-template-rows: var(--reel-header-height) minmax(0, 1fr);
  align-content: stretch;
  gap: 8px;
  min-height: 0;
  padding:
    10px
    max(var(--reel-inline-gutter), var(--safe-right))
    var(--reel-bottom-gap)
    max(var(--reel-inline-gutter), var(--safe-left));
  background: #090b0f;
}

.social-reel-screen .social-reel-track > .social-reel-post.is-record .social-reel-overlay .social-post-head {
  position: static;
  inset: auto;
  margin-left: 0;
}

.social-reel-screen .social-reel-post.is-record .social-reel-details {
  align-self: stretch;
  width: 100%;
  max-height: none;
}

.social-reel-screen .social-reel-post.is-record .social-reel-description {
  padding-top: 4px;
}

@media (max-width: 390px) {
  .social-reel-screen { --reel-inline-gutter: 10px; --reel-back-clearance: 50px; }
  .social-reel-screen .social-reel-overlay .social-post-head { grid-template-columns: 38px minmax(0, 1fr) auto auto; gap: 7px; }
  .social-reel-screen .social-reel-overlay .social-post-kind { max-width: 74px; overflow: hidden; text-overflow: ellipsis; }
  .social-reel-screen .social-reel-copy h2 { font-size: 28px; }
}

@media (max-height: 680px) {
  .social-reel-details { max-height: min(58dvh, calc(100dvh - var(--safe-top) - var(--safe-bottom) - 72px)); }
  .social-reel-screen .social-reel-post.is-record { grid-template-rows: minmax(178px, 38dvh) minmax(0, 1fr); }
  .social-reel-screen .social-reel-post.is-record .social-performance-cover { min-height: 0; padding-top: 18px; padding-bottom: 14px; }
  .social-reel-screen .social-reel-copy h2 { font-size: 30px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .social-reel-screen { --reel-inline-gutter: 12px; }
  .social-reel-screen .social-reel-post.has-media .social-reel-details { justify-self: end; width: min(48vw, 460px); max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 68px); }
  .social-reel-screen .social-reel-copy h2 { font-size: 26px; }
  .social-reel-screen .social-reel-post.is-record { grid-template-columns: minmax(240px, 45vw) minmax(0, 1fr); grid-template-rows: 1fr; }
  .social-reel-screen .social-reel-post.is-record .social-reel-overlay { height: 100%; }
  .social-reel-swipe-hint { display: none; }
}

@media (min-width: 760px) {
  .social-reel-track > .social-reel-post { border-inline: 1px solid rgba(255, 255, 255, .08); }
  .social-reel-screen .social-reel-back { left: max(calc((100vw - min(680px, 100vw)) / 2 + 14px), var(--safe-left)); }
}

@media (prefers-reduced-motion: reduce) {
  .social-reel-description { scroll-behavior: auto; }
}

@media (min-width: 480px) {
  :root {
    --app-max-width: 100%;
    --adaptive-gutter: 20px;
  }

  .shell {
    inline-size: 100%;
    max-inline-size: 100%;
    border-inline: 0;
  }

  .screen {
    inline-size: 100%;
    margin-inline: auto;
    padding-inline: var(--adaptive-gutter);
  }

  .auth-screen,
  .app-fatal-error,
  .shell.login {
    inline-size: min(calc(100% - 32px), 520px);
    max-inline-size: 520px;
    border-inline: 1px solid var(--border);
  }
}

@media (min-width: 640px) {
  :root { --adaptive-gutter: 24px; }

  .screen {
    max-inline-size: 900px;
  }

  .screen.social-home {
    max-inline-size: var(--adaptive-reading-max);
  }

  .screen.training-flow,
  .profile-settings-screen {
    max-inline-size: var(--adaptive-page-max);
  }

  .social-reel-screen {
    max-inline-size: none;
  }

  .chat-fullscreen {
    inline-size: min(calc(100% - 32px), var(--adaptive-chat-max));
    max-inline-size: var(--adaptive-chat-max);
    border-inline: 1px solid var(--border);
  }

  :is(
    .diet-floating,
    .diet-substitute-floating,
    .exercise-picker-floating,
    .modal-set-type-backdrop,
    .session-extra-exercise-backdrop,
    .session-set-adjustment-backdrop
  ) {
    align-items: center;
    justify-content: center;
    padding: calc(24px + var(--safe-top)) calc(24px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(24px + var(--safe-left));
  }

  :is(
    .diet-floating-panel,
    .diet-substitute-panel,
    .exercise-picker-panel,
    .modal-set-type-sheet,
    .session-extra-exercise-sheet,
    .session-set-adjustment-sheet
  ) {
    inline-size: min(100%, 680px);
    max-inline-size: 680px;
    max-block-size: calc(100dvh - 48px - var(--safe-top) - var(--safe-bottom));
    border: 1px solid var(--border);
    border-radius: 12px;
  }

  .profile-settings-screen {
    margin-inline: auto;
    border-inline: 1px solid var(--border);
  }
}

@media (min-width: 840px) {
  .training-flow > .training-card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .training-flow > .training-card-list > .empty {
    grid-column: 1 / -1;
  }

  .training-flow > .training-card-list :is(.training-plan-card, .training-division-card) {
    block-size: 100%;
  }

  .academy-mini-grid,
  .profile-clean-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .shell > .viewed-profile-screen {
    inset-inline-start: calc(50% + (var(--desktop-nav-width) / 2));
    inline-size: min(calc(100% - var(--desktop-nav-width)), calc(var(--adaptive-shell-max) - var(--desktop-nav-width)));
    max-inline-size: calc(var(--adaptive-shell-max) - var(--desktop-nav-width));
  }
  .viewed-profile-screen > .viewed-profile-body {
    padding-inline: var(--adaptive-gutter);
    padding-block-end: 32px;
  }
  :root {
    --app-max-width: var(--adaptive-shell-max);
    --adaptive-gutter: 30px;
  }

  body {
    padding-inline: var(--safe-left) var(--safe-right);
  }

  .shell:not(.login) {
    inline-size: min(100%, var(--adaptive-shell-max));
    max-inline-size: var(--adaptive-shell-max);
    padding-inline-start: var(--desktop-nav-width);
    border-inline: 1px solid rgba(126, 232, 255, .09);
  }

  .shell.login {
    padding-inline-start: 0;
  }

  .shell:not(.login) > .topbar {
    padding-inline: var(--adaptive-gutter);
  }

  .shell:not(.login) > .bottom-nav {
    inset-block: 0;
    inset-inline-start: max(0px, calc((100vw - var(--adaptive-shell-max)) / 2));
    inset-inline-end: auto;
    transform: none;
    inline-size: var(--desktop-nav-width);
    block-size: 100dvh;
    min-block-size: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, 64px);
    align-content: center;
    padding: var(--safe-top) 8px var(--safe-bottom);
    border-block-start: 0;
    border-inline-end: 1px solid var(--border);
    box-shadow: 14px 0 34px rgba(0, 0, 0, .22);
  }

  .shell:not(.login) > .bottom-nav button {
    min-inline-size: 56px;
    min-block-size: 56px;
    border-radius: 8px;
  }

  .shell:not(.login) > .bottom-nav button.active {
    background: rgba(240, 31, 57, .08);
  }

  .shell:not(.login) > .bottom-nav button.active::after {
    inset-block: 10px;
    inset-inline-start: -8px;
    inset-inline-end: auto;
    inline-size: 2px;
    block-size: auto;
  }

  .screen {
    max-inline-size: var(--adaptive-page-max);
    padding-block-end: 36px;
  }

  .screen.social-home {
    max-inline-size: var(--adaptive-reading-max);
  }

  .profile-settings-screen {
    max-inline-size: 1120px;
    min-block-size: calc(100dvh - 64px - var(--safe-top));
    block-size: calc(100dvh - 64px - var(--safe-top));
    padding-block-end: 0;
  }

  .chat-fullscreen {
    inset-inline-start: calc(50% + (var(--desktop-nav-width) / 2));
    inline-size: min(calc(100vw - var(--desktop-nav-width) - 32px), calc(var(--adaptive-shell-max) - var(--desktop-nav-width)));
    max-inline-size: calc(var(--adaptive-shell-max) - var(--desktop-nav-width));
  }

  :is(.home-quick-add, .diet-quick-fab) {
    inset-inline-start: auto;
    inset-inline-end: max(24px, calc((100vw - var(--adaptive-shell-max)) / 2 + 24px));
    inset-block-end: 24px;
  }
}

@media (min-width: 1180px) {
  .training-flow > .training-card-list {
    gap: 14px;
  }

  .profile-settings-page-body {
    grid-template-columns: 250px minmax(0, 1fr);
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .topbar {
    min-block-size: calc(56px + var(--safe-top));
  }

  .screen {
    padding-block-start: 12px;
  }

  :is(
    .diet-floating-panel,
    .diet-substitute-panel,
    .exercise-picker-panel,
    .modal-set-type-sheet,
    .session-extra-exercise-sheet,
    .session-set-adjustment-sheet
  ) {
    max-block-size: calc(100dvh - 24px - var(--safe-top) - var(--safe-bottom));
  }
}

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

/* Media-only publication viewer: one full-screen item, one active video, real pagination. */
html.social-media-viewer-active,
body.social-media-viewer-active {
  overflow: hidden;
  overscroll-behavior: none;
}

.social-reel-screen {
  --viewer-width: min(100vw, 560px);
  background: transparent;
  max-width: none;
  border: 0;
}

.social-viewer-frozen-background {
  position: fixed;
  inset: 0;
  z-index: 169;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg, #050608);
  filter: blur(6px);
}

body.social-media-viewer-active #app > .shell > :not(.social-reel-screen) {
  visibility: hidden;
}

.social-reel-track {
  width: var(--viewer-width);
  margin-inline: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: auto;
  overscroll-behavior-y: contain;
}

.social-reel-track > .social-reel-post {
  position: relative;
  width: 100%;
  max-width: none;
  height: 100dvh;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #050608;
}

.social-reel-media,
.social-reel-media .social-media-frame,
.social-reel-media :is(img, video) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.social-reel-media .social-media-frame :is(img, video) {
  object-fit: cover;
  background: #090b0f;
}

.social-media-error {
  display: none;
  position: absolute;
  inset: 0;
  place-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background: #0b0e12;
  color: #f5f7f8;
}

.social-media-error span { color: #8da0ad; font-size: 12px; }
.social-media-frame.has-error > :is(img, video) { display: none; }
.social-media-frame.has-error > .social-media-error { display: grid; }

.social-reel-screen .social-reel-overlay {
  position: absolute;
  inset: 0;
  display: block;
  padding: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .28), transparent 22%), linear-gradient(0deg, rgba(0, 0, 0, .88), transparent 62%);
}

.social-reel-screen .social-reel-details {
  position: absolute;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  left: max(14px, env(safe-area-inset-left, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  align-items: end;
  gap: 12px;
  width: auto;
  max-height: none;
  overflow: visible;
}

.social-reel-info {
  display: grid;
  align-content: end;
  gap: 8px;
  min-width: 0;
  padding-bottom: 2px;
  color: #f7f8fa;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .72);
  pointer-events: auto;
}

.social-reel-author {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.social-reel-author .avatar,
.social-reel-author > :first-child {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 35, 66, .72);
  border-radius: 50%;
  background: #14181d;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  object-fit: cover;
}
.social-reel-author > :first-child :is(img, picture) { width: 100%; height: 100%; object-fit: cover; }

.social-reel-author > span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.social-reel-author strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-reel-title {
  max-width: 32ch;
  font-size: 18px;
  line-height: 1.2;
}

.social-reel-caption {
  display: -webkit-box;
  max-width: 44ch;
  margin: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, .9);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.social-reel-meta {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
}

.social-reel-meta span {
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 6px;
  background: rgba(7, 9, 12, .58);
  color: #dfe7eb;
  font-size: 10px;
  font-weight: 800;
}

.social-reel-screen .social-reel-actions {
  display: grid;
  min-height: 0;
  align-content: end;
  gap: 8px;
  padding: 0;
  border: 0;
  pointer-events: auto;
}

.social-reel-screen .social-reel-actions button {
  display: grid;
  width: 52px;
  min-width: 52px;
  height: 52px;
  min-height: 52px;
  place-items: center;
  gap: 1px;
  padding: 6px 4px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  backdrop-filter: none;
  box-shadow: none;
}

.social-reel-screen .social-reel-actions button:is(:hover,:active,:focus-visible) { border:0; background:transparent; box-shadow:none; }
.social-reel-screen .social-reel-actions button.active { color: #ff2847; }
.social-reel-screen .social-reel-actions > button:has(.social-action-count) {
  display: flex;
  flex-direction: row;
  width: 76px;
  min-width: 76px;
  gap: 5px;
  border-radius: 6px;
}
.social-reel-screen .social-reel-actions .social-action-icon,
.social-reel-screen .social-reel-actions .control-icon { width: 22px; height: 22px; }
.social-reel-screen .social-reel-actions small { font-size: 8px; font-weight: 900; line-height: 1; }

.social-reel-screen .social-reel-back {
  position: fixed;
  top: max(10px, env(safe-area-inset-top, 0px));
  left: max(calc((100vw - var(--viewer-width)) / 2 + 12px), env(safe-area-inset-left, 0px));
  z-index: 178;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  background: rgba(8, 10, 13, .68);
  color: #fff;
  backdrop-filter: blur(8px);
}

.social-reel-page-status {
  display: grid;
  width: 100%;
  min-height: 72px;
  place-content: center;
  gap: 7px;
  color: #8da0ad;
  text-align: center;
}

.social-reel-page-status button {
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  background: #101318;
  color: #f5f7f8;
}

.social-reel-loader {
  width: 24px;
  height: 24px;
  margin: auto;
  border: 2px solid rgba(255, 255, 255, .18);
  border-top-color: #ff2342;
  border-radius: 50%;
  animation: social-reel-loading .7s linear infinite;
}

.social-post-detail-screen { padding-top: max(16px, env(safe-area-inset-top, 0px)); }
.social-post-detail-link { width: fit-content; min-height: 44px; margin-top: 6px; color: #9fb2bf; }

@keyframes social-reel-loading { to { transform: rotate(360deg); } }

@media (max-width: 359px) {
  .social-reel-screen .social-reel-details { right: 8px; left: 10px; gap: 8px; }
  .social-reel-screen .social-reel-actions button { width: 48px; min-width: 48px; height: 48px; min-height: 48px; }
  .social-reel-caption { -webkit-line-clamp: 2; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .social-reel-screen .social-reel-details { bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
  .social-reel-screen .social-reel-actions { grid-template-columns: repeat(4, 76px) 48px; }
  .social-reel-screen .social-reel-actions button { width: 48px; min-width: 48px; height: 48px; min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .social-reel-loader { animation-duration: 1.4s; }
}
.social-post-detail-screen .social-post-detail-link { display: none; }

.profile-legal-documents > p { margin: 0; color: var(--muted, #a9b8c4); line-height: 1.6; }
.profile-legal-documents nav { display: grid; min-width: 0; }
.profile-legal-documents nav a { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 52px; padding: 14px 0; border-bottom: 1px solid var(--line, #28333b); color: var(--text, #f5f7f8); text-decoration: none; overflow-wrap: anywhere; }
.profile-legal-documents nav small { color: var(--muted, #a9b8c4); font-size: 12px; }
.profile-legal-documents nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.profile-legal-documents nav a:focus-visible, .social-report-policy a:focus-visible { outline: 2px solid var(--accent, #ff2342); outline-offset: 3px; }
.social-report-policy { margin: 0; }

/* The viewer keeps its selected media above the expandable discussion sheet. */
.social-reel-screen button.social-reel-caption { display:block; width:100%; max-width:44ch; min-height:0; padding:0; border:0; border-radius:0; background:none; text-align:left; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.social-comments-backdrop.is-viewer-comments { display:flex; align-items:flex-end; justify-content:center; background:transparent; backdrop-filter:none; }
.is-viewer-comments .social-comments-panel.diet-floating-panel { width:100%; max-width:none; height:var(--social-comments-height,50dvh); max-height:100dvh; padding:0; grid-template-rows:32px auto minmax(0,1fr) auto; border:0; border-radius:8px 8px 0 0; animation:none; }
.is-viewer-comments .social-comments-drag { display:grid; place-items:center; width:100%; height:32px; min-height:32px; padding:0; border:0; background:none; touch-action:none; cursor:ns-resize; }
.social-comments-drag span { width:36px; height:4px; border-radius:2px; background:#8a9199; }
.is-viewer-comments .social-comments-panel-head { display:none; }
.is-viewer-comments .social-comments-panel.diet-floating-panel { grid-template-rows:32px minmax(0,1fr) auto; }
.is-viewer-comments #social-comments-context { display:none; }
.social-comments-publication { padding:12px 0; }
.social-comments-publication .social-reel-author { color:inherit; }
.social-comments-publication p { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.5; margin:12px 0 0; }
.social-comments-divider { border:0; border-top:1px solid #ffffff26; margin:4px 0 16px; }
html.social-viewer-comments-active .social-reel-screen .social-reel-overlay { visibility:hidden; }
html.social-viewer-comments-active .social-reel-screen .social-reel-media { inset:0 0 auto; height:calc(100dvh - var(--social-comments-height,50dvh)); min-height:0; overflow:hidden; }
html.social-viewer-comments-active .social-reel-media > :is(.social-media-frame,.social-album) { width:auto; height:100%; max-width:100%; aspect-ratio:9/16; min-height:0; }

/* Fit media inside a portrait stage without cropping or exceeding the viewport. */
.social-post .social-post-media:has(.social-media-frame) {
  width:min(100%,calc((100dvh - var(--safe-top,0px) - var(--safe-bottom,0px) - 180px) * 9 / 16));
  height:auto;
  min-height:0;
  max-height:none;
  aspect-ratio:9 / 16;
  margin-inline:auto;
  border-radius:8px;
  overflow:hidden;
}
.social-post-media .social-media-frame :is(img,video),
.social-reel-media .social-media-frame :is(img,video),
.social-story-media :is(img,video),
.social-story-canvas :is(img,video),
.social-publication-preview .social-media-frame :is(img,video) {
  object-fit:contain;
  object-position:center;
  background:#050607;
}
.social-post-media .social-album-track { scrollbar-width:none; }
.social-post-media .social-album-track::-webkit-scrollbar { display:none; }
.social-reel-media { display:grid;place-items:center; }
.social-reel-media > :is(.social-media-frame,.social-album) {
  position:relative;
  inset:auto;
  width:min(100%,calc((100dvh - var(--safe-top,0px) - var(--safe-bottom,0px)) * 9 / 16));
  height:auto;
  max-height:100%;
  aspect-ratio:9 / 16;
  margin:auto;
}
.social-reel-media .social-album-slide > .social-media-frame {
  inset:0;width:100%;height:100%;
}
.social-story-viewer {
  padding:max(8px,var(--safe-top,0px)) max(8px,var(--safe-right,0px)) max(8px,var(--safe-bottom,0px)) max(8px,var(--safe-left,0px));
}
.social-story-viewer .social-story-frame {
  width:min(calc(100dvw - var(--safe-left,0px) - var(--safe-right,0px) - 16px),calc((100dvh - var(--safe-top,0px) - var(--safe-bottom,0px) - 16px) * 9 / 16));
  height:auto;
  min-height:0;
  max-height:100%;
  aspect-ratio:9 / 16;
  border:0;
  border-radius:4px;
}
.social-story-composer-frame .social-story-canvas {
  width:100%;height:100%;min-height:0;
  display:grid;place-items:center;container-type:size;
}
.social-story-canvas .social-story-portrait {
  position:relative;overflow:hidden;background:#050607;
  width:min(100cqw,calc(100cqh * 9 / 16));
  height:min(100cqh,calc(100cqw * 16 / 9));
  aspect-ratio:9 / 16;
}
.social-publication-preview > :is(.social-album,.social-media-frame) {
  width:min(100%,calc(52dvh * 9 / 16));
  height:auto;
  min-height:0;
  aspect-ratio:9 / 16;
  margin-inline:auto;
}
.social-report-policy a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text, #f5f7f8); text-underline-offset: 4px; }
.story-studio [hidden] { display:none !important; }
body .social-story-composer.story-studio { padding:0; background:#050607; }
body .story-studio .social-story-composer-frame { position:relative; width:min(100%,560px); height:100dvh; max-height:100dvh; display:grid; grid-template-rows:auto minmax(0,1fr); border:0; border-radius:0; box-shadow:none; background:#050607; }
body .story-studio .social-story-composer-head { padding:calc(10px + var(--safe-top)) 12px 10px; background:#0e1216; }
.story-studio .social-story-canvas { padding:0 0 calc(72px + var(--safe-bottom)); }
.story-studio .social-story-media-picker { bottom:calc(12px + var(--safe-bottom)); min-height:48px; }
.story-studio-toolbar { position:absolute; right:12px; top:12px; z-index:4; display:grid; gap:10px; }
.story-studio-toolbar button { min-width:48px; min-height:48px; padding:8px; border:1px solid #64717b; border-radius:8px; background:#10151ce6; color:#fff; font-size:12px; }
.story-studio-toolbar button[aria-expanded="true"] { border-color:#ff3147; }
.story-studio button:focus-visible { outline:2px solid #57dcff; outline-offset:3px; }
body .story-studio .social-story-tools { position:absolute; z-index:5; left:12px; right:12px; bottom:calc(76px + var(--safe-bottom)); max-height:45dvh; padding:16px; border:1px solid #48545d; border-radius:8px; background:#10151c; }
.story-studio [data-story-panel] { display:grid; gap:14px; }
.story-studio [data-story-tools-done] { justify-self:end; min-height:44px; color:#fff; background:transparent; border:0; }
.story-studio .social-story-tools label>span { letter-spacing:0; font-size:11px; color:#b8c1c8; }
.story-studio .social-story-colors { flex-wrap:wrap; gap:10px; }
.story-studio .social-story-colors button { width:40px; height:40px; min-width:40px; min-height:40px; }
.story-studio .social-story-empty-media { padding:16px 82px 16px 16px; text-align:center; }
.story-studio .social-story-tools :is(input,select) { color:#fff; background:#0b0f14; }
.story-studio-toolbar svg { width:22px; height:22px; }
.story-studio-toolbar button { display:grid; place-items:center; }
.training-card-list .training-plan-card.is-pdf-plan { border-color: rgba(190, 155, 78, .58); }
.training-card-list .training-plan-card.is-pdf-plan:focus-visible { outline: 2px solid #be9b4e; outline-offset: 3px; }
.constancy-page.consistency-backdrop { padding: 0; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr); background: #0b0e11; color: #f4f6f8; }
.constancy-page .constancy-page__container { inline-size: min(100%,1200px); max-inline-size: 1200px; block-size: 100dvh; max-block-size: 100dvh; width: min(100%,1200px); height: 100dvh; max-height: 100dvh; max-width: 1200px; padding: 0; border: 0; border-radius: 0; background: #0b0e11; box-shadow: none; display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden; }
.constancy-page * { box-sizing: border-box; letter-spacing: 0; }
.constancy-header { display: flex; justify-content: space-between; align-items: center; gap: 4px; min-height: 68px; padding: calc(12px + env(safe-area-inset-top,0px)) 12px 12px; border-bottom: 1px solid #ffffff14; text-align: center; background: #0b0e11; }
.constancy-page button { cursor: pointer; transition: border-color 150ms ease, transform 150ms ease; font-family: inherit; }
.constancy-header button { width: 44px; height: 44px; padding: 10px; color: #f4f6f8; border: 1px solid #ffffff14; border-radius: 50%; background: #101418; font-size: 22px; display: grid; place-items: center; }
.constancy-page svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; }
.constancy-content { min-height: 0; padding: 0 14px calc(24px + env(safe-area-inset-bottom,0px)); overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 18px; }
.constancy-content > * { flex-shrink: 0; min-width: 0; }
.constancy-hero { position: relative; min-height: clamp(184px, 30vw, 300px); margin: 0 -14px; overflow: hidden; border-bottom: 1px solid #ffffff14; background: #050607; }
.constancy-hero img { display: block; width: 100%; height: 100%; min-height: inherit; object-fit: cover; object-position: center; }
.constancy-page .consistency-toolbar { display: flex; gap: 10px; align-items: center; padding: 12px; margin: 0; background: #101418; border: 1px solid #ffffff14; border-radius: 8px; }
.constancy-page .consistency-toolbar label { min-width: 0; gap: 8px; display: flex; align-items: center; font-size: 14px; color: #f4f6f8; }
.constancy-page .consistency-toolbar select { width: auto; min-width: 84px; min-height: 44px; padding: 8px; background: #151a20; color: #f4f6f8; border: 1px solid #ffffff14; border-radius: 6px; }
.constancy-cta { min-height: 44px; background: #d92242; border: 1px solid transparent; color: white; padding: 10px 14px; border-radius: 8px; }
.constancy-summary-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; }
.constancy-page .constancy-summary-card { --accent: #ff3b5c; display: flex; flex-direction: column; gap: 6px; width: 100%; min-width: 0; padding: 16px; text-align: left; border: 1px solid #ffffff14; border-radius: 8px; color: #f4f6f8; background: #12171c; }
.constancy-summary-card.running { --accent: #45d5ee; }
.constancy-summary-card.diet { --accent: #61dd91; }
.constancy-card-heading { display: flex; align-items: center; gap: 10px; color: var(--accent); font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.constancy-card-heading > svg:last-child { margin-left: auto; width: 18px; color: #9da6b2; }
.constancy-card-heading .training-running-icon { width: 24px; height: 24px; }
.constancy-metric { display: block; font-size: 32px; line-height: 1.2; color: #f4f6f8; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.constancy-metric small { font-size: 15px; font-weight: 400; color: #9da6b2; }
.constancy-secondary,.constancy-target { font-size: 13px; line-height: 1.5; color: #9da6b2; margin: 0; overflow-wrap: anywhere; }
.constancy-summary-card progress { appearance: none; width: 100%; height: 4px; border: 0; border-radius: 4px; overflow: hidden; margin-top: 6px; background: #ffffff14; }
.constancy-summary-card progress::-webkit-progress-bar { background: #ffffff14; }
.constancy-summary-card progress::-webkit-progress-value { background: var(--accent); }
.constancy-summary-card progress::-moz-progress-bar { background: var(--accent); }
.constancy-page .consistency-calendar { margin: 0; padding: 0; border: 0; }
.constancy-page .consistency-calendar h3,.constancy-body-card h3 { font-size: 19px; color: #f4f6f8; margin: 0 0 12px; }
.constancy-page .consistency-days { grid-template-columns: repeat(7,minmax(0,1fr)); gap: 5px; }
.constancy-page .consistency-days > div { background: #12171c; padding: 10px 4px; border: 1px solid #ffffff14; border-radius: 6px; gap: 5px; }
.constancy-page .consistency-days strong { font-size: 19px; color: #f4f6f8; }
.constancy-page .consistency-days small { font-size: 11px; color: #9da6b2; }
.constancy-page .consistency-days i { height: 4px; border-radius: 2px; background: #ffffff0a; }
.constancy-page .consistency-days .has-training { background: #ff3b5c; }
.constancy-page .consistency-days .has-running { background: #45d5ee; }
.constancy-page .consistency-days .has-diet { background: #61dd91; }
.constancy-page .consistency-legend { font-size: 12px; color: #9da6b2; margin-top: 12px; }
.constancy-page .consistency-legend span { border: 0; padding: 0; display: flex; align-items: center; gap: 6px; }
.constancy-page .consistency-legend span:before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #ff3b5c; }
.constancy-page .consistency-legend span:nth-child(2):before { background: #45d5ee; }
.constancy-page .consistency-legend span:nth-child(3):before { background: #61dd91; }
.constancy-body-card { padding-top: 18px; border-top: 1px solid #ffffff14; }
.constancy-body-card > header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.constancy-body-card h3 { margin: 0; }
.constancy-page .constancy-goal { background: transparent; border: 0; color: #9da6b2; font-size: 13px; display: flex; gap: 6px; align-items: center; min-height: 44px; padding: 0; text-align: left; max-width: 100%; overflow-wrap: anywhere; }
.constancy-body-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; }
.constancy-body-grid article { min-width: 0; border: 1px solid #ffffff14; border-radius: 8px; background: #151a20; padding: 16px; }
.constancy-body-grid h4 { color: #f4f6f8; font-size: 15px; margin: 0 0 10px; }
.constancy-body-grid .constancy-secondary { margin-top: 6px; }
.constancy-body-card footer { display: flex; justify-content: flex-end; margin-top: 16px; }
.constancy-page .constancy-cta { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 15px; }
.constancy-page .constancy-info-symbol { display: grid; place-items: center; width: 20px; height: 20px; border: 1.5px solid currentColor; border-radius: 50%; font: 700 14px/1 Arial,sans-serif; text-transform: none; }
.constancy-page [data-constancy-info] { padding: 0; display: grid; place-items: center; color: #b9c3cf; }
.constancy-page [data-constancy-info][aria-expanded="true"] { color: #45d5ee; border-color: #45d5ee; }
.constancy-page .constancy-method { position: fixed; inset: 0; margin: auto; width: min(520px,calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 48px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)); overflow-y: auto; overscroll-behavior: contain; padding: 20px; border: 1px solid #ffffff24; border-radius: 8px; background: #12171c; font-size: 14px; color: #b4bdc8; line-height: 1.6; box-shadow: 0 16px 48px #0008; }
.constancy-method::backdrop { background: #000b; }
.constancy-method > header { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.constancy-method > header h3 { margin: 0; min-width: 0; }
.constancy-page [data-constancy-info-close] { width: 44px; height: 44px; flex: 0 0 44px; padding: 10px; display: grid; place-items: center; border: 1px solid #ffffff24; border-radius: 50%; color: #f4f6f8; background: #151a20; }
.constancy-method h3 { color: #f4f6f8; font-size: 18px; }
.constancy-page .consistency-footnote { color: #9da6b2; }
.constancy-page :is(button,select,[tabindex]):focus-visible { outline: 2px solid #45d5ee; outline-offset: 3px; }
.constancy-page button:active { transform: translateY(1px); }
.constancy-page button:disabled { cursor: wait; opacity: .6; }
.constancy-skeleton { height: 166px; border-radius: 8px; background: #151a20; animation: constancy-pulse 1.2s ease-in-out infinite alternate; }
@keyframes constancy-pulse { to { opacity: .45; } }
@media (hover:hover) { .constancy-page button:not(:disabled):hover { transform: translateY(-1px); border-color: #ffffff40; } }
.constancy-personal-goals { display: grid; gap: 12px; padding-top: 18px; border-top: 1px solid #ffffff14; }
.constancy-personal-goals > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.constancy-personal-goals h3 { margin: 0; font-size: 19px; color: #f4f6f8; }
.constancy-personal-goals > header p { margin: 5px 0 0; color: #9da6b2; font-size: 13px; line-height: 1.4; }
.constancy-personal-add,.constancy-personal-goal-form button { min-height: 44px; padding: 10px 13px; border: 1px solid #ff3b5c; border-radius: 8px; color: #fff; background: #d92242; font: inherit; white-space: nowrap; }
.constancy-personal-goal { display: grid; gap: 12px; padding: 14px; border: 1px solid #ffffff14; border-radius: 8px; background: #12171c; }
.constancy-personal-goal > header { display: flex; justify-content: space-between; gap: 12px; }
.constancy-personal-goal h4 { margin: 0; color: #f4f6f8; font-size: 16px; }
.constancy-personal-goal > header p { margin: 5px 0 0; color: #9da6b2; font-size: 13px; line-height: 1.45; }
.constancy-personal-goal > header > span,.constancy-personal-task small { color: #9da6b2; font-size: 12px; white-space: nowrap; }
.constancy-personal-task-list { display: grid; gap: 8px; }
.constancy-personal-task { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid #ffffff0f; }
.constancy-personal-task strong,.constancy-personal-task small { display: block; overflow-wrap: anywhere; }
.constancy-personal-task strong { color: #f4f6f8; font-size: 14px; line-height: 1.35; }
.constancy-personal-task button { min-height: 44px; padding: 8px 10px; border: 1px solid #ffffff24; border-radius: 6px; color: #f4f6f8; background: #151a20; font: inherit; white-space: nowrap; }
.constancy-personal-goal > header > div,.constancy-personal-task > div { min-width: 0; overflow-wrap: anywhere; }
.constancy-task-done { color: #74e2ac; font-size: 12px; white-space: nowrap; }
.constancy-personal-empty { margin: 0; padding: 14px; border: 1px dashed #ffffff24; color: #9da6b2; font-size: 13px; line-height: 1.5; }
.constancy-personal-goal-form { display: grid; gap: 12px; padding: 14px; border: 1px solid #45d5ee44; border-radius: 8px; background: #101820; }
.constancy-personal-goal-form[hidden] { display: none !important; }
.constancy-personal-goal-form label { display: grid; gap: 6px; color: #f4f6f8; font-size: 13px; }
.constancy-personal-goal-form label > span { color: #9da6b2; font-size: 12px; }
.constancy-personal-goal-form :is(input,textarea) { width: 100%; box-sizing: border-box; min-height: 44px; padding: 10px; border: 1px solid #ffffff24; border-radius: 6px; color: #f4f6f8; background: #0b0f14; font: inherit; resize: vertical; }
.constancy-personal-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.constancy-personal-form-actions button:first-child { border-color: #ffffff24; background: transparent; }
.constancy-personal-form-status { margin: 0; color: #ff9baa; font-size: 13px; }
@media (max-width:600px) {
  .constancy-personal-goals > header,.constancy-personal-goal > header { flex-direction: column; }
  .constancy-personal-add { width: 100%; }
  .constancy-personal-task { align-items: stretch; flex-direction: column; }
  .constancy-personal-task button { width: 100%; }
}
@media (max-width:374px) {
  .constancy-hero { min-height: 204px; }
  .constancy-page .consistency-toolbar { flex-wrap: wrap; }
  .constancy-page .consistency-toolbar label { width: 100%; justify-content: space-between; }
}
@media (min-width:640px) { .constancy-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .constancy-summary-card:last-child { grid-column: 1 / -1; } }
@media (min-width:768px) { .constancy-content { padding: 0 28px 28px; gap: 24px; } .constancy-hero { margin-inline: -28px; } .constancy-header { padding-inline: 28px; } .constancy-body-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } .constancy-page .constancy-cta { width: auto; min-width: 240px; } }
@media (min-width:1024px) { .constancy-summary-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } .constancy-summary-card:last-child { grid-column: auto; } .constancy-summary-card { min-height: 190px; } }
@media (prefers-reduced-motion:reduce) { .constancy-page * { animation: none; transition: none; } }
.rat-smooth-chart { position: relative; display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 0 10px; width: 100%; min-width: 0; margin-top: 12px; color: #a6afb9; font-size: 11px; }
.rat-smooth-scale { height: 180px; display: flex; flex-direction: column; justify-content: space-between; padding: 6px 0; text-align: right; font-variant-numeric: tabular-nums; }
.rat-smooth-stage { min-width: 0; }
.rat-smooth-plot { position: relative; height: 180px; cursor: crosshair; touch-action: pan-y; outline: none; }
.rat-smooth-plot:focus-visible { outline: 2px solid #45d5ee; outline-offset: 4px; border-radius: 4px; }
.rat-smooth-plot > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.rat-smooth-grid { stroke: #ffffff12; stroke-width: 1; stroke-dasharray: 2 6; vector-effect: non-scaling-stroke; }
.rat-smooth-line { fill: none; stroke: #ff3b5c; stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.rat-smooth-series.water .rat-smooth-line { stroke: #45d5ee; stroke-width: 2; }
.rat-smooth-series.water .rat-smooth-area { opacity: .4; }
.rat-smooth-record { position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none; }
.rat-smooth-dot { position: absolute; width: 7px; height: 7px; border: 2px solid #ff3b5c; border-radius: 50%; background: #101418; transform: translate(-50%,-50%); box-sizing: border-box; }
.rat-smooth-dot.water { border-color: #45d5ee; }
.rat-smooth-record.is-active .rat-smooth-dot { width: 11px; height: 11px; background: #ff3b5c; border-color: #f4f6f8; }
.rat-smooth-record.is-active .rat-smooth-dot.water { background: #45d5ee; }
.rat-smooth-axis { position: relative; height: 30px; margin-top: 10px; font-size: 11px; }
.rat-smooth-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.rat-smooth-axis span:first-child { transform: none; left: 0 !important; }
.rat-smooth-axis span:last-child:not(:first-child) { transform: translateX(-100%); left: 100% !important; }
.rat-smooth-axis span:only-child { transform: translateX(-50%); left: 50% !important; }
.rat-smooth-tooltip { position: absolute; z-index: 2; width: 230px; max-width: 100%; box-sizing: border-box; padding: 10px 12px; background: #191e24; color: #f4f6f8; border: 1px solid #ffffff26; border-radius: 6px; font-size: 13px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; pointer-events: none; box-shadow: 0 6px 20px #0004; }
.rat-smooth-tooltip[hidden] { display: none; }
.rat-smooth-summary { grid-column: 1 / -1; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; min-width: 0; font-size: 11px; }
.rat-smooth-summary strong { margin-left: auto; color: #e9edf2; font-size: 11px; }
.rat-smooth-summary .main:before,.rat-smooth-summary .water:before { content: ''; display: inline-block; width: 12px; height: 2px; background: #ff3b5c; margin-right: 5px; vertical-align: middle; }
.rat-smooth-summary .water:before { background: #45d5ee; }
@media (min-width:768px) { .rat-smooth-plot,.rat-smooth-scale { height: 210px; } }

/* Match active-workout set rows without wrapping tools below the metrics. */
.exercise-modal-sets { --editor-set-control:44px; }
.exercise-modal-sets .exercise-modal-set-row {
  grid-template-columns:var(--editor-set-control) minmax(0,1fr) var(--editor-set-control);
  gap:4px;
  align-items:start;
}
.exercise-modal-sets .exercise-modal-set-row > .exercise-modal-set-body {
  display:flex;
  align-items:center;
  gap:4px;
  min-width:0;
}
.exercise-modal-sets .exercise-modal-set-body > .exercise-modal-set-fields {
  flex:1 1 0;
  width:0;
  min-width:0;
  gap:4px;
}
.exercise-modal-sets .exercise-modal-set-body > .exercise-modal-set-options {
  display:flex;
  flex:0 0 auto;
  gap:4px;
  align-items:center;
}
.exercise-modal-sets .exercise-modal-set-row :is(.set-type-letter,.trash-set,.session-set-tool) {
  width:var(--editor-set-control);
  min-width:var(--editor-set-control);
  height:44px;
  min-height:44px;
  padding:3px;
}
.exercise-modal-sets .exercise-modal-set-fields input { min-width:0; padding:0 3px; font-size:13px; }
.exercise-modal-sets .exercise-modal-set-body > .exercise-modal-set-fields.treadmill { grid-template-columns:repeat(3,minmax(0,1fr)); }
.exercise-modal-sets .cluster-tag { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
@container (max-width:300px) {
  .exercise-modal-set-row { --editor-set-control:36px; }
}
.exercise-set-adjustment-dialog { padding:0; border:0; background:transparent; color:var(--text); }
.exercise-set-adjustment-dialog::backdrop { background:rgba(0,0,0,.55); }
.exercise-default-rest-control { display:flex; align-items:center; justify-content:center; gap:8px; width:100%; min-height:44px; font-variant-numeric:tabular-nums; background:var(--panel-2); color:var(--text); border:1px solid var(--border); border-radius:6px; }

.workout-history-layout { display:grid; gap:20px; min-width:0; }
.workout-history-layout > section { min-width:0; margin:0; border-radius:8px; }
.workout-history-layout .history-stats-grid { margin:0; }
.history-volume-card-head { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.history-volume-period { display:flex; gap:4px; margin:12px 0; }
.history-volume-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:12px 0; min-width:0; }
.history-volume-toolbar .history-volume-period { margin:0; flex:0 0 auto; }
.history-volume-toolbar .history-volume-period button { padding-inline:10px; }
.history-volume-toolbar > .history-progress-filter--compact { flex:1 1 70px; max-width:156px; min-width:70px; }
.history-volume-toolbar > .history-delta { flex:0 0 auto; }
.history-volume-period button { min-height:36px; padding:6px 16px; border:1px solid var(--border); border-radius:6px; background:transparent; color:var(--text); }
.history-volume-period button[aria-pressed="true"] { border-color:var(--red); background:#ed174525; }
.history-week-ranges { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); max-height:150px; overflow-y:auto; gap:12px; margin-top:12px; padding-bottom:8px; }
.history-week-ranges > span { flex:none; display:grid; gap:4px; font-size:12px; }
.history-week-ranges small { color:var(--muted); font-size:11px; }
.history-exercise-section .rat-smooth-chart { display:block; }
.history-exercise-section .rat-smooth-scale { position:absolute; left:8px; top:0; height:220px; box-sizing:border-box; flex-direction:column; align-items:flex-start; padding:6px 0; font-size:10px; z-index:1; pointer-events:none; }
.history-exercise-section .rat-smooth-stage { width:100%; }
.history-exercise-section .rat-smooth-plot { height:220px; }
.history-exercise-section .rat-smooth-axis,.history-exercise-section .rat-smooth-summary { margin-inline:8px; }
.history-completed-section > h3 { font-size:16px; margin:0 0 12px; }
.history-completed-section > .stack { gap:12px; }
.history-session-title { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:baseline; gap:8px; }
.history-session-title strong { overflow-wrap:anywhere; font-size:14px; }
.history-session-title time { color:var(--muted); font-size:11px; white-space:nowrap; }
.history-session-metrics { display:grid; grid-template-columns:auto auto auto minmax(0,1fr); align-items:center; gap:8px; margin-top:10px; font-size:11px; font-variant-numeric:tabular-nums; }
.history-session-metrics > span { overflow-wrap:anywhere; }
.history-session-actions { display:flex; justify-content:flex-end; align-items:center; gap:2px; }
.history-session-actions button { display:grid; place-items:center; width:32px; height:36px; min-width:32px; padding:0; border:0; border-radius:0; background:transparent; color:var(--text); box-shadow:none; }
.history-session-actions svg { width:18px; height:18px; }
.history-session-card .history-session-extra { display:grid; gap:6px; margin-top:10px; font-size:11px; }
.history-notes-dialog { width:min(440px,calc(100vw - 32px)); max-height:75dvh; box-sizing:border-box; padding:16px; overflow-y:auto; color:var(--text); background:var(--panel); border:1px solid var(--border); border-radius:8px; }
.history-notes-dialog::backdrop { background:#0009; }
.history-notes-dialog > header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.history-notes-dialog > header button { width:40px; height:40px; border:0; background:transparent; color:var(--text); font-size:22px; }
@media (max-width:600px) {
  .history-session-metrics { gap:5px; }
}
@media (min-width:900px) {
  .history-exercise-section .rat-smooth-scale { height:300px; }
  .history-exercise-section .rat-smooth-plot { height:300px; }
  .history-session-actions button { width:40px; height:40px; }
}
.history-exercise-section .history-progress-filter > span { display:none; }
.history-exercise-section .history-progress-picker-trigger {
  border:0;
  border-bottom:1px solid rgba(255,255,255,.3);
  border-radius:0;
  background:transparent;
  box-shadow:none;
  padding:9px 2px;
}
.history-exercise-section .history-progress-picker-trigger:hover,
.history-exercise-section .history-progress-picker-trigger[aria-expanded="true"] {
  border-bottom-color:var(--primary, #ef1b2d);
}
.history-exercise-section .history-progress-picker-trigger:focus-visible {
  outline:2px solid var(--primary, #ef1b2d);
  outline-offset:3px;
}

/* Compact horizontal activity summaries in Constancy. */
.constancy-page .constancy-summary-grid { grid-template-columns:minmax(0,1fr); gap:8px; }
.constancy-page .constancy-summary-card {
  position:relative; display:grid; grid-template-columns:88px 64px minmax(0,1fr);
  grid-template-areas:"heading metric secondary" "heading metric target";
  gap:2px 10px; align-items:center; min-height:80px; padding:12px 32px 12px 12px;
  grid-column:auto; background:#101418;
}
.constancy-page .constancy-summary-card.running { --accent:#45d5ee; }
.constancy-page .constancy-summary-card.diet { --accent:#61dd91; }
.constancy-page .constancy-summary-card .constancy-card-heading { grid-area:heading; gap:7px; margin:0; font-size:14px; min-width:0; }
.constancy-page .constancy-summary-card .constancy-card-heading > svg:first-child,
.constancy-page .constancy-summary-card .training-running-icon { width:20px; height:20px; flex-shrink:0; }
.constancy-page .constancy-summary-card .constancy-card-heading > svg:last-child { position:absolute; right:10px; top:50%; transform:translateY(-50%); width:16px; height:16px; }
.constancy-page .constancy-summary-card .constancy-metric { grid-area:metric; font-size:22px; line-height:1.2; margin:0; min-width:0; overflow-wrap:anywhere; }
.constancy-page .constancy-summary-card .constancy-metric small { display:block; font-size:10px; line-height:1.4; font-weight:400; }
.constancy-page .constancy-summary-card .constancy-secondary { grid-area:secondary; font-size:11px; line-height:1.4; }
.constancy-page .constancy-summary-card .constancy-target { grid-area:target; font-size:11px; line-height:1.4; }
.constancy-page .constancy-summary-card progress { position:absolute; bottom:0; left:12px; width:calc(100% - 44px); height:2px; margin:0; }
@media(max-width:380px) {
  .constancy-page .constancy-summary-card { grid-template-columns:76px 54px minmax(0,1fr); column-gap:8px; }
  .constancy-page .constancy-summary-card .constancy-card-heading { font-size:13px; gap:5px; }
}

.constancy-page .constancy-progression { --chart-color:#ff3b5c; min-width:0; padding:8px 4px 18px; margin-bottom:8px; border-bottom:1px solid #ffffff14; }
.constancy-page .constancy-progression.running { --chart-color:#45d5ee; }
.constancy-page .constancy-progression.diet { --chart-color:#61dd91; }
.constancy-page .constancy-progression h4 { margin:0 0 12px; font-size:12px; line-height:1.4; font-weight:600; }
.constancy-page .constancy-progression .rat-smooth-plot,
.constancy-page .constancy-progression .rat-smooth-scale { height:146px; }
.constancy-page .constancy-progression .rat-smooth-line { stroke:var(--chart-color); }
.constancy-page .constancy-progression .rat-smooth-dot { border-color:var(--chart-color); }
.constancy-page .constancy-progression .is-active .rat-smooth-dot { background:var(--chart-color); }
.constancy-page .constancy-progression stop { stop-color:var(--chart-color); }
.constancy-page .constancy-progression .rat-smooth-empty { font-size:12px; margin:0; padding:16px 0; }

.constancy-goals-entry { display:flex; align-items:center; justify-content:space-between; gap:16px; width:100%; padding:16px 0; background:none; border:0; border-bottom:1px solid #ffffff24; color:#f4f6f8; text-align:left; }
.constancy-goals-entry span { display:grid; gap:4px; }
.constancy-goals-entry strong { font-size:16px; }
.constancy-goals-entry small { color:#aeb8c2; }
.constancy-goals-entry svg { width:20px; height:20px; }
.goals-page .constancy-header { justify-content:flex-start; gap:12px; }
.goals-page h2 { font-size:20px; margin:0; }
.goals-page .goals-content { padding-top:20px; }
.goals-list-heading,.goals-task-heading,.goals-xp,.goals-progress { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.goals-list-heading > span,.goals-task-heading > span,.goals-rule { font-size:12px; color:#aeb8c2; }
.goals-editor { display:grid; gap:18px; min-width:0; }
.goals-editor label { display:grid; gap:7px; font-size:13px; }
.goals-editor :is(input,textarea,select) { width:100%; min-width:0; box-sizing:border-box; border:1px solid #ffffff24; border-radius:6px; background:#101417; color:#f4f6f8; min-height:44px; padding:10px; font:inherit; color-scheme:dark; }
.goals-editor textarea { resize:vertical; }
.goals-editor h3 { font-size:16px; margin:8px 0 0; }
.goals-task-editor { display:grid; gap:10px; }
.goals-task-row { display:grid; grid-template-columns:18px minmax(0,1fr) 34px 36px; gap:6px; align-items:center; }
.goals-task-row > span,.goals-task-row small { font-size:11px; color:#aeb8c2; }
.goals-task-row > button { display:grid; place-items:center; min-height:44px; padding:0; background:none; border:0; color:#f4f6f8; }
.goals-task-row svg { width:18px; height:18px; }
.goals-page button:disabled { opacity:.45; cursor:not-allowed; }
.goals-page :is(button,input,select,textarea):focus-visible { outline:2px solid #45d5ee; outline-offset:2px; }
.goals-xp { border-top:1px solid #ffffff24; padding-top:18px; font-size:14px; }
.goals-xp output { color:#61dd91; font-size:20px; font-weight:700; white-space:nowrap; }
.goals-rule { margin:0; line-height:1.5; }
.goals-progress { font-size:12px; color:#aeb8c2; }
.goals-page progress { width:100%; height:4px; accent-color:#ff3b5c; }
.goals-page .constancy-personal-goal { background:transparent; border:0; border-bottom:1px solid #ffffff24; border-radius:0; padding:12px 0 24px; }
.goals-page .constancy-personal-task { flex-direction:row; align-items:center; }
.goals-page .constancy-personal-task button { width:auto; flex-shrink:0; font-size:12px; }

.progress-body-summary { padding:16px 0; border-block:1px solid #ffffff24; }
.progress-body-summary header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.progress-body-summary h3 { margin:0; font-size:16px; }
.progress-body-summary header small { display:block; margin-top:4px; color:#aeb8c2; font-size:12px; }
.progress-body-summary button { display:grid; place-items:center; width:44px; height:44px; flex-shrink:0; border:0; background:none; color:#fff; padding:0; }
.progress-body-summary button svg { width:20px; height:20px; }
.progress-body-summary button:focus-visible { outline:2px solid #45d5ee; outline-offset:2px; }
.progress-body-summary button:hover { color:#45d5ee; }
.progress-body-summary dl { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:12px 0 0; }
.progress-body-summary dt { font-size:12px; color:#aeb8c2; margin-bottom:5px; }
.progress-body-summary dd { font-size:20px; font-weight:700; margin:0; overflow-wrap:anywhere; }
.progress-body-summary dd small { font-size:12px; font-weight:400; color:#aeb8c2; }

.rpg-home:has(> .rpg-mission-tabs) > .rpg-subpage-head > .training-back,
.rpg-home:has(> .rpg-mission-tabs) > .rpg-subpage-head > .training-back:hover,
.rpg-home:has(> .rpg-mission-tabs) > .rpg-subpage-head > .training-back:active {
  border: 0;
  background: transparent;
  box-shadow: none;
}
.rpg-home:has(> .rpg-mission-tabs) > .rpg-subpage-head > .training-back:focus-visible {
  outline: 2px solid #45d5ee;
  outline-offset: 2px;
}

.club-discovery-header .club-search-bar > label {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.club-discovery-header .club-search-bar > label > input,
.club-discovery-header .club-search-bar > label > input:focus {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.constancy-header > button[data-constancy-info],
.constancy-header > button[data-constancy-info]:hover,
.constancy-header > button[data-constancy-info]:active {
  border: 0;
  background: transparent;
  box-shadow: none;
}
.constancy-header > button[data-constancy-info]:focus-visible {
  outline: 2px solid #45d5ee;
  outline-offset: 2px;
}

.constancy-header > button[data-home-panel-close],
.constancy-header > button[data-home-panel-close]:hover,
.constancy-header > button[data-home-panel-close]:active {
  border: 0;
  background: transparent;
  box-shadow: none;
}
.constancy-header > button[data-home-panel-close]:focus-visible {
  outline: 2px solid #45d5ee;
  outline-offset: 2px;
}

.constancy-header:has(> [data-constancy-period-trigger]) { position: relative; }
.constancy-header:has(> [data-constancy-period-trigger]) > [data-constancy-info] { margin-left: auto; }
.constancy-header > button[data-constancy-period-trigger] { border:0; background:transparent; box-shadow:none; }
.constancy-header > button[data-constancy-period-trigger]:focus-visible { outline:2px solid #45d5ee; outline-offset:2px; }
.constancy-header > button[data-constancy-period-trigger][aria-expanded="true"] { color:#45d5ee; }
.constancy-header .constancy-period-menu { position:absolute; top:calc(100% - 4px); right:12px; z-index:5; width:160px; padding:4px; border:1px solid #ffffff24; border-radius:6px; background:#101418; box-shadow:0 8px 20px #0006; }
.constancy-header .constancy-period-menu[hidden] { display:none; }
.constancy-header .constancy-period-menu button { display:flex; justify-content:space-between; align-items:center; gap:12px; width:100%; height:44px; padding:10px 12px; border:0; border-radius:4px; background:transparent; color:#f4f6f8; font-size:14px; }
.constancy-header .constancy-period-menu button[aria-checked="true"] { color:#45d5ee; }
.constancy-header .constancy-period-menu button:hover,.constancy-header .constancy-period-menu button:focus-visible { background:#242c34; outline:0; }
.constancy-header .constancy-period-menu svg { width:18px; height:18px; }

.training-flow:has(> .training-card-list) > .training-step-header:has(> [data-training-step="plans"]) .training-step-title h1 { font-size: 21.7px; overflow-wrap: anywhere; }

.running-plan-card-top:has(> .running-plan-card-actions) { grid-template-columns: 42px minmax(0, 1fr) auto 12px; gap: 8px; }
.running-plan-card-title { min-width: 0; overflow-wrap: anywhere; }
.running-plan-card-actions { display: flex; gap: 6px; }
.running-plan-card-actions button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; background: #0b0e11; color: #dce3e8; }
.running-plan-card-actions button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.running-plan-card-actions svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.notifications-fullscreen > .chat-header { grid-template-columns: 38px minmax(0, 1fr) auto; }

/* Exercise search occupies the viewport; only results scroll. */
.exercise-picker-floating {
  padding: 0;
  place-items: stretch;
  place-content: stretch;
  grid-template-columns: minmax(0, 1fr);
  background: var(--bg, #0b0d10);
  backdrop-filter: none;
}
.exercise-picker-floating > .exercise-picker-panel {
  width: 100%;
  inline-size: 100%;
  max-inline-size: none;
  height: 100dvh;
  block-size: 100dvh;
  max-height: none;
  max-block-size: none;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  box-sizing: border-box;
  padding: var(--safe-top, 0px) var(--safe-right, 0px) var(--safe-bottom, 0px) var(--safe-left, 0px);
}
.exercise-picker-panel > .exercise-picker-panel-head,
.exercise-picker-panel > .exercise-picker-search-shell,
.exercise-picker-panel > .exercise-picker-footer { flex-shrink: 0; }
.exercise-picker-panel > .exercise-picker-results {
  min-height: 0;
  overscroll-behavior: contain;
}

.exercise-picker-panel .exercise-picker-search-shell > input,
.exercise-picker-panel .exercise-picker-search-shell > input:focus {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}
.exercise-picker-panel .exercise-picker-search-shell:focus-within {
  border-color: var(--cyan);
}

.exercise-picker-panel .exercise-picker-search-shell > span {
  color: #fff;
}

.training-set-row .seq-editor.session .seq-row {
  grid-template-columns: 24px minmax(36px, 1fr) minmax(36px, 1fr) 38px 28px 24px;
  gap: 4px;
}
.training-set-row .seq-editor.session .seq-field input { min-width: 0; padding-inline: 3px; }
.training-set-row .seq-editor.session .seq-complete {
  width: 28px; height: 38px; min-width: 0; padding: 4px;
  border: 0; background: transparent; box-shadow: none; color: var(--muted);
  align-self: end;
}
.training-set-row .seq-editor.session .seq-complete.done { color: #35d07f; }
.training-set-row .seq-editor.session .seq-del { width: 24px; min-width: 0; padding: 2px; }
.training-set-row .seq-editor.session .seq-row > * { min-width: 0; max-width: 100%; box-sizing: border-box; }
.training-set-row .seq-editor.session .seq-rest-trigger { width: 100%; min-width: 0; box-sizing: border-box; }

.session-exercise-head-copy:has(> .session-technique-control) { row-gap: 0; }
.session-exercise-head-copy .session-technique-name { min-height: 28px; padding: 2px 0; }

.history-progress-filter { position: relative; }
.history-progress-filter:not(.history-progress-filter--compact) > .history-progress-picker-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 30;
  box-sizing: border-box;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .4);
}
