/* me-hub.css -- OWNER: the Me screen (the compact settings hub).
 *
 * Loaded by index.html after app.css. Everything for the four-row hub
 * (Profile / Study defaults / People & privacy / App & help), its header, and
 * the avatar screen that opens out of Profile belongs in this file.
 *
 * House rules that still apply here:
 *   - no url(), no raw hex (colour values come from styles/tokens.css)
 *   - each row is one tap target of 44px and up, with its current value on a
 *     second line
 *   - the first screen stays inside about 1.2 screens at 390x844
 *   - honour prefers-reduced-motion
 */

/* ===================================================================
   The header: face, name, what it is for, and one Edit
   =================================================================== */

.me-head {
  padding-top: 16px;
  padding-bottom: 16px;
}

.me-head-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.me-head-face {
  flex: 0 0 auto;
  display: inline-flex;
  width: 56px;
  height: 56px;
}

.me-head-face-button {
  padding: 0;
  border-radius: 999px;
  transition: transform var(--press-duration) var(--motion-ease),
              box-shadow var(--press-duration) var(--motion-ease);
}

.me-head-face-button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
}

.me-head-face-button:active { transform: scale(0.95); }

/* compose() sizes itself; the ink fallback takes the same box. */
.me-head-face .avatar {
  width: 56px;
  height: 56px;
}

.me-head-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.me-head-name {
  font-size: 20px;
  line-height: 1.25;
}

.me-head-for {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}

.me-head .btn {
  flex: 0 0 auto;
}

.me-head .note {
  margin-top: 12px;
}

/* The unset Spanish CTA is longer than its English/Japanese counterparts.
   On narrow phones it used to squeeze the name column until even "nombre"
   broke mid-word. Keep the identity together, then give the primary setup
   action a calm full-width row. The compact Edit state stays unchanged. */
@media (max-width: 430px) {
  .me-head-row:has(> .btn-primary) {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: center;
  }

  .me-head-row:has(> .btn-primary) > .btn-primary {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* A compact, Duolingo-like friend state strip. It deliberately contains only
   presence, so a future profile screen can own subjects and room history. */
.me-friend-status {
  margin: 0 var(--gutter) 16px;
  padding: 14px 0 0;
  border-top: var(--rule) solid var(--line);
}

.me-friend-status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 12px;
  margin-top: 11px;
}

.me-friend-status-item {
  flex: 0 0 72px;
  min-width: 0;
}

.me-friend-status-person {
  display: grid;
  width: 72px;
  min-height: 78px;
  justify-items: center;
  align-content: start;
  gap: 4px;
  padding: 0;
  color: var(--ink);
  text-align: center;
}

.me-friend-status-person:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
  border-radius: 12px;
}

.me-friend-status-face {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 3px solid transparent;
  border-radius: 999px;
}

