/* CoHours V2.1 Home -- start first, community second. */

#panel-focus { animation: none; }

.focus-flow {
  display: block;
  padding-bottom: var(--primary-bar-h);
}
.home-study-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px var(--gutter) 18px;
  text-align: center;
  border-bottom: var(--rule) solid var(--line);
  background: radial-gradient(circle at 50% 30%, var(--white), var(--paper) 70%);
}

.home-eyebrow { margin-bottom: 12px; }

.home-start-button {
  width: 100%;
  min-height: 54px;
  font-size: 17px;
}

.home-start-button .icon { width: 22px; height: 22px; }

.home-focus-promise {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 520px;
  padding: 17px 18px 15px;
  border: var(--rule) solid var(--line);
  border-radius: 20px;
  background: var(--white);
  box-shadow: var(--shadow-soft);
  text-align: left;
}

.home-focus-promise.is-reserved {
  border-color: var(--green-line);
  background: var(--green-soft);
}

.home-focus-promise.is-live {
  border-color: var(--green);
  background: var(--green-soft);
}

.home-focus-promise-head,
.home-focus-promise-foot,
.home-focus-promise-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-focus-promise-head .eyebrow { margin: 0; }
.home-focus-promise-time { align-items: baseline; justify-content: flex-start; }
.home-focus-promise-day { color: var(--muted); font-size: 16px; }
.home-focus-promise-time strong {
  font-family: var(--serif);
  font-size: clamp(30px, 9vw, 40px);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}
.home-focus-promise-meta { color: var(--muted); font-size: 14px; line-height: 1.4; }
.home-focus-promise-action { flex: 0 1 auto; min-width: 44px; }

.home-focus-promise.is-empty {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  box-shadow: none;
}
.home-focus-promise-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
}
.home-focus-promise-mark .icon { width: 21px; height: 21px; }
.home-focus-promise-status { margin-top: 4px; color: var(--ink-soft); font-size: 16px; line-height: 1.4; }

.home-clock {
  margin: 4px 0 2px;
  font-family: var(--serif);
  font-size: clamp(48px, 16vw, 68px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.home-live-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: 8px;
}

.home-live-actions .home-live-action {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding-inline: 12px;
}

.home-live-actions .home-live-finish { color: var(--cta-deep); }
.home-live-actions .home-live-action .icon { width: 21px; height: 21px; }

.focus-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--dock-h) + var(--safe-bottom));
  z-index: 15;
  display: grid;
  gap: 6px;
  min-height: var(--primary-bar-h);
  padding: 10px var(--gutter) 12px;
  border-top: var(--rule) solid var(--line);
  background: var(--paper);
}

.focus-bar-context {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 18px;
  text-align: center;
}
.focus-bar-context span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.focus-bar > .btn,
.focus-bar > .button-row { width: 100%; max-width: 560px; margin-inline: auto; }

.home-study-stage.is-break .home-clock { color: var(--green); }

.home-study-stage.is-complete { background: var(--paper); }

.home-result-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin: 2px 0 14px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
}

.home-result-mark .icon { width: 26px; height: 26px; }

.home-result-duration {
  font-family: var(--serif);
  font-size: clamp(44px, 14vw, 62px);
  line-height: 1;
  letter-spacing: -0.035em;
}

.home-result-label { margin-top: 7px; color: var(--muted); font-size: 14px; }

.home-result-material {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  margin-top: 20px;
  color: var(--ink-soft);
  font-size: 14px;
}

.home-result-material span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-result-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  max-width: 360px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: var(--rule) solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.home-result-total strong { color: var(--ink); font-family: var(--serif); font-size: 20px; font-weight: 500; }
.home-result-actions { width: 100%; max-width: 360px; margin-top: 18px; }

.home-completion-promise {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 360px;
  margin-top: 20px;
  padding: 18px;
  border: var(--rule) solid var(--line);
  border-radius: 20px;
  background: var(--paper-raise);
  box-shadow: var(--shadow-soft);
  text-align: left;
}

.home-completion-promise.is-reserved {
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
  background: var(--green-soft);
}

.home-completion-promise.is-live {
  border-color: var(--cta-line);
  background: var(--cta-soft);
}

