/* A quiet journal; the cottage character and the weekly stamps are the only illustrations. */
html:has(.portal-diary) { background: #F5F3F7; }
body.portal-refresh.portal-diary:not(.portal-account) {
  color-scheme: light;
  --pink: #F4C2F4; --purple: #E0CEE9; --green: #BEE0C6; --blue: #B1DEED; --rose: #F4C6C6; --gold: #F4D095;
  --text: #201D24; --muted: #625D69; --dim: #625D69; --card: #fff; --line: rgb(98 93 105 / .18);
  background: #F5F3F7; color: var(--text);
}
.portal-refresh.portal-diary:not(.portal-account) .app-shell { width: min(100%, 1000px); margin: 0 auto; min-height: 100dvh; background: #F5F3F7; }
.portal-diary .app-header { margin-inline: 24px; padding-inline: 0; }
.portal-diary .avatar { background: #fff; border-color: var(--line); }
.portal-diary .view { padding: 36px 32px 40px; }
.diary-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 106px; margin-bottom: 28px; }
.diary-eyebrow { margin: 0 0 9px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .12em; }
.diary-hero > div { min-width: 0; }
.diary-hero > yzh-pet-portrait { flex: none; }
.portal-diary h1 { margin: 0 0 8px; font-size: clamp(26px, 5vw, 34px); letter-spacing: -.04em; overflow-wrap: anywhere; }
.portal-diary .lede { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.portal-diary :is(a, button, summary):focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }
.portal-diary [hidden] { display: none !important; }
.daily-actions { display: grid; grid-template-columns: 1.12fr 1fr; gap: 20px; }
.portal-diary .system-message { margin: 0; color: var(--muted); line-height: 1.7; text-align: center; }
.portal-diary .system-message a { display: block; color: var(--text); }
.portal-diary .needs-login { background: #fff; border-color: var(--line); }
.checkin-card, .today-card { display: flex; flex-direction: column; min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.checkin-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.checkin-head h2 { margin: 0; font-size: 18px; }
.checkin-head small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.checkin-total { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.checkin-slots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 22px 0 16px; padding: 0; list-style: none; }
.slot { display: grid; justify-items: center; gap: 9px; padding: 0; color: var(--muted); }
.slot-icon { display: grid; place-items: center; box-sizing: border-box; width: 34px; height: 34px; border: 1px dashed var(--line); border-radius: 50%; font-size: 12px; }
.slot b { color: var(--muted); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.slot.is-next .slot-icon { border: 1px solid var(--text); background: var(--gold); color: var(--text); }
.slot.is-next b, .slot.is-grand b { color: var(--text); font-weight: 700; }
.slot.is-grand .slot-icon { background: var(--purple); border-style: solid; }
.slot.is-done .slot-icon { border-style: solid; border-color: var(--green); background: var(--green); color: var(--text); font-size: 16px; }
.slot.is-done b { color: var(--text); }
.slot.is-paying .slot-icon { border-style: dashed; border-color: var(--text); background: var(--gold); }
.stamp-progress { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.checkin-status, .today-status { margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.checkin-status:empty, .today-status:empty { display: none; }
.checkin-status.is-error, .today-status.is-error { padding: 8px 12px; border-radius: 8px; background: var(--rose); color: var(--text); }
.checkin-status.is-done, .today-status.is-done { color: var(--text); }
.checkin-button, .write-button, .read-entry { display: block; box-sizing: border-box; width: 100%; min-height: 46px; margin-top: 18px; padding: 12px; border: 1px solid transparent; border-radius: 10px; color: var(--text); font: inherit; font-size: 14px; font-weight: 650; line-height: 1.5; text-align: center; text-decoration: none; cursor: pointer; overflow-wrap: anywhere; }
.checkin-button { background: var(--green); }
.write-button, .read-entry { background: var(--purple); }
.read-entry span { margin-left: 6px; }
:is(.checkin-button, .write-button):hover:not(:disabled) { filter: brightness(.97); }
:is(.checkin-button, .write-button):disabled { background: #F5F3F7; border-color: var(--line); color: var(--muted); cursor: default; }
:is(.checkin-button, .write-button).is-busy::after { content: ''; display: inline-block; width: .8em; height: .8em; margin-left: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -.1em; animation: diary-spin .8s linear infinite; }
.today-card { border-top: 3px solid var(--purple); padding-top: 22px; }
.today-head { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.today-head h2 { margin: 0; font-size: 18px; }
.today-head small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.diary-price { padding: 4px 8px; border-radius: 6px; background: #F5F3F7; color: var(--muted); font-size: 12px; white-space: nowrap; }
.today-status { flex: 1; }
.today-footnote { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }
.book-head { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 40px 0 18px; }
.book-head h2 { margin: 0; font-size: 20px; }
.book-head small { color: var(--muted); font-size: 12px; }
.diary-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.diary-card { border: 1px solid var(--line); border-radius: 4px 16px 16px 4px; background: #fff; box-shadow: -3px 0 0 var(--purple); overflow: clip; }
.diary-entry { scroll-margin-top: 90px; }
.entry-summary { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 18px 26px; box-sizing: border-box; list-style: none; cursor: pointer; }
.entry-summary::-webkit-details-marker { display: none; }
.entry-summary:hover { background: #F5F3F7; }
.entry-summary:focus-visible { outline-offset: -4px !important; }
.entry-toggle { margin-left: auto; flex: none; width: 8px; height: 8px; border-bottom: 1.5px solid var(--muted); border-right: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform .2s ease; }
.diary-entry[open] .entry-toggle { transform: rotate(225deg); }
.entry-latest { flex: none; padding: 3px 7px; border-radius: 5px; background: var(--purple); color: var(--text); font-size: 11px; }
.diary-body { max-width: 720px; margin: 0 auto; padding: 10px 30px 26px; }
.diary-card.is-new { animation: diary-pop .5s ease-out; }
.diary-date { margin: 0; color: var(--text); font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.7; }
.diary-text { margin: 0; color: var(--text); font-size: 16px; line-height: 2.1; letter-spacing: .03em; overflow-wrap: anywhere; }
.diary-text + .diary-text { margin-top: 1em; }
.diary-sign { margin: 14px 0 0; color: var(--muted); font-size: 13px; text-align: right; overflow-wrap: anywhere; }
.diary-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 0; padding: 14px 0 0; border-top: 1px dashed var(--line); list-style: none; }
.diary-chips li { padding: 5px 10px; border-radius: 6px; background: #F5F3F7; color: var(--muted); font-size: 12px; }
.diary-chips b { margin-left: 4px; color: var(--text); font-weight: 600; }
.diary-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.empty-note { margin: 0; padding: 32px 16px; border: 1px dashed var(--line); border-radius: 12px; font-size: 15px; text-align: center; }
.empty-note p { margin: 0; }
.empty-note > span { display: block; margin-bottom: 10px; color: var(--muted); font-size: 24px; }
.empty-note small { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.book-toggle, .retry-button { display: block; width: 100%; min-height: 46px; margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); font-size: 13px; cursor: pointer; }
.retry-button { max-width: 220px; margin: 16px auto; }
.portal-diary .game-help { margin-top: 24px; background: transparent; }
.portal-diary .game-help summary { min-height: 44px; box-sizing: border-box; padding-block: 12px; color: var(--muted); font-size: 13px; cursor: pointer; }
.portal-diary .game-help h3 { margin: 18px 0 6px; font-size: 14px; color: var(--text); }
.portal-diary .game-help p { color: var(--muted); font-size: 13px; line-height: 1.9; }
.portal-diary .back-link { display: block; min-height: 44px; margin-top: 16px; color: var(--muted); font-size: 12px; line-height: 44px; text-align: center; text-decoration: none; }
.just-stamped .is-latest .slot-icon { animation: diary-stamp .45s ease-out; }
@keyframes diary-spin { to { transform: rotate(360deg); } }
@keyframes diary-pop { from { opacity: .4; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes diary-stamp { from { transform: scale(1.3) rotate(-15deg); } to { transform: none; } }
@media (max-width: 760px) {
  .daily-actions { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .portal-diary .view { max-width: 620px; margin-inline: auto; padding: 28px 24px 36px; }
}
@media (max-width: 540px) {
  .portal-diary .app-header { margin-inline: 20px; }
  .portal-diary .view { padding: 24px 18px 30px; }
  .diary-hero { margin-bottom: 22px; gap: 8px; }
  .checkin-card, .today-card { padding: 20px 16px; }
  .checkin-slots { gap: 4px; }
  .slot b { font-size: 11px; }
  .slot-icon { width: 28px; height: 28px; }
  .entry-summary { gap: 8px; padding: 16px; }
  .diary-date { font-size: 13px; }
  .entry-latest { font-size: 10px; padding-inline: 5px; }
  .diary-body { padding: 6px 20px 22px; }
  .book-head { margin-top: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .portal-diary *, .portal-diary *::after { animation: none !important; transition: none !important; }
}
