/* ---------- 手帐: the receipt printer page ---------- */
.journal-screen { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; background: linear-gradient(180deg, #2b49c9 0%, #16288a 100%); color: #10154d; }
.jr-top { flex: none; display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-top) + 8px) 14px 8px; color: #dfe6ff; }
.jr-top .w98-btn { min-width: 44px; min-height: 36px; display: grid; place-items: center; padding: 0 10px; font-size: 14px; }
.jr-title { flex: 1; text-align: center; font: 18px var(--f-pixel); letter-spacing: 1px; }
.jr-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 4px 0 calc(var(--safe-bottom, 0px) + 30px); }

/* the printer, and the receipt coming out of its slot */
/* The printer is drawn from the front-left, its slot tilted 11.5 degrees: it is turned back around the
   slot's middle (42.6% across, 43.2% down) so the slot runs level and the paper can come straight out of it. */
.jr-printer { position: relative; width: 420px; margin: 0 calc(50% - 210px); }
.jr-printer img { position: relative; z-index: 2; display: block; width: 100%; transform-origin: 42.6% 43.2%; transform: rotate(-11.5deg); filter: drop-shadow(0 8px 12px rgba(5, 10, 60, 0.45)); }
.jr-printer.is-printing { animation: jr-shake 0.08s linear infinite; }
@keyframes jr-shake { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(0.7px, -0.4px); } 75% { transform: translate(-0.7px, 0.4px); } }
.jr-led { position: absolute; z-index: 3; left: 83.3%; top: 46%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: #3dff7a; box-shadow: 0 0 8px #3dff7a; animation: jr-blink 1.1s steps(1) infinite; }
.jr-printer.is-printing .jr-led { animation-duration: 0.18s; }
/* the paper comes out of the slot (196px wide, 181px down, 31px left of centre), in front of the printer's lower half */
.jr-slot-out { position: relative; z-index: 3; width: 190px; margin: -239px 0 0 calc(50% - 126px); overflow: hidden; padding-bottom: 14px; min-height: 239px; }
.jr-slot-shade { position: absolute; z-index: 2; left: 0; right: 0; top: 0; height: 12px; background: linear-gradient(rgba(10, 15, 45, 0.5), transparent); pointer-events: none; }
.jr-print { transform: translateY(-100%); }
.jr-print.is-feeding { animation: jr-feed var(--feed) steps(var(--steps), end) both; }
@keyframes jr-feed { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@keyframes jr-print { 0% { transform: translateY(-100%); } 70% { transform: translateY(1.5%); } 100% { transform: translateY(0); } }
@keyframes jr-blink { 50% { opacity: 0.25; } }

/* receipt type: a dot-matrix pixel font for Chinese (Fusion Pixel, OFL; split so rare characters load only when used)
   and Courier Prime (OFL) for letters and numbers, like a thermal till slip */
@font-face { font-family: 'Typewriter'; src: url(/fonts/courier-prime-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Typewriter'; src: url(/fonts/courier-prime-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'ReceiptPx'; src: url(/fonts/fusion-pixel-common.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'ReceiptPx2'; src: url(/fonts/fusion-pixel-rest.woff2) format('woff2'); font-display: swap; }
.journal-screen, .jr-widget { --f-receipt: 'Typewriter', 'ReceiptPx', 'ReceiptPx2', monospace; }

/* thermal paper: faint banding, edges a touch darker, ink not quite even */
.jr-paper { padding: 14px 14px 12px; font: 12px/1.75 var(--f-receipt); color: #2b2b38; -webkit-font-smoothing: none; text-shadow: 0 0 0.4px rgba(43, 43, 56, 0.55);
  background-color: #fbf9f1;
  background-image: repeating-linear-gradient(0deg, rgba(70, 60, 30, 0.028) 0 1px, transparent 1px 3px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.045), transparent 9%, transparent 91%, rgba(0, 0, 0, 0.045)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.05), transparent 40px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28); }
.jr-paper.is-long { padding-top: 20px; }
.jr-tear { height: 8px; background: radial-gradient(circle at 8px 8px, transparent 7px, #fbf9f1 7.5px) 0 0 / 16px 8px repeat-x; filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.15)); }
.jr-head { text-align: center; font-size: 24px; line-height: 1.3; letter-spacing: 1px; }
.jr-sub { text-align: center; color: #6f6f80; }
.jr-rule { height: 0; border-top: 1px dashed #77778a; margin: 9px 0; }
.jr-label { color: #6f6f80; letter-spacing: 1px; }
.jr-money { display: flex; justify-content: space-between; width: 100%; padding: 0; border: 0; background: none; font: inherit; text-align: left; }
.jr-money i { font-style: normal; text-decoration: underline; }
.jr-empty { color: #9a9aa8; }
.jr-meal { display: flex; align-items: center; gap: 6px; min-height: 26px; }
.jr-slot { flex: none; width: 18px; height: 18px; border: 1px solid #2b2b38; display: grid; place-items: center; line-height: 1; }
.jr-what { flex: 1; min-width: 0; }
.jr-tag { font-style: normal; margin-left: 4px; padding: 0 2px; white-space: nowrap; border: 1px solid #2f7a48; color: #2f7a48; }
.jr-thumb { flex: none; width: 30px; height: 30px; padding: 0; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); background: #ddd; filter: grayscale(0.35) contrast(1.05); }
.jr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.jr-kcal { flex: none; min-width: 30px; text-align: right; }
.jr-total, .jr-line { display: flex; justify-content: space-between; gap: 10px; }
.jr-total { font-weight: 700; font-size: 13px; margin-top: 2px; }
.jr-todo { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 7px; width: 100%; min-height: 34px; position: relative; }
.jr-box { flex: none; width: 13px; height: 13px; border: 1px solid #2b2b38; display: grid; place-items: center; line-height: 1; }
.jr-todo-text { flex: 1; }
.jr-ask { color: #9a9aa8; }
.jr-stamp { color: #d42a44; border: 1.5px solid #d42a44; padding: 0 5px; border-radius: 3px; mix-blend-mode: multiply; transform: rotate(-12deg); animation: jr-stamp 0.45s cubic-bezier(0.3, 1.4, 0.5, 1) both; }
@keyframes jr-stamp { 0% { transform: scale(2.4) rotate(-18deg); opacity: 0; } 60% { transform: scale(0.9) rotate(-12deg); opacity: 1; } 100% { transform: scale(1) rotate(-12deg); } }
.jr-note { color: #3a3a58; }
.jr-note b { color: #d42a44; font-weight: normal; }
.jr-barcode { text-align: center; font-size: 16px; letter-spacing: 3px; margin-top: 6px; }

/* the month's stamp card: GPT's pink card with gold foil, real ink stamps */
.jr-card { width: min(340px, calc(100% - 32px)); aspect-ratio: 680 / 820; margin: 18px auto 0; padding: 11% 10% 7%; box-sizing: border-box;
  background: url(/img/y2k/jr-card.webp) center / 100% 100% no-repeat; filter: drop-shadow(0 10px 18px rgba(5, 10, 60, 0.4)); color: #8a5a3c; display: flex; flex-direction: column; }
.jr-card-head { display: flex; align-items: center; justify-content: space-between; }
.jr-card-title { text-align: center; display: flex; flex-direction: column; font-family: var(--f-receipt); }
.jr-card-title b { font-size: 24px; line-height: 1.2; font-weight: normal; color: #a0476a; }
.jr-card-title span { font-size: 12px; color: #b98a6e; }
.jr-arrow { width: 40px; height: 44px; border: 0; background: none; color: #b98a6e; display: grid; place-items: center; }
.jr-arrow.is-next svg { transform: scaleX(-1); }
.jr-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px 5px; margin-top: 10px; }
.jr-wd { text-align: center; font: 12px var(--f-receipt); color: #b98a6e; }
.jr-cell { position: relative; aspect-ratio: 1; border-radius: 50%; border: 1px dashed rgba(185, 138, 110, 0.7); background: rgba(255, 255, 255, 0.45); padding: 0; display: grid; place-items: center; color: #b98a6e; }
.jr-cell:disabled { opacity: 0.45; }
.jr-num { font: 12px var(--f-receipt); }
.jr-ink { position: absolute; inset: -24%; width: 148%; height: 148%; mix-blend-mode: multiply; transform: rotate(var(--r)); animation: jr-ink 0.42s cubic-bezier(0.3, 1.5, 0.5, 1) both; pointer-events: none; }
.jr-cell.is-half .jr-ink { opacity: 0.9; }
.jr-cell.is-today { border: 1.5px solid #a0476a; }
.jr-cell.is-picked { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #e8b84a; }
@keyframes jr-ink { 0% { transform: scale(1.7) rotate(calc(var(--r) - 20deg)); opacity: 0; } 100% { transform: scale(1) rotate(var(--r)); opacity: 1; } }
.jr-mark { position: absolute; z-index: 2; right: -9px; bottom: -8px; width: 24px; height: 24px; mix-blend-mode: multiply; transform: rotate(14deg); }
.jr-mark.m-breakfast { left: -9px; right: auto; transform: rotate(-14deg); }
.jr-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 10px; margin-top: auto; padding-top: 8px; font: 12px var(--f-receipt); color: #b98a6e; }
.jr-legend span { display: flex; align-items: center; gap: 3px; }
.jr-legend img { width: 20px; height: 20px; mix-blend-mode: multiply; }

/* the desk: receipts pierced on the spike (a pile, tap to spread them out); the month drawer */
.jr-desk { display: flex; justify-content: center; align-items: flex-end; gap: 22px; margin: 30px auto 0; padding: 0 16px; }
.jr-spike { position: relative; width: 150px; border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; color: inherit; }
.jr-spike-img { width: 110px; display: block; filter: drop-shadow(0 6px 8px rgba(5, 10, 60, 0.4)); }
.jr-stubs { position: absolute; left: 0; right: 0; top: 0; height: 130px; }
/* each slip's hole (43% down it) sits on the rod, turned a little around it */
.jr-stubs .jr-stub { position: absolute; left: 50%; top: 22px; margin-left: -36px; transform-origin: 50% 43%; transform: rotate(var(--r)); }
.jr-stub { width: 72px; height: 116px; padding: 6px 4px 0; box-sizing: border-box; border: 0; display: flex; flex-direction: column; align-items: center;
  background: url(/img/y2k/jr-stub.webp) center / 100% 100% no-repeat; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
  font: 11px/1.3 var(--f-receipt); color: #2b2b38; position: relative; }
.jr-stub b { font-weight: 700; font-size: 12px; }
.jr-stub span { color: #6f6f80; white-space: nowrap; }
.jr-stub .jr-stub-gap { height: 16px; flex: none; }
.jr-mini-stamp { position: absolute; left: 50%; bottom: 3px; width: 28px; height: 28px; margin-left: -14px; mix-blend-mode: multiply; transform: rotate(-12deg); opacity: 0.85; }
.jr-desk-label { margin-top: 6px; font: 12px var(--f-receipt); color: #c9d0ff; }
.jr-drawer { border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; }
.jr-drawer img { width: 120px; display: block; filter: drop-shadow(0 6px 8px rgba(5, 10, 60, 0.4)); transition: transform 0.3s cubic-bezier(0.3, 1.5, 0.5, 1); }
.jr-drawer:active img, .jr-spike:active .jr-spike-img { transform: scale(0.94); }

/* the pile spread out over the page */
.jr-fan-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(8, 12, 50, 0.72); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; animation: fade-in 0.2s; }
.jr-fan { display: grid; grid-template-columns: repeat(3, 96px); gap: 18px 14px; }
.jr-fan .jr-stub { width: 96px; height: 155px; padding-top: 10px; font-size: 12px; cursor: pointer; transform: rotate(var(--r));
  animation: jr-fly 0.5s cubic-bezier(0.3, 1.3, 0.5, 1) both; animation-delay: calc(var(--i) * 0.06s); }
.jr-fan .jr-stub b { font-size: 15px; }
.jr-fan .jr-stub .jr-stub-gap { height: 30px; }
.jr-fan .jr-mini-stamp { width: 38px; height: 38px; margin-left: -19px; }
.jr-fan .jr-stub:active { transform: rotate(var(--r)) scale(0.95); }
@keyframes jr-fly { 0% { transform: translateY(60vh) rotate(calc(var(--r) * 6)) scale(0.6); opacity: 0; } 100% { transform: rotate(var(--r)); opacity: 1; } }
.jr-fan-hint { font: 12px var(--f-receipt); color: #c9d0ff; }

/* the 月结账单 overlay */
.jr-bill-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(8, 12, 50, 0.7); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: calc(var(--safe-top) + 40px) 0 40px; animation: fade-in 0.2s; }
.jr-bill { width: 280px; animation: jr-print 1.3s cubic-bezier(0.3, 0.9, 0.4, 1) both; }

/* ---------- home: swipe between the desk and the widgets page ---------- */
.home-pager { position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.home-pager::-webkit-scrollbar { display: none; }
.home-page { flex: 0 0 100%; position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; }
.home-widgets { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: calc(var(--safe-top) + 24px) 16px 90px; box-sizing: border-box; overflow-y: auto; }
.home-dots { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-bottom, 0px) + 58px); display: flex; justify-content: center; gap: 7px; pointer-events: none; z-index: 5; }
.home-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.45); transition: background 0.2s, transform 0.2s; }
.home-dots i.on { background: #fff; transform: scale(1.25); }

.jr-widget { all: unset; box-sizing: border-box; cursor: pointer; width: min(330px, 100%); display: flex; flex-direction: column; align-items: center; }
.jr-widget:active { transform: scale(0.98); }
.jr-w-printer { width: 320px; position: relative; }
.jr-w-printer img { position: relative; z-index: 2; width: 100%; display: block; transform-origin: 42.6% 43.2%; transform: rotate(-11.5deg); filter: drop-shadow(0 6px 10px rgba(5, 10, 60, 0.45)); }
.jr-w-slot { position: relative; z-index: 3; left: -24px; width: 146px; margin-top: -182px; overflow: hidden; padding-bottom: 8px; }
.jr-w-paper { width: 100%; padding: 10px 10px 12px; box-sizing: border-box; background: #fbf9f1; color: #2b2b38; font: 12px/1.6 var(--f-receipt); -webkit-font-smoothing: none; line-height: 1.5;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  -webkit-mask: linear-gradient(#000 calc(100% - 10px), transparent calc(100% - 10px)), radial-gradient(circle at 7px 0, transparent 6px, #000 6.5px) bottom / 14px 10px repeat-x;
  mask: linear-gradient(#000 calc(100% - 10px), transparent calc(100% - 10px)), radial-gradient(circle at 7px 0, transparent 6px, #000 6.5px) bottom / 14px 10px repeat-x; padding-bottom: 20px; }
.jr-w-date { font-weight: 700; text-align: center; margin-bottom: 4px; }
.jr-w-line { display: flex; justify-content: space-between; gap: 8px; }
.jr-w-line span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-w-line.is-dim { color: #8a8db0; }
.jr-w-line.is-todo { border-top: 1.5px dashed #9aa0c8; margin-top: 4px; padding-top: 4px; color: #3a428a; }
.jr-w-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 8px; }
.jr-w-dots i { width: 8px; height: 8px; border-radius: 50%; border: 1px dashed #e6a9bf; box-sizing: border-box; }
.jr-w-dots i.is-full { background: #e8344e; border: 0; }
.jr-w-dots i.is-half { background: rgba(232, 52, 78, 0.45); border: 0; }
.jr-w-dots i.is-today { outline: 1.5px solid #b0306a; outline-offset: 1px; }

@media (prefers-reduced-motion: reduce) {
  .jr-print, .jr-bill, .jr-stub, .jr-ink, .jr-stamp, .jr-printer { animation: none !important; transform: none; }
}

/* the 小食谱 widget: a slowly turning wheel */
.food-widget { all: unset; box-sizing: border-box; cursor: pointer; width: min(330px, 100%); display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 18px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.55), rgba(190, 205, 255, 0.35)); border: 1.5px solid rgba(255, 255, 255, 0.7); box-shadow: 0 8px 20px rgba(5, 10, 60, 0.3), inset 0 1px 0 #fff; }
.food-widget:active { transform: scale(0.97); }
.food-wheel { position: relative; flex: none; width: 64px; height: 64px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 3px 8px rgba(5, 10, 60, 0.35);
  background: conic-gradient(#ffb3c9 0 60deg, #ffd36b 0 120deg, #9fe3ff 0 180deg, #c8f7c5 0 240deg, #d9b8e6 0 300deg, #ffc89a 0 360deg); animation: food-spin 9s linear infinite; }
.food-wheel i { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px #2b49c9; }
@keyframes food-spin { to { transform: rotate(360deg); } }
.food-text { display: flex; flex-direction: column; color: #10154d; }
.food-text b { font: 18px var(--f-pixel); font-weight: normal; }
.food-text span { font-size: 13px; color: #3a428a; }
@media (prefers-reduced-motion: reduce) { .food-wheel { animation: none; } }

/* the slip itself: the cropped paper texture, a torn top and bottom, and the hole the spike went through */
.jr-stub { clip-path: polygon(0 2%, 12% 0, 30% 1.5%, 52% 0, 70% 1.8%, 88% 0, 100% 1.5%, 100% 98%, 85% 100%, 64% 98.5%, 45% 100%, 24% 98.2%, 8% 100%, 0 98.5%); }
.jr-stub::before { content: ''; position: absolute; left: 50%; top: 43%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%;
  background: radial-gradient(circle, #2a2f5a 0 45%, rgba(0, 0, 0, 0.25) 60%, transparent 70%); }
.jr-fan .jr-stub::before { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; }