.home-completion-promise-eyebrow { margin: 0; color: var(--green); }
.home-completion-promise-title { font-family: var(--serif); font-size: 22px; line-height: 1.25; }
.home-completion-promise-time { font-family: var(--serif); font-size: 24px; line-height: 1.2; }
.home-completion-promise-body { color: var(--ink-soft); font-size: 16px; line-height: 1.6; }
.home-completion-promise .btn { margin-top: 2px; }
.home-completion-promise .btn-ghost { justify-self: center; margin-top: 0; }
.home-completion-promise-confirmed {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 16px;
  line-height: 1.5;
}

.home-nudge-prompt {
  display: grid;
  justify-items: center;
  width: 100%;
  max-width: 360px;
  margin-top: 18px;
  padding: 17px 14px 14px;
  border: var(--rule) solid var(--ai-line);
  border-radius: 20px;
  background: var(--ai-wash);
}

.home-streak-line { display: flex; align-items: baseline; gap: 6px; color: var(--yamabuki-ink); }
.home-streak-line strong { font-family: var(--serif); font-size: 30px; line-height: 1; }
.home-streak-line span { color: var(--muted); font-size: 12px; }
.home-nudge-title {
  max-width: 100%;
  margin-top: 7px;
  color: var(--ai-ink);
  font-size: 21px;
  overflow-wrap: anywhere;
  text-align: center;
  white-space: normal;
}
.home-nudge-friends { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 13px; }
.home-nudge-friends .btn { min-width: 0; }
.home-nudge-prompt > .btn-ghost { margin-top: 8px; }

.home-study-stage.is-nudge { background: radial-gradient(circle at 50% 32%, var(--ai-wash), var(--paper) 72%); }
.nudge-mark { background: var(--ai-wash); color: var(--ai-ink); }

.home-invite-prompt {
  width: 100%;
  max-width: 360px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: var(--rule) solid var(--line);
}

.home-invite-prompt-title,
.study-invite-landing-title,
.study-invite-preview-title {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.25;
}

.home-invite-prompt-title { font-size: 24px; }
.home-invite-prompt-body {
  max-width: 30ch;
  margin: 8px auto 16px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.home-invite-prompt > .btn-ghost { margin-top: 6px; }

.home-study-stage.is-invite { justify-content: center; min-height: min(620px, calc(100dvh - var(--header-h) - var(--dock-h))); }
.study-invite-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 4px 0 18px;
  border-radius: 50%;
  background: var(--cta-soft);
  color: var(--cta-deep);
}
.study-invite-mark .icon { width: 30px; height: 30px; }
.study-invite-landing-title { max-width: 14ch; font-size: clamp(28px, 8vw, 38px); }
.study-invite-landing-body {
  max-width: 34ch;
  margin-top: 12px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}
.study-invite-start { max-width: 360px; margin-top: 24px; }

.study-invite-sheet { display: grid; gap: 16px; padding: 0 var(--gutter) 18px; }
.study-invite-sheet > .field,
.study-invite-sheet > .note,
.study-invite-sheet > .button-row { margin: 0; }
.study-invite-preview {
  padding: 18px;
  border: var(--rule) solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--white), var(--cta-soft));
  text-align: left;
}
.study-invite-preview .eyebrow { color: var(--cta-deep); }
.study-invite-preview-title { margin-top: 9px; font-size: 22px; }
.study-invite-preview-body { margin-top: 9px; color: var(--ink-soft); font-size: 16px; line-height: 1.6; }
.study-invite-sheet-actions { justify-content: space-between; }
.study-invite-qr {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: var(--rule) solid var(--ai-line);
  border-radius: 18px;
  background: var(--ai-wash);
  color: var(--ai-ink);
  text-align: left;
}
.study-invite-qr-image { display: block; width: 132px; height: 132px; border-radius: 10px; }
.study-invite-qr-ground { fill: var(--white); }
.study-invite-qr-cells { fill: var(--ink); }
.study-invite-qr-title { font-family: var(--serif); font-size: 18px; line-height: 1.2; }
.study-invite-qr-body { margin-top: 6px; color: var(--ink-soft); font-size: 16px; line-height: 1.6; }

.home-material-row {
  margin-top: 18px;
  padding: 11px 12px;
  border: var(--rule) solid var(--line);
  border-radius: 14px;
  background: var(--white);
}

.home-material-row .row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-study-setup {
  width: 100%;
  max-width: 360px;
  margin-top: 18px;
  overflow: hidden;
  border: var(--rule) solid var(--line);
  border-radius: 18px;
  background: var(--white);
  box-shadow: var(--shadow-soft);
  text-align: left;
}

