/* Aikonomy shell. Pixel UI in Aiko's palette: plum-brown ink, cream paper, sakura pink, mustard. */
@font-face { font-family: 'Sembako Pixel'; src: url('fonts/sembako-pixel-400.woff2') format('woff2'); font-weight: 100 549; font-display: swap; }
@font-face { font-family: 'Sembako Pixel'; src: url('fonts/sembako-pixel-700.woff2') format('woff2'); font-weight: 550 900; font-display: swap; }
@font-face { font-family: 'Press Start 2P'; src: url('fonts/press-start-2p.woff2') format('woff2'); font-display: swap; }
/* Fusion Pixel 12px (OFL-1.1): accents & macrons for Latin; ja / zh subsets load only when CJK is on screen */
@font-face { font-family: 'Fusion Pixel Latin'; src: url('fonts/fusion-pixel-latin.woff2') format('woff2'); font-display: swap; unicode-range: U+00A0-024F, U+2000-2BFF; }
@font-face { font-family: 'Fusion Pixel JA'; src: url('fonts/fusion-pixel-ja.woff2') format('woff2'); font-display: swap; unicode-range: U+2E80-9FFF, U+3000-303F, U+FF00-FFEF; }
@font-face { font-family: 'Fusion Pixel ZH'; src: url('fonts/fusion-pixel-zh.woff2') format('woff2'); font-display: swap; unicode-range: U+2E80-9FFF, U+3000-303F, U+FF00-FFEF; }

