* { box-sizing: border-box; }
:root { --orange: #ff8a3d; --ink: #294535; --paper: #fff7e3; --blue: #80c6e2; }
body { margin: 0; background: #8ace9a; color: var(--ink); font: 15px/1.55 system-ui, 'PingFang SC', sans-serif; }
[hidden] { display: none !important; }
.page { min-height: 100vh; min-height: 100dvh; overflow: auto; padding: max(12px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom)); background: linear-gradient(#80c6e2, #90cf7b 620px, #90cf7b); }
main { max-width: 500px; margin: 0 auto; }
.folio { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.folio span, .folio b { border-radius: 20px; padding: 5px 11px; background: var(--paper); font-size: 12px; font-weight: 800; }
.folio b { background: #e6f5ff; color: #245579; }
.village { position: relative; width: min(100%, 370px); aspect-ratio: 370 / 270; margin: 8px auto 2px; overflow: hidden; }
.village img { position: absolute; display: block; width: 105.4054%; max-width: none; left: -2.7027%; top: -69.63%; }
.village.fallback img { width: 100%; height: 100%; left: 0; top: 0; object-fit: cover; }
.paper { margin: 9px 0; padding: 11px 14px; background: var(--paper); border-radius: 15px; }
.cap, .chapter, .rule { color: #795026; font-size: 12px; font-weight: 750; }
.chapter { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; }
h1, h2 { margin: 4px 0; font-size: 22px; line-height: 1.3; }
#attrs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 5px 0; }
#attrs > span { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 4px; border-radius: 8px; background: #f8e9c5; padding: 3px 7px; align-items: baseline; font-size: 12px; }
#attrs > span:nth-child(2) { background: #dceef9; }
#attrs > span:nth-child(3) { background: #e4ecd4; }
#attrs b { font-size: 17px; }
p { margin: 5px 0; }
#memory, #echo, .entry p { font-size: 13px; }
#memory, #echo { color: #485c48; }
#echo:empty, .chapter:empty { display: none; }
#echo:not(:empty) { padding: 5px 8px; background: #edf1d9; border-radius: 8px; }
.rule { margin: 9px 0 5px; }
#choices { display: grid; gap: 6px; }
button, summary { font: inherit; cursor: pointer; touch-action: manipulation; }
button { border: 0; font-weight: 750; }
.choice { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 8px 10px; border-radius: 12px; text-align: left; background: #d9ebf8; color: #183b56; }
.choice:first-child { background: var(--orange); color: #3a2414; }
.choice:nth-child(3) { background: #e2ecce; color: #284627; }
.choice i { min-width: 22px; text-align: center; border-radius: 6px; background: #ffffffb5; font-size: 12px; font-style: normal; }
.choice em { font-size: 11px; font-style: normal; text-align: right; }
.choice span { overflow-wrap: anywhere; }
.choice:active, .tools button:active { filter: brightness(.93); }
summary { min-height: 32px; padding: 4px 0; font-weight: 750; }
summary small { float: right; }
ol { padding-left: 22px; margin: 4px 0; font-size: 13px; }
li { margin: 5px 0; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.tools button { min-height: 48px; padding: 8px; border-radius: 14px; background: #357640; color: white; }
.tools button + button { background: #7452a3; }
dialog { color: inherit; width: min(92%, 450px); max-height: 82vh; padding: 16px; border: 0; border-radius: 15px; background: var(--paper); overflow: auto; }
dialog::backdrop { background: #17392eba; }
dialog form { float: right; margin: 0 0 6px 6px; }
dialog form button { background: #f2e4bf; color: var(--ink); width: 44px; height: 44px; border-radius: 50%; }
#panelBody { clear: both; }
.entry { padding: 8px 0; border-bottom: 1px solid #daccad; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: start; }
.grid .entry { padding: 8px; border: 1px solid #dac8a4; background: #ffedcb; border-radius: 8px; }
.grid .locked { min-height: 90px; display: grid; place-items: center; align-content: center; gap: 6px; border-style: dashed; background: transparent; color: #615b49; }
.sigil { width: 22px; height: 28px; border: 1px solid currentColor; border-radius: 8px 8px 3px 3px; }
button:focus-visible, summary:focus-visible { outline: 3px solid #154e76; outline-offset: 2px; }
@media (max-height: 760px) { .village { width: min(100%, 268px); } }
