/* ==== ui03：朝の便り・夜の1つ・売り上げ帳 ==== */
.day-scene .shop-ui > * { pointer-events: auto; }
.envelope { position: absolute; padding: 0; border: 0; background: none; display: flex; flex-direction: column; align-items: center; }
.envelope img { height: auto; }
.envelope span { border-radius: 16px; background: var(--grain), #fffaf0; font-weight: 700; color: var(--teal2); box-shadow: 0 2px 0 #dcc59c; }
@media (prefers-reduced-motion: no-preference) { .envelope img { animation: env-bob 2.4s ease-in-out infinite; } @keyframes env-bob { 50% { transform: translateY(-6px) rotate(-1.5deg); } } }
.letter-veil, .book-veil { position: absolute; inset: 0; background: rgba(40,30,20,.32); pointer-events: none !important; }
.letter { position: absolute; left: 230px; top: 60px; width: 720px; height: 496px; }
.letter-paper { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 16px 22px rgba(40,25,10,.4)); }
.letter-seal { position: absolute; left: 50%; top: -18px; width: 64px; margin-left: -32px; }
.letter-body { position: absolute; left: 86px; right: 86px; top: 74px; bottom: 84px; color: #3b2f2a; overflow: hidden; }
.letter-date { font-size: 16px; color: #8b7864; }
.letter-body p { margin: 0; font-size: 20px; line-height: 35px; /* 便せんの罫線（35px おき）に字をのせる */ word-break: keep-all; overflow-wrap: break-word; line-break: strict; }
.letter-ok { position: absolute; height: 56px; padding: 0 28px; border: 0; border-radius: 16px; font-size: 20px; font-weight: 700; color: #fff; background: var(--teal); box-shadow: 0 4px 0 var(--teal2); display: flex; align-items: center; justify-content: center; }
.letter-ok:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--teal2); }
.night-veil { position: absolute; inset: 0; pointer-events: none !important; background: linear-gradient(rgba(24,30,58,.55), rgba(24,26,44,.35)); }
.night-card { position: absolute; left: 240px; top: 150px; width: 700px; padding: 26px 28px 22px; border-radius: 20px; display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: var(--grain), linear-gradient(#fffcf5, #f6ead0); box-shadow: inset 0 0 0 1px rgba(160,120,70,.2), 0 4px 0 #d9c39a, 0 22px 30px -10px rgba(10,10,30,.6); }
.night-title { font-size: 26px; font-weight: 800; color: var(--teal2); }
.prep-row { display: flex; gap: 16px; }
.prep { width: 190px; height: 210px; padding: 10px; border: 0; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: #fffaf0; box-shadow: inset 0 0 0 2px #e4d3b0, 0 4px 0 #d9c39a; font-size: 19px; font-weight: 700; color: #3b2f2a; }
.prep img { width: 140px; height: 140px; object-fit: contain; pointer-events: none; }
.prep.on { box-shadow: inset 0 0 0 3px var(--teal), 0 4px 0 var(--teal2); background: #eef6f2; }
.prep:active { transform: translateY(3px); }
.night-skip { height: 50px; padding: 0 24px; border: 0; border-radius: 14px; background: none; color: #7a6656; font-size: 17px; font-weight: 700; box-shadow: inset 0 0 0 2px #e0cfae; display: flex; align-items: center; justify-content: center; }
/* 売り上げ帳：お店の台に開いた布張りの本 */
.ledger2 { position: absolute; left: 110px; top: 70px; width: 960px; height: 640px; padding: 26px 30px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; border-radius: 18px;
  background: linear-gradient(90deg, transparent calc(50% - 3px), rgba(90,60,30,.25) 50%, transparent calc(50% + 3px)), var(--grain), linear-gradient(#fffcf4, #f6ebd3);
  box-shadow: 0 0 0 10px #4f7b6e, 0 0 0 12px #3e665a, 0 22px 34px -8px rgba(30,20,10,.55); }
.ledger2::before { content: ""; position: absolute; inset: 14px; border-radius: 10px; pointer-events: none;
  background: repeating-linear-gradient(transparent 0 47px, rgba(170,140,100,.22) 47px 48px); }
.ledger2 .ribbon { position: absolute; left: 48px; top: -12px; width: 22px; height: 120px; background: #c96f7b; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 86%, 0 100%); }
.lpage { position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ltitle { font-size: 30px; font-weight: 800; color: var(--teal2); white-space: nowrap; letter-spacing: .08em; text-align: center; }
.ledger2 table { width: 100%; border-collapse: collapse; }
.ledger2 th { color: var(--sub); font-weight: 400; text-align: left; white-space: nowrap; padding: 4px 6px; border-bottom: 1.5px solid var(--line); }
.ledger2 td { padding: 8px 6px; border-bottom: 1.5px dashed var(--line); vertical-align: middle; }
.ledger2 .r { text-align: right; white-space: nowrap; }
.ledger2 td.d { white-space: nowrap; font-weight: 700; }
.ledger2 .items { display: block; line-height: 1.35; word-break: keep-all; overflow-wrap: break-word; }
.ledger2 tr.today td { background: linear-gradient(transparent 55%, rgba(232,193,105,.38) 55%); }
.ledger2 .empty { color: var(--sub); text-align: center; }
.ledger2 .jar { display: inline-flex; align-items: center; gap: 8px; color: var(--teal2); font-size: 18px; white-space: nowrap; }
.ledger2 .jar svg { width: 30px; height: 36px; flex: none; }
.ledger2 .money { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 20px; color: var(--sub); padding: 12px 4px; border-bottom: 1.5px dashed var(--line); }
.ledger2 .money b { font-size: 30px; color: var(--teal2); font-variant-numeric: tabular-nums; }
.ledger2 .money .jar svg { width: 40px; height: 48px; }
.ledger2 .grad-shelf { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 8px 6px; border-bottom: 8px solid #b98a5a; border-radius: 4px; }
.ledger2 .grad-shelf img { width: 92px; height: auto; }
.ledger2 .to-home { margin-top: auto; align-self: center; }
.ledger2 .page-nav { display: flex; gap: 10px; align-items: center; justify-content: center; font-size: 15px; color: var(--sub); margin-top: auto; }
.ledger2 .page-nav button { min-width: 52px; min-height: 48px; border: 0; border-radius: 12px; background: #fff8e8; color: var(--teal2); font-size: 18px; font-weight: 700; box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 var(--line); }
.ledger2 .page-nav button:disabled { opacity: .4; }
.compact .ledger2 .page-nav button { min-width: 60px; min-height: 56px; } /* final4：iPhone では帳が縮むので、縮んでも44px以上（.ledger と同じ） */
.compact .letter { left: 150px; top: 10px; width: 600px; height: 413px; }
.compact .letter-body { left: 70px; right: 70px; top: 50px; bottom: 80px; }

.compact .night-card { left: 100px; top: 20px; transform: scale(.9); transform-origin: 0 0; }
.compact .ledger2 { left: 30px; top: 16px; width: 840px; height: 438px; padding: 16px 22px; }
.compact .ledger2 table { font-size: 15px; }
.compact .ledger2 td { padding: 3px 4px; }
.compact .ledger2 tr:nth-child(n+5) { display: none; }
/* ==== ui04 ==== */
/* 封筒は扉の足もと（「とびらの下に手紙」の言葉どおり） */
.envelope { left: 790px; top: 392px; }

.compact .envelope { left: 560px; top: 210px; }
/* 便せん：日付の下の空きに、きのうの仕込み → 売れた品と買った人。ボタンは罫線から外して便せんの下 */
.letter-date { height: 23px; line-height: 23px; }
.letter-shelf { height: 80px; margin: 6px 0 0; display: flex; align-items: flex-end; }
.letter-shelf img { height: 64px; width: auto; filter: drop-shadow(0 3px 2px rgba(60,35,15,.25)); }
.letter-shelf .prep-was { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.letter-shelf .prep-was i { font-style: normal; font-size: 13px; color: #8b7864; }
.letter-shelf .arrow { align-self: center; color: #c2a57a; }
.letter-shelf .sold { display: flex; align-items: flex-end; gap: 2px; }

.letter-body > .letter-date + p { margin-top: 86px; }
.letter-body > .letter-shelf + p { margin-top: 0; }
.letter-ok { bottom: -74px; right: 40px; }
.compact .letter-ok { bottom: 16px; right: -140px; }
/* 夜：夜景を背に（灰色の幕にしない）。絵は letter.js が style で直に置く（var の url は CSS の場所から読まれて 404 になる） */
.letter-shelf .prep-was img { height: 56px; }
/* 背の低い画面：便せんは 0.833 倍なので、行の高さと上の空きも同じ割合で罫線にのせる */
.compact .letter-body p { font-size: 16px; line-height: 29.2px; }
.compact .letter-shelf { height: 75px; }
.compact .letter-shelf img { height: 52px; }

.compact .letter-shelf .prep-was img { height: 46px; }
.compact .letter-body > .letter-date + p { margin-top: 81px; }
.ledger2 table { font-size: 20px; } .ledger2 .items { font-size: 18px; } .ledger2 th { font-size: 15px; }
.compact .night-skip { height: 60px; } /* 0.9倍の紙と画面の縮みを合わせても44pt以上 */
/* ui07 便りの絵の列：「きのうの仕込み」は1行、3人分の品まで便せんの中に入る大きさ（iPad 548px・iPhone 460px の中） */
.letter-shelf { gap: 10px; }
.letter-shelf .prep-was i { white-space: nowrap; }
.letter-shelf .arrow { font-size: 22px; }
.letter-shelf .sold img { height: 56px; }
.letter-shelf .sold .who { height: 72px; }
.compact .letter-shelf { gap: 8px; }
.compact .letter-shelf .prep-was i { font-size: 12px; }
.compact .letter-shelf .sold img { height: 44px; }
.compact .letter-shelf .sold .who { height: 60px; }
/* 手紙箱の手紙（ui08）：便りの棚の場所は使わない */
.mail-read { z-index: 31; }
.mail-read .letter-date { height: auto; font-size: 18px; font-weight: 700; color: #6b5640; }
.mail-box[hidden] { display: none; }
/* 手紙箱の手紙（ui09）：日付を罫線のすぐ上へ（本文との間を空けすぎない）。もどるボタンは便せんの下のまん中 */
.mail-read .letter-date { padding-top: 66px; margin-bottom: 14px; }
.mail-read .letter-body > .letter-date + p { margin-top: 20px; }
.compact .mail-read .letter-date { padding-top: 67px; }
.compact .mail-read .letter-body > .letter-date + p { margin-top: 20px; }
.mail-read .letter-ok { left: 50%; right: auto; bottom: -72px; transform: translateX(-50%); }
.mail-read .letter-ok:active { transform: translate(-50%, 3px); }
.compact .mail-read .letter-ok { left: 50%; right: auto; bottom: 14px; }
/* 手紙箱の一覧：まだ読んでいない手紙は右に封の印（左よせの行の右の空きに） */
.mail-item .mail-unread { margin-left: auto; display: flex; align-items: center; gap: 6px; font-style: normal; font-size: 15px; font-weight: 800; color: #a5482f; white-space: nowrap; }
.mail-item .mail-unread svg { width: 30px; height: 30px; }
.compact .mail-item .mail-unread { font-size: 13px; }
/* ui10：封筒は扉の足もとの床に寝かせて小さく（letter.js が扉の実位置から置く。押す所は 150×70 で44pt以上） */
.envelope, .compact .envelope { width: 150px; height: auto; min-height: 70px; justify-content: flex-start; gap: 2px; }
.envelope img, .compact .envelope img { width: 64px; transform: scaleY(.6); transform-origin: 50% 50%; margin: -8px 0; filter: drop-shadow(0 3px 2px rgba(40,25,10,.35)); animation: none; }
.envelope span { font-size: 15px; padding: 4px 12px; white-space: nowrap; }
.compact .envelope img { width: 34px; margin: -5px 0; } /* 背の低い画面は絵が0.57倍なので、封筒も扉の幅より小さく */
.compact .envelope span { font-size: 14px; }
/* 点検16：便りの上の列は「今日の仕込み → 来そうなお客さん（見こみ）」。見こみは点線のわくで、確定した結果（下の文）と分ける */
.letter-shelf .forecast { position: relative; display: flex; flex-direction: column; align-items: flex-start; padding: 10px 8px 2px; border: 2px dashed #c9ab7c; border-radius: 12px; }
/* わくの名前は、わくの上の線にのせる（線が字を通らないよう、便せんの色で下地） */
.letter-shelf .forecast > i { position: absolute; left: 10px; top: -10px; padding: 0 5px; background: #f5eee0; font-style: normal; font-size: 13px; color: #8b7864; white-space: nowrap; line-height: 18px; }
.letter-shelf .forecast .row { display: flex; align-items: flex-end; gap: 6px; }
.letter-shelf .forecast .sold { position: relative; }
.letter-shelf .forecast .who { height: 56px; }
.letter-shelf .forecast .sold img:not(.who) { height: 40px; }
.letter-shelf .qty { position: absolute; right: -2px; bottom: -2px; padding: 0 5px; border-radius: 8px; background: #fffaf0; font-size: 14px; line-height: 20px; color: #6b5640; box-shadow: 0 0 0 1px #e0cfae; }
.letter-sub { color: #8b7864; font-size: 16px !important; }
.compact .letter-shelf .forecast .who { height: 48px; }
.compact .letter-shelf .forecast .sold img:not(.who) { height: 34px; }
.compact .letter-sub { font-size: 14px !important; }
.ledger2 .book-summary { margin: 0; padding: 4px 4px 0; font-size: 18px; line-height: 1.6; color: #5d4a3a; word-break: keep-all; overflow-wrap: break-word; }
.compact .ledger2 .book-summary { font-size: 15px; line-height: 1.5; }
.compact .letter-shelf .qty { font-size: 11px; line-height: 15px; padding: 0 3px; right: -6px; bottom: -4px; }
/* 点検17：便せんの上に「前の営業日の仕込み → その日のお店（実線のわく）」を大きく先に。今日の見こみ（点線のわく）は文の後に小さく。
   今日の列は罫線2本分（70px）の高さにして、後の文も罫線にのせる。あふれる日は便せんの中だけ動かす */
.letter-body { overflow-y: auto; }
.letter-shelf .result { position: relative; display: flex; flex-direction: column; align-items: flex-start; padding: 10px 8px 2px; border: 2px solid #c9ab7c; border-radius: 12px; background: rgba(255,250,240,.55); }
.letter-shelf .result > i { position: absolute; left: 10px; top: -11px; padding: 0 5px; background: #f5eee0; font-style: normal; font-size: 15px; font-weight: 700; color: #6b5640; white-space: nowrap; line-height: 20px; }
.letter-shelf .result .row { display: flex; align-items: flex-end; gap: 6px; }
.letter-shelf .result .sold { position: relative; }
.letter-shelf .result .who { height: 58px; }
.letter-shelf .result .sold img:not(.who) { height: 44px; }
.letter-shelf.past .prep-was i { font-size: 15px; font-weight: 700; color: #6b5640; }
.letter-shelf.today { height: 64px; }
.letter-shelf.today .prep-was img { height: 40px; }
.letter-shelf.today .forecast .who { height: 42px; }
.letter-shelf.today .forecast .sold img:not(.who) { height: 30px; }
.letter-shelf.today .forecast { padding-top: 8px; }
.letter-date + .letter-shelf.today { margin-top: 22px; }
.letter-body p.today-line { color: #5b4c40; }
.compact .letter-shelf .result .who { height: 50px; }
.compact .letter-shelf .result .sold img:not(.who) { height: 38px; }
.compact .letter-shelf.today { height: 52.4px; }
.compact .letter-shelf.today .prep-was img { height: 34px; }
.compact .letter-shelf.today .forecast .who { height: 36px; }
.compact .letter-shelf.today .forecast .sold img:not(.who) { height: 26px; }
.compact .letter-date + .letter-shelf.today { margin-top: 23px; }
.letter-shelf.today .forecast { background: #f5eee0; }
