:root{color-scheme:dark;--lacquer:#160f0c;--lacquer-2:#241610;--gold:#e4c57a;--gold-deep:#8d6730;--ink:#f6efe2;--muted:#cbb892;--red:#8d2c28}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:#100c09;color:var(--ink);font:15px "Sarabun","Thonburi",sans-serif}
canvas{display:block;width:100%;height:100%}
button{font:inherit;color:var(--ink);background:linear-gradient(#3a2418,#24160f);border:1px solid var(--gold-deep);border-radius:2px;padding:7px 11px;cursor:pointer;box-shadow:inset 0 0 0 1px #e4c57a33}
button:hover{background:linear-gradient(#5a3424,#321c14)}
button.on{background:linear-gradient(#a33b32,#6e221e);color:#fff6df;border-color:var(--gold)}
button:focus-visible{outline:2px solid var(--gold);outline-offset:3px}
header,footer{position:fixed;display:flex;pointer-events:none}
header{top:16px;left:16px;flex-direction:column;align-items:flex-start;gap:8px;width:188px}
footer{left:0;right:0;bottom:14px;flex-direction:column;align-items:center;gap:0}
.brand,.resources,.dock,#seasonbar,#post,#person,#ambient,#trade,#tech,#wallGuide,#tools,#status,#goods,#help{
  background:
    linear-gradient(180deg,#2a1a12f2,#140e0bf2) padding-box,
    linear-gradient(135deg,#f3e0a4,#8d6730 45%,#f3e0a4) border-box;
  border:1px solid transparent;
  box-shadow:inset 0 0 0 1px #5c3e22,inset 0 0 0 4px #140e0c,inset 0 0 0 5px #c4a15a88}
.brand{padding:8px 12px;border-left:4px solid var(--red);width:100%}
.brand b{display:block;font-family:"Ayuthaya","Thonburi","Sarabun",serif;font-size:18px;font-weight:400;letter-spacing:.04em;color:var(--gold)}
.brand small{color:var(--muted)}
.resources{display:flex;flex-direction:column;gap:0;width:100%;margin:0;padding:6px 8px;pointer-events:auto}
.resources span{display:flex;flex-direction:row;align-items:center;gap:8px;font-size:12px;color:var(--muted);padding:4px 4px;min-width:0}
.resources span+span{box-shadow:inset 0 1px 0 #c4a15a55}
.resources small{width:58px}
.resources b{margin-left:auto;display:block;color:var(--gold);font-size:14px;font-weight:600;line-height:1.15}
.res-ico{width:16px;height:16px;display:block;flex:none}
.dock{display:grid;grid-template-columns:1fr 1fr;gap:6px;width:100%;padding:8px;pointer-events:auto}
.dock button{font-size:12px;padding:6px 4px}
#tribute{background:linear-gradient(#8d2c28,#5c1c1a);border-color:var(--gold);color:#fff6df}
#debugFill,#debugMonth{width:100%;pointer-events:auto;font-size:12px;padding:6px 8px}
#seasonbar{position:fixed;top:16px;left:50%;transform:translateX(-50%);z-index:3;display:flex;align-items:center;gap:10px;padding:8px 12px;pointer-events:auto;max-width:min(720px,calc(100vw - 460px))}
#seasonbar>b{font-family:"Ayuthaya","Thonburi","Sarabun",serif;font-weight:400;color:var(--gold);white-space:nowrap}
#clock{font-size:12px;color:var(--muted);white-space:nowrap}
#year{display:flex;gap:3px;width:148px;height:10px}
#year i{flex:1;display:block;border-radius:1px;background:#3a2c24}
#year i.cool{background:#7f92a4}
#year i.hot{background:#c4a36a}
#year i.rain{background:#6e93a8}
#year i.on{outline:1px solid var(--gold);outline-offset:1px;filter:brightness(1.35)}
.speeds{display:flex;gap:4px}
.speeds button,#nightBtn{padding:5px 8px;font-size:12px}
#objective{margin:0;flex-basis:100%;font-size:12px;line-height:1.4;color:#ddd2bc;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#status{position:fixed;top:auto;bottom:112px;right:16px;transform:none;z-index:5;margin:0;max-width:240px;padding:10px 14px;font-size:13px;line-height:1.45;color:#f6efe2;pointer-events:none}
#post,#person{position:fixed;right:16px;top:92px;left:auto;z-index:2;display:flex;flex-direction:column;gap:8px;min-width:220px;max-height:calc(100vh - 340px);overflow:auto;padding:14px;pointer-events:auto}
#post[hidden],#person[hidden]{display:none}
#post b,#person>b{font-family:"Ayuthaya","Thonburi","Sarabun",serif;font-size:18px;font-weight:400;color:var(--gold)}
#post .row{display:flex;align-items:center;gap:8px}
#post .row[hidden],#staffRow[hidden]{display:none}
#post .row span{flex:1}
#post button{width:32px;height:28px;padding:0}
#buffaloRow{flex-direction:column;align-items:stretch;gap:6px}
#buffaloRow>.row{width:100%}
#postStock{display:flex;flex-direction:column}
#postStock[hidden]{display:none}
#postStock span{display:flex;align-items:center;gap:8px;padding:3px 0;font-size:13px;color:var(--muted)}
#postStock small{width:auto;color:var(--muted)}
#postStock b{margin-left:auto;color:var(--gold);font-size:14px;font-weight:600;font-family:inherit}
#postNote{display:flex;flex-direction:column;gap:4px;color:var(--muted);font-size:13px;line-height:1.4}
#postNote p{margin:0}
#post #upgradeHouse,#post #cutArea,#post #holdFestival,#post #holdSongkran{width:100%;height:auto;padding:8px 10px;line-height:1.4}
#upgradeHouse[hidden],#cutArea[hidden]{display:none}
#wallRow{display:flex;flex-direction:column;gap:6px}
#wallRow[hidden]{display:none}
#wallRow button{width:100%;height:auto;padding:7px 8px}
#wallGuide{position:fixed;right:16px;bottom:120px;top:auto;z-index:2;width:250px;padding:12px 14px;line-height:1.55;pointer-events:none}
#wallGuide[hidden]{display:none}
#wallGuide b.on{color:var(--gold)}
#wallGuide .short{color:#e7a09a}
#wallGuide kbd{display:inline-block;min-width:1.2em;margin-right:3px;padding:0 4px;border:1px solid var(--gold-deep);border-radius:2px;text-align:center}
#postNote,#post small{color:var(--muted);line-height:1.45}
#person{min-width:180px}
#person button{width:100%}
#trade{position:fixed;top:120px;right:24px;z-index:4;display:flex;flex-direction:column;gap:8px;width:min(420px,92vw);max-height:calc(100vh - 220px);overflow:auto;padding:14px;pointer-events:auto}
#trade[hidden]{display:none}
#trade b{font-family:"Ayuthaya","Thonburi","Sarabun",serif;font-size:18px;font-weight:400;color:var(--gold)}
#trade small{color:var(--muted);line-height:1.5}
#tradeRows{display:flex;flex-direction:column;gap:4px}
#tradeRows>b{margin-top:8px}
#trade .row{display:flex;align-items:center;gap:6px}
#trade .row span{flex:1;font-size:12px;line-height:1.4}
#trade .row button{padding:6px 8px}
#trade input{width:64px;color:var(--ink);background:#24160f;border:1px solid var(--gold-deep);padding:4px 6px}
#tech{position:fixed;top:88px;left:50%;transform:translateX(-50%);z-index:6;display:flex;flex-direction:column;gap:8px;width:min(920px,96vw);max-height:calc(100vh - 180px);overflow:auto;padding:14px;pointer-events:auto}
#tech[hidden]{display:none}
#tech>b{font-family:"Ayuthaya","Thonburi","Sarabun",serif;font-size:18px;font-weight:400;color:var(--gold)}
#tech>small{color:var(--muted);line-height:1.45}
#techTable{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.tech-col{display:flex;flex-direction:column;gap:6px}
.tech-col>b{color:var(--gold);font-weight:500}
#tech .tech{display:flex;flex-direction:column;align-items:flex-start;gap:3px;width:100%;min-width:0;text-align:left;padding:8px}
#tech .tech small{color:var(--muted);font-size:11px;line-height:1.35}
#tech .tech.owned{border-color:var(--gold);background:linear-gradient(#3d4a28,#243018)}
#tech .tech.locked{opacity:.55}
#tools button.locked{opacity:.4}
#ambient{position:fixed;top:112px;right:24px;z-index:2;display:flex;flex-direction:column;gap:8px;width:220px;padding:14px;pointer-events:auto}
#ambient[hidden]{display:none}
#ambient label{display:flex;flex-direction:column;gap:4px;color:var(--muted)}
#ambient input[type=range]{width:100%}
#ambient input[type=color]{width:100%;height:28px;padding:0;border:1px solid var(--gold-deep);background:#24160f}
#ambient button{width:100%}
#openHelp{font-family:"Ayuthaya","Thonburi","Sarabun",serif;font-size:18px;color:var(--gold);padding:4px 0}
#openGoods{width:100%;margin-top:6px;pointer-events:auto;font-size:12px;padding:6px 8px}
#goods{position:fixed;top:92px;right:16px;z-index:4;display:flex;flex-direction:column;gap:8px;width:268px;max-height:calc(100vh - 220px);overflow:auto;padding:14px;pointer-events:auto}
#goods[hidden]{display:none}
#goods>b{font-family:"Ayuthaya","Thonburi","Sarabun",serif;font-size:18px;font-weight:400;color:var(--gold)}
#goodsRows span{display:flex;align-items:center;gap:8px;padding:4px 0;color:var(--muted);font-size:13px}
#goodsRows span+span{box-shadow:inset 0 1px 0 #c4a15a55}
#goodsRows b{margin-left:auto;color:var(--gold);font-size:14px;font-weight:600}
#goods button{width:100%}
#help{position:fixed;top:72px;left:50%;transform:translateX(-50%);z-index:7;display:flex;flex-direction:column;gap:12px;width:min(980px,96vw);max-height:calc(100vh - 150px);overflow:auto;padding:16px;pointer-events:auto}
#help[hidden]{display:none}
.help-top{display:flex;align-items:center;gap:12px}
.help-top b{font-family:"Ayuthaya","Thonburi","Sarabun",serif;font-size:22px;font-weight:400;color:var(--gold)}
.help-top button{margin-left:auto}
.help-tabs{display:flex;gap:6px;flex-wrap:wrap}
.help-tabs button.on{background:linear-gradient(#a33b32,#6e221e);color:#fff6df}
.help-panel{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.help-panel[hidden]{display:none}
.help-card,.help-rule,.help-lanes article{display:flex;flex-direction:column;gap:6px;padding:12px;background:#1b0f0c;border:1px solid #5c3e22}
.help-name{display:flex;align-items:center;gap:8px}
.help-name b,.help-rule b,.help-lanes b{font-family:"Ayuthaya","Thonburi","Sarabun",serif;font-size:16px;font-weight:400;color:var(--gold)}
.help-card p{display:grid;grid-template-columns:52px minmax(0,1fr);gap:8px;margin:0;color:#f6efe2;font-size:13px;line-height:1.45}
.help-card small{color:var(--gold);font-weight:600}
.help-rule{grid-column:1/-1}
.help-rule span,.help-lanes small,.help-note{color:var(--muted);font-size:13px;line-height:1.5}
.help-lanes{grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr;gap:8px}
.help-routes{grid-column:1/-1;display:grid;grid-template-columns:1.2fr 1fr 1fr;gap:0;border:1px solid #5c3e22}
.help-routes div{display:contents}
.help-routes b,.help-routes span{padding:8px 10px;background:#1b0f0c;border-top:1px solid #5c3e2255}
.help-routes b{color:var(--gold);font-weight:500}
.help-note{grid-column:1/-1;margin:0}
@media(max-width:720px){.help-panel,.help-lanes{grid-template-columns:1fr}}
#uiToggle{position:fixed;top:26px;right:18px;z-index:6;padding:7px 12px}
#uiToggle[hidden]{display:none}
body.ui-off header,body.ui-off #seasonbar,body.ui-off #status,body.ui-off #post,body.ui-off #person,body.ui-off #trade,body.ui-off #tech,body.ui-off #goods,body.ui-off #help,body.ui-off #wallGuide,body.ui-off footer{visibility:hidden;pointer-events:none}
#tools{display:flex;flex-direction:column;align-items:center;gap:8px;padding:10px 12px;pointer-events:auto}
.tool-bar{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;flex-wrap:nowrap}
.tool-shortcuts{display:flex;gap:6px;flex:none}
.tool-shortcuts button{border-color:var(--gold)}
.tool-tabs{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-start;flex:1 1 auto;min-width:0}
.tool-panel{display:flex;justify-content:center;width:100%}
.tool-group{display:flex;flex-wrap:wrap;gap:6px;justify-content:center}
.tool-group[hidden]{display:none}
#tools button{min-width:76px;padding:8px 12px;background:#2a1a12;border-color:#8d673066}
#tools button b{display:block;font-weight:500}
#tools button small{display:block;font-size:10px;color:var(--muted);margin-top:3px}
#tools .tool-tabs .tab{min-width:0;padding:6px 14px;background:#1c120e;color:var(--gold);letter-spacing:.04em}
#tools .tool-tabs .tab.on{background:linear-gradient(#a33b32,#6e221e);color:#fff6df}
body:not(.chronicle) .only-chronicle{display:none!important}
#chron{margin:0;flex-basis:100%;font-size:12px;line-height:1.4;color:var(--gold);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#chron:empty{display:none}
#openCourt{grid-column:1/-1;border-color:var(--gold)}
#openCourt.alert{background:linear-gradient(#a33b32,#6e221e);color:#fff6df;animation:courtCall 1.6s ease-in-out infinite}
@keyframes courtCall{50%{box-shadow:inset 0 0 0 1px #e4c57a55,0 0 0 3px #e4c57a55}}
#chronicle{position:fixed;inset:0;z-index:31;display:flex;justify-content:center;align-items:flex-start;padding:5vh 16px;overflow:auto;background:radial-gradient(ellipse at 50% 15%,#2a1810ee,#0b0806f5);pointer-events:auto}
#chronicle[hidden]{display:none}
.chron-card{width:min(860px,96vw);max-height:90vh;max-height:90dvh;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:var(--gold-deep) #140e0b;display:flex;flex-direction:column;gap:14px;padding:26px 30px;
  background:linear-gradient(180deg,#22150f,#140e0b) padding-box,linear-gradient(135deg,#f3e0a4,#8d6730 45%,#f3e0a4) border-box;
  border:1px solid transparent;box-shadow:inset 0 0 0 1px #5c3e22,inset 0 0 0 5px #140e0c,inset 0 0 0 6px #c4a15a66,0 30px 80px #000c}
.chron-card>*{flex-shrink:0}
.chron-card>.story-actions{position:sticky;bottom:0;z-index:2;padding:12px 0;background:#140e0b;border-top:1px solid #8d673066}
.chron-card::-webkit-scrollbar{width:10px}
.chron-card::-webkit-scrollbar-track{background:#140e0b}
.chron-card::-webkit-scrollbar-thumb{background:var(--gold-deep);border:2px solid #140e0b;border-radius:6px}
.chron-card.intro{width:min(1120px,96vw)}
.chron-card.dyn{width:min(560px,96vw)}
.kicker{color:var(--muted);letter-spacing:.06em;font-size:12px}
.chron-card h2{margin:0;font-family:"Ayuthaya","Thonburi","Sarabun",serif;font-weight:400;font-size:26px;line-height:1.35;color:var(--gold)}
.chron-card>p{margin:0;line-height:1.7;color:#ecdfc8}
.chron-card .sec{border-left:3px solid var(--gold-deep);padding:2px 0 2px 12px}
.chron-card .sec>b{color:var(--gold);font-weight:500;font-size:13px}
.chron-card .sec p{margin:4px 0 0;line-height:1.7;color:#ecdfc8}
.chron-card .sec.warn{border-color:#c07a3a}
.chron-card .sec.warn p{color:#f0cfa0}
.chron-card .sec.play{border-color:#a33b32}
.chron-card .sec.city ul{margin:6px 0 4px;padding-left:18px;line-height:1.7}
.chron-card .sec.city small{color:var(--muted);font-size:12px}
.fx-invade{color:#f3a48e}.fx-raze{color:#f0b878}.fx-mood,.fx-leave,.fx-stock{color:#dccb96}
.chron-card .report{padding:10px 14px;background:#1b120d;border:1px solid #5c3e22}
.chron-card .report>b{color:var(--gold);font-weight:500;font-size:13px}
.chron-card .report ul,.chron-card ul.summary{margin:6px 0 0;padding-left:18px;font-size:13px;line-height:1.65;color:var(--muted)}
.story-actions{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap;margin-top:4px}
button.primary{background:linear-gradient(#a33b32,#6e221e);border-color:var(--gold);color:#fff6df;padding:10px 18px;font-size:15px}
.intro-grid{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);gap:24px;align-items:start}
.intro-how{display:flex;flex-direction:column;gap:12px}
.intro-how>p{margin:0;line-height:1.7;color:#ecdfc8}
.intro-list{margin:0;padding-left:20px;display:flex;flex-direction:column;gap:8px}
.intro-list li b{display:block;color:var(--gold);font-weight:500}
.intro-list li span{display:block;color:#ddd2bc;line-height:1.6;font-size:14px}
.intro-meters{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.intro-meter{display:grid;grid-template-columns:22px 1fr;column-gap:8px;align-items:center;padding:8px 10px;background:#1b120d;border:1px solid #5c3e22}
.intro-meter .ico{grid-row:1/3}
.intro-meter b{font-weight:500;font-size:13px}
.intro-meter small{color:var(--muted);font-size:11px}
.intro-tips{margin:0;padding-left:18px;font-size:13px;line-height:1.65;color:var(--muted)}
.ico svg{display:block;width:20px;height:20px}
.dynasty h3{margin:0 0 12px;font-size:20px;font-weight:600;color:#f6efe2}
.dyn-list{padding:16px 18px 2px;background:#111010;border:1px solid #3a3530;border-radius:12px}
.dyn{position:relative;padding:0 0 16px 28px}
.dyn::before{content:'';position:absolute;left:4px;top:15px;bottom:-1px;width:1px;background:#4a423a}
.dyn:last-child::before{display:none}
.dyn::after{content:'';position:absolute;left:0;top:5px;width:9px;height:9px;border-radius:50%;background:#b08a4e}
.dyn.sage::after{background:#7d8f7d}
.dyn.now::after{box-shadow:0 0 0 4px #e4c57a40}
.dyn b{display:block;font-size:15px;color:#f6efe2}
.dyn.now b{color:var(--gold)}
.dyn small{display:block;margin:2px 0;font-size:12px;color:#9a9288}
.dyn span{display:block;font-size:13px;color:#d8d0c4}
#court{position:fixed;inset:0;z-index:30;display:flex;align-items:center;justify-content:center;padding:16px;background:#0b0605b0;pointer-events:auto}
#court[hidden]{display:none}
.court-hall{position:relative;display:flex;flex-direction:column;width:min(1180px,100%);max-height:calc(100vh - 32px);overflow:hidden;background:#140b09;border:1px solid #c4a15a88;box-shadow:inset 0 0 0 1px #5c3e22,0 30px 80px #000c}
.court-col{display:flex;flex-direction:column;gap:12px;min-width:0}
.court-stage{position:relative;flex:none;width:100%;overflow:hidden;border:1px solid #c4a15a;box-shadow:inset 0 0 0 4px #140b09,inset 0 0 0 5px #8d6730;background:#1a0e0a;isolation:isolate}
.court-stage img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;object-position:center;transform:translate3d(calc(var(--px,0) * var(--mx,0px)),calc(var(--py,0) * var(--my,0px) + var(--dy,0px)),var(--z));user-select:none}
/* The complete reference image defines the scene height and architecture positions.
   Keep it in normal flow so narrow windows retain all four edges without cropping. */
.court-stage img.hall-full{position:relative;display:block;inset:auto;width:100%;height:auto;aspect-ratio:4/3;object-fit:contain;transform:none;--z:0px}
/* Reuse the reference pixels through the supplied cutout masks so the
   architecture stays registered to full.jpg at rest. Only these layers move. */
.hall-layer{position:absolute;inset:0;background:url("assets/court/full.jpg") center/100% 100% no-repeat;mask-image:var(--mask);mask-mode:alpha;mask-repeat:no-repeat;mask-size:var(--mask-size,100% 100%);mask-position:var(--mask-position,center);transform:translate(calc(var(--px,0) * var(--mx,0px) + var(--py,0) * var(--mxy,0px)),calc(var(--py,0) * var(--my,0px) + var(--px,0) * var(--myx,0px))) rotate(calc(var(--px,0) * var(--mr,0deg) + var(--py,0) * var(--mry,0deg)));transform-origin:50% 65%;pointer-events:none}
.hall-top{--mask:url("assets/court/top.png");--mx:2px;--my:1px;z-index:1}
.hall-floor{--mask:url("assets/court/floor.png");--mx:3px;--my:1px;z-index:2}
.hall-throne{--mask:url("assets/court/throne.png");--mask-size:67% 67%;--mask-position:50% 18.94%;--mx:2.5px;--my:-1.5px;--mxy:1px;--myx:.6px;--mr:.06deg;z-index:3}
.hall-rail{--mask:url("assets/court/rail.png");--mx:-5px;--my:2.5px;--mxy:-1.5px;--myx:1px;--mr:-.1deg;z-index:4}
.hall-col-left,.hall-col-right{--mask-size:100% 82%;--mask-position:center top;z-index:5}
.hall-col-left{--mask:url("assets/court/col-left.png");--mx:-10px;--my:-2px;--mxy:2px;--myx:-1.5px;--mr:-.16deg;--mry:.05deg;transform-origin:15% 70%}
.hall-col-right{--mask:url("assets/court/col-right.png");--mx:-8px;--my:3px;--mxy:-2px;--myx:1.5px;--mr:.13deg;--mry:-.05deg;transform-origin:85% 70%}
.court-stage img.fig{inset:auto;width:auto;height:calc(var(--h) * 2);bottom:var(--b);object-fit:contain;transform:none;transform-origin:bottom center;z-index:6;pointer-events:none}
.court-stage img.fig:not(.flip):not(.king){left:var(--x)}
.court-stage img.king{left:50%}
.court-stage img.fig.flip{left:auto;right:var(--x);transform:scaleX(-1)}
.court-stage img.noble:not(.flip){transform:scaleX(-1)}
.court-stage img.noble.flip{transform:none}
/* Anchor each soldier at the feet: both ranks converge toward the throne.
   Nearer guards render over the smaller guards farther down the hall. */
.court-stage img.soldier:not(.flip){transform:translateX(-50%)}
.court-stage img.soldier.flip{transform:translateX(50%) scaleX(-1)}
.court-stage img.s1,.court-stage img.s5{--x:12%;--b:6%;--h:18%;z-index:10}
.court-stage img.s2,.court-stage img.s6{--x:20%;--b:16%;--h:14.4%;z-index:9}
.court-stage img.s3,.court-stage img.s7{--x:26%;--b:24%;--h:11.5%;z-index:8}
.court-stage img.s4,.court-stage img.s8{--x:30%;--b:30%;--h:9.4%;z-index:7}
.court-stage img.king{--b:41%;--h:9%;transform:translateX(-50%)}
.court-stage img.attendant{--b:37%}
.hold{--x:38%;--h:12.15%}
.fan{--x:54%;--h:11.7%}
/* Seated courtiers face the throne in four paired rows along the carpet. */
.n1,.n5{--x:34%;--b:29%;--h:6%}
.n2,.n6{--x:31%;--b:20%;--h:7%}
.n3,.n7{--x:28%;--b:10%;--h:8%}
.n4,.n8{--x:25%;--b:0%;--h:9%}
.court-body{position:relative;z-index:2;flex:1 1 auto;min-height:0;display:flex;flex-direction:column;gap:12px;padding:18px 20px;overflow:auto}
.court-head,.court-foot{padding:12px 14px;background:#140b09;border:1px solid #5c3e22}
.court-foot{flex:none}
@media(prefers-reduced-motion:reduce){.hall-layer{transform:none}}
.court-title b{margin-right:12px;font-family:"Ayuthaya","Thonburi","Sarabun",serif;font-size:26px;font-weight:400;color:var(--gold)}
.court-title small{color:var(--muted);font-size:13px}
#courtMeters{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:12px}
.meter{position:relative;display:grid;grid-template-columns:24px minmax(0,1fr) auto;row-gap:6px;column-gap:8px;align-items:center;padding:10px 12px;background:#1b0f0c;border:1px solid #5c3e22}
.meter .ico{grid-row:1/3}
.meter small{grid-column:2;grid-row:1;color:var(--muted);font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.meter em{grid-column:3;grid-row:1;font-style:normal;font-weight:600;color:var(--gold)}
.meter .bar{position:relative;grid-column:2/4;grid-row:2;height:8px;overflow:hidden;background:#2e1d15}
.meter .bar::before{content:'';position:absolute;left:0;top:0;bottom:0;width:15%;background:#a33b3266;z-index:1}
.meter .bar u{position:absolute;right:0;top:0;bottom:0;width:15%;background:#a33b3266;z-index:1}
.meter .bar b{display:block;height:100%;background:linear-gradient(90deg,#8d6730,#e4c57a);transition:width .5s}
.meter.danger{border-color:#c0473c;box-shadow:0 0 0 1px #c0473c55}
.meter.danger .bar b{background:linear-gradient(90deg,#a33b32,#e07a5a)}
.meter .cue{position:absolute;top:-6px;left:50%;transform:translateX(-50%);border-radius:50%;background:#f6efe2;box-shadow:0 0 6px #f6efe2aa}
.meter .cue.small{width:7px;height:7px}
.meter .cue.big{top:-8px;width:12px;height:12px}
.court-main{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(280px,1fr);gap:14px;align-items:start}
#courtCard{display:flex;flex-direction:column;gap:10px;padding:22px 24px;color:#2a1a10;background:linear-gradient(180deg,#f3e6c8,#e2cd9e);border:1px solid var(--gold-deep);box-shadow:inset 0 0 0 4px #f3e6c8,inset 0 0 0 5px #a8854a,0 14px 30px #0008}
#courtCard .kicker{color:#7a5a30}
#courtCard h3{margin:0;font-family:"Ayuthaya","Thonburi","Sarabun",serif;font-size:22px;font-weight:400;line-height:1.45;color:#5a1c16}
#courtCard p{margin:0;line-height:1.65}
#courtCard .muted{color:#6a5236;font-size:13px}
#courtCard ul.result{margin:0;padding-left:18px;line-height:1.7}
#courtCard .choices{display:flex;flex-direction:column;gap:8px;margin-top:4px}
#courtCard .choice{display:flex;flex-direction:column;align-items:flex-start;text-align:left;padding:10px 14px}
#courtCard .choice b{font-weight:500}
#courtCard .choice small{margin-top:3px;font-size:12px;color:var(--muted)}
#courtCard .choice:disabled{opacity:.45;cursor:not-allowed}
#courtCard>button.primary{align-self:flex-end}
#courtCard.coup{color:#fff6df;background:linear-gradient(180deg,#6e221e,#2a0f0b);border-color:#e07a5a;box-shadow:inset 0 0 0 4px #4a1712,inset 0 0 0 5px #e07a5a88,0 14px 30px #0008}
#courtCard.coup .kicker{color:#f3a48e}
#courtCard.coup h3{color:#ffd9c2}
#courtSide{display:flex;flex-direction:column;gap:10px}
#courtSide section{display:flex;flex-direction:column;gap:5px;padding:10px 12px;background:#1b0f0c;border:1px solid #5c3e22}
#courtSide section>b{color:var(--gold);font-weight:500;font-size:13px}
#courtSide small{color:var(--muted);font-size:12px;line-height:1.45}
#courtSide .act{display:flex;flex-direction:column;align-items:flex-start;text-align:left;padding:6px 10px;font-size:13px}
#courtSide .act small{font-size:11px}
#courtSide .act:disabled{opacity:.4;cursor:not-allowed}
#courtSide .flag span{display:block;color:#f0b9a8;font-size:12.5px}
#courtSide .side-log button{align-self:flex-start;margin-top:4px;padding:5px 10px;font-size:12px}
.court-foot{display:flex;justify-content:flex-end;align-items:center;gap:12px}
#courtNote{color:#f0b9a8;font-size:13px}
#courtClose:disabled{opacity:.45;cursor:not-allowed}
@media(max-width:850px){
  #courtMeters{grid-template-columns:1fr 1fr}
  .court-main,.intro-grid{grid-template-columns:1fr}
  .chron-card{padding:18px}
}
@media(max-width:850px){
  #uiToggle{top:14px;right:12px}
  header{left:12px;width:156px}
  .brand b{font-size:16px}
  .brand small{display:none}
  .resources small{width:42px}
  .resources b{font-size:12px}
  #seasonbar{left:168px;right:12px;transform:none;max-width:none;flex-wrap:wrap}
  #status{top:auto;right:12px;bottom:168px;transform:none;max-width:200px}
  #post,#person{right:12px;top:auto;bottom:150px;min-width:0;max-width:calc(100vw - 180px)}
  footer{left:12px;right:12px;bottom:10px}
  #tools{gap:4px;padding:6px}
  #tools button{min-width:55px;padding:6px;font-size:12px}
  #tools .tool-tabs .tab{min-width:0;padding:5px 8px}
  .hint{display:none}
}

#tributeDialog{width:min(600px,calc(100vw - 32px));max-height:calc(100dvh - 40px);overflow:auto;box-sizing:border-box;padding:22px;background:#20140f;color:var(--text,#f3ead4);border:1px solid var(--gold,#c4a15a);box-shadow:0 24px 80px #000b}
#tributeDialog::backdrop{background:#0b0605c9}
.tribute-head{display:flex;align-items:start;justify-content:space-between;gap:16px}
#tributeDialog h2{margin:6px 0 12px;color:var(--gold)}
#tributeDialog h3{margin:16px 0 6px;font-size:15px;color:var(--gold)}
#tributeDialog p{font-size:14px;line-height:1.65;margin:6px 0}
#tributeDialog small,#tributeDiscount{color:var(--muted)}
#tributeNeeds{padding:10px 14px;background:#100b08;border:1px solid #5c3e22}
#tributeDialog .tribute-balance{margin:18px 0;color:var(--muted);font-size:12px}
#tributeConfirm{width:100%;padding:12px}
#tributeConfirm:disabled{opacity:.45;cursor:not-allowed}

#status{display:flex;flex-direction:column;gap:7px;max-width:min(320px,calc(100vw - 32px));padding:0;background:none;border:0;box-shadow:none;max-height:50vh;overflow:hidden}
#status:empty{display:none}
.status-item{margin:0;padding:10px 14px;background:#20140fee;border:1px solid #a8854a88;box-shadow:0 6px 16px #0004}
#notificationHistory{width:min(640px,calc(100vw - 32px));max-height:calc(100dvh - 40px);box-sizing:border-box;overflow:auto;padding:22px;background:#20140f;color:var(--text,#f3ead4);border:1px solid var(--gold,#c4a15a)}
#notificationHistory::backdrop{background:#0b0605c9}
#notificationHistory h2{margin:0;color:var(--gold)}
.notification-history-note,#notificationHistoryList small{color:var(--muted);font-size:12px}
#notificationHistoryList{list-style:none;padding:0;margin:16px 0 0}
#notificationHistoryList li{padding:10px 0;border-top:1px solid #5c3e22}
#notificationHistoryList p{margin:5px 0;font-size:14px;line-height:1.6}

/* City guide: a readable production loop, with separate high/low effects. */
.guide-intro{grid-column:1/-1;display:flex;gap:14px;align-items:center;padding:18px;background:linear-gradient(120deg,#392819,#201510);border:1px solid #947044;border-radius:8px}
.guide-intro h2{margin:0 0 6px;color:#f2d391;font-size:21px;font-weight:500}
.guide-intro p,.guide-section p{margin:0;color:#ddd1ba;font-size:14px;line-height:1.7}
.guide-icon{display:block;font-size:30px;line-height:1.3;flex-shrink:0}
.guide-section{grid-column:1/-1;min-width:0}
.guide-section h3,.guide-effect h3{margin:6px 0 12px;color:#f2d391;font-size:17px;font-weight:500}
.guide-flow{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}
.guide-flow li{position:relative;min-width:0;padding:16px;background:#211710;border:1px solid #725332;border-radius:8px}
.guide-flow li:not(:last-child)::after{content:'→';position:absolute;right:-16px;top:40px;color:#e6c17b;font-size:20px;z-index:1}
.guide-flow li b{display:block;color:#f3dfb3;margin:8px 0 6px;font-size:15px}
.guide-flow li p{font-size:13px;line-height:1.65}
.guide-feedback{grid-column:1/-1;margin:0;padding:12px 16px;border-left:3px solid #80b899;background:#17251e;color:#d4e7d8;line-height:1.7;font-size:14px}
.guide-effect{padding:16px;border:1px solid #654a2e;border-radius:8px;background:#211710}
.guide-effect>p{color:#d8ccb7;font-size:13px;line-height:1.7;margin:0 0 12px}
.guide-up,.guide-down{padding:10px 12px;border-radius:4px;font-size:13px;line-height:1.7}
.guide-up{background:#1b2c23;border-left:3px solid #84ba94;color:#d2e9d7;margin-bottom:8px}
.guide-down{background:#35201a;border-left:3px solid #d69a76;color:#efd4bd}
.guide-effect b,.guide-effect span{display:block}
#help .help-tabs button:focus-visible{outline:2px solid #f2d391;outline-offset:3px}
@media(min-width:721px){.guide-cycle li:nth-child(3)::after{content:'↓';right:50%;top:auto;bottom:-23px}.guide-cycle li:nth-child(4){grid-column:3;grid-row:2}.guide-cycle li:nth-child(5){grid-column:2;grid-row:2}.guide-cycle li:nth-child(6){grid-column:1;grid-row:2}.guide-cycle li:nth-child(4)::after,.guide-cycle li:nth-child(5)::after{content:'←';right:auto;left:-16px}}
@media(max-width:720px){.guide-flow{grid-template-columns:1fr;gap:18px}.guide-flow li:not(:last-child)::after{content:'↓';top:auto;right:50%;bottom:-23px}.guide-intro{align-items:flex-start;padding:12px}.guide-intro h2{font-size:18px}}

.home-services{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr));gap:6px;margin:5px 0 8px}
.home-service{display:grid;grid-template-columns:26px minmax(0,1fr) auto;align-items:center;gap:2px 7px;padding:9px 8px;border:1px solid #665136;border-radius:6px;background:#251d15}
.home-service-icon{grid-row:1;display:flex;align-items:center;justify-content:center;font-size:22px;color:#e5b786}
.home-service-icon .res-ico{width:25px;height:25px}
.home-service-name{min-width:0;white-space:nowrap;font-size:13px;color:#eee0c5}
#post .home-service small{grid-column:3;grid-row:1;justify-self:end;text-align:right;white-space:nowrap;width:auto;font-size:11px;line-height:1.4;color:#9dd3ac}
.home-service.is-ready{border-color:#5b7753;background:#20291e}
.home-service.is-missing{border-color:#73523c;background:#30221c}
#post .home-service.is-missing small{color:#e3ac87}
.home-summary{padding:9px 10px;border:1px solid #806238;border-radius:6px;background:#302418;color:#ebd19b;display:grid;gap:5px}
.home-upgrade-status{padding:9px;border-left:3px solid #d2ab62;background:#35291b;color:#f1d6a2;line-height:1.6;margin-top:5px}
#postNote .home-zones{font-size:12px;margin:7px 0 2px}
#postNote .home-income-hint{font-size:11px;line-height:1.6;margin-top:7px;color:#bfb19a}

/* Town hall details grow with their content instead of scrolling internally. */
#post:has(#holdFestival:not([hidden])){height:auto;max-height:none;overflow:visible;width:min(320px,calc(100vw - 32px));min-width:0;box-sizing:border-box}

#post #holdFestival,#post #holdSongkran{box-sizing:border-box;white-space:normal;overflow-wrap:anywhere;min-height:38px}

#saveProfiles{width:min(680px,calc(100vw - 32px));max-height:calc(100dvh - 40px);overflow:auto;box-sizing:border-box;padding:20px;background:#20140f;color:var(--text,#f3ead4);border:1px solid var(--gold);box-shadow:0 24px 80px #000b}
#saveProfiles::backdrop{background:#0009}
#profileStatus{font-size:13px;color:var(--muted);line-height:1.6;min-height:22px}
#profileList{display:grid;gap:10px}
.profile-card{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 14px;align-items:center;padding:12px;border:1px solid #6b4d30;border-radius:6px;background:#2a1d14}
.profile-card label{display:flex;align-items:center;gap:10px;color:var(--gold);font-size:14px;min-width:0}
.profile-card input{min-width:0;width:100%;box-sizing:border-box;padding:7px 9px;border:1px solid #856840;background:#160f0b;color:#f4e4c3;font:inherit;border-radius:4px}
.profile-card input:disabled{opacity:1;border-color:transparent;background:transparent}
.profile-card p{grid-column:1;margin:0;color:var(--muted);font-size:12px;line-height:1.6}
.profile-card button{grid-column:2;grid-row:1/3;min-width:110px;padding:10px}
@media(max-width:520px){.profile-card{grid-template-columns:1fr}.profile-card button{grid-column:1;grid-row:auto;width:100%}.profile-card label{flex-wrap:wrap}}


/* Cinematic start menu: one image, quiet motion, and a clear two-step flow. */
#gfx{position:fixed;inset:0;z-index:20;display:block;padding:0;overflow:hidden;background:#100e0a;pointer-events:auto;isolation:isolate;color:#f0e6d3}
#gfx .title-bg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:62% center;filter:saturate(.82) brightness(.86);animation:menuLandscape 32s ease-in-out infinite alternate;pointer-events:none;z-index:-3}
#gfx::before{content:'';position:absolute;inset:0;z-index:-2;background:linear-gradient(90deg,#0e100ee8 0%,#10120ff5 14%,#11130fe8 32%,#10120fa8 45%,#14150f26 65%,#14150f08),linear-gradient(0deg,#0b0d0bdb 0%,transparent 35%,#16170e33 80%,#10110d80);pointer-events:none}
#gfx::after{content:'';position:absolute;inset:18px;z-index:-1;border:1px solid #c6ad6c28;pointer-events:none}
#gfx .menu-layout{position:relative;display:grid;grid-template-columns:minmax(420px,520px) minmax(0,1fr);width:100%;height:100%;height:100dvh;margin:0;padding:0 clamp(28px,4.6vw,88px);gap:clamp(28px,5vw,96px);text-align:left}
#gfx .menu-panel{display:flex;flex-direction:column;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#8d764c #11130f;padding:clamp(28px,4vh,52px) 12px 24px 0;gap:clamp(15px,2.1vh,24px)}
#gfx .menu-brand{display:flex;align-items:center;justify-content:space-between;gap:18px;min-width:0;flex-shrink:0;padding-bottom:16px;border-bottom:1px solid #bca27040}
#gfx .logo{display:block;width:clamp(150px,16vw,224px);max-width:52%;height:auto;filter:drop-shadow(0 4px 15px #0009)}
#gfx .menu-edition{max-width:128px;font-size:11px;line-height:1.8;color:#bfaf8c;letter-spacing:.035em;text-align:right}
#gfx .menu-heading{flex-shrink:0}
#gfx .menu-kicker{display:flex;align-items:center;gap:10px;color:#c5ab75;font-size:10px;letter-spacing:.13em}
#gfx .menu-kicker::before{content:'';width:22px;height:1px;background:#b29a65}
#gfx h1{margin:10px 0 8px;font:400 clamp(29px,3.1vw,43px)/1.35 'Ayuthaya','Thonburi',serif;letter-spacing:.015em;color:#f1e9d5;text-shadow:0 3px 20px #0006}
#gfx h1 em{font-style:normal;color:#cbb484;font-size:.75em}
#gfx .menu-heading p{margin:0;font-size:12px;color:#bfb8a4;line-height:1.8;letter-spacing:0;text-shadow:none}
#gfx .menu-steps{display:flex;align-items:center;list-style:none;gap:20px;padding:0 0 13px;margin:0;border-bottom:1px solid #c3ab7130;flex-shrink:0}
#gfx .menu-steps li{display:flex;gap:8px;align-items:center;color:#867e69;font-size:11px}
#gfx .menu-steps li span{display:inline-grid;place-items:center;width:24px;height:24px;border:1px solid #9b875a45;border-radius:50%;font-size:10px;letter-spacing:.03em}
#gfx[data-stage="mode"] .step-mode,#gfx[data-stage="graphics"] .step-quality{color:#ead8ac}
#gfx[data-stage="mode"] .step-mode span,#gfx[data-stage="graphics"] .step-quality span{border-color:#d5b56e;background:#bd965a21;color:#f0d491}
#gfx[data-stage="graphics"] .step-mode{color:#bda979}
#gfx .map-picker{display:flex;flex-direction:column;gap:7px;flex-shrink:0;margin:0;padding:0;width:100%;background:none;border:0;border-radius:0}
#gfx .map-picker-label{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
#gfx .map-picker label{color:#d8c69c;font-size:12px}
#gfx .map-picker-label>span{font-size:10px;color:#948971}
#gfx .map-select-wrap{position:relative;display:flex;align-items:center}
#gfx .map-select-wrap svg{position:absolute;left:14px;width:21px;height:21px;fill:none;stroke:#c5aa72;stroke-width:1.2;stroke-linejoin:round;pointer-events:none}
#gfx #mapSelect{width:100%;min-width:0;max-width:100%;padding:12px 30px 12px 46px;border:1px solid #b79c624d;border-radius:2px;background:#192019b8;color:#e5d7b7;font:13px 'Sarabun','Thonburi',sans-serif;cursor:pointer;transition:border-color .2s,background .2s}
#gfx #mapSelect:hover,#gfx #mapSelect:focus-visible{border-color:#cfaf6e;background:#242a20;outline:1px solid #cfaf6e44;outline-offset:3px}
#gfx #mapSelect option{background:#182019;color:#ede1c3}
#gfx #mapDescription{min-height:16px;font-size:10px;line-height:1.7;color:#a69b81}
#gfx .menu-stage{flex-shrink:0}
#gfx .menu-stage[hidden]{display:none}
#gfx .menu-section-title{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:11px}
#gfx .menu-section-title h2{margin:0;font-size:13px;line-height:1.6;font-weight:500;color:#dcd0b5}
#gfx .menu-section-title>span{font-size:10px;color:#9e9278}
#gfx .row{display:flex;flex-direction:column;gap:10px;margin:0;align-items:stretch}
#gfx button.menu-choice{position:relative;display:grid;grid-template-columns:44px minmax(0,1fr) 20px;align-items:center;gap:13px;width:100%;max-width:none;min-width:0;margin:0;padding:17px 18px;text-align:left;font:inherit;border:1px solid #b19a6355;border-radius:2px;background:linear-gradient(105deg,#20261ee6,#151b15c7);box-shadow:inset 0 1px #ebd39a08,0 4px 18px #0002;transition:transform .2s,border-color .2s,background .2s,box-shadow .2s}
#gfx button.chronicle-choice{border-color:#c6a268a3;border-left:3px solid #c5a164;background:linear-gradient(110deg,#552b20ef,#2b2119e3 75%);box-shadow:inset 0 1px #f3d09c12,0 5px 20px #0003}
#gfx button.menu-choice:hover:not(:disabled){transform:translateX(4px);border-color:#e0c58a;background:linear-gradient(105deg,#3c3c28f5,#252b1fe8);box-shadow:inset 0 0 0 1px #cbb47520,0 5px 20px #0004}
#gfx button.chronicle-choice:hover{background:linear-gradient(110deg,#6b3728f5,#3b2a1eea)}
#gfx button.menu-choice:focus-visible{outline:2px solid #edcd86;outline-offset:4px;border-color:#edcd86}
#gfx button.menu-choice:active:not(:disabled){transform:translateX(2px)}
#gfx button.menu-choice:disabled{cursor:wait;opacity:.46;filter:saturate(.5)}
#gfx .choice-symbol{display:grid;place-items:center;width:44px;height:52px;color:#c8af79;border-right:1px solid #bba06a36;padding-right:11px}
#gfx .choice-symbol svg{width:33px;height:38px;fill:none;stroke:currentColor;stroke-width:1.25;stroke-linecap:round;stroke-linejoin:round}
#gfx .choice-copy{display:flex;flex-direction:column;gap:4px;min-width:0}
#gfx .choice-eyebrow{display:flex;align-items:center;gap:9px;flex-wrap:wrap;color:#bca77b;font-size:9px;line-height:1.6;letter-spacing:.035em}
#gfx .choice-badge{padding:1px 6px;color:#e8cd94;border:1px solid #c4a1665c;border-radius:2px;font-size:8px;line-height:1.6;letter-spacing:0;white-space:nowrap}
#gfx .choice-copy strong{font:400 20px/1.4 'Ayuthaya','Thonburi',serif;color:#eee1c3}
#gfx button .choice-copy small{display:block;margin:0;color:#bfb7a2;font:12px/1.8 'Sarabun','Thonburi',sans-serif;letter-spacing:0;text-align:left}
#gfx .choice-arrow{font:22px/1 Georgia,serif;color:#c6aa74;transition:transform .2s}
#gfx button.menu-choice:hover .choice-arrow{transform:translateX(3px)}
#gfx button.quality-choice{padding-block:12px;grid-template-columns:36px minmax(0,1fr) 20px}
#gfx .quality-choice .choice-copy strong{font-size:17px}
#gfx .quality-mark{display:flex;align-items:flex-end;justify-content:center;gap:4px;height:26px}
#gfx .quality-mark i{width:5px;height:12px;background:#c3a776;border-radius:1px}
#gfx .quality-mark i:nth-child(2){height:19px}#gfx .quality-mark i:nth-child(3){height:26px}
#gfx [data-quality="normal"] .quality-mark i:nth-child(3),#gfx [data-quality="low"] .quality-mark i:not(:first-child){background:#8d82524a}
#gfx .recommended{border-color:#b69d6d8c}
#gfx #gfxMode{font-size:10px;color:#c5ac79;font-weight:400}
#gfx #modeBack{display:inline-flex;align-items:center;gap:9px;min-width:0;max-width:none;margin:13px 0 0;padding:8px 2px;border:0;background:none;box-shadow:none;color:#bfb196;font:11px 'Sarabun','Thonburi',sans-serif}
#gfx #modeBack:hover{color:#f2d398;background:none}
#gfx .menu-footer{display:flex;flex-wrap:wrap;justify-content:space-between;gap:10px;margin-top:auto;padding-top:16px;border-top:1px solid #bba16b30;flex-shrink:0;color:#8d846f;font-size:9px;line-height:1.8;letter-spacing:.04em}
#gfx .menu-ready{display:inline-flex;align-items:center;gap:7px;color:#b9a77f}
#gfx .menu-ready::before{content:'';width:5px;height:5px;border-radius:50%;background:#c5a267;box-shadow:0 0 8px #c5a26766;animation:menuReadyPulse 1.4s ease-in-out infinite}
#gfx .menu-ready.is-ready{color:#bcc4a1}#gfx .menu-ready.is-ready::before{background:#b5c18b;animation:none}
#gfx .menu-ready.is-error{color:#dd9b82}#gfx .menu-ready.is-error::before{background:#db8b6b;animation:none}
#gfx .footer-diamond{padding:0 5px;font-size:6px;color:#9a8357}
#gfx .menu-vista{display:flex;flex-direction:column;justify-content:space-between;min-width:0;pointer-events:none;padding:40px 0 42px}
#gfx .vista-top{align-self:flex-end;color:#e3d1a2bd;font-size:10px;letter-spacing:.12em;text-shadow:0 2px 10px #0009}
#gfx .vista-top>span{margin:0 12px;font-size:6px;color:#d3b47a}
#gfx .vista-caption{align-self:flex-end;text-align:right;text-shadow:0 2px 18px #0008}
#gfx .vista-rule{display:block;width:64px;height:1px;margin:0 0 14px auto;background:#d4b97b}
#gfx .vista-caption small{color:#e5ce9d;font-size:11px;letter-spacing:.12em}
#gfx .vista-caption p{margin:9px 0;font:400 clamp(19px,2vw,28px)/1.6 'Ayuthaya','Thonburi',serif;color:#f3e7ca}
#gfx .vista-caption>span:last-child{color:#d8ceb5a8;font-size:10px;letter-spacing:.05em}
@keyframes menuLandscape{from{transform:scale(1.025)}to{transform:scale(1.075) translateX(-.6%)}}
@keyframes menuReadyPulse{50%{opacity:.4}}
@media(max-width:1000px){#gfx .menu-layout{grid-template-columns:minmax(360px,460px) minmax(0,1fr);gap:24px;padding-inline:32px}#gfx::before{background:linear-gradient(90deg,#0e120ff5 0%,#10140fea 34%,#12170f9c 60%,#14150f45),linear-gradient(0deg,#10120ebf,transparent 60%)}#gfx .vista-top{font-size:8px;letter-spacing:0}#gfx .vista-caption p{font-size:20px}}
@media(max-width:740px){#gfx .menu-layout{grid-template-columns:minmax(0,1fr);padding:0 24px;gap:0}#gfx .menu-panel{width:min(480px,100%);margin-inline:auto;padding-right:0;padding-top:26px;gap:17px}#gfx .menu-vista{display:none}#gfx .title-bg{object-position:65% center}#gfx::before{background:linear-gradient(90deg,#0d130eea,#11170fce),linear-gradient(0deg,#0d120ffa,transparent)}#gfx .menu-heading h1{font-size:34px}#gfx .logo{width:180px}#gfx .menu-brand{padding-bottom:14px}#gfx::after{inset:10px}}
@media(max-height:760px) and (min-width:741px){#gfx .menu-panel{padding-top:24px;gap:13px}#gfx .menu-heading h1{font-size:30px;margin-block:6px}#gfx .logo{width:160px}#gfx .menu-brand{padding-bottom:10px}#gfx button.menu-choice{padding-block:12px}#gfx .menu-steps{padding-bottom:9px}#gfx .menu-footer{padding-top:10px}}
@media(prefers-reduced-motion:reduce){#gfx .title-bg,#gfx .menu-ready::before{animation:none}#gfx button.menu-choice,#gfx .choice-arrow{transition:none}#gfx button.menu-choice:hover:not(:disabled){transform:none}}

#gfx .menu-loading{display:flex;flex-direction:column;align-items:flex-start;gap:7px;flex:1;min-width:150px}
#gfx #assetProgress{display:block;width:100%;max-width:280px;height:3px;border:0;appearance:none;background:#c3a76b20;accent-color:#c3a76b}
#gfx #assetProgress::-webkit-progress-bar{background:#c3a76b20}
#gfx #assetProgress::-webkit-progress-value{background:linear-gradient(90deg,#8d754c,#dfc187)}
#gfx #assetProgress::-moz-progress-bar{background:#c3a76b}
#gfx #menuRetry{padding:5px 9px;font:11px 'Sarabun','Thonburi',sans-serif;border:1px solid #b99462;background:#342419;color:#eed8af}
#gfx #menuRetry[hidden]{display:none}

/* Parchment strategy board: vector artwork, no extra model or texture downloads. */
#campaignMap{width:min(1160px,96vw);max-width:96vw;max-height:94dvh;padding:0;border:1px solid #a0824c;border-radius:9px;background:#24251e;color:#e8dfc9;box-shadow:0 28px 100px #000b;overflow:auto}
#campaignMap::backdrop{background:#080d10bd;backdrop-filter:blur(5px)}
.campaign-head{display:flex;justify-content:space-between;align-items:center;padding:20px 28px;border-bottom:1px solid #786744;background:linear-gradient(110deg,#333226,#20251f)}
.campaign-head small,.campaign-info small{color:#bca676;letter-spacing:.09em}.campaign-head h2{font-size:25px;margin:4px 0;font-weight:500}.campaign-head button{font-size:22px;background:none;color:#d8c69d;border:0}
.campaign-layout{display:grid;grid-template-columns:minmax(340px,1.5fr) minmax(280px,1fr)}
.campaign-paper{position:relative;background:#d9c59a;box-shadow:inset 0 0 45px #6d452a66}.campaign-paper svg{display:block;width:100%;max-height:70dvh;filter:sepia(.12)}
.map-regions polygon{fill:#c5b17f;stroke:#80683e;stroke-width:1.2;stroke-dasharray:4 2;cursor:pointer;transition:fill .15s}.map-regions polygon.owned{fill:#889b69}.map-regions polygon.selected,.map-regions polygon:hover,.map-regions polygon:focus{fill:#d7aa60;stroke:#8d3829;stroke-width:2.5;outline:none}
.map-city{cursor:pointer;fill:#4d3f29}.map-city circle{fill:#ede0bb;stroke:#695031;stroke-width:2}.map-city text{font:13px serif;paint-order:stroke;stroke:#d9c59a;stroke-width:3px;stroke-linejoin:round}.map-city.capital circle{fill:#913e30}.map-city.capital text{font-weight:bold;fill:#7b2f25}.map-city:focus circle{stroke:#b23d22;stroke-width:4}.map-sea{font:italic 20px serif;fill:#6c817b;letter-spacing:3px}.map-neighbor{font:13px serif;fill:#756c51}.campaign-legend{display:flex;gap:18px;justify-content:center;padding:12px;color:#695437;font-size:12px;border-top:1px solid #a98b52}.owned-key{color:#536944}
.campaign-info{padding:24px 28px;overflow:auto;max-height:calc(70dvh + 42px);background:radial-gradient(ellipse at top right,#3b3a2b00,#111b1955)}.campaign-info h3{font-size:28px;color:#ead3a3;margin:6px 0 12px}.campaign-info p{font-size:14px;line-height:1.8;color:#c4c5af}.campaign-info button{display:block;width:100%;padding:10px 14px;background:linear-gradient(#72613c,#51452e);border:1px solid #a28a53;border-radius:4px;color:#f6ebd1;cursor:pointer;font:inherit}.campaign-info button:disabled{opacity:.4;cursor:default}.campaign-info label{display:block;font-size:14px;color:#c3b38b}.campaign-info input,.campaign-info select{display:block;width:100%;box-sizing:border-box;margin:8px 0 14px;padding:8px;background:#171f1b;color:#e8dfc9;border:1px solid #736440;border-radius:4px;font:inherit}#campaignArmy{border-bottom:1px solid #60573b;padding-bottom:18px;margin-bottom:22px}.campaign-travel{border-left:2px solid #ba985e;padding-left:14px}.campaign-message{color:#e5c17c!important;min-height:24px}.campaign-info details{font-size:13px;border-top:1px solid #60573b;padding-top:16px}.campaign-info summary{cursor:pointer;color:#d3ba84}.campaign-foot{padding:12px 24px;color:#b5ad94;font-size:12px;border-top:1px solid #60573b;text-align:center}
@media(max-width:720px){.campaign-layout{grid-template-columns:1fr}.campaign-paper svg{max-height:65dvh}.campaign-info{max-height:none}.campaign-head{padding:14px}.campaign-head h2{font-size:20px}}
#barracksActions{margin-top:14px;padding-top:12px;border-top:1px solid #806741}#barracksActions p{font-size:13px;line-height:1.7;margin:6px 0;color:#d5c7a8}#barracksActions #barracksMission{color:#edce8a}#barracksActions button{display:block;width:100%;margin-top:8px;white-space:normal}#trainSoldiers:disabled{opacity:.45;cursor:default}
.map-coordinate-grid{stroke:#706246;stroke-width:.4;stroke-opacity:.17;pointer-events:none}.map-coordinate-grid text{stroke:none;fill:#877653;font:8px serif}.map-label-line{stroke:#766144;stroke-width:.7;fill:none;pointer-events:none}.map-city .map-neighbor-caption{font-size:9px;font-weight:normal}.map-neighbor-pin text{font-size:16px;font-weight:bold}.map-context-city text{font-size:11px}.map-context-city{pointer-events:none}.campaign-coordinate{font-size:11px!important;color:#acaa8f!important}.campaign-info a{color:#e1c789}
/* Compact city HUD and the options menu. */
.hud-icon{display:block;width:20px;height:20px;flex:none;color:var(--gold)}
.dock button{display:flex;align-items:center;justify-content:center;gap:6px;min-height:38px;line-height:1.35}.dock button span{min-width:0}.dock .hud-icon{width:18px;height:18px}
#toggleResources{display:flex;align-items:center;justify-content:space-between;width:100%;padding:7px 4px;border:0;background:none;box-shadow:none;text-align:left}
#toggleResources span{padding:0;font-size:12px;color:var(--gold)}#toggleResources .hud-icon{width:16px;height:16px;transform:rotate(180deg)}#toggleResources[aria-expanded=false] .hud-icon{transform:rotate(0)}
#resourceContents[hidden]{display:none}#resourceContents>#openGoods{width:100%;margin-top:5px;font-size:12px;padding:6px 4px}
#gameOptions{width:min(440px,92vw);max-height:90dvh;overflow:auto;padding:24px;border:1px solid #a88649;border-radius:10px;background:radial-gradient(ellipse at top,#413020,#1c1510 75%);color:var(--ink);box-shadow:0 24px 90px #000b}
#gameOptions::backdrop{background:#090b0bb8;backdrop-filter:blur(4px)}.options-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:24px}.options-head small{font-size:10px;letter-spacing:.2em;color:var(--muted)}.options-head h2{font-size:25px;font-weight:500;color:var(--gold);margin:5px 0}.options-head>button{border:0;background:none;font-size:22px;color:var(--muted)}.options-actions{display:grid;grid-template-columns:1fr 1fr;gap:12px}.options-actions>button{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:12px;min-height:112px;padding:16px 8px;border-radius:6px}.options-actions .hud-icon{width:28px;height:28px}.options-hint{margin:20px 0 0;text-align:center;font-size:12px;color:var(--muted)}
@media(max-width:760px){.dock button{flex-direction:column;gap:4px}.options-actions>button{min-height:96px}}
#uiToggle{display:flex;align-items:center;justify-content:center;width:38px;height:38px;padding:8px}#uiToggle .ui-eye-slash{display:none}#uiToggle[aria-pressed=true] .ui-eye-slash{display:block}
.music-settings{margin-top:20px;padding-top:16px;border-top:1px solid #806741}.music-settings>div{display:flex;align-items:center;justify-content:space-between;gap:12px}.music-settings h3{font-size:16px;font-weight:500;margin:0;color:var(--gold)}.music-settings label{display:flex;justify-content:space-between;font-size:13px;margin-top:14px;color:var(--muted)}.music-settings input{display:block;width:100%;margin:12px 0;accent-color:var(--gold)}.music-settings p{font-size:12px;color:var(--muted);margin:8px 0 0}
.music-settings .music-volume-controls{display:flex;align-items:center;gap:12px;margin-top:6px}.music-volume-controls button{flex:none;width:36px;height:36px;padding:0;font-size:22px}.music-settings .music-volume-controls input{flex:1;min-width:0;width:auto}
#gfx .menu-vista{position:relative}
#gfx .menu-vista .menu-loading{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:min(390px,92%);min-width:0;align-items:center;gap:16px;padding:28px 24px;text-align:center;background:linear-gradient(145deg,#20261ef5,#111810ed);border:1px solid #bba16b80;box-shadow:0 14px 50px #0007,inset 0 0 0 4px #c4a15a0c;pointer-events:auto;backdrop-filter:blur(8px)}
#gfx #menuLoadingTitle{font-size:22px;font-weight:500;color:#ead3a3;line-height:1.5}#gfx .menu-vista .menu-ready{justify-content:center;font-size:13px;line-height:1.7}#gfx .menu-vista #assetProgress{height:5px;max-width:none}#gfx .menu-loading[data-state=ready]{border-color:#aabb8199}#gfx .menu-loading[data-state=error]{border-color:#c67b6099}
@media(max-width:740px){#gfx .menu-vista{display:block;padding:0 0 24px}#gfx .menu-vista>.vista-top,#gfx .menu-vista>.vista-caption{display:none}#gfx .menu-vista .menu-loading{position:relative;top:auto;left:auto;transform:none;width:min(480px,100%);margin:18px auto 0;padding:18px}#gfx #menuLoadingTitle{font-size:19px}}
#gfx .menu-vista .menu-loading[hidden]{display:none}
#gfx .menu-vista>.logo{position:absolute;left:50%;top:24%;transform:translate(-50%,-50%);width:min(560px,100%);max-width:100%;height:auto;max-height:32dvh;object-fit:contain;filter:drop-shadow(0 8px 24px #000b)}
@media(max-width:740px){#gfx .menu-vista{grid-row:1;padding:20px 0 0}#gfx .menu-vista>.logo{position:relative;top:auto;left:auto;transform:none;width:min(320px,90%);max-height:22dvh;margin:0 auto}#gfx .menu-vista .menu-loading{margin:8px auto 0}#gfx .menu-panel{padding-top:18px}}