.home-study-setup .home-material-row {
  margin-top: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.home-setup-secondary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: var(--rule) solid var(--line);
}

.home-setup-secondary .row {
  min-width: 0;
  min-height: 72px;
  padding: 10px 8px;
  gap: 6px;
  border: 0;
  align-items: center;
}

.home-setup-secondary .row + .row { border-left: var(--rule) solid var(--line); }
.home-setup-secondary .row:only-child { grid-column: 1 / -1; }
.home-setup-secondary .row-lead { width: 28px; height: 30px; }
.home-setup-secondary .row-lead .icon { width: 18px; height: 18px; }
.home-setup-secondary .row-title { font-size: 13px; font-weight: 650; }
.home-setup-secondary .row-meta { font-size: 11px; line-height: 1.3; }
.home-setup-secondary .row-trail { display: none; }

.home-room-link {
  color: var(--green);
}

.home-first-session-pwa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 460px);
  margin: 18px auto 0;
  padding-top: 14px;
  border-top: var(--rule) solid var(--line);
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.6;
  text-align: left;
}

@media (max-width: 520px) {
  .home-first-session-pwa { align-items: stretch; flex-direction: column; }
}

.home-community { padding: 20px var(--gutter) 10px; }
.home-community-stack { min-width: 0; }
.home-community-stack[hidden] { display: none !important; }

.home-community.is-study-circle {
  margin: 10px var(--gutter) 0;
  padding: 18px 16px 16px;
  border: var(--rule) solid var(--ai-line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 92% 4%, color-mix(in srgb, var(--white) 78%, transparent), transparent 34%),
    var(--ai-wash);
}

.home-community.is-study-circle .home-community-title { color: var(--ai-ink); }
.home-community.is-background-room {
  margin-top: 14px;
  border-top: var(--rule) solid var(--line);
}

.study-circle-sheet { display: grid; gap: 14px; }
.study-circle-summary {
  padding: 2px 2px 13px;
  border-bottom: var(--rule) solid var(--line);
}
.study-circle-summary-title { margin-top: 4px; color: var(--ai-ink); font-size: 23px; }
.study-circle-summary-meta { margin-top: 5px; color: var(--muted); font-size: 13px; }

.home-community-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.home-community-title { font-size: 22px; }
.home-community-meta { margin-top: 4px; color: var(--muted); font-size: 16px; line-height: 1.6; }

.home-status-summaries {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.home-status-summaries::-webkit-scrollbar { display: none; }

.home-status-summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 5px 9px;
  border: var(--rule) solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.home-status-summary-studying { border-color: var(--ai); background: var(--ai); color: var(--white); }
.home-status-summary-break { border-color: var(--green); background: var(--green); color: var(--white); }
.home-status-count { font-size: 13px; }
.home-status-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: 0.82; }

.home-member-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.home-member {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 126px;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  padding: 13px 6px 10px;
  overflow: hidden;
  border: var(--rule) solid var(--line);
  border-radius: 22px 22px 15px 15px;
  background: var(--white);
  color: var(--ink);
  text-align: center;
}

.home-member-face { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; }
.home-member .avatar { border: 2px solid color-mix(in srgb, currentColor 22%, transparent); }
.home-member-name,
.home-member-meta {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-member-name { margin-top: 1px; font-size: 14px; font-weight: 700; line-height: 1.25; }
.home-member-meta { font-size: 11px; font-variant-numeric: tabular-nums; line-height: 1.25; opacity: 0.82; }
.home-member-clock { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; opacity: 0.95; }
.home-member-live-mark {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border: 2px solid color-mix(in srgb, var(--white) 62%, transparent);
  border-radius: 999px;
  background: var(--white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--white) 17%, transparent);
}

.home-member-studying {
  border-color: var(--ai-ink);
  background:
    radial-gradient(circle at 18% 10%, color-mix(in srgb, var(--white) 17%, transparent), transparent 38%),
    linear-gradient(150deg, color-mix(in srgb, var(--ai) 88%, var(--white)), var(--ai-ink));
  color: var(--white);
  box-shadow: 0 7px 16px color-mix(in srgb, var(--ai-ink) 22%, transparent);
}