.me-friend-status-face .avatar { width: 48px; height: 48px; }
.me-friend-status-person.is-studying .me-friend-status-face { border-color: var(--ai); }
.me-friend-invite-face {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink-soft);
}
.me-friend-invite-icon { width: 24px; height: 24px; }
.me-friend-invite:active .me-friend-invite-face {
  background: var(--green-soft);
  color: var(--green);
}
.me-friend-status-name {
  display: block;
  width: 100%;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-friend-status-clock {
  color: var(--ai-ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.15;
}
.me-friend-status-empty { margin-top: 7px; color: var(--muted); font-size: 13px; }

/* ===================================================================
   Friend momentum: one private Circle, not a global follower graph.
   =================================================================== */

.me-momentum {
  margin: 0 var(--gutter) 14px;
  padding: 16px;
  border: var(--rule) solid var(--ai-line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 90% 8%, var(--white), transparent 42%),
    var(--ai-wash);
}

.me-momentum-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.me-momentum-title { margin-top: 3px; color: var(--ai-ink); font-size: 21px; }
.me-own-streak { display: grid; flex: 0 0 auto; justify-items: end; color: var(--yamabuki-ink); }
.me-own-streak strong { font-family: var(--serif); font-size: 28px; line-height: 1; }
.me-own-streak span { margin-top: 3px; color: var(--muted); font-size: 11px; }

.me-friend-streaks {
  display: flex;
  gap: 13px;
  margin-top: 16px;
  overflow-x: auto;
  padding-bottom: 5px;
  scrollbar-width: none;
}

.me-friend-streaks::-webkit-scrollbar { display: none; }
.me-friend-streak { display: grid; flex: 0 0 58px; justify-items: center; gap: 3px; text-align: center; }
.me-friend-streak .avatar { box-shadow: 0 0 0 2px var(--white); }
.me-friend-name { width: 100%; overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.me-friend-days { width: 100%; color: var(--muted); font-size: 10px; line-height: 1.25; }
.me-momentum-empty { margin-top: 13px; color: var(--muted); font-size: 13px; line-height: 1.45; }

.me-momentum-setup {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
  margin-top: 12px;
  padding-top: 10px;
  border-top: var(--rule) solid var(--ai-line);
  color: var(--ai-ink);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.me-momentum-setup span { flex: 1 1 auto; }
.momentum-setup-sheet { display: grid; gap: 16px; padding: 0 var(--gutter) 18px; }
.momentum-setup-lead { color: var(--ink-soft); line-height: 1.55; }
.momentum-setup-steps { display: grid; gap: 12px; }
.momentum-setup-steps li { display: flex; align-items: center; gap: 11px; color: var(--ink-soft); }
.momentum-setup-steps strong {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 999px;
  background: var(--ai-wash);
  color: var(--ai-ink);
}

.sheet.sheet-guide {
  width: min(100%, 640px);
  height: min(94dvh, 900px);
  max-height: calc(100dvh - var(--safe-top));
  padding-bottom: 0;
}

.sheet-guide .sheet-body {
  display: flex;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.sheet-guide .momentum-setup-sheet {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
}

.pwa-guide-carousel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  gap: 12px;
  padding: 14px var(--gutter) max(16px, var(--safe-bottom));
}

.pwa-device-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--paper-raise);
  border: var(--rule) solid var(--line);
  border-radius: 14px;
}

.pwa-device-tab {
  min-height: var(--tap);
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-weight: 700;
}

.pwa-device-tab.is-selected {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--ink) 8%, transparent);
}

.pwa-step-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pwa-step-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.pwa-step-meta-end { display: flex; align-items: center; gap: 12px; }
.pwa-step-app-icon { width: 30px; height: 30px; border-radius: 8px; }
.pwa-step-dots { display: flex; gap: 6px; }
.pwa-step-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--line);
  transition: width var(--motion-duration) var(--motion-ease),
              background var(--motion-duration) var(--motion-ease);
}
.pwa-step-dot.is-current { width: 22px; background: var(--cta); }

.pwa-step-viewport {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  touch-action: pan-y;
}

.pwa-step-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform var(--motion-duration) var(--motion-ease);
  will-change: transform;
}

.pwa-step-slide {
  display: flex;
  align-items: center;
  flex: 0 0 100%;
  min-width: 0;
  min-height: 0;
}

.pwa-guide-shot {
  width: min(100%, 480px);
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  background: var(--paper-raise);
  border: var(--rule) solid var(--line);
  border-radius: 16px;
}

.pwa-guide-shot img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.pwa-guide-shot figcaption {
  padding: 10px 12px 12px;
  border-top: var(--rule) solid var(--line);
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}

.pwa-guide-message {
  display: grid;
  width: min(100%, 480px);
  min-height: min(100%, 360px);
  margin: auto;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 28px 24px;
  border: var(--rule) solid var(--line);
  border-radius: 16px;
  background: var(--paper-raise);
  text-align: center;
}

.pwa-guide-message-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
}

.pwa-guide-message-step {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pwa-guide-message h3 { font-size: 20px; }
.pwa-guide-message p {
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.6;
}

.pwa-step-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: 10px;
  align-self: end;
}

.pwa-step-actions .btn {
  width: 100%;
  height: 48px;
}

