@layer reset, base, layout, components, responsive;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, ol, blockquote { margin: 0; }
  button, textarea { font: inherit; }
  [hidden] { display: none !important; }
}
@layer base {
  :root { --bg: #f7f6f0; --paper: #fffefa; --ink: #2c3930; --muted: #65705f; --green: #385641; --line: #d9ded0; --sage: #eaf0e2; --serif: Georgia, 'Times New Roman', serif; font: 16px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); color-scheme: light; }
  body { min-width: 320px; }
  button { cursor: pointer; border: 0; background: none; color: inherit; min-height: 44px; }
  button:disabled { opacity: .5; cursor: not-allowed; }
  a { color: var(--green); text-underline-offset: 4px; }
  :focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
  :is(h1, h2, h3, h4, h5, h6):focus { outline: none; }
  h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.035em; line-height: 1.2; }
  h1 { font-size: clamp(2rem, 4vw, 2.7rem); }
  h2 { font-size: 1.65rem; }
  h3 { font-size: .82rem; font-weight: 600; }
  textarea { display: block; width: 100%; resize: vertical; background: transparent; color: inherit; border: 1px solid #929e89; border-radius: 5px; padding: 12px; font-size: 1rem; line-height: 1.7; }
  textarea::placeholder { color: #737a6e; opacity: 1; }
  textarea:read-only:not(#copy-text) { opacity: .7; }
  p { text-wrap: pretty; }
  code { font-size: .85em; background: var(--sage); padding: 2px 4px; border-radius: 3px; overflow-wrap: anywhere; }
  ::selection { background: #dbe5ce; }
}
@layer layout {
  .site-header { max-width: 1080px; margin: 0 auto; padding: 22px 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
  .brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.9rem; letter-spacing: -.06em; line-height: 1; }
  .brand > span { color: #6b805b; margin-left: -9px; }
  .header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 24px; }
  .header-actions form { margin: 0; }
  .login-page { min-height: 100svh; display: grid; place-items: center; padding: 24px; }
  .login { width: min(100%, 520px); display: grid; justify-items: start; gap: 20px; }
  .login h1 { text-wrap: balance; }
  .login .button { text-decoration: none; }
  .login-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0; list-style: none; color: var(--green); font-size: .8125rem; }
  .login-steps li { display: flex; align-items: center; gap: 6px; }
  .login-steps .step-number { display: grid; place-items: center; flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: #f0d6cb; font-size: .67rem; }
  .login-steps li:nth-child(2) .step-number { background: #f3e3b6; }
  .login-steps li:nth-child(3) .step-number { background: #dce8d2; }
  .login-steps .step-arrow { color: var(--muted); }
  .login-actions { display: grid; justify-items: start; gap: 10px; }
  .login-hint { color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
  #app { width: min(780px, 100%); margin: 0 auto; padding: 0 24px; }
  .journey { margin: 30px 0 34px; }
  .journey ol { display: flex; padding: 0; list-style: none; border-bottom: 1px solid var(--line); }
  .journey li { flex: 1; }
  .journey button { width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 11px 8px 17px; color: var(--muted); font-size: .85rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
  .journey button > span { display: grid; place-items: center; border: 1px solid #c9d2bf; border-radius: 50%; width: 25px; height: 25px; font-size: .67rem; }
  .journey [aria-current='step'] { color: var(--green); border-color: var(--green); font-weight: 600; }
  .journey [aria-current='step'] > span { color: var(--paper); background: var(--green); border-color: var(--green); }
  .intro { margin-bottom: 24px; }
  .intro > p { color: var(--muted); margin-top: 10px; font-size: .9rem; }
  .actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; }
  .notes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  footer { padding: 24px 0 28px; font-size: .72rem; color: var(--muted); text-align: center; }
  footer > p { display: inline; }
}
@layer components {
  .text-button { font-size: .8rem; color: var(--green); padding: 8px 0; text-underline-offset: 4px; }
  .text-button:hover:not(:disabled), .inline-button:hover { text-decoration: underline; }
  .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; min-height: 46px; border-radius: 6px; font-size: .83rem; font-weight: 500; border: 1px solid var(--green); }
  .primary { background: var(--green); color: var(--paper); }
  .prepare-actions { justify-content: flex-end; }
  .button > img { flex-shrink: 0; }
  .primary:hover:not(:disabled) { background: #2a422f; }
  .secondary { background: var(--paper); }
  .inline-button { font-size: inherit; text-decoration: underline; text-underline-offset: 3px; padding: 0 3px; }
  .editor { background: var(--paper); border: 1px solid #a6b09b; border-radius: 10px; padding: 20px; }
  .editor textarea { border: 0; min-height: 170px; padding: 3px; }
  .editor textarea:focus-visible { outline-offset: 5px; }
  .editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); font-size: .74rem; }
  .editor-toolbar > .muted { margin-inline-start: auto; }
  .record-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border: 1px solid var(--green); border-radius: 999px; background: var(--sage); color: var(--green); font-size: .78rem; font-weight: 600; white-space: nowrap; box-shadow: 0 2px 4px #2c39300a, inset 0 1px 0 #ffffffb3; transition: background .18s, box-shadow .18s; }
  .record-button:hover:not(:disabled):not([aria-disabled='true']) { background: #dfe9d5; box-shadow: 0 3px 8px #2c393014; }
  .record-icon { display: grid; place-items: center; width: 18px; height: 22px; flex-shrink: 0; }
  .record-icon svg { width: 18px; height: 22px; }
  .record-time { min-width: 2.3em; font-variant-numeric: tabular-nums; font-weight: 500; }
  .record-button[data-state='recording'] { background: #fae9e1; border-color: #97472f; color: #823c29; }
  .record-button[data-state='recording']:hover { background: #f6ddd1; }
  .record-button[data-state='recording'] svg,
  .record-button[aria-disabled='true'] svg { display: none; }
  .record-button[data-state='recording'] .record-icon::after { content: ''; width: 10px; height: 10px; border-radius: 3px; background: currentColor; animation: record-pulse 1.8s ease-in-out infinite; }
  .record-button[aria-disabled='true'] .record-icon::after { content: ''; width: 16px; height: 16px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
  .record-button[aria-disabled='true'] { cursor: wait; }
  @keyframes record-pulse { 50% { box-shadow: 0 0 0 4px #97472f1f; } }
  .muted, .hint { color: var(--muted); }
  .hint { font-size: .77rem; }
  .note-card { padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; min-width: 0; }
  .card-heading { display: flex; align-items: center; min-height: 48px; gap: 10px; margin-bottom: 6px; font-size: .9rem; font-weight: 600; }
  .letter { display: grid; place-items: center; width: 30px; height: 32px; border-radius: 5px; background: #e8edde; font-family: var(--serif); font-size: 1.2rem; font-weight: 400; }
  [data-card='behavior'] .letter { background: #f1e9dc; }
  [data-card='impact'] .letter { background: #f1e4dd; }
  [data-card='suggestion'] .letter { background: #e3eceb; }
  .note-card > .hint { margin-bottom: 12px; }
  .note-card > textarea { font-size: 1rem; min-height: 110px; }
  .note-question { margin-top: 14px; }
  .note-review { display: inline-flex; margin-inline-start: auto; color: var(--muted); font-size: .75rem; font-weight: 500; }
  .note-review:hover:not(:disabled) { text-decoration: none; }
  .note-review:hover:not(:disabled) .action-label { text-decoration: underline; }
  .becky-message { display: flex; align-items: flex-start; gap: 9px; }
  .becky-message > img { flex-shrink: 0; margin-top: 2px; }
  .becky-bubble { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid #d6dfc9; border-radius: 12px; border-start-start-radius: 3px; background: var(--sage); }
  .becky-bubble > p { font-size: .84rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
  .ready-reflection { margin-bottom: 20px; }
  .pocket-notes { margin: 0 0 20px; padding: 18px; background: var(--sage); border: 1px solid var(--line); border-radius: 9px; }
  .pocket-notes > h2 { font-size: 1.2rem; margin-bottom: 14px; }
  #practice-cues { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
  .cue p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .84rem; color: var(--muted); margin-top: 4px; }
  .feedback { margin-top: 32px; }
  .feedback > h2 { margin-bottom: 22px; }
  .feedback-item { --feedback-accent: var(--green); }
  .feedback-item + .feedback-item { margin-top: 14px; }
  .feedback-keep > .becky-bubble, .note-question[data-tone='keep'] > .becky-bubble { background: #edf3e7; }
  .feedback-reconsider { --feedback-accent: #805820; }
  .feedback-reconsider > .becky-bubble, .note-question[data-tone='reconsider'] > .becky-bubble { background: #fbf0dc; border-color: #e7d5b5; }
  #feedback-stale { font-size: .82rem; margin: -10px 0 20px; }
  .feedback-item h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--feedback-accent); font-size: .94rem; font-weight: 700; }
  .feedback-item p { font-size: .94rem; line-height: 1.7; overflow-wrap: anywhere; }
  .feedback[data-ready='true'] .feedback-keep > .becky-bubble { padding: 20px; border-color: #92ac79; background: linear-gradient(135deg, #e4eedb, #f5f1d8); box-shadow: 0 3px 12px #3856410d; }
  .feedback[data-ready='true'] .feedback-keep h3 { font-size: 1.15rem; }
  .feedback[data-ready='true'] #feedback-keep-icon { font-size: 1.35rem; line-height: 1; }
  .example-button { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; text-align: start; }
  .example-button > img { flex-shrink: 0; }
  .practice-example { margin-top: 12px; padding: 16px; border: 1px solid #e7d5b5; border-radius: 8px; background: var(--paper); overflow-wrap: anywhere; }
  .practice-example h4 { margin: 0 0 10px; font-size: .82rem; color: #805820; }
  .practice-example blockquote { font-family: var(--serif); font-size: 1.08rem; line-height: 1.6; white-space: pre-wrap; margin-bottom: 10px; }
  .practice-example p { font-size: .84rem; }
  #peer-reaction { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
  #peer-reaction > h3 { color: var(--green); font-size: .94rem; }
  #peer-response { font-family: var(--serif); font-size: 1.1rem; padding-left: 15px; border-left: 2px solid #9faf8d; margin: 7px 0 10px; overflow-wrap: anywhere; }
  .button-status { display: grid; }
  .button-label, .button-thinking { grid-area: 1 / 1; display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; }
  .button-thinking { visibility: hidden; gap: .65em; }
  button[data-thinking='true'] { opacity: 1; cursor: wait; }
  button[data-thinking='true'] .button-label { visibility: hidden; }
  button[data-thinking='true'] .button-thinking { visibility: visible; }
  button[data-thinking='true'] .thinking-dots > span { animation-play-state: running; }
  .thinking-dots { display: flex; align-items: center; gap: .4em; height: .75em; }
  .thinking-dots > span { width: .3em; height: .3em; border-radius: 50%; background: currentColor; animation: thinking 1.2s ease-in-out infinite paused; }
  .thinking-dots > span:nth-child(2) { animation-delay: .15s; }
  .thinking-dots > span:nth-child(3) { animation-delay: .3s; }
  @keyframes thinking { 0%, 60%, 100% { opacity: .65; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-.15em); } }
  @keyframes spin { to { transform: rotate(360deg); } }
  .error { font-size: .81rem; overflow-wrap: anywhere; }
  .error { color: #773923; }
  .error:not(:empty) { margin-top: 15px; }
  .error:not(:empty) { position: relative; padding: 14px 16px; padding-inline-start: 46px; border: 1px solid #e3c2b2; border-inline-start: 3px solid #a55335; border-radius: 8px; background: #fbede5; font-size: .88rem; line-height: 1.6; }
  /* Decorative exclamation mark; role="alert" announces only the message text. */
  .error:not(:empty)::before { content: ''; position: absolute; inset-inline-start: 14px; top: 16px; width: 20px; height: 20px; border: 1.5px solid currentColor; border-radius: 50%; background: linear-gradient(currentColor, currentColor) center 4px / 2px 6px no-repeat, radial-gradient(circle, currentColor 1px, transparent 1.5px) center 11px / 3px 3px no-repeat; }
  .export-bar { margin-top: 24px; padding-top: 8px; border-top: 1px solid #d9d8d3; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; color: #62645f; font-size: .73rem; }
  .export-bar > div { display: flex; gap: 6px; }
  #clear-download, .export-bar .text-button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 4px; border-radius: 4px; font-size: .75rem; color: #62645f; white-space: nowrap; }
  #clear-download:hover:not(:disabled), .export-bar .text-button:hover:not(:disabled) { text-decoration: none; }
  #clear-download:hover:not(:disabled) > .action-label, .export-bar .text-button:hover:not(:disabled) > .action-label { text-decoration: underline; }
  .notice { padding: 12px 16px; background: #eeeddf; border: 1px solid #dbdac6; border-radius: 7px; font-size: .8rem; }
  .setup-notice { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: -12px 0 23px; }
  .setup-notice .text-button { flex-shrink: 0; padding: 0; }
  dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 27px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); box-shadow: 0 15px 70px #24372526; }
  dialog::backdrop { background: #22362966; }
  dialog p { font-size: .88rem; margin-top: 16px; }
  dialog a { display: inline-block; font-size: .8rem; margin-top: 17px; }
  .dialog-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 25px; flex-wrap: wrap; }
  .clear-actions { align-items: center; justify-content: space-between; }
  .clear-confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-inline-start: auto; }
  .clear-confirm-actions .secondary:hover:not(:disabled) { background: var(--sage); }
  #copy-text { margin-top: 20px; font-size: .83rem; }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .skip-link { position: absolute; top: -100px; left: 16px; padding: 10px; background: var(--paper); }
  .skip-link:focus { top: 10px; }
}
@layer responsive {
  @media (max-width: 600px) {
    .site-header { padding: 15px 20px; }
    .header-actions { gap: 20px; }
    .header-actions button { font-size: .74rem; }
    #app { padding-inline: 20px; }
    .journey { margin: 19px 0 28px; }
    .journey button { gap: 7px; font-size: .8rem; }
    .intro > p { font-size: .86rem; }
    .notes-grid { grid-template-columns: 1fr; }
    .note-card { padding: 17px; }
    .editor { padding: 17px; }
    .editor textarea { min-height: 195px; }
    .actions { gap: 10px; }
    .button { padding-inline: 14px; }
    #practice-cues { grid-template-columns: 1fr; gap: 13px; }
    .setup-notice { font-size: .75rem; margin-top: 0; }
    footer { padding-top: 40px; line-height: 1.5; }
    footer > p, #ai-disclosure > span { display: block; }
    #clear-dialog { padding-bottom: 20px; }
    .clear-actions { flex-direction: column-reverse; gap: 16px; }
    .clear-confirm-actions { justify-content: center; margin-inline-start: 0; }
  }
  @media (pointer: coarse) { button { min-height: 48px; } }
  @media (prefers-reduced-motion: reduce) {
    .thinking-dots > span { animation: none; opacity: .65; }
    .record-button { transition: none; }
    .record-button .record-icon::after { animation: none; }
  }
}
