
:root {
      --ink: #273247;
      --muted: #78839a;
      --soft: #f4f7fb;
      --line: #dde4ef;
      --blue: #7e9ed2;
      --blue-deep: #5c7fb8;
      --coral: #f19a88;
      --yellow: #f7d98c;
      --mint: #a7d9c7;
      --lilac: #c6b8e8;
      --paper: #fffdf7;
      --shadow: 0 24px 60px rgba(47, 65, 96, .13);
      --cute-font: "ZCOOL KuaiLe", "YouYuan", "幼圆", "PingFang SC", sans-serif;
      --hand-font: "ZCOOL XiaoWei", "ZCOOL KuaiLe", "YouYuan", "幼圆", sans-serif;
    }

    * { box-sizing: border-box; }
    body {
      margin: 0;
      min-width: 320px;
      color: var(--ink);
      font-family: var(--cute-font);
      background:
        radial-gradient(circle at 12% 12%, rgba(255,255,255,.9) 0 2px, transparent 3px),
        radial-gradient(circle at 80% 28%, rgba(255,255,255,.7) 0 1px, transparent 2px),
        #edf2f8;
      background-size: 48px 48px, 70px 70px, auto;
    }

    button, input, textarea { font: inherit; }
    button { border: 0; cursor: pointer; color: inherit; }
    .app { max-width: 1440px; min-height: 100vh; margin: 0 auto; padding: 24px 30px 44px; }

    .topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
    .brand { display: flex; align-items: center; gap: 12px; }
    .brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--blue-deep); color: white; font-size: 23px; box-shadow: 0 9px 18px rgba(92,127,184,.25); transform: rotate(-4deg); }
    .brand h1 { margin: 0; font-size: 19px; letter-spacing: .04em; font-family: var(--hand-font); }
    .brand p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
    .top-actions { display: flex; align-items: center; gap: 10px; }
    .date-pill { color: var(--muted); font-size: 13px; background: rgba(255,255,255,.65); border: 1px solid rgba(255,255,255,.9); border-radius: 999px; padding: 8px 13px; }
    .today-btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13px; box-shadow: 0 7px 14px rgba(39,50,71,.18); transition: transform .2s, background .2s; }
    .today-btn:hover { transform: translateY(-1px); background: #36445e; }

    .workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
    .sidebar { display: grid; gap: 15px; }
    .panel { background: rgba(255,255,255,.79); border: 1px solid rgba(255,255,255,.9); border-radius: 16px; padding: 18px; box-shadow: 0 10px 30px rgba(64,83,115,.06); backdrop-filter: blur(8px); }
    .calendar-panel { background: #fff7fb; border-color: #f3cfdf; box-shadow: 0 12px 28px rgba(210,121,160,.11); }
    .mood-panel { background: #f1fbf8; border-color: #c6e9dc; box-shadow: 0 12px 28px rgba(82,171,143,.1); }
    .recent-panel { background: #f8f3ff; border-color: #dfd2f3; box-shadow: 0 12px 28px rgba(137,103,190,.1); }
    .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
    .panel-heading h2 { margin: 0; font-size: 14px; letter-spacing: .04em; }
    .panel-heading span { color: var(--muted); font-size: 11px; }
    .month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
    .month-nav strong { font-size: 16px; }
    .nav-btn { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: #eef3fb; color: var(--blue-deep); font-size: 17px; transition: background .2s, transform .2s; }
    .nav-btn:hover { background: #e1eaf8; transform: translateY(-1px); }
    .calendar-week, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
    .calendar-week { margin-bottom: 6px; color: #a0a9b9; font-size: 10px; text-align: center; }
    .day-cell { min-width: 0; aspect-ratio: 1; position: relative; display: grid; place-items: center; border-radius: 9px; background: transparent; color: #5c677b; font-size: 12px; transition: background .2s, color .2s; }
    .day-cell:hover { background: #edf3fb; }
    .day-cell.muted { color: #c4cad4; }
    .day-cell.selected { background: var(--blue-deep); color: #fff; box-shadow: 0 5px 11px rgba(92,127,184,.26); }
    .day-cell.today:not(.selected) { color: var(--coral); font-weight: 700; }
    .day-cell.has-entry::after { content: ""; position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--mood-color, var(--coral)); box-shadow: 0 0 0 2px rgba(255,255,255,.55); }
    .day-cell.selected.has-entry::after { background: var(--mood-color, #fff); box-shadow: 0 0 0 2px rgba(255,255,255,.8); }
    .mood-strip { display: flex; align-items: end; justify-content: space-between; height: 112px; padding: 11px 2px 5px; border-bottom: 1px dashed var(--line); }
    .mood-bar { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: end; gap: 6px; height: 100%; }
    .mood-bar i { width: 20px; max-height: 75px; min-height: 8px; border-radius: 8px 8px 4px 4px; background: var(--bar-color); opacity: .87; }
    .mood-bar small { color: var(--muted); font-family: var(--hand-font); font-size: 11px; white-space: nowrap; }
    .mood-legend { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px 4px; margin-top: 10px; color: var(--muted); font-size: 10px; }
    .mood-legend span { display: flex; align-items: center; gap: 4px; }
    .mood-legend b { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--dot); }
    .recent-list { display: grid; gap: 9px; }
    .recent-item { display: grid; grid-template-columns: 35px minmax(0, 1fr); gap: 9px; align-items: center; padding: 7px 8px; border-radius: 10px; background: #fbfcfe; cursor: pointer; transition: background .2s, transform .2s; }
    .recent-item:hover { background: #f0f5fd; transform: translateX(2px); }
    .recent-date { text-align: center; color: var(--blue-deep); font-size: 11px; line-height: 1.15; font-weight: 700; }
    .recent-date em { display: block; color: #9fa9bb; font-size: 9px; font-style: normal; font-weight: 400; }
    .recent-copy { min-width: 0; }
    .recent-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
    .recent-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; color: var(--muted); font-size: 10px; }

    .book-stage { min-width: 0; padding: 10px 0 14px; }
    .book-wrap { position: relative; padding: 20px 18px 22px; border-radius: 22px; background: #d5e0ee; box-shadow: var(--shadow); }
    .book-wrap::before, .book-wrap::after { content: ""; position: absolute; left: 17px; right: 17px; height: 9px; border-radius: 50%; background: #c1cede; z-index: 0; }
    .book-wrap::before { top: 8px; }
    .book-wrap::after { bottom: 9px; }
    .book { position: relative; z-index: 1; display: grid; grid-template-columns: 42% 58%; min-height: 610px; overflow: hidden; border-radius: 12px; background: var(--paper); box-shadow: 0 4px 0 #bcc9d8; perspective: 1800px; }
    .page { position: relative; min-width: 0; overflow: hidden; background-color: var(--paper); }
    .page::after { content: ""; pointer-events: none; position: absolute; inset: 0; opacity: .42; background-image: radial-gradient(rgba(156,139,111,.11) .7px, transparent .8px); background-size: 5px 5px; mix-blend-mode: multiply; }
    .page-left { padding: 34px 31px 30px; border-right: 1px solid #ece7dc; background: #fffcf4; }
    .page-right { padding: 34px 39px 30px 38px; transform-origin: left center; transform-style: preserve-3d; backface-visibility: hidden; z-index: 2; }
    .page-inner { position: relative; z-index: 1; height: 100%; }
    .hole-punches { position: absolute; z-index: 2; top: 42px; bottom: 33px; display: flex; flex-direction: column; justify-content: space-between; }
    .page-left .hole-punches { left: 9px; }
    .page-right .hole-punches { right: 9px; }
    .hole-punches i { width: 7px; height: 7px; border-radius: 50%; background: #d2dce9; box-shadow: inset 0 1px 2px rgba(38,53,77,.18); }
    .page-kicker { display: flex; align-items: center; gap: 7px; color: var(--coral); font-size: 11px; letter-spacing: .12em; }
    .page-kicker::before { content: ""; width: 22px; height: 1px; background: var(--coral); }
    .page-left h2 { margin: 20px 0 5px; font-family: var(--hand-font); font-size: clamp(46px, 6vw, 72px); line-height: .95; letter-spacing: .02em; color: var(--ink); }
    .page-left h2 small { display: block; margin-top: 10px; color: var(--muted); font-family: var(--cute-font); font-size: 13px; letter-spacing: .08em; }
    .date-ribbon { display: inline-flex; align-items: center; gap: 8px; margin: 23px 0 26px; padding: 7px 11px; color: #59677e; border: 1px solid #dbe3ee; border-radius: 7px; background: #f8fbff; font-size: 11px; }
    .date-ribbon b { color: var(--blue-deep); font-size: 17px; }
    .polaroid { position: relative; width: 100%; max-width: 214px; margin: 0 auto; padding: 8px 8px 24px; background: #fff; box-shadow: 0 7px 16px rgba(97,82,65,.12); transform: rotate(-3deg); }
    .polaroid .photo { height: 150px; display: grid; place-items: center; overflow: hidden; border-radius: 7px; background: #d7ebf0; transition: background .35s ease; }
    .polaroid .photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
    .polaroid figcaption { position: absolute; left: 12px; right: 12px; bottom: 5px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; color: #8e8476; font-family: var(--hand-font); font-size: 13px; line-height: 1.15; }
    .polaroid figcaption small { color: #a69b8b; font-family: var(--cute-font); font-size: 9px; letter-spacing: .02em; }
    .tape { position: absolute; top: -11px; left: 33%; width: 74px; height: 22px; background: rgba(247,217,140,.7); transform: rotate(4deg); }
    .left-note { margin-top: 43px; color: #74819a; font-family: var(--hand-font); font-size: 17px; line-height: 1.8; text-align: center; }

    .entry-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
    .entry-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
    .mood-emoji { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; background: #edf3fb; font-family: var(--cute-font); font-size: 24px; font-weight: 400; }
    .entry-status { padding: 5px 8px; border-radius: 6px; background: #edf7f2; color: #4f9a7c; font-size: 10px; }
    .entry-title { width: 100%; border: 0; outline: none; padding: 2px 0 11px; border-bottom: 1px solid #e9e0d2; color: var(--ink); background: transparent; font-family: var(--hand-font); font-size: clamp(24px, 3vw, 31px); }
    .entry-title::placeholder { color: #b9b1a5; }
    .rule-paper { min-height: 302px; margin-top: 17px; background: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, #e8edf2 32px); }
    .entry-content { width: 100%; min-height: 302px; resize: none; border: 0; outline: none; padding: 1px 2px 0 0; color: #4d5b71; background: transparent; font-family: var(--hand-font); font-size: 19px; line-height: 32px; }
    .entry-content::placeholder { color: #c8c2b7; }
    .entry-foot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding-top: 12px; border-top: 1px dashed #e8e0d4; background: transparent; }
    .tool-group { display: flex; align-items: center; gap: 9px; }
    .tool-label { color: #9d968b; font-size: 10px; }
    .color-dot { width: 23px; height: 23px; border: 2px solid transparent; border-radius: 50%; background: var(--dot); box-shadow: inset 0 0 0 1px rgba(255,255,255,.55); transition: transform .2s, border-color .2s; }
    .color-dot:hover, .color-dot.active { border-color: #5e6a7f; transform: scale(1.12); }
    .save-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 15px; border: 2px solid #f6b3ce; border-radius: 12px; color: #fff; background: #e979aa; font-size: 12px; box-shadow: 0 8px 16px rgba(220,103,157,.25); transition: transform .2s, background .2s, box-shadow .2s; }
    .save-btn:hover { transform: translateY(-2px) rotate(-1deg); background: #db6397; box-shadow: 0 11px 20px rgba(220,103,157,.3); animation: saveWiggle .45s ease; }
    .save-btn.saved { border-color: #a9e1ca; background: #68b99a; box-shadow: 0 8px 16px rgba(73,164,126,.23); animation: savePop .45s ease; }
    @keyframes saveWiggle { 0%,100% { transform: translateY(-2px) rotate(-1deg); } 50% { transform: translateY(-2px) rotate(2deg); } }
    @keyframes savePop { 0% { transform: scale(.94) rotate(-2deg); } 65% { transform: scale(1.06) rotate(1deg); } 100% { transform: scale(1) rotate(0); } }

    .book-caption { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 13px 7px 0; color: #8c99ad; font-size: 11px; }
    .book-caption span { display: inline-flex; align-items: center; gap: 7px; }
    .book-caption b { color: var(--blue-deep); font-size: 14px; }
    .page-switch { display: inline-flex; gap: 6px; }
    .page-switch button { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,.75); color: var(--blue-deep); }

    .mood-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-top: 6px; }
    .mood-option { display: grid; justify-items: center; gap: 4px; padding: 7px 2px; border-radius: 9px; background: #fbfcfe; color: #8d96a7; font-size: 10px; transition: transform .2s, background .2s, color .2s; }
    .mood-option span { font-family: var(--cute-font); font-size: 23px; font-weight: 400; line-height: 1; }
    .mood-option:hover { transform: translateY(-2px); }
    .mood-option.active { color: var(--ink); background: #fff5dd; box-shadow: inset 0 0 0 1px #f3dfaa; }
    .mood-option[data-mood="开心"].active { background: #fff5dd; }
    .mood-option[data-mood="平静"].active { background: #eaf6f2; }
    .mood-option[data-mood="难过"].active { background: #edf2fb; }
    .mood-option[data-mood="疲惫"].active { background: #f3effb; }
    .mood-option[data-mood="生气"].active { background: #fff0ed; }

    @media (max-width: 1040px) {
      .app { padding: 20px 20px 36px; }
      .workspace { grid-template-columns: 235px minmax(0, 1fr); gap: 17px; }
      .page-left { padding-left: 26px; padding-right: 26px; }
      .page-right { padding-left: 30px; padding-right: 30px; }
      .polaroid .photo { height: 125px; }
      .book { min-height: 570px; }
    }
    @media (max-width: 760px) {
      .app { padding: 15px 12px 26px; }
      .topbar { align-items: flex-start; margin-bottom: 16px; }
      .date-pill { display: none; }
      .workspace { display: flex; flex-direction: column; gap: 15px; }
      .sidebar { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
      .sidebar .panel:last-child { grid-column: 1 / -1; }
      .sidebar .panel { padding: 14px; }
      .calendar-week { margin-bottom: 4px; }
      .mood-strip { height: 105px; }
      .recent-list { grid-template-columns: repeat(3, 1fr); }
      .book-stage { width: 100%; padding-top: 0; }
      .book-wrap { padding: 12px 10px 15px; border-radius: 16px; }
      .book { display: block; min-height: 620px; }
      .page-left { display: none; }
      .page-right { min-height: 620px; padding: 27px 25px 25px 28px; }
      .page-right .hole-punches { right: 5px; top: 32px; bottom: 29px; }
      .entry-content, .rule-paper { min-height: 360px; }
      .entry-foot { position: static; margin-top: 13px; }
      .book-caption { margin-left: 2px; margin-right: 2px; }
    }
    @media (max-width: 470px) {
      .topbar { gap: 8px; }
      .brand h1 { font-size: 17px; }
      .brand p { font-size: 11px; }
      .today-btn { padding: 9px 10px; font-size: 12px; }
      .sidebar { grid-template-columns: 1fr; }
      .sidebar .panel:last-child { grid-column: auto; }
      .recent-list { grid-template-columns: 1fr; }
      .recent-item { padding: 7px 9px; }
      .page-right { min-height: 650px; padding: 24px 21px 22px 22px; }
      .entry-head { margin-bottom: 15px; }
      .entry-title { font-size: 25px; }
      .entry-content { font-size: 16px; }
      .tool-group { gap: 6px; }
      .save-btn { width: 100%; justify-content: center; }
      .entry-foot { gap: 11px; }
    }

@font-face { font-family: 'ZCOOL KuaiLe Local'; src: url('../assets/fonts/ZCOOLKuaiLe-Regular.woff2') format('woff2'); font-display: swap; font-weight: 400; }
@font-face { font-family: 'ZCOOL XiaoWei Local'; src: url('../assets/fonts/ZCOOLXiaoWei-Regular.woff2') format('woff2'); font-display: swap; font-weight: 400; }
:root { --cute-font: 'ZCOOL KuaiLe Local', 'ZCOOL KuaiLe', 'YouYuan', '幼圆', 'PingFang SC', sans-serif; --hand-font: 'ZCOOL XiaoWei Local', 'ZCOOL XiaoWei', 'ZCOOL KuaiLe Local', 'YouYuan', '幼圆', sans-serif; }
html { color-scheme: light; }
body { min-height: 100vh; min-width: 0; }
button, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(92,127,184,.35); outline-offset: 2px; }
.storage-alert { margin: 0 0 16px; padding: 10px 13px; border: 1px solid #e9b8ad; border-radius: 10px; color: #8f5146; background: #fff3ef; font-size: 12px; line-height: 1.55; }
.storage-alert[hidden] { display: none; }
html[data-theme="night"] .storage-alert { border-color: #7a544f; color: #f0c1b8; background: #463136; }
.privacy-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 18px; color: #8c99ad; font-size: 12px; line-height: 1.6; text-align: center; }
.privacy-note #syncStatus[data-state="online"] { color: #4b9a7a; }
.privacy-note #syncStatus[data-state="offline"] { color: #b98035; }
.privacy-note #syncStatus[data-state="conflict"], .privacy-note #syncStatus[data-state="error"] { color: #a9544b; }
.sync-conflict-notice { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 14px auto 24px; padding: 12px 16px; width: min(760px, calc(100% - 24px)); border: 1px solid #e5c892; border-radius: 10px; background: #fff5df; color: #845b20; font-size: 13px; }
.sync-conflict-notice[hidden] { display: none; }
.sync-conflict-notice button { min-height: 40px; padding: 8px 14px; border-radius: 8px; background: #fff; color: #7c5520; white-space: nowrap; }
.conflict-dialog { width: min(850px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 0; border: 1px solid #dbe3ee; border-radius: 16px; color: #273247; background: #fffdf8; box-shadow: 0 25px 70px rgba(38,50,71,.24); }
.conflict-dialog::backdrop { background: rgba(35,48,70,.38); }
.conflict-hint { margin: 14px 20px; font-size: 13px; line-height: 1.65; color: #66738b; }
.conflict-date-label { margin: 0 8px 0 20px; font-size: 13px; }
#conflictDate { min-height: 40px; margin-right: 20px; padding: 8px; border: 1px solid #dbe3ee; border-radius: 8px; background: #fff; color: #273247; font: inherit; }
.conflict-versions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 16px 20px; }
.conflict-versions section { min-width: 0; }
.conflict-versions h3 { margin: 0 0 6px; font-size: 15px; }
.conflict-versions p { margin: 0 0 8px; color: #78839a; font-size: 12px; min-height: 2.8em; }
.conflict-versions textarea { display: block; width: 100%; height: 220px; padding: 10px; resize: vertical; border: 1px solid #dbe3ee; border-radius: 8px; color: #273247; background: #fff; font-size: 16px; line-height: 1.65; }
.conflict-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 0 20px 8px; }
.conflict-actions button { min-height: 44px; font-size: 13px; }
@media (max-width: 600px) { .conflict-versions { grid-template-columns: minmax(0, 1fr); } .conflict-versions textarea { height: 170px; } .conflict-actions button { flex: 1 1 100%; } }
.privacy-note button { padding: 0; border: 0; color: #5c7fb8; background: transparent; cursor: pointer; font-size: inherit; text-decoration: underline; }
.entry-counter { margin-top: 5px; color: #8893a5; font-size: 12px; line-height: 1.5; text-align: right; }
.photo-fallback { display: grid; width: 100%; height: 100%; place-items: center; font-size: 56px; }
.photo-fallback[hidden] { display: none; }
.entry-status[data-state="dirty"], .entry-status[data-state="draft"] { color: #b98035 !important; background: #fff3db !important; }
.entry-status[data-state="error"] { color: #a04f45 !important; background: #fff0ed !important; }
.save-btn:disabled, .nav-btn:disabled, .page-switch button:disabled, .mood-option:disabled, .color-dot:disabled { opacity: .55; cursor: wait; transform: none !important; }
.tools-btn { min-height: 36px; padding: 8px 11px; border: 1px solid rgba(255,255,255,.8); border-radius: 9px; color: #5e6c83; background: rgba(255,255,255,.68); cursor: pointer; font-size: 12px; white-space: nowrap; }
.tools-btn:hover { background: #fff; }
html[data-theme="night"] .tools-btn { border-color: #3e526f; color: #d4dfed; background: #2b3e5c; }
.tools-dialog, .confirm-dialog { width: min(520px, calc(100vw - 28px)); padding: 0; border: 1px solid #dbe3ee; border-radius: 16px; color: #273247; background: #fffdf8; box-shadow: 0 25px 70px rgba(38,50,71,.24); }
.tools-dialog::backdrop, .confirm-dialog::backdrop { background: rgba(35,48,70,.38); backdrop-filter: blur(2px); }
html[data-theme="night"] .tools-dialog, html[data-theme="night"] .confirm-dialog { border-color: #485e7c; color: #edf3fb; background: #26364e; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid #e6eaf0; }
html[data-theme="night"] .dialog-head { border-bottom-color: #415570; }
.dialog-head h2 { margin: 0; font-family: var(--hand-font); font-size: 23px; font-weight: 400; }
.dialog-head button { width: 29px; height: 29px; border: 0; border-radius: 8px; color: #7f8ba0; background: #f1f4f8; cursor: pointer; font-size: 21px; line-height: 1; }
.tools-hint, .search-label, .search-count, .tools-dialog > .search-label, .backup-tools, .delete-current { margin-right: 20px; margin-left: 20px; }
.tools-hint { margin-top: 15px; color: #78839a; font-size: 11px; line-height: 1.6; }
.search-label { display: block; margin-top: 16px; color: #52617a; font-size: 11px; font-weight: 700; }
.search-controls { display: flex; gap: 8px; margin: 7px 20px 0; }
.search-controls input, .search-controls select { min-height: 36px; padding: 8px 10px; border: 1px solid #dbe3ee; border-radius: 8px; color: #273247; background: #fff; font-size: 11px; }
.search-controls input { flex: 1; min-width: 0; }
.search-results { display: grid; max-height: 210px; overflow: auto; margin: 2px 20px 0; border-top: 1px solid #edf0f4; }
.search-results .recent-item { background: transparent; }
.search-count { margin-top: 10px; margin-bottom: 0; color: #8a96aa; font-size: 10px; }
.secondary-btn, .primary-btn, .danger-btn { min-height: 34px; padding: 8px 11px; border-radius: 8px; cursor: pointer; font-size: 10px; }
.secondary-btn { border: 1px solid #dbe3ee; color: #5c6a81; background: #fff; }
.primary-btn { border: 1px solid #5c7fb8; color: #fff; background: #5c7fb8; }
.danger-btn { border: 1px solid #e5b9b3; color: #a9544b; background: #fff3f0; }
.tools-dialog > .secondary-btn { display: block; margin: 7px 20px 0; }
.backup-tools { margin-top: 17px; padding-top: 14px; border-top: 1px solid #e6eaf0; }
.backup-tools h3 { margin: 0; font-family: var(--hand-font); font-size: 17px; font-weight: 400; }
.backup-tools p { margin: 4px 0 10px; color: #8995a8; font-size: 10px; }
.backup-tools button + button { margin-left: 7px; }
.delete-current { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 17px; margin-bottom: 19px; padding-top: 13px; border-top: 1px dashed #e4e8ef; color: #8995a8; font-size: 10px; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: min(340px, calc(100vw - 48px)); padding: 11px 14px; border: 1px solid #bdd4c9; border-radius: 9px; color: #356c59; background: #effaf5; box-shadow: 0 12px 26px rgba(42,77,67,.16); font-size: 11px; }
.toast[hidden] { display: none; }
html[data-theme="night"] .toast { border-color: #4c806b; color: #b7ebd4; background: #29483f; }
html[data-theme="night"] .search-controls input, html[data-theme="night"] .search-controls select, html[data-theme="night"] .secondary-btn { border-color: #4b607c; color: #edf3fb; background: #2d405f; }
html[data-theme="night"] .search-label, html[data-theme="night"] .backup-tools h3 { color: #dce6f2; }
html[data-theme="night"] .backup-tools, html[data-theme="night"] .delete-current { border-color: #425773; }
/* Keep the handwritten headings while making small controls easier to read. */
.panel-heading span, .calendar-week, .mood-legend, .recent-date, .recent-date em,
.recent-copy strong, .recent-copy small, .page-kicker, .date-ribbon,
.entry-meta, .entry-status, .mood-option, .tool-label, .book-caption { font-size: 12px; }
.entry-counter, .tools-btn, .tools-hint, .search-label, .search-count, .backup-tools p, .delete-current, .toast,
.search-controls input, .search-controls select, .secondary-btn, .primary-btn, .danger-btn { font-size: 12px; line-height: 1.5; }
.privacy-note { flex-wrap: wrap; padding: 0 12px 16px; font-size: 12px; line-height: 1.6; }
.privacy-note button { min-height: 36px; padding: 6px 4px; white-space: nowrap; }
.nav-btn { width: 36px; height: 36px; }
.entry-head { flex-wrap: wrap; gap: 8px 12px; }
.entry-meta { min-width: 0; }
.entry-status { flex-shrink: 0; white-space: nowrap; }
.tool-group { min-width: 0; max-width: 100%; flex-wrap: wrap; gap: 3px; }
.tool-label { flex-shrink: 0; line-height: 1.5; }
.color-dot { position: relative; display: grid; flex: 0 0 36px; width: 36px; height: 40px; place-items: center; padding: 0; border: 0; border-radius: 9px; background: transparent; box-shadow: none; touch-action: manipulation; }
.color-dot::before { content: ""; box-sizing: border-box; width: 23px; height: 23px; border: 2px solid transparent; border-radius: 50%; background: var(--dot); box-shadow: inset 0 0 0 1px rgba(255,255,255,.55); transition: transform .2s, border-color .2s; }
.color-dot:hover, .color-dot.active { transform: none; }
.color-dot:hover::before, .color-dot.active::before { border-color: #5e6a7f; transform: scale(1.08); }
.save-btn { font-size: 13px; }
.save-btn:hover { transform: translateY(-1px); animation: none; }
.save-btn.saved, .save-btn.saved:hover { transform: none; animation: save-confirm .32s ease-out; }
@keyframes save-confirm { from { box-shadow: 0 0 0 3px rgba(104,185,154,.3); } to { box-shadow: 0 8px 16px rgba(73,164,126,.23); } }
/* Equal paper widths keep the spine still throughout a physical page turn. */
.book { grid-template-columns: 1fr 1fr; height: 610px; min-height: 610px; perspective: none; }
.page-inner { min-height: 0; }
.left-note { display: -webkit-box; max-height: 61.2px; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.page-right > .page-inner { display: flex; flex-direction: column; }
.page-right .rule-paper { flex: 1; }
.page-right .entry-foot { position: static; margin-top: 12px; }
.page-right .rule-paper { display: flex; min-width: 0; min-height: 0; overflow: hidden; }
.page-right .entry-content { flex: 1 1 0%; min-width: 0; min-height: 0; width: 100%; height: auto; color: #40546c; overflow: auto; }
.polaroid { padding-bottom: 32px; }
.book > .page-left, .flip-snapshot.page-left { box-shadow: inset -12px 0 18px -18px rgba(77,61,43,.3); }
.book > .page-right, .flip-snapshot.page-right { box-shadow: inset 12px 0 18px -18px rgba(77,61,43,.25); }
.flip-layer.stf__parent { position: absolute; inset: 0; z-index: 5; width: 100%; height: 100%; min-width: 0 !important; min-height: 0 !important; max-width: none !important; visibility: hidden; pointer-events: none; }
.flip-layer .stf__wrapper, .flip-layer .stf__block { width: 100%; height: 100%; padding: 0 !important; }
.book.is-flipping > .page { visibility: hidden; }
.book.is-flipping .flip-layer { visibility: visible; }
.flip-leaf { overflow: hidden; background: var(--paper); }
.flip-snapshot { width: 100%; height: 100%; transform: none; transform-style: flat; backface-visibility: visible; }
.flip-snapshot *, .flip-snapshot *::before, .flip-snapshot *::after { animation: none !important; transition: none !important; }
.book[aria-busy="true"] .save-btn:disabled, .book[aria-busy="true"] .mood-option:disabled, .book[aria-busy="true"] .color-dot:disabled { opacity: 1; }
.page-switch { gap: 8px; flex-shrink: 0; }
.page-switch button { display: flex; justify-content: center; gap: 6px; width: auto; min-width: 76px; height: 36px; padding: 0 12px; font-size: 12px; }
.page-switch button:hover:not(:disabled) { background: #fff; box-shadow: 0 3px 10px rgba(92,127,184,.12); }
.book-caption .caption-note { margin-left: 10px; }
.swipe-hint { display: none; }
@media (min-width: 761px) and (max-width: 1180px) {
  .workspace { grid-template-columns: 220px minmax(0, 1fr); gap: 16px; }
  .book-wrap { padding-right: 12px; padding-left: 12px; }
  .page-left, .page-right { padding-left: 24px; padding-right: 24px; }
  .page-left h2 { font-size: 58px; }
  .entry-foot { flex-wrap: wrap; gap: 10px; }
  .tool-label { flex-basis: 100%; }
  .entry-title { font-size: 25px; }
  .book { height: 610px; min-height: 610px; }
  .book-caption .caption-note { display: none; }
}
@media (min-width: 761px) and (max-width: 980px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .book-stage { order: -1; }
  .sidebar { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; }
  .brand { min-width: 0; }
  .brand-mark { flex-shrink: 0; }
  .top-actions { max-width: 100%; flex-wrap: wrap; gap: 8px; margin-left: auto; }
  .book-stage { order: -1; }
  .book > .page-right, .flip-snapshot.page-right { box-shadow: none; }
  .book-caption { flex-wrap: wrap; row-gap: 12px; }
  .book-caption .caption-note { display: none; }
  .page-switch button { min-height: 44px; min-width: 96px; }
  .swipe-hint { display: block; margin: 10px 0 0; color: #8c99ad; font-size: 12px; line-height: 1.6; text-align: center; }
  .entry-title, .entry-content { font-size: max(16px, 1em); }
  .entry-title { font-size: 25px; }
  .book, .page-right { height: auto; min-height: 0; }
  .page-right > .page-inner { height: auto; min-height: 0; }
  .page-right .rule-paper { flex: 0 0 auto; min-height: 280px; }
  .page-right .entry-content { height: 280px; min-height: 280px; }
  .flip-snapshot.page-right { height: 100%; }
  .entry-foot { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; } }
@media (max-width: 760px) { .tools-btn { order: 3; } .privacy-note { flex-wrap: wrap; } }
@media (max-width: 470px) {
  .tools-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px; }
  .today-btn { min-height: 40px; }
  .tool-group { width: 100%; }
  .tool-label { flex-basis: 100%; }
  .delete-current { align-items: flex-start; flex-direction: column; }
  .delete-current .danger-btn { width: 100%; }
  .backup-tools button { margin-top: 4px; }
  .page-right .rule-paper { min-height: 260px; }
  .page-right .entry-content { height: 260px; min-height: 260px; }
}
@media (max-width: 380px) {
  .entry-head { flex-wrap: nowrap; min-height: 48px; }
  .entry-status { max-width: 90px; white-space: normal; line-height: 16px; }
  .brand { gap: 8px; }
  .brand-mark { width: 32px; height: 32px; flex-shrink: 0; font-size: 20px; }
  .brand h1 { font-size: 15px; }
  .brand p { display: none; }
  .today-btn { white-space: nowrap; }
  .top-actions { flex-shrink: 0; }
}

:root {
  --book-cloth: #b9cddd;
  --book-binding: #8fa9bf;
  --book-rose: #d7bec8;
  --book-thread: #e3ebef;
  --book-cover-ink: #4c6578;
  --book-progress: 0;
  --spread-opacity: 0;
  --scene-opacity: 1;
  --chrome-opacity: 0;
  --cover-ui-opacity: 1;
}
* { letter-spacing: 0; }
html { scrollbar-gutter: stable; }
[hidden] { display: none !important; }
.paper-capture { position: fixed; top: 0; left: -20000px; pointer-events: none; contain: layout style paint; }
.paper-capture *, .paper-capture *::before, .paper-capture *::after { animation: none !important; transition: none !important; }
.paper-capture > .page { display: block !important; }
button { touch-action: manipulation; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.7; flex-shrink: 0; }
.icon-button { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; background: rgba(255,255,255,.65); border: 1px solid rgba(255,255,255,.85); border-radius: 8px; color: var(--blue-deep); }
.icon-button:hover { background: #fff; border-color: #d3deed; }
.brand-mark svg { width: 24px; height: 24px; }
.lock-scene { --closed-book-width: min(430px, calc(100vw - 48px), calc((100dvh - 130px) * .76)); --closed-book-height: calc(var(--closed-book-width) / .76); position: fixed; inset: 0; z-index: 50; min-height: 280px; overflow: hidden; }
body[data-cover-state="loading"] :is(.scene-canvas, .cover-fallback, .pin-lock, .lock-brand) { visibility: hidden; pointer-events: none; }
.cover-loading { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 14px; color: #71869c; font: 13px/1.5 system-ui, sans-serif; }
.cover-loading span { width: 24px; height: 24px; border: 2px solid #d6e1ed; border-top-color: #718fa9; border-radius: 50%; animation: cover-loading-spin .85s linear infinite; }
.cover-loading p { margin: 0; }
body:not([data-cover-state="loading"]) .cover-loading { display: none; }
@keyframes cover-loading-spin { to { transform: rotate(360deg); } }
.scene-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: var(--scene-opacity); }
.scene-canvas canvas { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; }
.lock-brand { position: absolute; top: 24px; left: max(30px, calc((100vw - 1220px) / 2)); }
.cover-fallback { position: absolute; width: var(--closed-book-width); height: var(--closed-book-height); left: 50%; top: calc(50% + 12px); transform: translate(-50%, -50%); border-radius: 5px 11px 11px 5px; background: repeating-linear-gradient(0deg, #ffffff0c 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, #526d8510 0 1px, transparent 1px 3px), var(--book-cloth); border: 1px solid #91aabe; box-shadow: -5px 0 0 var(--book-binding), 5px 4px 0 #fffdf7, 8px 8px 0 var(--book-binding), 4px 22px 38px -12px #43597244, inset 20px 0 22px -12px #4c6c8c50, inset 1px 1px 0 #ffffff90; color: var(--book-cover-ink); padding: 0; }
.cover-fallback::before { content: ""; position: absolute; top: 0; bottom: 0; left: 15px; width: 1px; background: #7c97ae60; box-shadow: 2px 0 0 #dce8f16b; }
.cover-art { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; }
.cover-stitch { position: absolute; inset: 12px 10px 12px 35px; border: 1px solid #7d96ac24; border-radius: 6px; }
.cover-fallback span { position: absolute; top: 26%; left: 8%; width: 92%; text-align: center; color: #607d94; font-size: 10px; }
.cover-fallback h1 { position: absolute; top: 31%; left: 8%; width: 92%; text-align: center; margin: 0; font: 42px/1.25 var(--hand-font); text-shadow: 0 1px 0 #e8f0f5b3, 0 -1px 0 #38506925; }
.cover-fallback small { position: absolute; top: 44%; left: 8%; width: 92%; text-align: center; color: #6b8091; font-size: 11px; }
.cover-fallback i { position: absolute; right: -6px; top: 60.5%; width: 74%; height: 18.5%; border: 1px solid #ae939f; border-radius: 8px 0 0 8px; background: repeating-linear-gradient(0deg, #ffffff12 0 1px, transparent 1px 3px), var(--book-rose); box-shadow: inset 0 0 0 3px #e3ccd4, 0 3px 5px #4f607d22; }
.cover-bookmark { position: absolute; z-index: -1; bottom: -21px; left: 24%; width: 14px; height: 24px; background: var(--book-rose); clip-path: polygon(0 0,100% 0,100% 100%,50% 78%,0 100%); }
body.scene-ready .cover-fallback { display: none; }
.pin-lock { --wheel-height: 42px; --digit-height: 26px; position: absolute; z-index: 2; width: 224px; left: calc(50% + var(--closed-book-width) * .12); top: calc(50% + 12px + var(--closed-book-height) * .19 - 67px); transform: translateX(-50%); display: grid; justify-items: center; opacity: var(--cover-ui-opacity); }
.lock-plate { display: flex; align-items: center; gap: 6px; color: var(--book-cover-ink); font-size: 12px; line-height: 18px; height: 18px; margin-bottom: 10px; }
.lock-plate svg { width: 13px; height: 13px; }
.pin-dials { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 12px; position: relative; border-radius: 7px; background: repeating-linear-gradient(0deg, #ffffff20 0 1px, transparent 1px 3px), linear-gradient(110deg, #c5cfd6, #f2f4f5 32%, #cbd5dd 76%, #a9bac7); border: 1px solid #8c9fae; box-shadow: 0 3px 0 #a0afbb, 0 6px 9px #41556b30, inset 0 1px 0 #fff, inset 0 -1px 0 #778fa661; }
.pin-dials::before, .pin-dials::after { content: ""; position: absolute; width: 4px; height: 4px; top: calc(50% - 2px); border-radius: 50%; background: linear-gradient(135deg, #edf1f4 40%, #647b8e 41% 57%, #d1dbe2 58%); box-shadow: 0 1px 1px #fff, 0 -1px 1px #7b8b9780; }
.pin-dials::before { left: 4px; } .pin-dials::after { right: 4px; }
.pin-wheel-column { width: 36px; flex: 0 0 36px; display: grid; grid-template-rows: 12px var(--wheel-height) 12px; }
.pin-step { display: grid; place-items: center; padding: 0; background: transparent; color: #758a9a; border-radius: 3px; }
.pin-step svg { width: 13px; height: 13px; stroke-width: 1.8; }
.pin-step:hover:not(:disabled) { color: #365a74; background: #ffffff80; }
.pin-step:disabled { cursor: default; }
.pin-digit { width: 36px; height: var(--wheel-height); position: relative; overflow: hidden; border-radius: 4px; border: 1px solid #8da0af; background: #f6f7f6; box-shadow: inset 0 3px 7px #42596b40, 0 1px 0 #ffffffbd; color: #314d63; cursor: grab; touch-action: none; user-select: none; isolation: isolate; }
.pin-digit:active { cursor: grabbing; }
.pin-digit::after { content: ""; pointer-events: none; position: absolute; z-index: 2; inset: 0; border-radius: inherit; background: linear-gradient(to bottom, #5a708d94, #e1e7eb26 28%, #ffffff08 40%, #ffffff08 60%, #e1e7eb30 74%, #5a708d94); box-shadow: inset 0 1px 4px #43586e48; }
.pin-digit::before { content: ""; position: absolute; z-index: 1; left: 1px; right: 1px; height: var(--digit-height); top: calc((var(--wheel-height) - var(--digit-height)) / 2 - 1px); border-block: 1px solid #65809620; pointer-events: none; }
.pin-wheel-track { position: absolute; inset: calc((var(--wheel-height) - var(--digit-height)) / 2 - 1px) 0 auto; will-change: transform; }
.pin-wheel-track > span { display: grid; place-items: center; width: 100%; height: var(--digit-height); font: 24px/1 Georgia, 'Times New Roman', serif; font-variant-numeric: tabular-nums; text-shadow: 0 1px 0 #fff; }
.pin-dials.is-editing .is-current .pin-digit, .pin-digit:focus-visible { outline: 2px solid #678aa7; outline-offset: 2px; }
.pin-keyboard-input { position: absolute; width: 1px; height: 1px; left: 50%; top: 50%; margin: 0; border: 0; padding: 0; color: transparent; caret-color: transparent; background: transparent; font-size: 16px; opacity: .01; pointer-events: none; }
.unlock-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 36px; min-width: 122px; padding: 0 14px; margin-top: 15px; border-radius: 6px; color: #fff; background: #66849f; border: 1px solid #58758e; box-shadow: 0 2px 4px #526d8530, inset 0 1px 0 #ffffff40; font-size: 12px; transition: background .18s, box-shadow .18s; }
.unlock-button:hover:not(:disabled) { background: #55768f; box-shadow: 0 3px 8px #526d8540, inset 0 1px 0 #ffffff40; }
.unlock-button svg { width: 14px; height: 14px; }
.unlock-button:disabled { opacity: .68; cursor: wait; }
.pin-message { min-height: 32px; max-width: 232px; margin: 10px 0 0; color: #526c84; text-align: center; font-size: 12px; line-height: 1.5; }
.has-error .pin-message { color: #9d4d6c; }
.has-error .pin-dials { border-color: #ab637e; }
body[data-diary-state="locked"] .app, body[data-diary-state="locked"] > .privacy-note, body[data-diary-state="locked"] > .sync-conflict-notice { visibility: hidden; opacity: 0; pointer-events: none; }
body:not([data-diary-state="open"]) { overflow: hidden; }
body[data-diary-state="preparing"] .book-wrap { opacity: .001; }
body[data-diary-state="preparing"] :is(.topbar, .book-caption, .privacy-note) { opacity: 0; }
body[data-diary-state="opening"] .lock-scene, body[data-diary-state="closing"] .lock-scene { pointer-events: none; }
body:is([data-diary-state="opening"], [data-diary-state="closing"]) .book-wrap { opacity: var(--spread-opacity); }
body:is([data-diary-state="opening"], [data-diary-state="closing"]) :is(.topbar, .book-caption, .privacy-note) { opacity: var(--chrome-opacity); }
.lock-brand { opacity: var(--cover-ui-opacity); }
body:not(.scene-ready):is([data-diary-state="opening"], [data-diary-state="closing"]) .cover-fallback { opacity: var(--scene-opacity); transform: translate(-50%, -50%) scale(calc(1 + var(--book-progress) * .06)); }
.app { max-width: 1280px; min-height: calc(100dvh - 58px); padding-bottom: 12px; display: flex; flex-direction: column; }
.topbar { flex-wrap: wrap; }
.top-actions { flex-wrap: wrap; }
.date-pill { font-size: 12px; }
.workspace { display: flex; flex: 1; align-items: center; justify-content: center; position: relative; }
.book-stage { width: min(1080px, 100%); margin: 0 auto; }
.book-wrap { padding: 10px 8px 12px; border-radius: 11px; background: repeating-linear-gradient(0deg, #ffffff0c 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, #526d850c 0 1px, transparent 1px 3px), var(--book-cloth); box-shadow: 0 2px 1px var(--book-binding), 0 16px 28px -10px #617a9733, 0 35px 65px -24px #5973903d; will-change: opacity; }
.book-wrap::before { top: auto; bottom: 12px; height: 10px; border-radius: 3px; background: repeating-linear-gradient(#fffaf0 0 1px, #c9c7be 1px 2px, #f8f3e8 2px 3px); }
.book-wrap::after { bottom: 4px; height: 5px; border-radius: 3px; background: var(--book-binding); }
body.scene-ready .book-wrap { background: transparent; box-shadow: none; opacity: var(--spread-opacity); }
body.scene-ready .book-wrap::before, body.scene-ready .book-wrap::after { display: none; }
body.scene-ready .book { box-shadow: none; }
body.scene-ready[data-diary-state="preparing"] .book-wrap { opacity: .001; }
.app, .privacy-note, .sync-conflict-notice { position: relative; z-index: 1; }
.book { height: clamp(640px, calc(100dvh - 220px), 680px); min-height: 640px; border-radius: 5px; box-shadow: 0 3px 0 #92a8ba; }
.book::after { content: ""; position: absolute; z-index: 6; width: 28px; top: 0; bottom: 0; left: calc(50% - 14px); background: linear-gradient(90deg, transparent, #807c6812 35%, #786c5c20 50%, #fffefa33 60%, transparent); pointer-events: none; }
.page-left h2 { font-size: 62px; }
.entry-title { font-size: 31px; }
.entry-foot { gap: 10px; }
.tool-label { flex-basis: 100%; }
.save-btn { white-space: nowrap; flex-shrink: 0; }
.save-btn { min-width: 94px; }
.paper-icon { display: inline-grid; place-items: center; padding: 0; width: 32px; height: 32px; flex: 0 0 32px; background: transparent; color: #71869c; border-radius: 5px; }
.paper-icon:hover { background: #e8eff680; }
.paper-icon[aria-pressed="true"] { color: #b99443; }
.paper-icon[aria-pressed="true"] svg { fill: #f1d88c; }
.entry-utilities { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.entry-attachments { display: flex; gap: 8px; padding-top: 12px; flex: 0 0 auto; }
.attachment { position: relative; width: 64px; height: 48px; flex: 0 0 64px; }
.attachment-image { width: 100%; height: 100%; padding: 0; border-radius: 3px; overflow: hidden; background: transparent; }
.attachment img { width: 100%; height: 100%; display: block; object-fit: cover; }
.attachment .paper-icon { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; background: #fffdf7; border: 1px solid #dde4ef; }
.attachment .paper-icon svg { width: 13px; height: 13px; }
.archive-tabs { display: flex; gap: 4px; margin: 12px 20px 0; border-bottom: 1px solid #e3e9f1; }
.archive-tabs button { flex: 1; min-height: 38px; padding: 5px; background: transparent; color: #8090a5; font-size: 13px; border-bottom: 2px solid transparent; }
.archive-tabs button[aria-selected="true"] { color: #5c7fb8; border-color: #7e9ed2; }
.draft-badge { color: #a17834; }
.day-cell.has-draft::before { content: ""; position: absolute; width: 5px; height: 5px; border: 1px solid #b99a5b; bottom: 4px; border-radius: 50%; }
.day-cell.is-favorite { box-shadow: inset 0 0 0 1px #d9bc79; }
.trash-item { display: flex; align-items: center; gap: 4px; padding: 8px 0; border-bottom: 1px solid #edf0f4; }
.trash-copy { flex: 1; min-width: 0; font-size: 13px; }
.trash-copy strong, .trash-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-copy small { margin-top: 4px; color: #8996aa; font-size: 11px; }
.settings-body { padding: 16px 20px 20px; display: grid; gap: 10px; font-size: 13px; }
.settings-body input:not([type="checkbox"]), .settings-body select { width: 100%; min-height: 40px; border: 1px solid #dbe3ee; border-radius: 6px; background: #fff; padding: 8px 10px; color: #40546c; }
.settings-body h3 { font: 17px var(--hand-font); margin: 12px 0 2px; }
.settings-body form, #backupConfirmRow { display: grid; gap: 10px; }
.settings-body p { min-height: 18px; margin: 0; color: #96705b; line-height: 1.5; }
.checkbox-label { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.settings-body button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 40px; }
.photo-dialog { width: min(900px, calc(100vw - 28px)); }
.photo-dialog > img { display: block; max-width: 100%; max-height: calc(100dvh - 120px); margin: auto; object-fit: contain; }
.close-fallback { position: fixed !important; margin: 0 !important; z-index: 2 !important; pointer-events: none; opacity: var(--fallback-paper-opacity, 1); }
.save-btn svg { width: 16px; height: 16px; }
.book-caption { flex-wrap: wrap; row-gap: 10px; }
.turn-progress { font-size: 12px; color: var(--blue-deep); font-variant-numeric: tabular-nums; }
.privacy-note { margin-top: 6px; }
.privacy-note button { display: grid; place-items: center; min-width: 36px; }
.privacy-note svg { width: 17px; height: 17px; }
.sidebar { position: fixed; z-index: 35; left: 0; top: 0; bottom: 0; width: 318px; max-width: calc(100vw - 28px); overflow-y: auto; padding: 20px; gap: 16px; display: block; background: #edf2f8; box-shadow: 12px 0 36px #42597725; }
.sidebar[hidden] { display: none; }
.index-backdrop { position: fixed; inset: 0; z-index: 34; background: #344a6438; }
.index-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.index-heading h2 { font: 20px var(--hand-font); margin: 0; }
.sidebar .panel { margin-bottom: 16px; }
.sidebar .panel:last-child { margin-bottom: 0; }
.recent-list { grid-template-columns: 1fr; }
.recent-item { text-align: left; }
.tools-dialog, .confirm-dialog, .conflict-dialog { max-height: calc(100dvh - 32px); overflow: auto; }
.backup-tools h3 { margin-bottom: 12px; }
.backup-tools button { display: inline-flex; align-items: center; gap: 5px; }
.backup-tools svg { width: 15px; height: 15px; }
@media (min-width: 761px) and (max-width: 1180px) {
  .page-left, .page-right { padding-left: 30px; padding-right: 30px; }
  .page-left h2 { font-size: 58px; }
  .tool-label { flex-basis: auto; }
}
@media (max-width: 760px) {
  .app { padding-bottom: 12px; }
  .topbar { row-gap: 12px; }
  .top-actions { gap: 7px; }
  .icon-button { width: 38px; height: 40px; }
  .today-btn { min-height: 40px; }
  .book { height: auto; min-height: 0; }
  .book::after { display: none; }
  .book-wrap::before { bottom: 7px; }
  .book-wrap::after { bottom: 3px; }
  .entry-title { font-size: 25px; }
  .tool-label { flex-basis: 100%; }
  .save-btn { justify-content: center; }
  .book-caption .caption-note { display: none; }
  .lock-brand { left: 20px; top: 20px; }
  .lock-brand .brand-mark { width: 36px; height: 36px; }
  .lock-brand h1 { font-size: 17px; }
  .lock-brand p { font-size: 11px; }
  .cover-fallback h1 { font-size: 34px; }
  .cover-fallback small { font-size: 10px; }
}
@media (max-width: 370px) {
  .lock-brand { left: 16px; top: 16px; gap: 8px; }
  .lock-brand h1 { font-size: 16px; }
  .lock-brand p { display: block; font-size: 10px; }
  .cover-fallback h1 { font-size: 31px; }
  body:not(.scene-ready) .pin-lock { width: 220px; }
  body:not(.scene-ready) .pin-message { max-width: 214px; }
}
@media (max-height: 420px) {
  .lock-brand { top: 14px; left: 20px; }
  .lock-brand .brand-mark { display: none; }
  .lock-brand p { display: none; }
  .cover-fallback span { font-size: 8px; }
  .cover-fallback h1 { font-size: 24px; }
  .cover-fallback small { font-size: 8px; }
  .pin-lock { --wheel-height: 42px; --digit-height: 24px; width: 210px; }
  .pin-dials { padding: 4px 10px; gap: 5px; }
  .pin-wheel-column { width: 31px; flex-basis: 31px; grid-template-rows: 12px var(--wheel-height) 12px; }
  .pin-digit { width: 31px; }
  .pin-wheel-track > span { font-size: 22px; }
  .lock-plate { margin-bottom: 7px; }
  .unlock-button { margin-top: 10px; }
  .pin-message { min-height: 18px; margin-top: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .pin-wheel-track { will-change: auto; }
}