@media (max-width: 640px) {
  .sheet.sheet-guide {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding-top: var(--safe-top);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pwa-step-track,
  .pwa-step-dot { transition: none; }
}

.pwa-guide-fallback {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

/* iPhone Home Screen setup is a device operation most people have never
   performed. The motion names only the four decisions; it is not a brittle
   screenshot of one Safari version and is never the sole accessible copy. */
.ios-home-motion {
  width: min(100%, 340px);
  margin: 0 auto;
}

.ios-home-demo {
  position: relative;
  height: 220px;
  overflow: hidden;
  background: color-mix(in srgb, var(--ai-wash) 58%, var(--paper) 42%);
  border: var(--rule) solid var(--ai-line);
  border-radius: 24px;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--ink) 10%, transparent);
}

.ios-demo-browser,
.ios-demo-actions,
.ios-demo-confirm,
.ios-demo-home {
  position: absolute;
  inset: 0;
  transition:
    opacity 360ms var(--motion-ease),
    transform 420ms var(--motion-ease);
}

.ios-demo-browser {
  display: grid;
  grid-template-rows: 1fr 50px;
  background: var(--white);
}

.ios-demo-page {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 17px;
  padding: 20px;
}

.ios-demo-wordmark {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
}

.ios-demo-start {
  min-width: 138px;
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--cta-deep);
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.ios-demo-toolbar {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 9px;
  background: color-mix(in srgb, var(--paper) 92%, var(--white) 8%);
  border-top: var(--rule) solid var(--line);
}

.ios-demo-tool {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  color: var(--ai-ink);
}

.ios-demo-tool-muted::before,
.ios-demo-tool-muted::after {
  position: absolute;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: var(--muted);
  content: '';
}

.ios-demo-tool-muted::before { transform: translateY(-4px); }
.ios-demo-tool-muted::after { transform: translateY(4px); }

.ios-demo-address {
  overflow: hidden;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--white);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ios-demo-tap {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 2px solid var(--cta);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
}

.ios-demo-actions {
  top: 34px;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 10px 12px 16px;
  background: color-mix(in srgb, var(--paper) 96%, var(--white) 4%);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 30px color-mix(in srgb, var(--ink) 14%, transparent);
  opacity: 0;
  transform: translateY(102%);
}

.ios-demo-handle {
  width: 38px;
  height: 4px;
  justify-self: center;
  border-radius: 999px;
  background: var(--line);
}

.ios-demo-actions-title {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ios-demo-action-row {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr 24px;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 11px;
  background: var(--white);
  border: 2px solid var(--ai);
  border-radius: 16px;
  color: var(--ai-ink);
  box-shadow: 0 5px 16px color-mix(in srgb, var(--ai) 12%, transparent);
}

.ios-demo-action-label { font-size: 12px; font-weight: 800; }
.ios-demo-action-row .ios-demo-tap { right: 7px; }

.ios-demo-app-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: var(--cta-deep);
  color: var(--white);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
}

.ios-demo-confirm {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 17px 15px;
  background: color-mix(in srgb, var(--paper) 96%, var(--white) 4%);
  opacity: 0;
  transform: translateX(9%);
}

.ios-demo-confirm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.ios-demo-add-button {
  position: relative;
  display: grid;
  min-width: 44px;
  min-height: 32px;
  place-items: center;
  border-radius: 999px;
  background: var(--ai);
  color: var(--white);
  font-size: 10px;
}

.ios-demo-add-button .ios-demo-tap { top: 1px; right: 7px; }

.ios-demo-confirm-app {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: var(--rule) solid var(--line);
}

.ios-demo-confirm-app > span:last-child { display: grid; }
.ios-demo-confirm-app strong { font-size: 12px; }
.ios-demo-confirm-app small { color: var(--muted); font-size: 9px; }

.ios-demo-webapp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.ios-demo-switch {
  display: flex;
  width: 34px;
  height: 20px;
  justify-content: flex-end;
  padding: 2px;
  border-radius: 999px;
  background: var(--green);
}

.ios-demo-switch i {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--white);
}

.ios-demo-home {
  display: grid;
  align-content: center;
  gap: 15px;
  padding: 22px;
  background:
    radial-gradient(circle at 18% 8%, var(--white), transparent 27%),
    linear-gradient(150deg, var(--ai-wash), var(--green-soft));
  opacity: 0;
  transform: scale(1.04);
}