:root {
  --bg: #1d1520; --bg2: #2a1f2e; --bg3: #3a2b3f; --line: #000;
  --paper: #fff3e0; --paper2: #f3dcc0; --ink: #2b1d2f; --ink2: #5a4560;
  --muted: #b9a7b8; --pink: #f49ab1; --pink2: #d9577a; --mustard: #e6a93a; --mustard2: #b87d1c;
  --teal: #45b39f; --navy: #34406e; --red: #e8574a; --green: #6dbb5d; --blue: #6aa6e8;
  --cjk: 'Fusion Pixel JA';
  --font: 'Sembako Pixel', 'Fusion Pixel Latin', var(--cjk), 'Hiragino Sans', 'PingFang SC', 'Noto Sans CJK JP', ui-monospace, monospace;
  --font2: 'Press Start 2P', 'Fusion Pixel Latin', var(--cjk), 'Hiragino Sans', 'PingFang SC', ui-monospace, monospace;
  --fs: 16px; --stage-h: 256px;
}
html[data-lang="zh"] { --cjk: 'Fusion Pixel ZH'; }
html[data-lang="ja"], html[data-lang="zh"] { --fs: 15px; }
html[data-lang="ja"] *, html[data-lang="zh"] * { line-break: strict; word-break: normal; overflow-wrap: anywhere; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0e0a10; color: var(--paper); font-family: var(--font); font-size: var(--fs); overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { background: radial-gradient(circle at 50% 0%, #2e2032, #0e0a10 70%); overflow: hidden; }
button { font-family: inherit; color: inherit; font-size: inherit; }
img, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
.hidden { display: none !important; }
.px { font-family: var(--font2); }

#app {
  position: relative; max-width: 520px; height: 100dvh; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); padding-top: env(safe-area-inset-top); box-shadow: 0 0 0 3px #000, 0 0 60px #000;
}

/* ------------------------------------------------------------ HUD */
#hud { flex: none; padding: 5px 8px 5px; background: linear-gradient(#33263a, #241a29); border-bottom: 3px solid #000; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; }
.hud-date { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; }
.hud-date b { font-weight: 700; }
.hud-date .hol { color: var(--pink); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.hud-date .trash { font-size: 11px; background: #4b3a52; padding: 1px 4px; color: #ffe0a0; box-shadow: 0 0 0 1px #000; }
.hud-slot { font-family: var(--font2); font-size: 8px; padding: 3px 4px 2px; background: #000; color: #ffe0a0; }
.hud-slot.afternoon { color: #a8dcff; } .hud-slot.evening { color: #ff9a70; } .hud-slot.night { color: #9aa8ff; }
.hud-wx { font-size: 13px; color: var(--muted); }
.hud-money { text-align: right; line-height: 1; cursor: pointer; }
.hud-money b { font-family: var(--font2); font-size: 12px; color: var(--mustard); display: block; }
.hud-money b.neg { color: var(--red); }
.hud-money small { font-size: 12px; color: var(--muted); }
.hud-money small.warn { color: #ff9a8a; } .hud-money small.ok { color: #9be08a; }
.hud-meters { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.meter { display: flex; align-items: center; gap: 4px; min-width: 0; }
.meter img { width: 14px; height: 14px; flex: none; }
.meter .mbar { flex: 1; height: 7px; background: #000; box-shadow: inset 0 0 0 1px #4a3a50; position: relative; }
.meter .mbar i { display: block; height: 100%; transition: width .4s steps(6); }
.meter.genki i { background: var(--mustard); } .meter.kokoro i { background: var(--pink); } .meter.health i { background: var(--green); }
.meter .mbar i.low { background: var(--red); animation: blink .7s steps(2) infinite; }
.meter span { font-size: 11px; color: var(--muted); width: 20px; text-align: right; }
@keyframes blink { 50% { opacity: .45; } }

/* ------------------------------------------------------------ stage */
#stage { position: relative; flex: none; height: var(--stage-h); background: #000; border-bottom: 3px solid #000; display: flex; justify-content: center; align-items: center; overflow: hidden; touch-action: manipulation; }
#scene { display: block; image-rendering: pixelated; }
#floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.floater { position: absolute; font-family: var(--font2); font-size: 10px; color: #fff; text-shadow: 1px 0 #000, -1px 0 #000, 0 1px #000, 0 -1px #000, 1px 1px #000; white-space: nowrap; transform: translate(-50%, 0); animation: float 1.3s ease-out forwards; }
.floater.money { color: #ffe066; } .floater.bad { color: #ff8a7a; } .floater.good { color: #9be08a; } .floater.pink { color: #ffb3c8; }
.floater.big { font-size: 14px; }
@keyframes float { 0% { opacity: 0; transform: translate(-50%, 6px); } 12% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -26px); } }
#notifs { position: absolute; left: 6px; right: 6px; top: 6px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; z-index: 5; }
.notif { pointer-events: auto; display: flex; gap: 6px; align-items: center; background: #fff3e0ee; color: var(--ink); padding: 3px 6px 3px 3px; font-size: 12px; line-height: 1.15; max-height: 44px; overflow: hidden; box-shadow: 0 0 0 2px var(--ink), 3px 3px 0 2px #0006; animation: slidein .25s steps(4); cursor: pointer; }
.notif > div { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif canvas, .notif img { width: 24px; height: 24px; flex: none; background: #f3dcc0; box-shadow: 0 0 0 1px var(--ink); }
.notif b { font-size: 12px; margin-right: 4px; }
.notif.out { animation: slideout .3s steps(4) forwards; }
@keyframes slidein { from { transform: translateY(-120%); opacity: 0; } }
@keyframes slideout { to { transform: translateY(-120%); opacity: 0; } }
#skip { position: absolute; right: 6px; bottom: 6px; z-index: 6; background: #000a; border: 0; color: #fff; font-family: var(--font2); font-size: 9px; padding: 8px 10px; min-height: 32px; box-shadow: 0 0 0 2px #fff6; cursor: pointer; }
.shake { animation: shake .35s steps(6); }
@keyframes shake { 20% { transform: translate(-3px, 1px); } 40% { transform: translate(3px, -1px); } 60% { transform: translate(-2px, 0); } 80% { transform: translate(2px, 1px); } }

/* ------------------------------------------------------------ panel */
#panel { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 8px 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.ptitle { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); }
.ptitle b { color: var(--paper); font-size: 16px; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.25; }
.hint.warn { color: #ffb0a0; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.slot {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-height: 66px;
  background: var(--paper); color: var(--ink); border: 0; padding: 6px 8px; cursor: pointer;
  box-shadow: inset -3px -3px 0 var(--paper2), 0 0 0 3px var(--line);
}
.slot:active:not(:disabled) { transform: translateY(1px); }
.slot .sl-name { font-family: var(--font2); font-size: 7px; color: var(--ink2); letter-spacing: .5px; }
.todo { justify-content: flex-start !important; text-align: left; min-height: 38px !important; font-size: 13px !important; font-weight: 400 !important; padding: 4px 8px !important; }
.slot .sl-act { font-size: 16px; font-weight: 700; line-height: 1.05; }
.slot .sl-sub { font-size: 12px; color: var(--ink2); line-height: 1.1; }
.slot .chips { margin-top: auto; }
.slot.now { box-shadow: inset -3px -3px 0 var(--paper2), 0 0 0 3px var(--line), 0 0 0 5px var(--mustard); }
.slot.done { background: #d9c6b2; opacity: .75; }
.slot.forced { background: #f7d9e0; }
.slot.idle .sl-act { color: var(--ink2); }
.slot .warn { color: #b8343a; font-size: 12px; }
.slot .cat { position: absolute; right: 6px; top: 6px; width: 8px; height: 8px; box-shadow: 0 0 0 1px var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 3px; }
.chip { font-size: 11px; line-height: 1; padding: 3px 4px 2px; background: #eadcc8; color: var(--ink); white-space: nowrap; box-shadow: 0 0 0 1px #0004; }
.chip.yen.pos { background: #e3f3c8; color: #2f6a1d; } .chip.yen.neg { background: #fbd9d3; color: #8a2a20; }
.chip.genki { background: #fbe9c0; } .chip.kokoro { background: #fde0e8; } .chip.health { background: #d9f0d2; }
.chip.bad { color: #8a2a20; } .chip.good { color: #2f6a1d; }
.chip.later { background: #e0e6f5; color: #34406e; }
.chip.chance { background: #efe3f7; color: #5a3a7a; }

/* activity colours (categories) */
.c-work { --cc: #e6a93a; } .c-money { --cc: #6dbb5d; } .c-home { --cc: #6aa6e8; } .c-self { --cc: #f49ab1; } .c-out { --cc: #a98be0; } .c-rest { --cc: #c9b8a8; } .c-forced { --cc: #e8574a; }
.slot .cat, .cell, .act-row .ico { background: var(--cc, #ccc); }

/* week grid */
.wgrid { display: grid; grid-template-columns: 34px repeat(4, 1fr); gap: 3px; }
.wgrid .wh { font-family: var(--font2); font-size: 7px; color: var(--muted); text-align: center; padding: 3px 0; }
.wgrid .wd { font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; background: #2a1f2e; box-shadow: 0 0 0 1px #000; }
.wgrid .wd.today { color: var(--mustard); }
.cell { border: 0; min-height: 34px; padding: 2px 3px; font-size: 12px; line-height: 1.05; color: var(--ink); cursor: pointer; box-shadow: inset -2px -2px 0 #0003, 0 0 0 1px #000; overflow: hidden; text-overflow: ellipsis; word-break: break-word; }
.cell:active { transform: translateY(1px); }
.cell.off { opacity: .55; }
.policies { display: grid; grid-template-columns: 1fr; gap: 6px; }
.pol { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.seg { display: flex; gap: 3px; flex-wrap: wrap; }
.seg button { flex: 1 1 auto; min-height: 32px; border: 0; padding: 4px 6px; font-size: 13px; background: #2a1f2e; color: var(--muted); box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #4a3a50; cursor: pointer; }
.seg button.on { background: var(--pink2); color: #fff; box-shadow: 0 0 0 1px #000, inset 2px 2px 0 #f49ab1; }
.seg button:disabled { opacity: .4; }

/* month plan */
.card { background: var(--bg2); padding: 8px 10px; box-shadow: 0 0 0 2px #000, inset 0 0 0 1px #4a3a50; display: flex; flex-direction: column; gap: 6px; }
.card h3 { margin: 0; font-size: 14px; color: var(--muted); font-weight: 400; display: flex; justify-content: space-between; gap: 8px; }
.card.paper { background: var(--paper); color: var(--ink); box-shadow: 0 0 0 3px #000; }
.card.paper h3 { color: var(--ink2); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 14px; }
.kv .v { text-align: right; font-weight: 700; }
.pos { color: #8fe07a !important; } .neg { color: #ff8a7a !important; }
.card.paper .pos { color: #2f7a1d !important; } .card.paper .neg { color: #b8343a !important; }
.spark { width: 100%; height: 48px; display: block; }
.alarm { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 14px; }

/* ------------------------------------------------------------ controls + dock */
#controls { flex: none; display: grid; grid-template-columns: 1fr 1.15fr; gap: 8px; padding: 6px 8px; background: #241a29; border-top: 3px solid #000; align-items: stretch; }
.zooms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.zooms button { border: 0; min-height: 48px; font-size: 13px; background: #2a1f2e; color: var(--muted); box-shadow: 0 0 0 2px #000, inset 0 0 0 1px #4a3a50; cursor: pointer; padding: 2px; line-height: 1.05; }
.zooms button.on { background: var(--navy); color: #fff; box-shadow: 0 0 0 2px #000, inset 2px 2px 0 #6a78b0; }
.zooms button.locked { opacity: .45; }
.zooms button small { display: block; font-size: 10px; opacity: .8; }
.play {
  border: 0; min-height: 48px; font-size: 17px; font-weight: 700; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--pink2); box-shadow: inset -3px -3px 0 #9e3554, inset 3px 3px 0 #f49ab1, 0 0 0 3px #000;
}
.play:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 3px 3px 0 #9e3554, 0 0 0 3px #000; }
.play:disabled { opacity: .5; }
.play .tri { font-size: 15px; }
.play small { font-size: 11px; font-weight: 400; display: block; opacity: .9; }
.zoom-why { grid-column: 1 / -1; font-size: 12px; color: #ffb0a0; line-height: 1.2; margin-top: -2px; }
#dock { flex: none; display: grid; grid-template-columns: 1fr 1fr 1fr 52px; gap: 5px; padding: 5px 8px calc(6px + env(safe-area-inset-bottom)); background: linear-gradient(#241a29, #18111b); border-top: 2px solid #000; }
.dock-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 5px; border: 0; min-height: 44px; background: #3a2b3f; font-size: 14px; cursor: pointer; box-shadow: inset -3px -3px 0 #241a29, inset 3px 3px 0 #5a4860, 0 0 0 2px #000; padding: 2px 4px; }
.dock-btn img { width: 24px; height: 24px; flex: none; }
.dock-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-btn:active { transform: translateY(1px); }
.badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 3px; background: var(--red); color: #fff; font-size: 11px; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px #000; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 15px; font-weight: 600; text-align: center;
  background: #5a4860; color: var(--paper); border: 0; padding: 8px 12px; cursor: pointer; min-height: 44px; line-height: 1.15;
  box-shadow: inset -3px -3px 0 #2e2234, inset 3px 3px 0 #8a7690, 0 0 0 3px #000;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 3px 3px 0 #2e2234, 0 0 0 3px #000; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.pink { background: var(--pink2); box-shadow: inset -3px -3px 0 #9e3554, inset 3px 3px 0 #f49ab1, 0 0 0 3px #000; }
.btn.go { background: #3f8f3e; box-shadow: inset -3px -3px 0 #235a25, inset 3px 3px 0 #7cc457, 0 0 0 3px #000; }
.btn.warn { background: #b8343a; box-shadow: inset -3px -3px 0 #7a1f22, inset 3px 3px 0 #e8574a, 0 0 0 3px #000; }
.btn.mustard { background: var(--mustard2); box-shadow: inset -3px -3px 0 #7a5212, inset 3px 3px 0 #f0c060, 0 0 0 3px #000; }
.btn.ghost { background: #2a1f2e; box-shadow: inset -3px -3px 0 #1d1520, inset 3px 3px 0 #4a3a50, 0 0 0 3px #000; }
.btn.paper { background: var(--paper); color: var(--ink); box-shadow: inset -3px -3px 0 var(--paper2), 0 0 0 3px #000; }
.btn.small { min-height: 36px; font-size: 13px; padding: 4px 8px; }
.btn.wide { width: 100%; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .btn { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ------------------------------------------------------------ dialogue */
#dialog { position: absolute; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; padding: 0 6px calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, #0008 30%); }
#dialog.hidden { display: none; }
.dlg { background: var(--paper); color: var(--ink); padding: 8px 10px 10px; box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--paper2), 0 0 0 9px #000, 0 10px 20px #0008; display: flex; flex-direction: column; gap: 6px; animation: pop .14s steps(3); max-height: calc(100dvh - var(--stage-h) - 40px); overflow: hidden; }
.dlg.narrator { background: #2a1f2e; color: var(--paper); box-shadow: 0 0 0 3px #000, 0 0 0 6px #5a4860, 0 0 0 9px #000, 0 10px 20px #0008; }
@keyframes pop { from { transform: scale(.94); opacity: .4; } }
.dlg-head { display: flex; gap: 8px; align-items: flex-start; flex: none; max-height: 48dvh; overflow-y: auto; }
.dlg .choices { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 3px; margin: -3px; }
@media (max-height: 700px) { .portrait, .portrait canvas { width: 56px; height: 56px; } .dlg-text { font-size: 15px; } .choice { padding: 6px 8px; } }
.portrait { flex: none; width: 80px; height: 80px; background: linear-gradient(#ffe7c0, #f3c7a0); box-shadow: 0 0 0 3px var(--ink); }
.portrait canvas { width: 80px; height: 80px; display: block; }
.dlg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dlg-kicker { font-family: var(--font2); font-size: 7px; color: var(--ink2); letter-spacing: .5px; text-transform: uppercase; }
.dlg.narrator .dlg-kicker { color: var(--muted); }
.dlg-title { font-weight: 700; font-size: 17px; line-height: 1.1; color: #9e2a4a; }
.dlg.narrator .dlg-title { color: var(--pink); }
.dlg-name { font-size: 13px; color: var(--ink2); }
.dlg-text { font-size: 16px; line-height: 1.3; min-height: 2.6em; white-space: pre-wrap; }
.dlg-more { align-self: flex-end; font-size: 11px; animation: bob .5s steps(2) infinite; opacity: .7; }
@keyframes bob { 50% { transform: translateY(3px); } }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.choice { display: flex; flex-direction: column; align-items: stretch; gap: 4px; text-align: left; width: 100%; background: #fff; color: var(--ink); border: 0; padding: 8px 10px; cursor: pointer; min-height: 44px; box-shadow: inset -3px -3px 0 #e8d6c0, 0 0 0 3px var(--ink); font-size: 15px; font-weight: 600; }
.choice:active:not(:disabled) { transform: translateY(2px); }
.choice:disabled { opacity: .55; cursor: default; background: #eee3d6; }
.choice .why { font-size: 12px; color: #b8343a; font-weight: 400; }
.choice.tag-risky { box-shadow: inset -3px -3px 0 #e8d6c0, 0 0 0 3px var(--ink), inset 4px 0 0 #e6a93a; }
.dlg.narrator .choice { background: var(--paper); }

/* ------------------------------------------------------------ overlay cards (digest, chapter, kakeibo page) */
#overlay { position: absolute; inset: 0; z-index: 35; background: #0009; display: flex; align-items: center; justify-content: center; padding: 12px; }
.ocard { width: 100%; max-height: 100%; overflow-y: auto; background: var(--paper); color: var(--ink); box-shadow: 0 0 0 3px #000, 6px 8px 0 3px #0007; padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 9px; animation: drop .2s steps(4); }
@keyframes drop { from { transform: translateY(-30%) rotate(-2deg); opacity: .3; } }
.ocard h2 { margin: 0; font-size: 20px; line-height: 1.1; color: #9e2a4a; }
.ocard .kick { font-family: var(--font2); font-size: 8px; color: var(--ink2); letter-spacing: 1px; border-bottom: 2px solid var(--ink); padding-bottom: 5px; }
.ocard .diary { font-style: italic; font-size: 15px; background: #fff; padding: 8px; box-shadow: 0 0 0 2px #e0cbb0; line-height: 1.3; }
.ocard .sec { font-family: var(--font2); font-size: 7px; color: var(--ink2); letter-spacing: .5px; margin-top: 2px; }
.ocard .lines { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.ocard .lines div { display: flex; justify-content: space-between; gap: 8px; }
.ocard .notes { font-size: 13px; line-height: 1.3; display: flex; flex-direction: column; gap: 3px; max-height: 150px; overflow-y: auto; }
.bars { display: flex; flex-direction: column; gap: 3px; }
.barrow { display: grid; grid-template-columns: 96px 1fr 64px; gap: 6px; align-items: center; font-size: 12px; }
.barrow .b { height: 9px; background: #e6d6c2; }
.barrow .b i { display: block; height: 100%; }
.barrow .b i.in { background: var(--green); } .barrow .b i.out { background: var(--pink2); }
.barrow .amt { text-align: right; font-weight: 700; }
.deltas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; font-size: 12px; text-align: center; }
.deltas div { background: #fff; padding: 4px 2px; box-shadow: 0 0 0 1px #e0cbb0; }
.deltas b { display: block; font-size: 15px; }
.chapter { text-align: center; background: #1d1520; color: var(--paper); box-shadow: 0 0 0 3px #000, 0 0 0 6px var(--pink2), 0 0 0 9px #000; }
.chapter .m { font-family: var(--font2); font-size: 10px; color: var(--pink); letter-spacing: 2px; }
.chapter h2 { color: var(--paper); font-size: 24px; }
.chapter .sum { font-size: 14px; color: var(--muted); }
.stamp-thud { animation: thud .45s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes thud { from { transform: scale(2.4) rotate(-12deg); opacity: 0; } to { transform: scale(1) rotate(-6deg); opacity: 1; } }

/* ------------------------------------------------------------ sheets */
#sheet-wrap { position: absolute; inset: 0; z-index: 40; display: none; background: #0008; align-items: flex-end; }
#sheet-wrap.show { display: flex; }
.sheet { width: 100%; max-height: 86%; display: flex; flex-direction: column; background: var(--bg2); box-shadow: 0 -3px 0 #000, 0 -6px 0 #5a4860, 0 -9px 0 #000; animation: up .18s steps(4); padding-bottom: env(safe-area-inset-bottom); }
@keyframes up { from { transform: translateY(40%); } }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; background: #3a2b3f; border-bottom: 3px solid #000; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head img { width: 28px; height: 28px; }
.xbtn { background: none; border: 0; font-size: 18px; cursor: pointer; min-width: 44px; min-height: 44px; color: var(--paper); }
.sheet-body { padding: 10px 10px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.act-list { display: flex; flex-direction: column; gap: 6px; }
.act-group { font-family: var(--font2); font-size: 7px; color: var(--muted); margin-top: 4px; letter-spacing: .5px; }
.act-row { display: grid; grid-template-columns: 8px 1fr; gap: 8px; align-items: stretch; text-align: left; background: var(--paper); color: var(--ink); border: 0; padding: 6px 8px 6px 6px; cursor: pointer; min-height: 48px; box-shadow: inset -3px -3px 0 var(--paper2), 0 0 0 2px #000; }
.act-row .ico { width: 8px; }
.act-row b { font-size: 15px; }
.act-row .d { font-size: 12px; color: var(--ink2); line-height: 1.15; }
.act-row .why { font-size: 12px; color: #b8343a; }
.act-row:disabled { opacity: .6; cursor: default; background: #e6d8c8; }
.act-row.cur { box-shadow: inset -3px -3px 0 var(--paper2), 0 0 0 2px #000, 0 0 0 4px var(--mustard); }
.act-row:active:not(:disabled) { transform: translateY(1px); }

/* ------------------------------------------------------------ phone */
.sheet.phone { background: none; box-shadow: none; align-items: center; padding: 0 0 env(safe-area-inset-bottom); max-height: 94%; animation: up .2s steps(4); }
.phone-body { width: min(100%, 380px); margin: 0 auto; background: #2b2030; padding: 10px 8px 12px; box-shadow: 0 0 0 3px #000, inset 0 0 0 3px #5a4860, 0 0 0 6px #e9a3b8, 0 0 0 9px #000; display: flex; flex-direction: column; gap: 6px; height: min(78dvh, 640px); }
.phone-bar { display: flex; justify-content: space-between; align-items: center; font-family: var(--font2); font-size: 8px; color: var(--muted); padding: 0 4px; }
.phone-screen { flex: 1; min-height: 0; background: var(--paper); color: var(--ink); display: flex; flex-direction: column; box-shadow: 0 0 0 2px #000; overflow: hidden; }
.phone-home { padding: 14px 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 8px; align-content: start; overflow-y: auto; background: linear-gradient(#ffe3ea, #fff3e0 60%); flex: 1; }
.app { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; color: var(--ink); cursor: pointer; font-size: 12px; padding: 2px; min-height: 64px; }
.app img { width: 48px; height: 48px; box-shadow: 0 0 0 2px var(--ink); background: #fff; }
.app .badge { top: -2px; right: calc(50% - 32px); }
.app:active img { transform: translateY(1px); }
.phone-close { align-self: center; width: 56px; height: 20px; border: 0; background: #5a4860; box-shadow: 0 0 0 2px #000; cursor: pointer; margin-top: 2px; border-radius: 0; }
.app-head { display: flex; align-items: center; gap: 6px; padding: 4px 6px; background: var(--ink); color: var(--paper); }
.app-head button { background: none; border: 0; color: var(--paper); min-width: 44px; min-height: 40px; font-size: 16px; cursor: pointer; }
.app-head h3 { margin: 0; flex: 1; font-size: 16px; }
.app-head img { width: 24px; height: 24px; }
.app-body { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 7px; font-size: 14px; }
.app-tabs { display: flex; gap: 3px; flex-wrap: wrap; }
.app-tabs button { flex: 1; border: 0; min-height: 36px; padding: 4px; font-size: 13px; background: #eadcc8; color: var(--ink2); cursor: pointer; box-shadow: 0 0 0 1px #0005; }
.app-tabs button.on { background: var(--ink); color: var(--paper); }
.li { background: #fff; padding: 7px 8px; box-shadow: 0 0 0 2px #e0cbb0; display: flex; flex-direction: column; gap: 4px; }
.li.dim { opacity: .6; }
.li .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.li .top b { font-size: 15px; }
.li .wage { font-weight: 700; color: #2f7a1d; white-space: nowrap; }
.li .sub { font-size: 12px; color: var(--ink2); line-height: 1.2; }
.li .rv { font-size: 12px; color: var(--ink2); font-style: italic; line-height: 1.25; }
.li .stars { color: #e0a020; font-style: normal; letter-spacing: -1px; }
.li .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.li .acts .btn { min-height: 36px; font-size: 13px; padding: 4px 10px; }
.li.unread { box-shadow: 0 0 0 2px var(--pink2); }
.tag { display: inline-block; font-size: 10px; padding: 2px 4px 1px; background: var(--ink); color: var(--paper); margin-right: 3px; vertical-align: middle; }
.tag.pink { background: var(--pink2); } .tag.green { background: #3f8f3e; } .tag.mustard { background: var(--mustard2); }
.empty { color: var(--ink2); font-size: 13px; text-align: center; padding: 18px 8px; }
.threads { display: flex; flex-direction: column; }
.thread { display: flex; gap: 8px; align-items: center; padding: 6px; background: #fff; border: 0; border-bottom: 2px solid #f0e2d0; text-align: left; cursor: pointer; color: var(--ink); min-height: 52px; }
.thread canvas { width: 40px; height: 40px; flex: none; background: #f3dcc0; }
.thread .tn { flex: 1; min-width: 0; }
.thread .tn b { display: block; font-size: 15px; }
.thread .tn small { display: block; font-size: 12px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat { display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 86%; background: #fff; padding: 6px 8px; font-size: 14px; line-height: 1.3; box-shadow: 0 0 0 2px #e0cbb0; }
.msg.me { align-self: flex-end; background: #d6f0c8; box-shadow: 0 0 0 2px #b0d8a0; }
.msg small { display: block; font-size: 10px; color: var(--ink2); margin-bottom: 2px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal .h { font-size: 11px; text-align: center; color: var(--ink2); }
.cal .d { min-height: 44px; background: #fff; font-size: 11px; padding: 2px; box-shadow: 0 0 0 1px #e0cbb0; display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.cal .d.today { box-shadow: 0 0 0 2px var(--pink2); }
.cal .d.past { opacity: .5; }
.cal .d.hol .n { color: #c02a3a; }
.cal .d .n { font-weight: 700; }
.cal .d i { font-style: normal; font-size: 9px; line-height: 1; padding: 1px 2px; color: #fff; white-space: nowrap; overflow: hidden; }
.cal .d i.pay { background: #3f8f3e; } .cal .d i.bill { background: #b8343a; } .cal .d i.ev { background: var(--navy); } .cal .d i.tr { background: #8a7a60; } .cal .d i.ex { background: var(--mustard2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11px; }
.legend i { font-style: normal; padding: 1px 3px; color: #fff; }
.money-big { font-family: var(--font2); font-size: 16px; color: var(--ink); }
.ledger { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.ledger div { display: flex; justify-content: space-between; gap: 6px; }
.ledger div span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------ title / new game / review */
.title-menu { display: flex; flex-direction: column; gap: 10px; padding: 8px 10px 0; }
.title-menu .btn { min-height: 52px; font-size: 18px; }
.title-menu .sub { font-size: 12px; color: var(--muted); text-align: center; }
.langs { display: flex; gap: 6px; justify-content: center; }
.langs button { border: 0; min-height: 44px; min-width: 60px; padding: 4px 10px; background: #2a1f2e; color: var(--muted); font-size: 14px; box-shadow: 0 0 0 2px #000, inset 0 0 0 1px #4a3a50; cursor: pointer; }
.langs button.on { background: var(--pink2); color: #fff; }
.credits { font-size: 11px; color: #8a7a88; text-align: center; padding: 6px 0 calc(10px + env(safe-area-inset-bottom)); line-height: 1.4; }
.pick-head { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.pick-head .step { font-family: var(--font2); font-size: 8px; color: var(--pink); }
.pick-head h2 { margin: 0; font-size: 20px; }
.pick-head p { margin: 0; font-size: 13px; color: var(--muted); }
.cards { display: flex; flex-direction: column; gap: 8px; }
.pcard { display: flex; flex-direction: column; gap: 4px; text-align: left; background: var(--paper); color: var(--ink); border: 0; padding: 9px 10px; cursor: pointer; box-shadow: inset -3px -3px 0 var(--paper2), 0 0 0 3px #000; }
.pcard:active { transform: translateY(1px); }
.pcard.on { box-shadow: inset -3px -3px 0 var(--paper2), 0 0 0 3px #000, 0 0 0 6px var(--pink2); }
.pcard b { font-size: 17px; }
.pcard .d { font-size: 13px; color: var(--ink2); line-height: 1.2; }
.pcard .facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 2px; }
.pcard .facts div { background: #fff; padding: 4px; box-shadow: 0 0 0 1px #e0cbb0; font-size: 11px; color: var(--ink2); line-height: 1.1; }
.pcard .facts b { display: block; font-size: 14px; color: var(--ink); }
.pcard .facts b.best { color: #2f7a1d; } .pcard .facts b.worst { color: #b8343a; }
.review .page { background: var(--paper); color: var(--ink); padding: 12px; box-shadow: 0 0 0 3px #000, 4px 5px 0 3px #0007; display: flex; flex-direction: column; gap: 8px; background-image: repeating-linear-gradient(0deg, transparent 0 21px, #e9d6be 21px 22px); }
.review h2 { margin: 0; font-size: 20px; color: #9e2a4a; }
.score-big { font-family: var(--font2); font-size: 28px; color: #9e2a4a; text-align: center; }
.rank { text-align: center; font-size: 20px; font-weight: 700; }
.parts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; text-align: center; font-size: 11px; }
.parts div { background: #fff; padding: 4px 2px; box-shadow: 0 0 0 1px #e0cbb0; }
.parts b { display: block; font-size: 15px; }
.stamps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stampbox { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; text-align: center; line-height: 1.1; }
.stampbox img, .stampbox canvas { width: 54px; height: 54px; }
.stampbox.off img, .stampbox.off canvas { opacity: .15; filter: grayscale(1); }
.letter { font-size: 16px; line-height: 1.45; font-style: italic; background: #fff; padding: 10px; box-shadow: 0 0 0 2px #e0cbb0; }
.mbars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; align-items: end; height: 80px; }
.mbars div { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 1px; }
.mbars i { display: block; }
.mbars i.in { background: var(--green); } .mbars i.out { background: var(--pink2); }
.mlabels { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; font-size: 9px; text-align: center; color: var(--ink2); }

/* ------------------------------------------------------------ toast, rotate, boot */
#toast { position: absolute; left: 50%; top: calc(60px + env(safe-area-inset-top)); transform: translateX(-50%); max-width: 92%; background: #000d; color: var(--paper); padding: 7px 10px; font-size: 14px; z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; box-shadow: 0 0 0 2px var(--mustard2); text-align: center; line-height: 1.25; }
#toast.show { opacity: 1; }
#toast.bad { box-shadow: 0 0 0 2px var(--red); }
#rotate { display: none; position: fixed; inset: 0; z-index: 200; background: #1d1520; color: var(--paper); align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 20px; font-size: 15px; }
.rot-ico { font-size: 40px; animation: rot 1.6s steps(4) infinite; }
@keyframes rot { 50% { transform: rotate(90deg); } }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) { #rotate { display: flex; } }

#boot { position: absolute; inset: 0; z-index: 100; background: #120c14; display: flex; align-items: center; justify-content: center; cursor: pointer; }
#boot.gone { display: none; }
.boot-inner { width: min(92%, 420px); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.boot-inner .studio { width: 100%; height: auto; aspect-ratio: 3 / 2; box-shadow: 0 0 0 3px #000; animation: fadein 1s steps(8); }
@keyframes fadein { from { opacity: 0; } }
.boot-bar { width: 100%; height: 10px; background: #000; box-shadow: 0 0 0 2px #4a3a50; }
.boot-bar .fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--pink2), var(--pink)); transition: width .2s; }
.boot-meta { width: 100%; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); min-height: 2.4em; }
.boot-meta .pct { font-family: var(--font2); font-size: 9px; }
.tap { border: 0; background: var(--pink2); color: #fff; font-family: var(--font2); font-size: 12px; padding: 14px 18px; min-height: 52px; min-width: 220px; box-shadow: inset -3px -3px 0 #9e3554, inset 3px 3px 0 #f49ab1, 0 0 0 3px #000; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tap small { font-family: var(--font); font-size: 12px; opacity: .85; }
.tap:disabled { opacity: .35; }
#boot.ready .tap { animation: pulse 1.2s steps(2) infinite; }
@keyframes pulse { 50% { transform: scale(1.04); } }
.reload-entry { display: none; color: var(--pink); font-size: 14px; }
#boot.entry-error .reload-entry, #boot.failed .reload-entry { display: block; }
#boot.starting .tap { visibility: hidden; }
.lang-switch { display: flex; gap: 6px; }
.lang-btn { border: 0; background: #2a1f2e; color: var(--muted); min-height: 40px; padding: 4px 10px; font-size: 14px; box-shadow: 0 0 0 2px #000; cursor: pointer; }
.lang-btn.on { background: var(--pink2); color: #fff; }

/* settings */
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 15px; }
.set-row .seg { flex: 0 1 auto; }
.toggle { border: 0; min-width: 72px; min-height: 40px; font-family: var(--font2); font-size: 9px; background: #2a1f2e; color: #ff8a7a; box-shadow: 0 0 0 2px #000, inset 0 0 0 1px #4a3a50; cursor: pointer; }
.toggle.on { color: #9be08a; background: #2d3a2a; }
input[type=range] { width: 100%; accent-color: var(--pink2); min-height: 32px; }
input[type=number] { font-family: var(--font); font-size: 16px; width: 110px; padding: 6px; background: #fff; border: 0; box-shadow: 0 0 0 2px #000; color: var(--ink); }

/* montage calendar page */
.cal-page { position: absolute; right: 8%; top: 12%; width: 22%; background: var(--paper); color: var(--ink); text-align: center; box-shadow: 0 0 0 2px var(--ink), 3px 3px 0 2px #0006; padding: 2px 0 4px; animation: flip .12s steps(2); }
.cal-page .cp-m { background: var(--pink2); color: #fff; font-size: 12px; padding: 2px 0; }
.cal-page .cp-d { font-family: var(--font2); font-size: 22px; padding: 6px 0 2px; }
.cal-page .cp-w { font-size: 12px; color: var(--ink2); }
@keyframes flip { from { transform: rotateX(70deg); } }

.hud-money small.loud { color: #fff; background: var(--red); padding: 1px 4px; animation: blink 1s steps(2) infinite; }
.alert { background: #fbd9d3; color: #8a2a20; padding: 6px 8px; font-size: 14px; font-weight: 700; box-shadow: 0 0 0 2px #b8343a; line-height: 1.25; }

details.card > summary { cursor: pointer; font-size: 14px; color: var(--muted); list-style: none; display: flex; gap: 6px; align-items: baseline; min-height: 32px; }
details.card > summary::before { content: '▸'; } details.card[open] > summary::before { content: '▾'; }
details.card > summary b { color: var(--paper); font-weight: 400; } details.card > summary .muted { font-size: 12px; }
.zooms button .zl { display: block; white-space: nowrap; }
.zooms button small { white-space: nowrap; font-size: 9px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 380px) { .hud-wx { display: none; } .hud-date { font-size: 14px; gap: 4px; } }
html[data-lang="ja"] .hud-wx, html[data-lang="zh"] .hud-wx { display: none; }

.dock-btn.icon-only span { display: none; }