.home-member-break {
  border-color: var(--green);
  background: linear-gradient(145deg, color-mix(in srgb, var(--green) 82%, var(--white)), var(--green));
  color: var(--white);
}

.home-member-offline {
  background: color-mix(in srgb, var(--white) 78%, var(--paper));
  color: var(--muted);
}

.home-member-offline .home-member-face { filter: grayscale(0.85); opacity: 0.5; }
.home-member-offline .home-member-name { font-weight: 550; }
.home-member.is-me { box-shadow: inset 0 0 0 2px var(--white); }
.home-member-studying.is-me { box-shadow: inset 0 0 0 2px var(--white), 0 0 0 1px var(--ai-ink); }
.home-member-offline.is-me { box-shadow: inset 0 0 0 2px var(--paper-deep); }

@media (max-width: 359px) {
  .home-member-list { gap: 7px; }
  .home-member { min-height: 118px; padding-inline: 4px; border-radius: 15px; }
  .home-member-name { font-size: 13px; }
  .home-status-summary { padding-inline: 7px; }
}

.home-chat-button {
  position: absolute;
  right: var(--gutter);
  bottom: calc(var(--dock-h) + var(--safe-bottom) + var(--primary-bar-h) + 14px);
  z-index: 16;
  width: 58px;
  height: 58px;
  min-height: 58px;
  padding: 0;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

.home-chat-button .icon { width: 25px; height: 25px; }

.sheet-body:has(.chat-sheet) {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}
.chat-sheet { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; }
.chat-message-list {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px var(--gutter) 16px;
}
.chat-message { display: flex; align-items: flex-start; gap: 9px; }
.chat-message.is-mine { flex-direction: row-reverse; }
.chat-message-body { flex: 1 1 auto; min-width: 0; }
.chat-message.is-mine .chat-message-body { text-align: right; }
.chat-message-head { display: flex; align-items: baseline; gap: 6px; font-size: 11px; color: var(--muted); }
.chat-message.is-mine .chat-message-head { justify-content: flex-end; }
.chat-message-name { color: var(--ink-soft); font-weight: 650; }
.chat-message-kind { padding: 1px 6px; border-radius: 999px; background: var(--green-soft); color: var(--green); }
.chat-message-text {
  display: inline-block;
  max-width: min(100%, 440px);
  margin-top: 3px;
  padding: 9px 12px;
  border-radius: 4px 14px 14px 14px;
  background: var(--white);
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.55;
  text-align: left;
}

.chat-message.is-mine .chat-message-text { border-radius: 14px 4px 14px 14px; background: var(--green-soft); }
.chat-composer {
  flex: 0 0 auto;
  padding: 12px var(--gutter) 0;
  border-top: var(--rule) solid var(--line);
  background: var(--paper);
}
.chat-actions { flex: 0 0 auto; align-items: stretch; padding: 0 var(--gutter) 8px; }

@media (max-height: 700px) {
  .home-study-stage { padding-top: 14px; }
}

/* Short tablets and landscape phones have enough width for the whole ready
   decision, but not enough height for a phone-shaped vertical stack. Keep the
   next real session, study setup, and Start visible together instead of making
   the setup scroll underneath the pinned action bar. */
@media (min-width: 640px) and (max-width: 959.99px) and (max-height: 600px) {
  .home-study-stage:has(> .home-focus-promise) {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(240px, 4fr);
    align-items: center;
    gap: 12px;
    min-height: 0;
    padding: 12px var(--gutter);
    text-align: left;
  }

  .home-study-stage:has(> .home-focus-promise) > .home-focus-promise {
    grid-column: 1;
    grid-row: 1 / span 2;
    max-width: none;
    gap: 8px;
    padding: 12px 14px;
  }

  .home-study-stage:has(> .home-focus-promise) .home-focus-promise-time strong {
    font-size: 32px;
  }

  .home-study-stage:has(> .home-focus-promise) > .home-study-setup {
    grid-column: 2;
    grid-row: 1;
    max-width: none;
    margin-top: 0;
  }

  .home-study-stage:has(> .home-focus-promise) > [data-refocus="focus-resume-draft"] {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
  }

  .home-study-stage:has(> .home-focus-promise) .home-material-row {
    padding-block: 8px;
  }

  .home-study-stage:has(> .home-focus-promise) .home-setup-secondary .row {
    min-height: 58px;
    padding-block: 7px;
  }

  /* .app-main already carries 24px of end breathing room in addition to the
     dock, so only reserve the remainder of this 70px action bar here. */
  .focus-flow { padding-bottom: 46px; }
  .focus-flow:has(> .home-study-stage.is-complete) { padding-bottom: 0; }

  .focus-bar {
    grid-template-columns: minmax(140px, 220px) minmax(360px, 560px);
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 70px;
    padding: 8px var(--gutter);
  }

  .focus-bar-context {
    justify-content: flex-end;
    text-align: right;
  }

  .focus-bar > .btn,
  .focus-bar > .button-row {
    max-width: none;
    margin-inline: 0;
  }

  /* Completion has a different decision shape from ready/live: the result is
     reassurance, while the next real session is the primary continuation.
     Use the available landscape width so both stay above the dock together. */
  .home-study-stage.is-complete:has(> .home-completion-promise) {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(360px, 3fr);
    grid-template-rows: repeat(7, auto);
    align-content: center;
    align-items: center;
    column-gap: 18px;
    row-gap: 0;
    min-height: 0;
    padding: 8px var(--gutter);
    text-align: center;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) > .home-eyebrow {
    grid-column: 1;
    grid-row: 1;
    margin-bottom: 4px;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) > .home-result-mark {
    grid-column: 1;
    grid-row: 2;
    width: 42px;
    height: 42px;
    margin: 0 auto 4px;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) > .home-result-mark .icon {
    width: 21px;
    height: 21px;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) > .home-result-duration {
    grid-column: 1;
    grid-row: 3;
    font-size: 42px;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) > .home-result-label {
    grid-column: 1;
    grid-row: 4;
    margin-top: 3px;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) > .home-result-material {
    grid-column: 1;
    grid-row: 5;
    justify-self: center;
    margin-top: 6px;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) > .home-result-total {
    grid-column: 1;
    grid-row: 6;
    max-width: 290px;
    margin-top: 7px;
    padding-top: 7px;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) > .home-result-actions {
    grid-column: 1;
    grid-row: 7;
    max-width: 290px;
    margin-top: 7px;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) > .home-completion-promise {
    grid-column: 2;
    grid-row: 1 / span 7;
    align-self: center;
    max-width: none;
    margin-top: 0;
    gap: 6px;
    padding: 12px 14px;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) .home-completion-promise-title {
    font-size: 20px;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) .home-completion-promise-time {
    font-size: 22px;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) .home-completion-promise-body {
    line-height: 1.4;
  }
}

/* 640 x 360 is the smallest useful two-column landscape. Preserve the 44px
   actions, but remove card air and the empty-material track so both secondary
   actions clear the dock (and still clear a landscape home indicator). */
@media (min-width: 640px) and (max-width: 959.99px) and (max-height: 370px) {
  .home-study-stage.is-complete:has(> .home-completion-promise) {
    align-content: start;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) > .home-result-total {
    margin-top: 4px;
    padding-top: 5px;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) > .home-result-actions {
    margin-top: 4px;
  }

  .home-study-stage.is-complete:has(> .home-completion-promise) > .home-completion-promise {
    gap: 2px;
    padding: 5px 12px;
  }
}

@media (min-width: 960px) {
  .app-body:not(.room-body) #panel-focus {
    display: grid;
    grid-template-columns: minmax(0, 65fr) minmax(0, 35fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: start;
    padding-bottom: 0;
    background-image: linear-gradient(to bottom, var(--line), var(--line));
    background-position: 65% 0;
    background-repeat: no-repeat;
    background-size: var(--rule) 100%;
  }
  .app-body:not(.room-body) #panel-focus > .home-flow { display: contents; }
  .app-body:not(.room-body) #panel-focus > .home-flow > .home-study-stage {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 0;
    min-height: calc(100dvh - var(--header-h));
    justify-content: center;
    border-bottom: 0;
  }
  .app-body:not(.room-body) #panel-focus > .home-flow > .home-community-stack {
    grid-column: 2;
    grid-row: 1;
    min-height: calc(100dvh - var(--header-h));
    padding: 22px 18px 110px;
  }
  .app-body:not(.room-body) #panel-focus .home-community {
    padding: 20px 12px 10px;
  }
  .app-body:not(.room-body) #panel-focus .home-community.is-study-circle {
    margin: 10px 0 0;
    padding: 20px 18px 18px;
  }
  .home-chat-button { right: 28px; bottom: 24px; }

  .app-body:not(.room-body) #panel-focus:has(.home-community-stack[hidden]) {
    grid-template-columns: minmax(0, 1fr);
    background-image: none;
  }
  .app-body:not(.room-body) #panel-focus:has(.home-community-stack[hidden]) > .home-flow > .home-study-stage {
    grid-column: 1;
  }
  .app-body:not(.room-body) #panel-focus:has(.home-community-stack[hidden]) > .focus-bar {
    right: 0;
  }
}