.ios-demo-home-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: start;
  gap: 14px;
}

.ios-demo-placeholder {
  aspect-ratio: 1;
  border-radius: 13px;
  background: color-mix(in srgb, var(--white) 60%, transparent);
}

.ios-demo-home-app {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 700;
}

.ios-demo-app-mark-large {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  box-shadow: 0 7px 15px color-mix(in srgb, var(--cta) 22%, transparent);
}

.ios-demo-home-app .ios-demo-tap { top: 7px; }

.ios-demo-opened {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--white);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.ios-home-caption {
  display: grid;
  min-height: 44px;
  place-items: center;
  padding: 8px 8px 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.ios-home-caption-step { display: none; }
.ios-home-progress { display: flex; justify-content: center; gap: 6px; margin-top: 7px; }
.ios-home-progress i { width: 6px; height: 6px; border-radius: 999px; background: var(--line); }
.ios-home-replay { min-height: var(--tap); justify-self: center; }

.ios-home-motion[data-stage="share"] [data-motion-caption="share"],
.ios-home-motion[data-stage="actions"] [data-motion-caption="actions"],
.ios-home-motion[data-stage="confirm"] [data-motion-caption="confirm"],
.ios-home-motion[data-stage="home"] [data-motion-caption="home"] { display: inline; }

.ios-home-motion[data-stage="share"] [data-motion-dot="share"],
.ios-home-motion[data-stage="actions"] [data-motion-dot="actions"],
.ios-home-motion[data-stage="confirm"] [data-motion-dot="confirm"],
.ios-home-motion[data-stage="home"] [data-motion-dot="home"] { width: 18px; background: var(--ai); }

.ios-home-motion[data-stage="share"] .ios-demo-share .ios-demo-tap,
.ios-home-motion[data-stage="actions"] .ios-demo-action-row .ios-demo-tap,
.ios-home-motion[data-stage="confirm"] .ios-demo-add-button .ios-demo-tap,
.ios-home-motion[data-stage="home"] .ios-demo-home-app .ios-demo-tap {
  animation: ios-guide-tap 1.35s ease-out infinite;
}

.ios-home-motion[data-stage="actions"] .ios-demo-browser {
  opacity: 0.42;
  transform: scale(0.98);
}

.ios-home-motion[data-stage="actions"] .ios-demo-actions {
  opacity: 1;
  transform: none;
}

.ios-home-motion[data-stage="confirm"] .ios-demo-browser,
.ios-home-motion[data-stage="confirm"] .ios-demo-actions {
  opacity: 0;
  transform: translateX(-7%);
}

.ios-home-motion[data-stage="confirm"] .ios-demo-confirm {
  opacity: 1;
  transform: none;
}

.ios-home-motion[data-stage="home"] .ios-demo-browser,
.ios-home-motion[data-stage="home"] .ios-demo-actions,
.ios-home-motion[data-stage="home"] .ios-demo-confirm {
  opacity: 0;
  transform: scale(0.96);
}

.ios-home-motion[data-stage="home"] .ios-demo-home {
  opacity: 1;
  transform: none;
}

@keyframes ios-guide-tap {
  0% { opacity: 0; transform: scale(0.62); }
  24% { opacity: 0.9; transform: scale(0.82); }
  72%, 100% { opacity: 0; transform: scale(1.32); }
}

@media (max-width: 360px) {
  .ios-home-demo { height: 204px; }
  .ios-demo-home-grid { gap: 9px; }
}

/* ===================================================================
   The four rows. Name on the first line, current value on the second.
   =================================================================== */

.me-hub {
  padding-top: 0;
  padding-bottom: 0;
}

.me-hub-row {
  min-height: 60px;
  padding-top: 12px;
  padding-bottom: 12px;
}

/* The summary is the point of the row, so it is allowed to run to two lines
   rather than being clipped to an ellipsis nobody can expand. */
.me-hub-row .row-meta {
  line-height: 1.4;
}

.me-hub-foot {
  padding: 14px var(--gutter) 18px;
}

/* ===================================================================
   Profile: the door to the avatar screen
   =================================================================== */

.me-avatar-entry-face {
  display: inline-flex;
  width: 40px;
  height: 40px;
}

.me-avatar-entry-face .avatar {
  width: 40px;
  height: 40px;
}

/* ===================================================================
   The avatar screen
   Preview held still at the top, six swipe rails below, one commit band.
   =================================================================== */

.me-avatar-top {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  justify-items: center;
  padding: 6px var(--gutter) 12px;
  background: var(--paper);
  border-bottom: var(--rule) solid var(--line);
}

.me-avatar-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
}

