/* Phone layouts use a single page scroll, readable lines and comfortable touch targets. */
@media (max-width:620px) {
  body {--theme-header-height:4rem;}
  .shell {width:calc(100% - 2rem);}
  .header-inner {width:calc(100% - 2rem); gap:.75rem;}
  .brand-name {max-width:none; font-size:.9375rem; line-height:1.4;}
  .menu-toggle {width:44px; height:44px;}
  body :is(input,textarea,select) {font-size:16px;}
  body[data-page="home"] main {height:auto; min-height:0; overflow:visible;}
  body[data-page="home"] {--theme-color-primary:#55745a; --theme-color-primary-deep:#3f6048; --theme-color-line:#cad1c5; --theme-color-surface:#fffdf7; --theme-color-surface-soft:#f1efe7; --theme-color-ink:#18231b; --theme-color-muted:#687369;}
  body[data-page="home"] .journal-hero {height:auto; min-height:0;}
  body[data-page="home"] .journal-hero.shell {width:100%;}
  body[data-page="home"] .agent-home-content {height:auto; min-height:0; display:block; padding:20px 16px 28px;}
  body[data-page="home"] .agent-home-content .journal-guide {width:100%; max-height:none; min-height:0; overflow:visible; border-radius:20px;}
  body[data-page="home"] .journal-guide .content-guide-header {padding:24px 20px 12px;}
  body[data-page="home"] .journal-guide .content-guide-header h2 {max-width:none; padding-right:0; margin-top:16px; font-size:clamp(1.65rem,7.6vw,2rem); line-height:1.4; letter-spacing:0;}
  body[data-page="home"] .journal-guide .content-guide-header p {padding-right:0; margin-top:14px; font-size:15px; line-height:1.85;}
  body[data-page="home"] .journal-guide .content-guide-form {padding:12px 20px 16px;}
  body[data-page="home"] .journal-guide .content-guide-form label {font-size:14px; margin-bottom:10px;}
  body[data-page="home"] .journal-guide-composer {grid-template-columns:minmax(0,1fr) 44px; gap:8px; padding:10px; border-radius:16px; box-shadow:0 6px 18px rgb(47 59 45 / 7%);}
  body[data-page="home"] .journal-guide-composer:focus-within {transform:none;}
  body[data-page="home"] .journal-guide .content-guide-form textarea,
  body[data-page="home"] .journal-guide:not(.has-guide-conversation) .content-guide-form textarea {min-height:96px; max-height:200px; padding:8px; line-height:1.65; resize:none;}
  body[data-page="home"] .journal-guide .content-guide-form button {width:44px; min-width:44px; height:44px;}
  body[data-page="home"] .journal-guide .content-guide-body {max-height:none; overflow:visible; padding:8px 20px 24px;}
  body[data-page="home"] .journal-guide .journal-guide-seeds {margin-bottom:12px; font-size:12px; letter-spacing:0;}
  body[data-page="home"] .journal-guide .journal-guide-seeds i {flex:1; max-width:none;}
  body[data-page="home"] .journal-guide:not(.has-guide-conversation) .content-guide-prompts {display:grid; grid-template-columns:minmax(0,1fr); gap:10px; flex-wrap:wrap;}
  body[data-page="home"] .journal-guide:not(.has-guide-conversation) .content-guide-prompts button:nth-child(n) {display:grid; grid-template-columns:24px minmax(0,1fr) 16px; align-items:center; gap:10px; width:100%; min-height:64px; padding:12px 14px; border-radius:12px; transform:none;}
  body[data-page="home"] .journal-guide:not(.has-guide-conversation) .content-guide-prompts button strong {min-width:0; font-size:14px; line-height:1.65; overflow-wrap:break-word; word-break:normal; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;}
  body[data-page="home"] .journal-guide .content-guide-prompts button i {position:static;}
  body[data-page="home"] .journal-guide.has-guide-conversation .content-guide-header {padding:16px 20px 8px;}
  body[data-page="home"] .journal-guide.has-guide-conversation .content-guide-body {padding:8px 20px 20px;}
  body[data-page="home"] .journal-guide.has-guide-conversation .content-guide-form {padding:12px 20px 20px;}
  body[data-page="home"] .journal-guide .content-guide-turn-user p {max-width:100%; font-size:15px; line-height:1.8;}
  body[data-page="home"] .journal-guide .guide-response-heading .content-guide-answer {font-size:16px; line-height:1.9;}
  body[data-page="home"] .site-footer {height:auto; margin-top:0; padding-bottom:calc(16px + env(safe-area-inset-bottom,0px));}
  body[data-page="home"] .footer-grid {height:auto; flex-wrap:wrap; gap:12px; padding-block:16px;}
  body[data-page="home"] .footer-meta {width:100%;}
  body[data-page="home"] .knowledge-home {padding-block:32px;}
  body[data-page="home"] .knowledge-home .section-heading {display:block;}
  body[data-page="home"] .knowledge-home .section-heading h2 {font-size:28px; line-height:1.5; margin-top:10px;}
  body[data-page="home"] .knowledge-home-actions {margin-top:20px; gap:10px;}
  body[data-page="home"] .knowledge-home-actions a {padding-inline:16px; min-height:44px; font-size:14px;}
  body[data-page="home"] .knowledge-map {gap:32px; margin-top:28px;}
  body[data-page="home"] .knowledge-group-grid {grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px;}
  body[data-page="home"] .knowledge-group-card {min-width:0; min-height:148px; padding:16px; border-radius:14px;}
  body[data-page="home"] .knowledge-group-card strong {font-size:15px; line-height:1.6; overflow-wrap:anywhere;}
  body[data-page="home"] .knowledge-group-card p {font-size:13px; line-height:1.8;}
  body[data-page="home"] .knowledge-recent a {padding-block:16px; gap:12px; font-size:15px; line-height:1.8;}
  body[data-page="home"] #content-guide-input {scroll-margin-top:84px;}
  body .kb-sidebar {padding:12px 18px;}
  body .kb-mobile-directory>summary {min-height:44px;}
  body .kb-center {padding:0 22px;}
  body .kb-toolbar {gap:12px; padding:18px 0;}
  body .kb-toolbar form {min-width:0; gap:8px;}
  body .kb-toolbar :is(input,button) {min-height:44px;}
  body .kb-toolbar input {font-size:16px; min-width:0;}
  body .kb-page {padding-top:24px; padding-bottom:96px;}
  body .kb-page h1,body .kb-center .article-header h1 {font-size:28px; line-height:1.5; overflow-wrap:anywhere;}
  body .kb-breadcrumbs {gap:8px; line-height:1.7; margin-bottom:24px; flex-wrap:wrap;}
  body .kb-intro {font-size:16px; line-height:1.9; margin-top:16px;}
  body .kb-center .article-content,body .kb-content {font-size:16px; line-height:1.95;}
  body .kb-center .article-content p,body .kb-content p {margin-block:1.2em;}
  body .kb-center .article-content :is(pre,table),body .kb-content :is(pre,table) {max-width:100%; overflow-x:auto;}
  body .kb-center .article-content img {max-width:100%; height:auto;}
  body .kb-center .post-meta {gap:8px 14px; line-height:1.8; flex-wrap:wrap;}
  body .kb-adjacent {flex-direction:column; gap:20px;}
  body .kb-adjacent a {max-width:100%; line-height:1.8;}
  body :is(.content-guide-launcher,.reader-launcher) {width:48px; min-width:48px; height:48px; min-height:48px; padding:0; justify-content:center; right:16px; bottom:calc(16px + env(safe-area-inset-bottom,0px));}
  body :is(.content-guide-launcher,.reader-launcher)>span:last-child {position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap;}
  body .content-guide-panel:not(.journal-guide),body .reader-panel {right:12px; bottom:calc(76px + env(safe-area-inset-bottom,0px)); width:calc(100vw - 24px); max-height:calc(100svh - 100px - env(safe-area-inset-bottom,0px));}
  body :is(.content-guide-close,[data-reader-close]) {min-width:44px; min-height:44px;}
  body .back-to-top {right:18px; bottom:calc(80px + env(safe-area-inset-bottom,0px));}
}
@media (min-width:621px) and (max-height:500px) and (pointer:coarse) {
  body[data-page="home"] main,body[data-page="home"] .journal-hero {height:auto; min-height:0; overflow:visible;}
  body[data-page="home"] .agent-home-content {height:auto; min-height:0; padding:24px 32px;}
  body[data-page="home"] .agent-home-content .journal-guide {max-height:none; min-height:0; overflow:visible;}
  body[data-page="home"] .journal-guide .content-guide-body {overflow:visible; max-height:none;}
  body[data-page="home"] .journal-guide .content-guide-header h2 {max-width:none; font-size:32px;}
}