@media (min-width: 960px) and (max-width: 1100px) {
  .home-member-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* ---- one full-screen follow-up after explicit Continue ---------------- */

body.has-moment { overflow: hidden; }

.moment-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow: hidden auto;
  overscroll-behavior: contain;
  background: var(--paper);
}

.moment-dialog {
  position: relative;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding:
    calc(var(--safe-top) + 8px)
    var(--gutter)
    calc(var(--safe-bottom) + 16px);
  outline: none;
  animation: motion-paper-in var(--motion-duration) var(--motion-ease);
}

.moment-head {
  display: flex;
  justify-content: flex-end;
  width: min(100%, 560px);
  margin: 0 auto;
}

.moment-close { flex: 0 0 var(--tap); }

.moment-body {
  display: grid;
  align-items: stretch;
  width: min(100%, 560px);
  min-height: 0;
  margin: 0 auto;
}

.moment-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
  padding: clamp(10px, 3dvh, 28px) 0 0;
  text-align: center;
}

.moment-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
}

.moment-nudge .moment-mark { background: var(--ai-wash); color: var(--ai-ink); }
.moment-invite .moment-mark { background: var(--cta-soft); color: var(--cta-deep); }
.moment-streak .moment-mark,
.moment-total .moment-mark { background: var(--yamabuki-wash); color: var(--yamabuki-ink); }
.moment-mark .icon { width: 32px; height: 32px; }

