/* Shared screen appearance. The printable diary keeps its own paper layout. */
@media screen {
  :root {
    --system-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --display: var(--system-font);
    --paper: #f5f6f7;
    --surface: #fff;
    --sidebar: #f9fafb;
    --ink: #1d2321;
    --muted: #56605c;
    --rule: #dfe4e1;
    --edge: #89958e;
    --green: #196448;
    --green-deep: #124a36;
    --tint: #e7f2eb;
    --mint: #e4f4e9;
    --red: #a52e32;
    --radius: 18px;
    --gutter: clamp(24px, 4vw, 60px);
    --panel-space: clamp(1.25rem, 2.15vw, 2rem);
    color-scheme: light;
    font-family: var(--system-font);
    font-optical-sizing: auto;
  }
  body { color: var(--ink); background: var(--paper); }
  :where(button, a, input, select, summary) { -webkit-tap-highlight-color: transparent; }
  :where(button, a, select, summary) { touch-action: manipulation; }
  :where(button, a, input, textarea, select, summary):focus-visible {
    outline: 3px solid #1666a3; outline-offset: 3px;
  }
  .feature :focus-visible { outline-color: #1666a3; }
  h1, .method-page > h1 {
    margin: 0 0 .22em; font: 700 clamp(2.15rem, 3.4vw, 3.45rem)/1.07 var(--display);
    letter-spacing: -.042em;
  }
  h2, .card-title { font-size: clamp(1.17rem, 1.65vw, 1.45rem); line-height: 1.24; font-weight: 650; letter-spacing: -.024em; }
  h3 { font-weight: 650; letter-spacing: -.012em; }
  .lead { max-width: 62ch; font-size: 1.025rem; }
  .eyebrow { text-transform: none; letter-spacing: .012em; font-size: .875rem; font-weight: 600; }
  .page-title { margin-bottom: clamp(1.35rem, 2.2vw, 2rem); }
  .navlink { min-height: 46px; gap: .8rem; border-radius: 12px; color: #404b46; font-weight: 500; }
  .navlink svg { width: 1.35rem; height: 1.35rem; opacity: 1; stroke-width: 1.7; }
  .navlink[aria-current="page"] { color: var(--green-deep); background: #e1eee6; font-weight: 650; }
  .brand { letter-spacing: -.035em; font-weight: 650; }
  .brand-mark { width: 32px; height: 32px; color: var(--green); }
  .topbar { color: var(--muted); background: var(--paper); }
  .topbar-title { font-weight: 600; color: #46534b; }
  main#content { max-width: 85rem; }
  .spread, .energy-layout { column-gap: clamp(1rem, 1.75vw, 1.6rem); }
  .stack, .rail, .energy-summaries { gap: 1.1rem; }
  .panel, .feature { padding: var(--panel-space); border-radius: var(--radius); }
  .panel { border: 1px solid #e0e5e2; box-shadow: 0 1px 3px rgb(26 47 36 / .045); }
  .hero-weave { display: none; }
  .feature.hero-card { border: 1px solid #d5e5da; color: var(--ink); background: #e6f0e9; }
  .hero-copy { max-width: 40rem; }
  .hero-copy .eyebrow { color: var(--green); }
  .hero-copy h2 {
    margin: .46em 0 .34em; max-width: 22ch; font: 650 clamp(1.75rem, 2.65vw, 2.75rem)/1.13 var(--display);
    letter-spacing: -.037em;
  }
  .hero-copy > p:not(.eyebrow) { color: #40594a; max-width: 49ch; }
  .hero-copy > .button { margin-top: 1.25rem; }
  .step-list li::before { font: 600 .94rem/1.5 var(--display); color: var(--green); }
  .week-caption strong, .cal-stat dd { font-weight: 650; }
  .mini-icon { color: var(--green); background: var(--tint); border: none; }
  .week-preview h2, .guide-card h2 { font-size: 1.23rem; }

  .button, .method-action, .icon-button, .calendar-head button, dialog button[type="submit"],
  .energy-repeat { border-radius: 11px; font-weight: 600; min-height: 44px; }
  :is(.button, .method-action, .icon-button, .calendar-head button, .energy-repeat, .navlink, .dismiss):active:not(:disabled) {
    filter: brightness(.92);
  }
  .button.primary, .method-action, .feature .button.light, .feature .button.primary, dialog button[type="submit"].primary {
    background: var(--green); border-color: var(--green); color: white;
  }
  .hero-copy .button.light[data-action="plan"], .button.subtle {
    background: #edf2ef; border-color: transparent; color: var(--green-deep);
  }
  .button.text-link { border-radius: 6px; padding-inline: .12em; color: var(--green); font-weight: 600; text-decoration: none; }
  .text-link:focus-visible, .method-source:focus-visible, .button.text-link:focus-visible { text-decoration: underline; }
  .button svg { width: 1.12em; height: 1.12em; }
  .check-line.major, .done-word { background: var(--tint); color: var(--green-deep); border-radius: 9px; }
  .done-word { padding: .3em .65em; font-weight: 600; }
  .goal-card dl { grid-template-columns: repeat(auto-fit,minmax(min(100%,13rem),1fr)); gap: .85rem 1.5rem; }
  .goal-card dt { font-weight: 550; }
  .goal-card dd { margin-top: .13rem; }
  .pe-fields legend, .check-group legend, .energy-preview dt { font-weight: 600; }
  .pe-activity dt, .pe-schedule thead th { font-weight: 500; }
  .method-page { max-width: 60rem; }
  .method-step { border-color: var(--rule); }
  .method-source, .method-stamp, .method-next { color: var(--green); }
  .method-speech h2, .method-paper h2 { font-weight: 650; letter-spacing: -.018em; }
  .method-paper { background: var(--tint); color: var(--ink); border-radius: var(--radius); }
  .method-note, .method-intro { color: var(--muted); }
  .energy-day { min-height: 52px; }
  button.energy-day .energy-day-name { font-weight: 600; }
  .energy-repeat { background: var(--surface); }
  .energy-repeat[aria-pressed="true"] { border-color: var(--green); }
  .calendar-head .cal-nav { width: 44px; border: 0; background: #edf2ef; color: var(--green); }
  .goal-fields summary, .cal-entry summary, .month-strip button { min-height: 44px; }
  .month-strip button { border-radius: 9px; font-weight: 500; }
  .week-grid { gap: 0; grid-template-columns: repeat(7,minmax(0,1fr)); }
  .week-date { min-height: 44px; max-width: 44px; aspect-ratio: auto; }
  .week-date.current { background: var(--tint); color: var(--green-deep); }
  .week-date.marked { color: white; background: var(--green); }
  .calendar-grid .cal-day { min-height: 44px; border-radius: 9px; }
  .calendar-grid .cal-day.done { color: white; background: var(--green); }
  .calendar-grid .cal-day.today:not(.done) { color: var(--green-deep); font-weight: 700; }
  .calendar-grid .cal-day.selected { outline: 2px solid var(--ink); outline-offset: -2px; }
  .calendar-grid .cal-day:focus-visible, .week-date:focus-visible {
    outline: 3px solid #1666a3; outline-offset: -3px;
  }
  .field { gap: .35rem; }
  .field > span:first-child { font-size: .94rem; font-weight: 600; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), textarea, select, .method-month-control select {
    border: 1px solid var(--edge); border-radius: 10px; min-height: 46px; font-size: 1rem; background: var(--surface);
  }
  input::placeholder, textarea::placeholder { color: #647069; }
  #editor { padding: 0; border: 1px solid var(--rule); border-radius: 22px; box-shadow: 0 20px 70px rgb(16 37 26 / .2); }
  #editor::backdrop { background: rgb(20 31 25 / .42); }
  #editor-form { padding-inline: clamp(1.1rem, 3.5vw, 2rem); }
  #editor .dialog-head {
    position: sticky; z-index: 1; top: 0; background: var(--surface); align-items: center;
    margin: 0; padding-block: 1rem .75rem; border-bottom: 1px solid var(--rule);
  }
  #dialog-title { font-size: 1.4rem; letter-spacing: -.028em; }
  .dismiss { border: 0; border-radius: 50%; color: #4a544f; background: #edf0ee; }
  #editor { scroll-padding-block: 5rem 1rem; overscroll-behavior: contain; }
  #editor-body { padding-block: 1.1rem .3rem; }
  #editor-actions { gap: .6rem; padding: 0 0 1.25rem; }
  #editor-error { font-weight: 550; }
  .toast { border-radius: 13px; }
}
@media screen and (hover: hover) {
  .button.primary:hover:not(:disabled), .method-action:hover, .feature .button.light:hover:not(:disabled) {
    color: #fff; background: var(--green-deep); border-color: var(--green-deep);
  }
  .button.text-link:hover, .hero-copy .button.light[data-action="plan"]:hover {
    color: var(--green-deep); background: var(--tint);
  }
  .button.text-link:hover { text-decoration: underline; }
}
@media screen and (min-width: 751px) {
  .sidebar { padding-top: 1.3rem; }
  .sidebar .brand { margin: 0 0 1.6rem .65rem; min-height: 44px; }
  .sidebar nav { gap: .25rem; }
  .sidebar-foot { border-top: 1px solid var(--rule); padding: 1rem .6rem 0; }
}
@media screen and (min-width: 851px) and (max-width: 1080px) {
  .spread { grid-template-columns: minmax(0, 1fr); }
}
@media screen and (max-width: 750px) {
  :root { --gutter: clamp(14px, 4.4vw, 28px); --radius: 16px; --panel-space: clamp(16px, 4.4vw, 24px); }
  .sidebar > .brand, .topbar { background: var(--surface); min-height: 54px; }
  .sidebar > .brand { font-size: 1.24rem; }
  .topbar { padding-right: max(var(--gutter), env(safe-area-inset-right)); }
  main#content { padding-top: 1.5rem; padding-bottom: calc(6.75rem + env(safe-area-inset-bottom)); }
  .sidebar nav {
    padding: .2rem max(3px, env(safe-area-inset-right)) calc(.2rem + env(safe-area-inset-bottom)) max(3px, env(safe-area-inset-left));
    background: #fff; box-shadow: 0 -2px 12px rgb(22 37 29 / .045);
  }
  .sidebar .navlink { min-height: 54px; min-width: 44px; gap: .28rem; font-size: clamp(.65rem,2.7vw,.76rem); line-height: 1.12; font-weight: 500; padding: .35rem 1px; border-radius: 10px; }
  .sidebar .navlink[aria-current="page"] { color: var(--green-deep); background: var(--tint); font-weight: 700; }
  .sidebar .navlink svg { width: 1.3rem; height: 1.3rem; }
  .feature.hero-card { padding: var(--panel-space); }
  .hero-copy h2 { max-width: 24ch; font-size: clamp(1.65rem, 5.9vw, 2.15rem); }
  #editor {
    margin: auto auto 0; width: min(100%, 36rem); max-width: 100%;
    max-height: calc(100dvh - max(14px, env(safe-area-inset-top))); border-radius: 20px 20px 0 0;
  }
  #editor-actions { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
}
@media screen and (min-width: 1081px) {
  .spread:has(.week-preview) { grid-template-columns: minmax(0, 1.5fr) minmax(23.5rem, 1fr); }
}
@media screen and (min-width: 376px) and (max-width: 420px) {
  .panel:has(.calendar-grid) .calendar-grid { margin-inline: -.5rem; gap: 0; }
}
@media screen and (max-width: 375px) {
  .panel:has(.calendar-grid), .week-preview { padding-inline: max(1px, calc((100vw - 310px) / 2 - var(--gutter))); }
  .calendar-grid { gap: 0; }
  .panel:has(.calendar-grid), .week-preview { margin-inline: calc(4px - var(--gutter)); }
  .week-grid { margin-inline: 0; }
  .week-preview > :not(.week-grid), .panel:has(.calendar-grid) > :not(.calendar-grid) { margin-inline: .6rem; }
}
@media screen and (max-height: 450px) {
  #editor .dialog-head { position: static; }
  #editor { scroll-padding-block: 1rem; }
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  @media screen and (max-width: 750px) {
    .sidebar nav {
      background: rgb(253 254 253 / .94);
      -webkit-backdrop-filter: saturate(125%) blur(14px);
      backdrop-filter: saturate(125%) blur(14px);
    }
  }
}
@media screen and (prefers-reduced-transparency: reduce), screen and (prefers-contrast: more) {
  .sidebar nav { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media screen and (prefers-contrast: more) {
  :root { --muted: #38423c; --edge: #525c56; --rule: #939c95; }
  .panel, .navlink[aria-current="page"] { border: 1px solid var(--edge); }
}

