/* Palette of the approved painted study; layout and controls stay familiar. */
:root{--paper:#faf9f0;--ink:var(--menu-3b3834, #3b3834);--muted:var(--menu-7d766d, #7d766d);--food:#b96659;--line:var(--menu-c7bfb5, #c7bfb5)}
body{background:var(--menu-b4a89b, #b4a89b);color:var(--ink)}
.brand h1{font-family:Georgia,'Times New Roman',serif;font-weight:700;letter-spacing:-.6px}
.resource,.realm-panel,.dock,.minimap-panel,.diplomacy-panel,.command-hint,.welcome,dialog{background:#faf9f0f5;border:1px solid var(--menu-74685b85, #74685b85);border-radius:9px 12px 8px 11px;box-shadow:2px 3px 0 var(--menu-52493e22, #52493e22)}
.resource.food{background:#f0dfd7}.resource.stone{background:#e0e6e7}.resource.gold{background:#eee5bd}
.resource strong{font-family:Georgia,'Times New Roman',serif;font-weight:700}
.command{background:var(--menu-e9e6e2, #e9e6e2);border-radius:5px 8px 4px 6px;border:1px solid transparent}
.command:hover{background:var(--menu-e1ddd8, #e1ddd8);border-color:var(--menu-9b8d7d, #9b8d7d)}
.command-icon img{filter:none;object-fit:contain}
.command-name{color:var(--menu-3b3834, #3b3834)}.command .count{background:#f9f7eb;border-color:var(--menu-beb5aa, #beb5aa)}
.small-button,.camera-tools button{background:#faf9f0;border:1px solid var(--menu-887b6d90, #887b6d90);border-radius:5px 7px 4px 6px;box-shadow:1px 2px 0 var(--menu-52493e20, #52493e20)}
.realm-entry{background:#f5f5e9;border-top-color:var(--menu-d7d0c9, #d7d0c9);border-right-color:var(--menu-d7d0c9, #d7d0c9);border-bottom-color:var(--menu-d7d0c9, #d7d0c9)}
.primary{background:var(--menu-7f705f, #7f705f);box-shadow:0 3px 0 var(--menu-544b40, #544b40)}.primary:hover{background:var(--menu-6b5f51, #6b5f51)}
#loading{background:var(--menu-e6e3df, #e6e3df);font-family:Georgia,'Times New Roman',serif}
.health>i{background:var(--menu-978876, #978876)}.guide-grid article{background:var(--menu-e9e5e1, #e9e5e1)}
.realm-score{font-size:10px;font-weight:700;color:var(--menu-645a4f, #645a4f);margin-top:4px}
.realm-entry.ranking-leader{border-color:#bd943c;border-left-color:var(--realm-color);background:#faf2d8}
.realm-line{flex-wrap:wrap}
.realm-name{line-height:1.4}
#kingdom-setup{width:min(940px,calc(100% - 32px));max-width:940px;max-height:94dvh;padding:30px;background:#f5efdf;color:var(--menu-443c32, #443c32);border:1px solid #a89977;border-radius:16px;box-shadow:0 24px 100px var(--menu-221e1980, #221e1980);overflow:auto}#kingdom-setup::backdrop{background:var(--menu-322c26b3, #322c26b3);backdrop-filter:blur(7px)}.kingdom-form header{text-align:center;margin-bottom:24px}.kingdom-form header small{letter-spacing:4px;color:#84704c}.kingdom-form h1{font-size:32px;margin:8px 0}.kingdom-form p{margin:0;color:#736a59}.setup-layout{display:grid;grid-template-columns:260px 1fr;gap:34px}.setup-preview{display:flex;flex-direction:column;align-items:center;justify-content:center;background:#e9e1cd;border:1px solid #d1c5a9;border-radius:12px;padding:12px;overflow-wrap:anywhere;text-align:center}.setup-preview canvas{width:220px;max-width:100%;height:auto}.setup-preview strong{font-size:23px;margin:16px 0 8px}.setup-description{font-size:13px;color:#736a59}.setup-options label,.setup-options legend{font-weight:700;font-size:14px}.setup-options input{box-sizing:border-box;width:100%;margin:8px 0 14px;padding:12px;background:#fffaf0;border:1px solid #b9ab8c;border-radius:7px;font:inherit;color:var(--menu-443c32, #443c32)}.setup-options fieldset{border:0;padding:0;margin:0 0 16px}.setup-options legend{margin-bottom:8px}.setup-options small{display:block;margin-top:6px;color:#736a59;font-size:11px}.setup-colors{display:flex;gap:9px;flex-wrap:wrap}.setup-colors button{width:34px;height:34px;min-height:0;border-radius:50%;border:2px solid #fff8e9;box-shadow:0 0 0 1px #b6aa91;cursor:pointer}.setup-colors button[aria-pressed=true]{outline:2px solid var(--menu-443c32, #443c32);outline-offset:3px}.setup-emblems{display:grid;grid-template-columns:repeat(10,1fr);gap:5px}.setup-emblems button{aspect-ratio:1;padding:3px;min-height:0;min-width:0;border:1px solid #d1c5a9;border-radius:5px;background:#fffaed;cursor:pointer}.setup-emblems img{display:block;width:100%;height:100%;object-fit:contain}.setup-emblems button[aria-pressed=true]{background:#dcc78e;outline:2px solid #76603e;outline-offset:0}.kingdom-form footer{display:flex;align-items:center;justify-content:space-between;gap:20px;border-top:1px solid #d1c5a9;margin-top:24px;padding-top:20px}.setup-error{font-size:12px;color:#736a59}.setup-play{background:var(--menu-675b4e, #675b4e);color:#fff5df;border:1px solid var(--menu-484036, #484036);border-radius:7px;padding:13px 34px;font:700 18px Georgia,serif;cursor:pointer;white-space:nowrap}.kingdom-form button:focus-visible{outline:3px solid #526b87;outline-offset:3px}.realm-heraldry{display:inline-flex;width:22px;height:26px;vertical-align:middle;margin-right:7px;clip-path:polygon(0 0,100% 0,100% 60%,85% 82%,50% 100%,15% 82%,0 60%);padding:2px;box-sizing:border-box}.realm-heraldry img{width:100%;height:100%;object-fit:contain}@media(max-width:650px){#kingdom-setup{padding:18px}.setup-layout{grid-template-columns:1fr;gap:20px}.setup-preview{display:grid;grid-template-columns:100px 1fr;padding:8px}.setup-preview canvas{grid-row:span 2;width:100px}.setup-preview strong{margin:0;font-size:20px}.setup-emblems{grid-template-columns:repeat(10,1fr)}.kingdom-form h1{font-size:25px}.kingdom-form footer{margin-top:12px}.setup-play{padding:12px 24px}}
@media(min-width:651px) and (max-height:850px){#kingdom-setup{padding:20px 28px}.kingdom-form header{margin-bottom:14px}.kingdom-form h1{font-size:28px}.setup-emblems button{aspect-ratio:auto;height:38px}.setup-options fieldset{margin-bottom:10px}.kingdom-form footer{margin-top:12px;padding-top:12px}.setup-preview canvas{width:190px}}

/* Player preferences and feudal ranking. */
#settings-dialog{width:min(420px,90vw)}
#settings-dialog label{display:block;margin:22px 0;font-size:15px}
#settings-dialog input[type=range]{display:block;width:100%;margin-top:12px;accent-color:#526b87}
#settings-dialog output{float:right;font-variant-numeric:tabular-nums}
#settings-dialog input[type=checkbox]{accent-color:#526b87;width:18px;height:18px;vertical-align:middle}
.top-actions .text-action{width:auto;padding:0 10px;font-size:12px}
#realm-list .realm-entry{background:color-mix(in srgb,var(--realm-color) 18%,#fffdf5);color:var(--menu-2b2722, #2b2722);border-color:color-mix(in srgb,var(--realm-color) 35%,#fffdf5);border-left:4px solid var(--realm-color)}
#realm-list .realm-name,#realm-list .realm-score,#realm-list .realm-relation,#realm-list .request-pending{color:inherit}
#realm-list .realm-name{display:flex;align-items:center;gap:6px;text-align:left}
#realm-list .realm-relation{display:flex;align-items:center;flex-wrap:wrap;gap:4px}
#realm-list .realm-vassals{margin:6px 0 0 13px;border-left:1px solid currentColor;padding-left:6px}
#realm-list .realm-vassals .realm-entry{padding:6px;margin:5px 0;font-size:11px}
#realm-list .realm-vassals .realm-name{font-size:11px}
#realm-list .realm-heraldry{flex-shrink:0}
#realm-list .realm-relation .realm-heraldry{width:20px;height:24px}
#realm-list .realm-relation .realm-heraldry img{width:100%;height:100%}
#realm-list .own-realm{outline:2px solid #fff;outline-offset:-3px}
@media(max-width:700px){.top-actions{flex-wrap:wrap;justify-content:flex-end;gap:4px}.top-actions .text-action{font-size:10px;padding:0 6px}}

.diplomacy-button{background:var(--menu-e4e0db, #e4e0db);color:var(--menu-2f2a24, #2f2a24);border-color:var(--menu-a39585, #a39585)}
.diplomacy-button:hover{background:var(--menu-d4cdc5, #d4cdc5);color:var(--menu-221e19, #221e19)}
.diplomacy-button.war-button{background:#f5d8d5;color:#782c29;border-color:#ce9690}
.diplomacy-button.war-button:hover{background:#ecc0bc;color:#60201e}
.diplomacy-button:focus-visible{outline:2px solid var(--menu-38312a, #38312a);outline-offset:2px}

.replay-button{position:fixed;top:100px;left:50%;transform:translateX(-50%);z-index:35;min-width:220px;padding:18px 34px;font-size:25px;font-weight:900;box-shadow:0 5px 20px var(--menu-2e282240, #2e282240)}
.replay-button[hidden]{display:none}
@media(max-width:800px){.replay-button{top:145px;min-width:180px;padding:14px 26px;font-size:22px}}

.awaiting-replay #toast{top:205px}
@media(max-width:800px){.awaiting-replay #toast{top:240px}}

.placing-castle #toast{top:170px}
@media(max-width:800px){.placing-castle #toast{top:210px}}

.command.unaffordable,.command.unaffordable:hover{background:#f0ceca;border-color:#cb8e87}
.command.unaffordable .command-icon{filter:grayscale(1);opacity:.65}
.command.unaffordable .cost{opacity:1}
.command .cost-item.missing{color:#a32625}
.count.at-limit{color:#b51f24;background:#fff0e9;border-color:#c35b57}

.shield-choices{display:flex;flex-wrap:wrap;gap:7px}.shield-choices button{display:flex;flex-direction:column;align-items:center;gap:3px;min-width:64px;padding:5px 8px;background:#fffaf0;color:var(--menu-443c32, #443c32);border:1px solid #b9ab8c;border-radius:6px;cursor:pointer;font:600 12px Arial}.shield-choices canvas{width:32px;height:38px}.shield-choices button[aria-pressed=true]{background:#dcc78e;outline:2px solid #76603e}.realm-heraldry{clip-path:none;padding:0;background:transparent}.setup-preview{align-self:start;position:sticky;top:0}.setup-options [hidden]{display:none}@media(max-width:650px){.setup-preview{position:static}}

.command .capacity-gain{position:absolute;right:4px;top:27px;padding:2px 5px;border:1px solid var(--menu-887866, #887866);border-radius:5px;background:var(--menu-eeece9, #eeece9);color:var(--menu-4f463c, #4f463c);font:900 14px Arial,sans-serif;line-height:18px;pointer-events:none;box-shadow:0 1px 3px var(--menu-3d362e20, #3d362e20)}.command .capacity-gain[hidden]{display:none}@media(max-width:800px){.command .capacity-gain{top:22px;right:2px;font-size:12px;padding:1px 3px}}

/* Architecture choice below the heraldic identity. */
#kingdom-setup .architecture-section{width:100%;margin:18px 0 0;box-sizing:border-box;text-align:left}
#kingdom-setup .architecture-choices{display:flex;gap:8px;margin:10px 0}
#kingdom-setup .architecture-choices button{flex:1;padding:9px 5px;border:1px solid var(--menu-80776d, #80776d);border-radius:6px;background:#e7e0cc;color:var(--menu-3b3630, #3b3630);cursor:pointer}
#kingdom-setup .architecture-choices button[aria-pressed="true"]{background:var(--menu-5a5044, #5a5044);color:#fff3d7;outline:2px solid #bca573;outline-offset:1px}
#kingdom-setup canvas.architecture-preview{display:block;width:100%;height:auto;max-height:none;border:1px solid var(--menu-7c7165, #7c7165);border-radius:8px;box-sizing:border-box}

@media(max-width:650px){#kingdom-setup .architecture-section{grid-column:1/-1}#kingdom-setup canvas.architecture-preview{width:100%;grid-row:auto}}

#kingdom-setup .architecture-choices{flex-wrap:wrap}#kingdom-setup .architecture-choices button{flex:1 1 90px}

/* Small gaps between economy, army, buildings and castle. */
.dock .command.group-start{margin-left:12px}
@media(max-width:800px){.dock .command.group-start{margin-left:6px}}

.wall-preview .command-icon{font-size:42px;color:var(--menu-38332d, #38332d)}.wall-preview .cost{font-size:10px}

.kingdom-form>fieldset{border:0;padding:0;margin:0 0 24px;min-width:0}.kingdom-form>fieldset>legend{font-weight:700;margin-bottom:10px}
.lifestyle-choices{display:grid;grid-template-columns:1fr 1fr;gap:16px}
#kingdom-setup .lifestyle-card{display:flex;flex-direction:column;gap:10px;min-width:0;padding:16px;border:2px solid #b9ab8c;border-radius:12px;background:#fff8e8;color:var(--menu-443c32, #443c32);text-align:left;font:inherit;cursor:pointer;transition:border-color .15s,background .15s}
#kingdom-setup .lifestyle-card>strong{font:700 23px Georgia,serif;display:flex;justify-content:space-between;align-items:center}
#kingdom-setup .lifestyle-card>strong::after{content:'○';font:20px Arial;color:#81785f}
#kingdom-setup .lifestyle-card[aria-pressed=true]{border-color:var(--menu-655a4d, #655a4d);background:var(--menu-e6e2de, #e6e2de);box-shadow:0 0 0 1px var(--menu-655a4d, #655a4d)}
#kingdom-setup .lifestyle-card[aria-pressed=true]>strong::after{content:'✓';color:var(--menu-5b5145, #5b5145)}
#kingdom-setup .lifestyle-card:hover{border-color:var(--menu-655a4d, #655a4d)}
.lifestyle-scene{display:block;box-sizing:border-box;width:100%;height:auto;border:1px solid #a59876;border-radius:7px}
.lifestyle-description{font-size:14px;line-height:1.5}.lifestyle-tax{font-size:12px;font-weight:700;line-height:1.5;margin-top:auto;padding-top:10px;border-top:1px solid #c9bea2}
.dark-interface #kingdom-setup .lifestyle-card{background:var(--menu-3d3934, #3d3934);color:#eee5cf;border-color:var(--menu-746a5e, #746a5e)}.dark-interface #kingdom-setup .lifestyle-card[aria-pressed=true]{background:var(--menu-52483d, #52483d);border-color:var(--menu-c0b7ac, #c0b7ac);box-shadow:0 0 0 1px var(--menu-c0b7ac, #c0b7ac)}.dark-interface #kingdom-setup .lifestyle-card>strong::after{color:var(--menu-c0b7ac, #c0b7ac)}
@media(max-width:650px){.lifestyle-choices{grid-template-columns:1fr;gap:12px}#kingdom-setup .lifestyle-card{padding:12px;gap:8px}.lifestyle-scene{max-height:150px;object-fit:cover}}

#settings-dialog section+section{border-top:1px solid var(--line);margin-top:28px;padding-top:20px}
#settings-dialog section h3{font-size:18px;margin:18px 0 12px;font-weight:800}

.realm-entry.ranking-hover{outline:2px solid #ffe13b;outline-offset:-2px}.realm-entry.ranking-hover > .realm-line .realm-heraldry{filter:drop-shadow(0 0 5px #ffe13b)}

/* Active orders remain legible even when recruiting is unaffordable or capped. */
.command.active,.command.active.unaffordable,.command.active.unaffordable:hover{background:var(--menu-e1ddd8, #e1ddd8);border-color:var(--menu-6f6254, #6f6254);box-shadow:inset 0 0 0 2px var(--menu-6f6254, #6f6254),0 0 10px #d8c16b80}
.dark-interface .dock .command.active,.dark-interface .dock .command.active.unaffordable,.dark-interface .dock .command.active.unaffordable:hover{background:var(--menu-5b5044, #5b5044);border-color:var(--menu-c0b7ac, #c0b7ac);box-shadow:inset 0 0 0 2px var(--menu-c0b7ac, #c0b7ac),0 0 10px #d8c16b80}
.command.active.unaffordable .command-icon{filter:none;opacity:1}

.command .auto-purchase-border{display:none;position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:5;overflow:visible}
.command.auto-purchase .auto-purchase-border{display:block}
.auto-purchase-border rect{fill:none;stroke:#fff;stroke-width:2.5;stroke-linecap:round;stroke-dasharray:12 38;animation:auto-purchase-orbit 2.5s linear infinite;filter:drop-shadow(0 0 2px #ffffffa0)}
@keyframes auto-purchase-orbit{to{stroke-dashoffset:-100}}
@media(prefers-reduced-motion:reduce){.auto-purchase-border rect{animation:none}}

.command.auto-purchase-holding .auto-purchase-border{display:block}
.command.auto-purchase-holding .auto-purchase-border rect{animation:auto-purchase-charge .4s linear forwards;stroke-dashoffset:0}
@keyframes auto-purchase-charge{from{stroke-dasharray:0 50}to{stroke-dasharray:12 38}}
