@font-face { font-family: 'Zen Antique'; src: url(assets/fonts/antique.woff) format('woff'); font-display: swap; }
@font-face { font-family: 'Shippori Mincho B1'; src: url(assets/fonts/mincho-500.woff) format('woff'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Shippori Mincho B1'; src: url(assets/fonts/mincho-700.woff) format('woff'); font-weight: 600 900; font-display: swap; }
@font-face { font-family: 'IM Fell English'; src: url(assets/fonts/fell.woff) format('woff'); font-display: swap; }
:root {
  --ink: #2a1a0e;
  --ink-soft: #4a3220;
  --red: #8b1a1a;
  --red-deep: #5e0f0f;
  --gold: #c9a227;
  --parch: #e8d3a3;
  --serif: 'Shippori Mincho B1', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --antique: 'Zen Antique', 'Shippori Mincho B1', 'Hiragino Mincho ProN', serif;
  --num: 'IM Fell English', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0c0805; color: var(--ink); font-family: var(--serif); }
button { font-family: inherit; cursor: pointer; }

#stage {
  position: absolute; left: 50%; top: 50%; width: 1600px; height: 900px;
  transform-origin: center; user-select: none;
}
#desk { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#glow {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 40% 45% at 88% 10%, rgba(255, 170, 70, .16), transparent 70%),
    radial-gradient(ellipse 80% 70% at 50% 55%, transparent 55%, rgba(0, 0, 0, .55) 100%);
  animation: flicker 4s infinite;
}
@keyframes flicker { 0%, 100% { opacity: 1 } 45% { opacity: .9 } 50% { opacity: .97 } 70% { opacity: .88 } }

/* ===== 羊皮紙 ===== */
.doc, .pile .sheet, #pending, .slip, .tag, #clock #date {
  background-color: var(--parch);
  background-image: url(assets/parchment.jpg);
  background-size: 512px;
}

/* ===== 日付と蝋燭 ===== */
#clock { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; z-index: 5; }
#date {
  font-family: var(--antique); font-size: 22px; letter-spacing: .12em; padding: 6px 22px 7px;
  clip-path: polygon(2% 8%, 30% 0, 70% 6%, 99% 0, 97% 50%, 100% 96%, 60% 100%, 25% 94%, 0 100%, 3% 50%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .6); color: var(--ink);
}
#daycandle { width: 16px; height: 46px; display: flex; align-items: flex-end; }
#daycandle .wax-body {
  position: relative; width: 100%; background: linear-gradient(90deg, #d8c79c, #fff2cf 45%, #c9b688);
  border-radius: 3px 3px 2px 2px; box-shadow: 0 0 18px rgba(255, 180, 80, .5);
}
#daycandle .flame {
  position: absolute; left: 50%; top: -15px; width: 8px; height: 14px; transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 70%, #fff8d0, #ffb43c 55%, transparent 72%);
  border-radius: 50% 50% 45% 45%; animation: flame .18s infinite alternate;
}
@keyframes flame { to { transform: translateX(-50%) scaleY(1.15) skewX(4deg); } }
#pause, #speed {
  height: 34px; min-width: 34px; border-radius: 50%; border: 1px solid rgba(201, 162, 39, .6);
  background: radial-gradient(circle at 40% 35%, #4b3420, #1e130b); color: #e8cf8f; font-family: var(--antique); font-size: 13px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .6);
}
#speed { border-radius: 17px; padding: 0 10px; }
#pause svg { width: 18px; height: 18px; fill: none; stroke: #e8cf8f; stroke-width: 1.6; }
#pause.on { background: radial-gradient(circle at 40% 35%, #8b1a1a, #3d0808); }

/* ===== 書類の山 ===== */
#piles { position: absolute; top: 70px; left: 585px; width: 720px; display: flex; justify-content: space-between; z-index: 2; }
#piles .group { display: flex; gap: 8px; }
.pile { position: relative; width: 84px; height: 178px; cursor: pointer; transition: transform .2s; }
.pile .base { position: absolute; left: 2px; right: 2px; bottom: 30px; height: calc(var(--base, 4) * 5px + 6px); border-radius: 2px;
  background: repeating-linear-gradient(180deg, #d9bf8a 0 3px, #8a6a3c 3px 4px, #cdb07a 4px 6px, #6e512a 6px 7px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, .6), inset 0 0 12px rgba(60, 30, 5, .5); clip-path: polygon(0 0, 100% 3px, 99% 100%, 1% 100%); }
.pile .base::after { content: ''; position: absolute; left: 30%; top: 0; bottom: 0; width: 7px; background: linear-gradient(90deg, #5e0f0f, #8b1a1a, #5e0f0f); opacity: var(--tie, 0); }
.pile:hover { transform: translateY(-4px); }
.pile .sheets { position: absolute; left: 3px; right: 3px; bottom: calc(30px + var(--base, 4) * 5px + 6px); height: 100px; }
.pile .sheet {
  position: absolute; left: 0; right: 0; bottom: 0; height: 56px;
  box-shadow: 0 2px 3px rgba(0, 0, 0, .55), inset 0 0 18px rgba(120, 70, 20, .35);
  clip-path: polygon(0 4%, 20% 0, 50% 3%, 80% 0, 100% 5%, 98% 100%, 60% 97%, 30% 100%, 1% 97%);
}
.pile .sheet:nth-child(odd) { filter: brightness(.93) sepia(.15); }
.pile .sheet.urgent::after { content: ''; position: absolute; right: 10px; top: 12px; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #c02a2a, #5e0f0f); }
.pile .tag {
  position: absolute; left: 0; right: 0; bottom: 0; height: 32px; display: grid; place-items: center;
  font-family: var(--antique); font-size: 17px; letter-spacing: .14em; color: var(--ink);
  box-shadow: 0 3px 6px rgba(0, 0, 0, .6);
  clip-path: polygon(0 10%, 50% 0, 100% 8%, 97% 92%, 50% 100%, 2% 94%);
}
.pile .tag.royal { color: var(--red-deep); }
.pile .count {
  position: absolute; right: -6px; bottom: 22px; min-width: 28px; height: 28px; border-radius: 50%; padding: 0 4px;
  display: grid; place-items: center; font-family: var(--num); font-size: 14px; color: #f7e3b5;
  background: radial-gradient(circle at 35% 30%, #b32020, #5e0f0f 75%); box-shadow: 0 2px 4px rgba(0, 0, 0, .7);
}
.pile .count:empty { display: none; }
.pile.full .tag { animation: shake .4s infinite; }
.pile.arrive .sheets { animation: drop .5s cubic-bezier(.2, 1.4, .4, 1); }
.pile.topple .sheets { animation: topple .7s; }
@keyframes drop { from { transform: translateY(-60px) rotate(-6deg); opacity: 0 } }
@keyframes shake { 50% { transform: rotate(1.5deg) } }
@keyframes topple { 40% { transform: rotate(12deg) translateX(10px) } }
.flying-sheet {
  position: fixed; width: 80px; height: 56px; background: var(--parch); z-index: 50; pointer-events: none;
  animation: fall 1.4s ease-in forwards; box-shadow: 0 6px 14px rgba(0, 0, 0, .5);
}
@keyframes fall { to { transform: translate(140px, 600px) rotate(220deg); opacity: 0 } }

/* ===== 帳簿 ===== */
#ledger {
  position: absolute; left: 150px; top: 560px; width: 520px; height: 290px; display: flex; z-index: 3;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .7)); transform: rotate(-2deg);
}
#ledger::before {
  content: ''; position: absolute; inset: -10px -12px -14px; border-radius: 6px;
  background: linear-gradient(180deg, #4a2a16, #2b170b); z-index: -1;
}
#ledger .page {
  flex: 1; position: relative; padding: 18px 20px 14px;
  background: url(assets/parchment.jpg) 0 0/512px, var(--parch);
}
#ledger .page.left { border-radius: 4px 0 0 4px; box-shadow: inset -24px 0 26px -18px rgba(70, 40, 10, .6); }
#ledger .page.right { border-radius: 0 4px 4px 0; box-shadow: inset 24px 0 26px -18px rgba(70, 40, 10, .6); }
#ledger table { width: 100%; border-collapse: collapse; font-size: 17px; }
#ledger td { padding: 5px 2px; border-bottom: 1px solid rgba(74, 50, 32, .28); }
#ledger td:first-child { font-family: var(--antique); white-space: nowrap; letter-spacing: .06em; }
#ledger td.num { font-family: var(--num); font-size: 22px; text-align: right; padding-right: 8px; color: var(--ink); }
#ledger td.bar { width: 62px; }
#ledger td.bar i { display: block; height: 4px; background: var(--ink-soft); opacity: .55; border-radius: 2px; }
#ledger tr.low td { color: var(--red); }
#ledger tr.low td.bar i { background: var(--red); opacity: .9; }
#ledger tr.flash td.num { animation: inkflash 1s; }
@keyframes inkflash { 0% { color: var(--red); transform: scale(1.2) } }
#ledger .page.right table { font-size: 14px; }
#ledger .page.right td { padding: 3px 2px; }
#ledger .page.right td.num { font-size: 17px; }
#ledger .sealrow { display: flex; align-items: center; gap: 12px; font-family: var(--antique); font-size: 15px; margin-bottom: 8px; }
#ledger .works { margin: 0; padding: 0 0 0 4px; list-style: none; font-size: 15px; }
#ledger .works li { padding: 4px 0; border-bottom: 1px solid rgba(74, 50, 32, .28); }
#ledger .works li::before { content: '✠ '; color: var(--ink-soft); }
#ledger .works li.prob { color: var(--red); }
#ledger .works li.prob::before { content: '✗ '; color: var(--red); }
#ledger .ribbons { position: absolute; right: 18px; bottom: -34px; display: flex; gap: 6px; }
#ledger .ribbon {
  width: 38px; height: 46px; border: 0; padding-top: 10px; font-family: var(--antique); font-size: 13px; color: #f3dcaa;
  background: linear-gradient(90deg, #5e0f0f, #8b1a1a 50%, #5e0f0f);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); opacity: .75; transition: transform .2s;
}
#ledger .ribbon.on { opacity: 1; transform: translateY(6px); }
.sealsvg { filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .5)); flex: none; }