.me-avatar-title {
  flex: 1 1 auto;
  font-size: 17px;
  text-align: center;
  /* Balances the Back button so the title reads as centred without a spacer
     element nobody can focus. */
  padding-right: 64px;
}

.me-avatar-preview {
  display: grid;
  width: 128px;
  height: 128px;
  place-items: center;
  margin-top: 4px;
}

.me-avatar-preview .avatar {
  box-shadow: inset 0 0 0 1px var(--ink-faint);
}

.me-avatar-help {
  margin-top: 8px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  text-align: center;
}

.me-rails {
  padding: 4px 0 8px;
}

.me-rail-block {
  padding: 12px 0 10px;
  border-bottom: var(--rule) solid var(--line);
}

.me-rail-block:last-child {
  border-bottom: 0;
}

.me-rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 var(--gutter) 8px;
}

.me-rail-title {
  font-size: 15px;
}

.me-rail-count {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.me-rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  /* Half-rail edge space so the first and last choice can reach the centre
     too, which is what the snap point is measured against. */
  padding: 3px calc(50% - 36px) 10px;
  scroll-padding-inline: calc(50% - 36px);
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.me-rail::-webkit-scrollbar {
  display: none;
}

.me-rail-option {
  display: grid;
  flex: 0 0 72px;
  min-width: 72px;
  min-height: 88px;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 5px 4px 3px;
  background: var(--paper-raise);
  border: 2px solid transparent;
  border-radius: 16px;
  scroll-snap-align: center;
  transition:
    border-color var(--press-duration) var(--motion-ease),
    background-color var(--press-duration) var(--motion-ease),
    transform var(--press-duration) var(--motion-ease);
}

.me-rail-option:active {
  transform: scale(0.97);
}

.me-rail-option[aria-pressed="true"] {
  background: var(--white);
  border-color: var(--green);
}

.me-rail-option .avatar {
  box-shadow: inset 0 0 0 1px var(--ink-faint);
}

.me-rail-label {
  min-height: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 18px;
}

.me-rail-option[aria-pressed="true"] .me-rail-label {
  color: var(--green);
  font-weight: 700;
}

/* Avatar choices scroll independently while the one commit action stays in
   the predictable band immediately above the global dock. Reserving the same
   band at the end of .me-rails keeps the final row fully reachable. */
.me-avatar-commit .btn {
  min-height: 52px;
}

@media (max-width: 959px) {
  /* A transformed panel becomes the containing block for position: fixed.
     The avatar screen is an in-panel editor, so it skips the entry animation
     and lets its commit band pin to the real viewport instead. */
  #panel-me:has(.me-avatar-top) { animation: none; }

  .me-rails { padding-bottom: calc(var(--primary-bar-h) + 16px); }

  .me-avatar-commit {
    position: fixed;
    right: 0;
    bottom: calc(var(--dock-h) + var(--safe-bottom));
    left: 50%;
    width: min(100%, var(--app-frame-max));
    padding-bottom: 12px;
    transform: translateX(-50%);
    z-index: 24;
  }
}

@media (max-width: 640px), (max-height: 600px) {
  .me-avatar-commit { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .me-rail {
    scroll-behavior: auto;
  }

  .me-rail-option:active {
    transform: none;
  }
}

/* App help is read inside the sheet. Paragraphs and numbered steps remain
   intact instead of being forced through compact, two-line settings rows. */
.help-lede {
  margin: 0 var(--gutter) 18px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.65;
}

.help-topics {
  display: grid;
  gap: 12px;
  padding: 0 var(--gutter) 24px;
}

.help-topic {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
}

.help-topic-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
}

.help-topic-heading::-webkit-details-marker { display: none; }
.help-topic-heading::after {
  width: 8px;
  height: 8px;
  margin: 0 3px 4px auto;
  flex: 0 0 auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  content: '';
  transform: rotate(45deg);
  transition: transform var(--motion-duration) var(--motion-ease);
}
.help-topic[open] > .help-topic-heading::after { margin-bottom: -4px; transform: rotate(225deg); }
.help-topic-heading:focus-visible { outline: 2px solid var(--green); outline-offset: -3px; }
.help-topic-content { padding: 0 16px 16px; }

.help-topic-icon {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: var(--cta-deep);
  background: var(--cta-soft);
}

.help-topic-icon .icon { width: 18px; height: 18px; }
.help-topic-title { margin: 0; font-size: 17px; line-height: 1.35; }

.help-topic-body,
.help-topic-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.65;
}

