:root{--log-w:276px;--court-nav-h:58px;--ink:#382715;--paper:#fff8e8;--paper2:#f3e5c7;--gold:#a66d16;--jade:#397c68;--cinnabar:#a94835}
body{background:#d8c7a2;color:var(--ink)}
#title-screen{background:linear-gradient(rgba(255,245,217,.12),rgba(83,49,19,.28)),url('../img/bg/title_bg.jpg') center/cover no-repeat!important}
#game-screen{background:#e9ddc0!important}
#main-row{position:relative;grid-template-columns:minmax(0,1fr) var(--log-w)!important;background:#e8dcc4}
#screen-root{padding:7px 9px 8px!important}
#topbar{min-height:54px;background:linear-gradient(#fff7df,#ead6a8)!important;color:#533816!important;border-bottom:2px solid #b4873d!important;box-shadow:0 3px 10px rgba(92,61,20,.18)!important;display:grid!important;grid-template-columns:auto auto repeat(9,minmax(78px,auto));gap:4px!important}
#topbar>span{padding:6px 8px!important;color:#59401d!important;background:rgba(255,255,255,.46)!important;border:1px solid rgba(152,105,38,.32)!important;border-radius:3px!important;text-align:center}
#topbar>span:hover{background:#fffaf0!important;border-color:#b78336!important}
#tb-v7-extra{display:none!important}
#log-panel{background:linear-gradient(90deg,#f2e6ca,#fffaf0)!important;border-left:1px solid #b99150!important}
.log-header{background:linear-gradient(#fff3d3,#e8ca88)!important;color:#694716!important}

/* 正殿按钮位于画面内部右侧；朝堂按钮固定在画面底部。 */
#action-rail{position:absolute;z-index:8;right:calc(var(--log-w) + 24px);top:50%;transform:translateY(-50%);width:132px;padding:8px!important;display:grid!important;gap:7px!important;background:rgba(255,248,226,.76)!important;border:1px solid rgba(140,94,34,.55)!important;box-shadow:0 8px 25px rgba(75,44,16,.20)!important;backdrop-filter:blur(5px);align-content:center!important}
#action-rail button{min-height:43px!important;padding:8px 10px!important;color:#573815!important;background:linear-gradient(90deg,#fffaf0,#ead6a8)!important;border:1px solid #a87936!important;border-radius:2px!important;box-shadow:0 2px 5px rgba(74,46,16,.14)!important;font:700 15px var(--serif)!important;letter-spacing:3px!important}
#action-rail button:hover,#action-rail button:focus-visible{color:#773f19!important;background:linear-gradient(90deg,#ffe8ab,#f4c96e)!important;border-color:#bd761f!important;transform:translateX(-2px)!important}
#action-rail button i{display:none!important}
#action-rail[data-scene="court"]{left:10px;right:calc(var(--log-w) + 10px);bottom:9px;top:auto;transform:none;width:auto;height:var(--court-nav-h);grid-template-columns:repeat(10,minmax(0,1fr));padding:5px!important;background:rgba(255,249,230,.92)!important}
#action-rail[data-scene="court"] button{min-height:0!important;padding:5px 2px!important;font-size:12px!important;letter-spacing:1px!important}
#action-rail[data-scene="court"] .rail-log{display:none!important}
#action-rail[data-scene="harem"],#action-rail[data-scene="visit"]{right:calc(var(--log-w) + 24px)}

.v7-page,.palace-scene,.world-page,.map-select-page{border:1px solid #b68b4b!important;background:#fbf3df!important;box-shadow:0 5px 18px rgba(78,52,18,.18)!important}
.v7-page{padding-bottom:calc(var(--court-nav-h) + 4px)}
.v7-heading{background:linear-gradient(100deg,#fff8e5,#e9d19c)!important}
.v7-content{padding:10px!important}
.palace-scene{background:linear-gradient(90deg,rgba(255,246,219,.08),rgba(255,246,219,.18)),url('../img/bg/palace_bg.jpg') center/cover no-repeat!important}
.palace-art{grid-template-columns:minmax(300px,1fr) minmax(210px,.55fr)!important;color:#5a3515!important;text-shadow:0 1px 1px rgba(255,255,255,.85)!important;padding:clamp(20px,3vw,42px)!important;padding-right:180px!important}
.palace-title{background:linear-gradient(90deg,rgba(255,250,232,.90),rgba(255,250,232,.36))!important;border-left:5px solid #bd7331!important}
.palace-title span{color:#9a5a20!important}.palace-title h1{color:#6f3519!important}
.palace-overview{background:rgba(255,250,232,.84)!important;border-color:#b9853d!important;backdrop-filter:blur(5px)}
.palace-overview article,.palace-agenda article{background:rgba(255,247,220,.78)!important;border-color:#c39854!important}.palace-overview span,.palace-agenda span{color:#77572f!important}.palace-overview b,.palace-agenda b{color:#733d1c!important}
.palace-agenda{display:grid!important;grid-template-columns:repeat(3,1fr);gap:8px;background:rgba(255,250,232,.82)!important;border:1px solid #bc8e4b!important;padding:10px!important}

/* 统一2:3人物立绘。 */
.portrait-slot,.candidate-portrait{position:relative;overflow:hidden;padding:0!important;background:#ead9bb!important;border:1px solid #a87942!important}
.portrait-slot{width:120px;aspect-ratio:2/3;align-self:center}
.portrait-slot img,.candidate-portrait img,.general-detail-portrait{width:100%;height:100%;display:block;object-fit:cover;object-position:center top}
.candidate-portrait{width:100%;height:auto!important;aspect-ratio:2/3;align-self:center;max-height:100%}
.candidate-view{grid-template-columns:minmax(300px,38%) minmax(0,1fr)!important;align-items:stretch}
.candidate-profile{background:#fffaf0!important;overflow:hidden}
.candidate-modal{width:min(1120px,calc(100vw - 26px))!important;height:min(720px,calc(100dvh - 22px))!important}
.general-detail-portrait{width:180px;aspect-ratio:2/3;float:left;margin:0 16px 10px 0;border:2px solid #aa7a37;object-fit:cover}
.consort-grid{height:calc(100% - 150px)!important}.consort-card{grid-template-columns:120px minmax(0,1fr)!important;background:#fffaf0!important}
.card-actions button:hover{background:#d99d43!important;color:#4c2d0d!important}

/* 人事与内容密度。 */
.hr-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:8px}.hr-summary article{display:flex;justify-content:space-between;align-items:center;padding:9px 13px;background:#efe0bd;border:1px solid #c29b59}.hr-summary b{font-size:20px;color:#8c5319}
.roster-grid{height:calc(100% - 100px);display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:minmax(76px,1fr);gap:7px;overflow:hidden}.roster-card{padding:9px;background:#fffaf0;border:1px solid #c7a46b;cursor:pointer}.roster-card:hover{background:#fff0c9}.roster-card>div{display:flex;justify-content:space-between}.roster-card p{margin:6px 0;font-size:12px}.roster-card small{color:#80694a}
.page-actions{position:absolute;left:12px;right:12px;bottom:calc(var(--court-nav-h) + 8px);display:grid;grid-template-columns:repeat(5,1fr);gap:5px}.page-actions button{padding:7px;background:#ead4a5;border:1px solid #aa7b38;color:#563716;font-weight:700}
.roster-card button{margin-top:5px;padding:4px 8px;background:#e1bd78;border:1px solid #a87936;color:#543513}.roster-card em{float:right;color:#9a5a20;font-style:normal;font-weight:700}
.featured-attrs{display:flex;align-items:center;gap:5px!important}.featured-attrs strong{padding:3px 7px;background:#ead19c;border:1px solid #bc8c45;color:#754116}.featured-attrs span{margin-left:auto;color:#765f42}
.court-v8{height:100%;display:grid;grid-template-columns:minmax(260px,.75fr) minmax(0,1.25fr);gap:12px}.court-throne{display:grid;place-content:center;text-align:center;gap:14px;background:linear-gradient(rgba(255,249,228,.76),rgba(245,222,174,.9)),url('../img/bg/court_bg.jpg') center/cover;border:1px solid #b98b46}.court-throne span{letter-spacing:5px;color:#8a5b22}.court-throne h2{font:700 30px var(--serif);color:#6d3b18}.court-briefs{display:grid;grid-template-rows:auto repeat(4,minmax(0,1fr));gap:7px}.court-briefs h3{margin:0;padding:8px;background:#ead19c}.court-briefs article{display:grid;grid-template-columns:100px 1fr;gap:10px;align-items:center;padding:9px 12px;background:#fffaf0;border:1px solid #c7a46b}.court-briefs article b{color:#966020}.army-v8-list{height:calc(100% - 58px);display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(150px,1fr);gap:8px}.army-v8-card{display:grid;grid-template-rows:auto auto 1fr;padding:10px;background:#fffaf0;border:1px solid #c29b59}.army-v8-card header,.army-v8-card footer{display:flex;justify-content:space-between;gap:6px;flex-wrap:wrap}.army-v8-card h3{margin:0}.army-v8-card header>b{padding:4px 8px}.army-v8-card .ready{color:#28705b;background:#dceee3}.army-v8-card .spent{color:#765f42;background:#ede4d3}.army-bars{display:grid;grid-template-columns:repeat(4,1fr);gap:5px;margin:9px 0}.army-bars label{padding:6px;text-align:center;background:#f0e1bf;border:1px solid #d0ae73}.army-bars strong{display:block;color:#874d18}.army-v8-card footer button{padding:6px 9px;background:#e5c98f;border:1px solid #aa7a36;color:#4e3114}.army-v8-card footer .danger{background:#c96c4d;color:white}

/* 天下地图填满主画面，外交并入右栏。 */
.world-page{height:100%;display:grid;grid-template-rows:64px minmax(0,1fr);padding-bottom:calc(var(--court-nav-h) + 4px);overflow:hidden}.world-page>header{display:flex;align-items:center;justify-content:space-between;padding:8px 18px;background:linear-gradient(90deg,#fff6df,#e4c88d);border-bottom:1px solid #ae813e}.world-page>header span{color:#876233;letter-spacing:3px}.world-page>header h2{margin:2px 0;font:700 25px var(--serif);letter-spacing:5px}.world-page>header button{padding:10px 16px;background:#a44d31;color:#fff5dc;border:1px solid #74301d}.world-page main{min-height:0;padding:8px}.world-page .panel-body{height:100%;display:grid!important;grid-template-columns:minmax(0,1fr) minmax(260px,30%);gap:8px!important;padding:0!important}.world-page #map-wrap{background:#d9c99e!important;border:1px solid #9c753d!important}.world-page #map-canvas{width:100%;height:100%;object-fit:contain}.world-page .map-side{padding:10px!important;background:#fffaf0!important}.world-focus header{padding:12px;border-left:6px solid var(--faction);background:#efe0bd}.world-focus h2{margin:3px 0;font-size:25px}.world-stats{display:grid;grid-template-columns:repeat(2,1fr);gap:6px;margin:10px 0}.world-stats b{padding:9px;text-align:center;background:#f2e6cd;border:1px solid #cfb07a}.world-diplomacy{display:grid;grid-template-columns:repeat(2,1fr);gap:6px;margin-top:12px}.world-diplomacy button{padding:10px;background:#e7cc94;border:1px solid #a97834;color:#543513}
.rank-modal{width:min(860px,calc(100vw - 24px))!important;height:min(690px,calc(100dvh - 24px))!important;overflow:hidden!important}.power-rank{height:100%;display:grid;grid-template-rows:auto repeat(13,minmax(0,1fr)) auto;gap:3px}.power-rank h2{margin:0}.power-rank article{display:grid;grid-template-columns:32px 12px 1fr 110px;grid-template-rows:1fr 1fr;align-items:center;padding:3px 8px;background:#f7ecd6;border:1px solid #d1b27a}.power-rank strong{grid-row:1/3;font-size:18px}.power-rank i{grid-row:1/3;width:9px;height:32px}.power-rank div{display:grid}.power-rank span,.power-rank small{font-size:10px;color:#756247}.power-rank em{font-style:normal;font-weight:700;color:#9a5a20}.power-rank small{grid-column:3/5}
.family-alert{text-align:center;display:grid;gap:12px;padding:18px}.family-alert>span{color:#9a6825;letter-spacing:5px}.family-alert h2{font:700 29px var(--serif);margin:0}.family-alert>div{display:grid;grid-template-columns:repeat(2,1fr);gap:7px}.family-alert button{padding:10px;background:#ead3a2;border:1px solid #a97834}

/* 明亮基础组件，减少无意义暗色与说明小字。 */
.system-card,.action-grid article,.case-list article,.family-grid article,.building-catalog article,.project-list article,.diplomacy-grid article{background:#fffaf0!important;border-color:#c7a66e!important}.v7-heading span,.page-note,.tip{color:#756247}.location-banner{color:#573617!important;background:linear-gradient(110deg,#f5e5bf,#d7b471)!important}.location-banner span{color:#95601f!important}.location-banner h2{color:#673816!important}.harem-banner{background:linear-gradient(110deg,#f6d9d9,#e5b0b5)!important}.garden-banner{background:linear-gradient(110deg,#dcebcf,#c6d19b)!important}.clinic-banner{background:linear-gradient(110deg,#d2e9e1,#aed0c4)!important}

@media(max-width:1100px){:root{--log-w:210px}.roster-grid{grid-template-columns:repeat(3,1fr)}#topbar{grid-template-columns:repeat(6,1fr)!important}#topbar>span{font-size:11px!important}.palace-art{padding-right:155px!important}#action-rail{right:calc(var(--log-w) + 18px);width:118px}.world-page .panel-body{grid-template-columns:minmax(0,1fr) 240px}}
@media(max-width:700px){:root{--log-w:40px;--court-nav-h:52px}#main-row{grid-template-columns:minmax(0,1fr) var(--log-w)!important}#topbar{min-height:72px!important;grid-template-columns:repeat(4,1fr)!important;padding:3px!important}#topbar>span{display:block!important;padding:3px!important;font-size:9px!important}#tb-ruler,#tb-people{display:none!important}#action-rail{right:calc(var(--log-w) + 7px);width:86px;padding:4px!important}#action-rail button{min-height:38px!important;font-size:11px!important;letter-spacing:1px!important}.palace-art{display:block!important;padding:12px 104px 12px 12px!important}.palace-title{padding:10px!important}.palace-title h1{font-size:27px!important}.palace-overview{grid-template-columns:repeat(2,1fr)!important;margin-top:7px}.palace-agenda{grid-template-columns:repeat(3,1fr)!important}.palace-agenda article{padding:5px!important}.v7-page{grid-template-rows:48px minmax(0,1fr)!important}.v7-content{padding:5px!important}.consort-grid{grid-template-columns:1fr!important}.consort-card{grid-template-columns:84px minmax(0,1fr)!important}.portrait-slot{width:84px}.candidate-view{grid-template-columns:minmax(128px,34%) minmax(0,1fr)!important;gap:5px!important}.candidate-profile{padding:6px!important}.candidate-profile h2{font-size:18px!important}.candidate-attrs article{padding:2px!important}.bio-card{font-size:9px!important;line-height:1.3!important}.roster-grid{grid-template-columns:repeat(2,1fr);grid-auto-rows:minmax(66px,1fr)}.roster-card{padding:5px}.roster-card p{font-size:9px}.page-actions{grid-template-columns:repeat(5,1fr);gap:2px}.page-actions button{font-size:9px;padding:5px 1px}#action-rail[data-scene="court"]{left:4px;right:calc(var(--log-w) + 4px);bottom:4px;grid-template-columns:repeat(5,1fr);height:auto;min-height:var(--court-nav-h);overflow:hidden}#action-rail[data-scene="court"] button{font-size:9px!important}.world-page{grid-template-rows:48px minmax(0,1fr)}.world-page>header{padding:4px 7px}.world-page>header h2{font-size:18px}.world-page>header button{padding:6px;font-size:10px}.world-page .panel-body{grid-template-columns:minmax(0,1fr) 130px!important}.world-page .map-side{padding:4px!important;font-size:9px}.world-stats{gap:2px}.world-stats b{padding:3px;font-size:9px}.world-diplomacy{gap:2px}.world-diplomacy button{padding:5px 1px;font-size:9px}.power-rank article{grid-template-columns:22px 8px 1fr 65px}.power-rank{grid-template-rows:auto repeat(13,minmax(0,1fr)) auto}.general-detail-portrait{width:110px}.rank-modal{padding:6px!important}.court-v8{grid-template-columns:1fr 1.2fr;gap:5px}.court-throne h2{font-size:20px}.court-briefs article{grid-template-columns:64px 1fr;padding:4px;font-size:9px}.army-v8-list{grid-template-columns:1fr}.army-bars{gap:2px}.army-bars label{padding:3px;font-size:9px}}
@media(max-width:500px) and (orientation:portrait){#main-row{grid-template-columns:minmax(0,1fr) var(--log-w)!important}.world-page .panel-body{grid-template-columns:1fr!important;grid-template-rows:minmax(240px,55%) minmax(0,1fr)!important}.world-page .map-side{font-size:10px;overflow:hidden}.candidate-view{grid-template-columns:38% minmax(0,1fr)!important}.candidate-portrait{align-self:start}.palace-overview article{min-height:46px!important}.palace-agenda{display:none!important}}
@media(max-width:500px) and (orientation:portrait){.candidate-modal{height:auto!important;max-height:calc(100dvh - 18px)!important}.candidate-view{min-height:0!important}}
@media(max-height:650px){.build-dashboard{display:none!important}.project-list:empty{display:none!important}.building-catalog p{display:none!important}.building-catalog article{padding:5px!important}.building-catalog article>div{margin-top:2px!important}.building-catalog+.page-turn{height:30px!important}}
@media(max-height:560px){#topbar{min-height:44px}.palace-art{padding-top:10px!important;padding-bottom:10px!important}.palace-title p{display:none}.palace-overview article{min-height:48px!important}.candidate-modal{height:calc(100dvh - 8px)!important}.candidate-profile{gap:3px!important;padding:5px!important}.candidate-attrs article{padding:2px!important}.bio-card{line-height:1.25!important;padding:4px!important}.roster-card p{margin:2px 0}.hr-summary{display:none}.roster-grid{height:calc(100% - 38px)}.section-title{margin:0!important;font-size:12px!important}.building-catalog{gap:2px!important}.building-catalog h3{margin:0!important}.v7-content{padding:3px!important}}
.emperor-compact{position:absolute;right:14px;bottom:calc(var(--court-nav-h) + 10px);padding:7px 12px;background:#a44d31;color:#fff;border:1px solid #71311f}.case-list,.target-grid,.relation-grid,.training-list,.chronicle{max-height:calc(100% - 40px);overflow:hidden}.v7-content>.page-turn{position:absolute;left:12px;right:12px;bottom:calc(var(--court-nav-h) + 5px)}
.military-v8{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.military-v8 section{display:grid;gap:5px;text-align:center;padding:14px;background:#efe0bd;border:1px solid #c29b59}.military-v8 b{font-size:22px;color:#8b501a}.military-actions{height:calc(100% - 82px);display:grid;grid-template-columns:repeat(2,1fr);gap:10px;padding-top:10px}.military-actions button{font:700 21px var(--serif);letter-spacing:3px;background:linear-gradient(135deg,#fff9e9,#e4c583);border:1px solid #aa7936;color:#5a3515}.military-actions button:hover{background:#f2d48f}.military-actions b{display:block}
@media(max-height:450px){.court-v8{position:absolute;inset:3px!important;height:auto!important}.court-briefs{grid-template-rows:auto repeat(2,minmax(0,1fr))!important}.court-throne{gap:4px!important}.court-throne h2{font-size:19px!important;margin:3px}.court-briefs h3{padding:3px!important}.case-list article,.target-grid article,.relation-grid article,.training-list article,.chronicle article{padding:4px!important}.army-create{min-height:28px!important;gap:3px!important}.army-create select,.army-create input,.army-create button{min-height:26px!important;height:26px!important;padding:1px 4px!important}.army-v8-list{height:calc(100% - 34px)!important}.army-v8-list .empty-state{min-height:0!important;height:100%!important;padding:4px!important}.action-grid article p{display:none!important}.military-v8 section{padding:4px}.military-v8 b{font-size:15px}.military-actions{height:calc(100% - 48px);gap:4px;padding-top:4px}.military-actions button{font-size:15px}.location-banner{display:none!important}.consort-grid{height:100%!important}}
@media(max-height:450px){.city-manage-grid article p{display:none!important}.action-grid{height:100%!important;grid-template-columns:repeat(4,1fr)!important;gap:3px!important}.action-grid article{min-height:0!important;padding:4px!important}.action-grid article h3{margin:2px!important;font-size:14px!important}.army-v8-list .empty-state span{display:none!important}.consort-grid .empty-state{min-height:0!important;height:100%!important}.route-summary{padding:2px!important}}
@media(max-width:700px) and (min-height:451px){.military-actions{height:auto;position:absolute;left:5px;right:5px;top:92px;bottom:5px}.military-v8 section{padding:7px}.army-v8-list .empty-state{min-height:0!important;height:100%!important}.army-v8-list .empty-state span{display:none!important}}
.v7-content{position:relative}.army-v8-list{height:calc(100% - 85px)!important}
@media(max-height:450px){.city-manage-grid article{padding:2px!important}.city-manage-grid h3{margin:0!important}.city-manage-grid .meter-row{margin:2px 0!important}.city-manage-grid button{min-height:24px!important;padding:2px 5px!important}.army-v8-list{height:calc(100% - 72px)!important}.action-grid{height:calc(100% - 5px)!important}.consort-grid{height:calc(100% - 45px)!important}}
@media(max-height:450px){.army-v8-list{grid-auto-rows:minmax(0,1fr)!important}.consort-grid{grid-template-rows:minmax(0,1fr)!important}.consort-grid .empty-state{height:auto!important;min-height:0!important;overflow:hidden!important}}