.moment-eyebrow { margin-bottom: 10px; }

.moment-title {
  max-width: 18ch;
  font-family: var(--serif);
  font-size: clamp(30px, 9vw, 44px);
  font-weight: 500;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.moment-value {
  margin-top: 22px;
  color: var(--yamabuki-ink);
  font-family: var(--serif);
  font-size: clamp(38px, 12vw, 58px);
  line-height: 1;
}

.moment-description {
  max-width: 36ch;
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.55;
}

.moment-share-recipient {
  max-width: 36ch;
  margin-top: 18px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.moment-share-preview {
  max-width: 38ch;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--sheet-radius);
  background: var(--paper-raise);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
}

.moment-privacy {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 38ch;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
}

.moment-privacy .icon { flex: 0 0 auto; margin-top: 2px; }

.moment-friend-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
  width: 100%;
  margin-top: 22px;
}

.moment-friend-choices .btn {
  min-width: 0;
  overflow-wrap: anywhere;
}

.moment-friend-choices .btn.is-selected {
  border-color: var(--ai);
  background: var(--ai-wash);
  color: var(--ai-ink);
}

.moment-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 6px;
  width: 100%;
  margin-top: auto;
  padding-top: max(26px, 5dvh);
  background: linear-gradient(to bottom, transparent, var(--paper) 24px);
}

@media (max-height: 700px) {
  .moment-dialog { padding-top: var(--safe-top); padding-bottom: calc(var(--safe-bottom) + 8px); }
  .moment-content { min-height: auto; padding-top: 0; }
  .moment-mark { width: 54px; height: 54px; margin-bottom: 10px; }
  .moment-mark .icon { width: 25px; height: 25px; }
  .moment-title { font-size: clamp(27px, 7vw, 36px); }
  .moment-value { margin-top: 12px; font-size: clamp(34px, 9vw, 46px); }
  .moment-description { margin-top: 10px; line-height: 1.4; }
  .moment-friend-choices { margin-top: 12px; }
  .moment-actions {
    position: static;
    margin-top: 14px;
    padding-top: 0;
    background: none;
  }
}

@media (min-width: 960px) {
  .moment-dialog { padding-inline: 32px; }
  .moment-content { justify-content: center; padding-top: 0; }
  .moment-actions { margin-top: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .moment-dialog { animation: none; }
}

body.reduced-motion .moment-dialog { animation: none !important; }