.help-topic-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 16px;
}

.help-topic-steps {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.55;
}

@media (prefers-reduced-motion: reduce) {
  .help-topic-heading::after { transition: none; }
}

/* Red CSS annotations sit over real demo=review captures, so the source
   screenshots and the callout geometry stay independently maintainable. */
.guide-tour { padding-bottom: 8px; }
.guide-tour-count { margin: 0; color: var(--cta-deep); font-size: 12px; font-weight: 750; letter-spacing: 0.05em; }
.guide-tour-title { margin: 6px 0 0; font-size: 21px; line-height: 1.3; }
.guide-tour-body { margin: 8px 0 0; color: var(--ink-soft); font-size: 16px; line-height: 1.65; }
.guide-tour-figure { margin: 16px 0 0; }

.guide-tour-media {
  position: relative;
  width: min(100%, 390px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.guide-tour-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 390 / 844;
}

.guide-callout {
  position: absolute;
  box-sizing: border-box;
  border: 3px solid var(--danger);
  border-radius: 10px;
  pointer-events: none;
}

.guide-callout-number {
  position: absolute;
  top: -15px;
  left: -15px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 2px solid var(--white);
  border-radius: 50%;
  color: var(--white);
  background: var(--danger);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.guide-callout::after {
  position: absolute;
  right: -24px;
  bottom: -3px;
  width: 22px;
  border-top: 3px solid var(--danger);
  content: '';
  transform: rotate(28deg);
  transform-origin: left center;
}

.guide-tour-caption { margin-top: 12px; }
.guide-tour-callouts { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.guide-tour-callouts li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; color: var(--ink-soft); font-size: 16px; line-height: 1.55; }
.guide-tour-callouts strong { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: var(--white); background: var(--danger); font-size: 12px; }
.guide-tour-actions { position: sticky; bottom: -1px; z-index: 2; margin: 18px -16px -8px; padding: 12px 16px calc(8px + var(--safe-bottom)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(8px); }

/* Percentage geometry follows the 390x844 source at every rendered width. */
.guide-tour-step-focus .guide-callout-1 { left: 5%; top: 34%; width: 90%; height: 15%; }
.guide-tour-step-focus .guide-callout-2 { left: 25%; top: 9%; width: 50%; height: 23%; }
.guide-tour-step-rooms .guide-callout-1 { left: 4%; top: 11%; width: 92%; height: 23%; }
.guide-tour-step-rooms .guide-callout-2 { left: 4%; top: 36%; width: 92%; height: 25%; }
.guide-tour-step-progress .guide-callout-1 { left: 4%; top: 18%; width: 92%; height: 16%; }
.guide-tour-step-progress .guide-callout-2 { left: 4%; top: 34%; width: 92%; height: 28%; }
.guide-tour-step-me .guide-callout-1 { left: 4%; top: 31%; width: 92%; height: 19%; }
.guide-tour-step-me .guide-callout-2 { left: 71%; top: 1%; width: 15%; height: 7%; }
.guide-tour-step-sheet .guide-callout-1 { left: 40%; top: 52%; width: 18%; height: 5%; }
.guide-tour-step-sheet .guide-callout-2 { left: 82%; top: 55%; width: 13%; height: 8%; }

/* Sheets remain 430px wide in the desktop shell. Keep Help and the tour in
   one readable column based on that container instead of the viewport width. */
