@charset "UTF-8";

:root {
  color-scheme: light;
  --paper: #fff9f1;
  --ink: #483e50;
  --muted: #756b79;
  --line: #e9dfe4;
  --accent: #c83c60;
  --accent-wash: #ffe5ec;
  font-family: var(--diary-font-family);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: weight;
}

* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.85; }
button, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 4px; }
p, h1, h2 { margin: 0; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible { outline: 3px solid #8f70cc; outline-offset: 5px; }
.diary-workspace { width: min(100% - 64px, 780px); margin: 0 auto; padding: 46px 0 24px; }

.diary-header { padding: 0 6px 27px; }
.brand-line { display: flex; align-items: center; gap: 18px; }
.brand-mark { display: block; width: 65px; height: 65px; flex-shrink: 0; color: #ffda70; transform: rotate(-8deg); }
.brand-mark svg { display: block; width: 100%; height: 100%; }
h1 { font-size: clamp(26px, 4.6vw, 38px); font-weight: 800; letter-spacing: .055em; line-height: 1.45; }
.tagline { color: var(--muted); font-size: 13px; margin-top: 7px; letter-spacing: .02em; }

.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
h2 { font-size: 16px; font-weight: 800; letter-spacing: .04em; }
.section-note { position: relative; padding: 3px 12px; border-radius: 12px 12px 12px 3px; color: #805721; background: #fff0bc; font-size: 11px; font-weight: 700; transform: rotate(2deg); white-space: nowrap; }
.entry-date { color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.writing-section { padding: 26px 28px 25px; background: #fff; border: 2px solid #efdfe5; border-radius: 24px; box-shadow: 0 5px 0 #f2e6df; }
textarea { display: block; width: 100%; min-height: 154px; padding: 17px 19px; resize: vertical; border: 2px solid #e6dfe8; border-radius: 15px; outline: none; color: var(--ink); background: #fffdfc; line-height: 1.95; transition: border-color .18s, box-shadow .18s; }
textarea::placeholder { color: #7e7280; }
textarea:focus { border-color: #d96783; box-shadow: 0 0 0 4px #fce8ed; }
textarea[aria-invalid="true"] { border-color: #b83249; }
.form-bottom { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 19px; }
.writing-help { font-size: 12px; color: var(--muted); }
.character-count { font-size: 11px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.primary-button, .secondary-button { display: inline-flex; gap: 22px; justify-content: center; align-items: center; min-height: 47px; padding: 10px 23px; border: 2px solid transparent; border-radius: 16px; font-size: 14px; font-weight: 800; transition: background .18s, transform .18s, box-shadow .18s; white-space: nowrap; }
.primary-button { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 0 #9c2a4c; }
.primary-button:hover:not(:disabled) { background: #b62b51; border-color: #b62b51; transform: translateY(-2px); box-shadow: 0 6px 0 #9c2a4c; }
.primary-button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #9c2a4c; }
.primary-button:disabled { background: #f8e2e8; border-color: #f8e2e8; color: #946776; box-shadow: 0 3px 0 #ecd1da; cursor: default; }
.primary-button span { display: grid; place-items: center; width: 22px; height: 22px; font-size: 22px; line-height: 1; }
.secondary-button { background: #fff; border-color: #dfa1b4; color: #ad3152; box-shadow: 0 3px 0 #f0d9e2; }
.secondary-button:hover:not(:disabled) { background: var(--accent-wash); transform: translateY(-1px); box-shadow: 0 4px 0 #f0d9e2; }
.secondary-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #f0d9e2; }
.secondary-button:disabled { opacity: .55; cursor: wait; }
.form-error { color: #b12e45; font-size: 13px; }
.form-error:not(:empty) { margin-top: 8px; }
.network-error { padding: 16px 19px; border: 2px solid #e4b5be; border-radius: 16px; background: #fff0ef; margin-bottom: 20px; font-size: 13px; }
.network-error a { display: block; }

.entry-section { padding: 32px 6px 31px; }
.entry-paper { padding: 21px 24px; background: #fff4cf; border: 1px solid #eedda6; border-radius: 18px; overflow-wrap: anywhere; line-height: 2; }
.entry-paper p + p { margin-top: 1em; }
.quiet-state { padding: 21px 24px; color: var(--muted); font-size: 13px; border: 2px dashed #e8ddcf; border-radius: 18px; }
.chatter-section { border-top: 2px dashed var(--line); padding: 26px 6px 0; }
.chatter-section .section-heading { margin-bottom: 11px; }
.chatter-sign { display: inline-block; color: #c27598; font-size: 25px; font-weight: 800; letter-spacing: 4px; transform: rotate(6deg); }
.ai-label { color: #75677b; font-size: 11px; margin-bottom: 28px; line-height: 1.85; }
.ai-label::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; background: #b898d6; border-radius: 50%; vertical-align: 1px; }
.empty-chatter { color: var(--muted); padding: 14px 0 24px; text-align: center; font-size: 13px; }
.empty-symbol { display: inline-grid; place-items: center; width: 55px; height: 40px; background: #f4e7f6; border: 1px solid #e6d5ed; border-radius: 17px 17px 17px 4px; margin-bottom: 17px; color: #916aa0; font-size: 28px; line-height: 1; transform: rotate(-5deg); }
.fallback-state { text-align: center; padding: 17px 8px 24px; }
.snack-symbol { display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 13px; font-size: 32px; background: #fff0cf; border-radius: 23px; transform: rotate(-5deg); }
.state-detail, .retry-count, .previous-chatter-label { color: var(--muted); font-size: 12px; }
.state-detail { margin-top: 7px; }
.previous-chatter-label { margin: 0 0 16px 6px; }
.state-notice { padding: 16px 0; color: var(--muted); font-size: 13px; }
.retry-row { display: flex; align-items: center; justify-content: center; gap: 17px; margin-top: 32px; }
.waiting-state { text-align: center; padding: 38px 0; font-size: 14px; color: var(--muted); }
.gathering-dots { display: inline-flex; gap: 9px; margin-bottom: 14px; }
.gathering-dots i { display: block; width: 13px; height: 13px; background: #f39bb3; border-radius: 50%; animation: gather 1s ease-in-out infinite; }
.gathering-dots i:nth-child(2) { animation-delay: .15s; background: #f5d16d; }
.gathering-dots i:nth-child(3) { animation-delay: .3s; background: #b69ade; }
.diary-footer { border-top: 2px dashed var(--line); padding: 22px 0 6px; margin-top: 40px; text-align: center; font-size: 11px; color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@keyframes appear { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gather { 0%, 70%, 100% { transform: translateY(0); } 35% { transform: translateY(-7px); } }

@media (max-width: 560px) {
  .diary-workspace { width: calc(100% - 32px); padding-top: 26px; }
  .diary-header { padding: 0 2px 23px; }
  .brand-line { gap: 12px; }
  .brand-mark { width: 49px; height: 53px; }
  h1 { font-size: clamp(23px, 6.5vw, 31px); letter-spacing: .025em; }
  .tagline { font-size: 10px; margin-top: 6px; }
  .writing-section { padding: 20px 17px 23px; border-radius: 21px; }
  .section-heading { gap: 10px; margin-bottom: 15px; }
  h2 { font-size: 14px; letter-spacing: .01em; }
  .section-note { font-size: 10px; padding: 3px 9px; }
  textarea { padding: 14px; font-size: 16px; min-height: 155px; }
  .form-bottom { flex-wrap: wrap; gap: 13px; margin-top: 14px; }
  .writing-help { font-size: 11px; width: 100%; }
  .character-count { font-size: 10px; }
  .primary-button { width: 100%; gap: 16px; min-height: 47px; font-size: 14px; }
  .entry-section { padding: 28px 2px 26px; }
  .entry-paper { padding: 18px; font-size: 14px; }
  .entry-date { font-size: 11px; }
  .quiet-state { padding: 18px; font-size: 12px; }
  .chatter-section { padding: 22px 2px 0; }
  .ai-label { font-size: 10px; line-height: 1.9; }
  .ai-label::before { margin-right: 5px; width: 6px; height: 6px; }
  .fallback-state > p:first-of-type { font-size: 12px; }
  .retry-row { gap: 13px; }
  .secondary-button { padding: 10px 17px; font-size: 13px; }
  .retry-count { font-size: 11px; }
  .previous-chatter-label { margin-left: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Calendar and day navigation share the existing paper and strawberry palette. */
.main-navigation { display: flex; gap: 8px; margin-top: 22px; }
.main-navigation a { padding: 6px 20px; border-radius: 12px; text-decoration: none; font-size: 13px; font-weight: 700; }
.main-navigation a:hover, .main-navigation a[aria-current="page"] { background: var(--accent-wash); }
.date-navigation, .month-navigation { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 18px 2px; border-top: 1px solid var(--line); }
.date-navigation a, .month-navigation a, .date-navigation > span, .month-navigation > span { font-size: 12px; }
.date-navigation > :nth-child(3), .month-navigation > :nth-child(3) { justify-self: end; }
[aria-disabled="true"] { color: #a399a3; }
.date-navigation .back-to-calendar { grid-column: 1 / -1; justify-self: end; font-size: 11px; }
.edit-button { padding: 5px 12px; color: var(--accent); background: transparent; border: 1px solid #dfa1b4; border-radius: 10px; font-size: 12px; }
.edit-button:hover { background: var(--accent-wash); }
.writing-section + .chatter-section { margin-top: 32px; }
.chatter-summary { margin-bottom: 18px; font-size: 12px; color: var(--muted); }
.retry-row { flex-wrap: wrap; }
.future-day { padding: 60px 0; text-align: center; }
.future-day a { display: inline-block; margin-top: 12px; font-size: 13px; }
@media (max-width: 560px) {
  .date-navigation, .month-navigation { gap: 5px; }
  .date-navigation h2 { font-size: 13px; }
  .date-navigation a, .date-navigation > span, .month-navigation a, .month-navigation > span { font-size: 10px; }
}

/* Account and login screens use the diary's existing paper palette. */
input { font: inherit; color: inherit; }
input[type="submit"] { cursor: pointer; }
.header-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 22px; }
.header-tools .main-navigation { margin-top: 0; }
.account-navigation { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 12px; min-width: 0; }
.account-navigation > span { max-width: 180px; overflow-wrap: anywhere; }
.text-button { border: 0; background: none; color: var(--accent); padding: 5px 0; text-decoration: underline; text-underline-offset: 4px; font-size: 12px; }
.header-about { font-size: 12px; white-space: nowrap; text-underline-offset: 4px; }
.header-side { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-left: auto; }
/* Phase 8: the JA | EN toggle. The current language is inert; the other is a PATCH /locale button. */
.locale-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.locale-form { display: inline; }
.locale-option { display: inline-block; padding: 2px 7px; border-radius: 8px; font: inherit; font-weight: 800; line-height: 1.6; }
button.locale-option { border: 0; background: none; color: var(--accent); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
button.locale-option:hover { background: var(--accent-wash); }
.locale-option.is-current { color: var(--muted); background: #f3efec; }
.locale-divider { color: #cfc4cb; }
.auth-workspace { max-width: 620px; }
.account-form h2 { font-size: 21px; }
.account-form h3 { margin-top: 28px; font-size: 16px; }
.account-email { margin-top: 8px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.form-introduction { margin: 10px 0 22px; color: var(--muted); font-size: 13px; }
.form-field { margin: 0 0 23px; }
.form-field > label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 700; }
.form-field input:not([type="checkbox"]) { width: 100%; min-width: 0; padding: 10px 13px; min-height: 46px; border: 2px solid #e6dfe8; border-radius: 12px; background: #fffdfc; }
input:focus-visible { outline: 3px solid #f2c7d4; outline-offset: 2px; }
input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; flex-shrink: 0; }
.check-option { display: inline-flex !important; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.remember-option { margin-bottom: 22px; }
.account-form input[type="submit"] { display: block; }
.account-link { margin-top: 27px; font-size: 13px; }
.account-form .primary-button { min-width: 150px; }
@media (max-width: 560px) {
  .main-navigation a { padding: 6px 13px; }
  .account-navigation { justify-content: flex-end; }
  .header-side { width: 100%; justify-content: flex-end; }
  .form-field input:not([type="checkbox"]) { font-size: 16px; }
  .account-form h2 { font-size: 18px; }
}

/* Phase 7: the diary and its replies read as one board thread. Every reply looks the same:
   no colours, faces or bubbles per poster, only the number, the anonymous name, the date and the ID. */
.thread-head { padding-bottom: 12px; }
.thread-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.thread-title { font-size: 20px; line-height: 1.5; letter-spacing: .01em; overflow-wrap: anywhere; }
.ai-mark { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 8px; background: #efe6f6; color: #6f4f8a; font-size: 11px; font-weight: 700; line-height: 1.8; vertical-align: middle; white-space: nowrap; }
.thread-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 20px; color: var(--muted); font-size: 12px; }
.thread-list { list-style: none; margin: 0; padding: 0; }
.res { padding: 12px 6px 14px; border-top: 1px solid var(--line); }
.res-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 13px; line-height: 1.6; }
.res-no { font-weight: 800; font-variant-numeric: tabular-nums; }
.res-name { color: #1d7a34; font-weight: 700; }
.res-date { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.res-id { color: #8a8290; font-size: 11px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .02em; }
.res-body { margin: 6px 0 0 22px; white-space: pre-line; overflow-wrap: anywhere; font-size: 14px; line-height: 1.9; }
.anchor { padding: 0; border: 0; background: none; color: #1f6fb2; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.anchor:hover { color: #14507f; }
.res-op { padding: 14px 18px 18px; border-top: 0; border-left: 5px solid #e0b64a; border-radius: 0 16px 16px 0; background: #fff4cf; }
.res-op .res-body { margin-left: 0; white-space: normal; }
.res-op .entry-paper { padding: 0; border: 0; background: none; border-radius: 0; }
.op-label { display: inline-block; margin: 8px 0 4px; padding: 0 9px; border-radius: 8px; background: #fbe6a6; color: #7a5a12; font-size: 11px; font-weight: 700; line-height: 1.9; }
.ai-label-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ai-label-row .ai-label { margin-bottom: 20px; }
.reveal-all-button { flex-shrink: 0; padding: 4px 12px; border: 1px solid #dfa1b4; border-radius: 10px; background: #fff; color: #ad3152; font-size: 12px; font-weight: 700; }
.reveal-all-button:hover { background: var(--accent-wash); }
.thread-title-input { display: block; width: 100%; margin-bottom: 12px; padding: 11px 15px; border: 2px solid #e6dfe8; border-radius: 12px; outline: none; color: var(--ink); background: #fffdfc; font-weight: 700; transition: border-color .18s, box-shadow .18s; }
.thread-title-input::placeholder { color: #7e7280; font-weight: 400; }
.thread-title-input:focus { border-color: #d96783; box-shadow: 0 0 0 4px #fce8ed; }
.thread-title-input[aria-invalid="true"] { border-color: #b83249; }
.is-highlighted { background: #fff0bc; }
.thread-board .res { transition: opacity .28s ease-out, transform .28s ease-out, background .3s; }
[data-chatter-reveal-animate-value="true"] .res:not(.is-revealed) { opacity: 0; transform: translateY(6px); }
@media (max-width: 560px) {
  .thread-title { font-size: 16px; }
  .thread-meta { margin-bottom: 14px; font-size: 11px; }
  .res { padding: 10px 2px 12px; }
  .res-head { font-size: 12px; gap: 3px 8px; }
  .res-body { margin-left: 14px; font-size: 13px; }
  .res-op { padding: 12px 14px 14px; }
  .thread-title-input { padding: 10px 13px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .res { opacity: 1 !important; transform: none !important; }
}

/* Phase 10: billing. The diary screens get one quiet line and a link, never a price table; the
   account page gets a Subscription section between the address and the password form. */
.account-section { margin-top: 30px; padding-top: 22px; border-top: 2px dashed var(--line); }
.account-form .account-section h3 { margin-top: 0; }
.account-form h4 { margin: 14px 0 0; font-size: 14px; }
turbo-frame.subscription-panel { display: block; margin-top: 12px; }
.plan-name { font-size: 15px; font-weight: 800; }
.plan-price, .subscription-status, .subscription-date { font-size: 13px; }
.plan-price { color: var(--muted); }
.subscription-status { margin-top: 10px; font-weight: 700; }
.subscription-note { margin: 12px 0 18px; color: var(--muted); font-size: 13px; }
.subscription-status + .subscription-note, .subscription-date + .subscription-note { margin-top: 6px; }
.subscription-date + form, .subscription-date + .subscription-note + form { margin-top: 18px; }
.subscription-panel .primary-button { white-space: normal; text-align: center; }
.portal-form { margin-top: 12px; }
.subscription-processing { display: flex; align-items: center; gap: 14px; padding: 8px 0 4px; color: var(--muted); font-size: 13px; }
.subscription-processing .gathering-dots { margin-bottom: 0; }
.billing-footer { margin-top: 32px; }
.thread-locked { padding: 18px 8px 8px; text-align: center; color: var(--muted); font-size: 13px; }
.thread-locked .secondary-button { margin-top: 14px; }
.locked-notice p + p { margin-top: 4px; }
.locked-lead { color: var(--ink); font-weight: 700; }
.subscribe-link { font-weight: 800; }
.retry-hint { flex-basis: 100%; text-align: center; color: var(--muted); font-size: 12px; }
.retry-row .secondary-button[aria-describedby="thread_subscribe_hint"] { cursor: not-allowed; }
.trial-banner { margin: 4px 0 18px; padding: 9px 16px; border-radius: 14px; background: #fff0bc; color: #6d5316; font-size: 12px; text-align: center; }
@media (max-width: 560px) {
  .account-section { margin-top: 24px; padding-top: 18px; }
  .subscription-panel .primary-button { width: 100%; }
  .thread-locked { font-size: 12px; }
  .trial-banner { font-size: 11px; }
}
