/* A compact, readable practice with one activity in view at a time. */
#reflection-dialog {
  width: min(640px, calc(100% - 32px));
  max-width: none;
  max-height: min(90svh, 820px);
  padding: 0;
  overflow: hidden;
  border: 0;
}
#reflection-dialog[open] { display: flex; flex-direction: column; }
.reflection-header { flex: none; padding: 26px 32px 18px; }
#reflection-step {
  margin: 0 40px 18px 0;
  font-size: 12px;
  line-height: 1.5;
  color: #596f63;
}
#reflection-dialog .dialog-close { top: 14px; right: 16px; }
.reflection-progress {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.reflection-progress li {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 11px;
  color: #66736b;
  background: #efefea;
  font-size: 13px;
  line-height: 1.4;
}
.reflection-progress span { font-size: 11px; font-weight: 600; }
.reflection-progress [aria-current=step] { color: #234e40; background: #dceee4; font-weight: 650; }
.reflection-body { min-height: 0; overflow-y: auto; padding: 4px 32px 16px; overscroll-behavior: contain; }
#reflection-dialog h2 { font-size: 30px; line-height: 1.15; margin: 0 0 18px; max-width: 490px; text-wrap: pretty; }
#reflection-title:focus-visible { outline: none; }
#reflection-content > p { font-size: 15px; line-height: 1.6; margin-bottom: 20px; }
#reflection-content .reflection-prompt { font-size: 14px; font-weight: 650; color: #111827; margin: 0 0 10px !important; }
#reflection-content .small-note { font-size: 12px; line-height: 1.6; margin: 16px 0 0; }
.reflection-choices { display: grid; gap: 9px; margin: 0; }
.reflection-choices button {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  padding: 15px 17px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: #edf3ed;
  color: #234e40;
  font-size: 15px;
  line-height: 1.5;
}
.reflection-choice-copy { display: grid; gap: 5px; }
.reflection-choice-copy strong { font-size: 15px; font-weight: 600; }
.reflection-choice-copy > span { font-size: 13px; font-weight: 400; color: #596b61; }
.reflection-choices button[aria-pressed]::before {
  content: '';
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 1.5px solid #859f90;
  border-radius: 50%;
}
.reflection-choices button[aria-pressed=true] { border-color: #159777; background: #e0eee5; }
.reflection-choices button[aria-pressed=true]::before { border: 5px solid #159777; background: #fffdf9; }
.reflection-topics { grid-template-columns: 1fr 1fr; gap: 10px; }
.reflection-topics button { justify-content: space-between; align-items: center; }
.reflection-topics .reflection-choice-copy strong { font-size: 16px; }
.reflection-topics .chevron { width: 14px; height: 18px; flex: 0 0 14px; }
.reflection-takeaway { padding: 20px 22px; margin: 0 0 18px; border-radius: 16px; }
.reflection-takeaway span { font-size: 12px; font-weight: 600; margin-bottom: 9px; }
.reflection-takeaway p { font-size: 18px; line-height: 1.55; }
.reflection-moment { background: #efefea; }
.reflection-moment p { font-size: 16px; }
.reflection-pause { padding: 19px 22px; margin: 0; background: #e5efeb; border-radius: 16px; }
.reflection-pause h3 { font-size: 15px; font-weight: 650; letter-spacing: 0; line-height: 1.5; margin: 0 0 8px; }
.reflection-pause p, .reflection-pause li { font-size: 15px; line-height: 1.6; }
.reflection-pause ul { margin: 0; padding-left: 18px; }
.reflection-pause li + li { margin-top: 5px; }
.reflection-edit { margin: 0 0 18px; }
.reflection-edit summary, .reflection-change { font-size: 13px; color: #42695b; }
.reflection-edit summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; list-style: none; }
.reflection-edit summary::-webkit-details-marker { display: none; }
.reflection-edit summary .chevron { width: 14px; height: 18px; }
.reflection-edit[open] summary .chevron { transform: rotate(90deg); }
.reflection-edit label { margin-top: 12px; }
.reflection-edit textarea { font-size: 16px; }
.reflection-reading { margin: 24px 0 0; padding: 26px 28px 28px; border: 0; border-radius: 18px; background: #e2eee8; color: #234e40; }
.reflection-reading p { margin: 0; max-width: 40ch; text-wrap: pretty; }
.reflection-reading .reflection-reading-first { font-size: 24px; line-height: 1.4; font-weight: 550; letter-spacing: -.02em; }
.reflection-reading .reflection-reading-next { margin-top: 20px; font-size: 19px; line-height: 1.65; font-weight: 400; }
#reflection-content .reflection-tone { font-size: 13px; line-height: 1.6; color: #596b61; margin: 16px 0 25px; }
.reflection-care-choices button { align-items: flex-start; }
.reflection-care-choices button::before { margin-top: 3px; }
.reflection-takeaway .reflection-action-detail { margin-top: 8px; font-size: 14px; line-height: 1.6; color: #596b61; }
.reflection-change { display: block; padding: 12px 0; margin-top: 6px; background: transparent; text-decoration: underline; text-underline-offset: 4px; }
.reflection-restart { font-size: 13px; margin: 18px 0 0; border: 0; }
.reflection-copy { margin-top: 22px; }
.reflection-copy-button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid #b8c9bc;
  border-radius: 12px;
  background: transparent;
  color: #234e40;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}
.reflection-copy-button:hover { background: #edf2eb; }
.reflection-copy-button:disabled { opacity: .65; cursor: wait; }
.reflection-copy-button:focus-visible { outline: 2px solid #426f5c; outline-offset: 3px; }
.reflection-copy-status { min-height: 1.6em; margin-top: 8px; color: #596b61; font-size: 14px; line-height: 1.6; }
#reflection-dialog .reflection-navigation {
  flex: none;
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0;
  padding: 14px 32px 22px;
  background: var(--cream);
}
.reflection-navigation .text-link, .reflection-navigation .reflection-exit {
  margin: 0;
  padding: 10px 0;
  border: 0;
  background: transparent;
  font-size: 13px;
  line-height: 1.5;
  white-space: nowrap;
}
.reflection-navigation .text-link { color: #234e40; }
.reflection-navigation .reflection-exit { font-size: 12px; color: #66736b; }
.reflection-navigation .button { min-height: 46px; padding: 12px 20px; gap: 14px; font-size: 14px; }
@media (max-width: 480px) {
  #reflection-dialog { width: calc(100% - 24px); max-height: 92svh; border-radius: 22px; }
  .reflection-header { padding: 23px 22px 17px; }
  #reflection-step { font-size: 10px; margin-bottom: 18px; margin-right: 30px; }
  #reflection-dialog .dialog-close { width: 36px; height: 36px; top: 12px; right: 12px; }
  .reflection-progress { gap: 6px; }
  .reflection-progress li { padding: 8px 5px; gap: 5px; font-size: 12px; }
  .reflection-body { padding: 3px 22px 12px; }
  #reflection-dialog h2 { font-size: 27px; margin-bottom: 16px; }
  #reflection-content > p { font-size: 14px; margin-bottom: 18px; }
  .reflection-topics { grid-template-columns: 1fr; gap: 8px; }
  .reflection-choices button { padding: 12px 14px; font-size: 14px; gap: 10px; }
  .reflection-choice-copy { gap: 3px; }
  .reflection-choice-copy strong { font-size: 14px; }
  .reflection-choice-copy > span { font-size: 12px; }
  .reflection-topics .reflection-choice-copy strong { font-size: 15px; }
  .reflection-pause, .reflection-takeaway { padding: 18px; }
  .reflection-pause p, .reflection-pause li { font-size: 14px; }
  .reflection-takeaway p { font-size: 17px; }
  .reflection-reading { padding: 22px; margin-top: 20px; }
  .reflection-reading .reflection-reading-first { font-size: 22px; }
  .reflection-reading .reflection-reading-next { margin-top: 17px; font-size: 17px; }
  .reflection-moment p { font-size: 15px; }
  #reflection-dialog .reflection-navigation { padding: 12px 22px 18px; gap: 14px; }
  .reflection-navigation .button { padding: 12px 16px; gap: 8px; }
}
@media (max-width: 360px) {
  .reflection-header { padding-inline: 18px; }
  .reflection-body { padding-inline: 18px; }
  #reflection-dialog .reflection-navigation { padding-inline: 18px; gap: 10px; }
  .reflection-navigation .reflection-exit { font-size: 11px; }
  .reflection-navigation .button { padding-inline: 12px; }
}

/* Compact, content-sized dialogs keep the page visible around the practice. */
@media (max-width: 700px) {
  #reflection-dialog,
  #practice-dialog {
    width: min(400px, calc(100% - 40px));
    max-width: none;
    max-height: min(680px, 82svh);
    max-height: min(680px, 82dvh);
    margin: auto;
    border: 0;
    border-radius: 22px;
    background: #faf9f6;
    color-scheme: light;
    box-shadow: 0 18px 60px #22342926;
  }
  #reflection-dialog::backdrop,
  #practice-dialog::backdrop {
    background: #242c286b;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  #reflection-dialog :is(button, a, summary, textarea),
  #practice-dialog :is(button, a, summary, audio) {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  #reflection-dialog :is(button, a, summary, textarea):focus-visible,
  #practice-dialog :is(button, a, summary, audio):focus-visible {
    outline: 2px solid #426f5c;
    outline-offset: 3px;
  }
  #reflection-dialog .button:hover,
  #practice-dialog .button:hover { transform: none; }
  #reflection-dialog .dialog-close,
  #practice-dialog .dialog-close {
    width: 44px;
    height: 44px;
    top: 8px;
    right: 8px;
    font-size: 26px;
    background: transparent;
    z-index: 2;
  }

  #reflection-dialog { height: fit-content; padding: 0; overflow: hidden; }
  .reflection-header { padding: 20px 20px 12px; }
  #reflection-step {
    min-height: 20px;
    margin: 0 36px 14px 0;
    font-size: 11px;
    line-height: 1.5;
  }
  .reflection-progress { gap: 7px; }
  .reflection-progress li {
    justify-content: center;
    gap: 5px;
    padding: 6px 4px;
    border: 0;
    border-radius: 8px;
    background: #efefea;
    font-size: 12px;
    line-height: 1.4;
  }
  .reflection-progress span { font-size: 11px; }
  .reflection-progress [aria-current=step] { background: #dceee4; color: #234e40; }
  #reflection-dialog[data-step="0"] .reflection-progress { display: none; }
  #reflection-dialog[data-step="0"] #reflection-step { margin-bottom: 0; }
  .reflection-body {
    flex: 0 1 auto;
    min-height: 0;
    padding: 4px 20px 18px;
    overflow-y: auto;
    overflow-anchor: none;
    overscroll-behavior: contain;
    scroll-padding-block: 12px;
  }
  #reflection-dialog h2 {
    font-size: 26px;
    line-height: 1.16;
    letter-spacing: -.035em;
    margin-bottom: 14px;
  }
  #reflection-content > p {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 18px;
  }
  #reflection-content .reflection-prompt {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px !important;
  }
  #reflection-content .small-note {
    font-size: 13px;
    line-height: 1.5;
    margin-top: 15px;
  }
  .reflection-choices,
  .reflection-topics { grid-template-columns: 1fr; gap: 8px; }
  .reflection-choices button {
    min-height: 48px;
    padding: 11px 12px;
    gap: 10px;
    border-radius: 12px;
    font-size: 16px;
    line-height: 1.45;
    background: #edf2eb;
  }
  .reflection-choice-copy { gap: 4px; }
  .reflection-choice-copy strong,
  .reflection-topics .reflection-choice-copy strong { font-size: 15px; line-height: 1.4; }
  .reflection-choice-copy > span { font-size: 14px; line-height: 1.45; }
  /* The four topic names already say what each entry option is. */
  .reflection-topics .reflection-choice-copy > span { display: none; }
  .reflection-topics button { min-height: 48px; }
  .reflection-choices button[aria-pressed=true] { border-color: #426f5c; background: #e3eee5; }
  .reflection-choices button[aria-pressed=true]::before { border-color: #426f5c; }
  .reflection-pause,
  .reflection-takeaway { padding: 16px; border-radius: 12px; margin: 0 0 16px; }
  .reflection-pause h3 { font-size: 15px; margin-bottom: 8px; }
  .reflection-pause p,
  .reflection-pause li,
  .reflection-moment p { font-size: 16px; line-height: 1.5; }
  .reflection-takeaway span { font-size: 12px; margin-bottom: 8px; }
  .reflection-takeaway p { font-size: 17px; line-height: 1.5; }
  .reflection-takeaway .reflection-action-detail { font-size: 14px; }
  .reflection-reading { padding: 18px; margin-top: 18px; border-radius: 12px; }
  .reflection-reading .reflection-reading-first { font-size: 21px; line-height: 1.35; }
  .reflection-reading .reflection-reading-next { margin-top: 14px; font-size: 16px; line-height: 1.55; }
  #reflection-content .reflection-tone { font-size: 13px; margin: 14px 0 16px; }
  .reflection-edit summary,
  .reflection-edit label,
  .reflection-edit > p,
  .reflection-change,
  .reflection-restart { font-size: 14px; line-height: 1.5; }
  .reflection-edit summary { min-height: 44px; }
  .reflection-edit textarea { font-size: 16px; line-height: 1.5; }
  .reflection-change { min-height: 44px; padding-block: 11px; }
  .reflection-copy { margin-top: 16px; }
  #reflection-dialog .reflection-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
    padding: 10px 20px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid #e4e6dc;
    background: #faf9f6;
  }
  .reflection-navigation .button {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 11px 16px;
    gap: 14px;
    font-size: 15px;
    border-radius: 12px;
  }
  .reflection-navigation .text-link,
  .reflection-navigation .reflection-exit {
    min-height: 44px;
    padding: 11px 0;
    font-size: 13px;
    line-height: 1.5;
  }
  #reflection-back { grid-column: 1; grid-row: 2; justify-self: start; }
  #reflection-finish { grid-column: 2; grid-row: 2; justify-self: end; }
  #reflection-dialog[data-step="0"] #reflection-finish { grid-column: 1 / -1; grid-row: 1; justify-self: start; }

  #practice-dialog { padding: 25px 20px 18px; overflow-y: auto; overscroll-behavior: contain; }
  #practice-dialog .eyebrow { min-height: 20px; margin: 0 32px 14px 0; font-size: 10px; }
  #practice-dialog h2 { font-size: 26px; line-height: 1.16; margin-bottom: 14px; letter-spacing: -.035em; }
  #practice-dialog > p:not(.eyebrow) { font-size: 16px; line-height: 1.5; margin-bottom: 18px; }
  #practice-dialog audio { display: block; height: 44px; margin: 0 0 18px; }
  #practice-dialog .quiet-practice { padding: 0 12px; margin-bottom: 10px; border-radius: 12px; }
  #practice-dialog .quiet-practice summary { min-height: 48px; font-size: 14px; gap: 10px; }
  #practice-dialog .quiet-practice p { font-size: 16px; line-height: 1.5; margin-top: 12px; }
  #practice-dialog .quiet-practice p:last-child { padding-bottom: 16px; }
  #practice-dialog .audio-app-link {
    display: inline-flex;
    width: auto;
    min-height: 44px;
    padding: 10px 0;
    background: transparent;
    box-shadow: none;
    color: #087e65;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 0;
  }
  #practice-dialog .audio-app-link:hover { background: transparent; }
  #practice-dialog .audio-ending { margin: 16px 0 8px; }
  #practice-dialog .audio-ending p { font-size: 16px; line-height: 1.5; }
  #practice-dialog .audio-ending > div { gap: 20px; margin-top: 8px; }
  #practice-dialog .audio-ending button { min-height: 44px; font-size: 14px; }
}

/* Optional onward reading stays secondary to the response and Finish action. */
#reflection-content .reflection-onward {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid #dce3d9;
}
#reflection-content .reflection-onward h3 {
  margin: 0 0 8px;
  color: #234e40;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0;
}
#reflection-content .reflection-onward .text-link {
  display: block;
  width: fit-content;
  min-height: 44px;
  margin: 0;
  padding: 10px 0;
  border: 0;
  font-size: 14px;
  line-height: 1.5;
  text-decoration: underline;
  text-underline-offset: 4px;
}
#reflection-content .reflection-onward p {
  margin: 12px 0 0;
  color: #596b61;
  font-size: 13px;
  line-height: 1.6;
}
