/* V4.23 拾光記憶球：3:2 典雅日式信箋卡片 + 右下角圓形新增按鈕。 */
.memories-view,.memory-overlay{--m-ink:#284b39;--m-border:#c6dacc;--m-shadow:0 10px 25px rgba(20,55,39,.14);font-family:'Noto Serif TC','Noto Serif CJK TC',serif}
.memories-view [hidden],.memory-overlay[hidden],.memory-overlay [hidden]{display:none!important}
.memories-view button,.memory-overlay button{cursor:pointer;font-family:inherit}
.memories-view button:focus-visible,.memory-overlay button:focus-visible,.memory-overlay input:focus-visible,.memory-overlay textarea:focus-visible{outline:3px solid #fcf6c9;outline-offset:3px}
.memory-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:0 0 18px}
.memory-overline{color:#e0ede1;letter-spacing:.22em;font-weight:600;font-size:11px;line-height:1.7}
.memory-action-primary{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:11px 17px;border:1px solid #cdded1;border-radius:999px;background:#e9f2ea;color:#345c45;font-size:13px;font-weight:700;white-space:nowrap}
.memory-action-primary .ico{width:16px;height:16px}
.memory-day-filters{display:flex;gap:8px;overflow-x:auto;padding:3px 1px 13px;margin:0 0 8px;scrollbar-width:none;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
.memory-day-filters::-webkit-scrollbar{display:none}
.memory-filter{border:1px solid rgba(226,241,229,.51);background:rgba(231,242,231,.08);color:#ebf3eb;white-space:nowrap;border-radius:999px;padding:8px 14px;font-size:12px;line-height:1.4;flex:0 0 auto}
.memory-filter.active{border-color:#e9f1e9;background:#e6efe7;color:#2e5640;font-weight:700}
.memory-stat{display:flex;align-items:center;justify-content:space-between;gap:8px;color:#dfeade;font-size:11px;margin-bottom:13px}.memory-stat strong{font-weight:600}
.memory-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;align-items:start}
.memory-card{position:relative;min-width:0;aspect-ratio:3/2;display:flex;justify-content:center;align-items:center;isolation:isolate;padding:15px 18px;overflow:hidden;text-align:left;border:1px solid #bdcfc0;border-radius:18px;color:#294a39;box-shadow:0 8px 22px rgba(22,54,38,.13),inset 0 0 0 1px rgba(255,255,255,.57);background:linear-gradient(145deg,rgba(255,255,255,.51),rgba(255,255,255,0) 66%),var(--memory-card-bg,#e8f0e8);transition:transform .16s ease}


/* A quiet Japanese stationery motif, never a full-surface pattern:
   a double fine frame and a few short warm-brass corner strokes. */
.memories-view{padding-bottom:90px}
.memory-card[data-tone="0"]{--memory-card-bg:#e8eee7}
.memory-card[data-tone="1"]{--memory-card-bg:#e8eee8}
.memory-card[data-tone="2"]{--memory-card-bg:#eeefe7}
.memory-card::before{content:"";position:absolute;inset:6px;z-index:0;pointer-events:none;border:1px solid rgba(94,127,100,.25);border-radius:13px}
.memory-card::after{content:"";position:absolute;inset:0;z-index:0;pointer-events:none;opacity:.60;
  background:linear-gradient(#adac8b,#adac8b) left 14px top 14px/19px 1px no-repeat,
             linear-gradient(#adac8b,#adac8b) left 14px top 14px/1px 10px no-repeat,
             linear-gradient(#adac8b,#adac8b) right 14px bottom 14px/21px 1px no-repeat}
.memory-card:hover{box-shadow:0 13px 27px rgba(22,54,38,.18),inset 0 0 0 1px rgba(255,255,255,.6)}
/* Floating orb only on the memory page; a real 60px touch target. */
.memory-fab{position:fixed;z-index:55;right:max(28px,env(safe-area-inset-right));bottom:calc(28px + env(safe-area-inset-bottom));
  width:66px;height:66px;min-width:66px;min-height:66px;padding:0;
  display:flex;align-items:center;justify-content:center;border-radius:50%;
  color:#2b513b;border:1px solid rgba(247,255,246,.93);
  background:radial-gradient(circle at 27% 22%,#f9fdf6 0%,#e8f1e7 53%,#cbdcca 100%);
  box-shadow:0 11px 25px rgba(22,54,38,.30),inset 0 0 0 4px rgba(255,255,255,.33);
  transition:transform .16s ease,box-shadow .16s ease;touch-action:manipulation}
.memory-fab .ico{width:26px;height:26px;stroke-width:2.1;flex:none}
.memory-fab:hover{transform:translateY(-2px) scale(1.045);box-shadow:0 15px 30px rgba(22,54,38,.32),inset 0 0 0 4px rgba(255,255,255,.4)}
.memory-fab:active{transform:scale(.96)}
@media(max-width:900px){.memory-fab{bottom:calc(94px + env(safe-area-inset-bottom));right:max(19px,env(safe-area-inset-right));width:62px;height:62px;min-width:62px;min-height:62px}}
@media(max-width:760px){.memory-card::before{inset:5px;border-radius:10px}.memory-card::after{background-size:13px 1px,1px 8px,15px 1px;background-position:left 12px top 12px,left 12px top 12px,right 12px bottom 12px}}
@media(max-width:350px){.memory-fab{width:56px;height:56px;min-width:56px;min-height:56px;right:13px}.memory-card::before{inset:4px;border-radius:9px}}
@media(prefers-reduced-motion:reduce){.memory-fab{transition:none}}

.memory-card:hover{transform:translateY(-2px)}
.memory-text-preview{position:relative;z-index:1;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4;line-clamp:4;overflow:hidden;overflow-wrap:anywhere;white-space:pre-wrap;font-weight:700;font-size:clamp(14px,1.4vw,19px);line-height:1.65;letter-spacing:.02em;max-height:100%;text-shadow:none}
.memory-card.short .memory-text-preview{font-size:clamp(16px,1.8vw,23px)}.memory-card.long .memory-text-preview{font-size:clamp(12px,1.2vw,16px)}
.memory-empty{grid-column:1/-1;min-height:230px;border-radius:19px;border:1px dashed #bed6c3;background:#e8f1e51a;color:#f3f7f0;display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;padding:30px}.memory-empty-orb{font-size:39px;color:#e5f1e6;margin-bottom:5px}.memory-empty strong{font-size:18px}.memory-empty p{font-size:12px;margin:9px 0 20px;color:#e0eade}.memory-empty button{padding:10px 16px;border:1px solid #d9ebdd;border-radius:99px;background:#e5f0e6;color:#305840;font-weight:700}
.memory-overlay{position:fixed;inset:0;background:rgba(15,40,26,.62);backdrop-filter:blur(3px);display:flex;align-items:center;justify-content:center;padding:20px;z-index:115;color:var(--m-ink)}
.memory-sheet{width:min(100%,570px);max-height:calc(100dvh - 40px);overflow-y:auto;overscroll-behavior:contain;background:#edf4ed;border:1px solid #d3e1d6;border-radius:24px;box-shadow:0 23px 90px #071b0c65}
.memory-viewer-sheet{width:min(100%,630px)}.memory-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:22px 25px 8px}.memory-sheet-head span{display:block;font-size:10px;letter-spacing:.21em;color:#829a88;margin:0 0 4px}.memory-sheet-head h2{margin:0;color:#2a4f39;font:700 24px/1.5 'Noto Serif TC',serif}
.memory-close{display:grid;place-items:center;width:36px;height:36px;min-width:36px;background:#fafdfa;border-radius:50%;border:1px solid #c5d7c9;color:#42694e;font-size:25px;line-height:1}
.memory-form{padding:16px 25px 26px}.memory-field{font-size:13px;color:#3c6248;font-weight:700;display:block;margin:0 0 18px}.memory-field small{font-size:11px;font-weight:400;margin-left:7px;color:#799282}
.memory-field textarea,.memory-field input{display:block;width:100%;font-family:inherit;font-size:16px;line-height:1.7;box-sizing:border-box;margin-top:8px;border:1px solid #c3d7c6;border-radius:12px;background:#fffefb;color:#294c38;padding:12px 14px}
.memory-field textarea{resize:vertical;min-height:150px}
.memory-form-footer{display:flex;align-items:center;justify-content:flex-end;gap:9px;padding-top:18px;border-top:1px solid #cedecc}.memory-form-footer [role="status"]{font-size:11px;color:#6a8971;margin-right:auto;line-height:1.45;min-width:0}
.memory-secondary,.memory-primary{border-radius:999px;padding:11px 17px;font-size:12px;font-weight:700;white-space:nowrap}.memory-secondary{border:1px solid #bfd2c4;background:#f6faf5;color:#486f52}.memory-primary{border:1px solid #436f51;background:#436f51;color:#fff}.memory-primary:disabled,.memory-secondary:disabled{opacity:.5;cursor:wait}
.memory-viewer-body{padding:14px 25px 25px}.memory-full-text{white-space:pre-wrap;overflow-wrap:anywhere;color:#2c513c;line-height:2;letter-spacing:.02em;margin:18px 0 24px;background:#e0ebdf;padding:25px;border-radius:15px;font-size:17px}
.memory-foot{display:flex;justify-content:space-between;align-items:flex-end;gap:15px;border-top:1px solid #cbdcce;padding-top:15px}.memory-author{font-weight:700;font-size:15px;color:#345d46}.memory-created{font-size:11px;color:#708c79;margin-top:5px}.memory-viewer-actions{display:flex;gap:7px}.memory-viewer-actions button{border-radius:99px;border:1px solid #ccdfce;background:#fff;color:#456b52;padding:8px 12px;font-size:11px}.memory-viewer-actions .memory-danger{color:#a35955;border-color:#e3c8c7}
@media(max-width:1130px){.memory-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:760px){.memory-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}.memory-card{border-radius:15px;padding:10px 11px}.memory-text-preview{font-size:13px;line-height:1.5;-webkit-line-clamp:4;line-clamp:4}.memory-card.short .memory-text-preview{font-size:16px}.memory-card.long .memory-text-preview{font-size:11.5px}}
@media(max-width:560px){.memory-toolbar{gap:8px;margin-bottom:14px}.memory-overline{font-size:9px;letter-spacing:.16em}.memory-action-primary{padding:9px 12px;font-size:11px}.memory-filter{font-size:11px;padding:7px 11px}.memory-stat{font-size:10px}.memory-overlay{padding:0;align-items:flex-end}.memory-sheet{width:100%;max-height:93dvh;border-radius:24px 24px 0 0;border-bottom:0}.memory-sheet-head{padding:19px 18px 6px}.memory-form{padding:14px 18px calc(25px + env(safe-area-inset-bottom))}.memory-viewer-body{padding:14px 18px calc(25px + env(safe-area-inset-bottom))}.memory-full-text{font-size:15px;padding:19px}}
@media(max-width:350px){.memory-card{padding:8px;border-radius:12px}.memory-text-preview{font-size:12px}.memory-card.short .memory-text-preview{font-size:14px}.memory-card.long .memory-text-preview{font-size:11px}.memory-overline{max-width:135px}.memory-grid{gap:8px}.memory-form-footer{flex-wrap:wrap}.memory-form-footer [role="status"]{flex:1 0 100%}}
@media(prefers-reduced-motion:reduce){.memory-card{transition:none}}