#coins {
  position: absolute; left: 590px; top: 470px; width: 110px; height: 90px; z-index: 3; pointer-events: none;
  background: url(assets/coin_s.png) center bottom/contain no-repeat;
  transform: scale(calc(.45 + var(--h, 5) * .07)); transform-origin: bottom center;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .6)); transition: transform .5s;
}
#coins.few { opacity: .5; }
.delta {
  position: fixed; z-index: 100; font-family: var(--num); font-size: 22px; pointer-events: none;
  animation: rise 1.6s forwards; text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
.delta.up { color: #f0d27a; }
.delta.down { color: #ff7a6a; }
@keyframes rise { to { transform: translateY(-36px); opacity: 0 } }

/* ===== 未決 ===== */
#pending {
  position: absolute; left: 720px; top: 300px; width: 380px; height: 590px; padding: 22px 30px 20px; z-index: 3;
  transform: rotate(-1.2deg); box-shadow: 0 10px 18px rgba(0, 0, 0, .65), inset 0 0 40px rgba(120, 70, 20, .35);
  clip-path: polygon(0 1%, 30% 0, 60% 1.2%, 100% 0, 99% 40%, 100% 99%, 70% 100%, 35% 98.8%, 1% 100%, 0 60%);
}
#pending .ph { font-family: var(--antique); font-size: 26px; letter-spacing: .3em; text-align: center; border-bottom: 1.5px solid var(--ink-soft); padding-bottom: 6px; margin-bottom: 6px; }
#pending ul { list-style: none; margin: 0; padding: 0; }
#pending li { display: grid; grid-template-columns: 18px 1fr 46px; align-items: center; gap: 8px; padding: 7px 0; font-size: 16px; line-height: 1.35; cursor: pointer; border-bottom: 1px dotted rgba(74, 50, 32, .35); }
#pending li:hover .lbl { color: var(--red); }
#pending li b { font-family: var(--antique); font-weight: normal; color: var(--ink-soft); margin-right: 2px; }
#pending li .box { width: 13px; height: 13px; border: 1.5px solid var(--ink); }
#pending li .box.ok { background: linear-gradient(45deg, transparent 45%, var(--ink) 45% 55%, transparent 55%), linear-gradient(-45deg, transparent 45%, var(--ink) 45% 55%, transparent 55%); }
#pending li.urgent .lbl { color: var(--red); }
#pending li.more { display: block; text-align: right; font-style: italic; color: var(--ink-soft); cursor: default; }
.wick { height: 5px; background: rgba(74, 50, 32, .2); border-radius: 3px; overflow: hidden; }
.wick i { display: block; height: 100%; background: linear-gradient(90deg, #ffb43c, #f3e0b0); }
#pending li.urgent .wick i { background: #c02a2a; }

/* ===== 部下の紙片 ===== */
#slips { position: absolute; left: 1150px; top: 300px; width: 270px; height: 400px; z-index: 4; display: flex; flex-wrap: wrap; gap: 14px 12px; align-content: flex-start; }
.slip {
  position: relative; width: 126px; flex: none; padding: 10px 11px 9px; font-size: 14px; line-height: 1.45;
  box-shadow: 0 6px 12px rgba(0, 0, 0, .6); filter: sepia(.25) brightness(.97);
  clip-path: polygon(0 3%, 50% 0, 100% 4%, 97% 100%, 3% 97%); animation: slipin .5s ease-out;
}
@keyframes slipin { from { transform: translateY(60px) rotate(8deg); opacity: 0 } }
.slip .sfrom { font-family: var(--antique); font-size: 11.5px; color: var(--ink-soft); }
.slip .marks { display: flex; gap: 6px; margin-top: 6px; }
.slipwick { height: 3px; background: rgba(74, 50, 32, .2); margin-top: 6px; }
.slipwick i { display: block; height: 100%; background: #ffb43c; }
.smark {
  flex: 1; border: 1.5px solid var(--ink); background: transparent; font-family: var(--antique); font-size: 15px; padding: 2px 0; color: var(--ink);
}
.smark:hover { background: var(--ink); color: var(--parch); }

/* ===== 地図の巻物 ===== */
#mapscroll {
  position: absolute; right: 30px; bottom: 34px; width: 210px; height: 140px; border: 0; z-index: 3;
  background: url(assets/map.jpg) center/cover; transform: perspective(600px) rotateX(38deg) rotate(-8deg);
  box-shadow: 0 16px 20px rgba(0, 0, 0, .7); filter: sepia(.2) brightness(.85); transition: filter .2s, transform .2s;
}
#mapscroll::after {
  content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 32%, rgba(0, 0, 0, .25) 33%, transparent 35% 65%, rgba(0, 0, 0, .25) 66%, transparent 68%);
}
#mapscroll:hover { filter: sepia(.1) brightness(1); transform: perspective(600px) rotateX(30deg) rotate(-6deg) translateY(-6px); }
#mapscroll.news::before {
  content: ''; position: absolute; right: -10px; top: -14px; width: 34px; height: 34px; z-index: 2;
  background: url(assets/seal_s.png) center/contain no-repeat; animation: pulse 1s infinite alternate;
}
@keyframes pulse { to { transform: scale(1.15) } }

/* ===== 開いた書類 ===== */
#focus { position: absolute; inset: 0; z-index: 10; pointer-events: none; display: grid; place-items: center; padding: 120px 0 0 300px; }
#focus .doc { pointer-events: auto; }
.doc {
  position: relative; width: 520px; min-height: 400px; padding: 50px 54px 92px; transform: rotate(var(--r, 0deg));
  box-shadow: 0 30px 50px rgba(0, 0, 0, .75), inset 0 0 70px rgba(120, 70, 20, .45);
  clip-path: polygon(0 1.5%, 12% 0, 30% 1%, 55% 0, 78% 1.2%, 100% 0, 99.2% 25%, 100% 55%, 99% 80%, 100% 100%, 75% 99%, 50% 100%, 22% 98.8%, 0 100%, .8% 70%, 0 40%);
  animation: docin .35s cubic-bezier(.2, 1, .3, 1);
  font-size: 22px; line-height: 1.7; color: var(--ink);
}
@keyframes docin { from { transform: translateY(80px) rotate(4deg) scale(.92); opacity: 0 } }
.doc.fly { animation: docout .5s ease-in forwards; }
@keyframes docout { to { transform: translate(520px, -120px) rotate(18deg) scale(.5); opacity: 0 } }
.doc .from { font-family: var(--antique); font-size: 17px; letter-spacing: .1em; color: var(--ink-soft); margin-bottom: 14px; border-bottom: 1px solid rgba(74, 50, 32, .4); padding-bottom: 8px; }
.doc .pilemark { position: absolute; right: 54px; top: 22px; font-family: var(--antique); font-size: 14px; color: var(--red); letter-spacing: .2em; }
.doc .body { font-weight: 700; }
.doc .body::first-letter { font-family: var(--antique); font-size: 1.9em; float: left; line-height: 1; margin: 2px 6px 0 0; color: var(--red-deep); }
.doc .date { position: absolute; left: 58px; bottom: 30px; font-family: var(--antique); font-size: 14px; color: var(--ink-soft); }
.doc .amt { margin-top: 14px; font-weight: 500; font-size: 19px; }
.doc .amt b, .doc b.claim { font-family: var(--num); font-size: 30px; font-weight: normal; }
.doc .hintline { margin-top: 18px; font-size: 13px; font-weight: 500; color: var(--ink-soft); letter-spacing: .2em; }
.doc .filed { font-size: 15px; font-weight: 500; color: var(--ink-soft); margin-top: 4px; }
.doc-candle { position: absolute; right: 24px; top: 70px; width: 8px; height: 120px; background: rgba(74, 50, 32, .18); border-radius: 4px; display: flex; align-items: flex-end; }
.doc-candle i { display: block; width: 100%; background: linear-gradient(#fff4cf, #d9c48f); border-radius: 4px; position: relative; }
.doc-candle i::before { content: ''; position: absolute; left: -3px; top: -12px; width: 14px; height: 12px; border-radius: 50% 50% 40% 40%; background: radial-gradient(ellipse at 50% 70%, #fff8d0, #ffb43c 55%, transparent 72%); animation: flame .18s infinite alternate; }
.doc.royal { box-shadow: 0 30px 50px rgba(0, 0, 0, .75), inset 0 0 0 10px rgba(139, 26, 26, .12), inset 0 0 70px rgba(120, 70, 20, .45); }
.doc.royal .from { color: var(--red-deep); text-align: center; font-size: 22px; letter-spacing: .4em; }

.acts { position: absolute; right: 50px; bottom: 26px; display: flex; gap: 18px; }
.stamp {
  position: relative; width: 74px; height: 74px; border: 0; background: none; padding: 0;
  transition: transform .15s;
}
.stamp::before { content: ''; position: absolute; inset: -4px; background: url(assets/stamp_s.png) center/contain no-repeat; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .55)); }
.stamp span {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--antique); font-size: 15px; color: #f3dcaa; background: rgba(30, 18, 9, .85); padding: 0 8px; border-radius: 10px;
}
.stamp.no span { background: rgba(20, 20, 20, .9); }
.stamp.yes span { background: rgba(110, 18, 18, .92); }
.stamp:hover { transform: translateY(-6px) rotate(-4deg); }
.stamp:disabled { opacity: .6; transform: none; }
.stamp.small { width: 54px; height: 54px; }
.stamp.small span { font-size: 12px; }
#focus .doc .acts .stamp:first-child { animation: invite 1.4s ease-in-out infinite; }
@keyframes invite { 50% { transform: translateY(-4px) rotate(-3deg) } }
.stampmark {
  position: absolute; right: 120px; bottom: 120px; width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--antique); font-size: 38px; letter-spacing: .05em; border: 5px double currentColor; opacity: .85;
  mix-blend-mode: multiply; animation: thud .25s ease-out;
}
.stampmark.yes { color: #9c1c1c; }
.stampmark.no { color: #1d1a18; }
.stampmark.read { color: #3b2a14; }
@keyframes thud { from { transform: scale(1.8); opacity: 0 } }

.quillnum { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.qa { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--ink); background: transparent; font-size: 22px; color: var(--ink); }
.qa:hover { background: var(--ink); color: var(--parch); }
.qv { font-family: var(--num); font-size: 36px; min-width: 170px; text-align: center; border-bottom: 1.5px solid var(--ink-soft); }
.qv.ink { animation: ink .4s; }
@keyframes ink { from { color: #000; filter: blur(1px) } }

.testimonies { display: flex; gap: 18px; margin-top: 16px; }
.testimony { flex: 1; position: relative; padding: 12px 12px 56px; border: 1px solid rgba(74, 50, 32, .5); background: rgba(255, 245, 220, .25); font-weight: 500; font-size: 16px; }
.testimony .tw { font-family: var(--antique); }
.testimony .td { color: var(--ink-soft); font-size: 15px; }
.tseal { position: absolute; left: 12px; bottom: 12px; width: 34px; height: 34px; background: url(assets/seal_s.png) center/contain no-repeat; }
.tseal.none { background: none; border: 1.5px dashed rgba(74, 50, 32, .5); border-radius: 50%; }
.testimony .stamp { position: absolute; right: 10px; bottom: 6px; }

.charterseal { margin: 18px auto 0; width: 92px; position: relative; }
.charterseal .ribbon-tail { position: absolute; left: 30px; top: 70px; width: 30px; height: 50px; background: linear-gradient(90deg, #5e0f0f, #8b1a1a); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); z-index: -1; }

.opts { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.opt { text-align: left; background: transparent; border: 0; border-bottom: 1px solid rgba(74, 50, 32, .35); padding: 8px 4px; font-size: 19px; font-weight: 700; color: var(--ink); display: flex; gap: 12px; align-items: center; }
.opt .box { width: 18px; height: 18px; border: 2px solid var(--ink); flex: none; }
.opt:hover:not(:disabled) { color: var(--red); }
.opt:disabled { opacity: .45; cursor: default; }
.opt.signed { opacity: 1 !important; color: var(--red-deep); }
.opt.signed .box { background: linear-gradient(45deg, transparent 42%, var(--red-deep) 42% 58%, transparent 58%), linear-gradient(-45deg, transparent 42%, var(--red-deep) 42% 58%, transparent 58%); }
.wax { width: 110px; height: 110px; background: url(assets/seal_s.png) center/contain no-repeat; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .5)); }
.wax.drop { position: absolute; right: 60px; bottom: 30px; animation: thud .3s ease-out; }
.wax.big { width: 140px; height: 140px; margin: 24px auto 0; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .5)) hue-rotate(var(--hue, 0deg)); }

/* ===== 地図 ===== */
#map { position: absolute; inset: 0; z-index: 20; display: none; place-items: center; background: rgba(8, 5, 3, .7); }
#map.open { display: grid; }
#mapsheet {
  position: relative; width: 1260px; height: 840px; background: url(assets/map.jpg) center/cover;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .8); animation: unroll .4s ease-out;
}
@keyframes unroll { from { transform: scaleY(.1); opacity: .2 } }
#mapsheet svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#mapsheet line { stroke: rgba(60, 30, 12, .7); vector-effect: non-scaling-stroke; stroke-width: 3; stroke-dasharray: 2 5; stroke-linecap: round; }
#mapsheet line.order { stroke: #8b1a1a; stroke-dasharray: 6 6; stroke-width: 3; animation: march 1s linear infinite; }
#mapsheet line.march { stroke: #8b1a1a; stroke-dasharray: none; stroke-width: 4; opacity: .7; }
@keyframes march { to { stroke-dashoffset: -12; } }
.node .mark { flex: none; }
.node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; }
.node .mark { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--ink); background: rgba(232, 211, 163, .7); }
.node.foe .mark { border-color: #222; background: rgba(30, 30, 30, .6); }
.node .nm { margin-top: 2px; font-family: var(--antique); font-size: 19px; color: var(--ink); text-shadow: 0 0 4px #f0dcae, 0 0 8px #f0dcae; white-space: nowrap; }
.node.foe .nm { color: #1a1a1a; }
.node.own:not(.t-forest):not(.t-river) .mark { border-color: var(--red-deep); }
.node.besieged .mark { animation: pulse .5s infinite alternate; background: #c02a2a; }
.node .scout {
  margin-top: 3px; font-family: var(--antique); font-size: 13px; border: 1px solid var(--ink); background: rgba(232, 211, 163, .9); padding: 1px 7px; color: var(--ink); opacity: .55; transition: opacity .2s;
}
.node:hover .scout { opacity: 1; }
.node .scout:hover { background: var(--ink); color: var(--parch); }
.token {
  position: absolute; transform: translate(-50%, -100%); width: 54px; height: 54px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  box-shadow: 0 6px 10px rgba(0, 0, 0, .6), inset 0 -4px 6px rgba(0, 0, 0, .4), inset 0 3px 4px rgba(255, 255, 255, .25);
  font-family: var(--antique); z-index: 2;
}
.token.own { background: radial-gradient(circle at 35% 30%, #c43030, #6a1010); color: #f7e3b5; cursor: grab; }
.token.own.drag { cursor: grabbing; transform: translate(-50%, -50%) scale(1.15); z-index: 5; transition: none; }
.token.own.waiting { outline: 2px dashed #8b1a1a; outline-offset: 4px; }
.token.foe { background: radial-gradient(circle at 35% 30%, #4a4a4a, #111); color: #ddd; transform: translate(-50%, 0); }
.token b { font-size: 20px; font-weight: normal; }
.token small { font-family: var(--num); font-size: 14px; }
.token em { position: absolute; top: 100%; margin-top: 3px; font-style: normal; font-size: 12px; color: #222; background: rgba(232, 211, 163, .85); padding: 0 4px; white-space: nowrap; }

/* ===== 予算 ===== */
#budget { position: absolute; inset: 0; z-index: 30; display: none; place-items: center; background: rgba(8, 5, 3, .72); }
#budget.open { display: grid; }
.budget-doc { width: 1060px; min-height: 0; padding: 40px 54px 110px; }
.budget-doc .from { text-align: center; font-size: 26px; letter-spacing: .4em; color: var(--red-deep); }
.budget-doc .acct { display: flex; justify-content: center; gap: 40px; font-size: 17px; font-weight: 500; }
.budget-doc .acct b { font-family: var(--num); font-size: 24px; font-weight: normal; }
.purse { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 16px 0 10px; min-height: 56px; }
.coinstack { display: flex; }
.coinstack .coin { margin-left: -12px; }
.purse .left { font-family: var(--antique); font-size: 26px; }
.coin { display: inline-block; width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 38% 32%, #fff3b0, #e0b443 35%, #a87a1c 70%, #6d4c0e); box-shadow: inset 0 0 0 3px rgba(110, 76, 14, .7), inset 0 0 0 6px rgba(255, 230, 150, .35), 0 3px 4px rgba(0, 0, 0, .55); }
.dishes { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin-top: 8px; }
.dish { position: relative; cursor: pointer; text-align: center; }
.dish .plate {
  height: 100px; border-radius: 50%; margin: 0 auto; width: 116px; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; padding: 14px;
  background: radial-gradient(ellipse at 50% 40%, #a77c3a, #6b4a1e 60%, #3d2a10); box-shadow: inset 0 6px 14px rgba(0, 0, 0, .55), 0 6px 10px rgba(0, 0, 0, .4);
}
.dish .plate .coin { width: 32px; height: 32px; margin: -5px -3px; animation: drop .3s; }
.dish:hover .plate { box-shadow: inset 0 6px 14px rgba(0, 0, 0, .55), 0 0 0 3px rgba(201, 162, 39, .7); }
.dish .dn { font-family: var(--antique); font-size: 20px; margin-top: 6px; letter-spacing: .2em; }
.dish .crown { position: absolute; top: -4px; right: 6px; display: flex; gap: 2px; }
.req { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-family: var(--antique); font-size: 13px; color: #f7e3b5; background: radial-gradient(circle at 35% 30%, #b32020, #5e0f0f 75%); box-shadow: 0 2px 3px rgba(0, 0, 0, .5); }
.dish:not(.short) .req { filter: grayscale(.2) brightness(.8); }
.dish.short .req { animation: pulse .6s infinite alternate; }
.take { position: absolute; top: 4px; left: 12px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--ink); background: rgba(232, 211, 163, .85); font-size: 15px; line-height: 1; }
.cards { display: flex; gap: 14px; justify-content: center; margin-top: 22px; }
.card { position: relative; width: 200px; padding: 12px 12px 12px 42px; cursor: pointer; font-weight: 700; font-size: 16px; border: 1.5px solid rgba(74, 50, 32, .55); background: rgba(120, 80, 30, .14); box-shadow: 0 2px 0 rgba(74, 50, 32, .25); }
.card:hover { background: rgba(120, 80, 30, .24); }
.card.problem { border-color: rgba(139, 26, 26, .7); color: var(--red-deep); }
.card.funded { outline: 3px solid var(--gold); outline-offset: -6px; }
.card .cost { display: flex; gap: 4px; margin-top: 6px; }
.slot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px dashed var(--ink-soft); }
.slot.full { border: 0; background: radial-gradient(circle at 38% 32%, #fff3b0, #e0b443 35%, #a87a1c 70%, #6d4c0e); box-shadow: inset 0 0 0 2px rgba(110, 76, 14, .7); }
.card .take { left: 8px; top: 10px; }

/* ===== 終わり ===== */
#end { position: absolute; inset: 0; z-index: 40; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 24px; background: rgba(5, 3, 2, .82); }
#end.open { display: flex; }
.end-doc { width: 600px; min-height: 0; text-align: center; padding: 60px 60px 70px; }
.end-doc .body.big { font-size: 34px; font-family: var(--antique); font-weight: normal; }
.end-doc .body::first-letter { float: none; font-size: 1em; margin: 0; color: inherit; }
.end-doc .date { position: static; margin-top: 12px; }
.again { font-family: var(--antique); font-size: 20px; letter-spacing: .3em; color: #e8cf8f; background: transparent; border: 1px solid rgba(201, 162, 39, .6); padding: 10px 28px; }
.again:hover { background: rgba(201, 162, 39, .15); }

.docseal { position: absolute; left: 54px; bottom: 56px; width: 46px; height: 46px; }
.node .siege { margin-top: 2px; font-family: var(--num); font-size: 15px; color: #f7e3b5; background: #8b1a1a; padding: 0 6px; border-radius: 8px; }
.smark { flex: none; width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 2.5px double currentColor; background: transparent; font-size: 15px; transform: rotate(-8deg); }
.smark.yes { color: #9c1c1c; }
.smark.no { color: #1d1a18; }
.smark:hover { background: transparent; color: inherit; transform: rotate(-8deg) scale(1.15); }
.smark.yes:hover { background: rgba(156, 28, 28, .12); }
.smark.no:hover { background: rgba(29, 26, 24, .12); }
.slip .marks { justify-content: flex-end; }

/* ===== 第二版 ===== */
#stage.jolt { animation: jolt .13s ease-out; }
@keyframes jolt { 0% { translate: 0 0 } 30% { translate: 1.5px 3px } 60% { translate: -1px -1px } 100% { translate: 0 0 } }
#glow.flare { animation: flare 1.6s ease-out; }
@keyframes flare { 0% { filter: brightness(1) } 20% { filter: brightness(2.2) saturate(1.4) } 100% { filter: brightness(1) } }
.splat { position: absolute; border-radius: 50%; background: currentColor; opacity: .7; transform: translate(-50%, -50%); }

/* 御下命 */
#goal {
  position: absolute; left: 330px; top: 262px; width: 260px; min-height: 110px; padding: 14px 16px 14px 18px; z-index: 3;
  background: url(assets/parchment.jpg) 0 0/512px, var(--parch); transform: rotate(-2.5deg);
  box-shadow: 0 8px 14px rgba(0, 0, 0, .6), inset 0 0 0 5px rgba(139, 26, 26, .14), inset 0 0 30px rgba(120, 70, 20, .4);
  clip-path: polygon(0 3%, 40% 0, 100% 2%, 98% 97%, 55% 100%, 2% 98%);
}
#goal:empty { display: none; }
#goal .gx { font-family: var(--antique); font-size: 19px; line-height: 1.4; color: var(--red-deep); padding-right: 40px; }
#goal .gp { position: relative; margin-top: 10px; height: 22px; border-bottom: 1.5px solid var(--ink-soft); }
#goal .gp span { position: relative; z-index: 1; font-family: var(--num); font-size: 19px; }
#goal .gp i { position: absolute; left: 0; bottom: 0; height: 5px; background: var(--red); opacity: .55; }
#goal .gwax { position: absolute; right: 8px; top: 8px; width: 46px; height: 46px; background: url(assets/seal_s.png) center/contain no-repeat; filter: grayscale(.7) brightness(.8); transition: filter .3s, transform .3s; }
#goal.met .gwax { filter: none; transform: scale(1.12) rotate(-8deg); }
#goal.met .gp i { background: #2f6a2a; }

/* 官吏 */
#staff { position: absolute; left: 340px; top: 395px; display: flex; gap: 12px; z-index: 4; }
.officer {
  position: relative; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 38% 32%, #4a3a26, #1e140a 75%); box-shadow: 0 5px 8px rgba(0, 0, 0, .7), inset 0 0 0 3px rgba(201, 162, 39, .55);
  color: #ecd08a; font-family: var(--antique); font-size: 26px; cursor: default;
}
.officer.vacant { background: transparent; box-shadow: inset 0 0 0 2px rgba(232, 211, 163, .18); }
.officer .tip {
  display: none; position: absolute; left: 50%; top: 64px; transform: translateX(-50%); width: 200px; padding: 8px 10px; z-index: 9;
  background: url(assets/parchment.jpg) 0 0/512px, var(--parch); color: var(--ink); font-family: var(--serif); font-size: 14px; line-height: 1.5;
  box-shadow: 0 6px 12px rgba(0, 0, 0, .6);
}
.officer:hover .tip { display: block; }

/* 私財と目 */
#purse {
  position: absolute; left: 345px; top: 468px; width: 72px; height: 80px; border: 0; z-index: 4; padding: 0;
  background: radial-gradient(ellipse at 45% 62%, #7a4e2a, #4a2c14 60%, #2a170a);
  border-radius: 46% 46% 40% 40% / 38% 38% 58% 58%; box-shadow: 0 8px 10px rgba(0, 0, 0, .65), inset 0 -6px 10px rgba(0, 0, 0, .45);
  transition: transform .15s;
}
#purse::before { content: ''; position: absolute; left: 18px; right: 18px; top: 12px; height: 4px; border-radius: 2px; background: #c9a227; opacity: .8; }
#purse span { position: absolute; left: 0; right: 0; top: 34px; text-align: center; font-family: var(--num); font-size: 20px; color: #ecd08a; }
#purse.empty span { opacity: .35; }
#purse:not(.empty):hover { transform: translateY(-3px) rotate(-3deg); }
#eye { position: absolute; left: 430px; top: 496px; width: 40px; height: 24px; z-index: 4; pointer-events: none; transition: opacity .6s; }
#eye path { fill: none; stroke: #e9d39c; stroke-width: 2.2; }
#eye circle { fill: #e9d39c; }
#eye.watch path { stroke: #e04a3a; }
#eye.watch circle { fill: #e04a3a; animation: pulse .8s infinite alternate; transform-origin: 20px 12px; }

/* インク壺 */
#inkwell { position: absolute; left: 1438px; top: 330px; width: 150px; height: 150px; border: 0; background: transparent; z-index: 3; border-radius: 50%; }
#inkwell.ready { box-shadow: 0 0 0 2px rgba(236, 208, 138, .25), 0 0 26px rgba(236, 208, 138, .35); animation: inkglow 1.6s ease-in-out infinite alternate; }
#inkwell:not(.ready) { cursor: default; }
@keyframes inkglow { to { box-shadow: 0 0 0 2px rgba(236, 208, 138, .5), 0 0 40px rgba(236, 208, 138, .55); } }

/* 書類の上の手がかり */
.pouch {
  position: absolute; right: 46px; top: 220px; width: 62px; height: 70px; border: 0; padding: 0; z-index: 3;
  background: radial-gradient(ellipse at 45% 62%, #8a5a30, #4a2c14 62%, #2a170a);
  border-radius: 46% 46% 40% 40% / 38% 38% 58% 58%; box-shadow: 0 8px 10px rgba(0, 0, 0, .5), inset 0 -6px 10px rgba(0, 0, 0, .45);
  transform: rotate(10deg); transition: transform .15s;
}
.pouch::before { content: ''; position: absolute; left: 16px; right: 16px; top: 10px; height: 4px; border-radius: 2px; background: #c9a227; }
.pouch span { position: absolute; left: 0; right: 0; top: 28px; font-family: var(--num); font-size: 18px; color: #ecd08a; }
.pouch:hover { transform: rotate(4deg) translateY(-4px); }
.pouch.taken { animation: grab .45s ease-in forwards; }
@keyframes grab { to { transform: translate(-500px, 200px) scale(.4); opacity: 0; } }
.loupe { position: absolute; left: -16px; top: -16px; width: 124px; height: 124px; border-radius: 50%; border: 5px solid #6b4a1e; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); }
.loupe::after { content: ''; position: absolute; right: -30px; bottom: -14px; width: 42px; height: 10px; background: #4a2c14; transform: rotate(40deg); border-radius: 4px; }
.testimony.circled::after { content: ''; position: absolute; inset: -8px -10px; border: 3px solid rgba(156, 28, 28, .75); border-radius: 50%; transform: rotate(-3deg); pointer-events: none; }
.pencil { margin-top: 6px; font-size: 16px; font-weight: 500; color: #5a5a5a; font-style: italic; transform: rotate(-2deg); }
.spynote { display: inline-block; margin-top: 12px; padding: 2px 10px; font-family: var(--antique); font-size: 18px; color: #e8d3a3; background: #1e140a; transform: rotate(-4deg); box-shadow: 0 3px 6px rgba(0, 0, 0, .4); }
.unmask {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%) rotate(-12deg); z-index: 5; pointer-events: none;
  font-family: var(--antique); font-size: 92px; color: #a01818; border: 8px double #a01818; padding: 0 22px; mix-blend-mode: multiply; opacity: .9;
  animation: unmask .35s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes unmask { from { transform: translate(-50%, -50%) rotate(-12deg) scale(2.4); opacity: 0; } }
.flycoin { position: fixed; z-index: 120; width: 26px; height: 26px; pointer-events: none; animation: flycoin 1s cubic-bezier(.5, -0.4, .6, 1) forwards; }
@keyframes flycoin { to { transform: translate(var(--dx), var(--dy)) scale(.6); opacity: .2; } }

/* 帳簿の機嫌 */
#ledger .sealrow em { margin-left: auto; font-style: normal; font-family: var(--antique); font-size: 16px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
#ledger .sealrow em.grudge { color: #f7e3b5; background: #5e0f0f; }
#ledger .sealrow em.grace { color: #3d2a10; background: #d9b44a; }

/* 予算の御下命 */
.goalres { text-align: center; font-family: var(--antique); font-size: 17px; margin: -4px 0 10px; }
.goalres.ok { color: #2f6a2a; }
.goalres.ng { color: var(--red); }

/* 登用 */
#hire { position: absolute; inset: 0; z-index: 32; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: rgba(8, 5, 3, .72); }
#hire.open { display: flex; }
.hire-doc { width: 980px; min-height: 0; padding: 40px 50px 50px; }
.hire-doc .from { text-align: center; font-size: 24px; letter-spacing: .3em; color: var(--red-deep); }
.cands { display: flex; gap: 22px; justify-content: center; margin-top: 10px; }
.cand {
  width: 260px; padding: 18px 16px 16px; border: 1.5px solid rgba(74, 50, 32, .55); background: rgba(120, 80, 30, .12); color: var(--ink); text-align: center;
  transition: transform .15s, background .15s;
}
.cand:hover { transform: translateY(-6px); background: rgba(120, 80, 30, .24); }
.cand b { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 50%; font-family: var(--antique); font-weight: normal; font-size: 36px; color: #ecd08a; background: radial-gradient(circle at 38% 32%, #4a3a26, #1e140a 75%); box-shadow: inset 0 0 0 3px rgba(201, 162, 39, .55); }
.cand .cn { font-family: var(--antique); font-size: 22px; }
.cand .ct { font-size: 15px; font-weight: 700; margin-top: 6px; min-height: 44px; }
.cand .cw { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.hirenote { text-align: center; margin-top: 14px; font-size: 15px; color: var(--red); }

/* 結末の帳簿 */
.endledger { margin: 18px auto 0; border-collapse: collapse; font-size: 17px; }
.endledger td { padding: 4px 18px; border-bottom: 1px solid rgba(74, 50, 32, .3); }
.endledger td:first-child { font-family: var(--antique); text-align: left; }
.endledger td:last-child { font-family: var(--num); text-align: right; font-size: 19px; }

/* ===== 公開向け ===== */
#menu { position: absolute; inset: 0; z-index: 45; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 20px; background: rgba(8, 5, 3, .7); }
#menu.open { display: flex; }
.menu-doc { width: 520px; min-height: 0; padding: 40px 56px 46px; }
.menu-doc .from { text-align: center; font-size: 22px; letter-spacing: .3em; }
.mrow { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid rgba(74, 50, 32, .3); font-family: var(--antique); font-size: 20px; }
.mrow input[type=range] { width: 220px; accent-color: #8b1a1a; }
.mbtn { font-family: var(--antique); font-size: 18px; min-width: 120px; padding: 6px 16px; color: var(--ink); background: rgba(120, 80, 30, .12); border: 1.5px solid rgba(74, 50, 32, .55); }
.mbtn:hover { background: rgba(120, 80, 30, .25); }
.mbtn.danger { color: var(--red-deep); border-color: rgba(139, 26, 26, .6); }
.resume-acts { display: flex; gap: 18px; }
.resume-doc .body.big { font-size: 30px; }
.repute { text-align: center; font-family: var(--antique); font-size: 16px; color: var(--ink-soft); margin: -4px 0 8px; letter-spacing: .1em; }
.officer.show .tip { display: block; }
#turn { display: none; }
@media (orientation: portrait) and (max-width: 900px) {
  #turn { display: grid; place-items: center; position: fixed; inset: 0; z-index: 999; background: #0c0805; }
  #turn svg { width: 120px; height: 120px; fill: none; stroke: #e8cf8f; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; animation: tilt 1.8s ease-in-out infinite; }
}
@keyframes tilt { 0%, 30% { transform: rotate(0) } 60%, 100% { transform: rotate(-90deg) } }

/* ===== 英語版 ===== */
html[lang=en] { --serif: 'IM Fell English', Georgia, serif; --antique: 'IM Fell English', Georgia, serif; }
html[lang=en] body, html[lang=en] .doc .body, html[lang=en] .opt, html[lang=en] .card, html[lang=en] .cand .ct, html[lang=en] .testimony { font-weight: normal; }
html[lang=en] .doc { font-size: 24px; line-height: 1.45; }
html[lang=en] .doc .body::first-letter { font-size: 2.3em; margin: 4px 6px 0 0; }
html[lang=en] .pile .tag { font-size: 15px; letter-spacing: .02em; }
html[lang=en] #pending .ph { letter-spacing: .12em; }
html[lang=en] #pending li { font-size: 16px; }
html[lang=en] #ledger td:first-child { letter-spacing: 0; font-size: 17px; }
html[lang=en] #ledger .ribbon { font-size: 11px; padding-top: 12px; width: 44px; }
html[lang=en] .stampmark { font-size: 27px; letter-spacing: 0; }
html[lang=en] .stamp span { font-size: 15px; }
html[lang=en] .unmask { font-size: 64px; letter-spacing: .04em; }
html[lang=en] .officer b { font-size: 21px; }
html[lang=en] .cand b { font-size: 30px; }
html[lang=en] #goal .gx { font-size: 20px; }
html[lang=en] .slip { font-size: 15px; line-height: 1.3; }
html[lang=en] .slip .sfrom { font-size: 13px; font-style: italic; }
html[lang=en] .smark { font-size: 13px; }
html[lang=en] .mark, html[lang=en] .mrow { letter-spacing: 0; }
html[lang=en] .dish .dn { letter-spacing: .04em; }
html[lang=en] .budget-doc .from, html[lang=en] .hire-doc .from { letter-spacing: .08em; }
html[lang=en] .doc.royal .from { letter-spacing: .15em; }
html[lang=en] #date { letter-spacing: .04em; font-size: 20px; }
html[lang=en] .node .nm { font-size: 18px; }
html[lang=en] .end-doc .body.big { font-size: 34px; font-style: italic; }
.doc.kind-law .pouch { top: auto; bottom: 16px; right: 66px; }

/* ===== 第三版: 過労 ===== */
#fatigue { position: relative; width: 110px; height: 10px; border-radius: 5px; background: rgba(20, 12, 6, .75); box-shadow: inset 0 0 0 1px rgba(232, 207, 143, .35); overflow: hidden; }
#fatigue i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #d9c48f, #e0a040 60%, #c02a2a); background-size: 110px 100%; transition: width .3s; }
#fatigue.high { animation: shake .35s infinite; }
#bedbtn {
  display: none; width: 40px; height: 34px; border-radius: 17px; border: 1px solid rgba(201, 162, 39, .6);
  background: radial-gradient(circle at 40% 35%, #2a3350, #0d1020); box-shadow: 0 3px 8px rgba(0, 0, 0, .6);
}
#bedbtn::before { content: ''; display: block; width: 14px; height: 14px; margin: auto; border-radius: 50%; box-shadow: -4px 2px 0 0 #e8cf8f; transform: translateX(3px); }
#bedbtn.show { display: block; animation: pulse 1.2s infinite alternate; }

#tea {
  position: absolute; left: 1468px; top: 505px; width: 74px; height: 62px; border: 0; padding: 0; z-index: 3; background: none;
}
#tea::before { /* 椀 */
  content: ''; position: absolute; left: 6px; right: 6px; bottom: 6px; height: 34px; border-radius: 6px 6px 30px 30px;
  background: radial-gradient(ellipse at 40% 20%, #8a5a30, #4a2c14 70%); box-shadow: 0 8px 10px rgba(0, 0, 0, .6), inset 0 6px 0 -2px #2a170a;
}
#tea::after { /* 受け皿 */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; border-radius: 50%; background: #3a2412; box-shadow: 0 4px 6px rgba(0, 0, 0, .5);
}
#tea .steam { position: absolute; left: 50%; top: -14px; width: 20px; height: 30px; transform: translateX(-50%); opacity: 0; }
#tea.ready .steam { opacity: 1; background: radial-gradient(ellipse at 50% 80%, rgba(255, 255, 255, .45), transparent 60%); filter: blur(3px); animation: steam 2.4s ease-in-out infinite; }
#tea:not(.ready) { cursor: default; filter: brightness(.7); }
@keyframes steam { 0% { transform: translate(-50%, 6px) scaleY(.6); opacity: 0 } 40% { opacity: .9 } 100% { transform: translate(-40%, -14px) scaleY(1.2); opacity: 0 } }

#tiredfx { position: absolute; inset: 0; pointer-events: none; z-index: 8; opacity: calc(var(--tired, 0) * var(--tired, 0)); background: radial-gradient(ellipse 70% 65% at 50% 52%, transparent 45%, rgba(40, 0, 0, .7) 100%); }
#night {
  position: absolute; inset: 0; pointer-events: none; z-index: 9; opacity: calc(var(--dark, 0) * .9);
  background: radial-gradient(circle at 87% 12%, rgba(255, 170, 70, .08) 0, transparent 14%), radial-gradient(ellipse 60% 55% at 55% 55%, rgba(6, 8, 22, .25), rgba(6, 8, 22, .72) 100%);
  transition: opacity .4s;
}
#night.asleep { opacity: 1; z-index: 26; pointer-events: auto; background: rgba(4, 5, 14, .93); }
#night.asleep::after {
  content: ''; position: absolute; left: 50%; top: 42%; width: 90px; height: 90px; border-radius: 50%; transform: translate(-50%, -50%);
  box-shadow: -18px 10px 0 0 #e8cf8f; animation: pulse 1.6s infinite alternate;
}
#night.fainted { background: rgba(26, 4, 4, .95); }
#night.fainted::after { box-shadow: none; border: 3px solid rgba(232, 207, 143, .4); width: 60px; height: 60px; }

#dusk { position: absolute; inset: 0; z-index: 27; display: none; align-items: center; justify-content: center; gap: 70px; background: rgba(6, 6, 16, .55); }
#dusk.open { display: flex; animation: docin .4s ease-out; }
#dusk .duskinfo { position: absolute; top: 210px; left: 50%; transform: translateX(-50%); width: 120px; height: 120px; display: grid; place-items: center;
  background: url(assets/parchment.jpg) 0 0/512px, var(--parch); clip-path: polygon(0 4%, 100% 0, 97% 100%, 3% 96%); box-shadow: 0 8px 14px rgba(0, 0, 0, .6); }
#dusk .duskinfo b { font-family: var(--num); font-size: 54px; font-weight: normal; color: var(--red-deep); }
#dusk .choice { width: 230px; height: 250px; margin-top: 180px; border: 1.5px solid rgba(201, 162, 39, .55); background: rgba(20, 14, 8, .85); color: #e8cf8f;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; font-family: var(--antique); font-size: 26px; letter-spacing: .1em; transition: transform .15s, background .15s; }
#dusk .choice:hover { transform: translateY(-6px); background: rgba(40, 28, 14, .92); }
#dusk .choice i { display: block; width: 90px; height: 90px; }
#dusk .bed i { border-radius: 50%; box-shadow: -22px 12px 0 0 #e8cf8f; transform: translateX(14px); }
#dusk .candle i { width: 26px; height: 90px; background: linear-gradient(90deg, #d8c79c, #fff2cf 45%, #c9b688); border-radius: 4px; position: relative; box-shadow: 0 0 40px rgba(255, 180, 80, .6); }
#dusk .candle i::before { content: ''; position: absolute; left: 50%; top: -30px; width: 18px; height: 28px; transform: translateX(-50%); border-radius: 50% 50% 45% 45%;
  background: radial-gradient(ellipse at 50% 70%, #fff8d0, #ffb43c 55%, transparent 72%); animation: flame .18s infinite alternate; }

/* 手の震えと、かすむ文字 */
#stage.trembling .stamp, #stage.trembling .smark, #stage.trembling .opt, #stage.trembling .qa { animation: tremor .16s infinite alternate !important; }
@keyframes tremor { from { translate: calc(var(--trem) * -5px) calc(var(--trem) * 3px); } to { translate: calc(var(--trem) * 5px) calc(var(--trem) * -4px); } }
#focus .doc .body, #pending ul, #ledger table { filter: blur(var(--blur, 0px)); }
.postscript { margin-top: 12px; font-style: italic; color: var(--ink-soft); font-size: 18px; }
html[lang=en] #dusk .choice { font-size: 22px; letter-spacing: .02em; }
.end-doc { width: 760px; padding: 44px 56px 50px; }
.endledger { display: grid; grid-template-columns: 1fr 1fr; column-gap: 34px; margin-top: 12px; }
.endledger tbody { display: contents; }
.endledger tr { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(74, 50, 32, .3); }
.endledger td { border: 0; padding: 4px 4px; font-size: 16px; }
.wax.big { width: 110px; height: 110px; margin-top: 14px; }

/* ===== 第四版: 分かりやすさ ===== */
/* 印の見比べ */
.sealcmp { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 16px; }
.sealcol { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 14px 8px; border: 1px solid rgba(74, 50, 32, .35); background: rgba(255, 245, 220, .22); }
.sealcol span { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.sealcol.mine { border-color: rgba(139, 26, 26, .45); }
.sealcol .loupe { left: -6px; top: -6px; width: 108px; height: 108px; }
.vs { font-size: 26px; color: var(--ink-soft); }
/* 訴訟 */
.doc .filed { margin-top: 8px; font-size: 15px; }
.doc .filed span { color: var(--ink-soft); }
.doc .filed b { font-size: 18px; color: var(--red-deep); border-bottom: 2px solid rgba(139, 26, 26, .5); }
.noseal { position: absolute; left: 52px; bottom: 20px; font-size: 13px; color: var(--red); }
/* 正誤の知らせ */
.toast {
  position: absolute; left: 50%; top: 92px; transform: translateX(-50%); z-index: 50; min-width: 300px; max-width: 560px; padding: 10px 22px 12px; text-align: center;
  background: url(assets/parchment.jpg) 0 0/512px, var(--parch); box-shadow: 0 10px 20px rgba(0, 0, 0, .65); color: var(--ink);
  clip-path: polygon(0 6%, 100% 0, 98% 94%, 2% 100%); animation: toastin .3s ease-out; pointer-events: none;
}
.toast b { display: block; font-family: var(--antique); font-weight: normal; font-size: 22px; }
.toast span { display: block; font-size: 16px; margin-top: 2px; }
.toast em { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.toast.good b { color: #2f6a2a; }
.toast.bad b { color: var(--red); }
.toast.out { transition: opacity .6s, transform .6s; opacity: 0; transform: translate(-50%, -10px); }
@keyframes toastin { from { transform: translate(-50%, -20px); opacity: 0; } }
/* 手引きの付箋 */
.coach {
  position: absolute; z-index: 70; width: 340px; padding: 14px 16px 12px; color: var(--ink);
  background: #f3e2b8 url(assets/parchment.jpg) 0 0/512px; box-shadow: 0 14px 28px rgba(0, 0, 0, .75), 0 0 0 2px rgba(139, 26, 26, .55);
  animation: toastin .25s ease-out; font-size: 16px; line-height: 1.55;
}
.coach::before { content: ''; position: absolute; left: var(--ax, 170px); width: 18px; height: 18px; background: #f3e2b8; transform: translateX(-50%) rotate(45deg); box-shadow: -2px -2px 0 0 rgba(139, 26, 26, .55); }
.coach.below::before { top: -9px; }
.coach.above::before { bottom: -9px; box-shadow: 2px 2px 0 0 rgba(139, 26, 26, .55); }
.coach .ct { font-weight: 700; }
html[lang=en] .coach .ct { font-weight: normal; font-size: 17px; }
.coach button { display: block; margin: 10px 0 0 auto; font-family: var(--antique); font-size: 15px; padding: 4px 16px; color: #f7e3b5; background: var(--red-deep); border: 0; }
.coachring { position: absolute; z-index: 69; border: 3px solid rgba(224, 160, 64, .9); border-radius: 10px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); animation: pulse .8s infinite alternate; }
/* 手引きの頁 */
.help-doc { width: 760px; max-height: 820px; min-height: 0; padding: 36px 50px 40px; overflow-y: auto; }
.help-doc .from { text-align: center; font-size: 24px; letter-spacing: .3em; }
.helpbody { font-size: 15px; line-height: 1.6; font-weight: 500; }
.helpbody h4 { margin: 12px 0 2px; font-family: var(--antique); font-weight: normal; font-size: 18px; color: var(--red-deep); }
.helpbody p { margin: 0; }
html[lang=en] .helpbody { font-size: 17px; font-weight: normal; }
/* 軍の命令 */
#armypanel { position: absolute; left: 18px; bottom: 18px; width: 330px; padding: 14px 16px; z-index: 6; color: var(--ink);
  background: url(assets/parchment.jpg) 0 0/512px, var(--parch); box-shadow: 0 10px 20px rgba(0, 0, 0, .6), inset 0 0 0 2px rgba(139, 26, 26, .25); }
#armypanel .ap-hint { font-family: var(--antique); font-size: 16px; }
#armypanel .ap-name { font-family: var(--antique); font-size: 22px; color: var(--red-deep); }
#armypanel .ap-men { font-family: var(--num); font-size: 30px; line-height: 1; }
#armypanel .ap-men small { font-size: 15px; margin-left: 4px; }
#armypanel .ap-st { font-size: 15px; font-weight: 700; margin-top: 4px; }
#armypanel .ap-note { font-size: 13px; color: var(--ink-soft); margin: 2px 0 8px; }
#armypanel .ap-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#armypanel .ap-btns .mbtn { min-width: 0; font-size: 14px; padding: 6px 6px; }
#armypanel .ap-btns .mbtn:first-child { grid-column: 1 / 3; background: rgba(139, 26, 26, .15); }
#armypanel .mbtn:disabled { opacity: .35; cursor: default; }
.token.own.sel { box-shadow: 0 0 0 4px #f0d27a, 0 6px 10px rgba(0, 0, 0, .6); }
.node.pickable .mark { animation: pulse .6s infinite alternate; border-color: #c02a2a; background: rgba(240, 210, 122, .9); cursor: pointer; }
.node.pickable { cursor: pointer; z-index: 3; }
.node.pickable .nm { color: var(--red-deep); }
.node .gar { margin-top: 1px; font-family: var(--num); font-size: 13px; color: var(--ink); background: rgba(232, 211, 163, .85); padding: 0 5px; border-radius: 6px; }
/* 書状の説明 */
.opt .ol { display: flex; flex-direction: column; }
.opt .ol small { font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-top: 2px; }
/* 帳簿の内訳と見込み */
#ledger:hover { z-index: 7; }
#ledger td.bar { position: relative; }
.stip { display: none; position: absolute; left: -200px; bottom: 26px; width: 330px; z-index: 9; padding: 9px 12px; font-size: 14px; line-height: 1.5; font-family: var(--serif); color: var(--ink);
  background: #f3e2b8; box-shadow: 0 8px 16px rgba(0, 0, 0, .6); }
#ledger .page.left tr:hover .stip { display: block; }
#ledger .page.left tr:hover td { color: var(--red-deep); }
#ledger tr.fc td { border: 0; padding-top: 8px; font-family: var(--antique); font-size: 15px; color: var(--ink-soft); }
#ledger tr.hl td { background: rgba(224, 160, 64, .35); }
#ledger tr.hl td.num { color: var(--red-deep); font-size: 21px; }

/* ===== 第五版 ===== */
#inkwell.locked, #mapscroll.locked, #purse.locked, #eye.locked, #staff.locked, #tea.locked { display: none; }
#coins.market { pointer-events: auto; cursor: pointer; }
#coins.market:hover { filter: drop-shadow(0 0 10px rgba(240, 210, 122, .8)) drop-shadow(0 6px 6px rgba(0, 0, 0, .6)); }
#staff { top: 410px; }
#purse { top: 482px; }
#eye { top: 510px; }
#goal .standing { margin-top: 8px; font-size: 14px; color: var(--ink-soft); }
#goal .standing b { font-family: var(--antique); font-weight: normal; font-size: 17px; color: var(--red-deep); }
.ifgrant { margin-top: 10px; font-size: 16px; font-weight: 500; color: var(--ink-soft); }
.bdetail { margin-top: 8px; font-size: 15px; font-weight: 500; color: var(--ink-soft); }
#armypanel .ap-est { margin-top: 10px; border-top: 1px solid rgba(74, 50, 32, .35); padding-top: 6px; }
#armypanel .ap-esth { font-size: 12px; color: var(--ink-soft); }
#armypanel .ap-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; padding: 2px 0; }
#armypanel .ap-row small { margin-left: 6px; font-size: 11px; color: var(--ink-soft); }
#armypanel .ap-row b { font-family: var(--num); font-weight: normal; font-size: 18px; }
#armypanel .ap-row b.hi { color: #2f6a2a; }
#armypanel .ap-row b.mid { color: #8a6a12; }
#armypanel .ap-row b.lo { color: var(--red); }

/* ===== 第六版 ===== */
.appoint-doc { width: 780px; }
.appoint-doc .body.big { font-size: 26px; margin-bottom: 14px; }
.scns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; }
.scn { padding: 14px 16px; border: 1.5px solid rgba(74, 50, 32, .55); background: rgba(120, 80, 30, .1); color: var(--ink); transition: transform .15s, background .15s; }
.scn:hover:not(:disabled) { transform: translateY(-3px); background: rgba(139, 26, 26, .12); border-color: rgba(139, 26, 26, .7); }
.scn b { display: block; font-family: var(--antique); font-weight: normal; font-size: 21px; color: var(--red-deep); }
.scn span { display: block; font-size: 14px; font-weight: 500; margin-top: 4px; }
.scn em { display: block; font-size: 13px; font-style: normal; color: #2f6a2a; margin-top: 4px; }
.scn.lockedscn { opacity: .5; cursor: default; }
.scn.lockedscn b { color: var(--ink-soft); }
.appoint-doc .wax.big { width: 90px; height: 90px; margin-top: 16px; }
.recsum { text-align: center; font-family: var(--antique); font-size: 18px; margin: 6px 0 14px; }
.achs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.ach { display: grid; grid-template-columns: 22px 1fr; column-gap: 6px; opacity: .45; }
.ach.got { opacity: 1; }
.ach i { grid-row: span 2; font-style: normal; font-size: 18px; color: var(--red-deep); }
.ach b { font-family: var(--antique); font-weight: normal; font-size: 17px; }
.ach span { font-size: 13px; color: var(--ink-soft); }
.toast.ach b { color: #8a6a12; }
.toast.ach { box-shadow: 0 10px 20px rgba(0, 0, 0, .65), inset 0 0 0 2px rgba(201, 162, 39, .7); }
html[lang=en] .scn span, html[lang=en] .ach span { font-weight: normal; font-size: 15px; }

.toast.low { top: auto; bottom: 28px; }

/* ===== 第七版: 金貨が動く予算・借財・結末 ===== */
.budget-doc { width: 1120px; }
.purse { flex-wrap: wrap; }
.purse .debtnow { font-size: 16px; font-weight: 500; line-height: 1.5; margin-left: 18px; text-align: left; }
.purse .debtnow b { font-family: var(--num); font-size: 22px; font-weight: normal; }
.coinstack { min-width: 40px; min-height: 40px; }
.coinstack .coin { animation: drop .25s; }
.coin.flying { position: fixed; z-index: 80; pointer-events: none; animation: coinfly .38s cubic-bezier(.35, .1, .3, 1) forwards; }
@keyframes coinfly {
  50% { transform: translate(calc(var(--dx) * .5), calc(var(--dy) * .5 - 70px)) scale(1.2) rotate(-90deg); }
  to { transform: translate(var(--dx), var(--dy)) scale(.8) rotate(-200deg); }
}
.bump { animation: bump .22s; }
@keyframes bump { 40% { transform: scale(1.08) translateY(3px); } }
.dish .dfx { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.dish.repay .plate { background: radial-gradient(ellipse at 50% 40%, #8c3a2a, #5e1f14 60%, #2e0e08); }
.dish.repay .dn { color: var(--red-deep); }
.bpreview { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; margin-top: 18px; min-height: 26px; font-size: 17px; font-weight: 700; }
.bpreview .neg { color: var(--red); }
.bpreview .none { font-weight: 500; color: var(--ink-soft); font-size: 15px; }
.acct .bad { color: var(--red); }
#ledger tr.debtrow td { color: var(--red-deep); }
#ledger .dmarks { font-size: 14px; letter-spacing: .15em; color: var(--red); }
.endkind { position: absolute; top: 20px; right: 54px; font-family: var(--antique); font-size: 15px; letter-spacing: .15em; color: var(--red); }
.endsub { margin-top: 10px; font-size: 18px; font-weight: 500; color: var(--ink-soft); }
.recsum .unseen { color: var(--ink-soft); opacity: .6; }
/* 借財の行が増えたぶん、左の頁を詰める */
#ledger .page.left td { padding: 2px 2px; }
#ledger .page.left td.num { font-size: 20px; }
#ledger .page.left tr.fc td { padding-top: 4px; font-size: 13px; border-bottom: 0; }
