/* A separate phone composition: daily actions first, deeper reading on demand. */
@media (max-width:700px), (orientation:landscape) and (pointer:coarse) and (max-height:520px) and (max-width:1000px) {
  .phone-home {display:grid;gap:14px;max-width:none;margin:0;--home-card-shadow:0 4px 14px #00000005}
  .phone-home>* {min-width:0;margin:0;order:0;grid-column:auto}
  .phone-welcome h1 {font-size:23px;line-height:1.25;letter-spacing:-.7px;font-weight:650;margin:0}
  .phone-welcome journal-prompts {display:grid;margin:3px 0 0;min-width:0}
  .phone-welcome .journal-question {font-size:12px;line-height:1.4;font-weight:400}
  .phone-welcome .journal-question strong {font-weight:450;color:var(--muted)}
  .phone-welcome .journal-prompt-toggle {width:44px;min-height:32px}
  .phone-quick-actions {display:grid;grid-template-columns:repeat(auto-fit,minmax(60px,1fr));gap:8px;padding-block:2px 4px}
  .phone-quick-actions button {
    --quick-color:#7450b5;
    display:flex;flex-direction:column;align-items:center;justify-content:center;
    gap:9px;min-width:0;min-height:92px;padding:12px 3px 10px;
    border:1px solid color-mix(in srgb,var(--quick-color) 18%,var(--surface));
    border-radius:19px;color:var(--text);font-size:11px;font-weight:650;line-height:1.3;
    background:linear-gradient(155deg,color-mix(in srgb,var(--quick-color) 13%,var(--surface)),color-mix(in srgb,var(--quick-color) 3%,var(--surface)));
    box-shadow:0 3px 8px color-mix(in srgb,var(--quick-color) 7%,transparent),inset 0 1px 0 #ffffff24;
  }
  .phone-quick-actions [data-page=tracking] {--quick-color:#2866b2}
  .phone-quick-actions [data-page=journal] {--quick-color:#a25b2b}
  .phone-quick-actions [data-action=reminder-add] {--quick-color:#207f72}
  .phone-quick-actions .icon {
    flex:none;width:38px;height:38px;padding:9px;border-radius:13px;color:#fff;
    background:linear-gradient(145deg,color-mix(in srgb,var(--quick-color) 88%,#fff),var(--quick-color));
    box-shadow:0 4px 8px color-mix(in srgb,var(--quick-color) 25%,transparent),inset 0 1px 0 #ffffff38;
  }
  .phone-quick-actions button:active {transform:translateY(1px) scale(.97);box-shadow:inset 0 1px 4px #00000012}
  .phone-quick-actions button:focus-visible {outline:2px solid var(--accent);outline-offset:3px}
  @media (prefers-reduced-motion:no-preference) {
    .phone-quick-actions button {transition:transform .16s ease,box-shadow .16s ease}
  }

  .phone-home .recharge-card {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 10px;align-items:center;min-height:0;padding:14px;border:1px solid color-mix(in srgb,#478f9b 22%,var(--surface));border-radius:22px;background:linear-gradient(125deg,color-mix(in srgb,#68b4b5 16%,var(--surface)),color-mix(in srgb,#8bbce1 5%,var(--surface)));color:var(--text);box-shadow:var(--home-card-shadow)}
  .phone-home .recharge-launch {display:flex;grid-area:1/1;align-items:center;gap:9px;min-width:0;min-height:64px;padding:0;border:0;background:transparent;color:inherit;text-align:left}
  .phone-home .recharge-art {width:48px;height:48px;object-fit:contain;flex:none;border-radius:16px;background:color-mix(in srgb,var(--surface) 70%,transparent)}
  .phone-home .recharge-launch>span {display:grid;gap:2px;min-width:0}
  .phone-home .recharge-launch strong {font-family:inherit;font-size:18px;font-weight:650;line-height:1.25;letter-spacing:-.3px}
  .phone-home .recharge-launch small {display:none}
  .phone-home .recharge-launch span span {font-size:11px;line-height:1.4;color:var(--muted)}
  .phone-home .recharge-tally {display:contents}
  .phone-home .recharge-tally>button {grid-area:1/2;align-self:center;justify-self:end;display:flex;align-items:center;justify-content:center;gap:5px;min-height:44px;min-width:44px;border:0;border-radius:13px;padding:0 10px;background:var(--accent);color:var(--surface);font-size:11px;font-weight:600;white-space:nowrap;box-shadow:0 3px 8px #00000010}
  .phone-home .recharge-tally>button b {font-size:20px;font-weight:400}
  .phone-home .recharge-stats {grid-area:2/1/3/-1;display:flex;flex-wrap:wrap;gap:6px 14px;align-items:center;font-size:11px;line-height:1.3;color:var(--muted);margin-top:10px;padding:10px 0 0;border-top:1px solid color-mix(in srgb,var(--accent) 12%,transparent)}
  .phone-home .recharge-stats>span {display:flex;align-items:center;gap:3px;border:0;padding:0;min-height:20px}
  .phone-home .recharge-stats b {font-size:12px;font-weight:650;color:var(--text)}
  .phone-home .recharge-flame {display:inline-flex;color:var(--accent)}
  .phone-home .recharge-flame .icon {width:13px;height:13px}
  .phone-home .recharge-retry {grid-column:1/-1;min-height:44px}
  .phone-home .recharge-retry[hidden] {display:none}

  .phone-pulse {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .phone-pulse>button {--pulse-color:#7450b5;display:grid;grid-template-columns:1fr;grid-template-rows:28px auto 1fr auto;align-items:start;gap:7px;min-width:0;padding:14px;text-align:left;border:1px solid color-mix(in srgb,var(--pulse-color) 18%,var(--surface));border-radius:21px;background:linear-gradient(145deg,color-mix(in srgb,var(--pulse-color) 12%,var(--surface)),color-mix(in srgb,var(--pulse-color) 3%,var(--surface)));color:var(--text);box-shadow:var(--home-card-shadow)}
  .phone-pulse>button:only-child {grid-column:1/-1}
  .phone-pulse .phone-pulse-tasks {--pulse-color:#207f72}
  .phone-pulse-top {display:flex;align-items:center;justify-content:space-between;gap:8px}
  .phone-pulse-symbol {display:grid;place-items:center;width:28px;height:28px;border-radius:10px;background:var(--pulse-color);color:#fff}
  .phone-pulse-symbol .icon {width:16px;height:16px}
  .phone-pulse-top>.icon {width:14px;height:14px;color:var(--muted)}
  .phone-pulse-title {font-size:12px;font-weight:650;line-height:1.4}
  .phone-pulse strong {display:flex;gap:5px;align-items:baseline;font-size:29px;line-height:1.15;letter-spacing:-.7px;font-weight:650;font-variant-numeric:tabular-nums}
  .phone-pulse strong small {font-size:12px;font-weight:500;letter-spacing:0}
  .phone-pulse>button>small {font-size:10px;line-height:1.5;color:var(--muted);min-height:30px}

  .phone-home .home-agenda {--home-tint:#2866b2}
  .phone-home .home-reminders {--home-tint:#207f72}
  .phone-home .home-pins {--home-tint:#7450b5}
  .phone-home :is(.home-agenda,.home-reminders,.home-pins) {padding:8px 14px 12px;border:1px solid color-mix(in srgb,var(--home-tint) 16%,var(--surface));border-radius:21px;background:linear-gradient(155deg,color-mix(in srgb,var(--home-tint) 5%,var(--surface)),var(--surface) 65%);color:var(--text);box-shadow:var(--home-card-shadow);min-height:0;margin:0}
  .phone-home :is(.home-agenda .panel-title,.home-reminders>.panel-title,.home-goals-heading) {display:flex;align-items:center;justify-content:space-between;flex-wrap:nowrap;gap:8px;min-height:48px;margin:0 0 4px;padding:0;border:0}
  .phone-home :is(.panel-title h2,.home-goals-heading h2) {display:flex;align-items:center;gap:7px;font-family:inherit;font-size:14px;line-height:1.3;letter-spacing:-.25px;font-weight:650}
  .phone-home :is(.home-agenda,.home-reminders,.home-pins) h2::before {content:'';flex:none;width:4px;height:16px;border-radius:4px;background:var(--home-tint)}
  .phone-home :is(.panel-title .text-button,.home-goals-heading .home-view-link) {flex:none;min-height:44px;font-size:10px;padding:4px 8px;gap:4px;border-radius:12px;background:var(--surface-soft);color:var(--accent)}
  .phone-home .text-button .icon {width:14px;height:14px}
  .phone-home .home-agenda ul {list-style:none;margin:0;padding:0}
  .phone-home .home-agenda-item {display:grid;grid-template-columns:4em minmax(0,1fr);gap:8px;align-items:center;min-height:44px;padding:7px 0;font-size:13px;line-height:1.4}
  .phone-home .home-agenda-item strong {font-weight:500;overflow-wrap:anywhere}
  .phone-home .home-agenda-item>span {font-size:10px;color:var(--accent);font-variant-numeric:tabular-nums;border-radius:8px;background:var(--accent-soft);padding:6px 2px;text-align:center}
  .phone-home .home-agenda li+li {border-top:1px solid color-mix(in srgb,var(--border) 65%,transparent)}
  .phone-home .home-agenda details>summary {display:flex;align-items:center;min-height:44px;font-size:11px;color:var(--accent);cursor:pointer}
  .phone-home .home-agenda details>summary::after {content:'⌄';margin-left:auto}
  .phone-home .home-agenda>p {font-size:12px;padding:12px;margin:4px 0 0;line-height:1.6;border-radius:12px;background:var(--surface-soft)}
  .phone-home .reminders-heading {display:flex;flex-direction:column;gap:3px;align-items:flex-start;min-width:0}
  .phone-home .reminders-heading h2 {display:flex;align-items:center;gap:5px}
  .phone-home .reminders-heading .count {font-size:10px;min-width:18px;height:18px;padding:2px 5px;margin:0;border-radius:5px;background:var(--accent-soft);color:var(--accent)}
  .phone-home .reminders-heading p {font-size:10px;line-height:1.4;margin:0}
  .phone-home .home-reminder-preview,.phone-home .reminder-list {display:block;margin:0;padding:0;list-style:none}
  .phone-home .reminder-list>li {border:0;border-top:1px solid var(--border);border-radius:0}
  /* Keep the swipe row opaque so its Dismiss action stays behind the content. */
  .phone-home .reminder-row {display:flex;align-items:center;gap:10px;min-height:60px;padding:6px 0;border-radius:0;background:var(--surface)}
  .phone-home .reminder-symbol {width:32px;height:32px;flex:none;border-radius:11px;font-size:15px;background:color-mix(in srgb,#207f72 12%,var(--surface));color:var(--accent)}
  .phone-home .reminder-symbol .icon {width:16px;height:16px}
  .phone-home .reminder-copy {min-width:0;flex:1}
  .phone-home .reminder-copy strong {font-size:12px;line-height:1.4;font-weight:550;overflow-wrap:anywhere}
  .phone-home .reminder-copy>span {font-size:10px;line-height:1.4}
  .phone-home .reminder-options {flex:none;width:44px;height:44px;margin-right:-6px}
  .phone-home :is(.home-reminder-more,.upcoming-reminders) {margin:0;padding:0;border:0;border-top:1px solid var(--border)}
  .phone-home :is(.home-reminder-more,.upcoming-reminders)>summary {display:flex;align-items:center;min-height:44px;padding:4px 0;font-size:11px;color:var(--accent);cursor:pointer}
  .phone-home :is(.home-reminder-more,.upcoming-reminders)>summary::after {content:'⌄';margin-left:auto}
  .phone-home .home-reminder-more:not([open]) .when-open,.phone-home .home-reminder-more[open] .when-closed {display:none}
  .phone-home .schedule-reminder {margin:0;padding:8px;min-height:54px;font-size:12px;gap:8px}
  .phone-home .reminder-undo {margin:4px 0;font-size:12px}
  .phone-home .reminder-undo button {min-height:44px}
  .phone-home [hidden] {display:none!important}

  .phone-home .pin-stack {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;min-height:0;margin-bottom:0}
  .phone-home .focus-goal {display:flex;flex-direction:column;align-items:stretch;justify-content:space-between;gap:16px;min-height:122px;min-width:0;padding:12px;border:1px solid color-mix(in srgb,#7450b5 14%,var(--surface));border-radius:15px;background:linear-gradient(145deg,color-mix(in srgb,#7450b5 9%,var(--surface)),var(--surface-soft));color:var(--text);text-align:left}
  .phone-home .focus-goal:only-child {grid-column:1/-1;min-height:70px}
  .phone-home .focus-goal+.focus-goal {border:1px solid color-mix(in srgb,#7450b5 14%,var(--surface))}
  .phone-home .focus-goal-copy {display:flex;flex-direction:column;gap:4px}
  .phone-home .focus-goal-copy strong {order:-1;font-size:13px;font-weight:550;line-height:1.4;overflow-wrap:anywhere}
  .phone-home .focus-goal-copy small {font-size:9px;letter-spacing:0;line-height:1.4;text-transform:none;color:var(--muted)}
  .phone-home .goal-instrument {display:flex;align-items:center;justify-content:space-between;gap:3px;width:100%;min-width:0;translate:none}
  .phone-home .goal-dial-face {display:contents}
  .phone-home .goal-dial-face>svg {display:none}
  .phone-home .dial-center {position:static;inset:auto;display:flex;align-items:baseline;gap:3px}
  .phone-home .dial-center b {font-size:15px;font-weight:650;line-height:1.2;color:var(--accent)}
  .phone-home .dial-center small {font-size:9px;letter-spacing:0;text-transform:none;color:var(--muted)}
  .phone-home .dial-digits {font-size:9px;letter-spacing:0;color:var(--muted);font-variant-numeric:tabular-nums}
  .phone-home .goal-undated .dial-digits {display:none}
  .phone-home .home-quote {display:grid;gap:0;min-height:0;padding:8px 16px 16px;border:1px solid color-mix(in srgb,#a25b2b 16%,var(--surface));border-radius:21px;background:linear-gradient(125deg,color-mix(in srgb,#d9b078 13%,var(--surface)),var(--surface));box-shadow:var(--home-card-shadow)}
  .phone-home .thought-heading {display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:38px;margin:0}
  .phone-home .thought-heading h2 {font-size:10px;letter-spacing:.08em;font-weight:600;text-transform:uppercase;color:var(--muted)}
  .phone-home .thought-heading .home-view-link {position:relative;min-height:44px}
  .phone-home .home-quote .home-view-link::after {display:none}
  .phone-home .home-quote blockquote {margin:0;font-family:Georgia,'Times New Roman',serif;font-size:16px;line-height:1.4;letter-spacing:-.2px;overflow-wrap:anywhere}
  .phone-home .home-quote:not(.thought-expanded) .phone-thought-preview {display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
  .phone-home .phone-thought-toggle {justify-self:start;min-height:44px;font-size:11px;padding:4px 0}
  .phone-home .thought-attribution {margin:6px 0 0;font-size:10px;line-height:1.4;color:var(--muted)}
  .phone-week-details {padding:4px 12px;border:1px solid var(--border);border-radius:16px;background:var(--surface)}
  .phone-week-details>summary {display:flex;align-items:center;gap:7px;min-height:44px;font-size:12px;font-weight:550;cursor:pointer}
  .phone-week-details>summary>.icon {width:16px;height:16px;color:var(--muted)}
  .phone-week-details>summary>.icon:last-child {margin-left:auto}
  .phone-week-details[open]>summary>.icon:last-child {transform:rotate(90deg)}
  .phone-home .insight-spread {margin:4px 0 0}
  .phone-home .spread-head {gap:8px;flex-wrap:wrap;margin:0 0 8px}
  .phone-home .spread-kicker {display:none}
  .phone-home .spread-head h2 {font-size:15px}
  .phone-home .spread-cta {min-height:44px;font-size:11px;padding:8px 12px}
  .phone-home .spread-charts {display:grid;grid-template-columns:1fr;gap:8px}
  .phone-home .spread-charts>section {padding:12px;border-radius:14px}
  .phone-home .spread-charts header {gap:5px;flex-wrap:wrap}
  .phone-home .spread-charts h3 {font-size:14px}
  .phone-home .signal-stat>b {font-size:28px}
  .phone-home .signal-plot {height:66px}
  .phone-home .task-wheel {width:64px}
  .phone-home .task-breakdown {gap:14px}
  .phone-home .wheel-legend {max-width:none}
  .phone-home .phone-home-empty {font-size:13px;color:var(--muted)}
  .phone-home .customize-home {min-height:44px}
}
@media (max-width:360px) {
  .phone-welcome h1 {font-size:21px}
  .phone-pulse>button {padding-inline:12px}
  .phone-pulse-title {font-size:11px}
  .phone-home .goal-instrument {flex-wrap:wrap}
}

/* Calendar and sign-in surfaces retain their existing interactions. */
@media (max-width:700px) {
  /* The native date input and visible period continue to share one grid cell. */
  .workspace-calendar .home-calendar { padding: 14px 10px; border-radius: 18px; }
  .workspace-calendar .cal-heading { margin-bottom: 10px; }
  .workspace-calendar .cal-toolbar { row-gap: 8px; padding-bottom: 12px; }
  .workspace-calendar .cal-switch button { min-height: 44px; font-size: 13px; }
  .workspace-calendar .cal-workspace { gap: 16px; padding-top: 12px; }
  .workspace-calendar .cal-week-choice .cal-date { min-height: 54px; gap: 1px; padding: 5px 0; }
  .workspace-calendar .cal-week-count { padding-top: 2px; }
  .workspace-calendar .cal-cell { min-height: 49px; padding: 1px; }
  .workspace-calendar .cal-cell .cal-date > strong { max-width: 100%; }
  .workspace-calendar .cal-mobile-count { padding-top: 0; overflow-wrap: anywhere; }
  .workspace-calendar .cal-empty { min-height: 64px; padding: 8px; gap: 0; }
  .workspace-calendar .cal-empty-mark { font-size: 17px; }
  .workspace-calendar .cal-detail-heading { align-items: center; margin-bottom: 9px; }
  .workspace-calendar .cal-day-agenda .cal-item { min-height: 56px; padding: 10px 12px; }
  .workspace-calendar .cal-week-overview { margin-top: 12px; }
  .workspace-calendar .cal-legend { gap: 5px 12px; margin-top: 8px; padding-top: 9px; }

  /* A short brand masthead leaves the sign-in form within reach of the keyboard. */
  .dream-entry {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
  }
  .dream-cover {
    min-height: 0;
    padding: max(18px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 18px max(20px, env(safe-area-inset-left));
    gap: 10px;
  }
  .dream-wordmark { position: static; }
  .dream-caption { margin: 0; }
  .dream-caption h2 { font-size: 22px; }
  .dream-caption h2 br { display: inline; }
  .dream-land { width: min(40%, 130px); pointer-events: none; }
  .dream-panel {
    align-content: start;
    padding: clamp(22px, 5svh, 40px) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  }
  .dream-card { min-width: 0; }
  .dream-card h1 { font-size: clamp(32px, 8vw, 42px); margin: 10px 0 22px; text-wrap: balance; }
  .dream-flow input { font-size: 16px; min-height: 48px; border-radius: 12px; }
  :root[data-theme=dark] .dream-entry { background: var(--bg); color: var(--text); }
  :root[data-theme=dark] .dream-card :is(h1,label) { color: var(--text); }
  :root[data-theme=dark] .dream-kicker { color: var(--muted); }
  :root[data-theme=dark] .dream-flow input {
    color-scheme: dark;
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
  }
  :root[data-theme=dark] .dream-error { color: #ffb9b2; }
  .dream-link, .dream-guides a { display: inline-flex; align-items: center; min-height: 44px; }
  .dream-arrival { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .dream-welcome-mark { width: 80px; height: 80px; margin-bottom: 20px; }
  .opening-screen { padding-inline: 22px; }
  .guided-tour .guided-tour-close { width: 44px; height: 44px; }
  .guided-tour .guided-tour-card { padding: 14px 17px; border-radius: 20px; }
  .guided-tour .guided-tour-body { overflow-wrap: anywhere; }
  .guided-tour #guided-tour-description { font-size: 14px; line-height: 1.48; }
  .guided-tour .guided-tour-instruction { font-size: 12px; line-height: 1.42; }
  .guided-tour .guided-tour-footer { gap: 6px; margin-top: 8px; }
  .guided-tour-logo { width: 52px; height: 52px; margin-bottom: 8px; }
}
