:root {
  --parch: #efe3c8; --dark: #2b1b12; --darker: #1e130c; --mid: #4a3020; --panel: #3a2618; --hi: #5a3d28;
  --gold: #e6b33a; --crimson: #8e1c1c; --muted: #b8a888; --bad: #ff7b6b; --good: #9fd18b; --blue: #7fc8ff;
  --purple: #6a2c91; --epic: #a066d3; --crown: #5fc8e6; --line: #6b4a2a;
  --title: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--dark); color: var(--parch);
  font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
h1, h2, h3 { font-family: var(--title); color: var(--gold); margin: 4px 0; }
h2 { font-size: 18px; } h3 { font-size: 16px; }
.small { font-size: 12px; } .tiny { font-size: 11px; } .muted { color: var(--muted); }
.gold { color: var(--gold); } .bad { color: var(--bad); } .good { color: var(--good); } .blue { color: var(--blue); }
.center-msg { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--title); color: var(--gold); font-size: 20px; }

#app, #game { height: 100%; }
#game { display: flex; flex-direction: column; }
#view { flex: 1; min-height: 0; overflow: hidden; position: relative; }
.scroll { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page { max-width: 820px; margin: 0 auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }

/* resource bar */
#resbar { background: var(--darker); padding: 4px 10px; padding-top: max(4px, env(safe-area-inset-top)); }
#resbar .row1 { display: flex; align-items: center; gap: 12px; max-width: 820px; margin: 0 auto; }
#resbar .name { font-family: var(--title); font-weight: bold; color: var(--gold); font-size: 15px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#resbar .res { display: flex; justify-content: space-between; max-width: 820px; margin: 2px auto 0; font-size: 13px; }
#resbar .res span { white-space: nowrap; }
#resbar .alert { max-width: 820px; margin: 0 auto; font-size: 12px; font-weight: bold; }
.ri { display: inline-block; width: 16px; height: 16px; margin-right: 3px; vertical-align: -3px; background: center / contain no-repeat; filter: drop-shadow(0 1px 1px rgba(0,0,0,.55)); }
#resbar .ri { width: 22px; height: 22px; vertical-align: -6px; margin-right: 4px; }
.ri.food { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2032%2032'%3E%3Cdefs%3E%3ClinearGradient%20id%3D'g'%20x1%3D'0'%20y1%3D'0'%20x2%3D'1'%20y2%3D'1'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%23ffe48a'%2F%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%23c98a1e'%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%20%3Cg%20stroke%3D'%238a5a12'%20stroke-width%3D'1.2'%20stroke-linecap%3D'round'%3E%3Cpath%20d%3D'M16%2030%20L16%2012%20M16%2030%20L9%2013%20M16%2030%20L23%2013%20M16%2030%20L12.5%2011%20M16%2030%20L19.5%2011'%20fill%3D'none'%2F%3E%3C%2Fg%3E%20%3Cg%20fill%3D'url(%23g)'%20stroke%3D'%238a5a12'%20stroke-width%3D'.7'%3E%20%3Cellipse%20cx%3D'16'%20cy%3D'6'%20rx%3D'2.3'%20ry%3D'4.6'%2F%3E%3Cellipse%20cx%3D'12'%20cy%3D'7.5'%20rx%3D'2.1'%20ry%3D'4.3'%20transform%3D'rotate(-14%2012%207.5)'%2F%3E%3Cellipse%20cx%3D'20'%20cy%3D'7.5'%20rx%3D'2.1'%20ry%3D'4.3'%20transform%3D'rotate(14%2020%207.5)'%2F%3E%20%3Cellipse%20cx%3D'8'%20cy%3D'10.5'%20rx%3D'2'%20ry%3D'4'%20transform%3D'rotate(-28%208%2010.5)'%2F%3E%3Cellipse%20cx%3D'24'%20cy%3D'10.5'%20rx%3D'2'%20ry%3D'4'%20transform%3D'rotate(28%2024%2010.5)'%2F%3E%3C%2Fg%3E%20%3Cpath%20d%3D'M10.5%2021.5%20Q16%2024.5%2021.5%2021.5%20L21%2024.5%20Q16%2027%2011%2024.5%20Z'%20fill%3D'%23b3261e'%20stroke%3D'%236e1410'%20stroke-width%3D'.7'%2F%3E%3C%2Fsvg%3E"); }
.ri.wood { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2032%2032'%3E%3Cdefs%3E%3ClinearGradient%20id%3D'b'%20x1%3D'0'%20y1%3D'0'%20x2%3D'0'%20y2%3D'1'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%238a5a2e'%2F%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%234a2c14'%2F%3E%3C%2FlinearGradient%3E%3CradialGradient%20id%3D'e'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%23f1d19a'%2F%3E%3Cstop%20offset%3D'.7'%20stop-color%3D'%23d9a965'%2F%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%239a6a34'%2F%3E%3C%2FradialGradient%3E%3C%2Fdefs%3E%20%3Cg%20stroke%3D'%233a2210'%20stroke-width%3D'.9'%3E%20%3Crect%20x%3D'9'%20y%3D'17'%20width%3D'20'%20height%3D'10'%20rx%3D'5'%20fill%3D'url(%23b)'%2F%3E%3Crect%20x%3D'2'%20y%3D'17'%20width%3D'20'%20height%3D'10'%20rx%3D'5'%20fill%3D'url(%23b)'%20opacity%3D'0'%2F%3E%20%3Crect%20x%3D'5'%20y%3D'8'%20width%3D'22'%20height%3D'10'%20rx%3D'5'%20fill%3D'url(%23b)'%2F%3E%20%3Crect%20x%3D'1'%20y%3D'18'%20width%3D'17'%20height%3D'10'%20rx%3D'5'%20fill%3D'url(%23b)'%2F%3E%20%3Ccircle%20cx%3D'27'%20cy%3D'22'%20r%3D'4.6'%20fill%3D'url(%23e)'%2F%3E%3Ccircle%20cx%3D'25'%20cy%3D'13'%20r%3D'4.6'%20fill%3D'url(%23e)'%2F%3E%3Ccircle%20cx%3D'16.5'%20cy%3D'23'%20r%3D'4.6'%20fill%3D'url(%23e)'%2F%3E%3C%2Fg%3E%20%3Cg%20fill%3D'none'%20stroke%3D'%23a8743a'%20stroke-width%3D'.8'%3E%3Ccircle%20cx%3D'27'%20cy%3D'22'%20r%3D'2.4'%2F%3E%3Ccircle%20cx%3D'25'%20cy%3D'13'%20r%3D'2.4'%2F%3E%3Ccircle%20cx%3D'16.5'%20cy%3D'23'%20r%3D'2.4'%2F%3E%3Ccircle%20cx%3D'27'%20cy%3D'22'%20r%3D'.7'%2F%3E%3Ccircle%20cx%3D'25'%20cy%3D'13'%20r%3D'.7'%2F%3E%3Ccircle%20cx%3D'16.5'%20cy%3D'23'%20r%3D'.7'%2F%3E%3C%2Fg%3E%20%3Cpath%20d%3D'M7%2011%20H19%20M4%2021%20H11%20M8%2024.5%20H12'%20stroke%3D'%232e1a0c'%20stroke-width%3D'.8'%20opacity%3D'.7'%2F%3E%3C%2Fsvg%3E"); }
.ri.stone { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2032%2032'%3E%3Cdefs%3E%3ClinearGradient%20id%3D't'%20x1%3D'0'%20y1%3D'0'%20x2%3D'0'%20y2%3D'1'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%23e4e1da'%2F%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%23b9b4a8'%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D's'%20x1%3D'0'%20y1%3D'0'%20x2%3D'0'%20y2%3D'1'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%239c978c'%2F%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%236d6960'%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%20%3Cg%20stroke%3D'%234a4740'%20stroke-width%3D'.9'%20stroke-linejoin%3D'round'%3E%20%3Cpath%20d%3D'M2%2019%20L9%2015%20L17%2017%20L17%2027%20L9%2029%20L2%2027%20Z'%20fill%3D'url(%23s)'%2F%3E%3Cpath%20d%3D'M2%2019%20L9%2015%20L17%2017%20L10%2021%20Z'%20fill%3D'url(%23t)'%2F%3E%20%3Cpath%20d%3D'M15%2019%20L23%2015%20L30%2018%20L30%2027%20L22%2029%20L15%2027%20Z'%20fill%3D'url(%23s)'%2F%3E%3Cpath%20d%3D'M15%2019%20L23%2015%20L30%2018%20L22%2021.5%20Z'%20fill%3D'url(%23t)'%2F%3E%20%3Cpath%20d%3D'M8%208%20L16%204%20L24%207%20L24%2016%20L16%2019%20L8%2016%20Z'%20fill%3D'url(%23s)'%2F%3E%3Cpath%20d%3D'M8%208%20L16%204%20L24%207%20L16%2011%20Z'%20fill%3D'url(%23t)'%2F%3E%3C%2Fg%3E%20%3Cpath%20d%3D'M16%2011%20V19%20M10%2021%20V28.5%20M22%2021.5%20V28.5'%20stroke%3D'%234a4740'%20stroke-width%3D'.9'%2F%3E%3Cpath%20d%3D'M11%2013%20l2%201%20M19%2024%20l3%20-1%20M5%2023%20l2%201'%20stroke%3D'%2355524a'%20stroke-width%3D'.7'%2F%3E%3C%2Fsvg%3E"); }
.ri.iron { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2032%2032'%3E%3Cdefs%3E%3ClinearGradient%20id%3D't'%20x1%3D'0'%20y1%3D'0'%20x2%3D'1'%20y2%3D'1'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%23e8eef4'%2F%3E%3Cstop%20offset%3D'.5'%20stop-color%3D'%23a9b6c2'%2F%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%237b8894'%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D'f'%20x1%3D'0'%20y1%3D'0'%20x2%3D'0'%20y2%3D'1'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%2376828e'%2F%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%233f4852'%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%20%3Cg%20stroke%3D'%232b3138'%20stroke-width%3D'.9'%20stroke-linejoin%3D'round'%3E%20%3Cpath%20d%3D'M3%2022%20L8%2015%20L24%2015%20L29%2022%20L29%2027%20L3%2027%20Z'%20fill%3D'url(%23f)'%2F%3E%3Cpath%20d%3D'M8%2015%20L24%2015%20L21.5%2019%20L10.5%2019%20Z'%20fill%3D'url(%23t)'%2F%3E%3Cpath%20d%3D'M3%2022%20L8%2015%20L10.5%2019%20L7.5%2024%20Z'%20fill%3D'%235a6570'%2F%3E%3Cpath%20d%3D'M29%2022%20L24%2015%20L21.5%2019%20L24.5%2024%20Z'%20fill%3D'%234b5560'%2F%3E%3Cpath%20d%3D'M7.5%2024%20L10.5%2019%20L21.5%2019%20L24.5%2024%20L24.5%2027%20L7.5%2027%20Z'%20fill%3D'url(%23f)'%2F%3E%20%3Cpath%20d%3D'M8%2013%20L11.5%207%20L22.5%207%20L26%2013%20L26%2015%20L8%2015%20Z'%20fill%3D'url(%23f)'%2F%3E%3Cpath%20d%3D'M11.5%207%20L22.5%207%20L20.5%2010.5%20L13.5%2010.5%20Z'%20fill%3D'url(%23t)'%2F%3E%3Cpath%20d%3D'M11%2014.5%20L13.5%2010.5%20L20.5%2010.5%20L23%2014.5%20Z'%20fill%3D'%23687480'%2F%3E%3C%2Fg%3E%20%3Cpath%20d%3D'M12.5%2016.3%20H18'%20stroke%3D'%23fff'%20stroke-width%3D'1'%20opacity%3D'.75'%20stroke-linecap%3D'round'%2F%3E%3Cpath%20d%3D'M13.5%208.2%20H17.5'%20stroke%3D'%23fff'%20stroke-width%3D'.9'%20opacity%3D'.75'%20stroke-linecap%3D'round'%2F%3E%3C%2Fsvg%3E"); }
.ri.gold { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2032%2032'%3E%3Cdefs%3E%3ClinearGradient%20id%3D'g'%20x1%3D'0'%20y1%3D'0'%20x2%3D'1'%20y2%3D'0'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%23b47a12'%2F%3E%3Cstop%20offset%3D'.35'%20stop-color%3D'%23ffe27a'%2F%3E%3Cstop%20offset%3D'.7'%20stop-color%3D'%23e6a920'%2F%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%239a6508'%2F%3E%3C%2FlinearGradient%3E%3CradialGradient%20id%3D't'%20cx%3D'.4'%20cy%3D'.35'%3E%3Cstop%20offset%3D'0'%20stop-color%3D'%23fff3b0'%2F%3E%3Cstop%20offset%3D'1'%20stop-color%3D'%23e2a41c'%2F%3E%3C%2FradialGradient%3E%3C%2Fdefs%3E%20%3Cg%20stroke%3D'%237a4f06'%20stroke-width%3D'.9'%3E%20%3Cpath%20d%3D'M3%2022%20v3.5%20a8%203.4%200%200%200%2016%200%20v-3.5'%20fill%3D'url(%23g)'%2F%3E%3Cellipse%20cx%3D'11'%20cy%3D'22'%20rx%3D'8'%20ry%3D'3.4'%20fill%3D'url(%23t)'%2F%3E%20%3Cpath%20d%3D'M3%2017.5%20v3.5%20a8%203.4%200%200%200%2016%200%20v-3.5'%20fill%3D'url(%23g)'%2F%3E%3Cellipse%20cx%3D'11'%20cy%3D'17.5'%20rx%3D'8'%20ry%3D'3.4'%20fill%3D'url(%23t)'%2F%3E%20%3Cpath%20d%3D'M3%2013%20v3.5%20a8%203.4%200%200%200%2016%200%20v-3.5'%20fill%3D'url(%23g)'%2F%3E%3Cellipse%20cx%3D'11'%20cy%3D'13'%20rx%3D'8'%20ry%3D'3.4'%20fill%3D'url(%23t)'%2F%3E%20%3Cpath%20d%3D'M14%2024%20v3%20a7.5%203.2%200%200%200%2015%200%20v-3'%20fill%3D'url(%23g)'%2F%3E%3Cellipse%20cx%3D'21.5'%20cy%3D'24'%20rx%3D'7.5'%20ry%3D'3.2'%20fill%3D'url(%23t)'%2F%3E%20%3Cpath%20d%3D'M14%2020%20v3%20a7.5%203.2%200%200%200%2015%200%20v-3'%20fill%3D'url(%23g)'%2F%3E%3Cellipse%20cx%3D'21.5'%20cy%3D'20'%20rx%3D'7.5'%20ry%3D'3.2'%20fill%3D'url(%23t)'%2F%3E%3C%2Fg%3E%20%3Cellipse%20cx%3D'11'%20cy%3D'13'%20rx%3D'4.6'%20ry%3D'1.7'%20fill%3D'none'%20stroke%3D'%23b9800f'%20stroke-width%3D'.8'%2F%3E%3Cellipse%20cx%3D'21.5'%20cy%3D'20'%20rx%3D'4.2'%20ry%3D'1.5'%20fill%3D'none'%20stroke%3D'%23b9800f'%20stroke-width%3D'.8'%2F%3E%3C%2Fsvg%3E"); }

/* bottom tabs */
#tabs { display: flex; background: var(--darker); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid #3a2618; }
#tabs button { flex: 1; background: none; border: 0; padding: 6px 0 5px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; color: var(--muted); position: relative; }
#tabs button .ic { font-size: 20px; line-height: 24px; filter: grayscale(.6); }
#tabs button.on { color: var(--gold); }
#tabs button.on .ic { filter: none; }
#tabs .badge { position: absolute; top: 2px; left: 55%; background: var(--crimson); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; min-width: 16px; }

/* widgets */
.panel { background: var(--mid); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.btn { display: block; width: 100%; background: var(--gold); color: var(--dark); border: 0; border-radius: 20px; padding: 9px 14px; font-weight: 600; margin-top: 6px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.outline { background: transparent; color: var(--gold); border: 1px solid var(--gold); }
.btn.purple { background: var(--purple); color: #fff; } .btn.blue { background: #3f6e8c; color: #fff; } .btn.red { background: var(--crimson); color: var(--parch); }
.btn.inline { display: inline-block; width: auto; margin: 0; padding: 6px 12px; font-size: 13px; }
.link { background: none; border: 0; color: var(--gold); padding: 4px 6px; font-size: 13px; }
.link.bad { color: var(--bad); }
.row { display: flex; align-items: center; gap: 8px; }
.row > .grow { flex: 1; min-width: 0; }
.cols2 { display: flex; gap: 8px; } .cols2 > * { flex: 1; }
.prog { height: 6px; background: var(--darker); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.prog > i { display: block; height: 100%; background: var(--gold); width: 0; }
.prog.green > i { background: #7fb347; } .prog.red > i { background: #ff6b5b; } .prog.lgreen > i { background: var(--good); } .prog.purple > i { background: var(--epic); }
.cost { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px; margin: 3px 0; }
.chips { display: flex; gap: 5px; overflow-x: auto; padding: 4px 0; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.chip.on { background: var(--hi); border-color: var(--gold); color: var(--gold); }
.subtabs { display: flex; background: var(--darker); overflow-x: auto; flex-shrink: 0; }
.subtabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font-size: 13px; white-space: nowrap; color: var(--muted); }
.subtabs button.on { color: var(--gold); border-bottom-color: var(--gold); }
.with-sub { display: flex; flex-direction: column; height: 100%; } .with-sub > .scroll { flex: 1; min-height: 0; height: auto; }
input[type=text], input[type=number], input[type=password], input[type=email], input[type=search] { background: var(--darker); border: 1px solid var(--line); border-radius: 8px; color: var(--parch); padding: 9px 10px; width: 100%; }
input[type=range] { width: 100%; accent-color: var(--gold); }
ul.bul { margin: 4px 0; padding-left: 18px; font-size: 13px; } ul.bul li { margin: 2px 0; }
.sprite { display: block; object-fit: contain; }
.unitimg { width: 44px; height: 44px; object-fit: contain; flex-shrink: 0; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; color: var(--gold); font-size: 12px; padding: 4px 2px; }
table.t td { padding: 6px 2px; }
table.t tr.me td { background: var(--hi); }
table.t tr.click { cursor: pointer; }

/* city: the town view */
.town { position: absolute; inset: 0; overflow: hidden; background: #34552a; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.town:active { cursor: grabbing; }
.town-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.town-world img { position: absolute; pointer-events: none; -webkit-user-drag: none; }
.town-world .tbg, .town-world .tfg { left: 0; top: 0; width: 100%; height: 100%; }
.tsprite.ghost { opacity: .55; filter: saturate(.4) brightness(1.1); }
.tplot { position: absolute; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); cursor: pointer; }
.tplot.empty { background: rgba(255,240,200,0); transition: background .15s; }
.tplot.empty:hover { background: rgba(255,240,200,.18); }
.tplot.hit:hover { background: rgba(255,230,160,.12); }
.tplot.target { background: rgba(230,179,58,.35); animation: pulse 1.1s ease-in-out infinite; }
.tplot.moving { background: rgba(127,200,255,.35); }
@keyframes pulse { 50% { background: rgba(230,179,58,.12); } }
.thit { position: absolute; cursor: pointer; }
a.coord { color: #8fd0ff; text-decoration: underline dotted; cursor: pointer; white-space: nowrap; font-weight: bold; } a.coord:hover { color: #fff; }
.tscaf { position: absolute; pointer-events: none; opacity: .75; background: repeating-linear-gradient(90deg, transparent 0 18%, #6b4423 18% 21%), repeating-linear-gradient(0deg, transparent 0 30%, #6b4423 30% 33%); }
.town-labels { position: absolute; inset: 0; pointer-events: none; }
.tlabel { position: absolute; transform: translate(-50%, -45%); display: flex; align-items: center; gap: 0; pointer-events: auto; cursor: pointer; white-space: nowrap;
  background: linear-gradient(#3b2a1d, #22160e); border: 1px solid #a07a3a; border-radius: 12px; padding: 0 9px 0 0; font-size: 12px; font-weight: 600; color: #f6ead0; box-shadow: 0 2px 6px rgba(0,0,0,.55); flex-wrap: wrap; max-width: 170px; }
.tlabel .lv { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 11px; background: radial-gradient(circle at 35% 30%, #3f6fb0, #1e3c6c); border: 1px solid #c9a35a; font-size: 11.5px; margin: -1px 6px -1px -1px; color: #fff; }
.tlabel.small { padding: 0; border-radius: 11px; }
.tlabel.small .lv { margin: -1px; }
.tlabel.keep .lv { background: radial-gradient(circle at 35% 30%, #d9a832, #8a5a12); }
.tlabel.wall .lv { background: radial-gradient(circle at 35% 30%, #8d8d8d, #4a4a4a); }
.tlabel .tl-unit { width: 20px; height: 20px; margin-left: 4px; object-fit: contain; }
.tlabel .tl-prog { flex-basis: 100%; height: 4px; background: rgba(0,0,0,.6); border-radius: 2px; overflow: hidden; margin: 2px 0 2px 6px; }
.tlabel.small .tl-prog { margin: 0 2px 2px; }
.tlabel .tl-prog i { display: block; height: 100%; background: linear-gradient(90deg, #e6b33a, #ffd877); }
.tlabel .tl-cd { flex-basis: 100%; font-size: 10.5px; color: #ffd877; padding-left: 8px; font-weight: normal; }
.tplus { position: absolute; transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%; background: rgba(30,19,12,.55); border: 1px dashed rgba(240,220,170,.7); color: #f2e2bb; display: flex; align-items: center; justify-content: center; font-size: 15px; pointer-events: auto; cursor: pointer; }
.tplus.small { width: 22px; height: 22px; font-size: 13px; }
.tplus::after { content: ''; position: absolute; inset: -9px; }   /* bigger touch target */
.town-top { position: absolute; left: 0; right: 0; top: 0; padding: 6px; display: flex; flex-direction: column; gap: 4px; align-items: center; pointer-events: none; }
.town-top > * { pointer-events: auto; }
.bq { display: flex; gap: 6px; width: 100%; max-width: 640px; }
.bqi { flex: 1; background: rgba(30,19,12,.82); border: 1px solid rgba(160,122,58,.6); border-radius: 8px; padding: 4px 7px; font-size: 11.5px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.bqi.idle { color: var(--good); cursor: default; }
.spin-pill { width: auto; margin: 0; padding: 5px 14px; font-size: 13px; }
.movebar { background: rgba(30,60,100,.92); border: 1px solid var(--blue); border-radius: 10px; padding: 6px 10px; font-size: 13px; display: flex; align-items: center; gap: 10px; }
.town-zoom { position: absolute; right: 8px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.town-zoom button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid #a07a3a; background: rgba(30,19,12,.85); color: var(--gold); font-size: 18px; line-height: 1; }.evo { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; }
.evo > div { text-align: center; border-radius: 8px; padding: 2px; }
.evo > div.cur { background: var(--hi); }
.evo .img { aspect-ratio: 1; position: relative; }
.evo img { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); }
.evo .n { font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evo .cur .n { color: var(--gold); font-weight: bold; }
.evo .l { font-size: 8.5px; color: var(--muted); }

/* map */
#mapview { position: absolute; inset: 0; overflow: hidden; touch-action: none; background: #2b1b12; }
#mapcanvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
#mapcanvas.drag { cursor: grabbing; }
#mapview canvas.map3d, #mapview canvas.map3d-ov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hud { position: absolute; background: rgba(30,19,12,.82); border-radius: 8px; padding: 4px 8px; font-size: 11.5px; }
.hud.tl { top: 8px; left: 8px; cursor: pointer; max-width: calc(100% - 160px); }
.fabs { position: absolute; display: flex; gap: 6px; }
.fabs.tr { top: 8px; right: 8px; } .fabs.r { right: 8px; top: 50%; transform: translateY(-50%); flex-direction: column; }
.fab { width: 40px; height: 40px; border-radius: 12px; background: var(--mid); border: 1px solid var(--line); font-size: 17px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.fab.on { background: #8a6a2a; }
.minimap { position: absolute; left: 8px; bottom: 8px; }
.minimap canvas { display: block; border: 2px solid rgba(230,179,58,.6); background: #1e130c; cursor: crosshair; }
.minimap .tog { background: rgba(30,19,12,.82); color: var(--gold); font-size: 10.5px; padding: 2px 6px; display: inline-block; cursor: pointer; }
.tp-banner { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); background: rgba(106,44,145,.93); border-radius: 10px; padding: 6px 12px; display: flex; align-items: center; gap: 8px; color: #fff; font-size: 13px; max-width: 92%; }
.country-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; margin: 6px 0; }
.country-grid button { border: 0; border-radius: 3px; padding: 6px 1px; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #5d8a3a; }
.country-grid button:nth-child(12n+1), .country-grid button:nth-child(12n+3), .country-grid button:nth-child(12n+5),
.country-grid button:nth-child(12n+8), .country-grid button:nth-child(12n+10), .country-grid button:nth-child(12n+12) { background: #4a7330; }
.country-grid button.hl { background: #8a6a2a; }

/* sheets & dialogs */
#sheet-wrap { position: fixed; inset: 0; z-index: 20; }
#sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
#sheet { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 640px; max-height: 88%; overflow-y: auto;
  background: var(--panel); border-radius: 18px 18px 0 0; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 20px rgba(0,0,0,.5); animation: up .18s ease-out; will-change: transform; }
#sheet::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: #8a7258; margin: 2px auto 8px; }
/* (2026-11-17) slide only, no fade: starting at opacity .4 let the town and its name plates show through the sheet for a few
   frames on phones ("a flicker of another window"), and when the animation ended the sheet dropped off its own layer and was
   painted again — one blank frame. will-change keeps the sheet (and the chat panel) on its own layer for good. */
@keyframes up { from { transform: translate(-50%, 40px); } }
#dialog-wrap { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
#dialog { background: var(--mid); border-radius: 18px; padding: 18px; width: 100%; max-width: 420px; max-height: 90%; overflow-y: auto; }
#dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
#dialog .pick { padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
#dialog .pick:hover { background: var(--hi); }
#toast { position: fixed; left: 50%; bottom: calc(108px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #ead9b5; color: var(--dark); padding: 10px 16px; border-radius: 8px; z-index: 40; max-width: 90%; box-shadow: 0 3px 12px rgba(0,0,0,.5); font-weight: 500; }

/* heroes */
.crest { width: 52px; height: 52px; flex-shrink: 0; }
.hero-name { font-family: var(--title); font-weight: bold; font-size: 16px; }

/* login */
#login { height: 100%; overflow-y: auto; background: radial-gradient(ellipse at top, #4a3020, #2b1b12 70%); }
.login-box { max-width: 420px; margin: 0 auto; padding: 30px 20px; text-align: center; }
.login-box img { width: 220px; height: 220px; object-fit: contain; margin: 0 auto; display: block; }
.login-box h1 { font-size: 34px; margin: 4px 0 0; }
.login-box .panel { text-align: left; margin-top: 14px; }

/* spin */
.wheel-box { position: relative; width: min(300px, 86vw); aspect-ratio: 1; margin: 6px auto; }
.wheel-box canvas { width: 100%; height: 100%; }
.wheel-box .pointer { position: absolute; left: 50%; top: -2px; transform: translateX(-50%); width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 30px solid #fff; filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }

/* chat */
#chatbar { display: flex; align-items: center; gap: 8px; background: linear-gradient(#2a1c12, #1e130c); border-top: 1px solid #4a3020; padding: 5px 10px; font-size: 12.5px; cursor: pointer; min-height: 30px; }
#chatbar .ci { font-size: 15px; }
#chatbar .cl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #e8dcc0; }
#chatbar .badge, #chat-tabs .badge, .conv .badge { background: var(--crimson); color: #fff; border-radius: 9px; font-size: 10.5px; padding: 0 6px; min-width: 18px; text-align: center; font-weight: bold; }
.ct { font-size: 10.5px; padding: 0 5px; border-radius: 4px; margin-right: 2px; font-weight: bold; }
.ct.w { background: #3c5a2a; } .ct.a { background: #2c4a7a; } .ct.p { background: #6a2c91; }
#chat-wrap { position: fixed; inset: 0; z-index: 25; }
#chat-bg { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
#chat-panel { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 640px; height: min(86%, 760px); display: flex; flex-direction: column;
  background: var(--panel); border-radius: 18px 18px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,.5); animation: up .18s ease-out; will-change: transform; overflow: hidden; padding-bottom: env(safe-area-inset-bottom); }
#chat-tabs { display: flex; background: var(--darker); flex-shrink: 0; }
#chat-tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; padding: 11px 4px; font-size: 13px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
#chat-tabs button.on { color: var(--gold); border-bottom-color: var(--gold); }
#chat-tabs button:disabled { opacity: .4; }
#chat-tabs button.x { flex: 0 0 44px; font-size: 16px; }
#chat-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#chat-body .msgs { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.cm { max-width: 86%; align-self: flex-start; background: #4a3324; border-radius: 4px 12px 12px 12px; padding: 5px 9px; }
.cm.mine { align-self: flex-end; background: #5a4520; border-radius: 12px 4px 12px 12px; }
.cday { align-self: center; font-size: 11px; color: var(--muted, #b9a88a); padding: 2px 10px; margin: 6px 0 2px; border-radius: 9px; background: rgba(0,0,0,.25); }
.cm.sys { align-self: center; background: rgba(230,179,58,.12); border: 1px solid rgba(230,179,58,.35); border-radius: 10px; text-align: center; }
.cm .meta { font-size: 11px; color: var(--muted); }
.cm .meta span { opacity: .7; margin-left: 4px; }
.cm .who { background: none; border: 0; padding: 0; color: var(--gold); font-weight: bold; font-size: 11.5px; }
.cm.mine .who { color: #ffd877; }
.cm .tx { font-size: 13.5px; word-wrap: break-word; overflow-wrap: anywhere; }
#chat-body form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
#chat-body form .btn { width: auto; margin: 0; }
.dmhead { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.inbox { flex: 1; overflow-y: auto; }
.newdm { padding: 8px; border-bottom: 1px solid var(--line); }
.newdm .pick { padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.newdm .pick:hover { background: var(--hi); }
.conv { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-bottom: 1px solid rgba(107,74,42,.5); cursor: pointer; }
.conv:hover { background: var(--hi); }
.conv .av { width: 34px; height: 34px; border-radius: 50%; background: #6a2c91; display: flex; align-items: center; justify-content: center; font-weight: bold; font-family: var(--title); flex-shrink: 0; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 900px) {
  #tabs { justify-content: center; } #tabs button { flex: 0 0 110px; }
}

/* ---- war: flashing alerts, marches panel (top right of the city and the world map) ---- */
@keyframes flash { 0%, 100% { background: rgba(190,30,30,.95); color: #fff; } 50% { background: rgba(255,200,60,.95); color: #300; } }
.flash { animation: flash 1s steps(1) infinite; border-radius: 6px; padding: 1px 8px; }
/* 2026-11-20: a threat that has been seen stops flashing but stays red until it is over */
.redon { background: rgba(190,30,30,.95); color: #fff; border-radius: 6px; padding: 1px 8px; }
#tabs .badge.redon { padding: 0 5px; } .ab.fold.min .redon { padding: 0 4px; }
.ab.threat.seen { animation: none; }
#resbar .alert.redon { background: rgba(190,30,30,.95); color: #fff; }
#resbar .alert { cursor: pointer; padding: 1px 8px; border-radius: 6px; margin-top: 2px; }
#tabs .badge.flash { padding: 0 5px; }
body.under-attack #resbar { box-shadow: inset 0 0 0 2px #e03030; }
/* 2026-12-01: ✓ checked threats raise no alarm; their bar turns calm grey */
#resbar .alert .achk { margin-left: 6px; padding: 0 7px; border-radius: 5px; border: 1px solid rgba(255,255,255,.6); background: rgba(0,0,0,.25); color: #fff; font-weight: bold; cursor: pointer; }
.ab.threat.done { animation: none !important; background: rgba(60,52,44,.88) !important; border-color: rgba(140,130,110,.6) !important; color: #cfc6b4; }
.mpanel { position: absolute; top: 8px; right: 8px; width: 250px; max-width: calc(100% - 16px); z-index: 5; font-size: 11.5px; pointer-events: auto; }
.mpanel .mh { background: rgba(30,19,12,.9); border: 1px solid rgba(160,122,58,.7); border-radius: 8px; padding: 5px 9px; cursor: pointer; display: flex; gap: 6px; align-items: center; font-weight: bold; color: var(--gold); }
.mpanel.open .mh { border-radius: 8px 8px 0 0; }
.mpanel .mh .grow { flex: 1; } .mpanel .mh .warn { color: #ff8a7a; }
.mpanel .ml { background: rgba(30,19,12,.86); border: 1px solid rgba(160,122,58,.7); border-top: 0; border-radius: 0 0 8px 8px; max-height: 46vh; overflow-y: auto; }
.mpanel .mr { display: flex; gap: 6px; align-items: center; padding: 4px 7px; border-top: 1px solid rgba(160,122,58,.25); cursor: pointer; }
.mpanel .mr:first-child { border-top: 0; }
.mpanel .mr .ic { width: 20px; text-align: center; font-size: 14px; flex: none; }
.mpanel .mr .tx { flex: 1; min-width: 0; } .mpanel .mr .tx div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mpanel .mr .t { color: #ffd877; font-variant-numeric: tabular-nums; }
.mpanel .mr.threat { background: rgba(150,25,25,.55); } .mpanel .mr.threat .t { color: #fff; }
.mpanel .mr button { flex: none; background: #6b1515; color: #fff; border: 1px solid #c9a35a; border-radius: 6px; font-size: 11px; padding: 3px 7px; }
.mpanel .mr button.soft { background: #2b3d57; }
.mpanel .none { padding: 6px 9px; color: #cdbb96; }
.mapwrap-has-panel .fabs.tr { top: 50px; }
.gate-pill { background: rgba(30,19,12,.85); border: 1px solid rgba(160,122,58,.7); border-radius: 14px; padding: 4px 11px; font-size: 12px; cursor: pointer; color: #efe3c8; }
.gate-pill.closed { border-color: #e05050; color: #ffb0a0; }
.town-top { align-items: flex-start; padding-right: 266px; }
@media (max-width: 700px) { .town-top { padding-right: 6px; padding-top: 44px; } .mpanel { width: 230px; } }
.kv { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 2px 0; }
.seg { display: flex; gap: 6px; margin: 6px 0; } .seg button { flex: 1; padding: 7px 4px; border-radius: 8px; border: 1px solid var(--line); background: var(--mid); color: #efe3c8; font-size: 13px; }
.seg button.on { background: #8a6a2a; color: #fff; font-weight: bold; }
.pinkname { color: #ff7ad1; }
@media (max-width: 700px) { #mapview > .mpanel { top: 54px; } }

/* ================= 2026-11-13 layout: slim top bar, icon rail on the right, activity bars left, chat box ================= */
#stage { flex: 1; min-height: 0; position: relative; overflow: hidden; }
#view { position: absolute; inset: 0; }
/* ---- top bar ---- */
#resbar { background: linear-gradient(#3a2618, #1e130c); border-bottom: 1px solid #a07a3a; box-shadow: 0 2px 8px rgba(0,0,0,.5); padding: 3px 8px; padding-top: max(3px, env(safe-area-inset-top)); position: relative; z-index: 6; }
#resbar .tb { display: flex; align-items: center; gap: 8px; }
#resbar .me { display: flex; align-items: center; gap: 7px; background: linear-gradient(#5a3d28, #33210f); border: 1px solid #c9a35a; border-radius: 9px; padding: 2px 10px 2px 3px; min-width: 0; flex: 0 1 auto; box-shadow: inset 0 1px 0 rgba(255,220,150,.25); }
#resbar .me:hover { filter: brightness(1.15); }
#resbar .me .portrait { border-radius: 5px; flex: none; }
#resbar .mn { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; text-align: left; }
#resbar .mn b { font-family: var(--title); color: var(--gold); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
#resbar .mn i { font-style: normal; font-size: 10.5px; color: #d8c8a8; white-space: nowrap; }
#resbar .res { display: flex; gap: 6px; flex: 1; justify-content: center; margin: 0; max-width: none; min-width: 0; font-size: 13px; }
#resbar .rc { display: inline-flex; align-items: center; gap: 2px; background: rgba(0,0,0,.42); border: 1px solid rgba(160,122,58,.55); border-radius: 12px; padding: 1px 9px 1px 3px; min-width: 0; box-shadow: inset 0 1px 3px rgba(0,0,0,.6); }
#resbar .rc b { font-weight: 600; font-variant-numeric: tabular-nums; }
#resbar .ri { width: 20px; height: 20px; vertical-align: 0; margin-right: 2px; flex: none; }
#resbar .xt { display: flex; align-items: center; gap: 8px; font-size: 12px; white-space: nowrap; }
#resbar .med { color: #e0b0ff; } #resbar .bub { color: var(--blue); }
#resbar .alert { max-width: none; text-align: center; margin-top: 3px; }
@media (max-width: 700px) {
  #resbar { padding: 2px 4px; } #resbar .tb { gap: 4px; }
  #resbar .mn i, #resbar .xt { display: none; } #resbar .mn b { max-width: 64px; font-size: 12px; } #resbar .me { padding-right: 5px; gap: 4px; }
  #resbar .res { gap: 2px; font-size: 11.5px; justify-content: space-between; } #resbar .rc { padding: 1px 4px 1px 1px; } #resbar .ri { width: 16px; height: 16px; margin-right: 1px; }
}
/* ---- icon rail (right edge) ---- */
#tabs { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); z-index: 7; display: flex; flex-direction: column; gap: 4px; background: none; border: 0; padding: 0; max-height: calc(100% - 8px); overflow-y: auto; scrollbar-width: none; }
#tabs::-webkit-scrollbar { display: none; }
#tabs button { flex: none; width: 48px; height: 46px; padding: 2px 0 1px; border-radius: 11px; border: 1px solid #a07a3a; background: linear-gradient(#4a3020ee, #24160cee); box-shadow: 0 2px 6px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,220,150,.22); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; font-size: 9.5px; color: #e8dcc0; position: relative; }
#tabs button .ic { font-size: 20px; line-height: 24px; filter: none; }
#tabs button .lb { line-height: 11px; }
#tabs button.on { border-color: #ffd877; background: linear-gradient(#8a6a2aee, #4a3414ee); color: #fff; }
#tabs button:hover { filter: brightness(1.2); }
#tabs .badge { position: absolute; top: -3px; left: auto; right: -3px; background: var(--crimson); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; min-width: 16px; border: 1px solid #ffb0a0; }
@media (max-height: 520px) { #tabs button { height: 36px; } #tabs button .lb { display: none; } }
@media (min-width: 900px) { #tabs { justify-content: flex-start; } #tabs button { flex: none; } }
.page { padding-right: 62px; } .subtabs { padding-right: 58px; }
@media (min-width: 980px) { .page { padding-right: 10px; } }
#toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
/* ---- activity bars (left edge): threats, marches, builds, research, training ---- */
#lpanel { position: absolute; left: 6px; top: 6px; z-index: 5; width: 290px; max-width: calc(100% - 70px); display: flex; flex-direction: column; gap: 3px; max-height: 55%; overflow-y: auto; scrollbar-width: none; }
#lpanel:empty { display: none; }
.ab { position: relative; display: flex; align-items: center; gap: 6px; height: 30px; flex: none; padding: 0 5px 0 4px; border-radius: 7px; cursor: pointer; overflow: hidden; color: #fff; font-size: 11.5px;
  background: linear-gradient(#3f7fd0, #1d4f9c 48%, #123a7a 52%, #1a4a90); border: 1px solid #0c2550; box-shadow: 0 2px 5px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.35); text-shadow: 0 1px 1px rgba(0,0,0,.7); }
.ab:hover { filter: brightness(1.12); }
.ab .ic { flex: none; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #7fd060, #2a7a22); border: 1px solid #0c3a10; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.ab .ic img { width: 20px; height: 20px; object-fit: contain; }
.ab .k { flex: none; font-weight: bold; font-size: 12px; }
.ab .tx { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; white-space: nowrap; overflow: hidden; }
.ab .tx b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; color: #e6f0ff; min-width: 0; }
.ab .tx i { font-style: normal; margin-left: auto; flex: none; font-size: 11px; color: #d6e6ff; } .ab .tx i .t { color: #fff; font-weight: bold; font-variant-numeric: tabular-nums; font-size: 12px; }
.ab button { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 1px solid #f0c0b0; background: linear-gradient(#c23a2a, #7a1810); color: #fff; font-size: 11px; padding: 0; line-height: 1; }
.ab button.soft { background: linear-gradient(#5a7090, #2b3d57); border-color: #b8c8e0; }
.ab button + button, .mpanel .mr button + button { margin-left: 3px; }
.ab button[data-abh] { background: linear-gradient(#e0b040, #8a6010); border-color: #ffe6a0; }
.ab .abp { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(0,0,0,.45); } .ab .abp i { display: block; height: 100%; background: linear-gradient(90deg, #ffd24a, #fff3a8); }
/* 2026-11-20: marches on their way out are teal; on the way home they stay blue, so a turn-round is easy to see */
.ab.march { background: linear-gradient(#36c2b0, #12857a 48%, #0b665d 52%, #107a6f); border-color: #053a34; } .ab.march .ic { background: radial-gradient(circle at 35% 30%, #fff0b0, #c89020); border-color: #5a3a08; }
.ab.back .ic { background: radial-gradient(circle at 35% 30%, #bfe0ff, #3f7fd0); border-color: #0c2550; }
.ab.threat { background: linear-gradient(#e04a3a, #a01c14 48%, #7a100c 52%, #98201a); border-color: #4a0806; animation: abflash 1s steps(1) infinite; } .ab.threat .ic { background: radial-gradient(circle at 35% 30%, #ffd24a, #c06a10); }
@keyframes abflash { 50% { filter: brightness(1.45); } }
.ab.siege, .ab.stay { background: linear-gradient(#8a6fc0, #4a3488 48%, #36246a 52%, #45307e); border-color: #1c1040; }
.ab.build { background: linear-gradient(#d0963f, #9c651d 48%, #7a4a12 52%, #905a1a); border-color: #4a2a08; } .ab.build .ic { background: radial-gradient(circle at 35% 30%, #f4d58a, #a8741e); }
.ab.research { background: linear-gradient(#b05fd0, #6f2a9c 48%, #561c7a 52%, #68268e); border-color: #2c0c44; } .ab.research .ic { background: radial-gradient(circle at 35% 30%, #e6b8ff, #7a3aa8); }
.ab.train { background: linear-gradient(#4fb06a, #1f7a3a 48%, #145c2a 52%, #1c6e34); border-color: #08301a; } .ab.train .ic { background: radial-gradient(circle at 35% 30%, #f0e6c8, #a89868); }
.ab.fold { height: 22px; background: rgba(20,14,10,.78); border-color: rgba(160,122,58,.6); box-shadow: none; color: #e8dcc0; } .ab.fold .ic { background: none; border: 0; }
.ab.fold.min { align-self: flex-start; padding: 0 9px; } .ab.fold.min .flash { padding: 0 4px; }
@media (max-width: 700px) { #lpanel { width: 232px; } .ab { height: 28px; } .ab .k { display: none; } }
/* ---- chat box (bottom left of City and World) ---- */
#chatbox { position: absolute; left: 6px; bottom: 6px; z-index: 5; width: 460px; max-width: calc(100% - 66px); border-radius: 9px; overflow: hidden; border: 1px solid #a07a3a; box-shadow: 0 3px 10px rgba(0,0,0,.6);
  background: linear-gradient(rgba(58,38,24,.86), rgba(24,15,9,.9)); padding-bottom: env(safe-area-inset-bottom); }
#chatbox .cbm { height: 76px; overflow: hidden; padding: 4px 8px 2px; font-size: 12px; line-height: 17.5px; cursor: pointer; background: rgba(244,232,204,.07); border-bottom: 1px solid rgba(160,122,58,.5); display: flex; flex-direction: column; justify-content: flex-end; }
#chatbox .cbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #f2e8d0; flex: none; }
#chatbox .cbl b { color: #8fd0ff; font-weight: 600; } #chatbox .cbl .tm { color: #b8a888; margin: 0 2px; font-size: 11px; } #chatbox .cbl.sys { color: #ffd877; } #chatbox .cbl.sys b { color: #ffd877; }
#chatbox .ct { background: none; padding: 0; margin: 0; font-size: 12px; } #chatbox .ct.w { color: #9fd18b; } #chatbox .ct.a { color: #7fc8ff; } #chatbox .ct.p { color: #e0a0ff; }
#chatbox form { display: flex; gap: 4px; padding: 4px; }
#chatbox form button { flex: none; border-radius: 6px; border: 1px solid #a07a3a; background: linear-gradient(#5a3d28, #33210f); color: #f2e2bb; font-size: 11.5px; padding: 0 8px; height: 26px; }
#chatbox form button.a { color: #7fc8ff; } #chatbox form button.w { color: #9fd18b; }
#chatbox form input { flex: 1; min-width: 0; height: 26px; padding: 2px 8px; border-radius: 6px; font-size: 13px; background: rgba(0,0,0,.5); }
@media (max-width: 700px) { #chatbox .cbm { height: 58px; } }
/* ---- city: gate pill centred, stores panel on the right, scaffolding ---- */
.town-top { align-items: center; padding: 6px 70px 0 70px; }
@media (max-width: 700px) { .town-top { padding: 0 60px; top: auto; bottom: 122px; } }
.cres { position: absolute; right: 58px; top: 6px; z-index: 4; width: 34px; border-radius: 9px; overflow: hidden; border: 1px solid #0c2550; box-shadow: 0 3px 10px rgba(0,0,0,.55); background: linear-gradient(#1d4f9c, #0e2a5a); font-size: 12.5px; color: #fff; cursor: default; }
.cres.open { width: 168px; }
.cres .ch { display: flex; justify-content: space-between; gap: 6px; padding: 4px 8px; background: linear-gradient(#b3261e, #6e1410); font-family: var(--title); font-weight: bold; color: #ffe9a8; cursor: pointer; white-space: nowrap; overflow: hidden; border-bottom: 1px solid #e6b33a; }
.cres:not(.open) .ch span:first-child { display: none; } .cres:not(.open) .ch { justify-content: center; }
.cres .cr { display: flex; align-items: center; gap: 4px; padding: 3px 8px; border-top: 1px solid rgba(255,255,255,.1); }
.cres .cr b { flex: 1; font-weight: 600; font-variant-numeric: tabular-nums; } .cres .cr .rt { font-size: 11.5px; font-weight: bold; } .cres .cr .rt.good { color: #9ff07a; }
.cres .cr.top { background: rgba(0,0,0,.25); font-size: 12px; } .cres .cr.top .l { flex: 1; color: #cfe0ff; }
.cres .ri { width: 20px; height: 20px; vertical-align: 0; }
.cres .cf { font-size: 10px; color: #b8c8e8; padding: 2px 8px 4px; text-align: right; }
.town-zoom { right: 58px; bottom: 8px; }
.tscaf { position: absolute; pointer-events: none; opacity: 1; background: none; overflow: visible; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.tscaf .sc-load { transform-box: fill-box; transform-origin: 50% 0; animation: scswing 2.4s ease-in-out infinite; }
.tscaf .sc-arm { transform-box: fill-box; transform-origin: 0 100%; animation: schammer .7s ease-in-out infinite; }
@keyframes scswing { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes schammer { 0%, 100% { transform: rotate(-35deg); } 50% { transform: rotate(25deg); } }
/* ---- world map controls ---- */
.hud.tl { top: 6px; left: 50%; transform: translateX(-50%); text-align: center; max-width: 46%; white-space: nowrap; overflow: hidden; }
.fabs.r { right: 58px; top: auto; bottom: 8px; transform: none; gap: 4px; } .fabs.r .fab { width: 36px; height: 36px; border-radius: 10px; border-color: #a07a3a; background: linear-gradient(#4a3020ee, #24160cee); }
.minimap { left: auto; right: 58px; top: 6px; bottom: auto; display: flex; flex-direction: column; align-items: flex-end; }
@media (max-width: 700px) { .hud.tl { left: auto; right: 58px; transform: none; top: auto; bottom: 252px; max-width: 150px; font-size: 10px; display: none; } .minimap canvas { max-width: 96px; max-height: 96px; } }
.tp-banner { bottom: 130px; }
/* ---- stats grid (profile, alliance) ---- */
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 4px; }
.statc { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 4px; text-align: center; min-width: 0; }
.statc b { display: block; font-size: 16px; color: var(--gold); font-family: var(--title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .statc span { font-size: 10.5px; color: var(--muted); }
@media (max-width: 560px) { .statgrid { grid-template-columns: repeat(2, 1fr); } }
.portrait { display: block; flex: none; }
/* ---- Wheel of Fortune: prize board ---- */
.fboard { max-width: 520px; width: 100%; margin: 0 auto; border-radius: 14px; padding: 0 10px 8px; background: linear-gradient(#24508f, #10284f); border: 2px solid #0a1c3c; box-shadow: 0 0 0 2px #c9a35a, 0 8px 22px rgba(0,0,0,.6); }
.fhead { width: fit-content; margin: -2px auto 8px; padding: 4px 26px 5px; background: linear-gradient(#d2372c, #86160f); border: 1px solid #ffd877; border-top: 0; border-radius: 0 0 12px 12px; font-family: var(--title); font-weight: bold; color: #fff3c8; letter-spacing: .5px; text-shadow: 0 1px 2px #000; }
.fgrid { display: grid; gap: 6px; aspect-ratio: 5 / 4; }
.ft { border-radius: 9px; border: 2px solid #56402a; background: radial-gradient(circle at 50% 35%, #5a4634, #241a12); display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; min-height: 0; position: relative; box-shadow: inset 0 0 8px rgba(0,0,0,.7); transition: transform .08s; }
.ft .e { font-size: clamp(20px, 6vw, 34px); line-height: 1.1; } .ft .n { font-size: 10px; color: #e8dcc0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 96%; }
.ft.r-uncommon { border-color: #4f9a55; } .ft.r-epic { border-color: #a066d3; } .ft.r-legendary { border-color: #e6b33a; background: radial-gradient(circle at 50% 35%, #7a5a1c, #2a1c06); } .ft.blank { opacity: .35; }
.ft.lit { border-color: #fff3a8; box-shadow: 0 0 0 2px #ffd24a, 0 0 16px 4px rgba(255,210,74,.85), inset 0 0 12px rgba(255,220,120,.5); transform: scale(1.06); z-index: 1; }
.ft.win { animation: ftwin .45s ease-in-out 3; } @keyframes ftwin { 50% { transform: scale(1.18); } }
.fcenter { border-radius: 10px; border: 2px solid #c9a35a; background: linear-gradient(#f4e8c8, #cdb88a); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 6px; min-width: 0; min-height: 0; box-shadow: inset 0 0 18px rgba(90,60,20,.55); }
.fshow { display: flex; flex-direction: column; align-items: center; color: #2b1b12; text-align: center; } .fshow .e { font-size: clamp(34px, 11vw, 62px); line-height: 1.05; filter: drop-shadow(0 3px 3px rgba(0,0,0,.4)); } .fshow b { font-size: 13px; text-shadow: 0 1px 0 rgba(255,255,255,.5); filter: brightness(.62); }
.fbtn { border-radius: 8px; border: 1px solid #5a3a10; background: linear-gradient(#ffd24a, #c98a14); color: #3a2204; font-weight: bold; font-size: 15px; padding: 6px 22px; box-shadow: 0 2px 0 #7a5208, inset 0 1px 0 rgba(255,255,255,.6); min-width: 60%; }
.fbtn:disabled { background: linear-gradient(#9a9486, #6a655a); color: #2a2620; box-shadow: none; font-size: 12px; font-weight: 600; }
.ffoot { text-align: center; font-size: 11px; color: #b8c8e8; margin-top: 6px; }
/* ---- hero cards ---- */
.hgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
.hcard { display: flex; gap: 10px; padding: 8px; border-radius: 6px; background: linear-gradient(#4a3222, #2a1a10); border: 2px solid #1a0f08; box-shadow: 0 0 0 1px #a07a3a, inset 0 0 0 1px rgba(201,163,90,.35), 0 3px 8px rgba(0,0,0,.5); min-width: 0; }
.hcard.r-legendary { box-shadow: 0 0 0 1px #e6b33a, inset 0 0 0 1px rgba(230,179,58,.5), 0 3px 10px rgba(0,0,0,.5); }
.hport { position: relative; flex: none; align-self: flex-start; } .hport .portrait { border-radius: 4px; box-shadow: 0 0 0 2px #1a0f08, 0 0 0 3px #c9a35a; }
.hlv { position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); background: linear-gradient(#5a3d28, #2b1b12); border: 1px solid #c9a35a; border-radius: 9px; font-size: 10.5px; padding: 0 8px; white-space: nowrap; color: #ffe9a8; font-weight: bold; }
.hinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hn { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .hn b { font-family: var(--title); } .hn .role { color: #8fe07a; font-size: 12px; } .hn .role.def { color: #ffd877; }
.stars { color: #ffd24a; font-size: 14px; letter-spacing: 1px; text-shadow: 0 1px 1px #000; } .stars i { font-style: normal; color: #5a4a3a; }
.hs { display: flex; gap: 6px; font-size: 13px; align-items: baseline; } .hs span { flex: 1; color: #f2e8d0; } .hs b { color: #7fe06a; font-weight: 600; font-variant-numeric: tabular-nums; } .hs i { font-style: normal; color: #7fe06a; font-size: 11.5px; min-width: 42px; }
.hslots { display: flex; align-items: center; gap: 5px; margin-top: 3px; }
.slot { width: 32px; height: 32px; flex: none; border-radius: 5px; border: 1px solid #c9a35a; background: radial-gradient(circle at 50% 35%, #4a3a2c, #17100a); display: flex; align-items: center; justify-content: center; font-size: 16px; box-shadow: inset 0 0 5px #000; }
.slot.txt { font-size: 10.5px; font-weight: bold; color: #8fe07a; } .slot.empty { border-color: #5a4a3a; } .slot .crest { width: 26px; height: 26px; }
.hxp { flex: 1; min-width: 0; font-size: 10px; color: var(--muted); text-align: right; } .hxp .prog { height: 5px; margin: 0 0 1px; }
.hact { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; }
.hbtn { border-radius: 5px; border: 1px solid #c9a35a; background: linear-gradient(#a8743a, #6b4018); color: #fff3d8; font-size: 12.5px; padding: 4px 12px; box-shadow: inset 0 1px 0 rgba(255,230,170,.4), 0 1px 0 #2a1808; text-shadow: 0 1px 1px #000; }
.hbtn.dim { background: linear-gradient(#5a4a3e, #3a2e26); border-color: #8a7258; color: #d8c8a8; } .hbtn:hover { filter: brightness(1.15); }
@media (max-width: 420px) { .hgrid { grid-template-columns: 1fr; } .hport .portrait { width: 78px !important; height: 94px !important; } }
@media (max-width: 700px) { .fabs.r, .town-zoom { bottom: 104px; } .cres { top: 40px; } }

/* 2026-11-14: "future looks" strip is hidden until pinned with its button (2026-11-17: no hover preview any more — it got in the way); infirmary bar */
.evo-wrap { position: relative; margin-top: 8px; }
.evo-pop { display: none; }
.evo-wrap.open .evo-pop { display: block; }
.ab.heal { background: linear-gradient(#4fb0b0, #1f7a80 48%, #145c62 52%, #1c6e74); border-color: #08303a; } .ab.heal .ic { background: radial-gradient(circle at 35% 30%, #fff, #c9b98f); }

/* Android app: native Google sign-in button (Google blocks its web button inside app WebViews) */
.btn.gbtn-app { background: #fff; color: #1f1f1f; max-width: 280px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn.gbtn-app .g { font: bold 18px/1 Arial, sans-serif; color: #4285f4; }
.panel a { color: var(--gold); }

/* ===== 2026-11-14 accounts: e-mail + password sign-in / register ===== */
.login-form { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.login-form label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: #e8dcc0; }
.login-form input { width: 100%; box-sizing: border-box; }
.login-form .btn { margin-top: 4px; }
.login-seg { margin-bottom: 10px; }
.login-box a { color: #e8c170; }

/* ===== 2026-11-14 layout v2: floating resources, lord card above the chat, scalable chat, windows over the map ===== */
/* resources: capsules floating at the top centre of the World view (the City view has its stores panel instead) */
#resbar { position: absolute; top: 0; left: 0; right: 0; z-index: 6; background: none; border: 0; box-shadow: none; padding: 6px 62px 0; padding-top: max(6px, env(safe-area-inset-top)); pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
#resbar.empty { display: none; }
#resbar > * { pointer-events: auto; }
#resbar .res { display: flex; gap: 10px; flex: none; justify-content: center; margin: 0; max-width: 100%; font-size: 14px; }
#resbar .rc { position: relative; display: flex; align-items: center; height: 36px; min-width: 96px; padding: 0 12px 0 36px; border-radius: 18px; background: linear-gradient(180deg, rgba(58,38,22,.93), rgba(20,12,6,.93)); border: 1.5px solid #c9a35a; box-shadow: 0 3px 8px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,225,160,.3), inset 0 -2px 4px rgba(0,0,0,.5); }
#resbar .rc .ri { position: absolute; left: -6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; margin: 0; filter: drop-shadow(0 2px 2px rgba(0,0,0,.8)); }
#resbar .rc .rv { display: flex; flex-direction: column; line-height: 1.05; }
#resbar .rc b { color: #fff8e6; font-size: 15px; font-weight: 700; text-shadow: 0 1px 2px #000; font-variant-numeric: tabular-nums; }
#resbar .rc em { font-style: normal; font-size: 10.5px; font-weight: 700; color: #a8f07a; text-shadow: 0 1px 1px #000; } #resbar .rc em.neg { color: #ff9a7a; }
#resbar .rc .fill { position: absolute; left: 34px; right: 12px; bottom: 3px; height: 2px; border-radius: 2px; background: rgba(255,255,255,.12); overflow: hidden; }
#resbar .rc .fill i { display: block; height: 100%; background: linear-gradient(90deg, #6fbf3a, #c8f07a); }
#resbar .alert { margin: 0; padding: 3px 14px; border-radius: 8px; background: rgba(60,8,8,.88); border: 1px solid #e05040; box-shadow: 0 2px 8px rgba(0,0,0,.5); max-width: 640px; }
/* (2026-11-17) running boosts / battle buffs under the resources */
#resbar .buffs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 100%; }
#resbar .bf { font-size: 11.5px; font-weight: 700; color: #fff3d6; padding: 1px 8px; border-radius: 10px; background: rgba(30,18,8,.86); border: 1px solid #a07a3a; box-shadow: 0 2px 5px rgba(0,0,0,.45); white-space: nowrap; text-shadow: 0 1px 1px #000; }
#resbar .bf.win { border-color: #e07a3a; background: linear-gradient(rgba(80,30,10,.9), rgba(40,14,4,.9)); }
@media (max-width: 760px) {
  #resbar { padding: 4px 58px 0 4px; }
  #resbar .res { gap: 3px; width: 100%; justify-content: space-between; }
  #resbar .rc { min-width: 0; flex: 1; height: 30px; padding: 0 4px 0 24px; border-radius: 15px; }
  #resbar .rc .ri { width: 28px; height: 28px; left: -4px; }
  #resbar .rc b { font-size: 12px; } #resbar .rc em { display: none; } #resbar .rc .fill { left: 22px; right: 6px; }
  #stage[data-tab=map] #lpanel { top: 42px; }
}
@media (min-width: 761px) and (max-width: 1150px) { #stage[data-tab=map] #lpanel { top: 52px; } }
/* bottom left: lord card, then the chat box */
#bl { position: absolute; left: 6px; bottom: 6px; z-index: 5; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; width: clamp(280px, 34vw, 680px); max-width: calc(100% - 66px); pointer-events: none; }
#bl > * { pointer-events: auto; }
#bl #chatbox { position: static; width: 100%; max-width: none; }
#lordbox .me { display: flex; align-items: center; gap: 8px; background: linear-gradient(rgba(90,61,40,.95), rgba(40,25,12,.95)); border: 1.5px solid #c9a35a; border-radius: 11px; padding: 3px 12px 3px 3px; box-shadow: 0 3px 8px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,220,150,.25); color: inherit; max-width: 100%; }
#lordbox .me:hover { filter: brightness(1.15); }
#lordbox .me .portrait { border-radius: 6px; flex: none; }
#lordbox .mn { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; text-align: left; }
#lordbox .mn b { font-family: var(--title); color: var(--gold); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
#lordbox .mn i { font-style: normal; font-size: 11px; color: #e0d0b0; white-space: nowrap; }
#lordbox .xt { display: flex; flex-direction: column; gap: 1px; font-size: 11.5px; white-space: nowrap; padding-left: 6px; border-left: 1px solid rgba(201,163,90,.4); }
#lordbox .med { color: #e0b0ff; } #lordbox .bub { color: var(--blue); }
/* the chat box grows with the screen: taller and more lines on a computer */
#chatbox .cbm { height: clamp(58px, 15vh, 200px); font-size: clamp(12px, .85vw, 14.5px); line-height: 1.45; }
#chatbox form input, #chatbox form button { height: clamp(26px, 3.2vh, 32px); font-size: clamp(12px, .85vw, 14px); }
@media (max-width: 700px) { #chatbox .cbm { height: 58px; } #lordbox .mn i, #lordbox .xt { display: none; } #lordbox .mn b { font-size: 13px; max-width: 110px; } }
/* windows: every page except City / World floats over the live view */
#win { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; padding: 50px 66px 12px 12px; background: rgba(0,0,0,.28); }
#win.hidden { display: none; }
#win .win-frame { width: min(960px, 100%); height: 100%; max-height: 900px; display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; border: 2px solid #c9a35a; background: linear-gradient(#2c1d12f5, #1a110af5); box-shadow: 0 10px 40px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,220,150,.25); }
#win .win-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; background: linear-gradient(#7a2018, #4a100c); border-bottom: 2px solid #c9a35a; font-family: var(--title); font-size: 18px; font-weight: bold; color: #ffe9a8; text-shadow: 0 1px 2px #000; }
#win .win-head span { flex: 1; }
#win #win-x { width: 32px; height: 32px; border-radius: 8px; border: 1px solid #e6b33a; background: linear-gradient(#5a3d28, #33210f); color: #ffe9a8; font-size: 16px; cursor: pointer; }
#win #win-x:hover { filter: brightness(1.25); }
#win-body { flex: 1; min-height: 0; position: relative; }
#win-body > .scroll, #win-body > .with-sub { height: 100%; }
#win .page { padding-right: 10px; } #win .subtabs { padding-right: 8px; }
#stage[data-tab=city] #win { padding-top: 12px; }
@media (max-width: 700px) { #win { padding: 4px 58px 4px 4px; } #stage[data-tab=map] #win { padding-top: 40px; } #win .win-head { font-size: 16px; padding: 4px 6px 4px 10px; } }
.hbtn.dis { background: linear-gradient(#b8432c, #74200f); border-color: #e6a070; color: #fff3e8; }
/* saved places: star on the tile sheet, icon picker, list */
.favstar { position: absolute; right: 14px; top: 12px; width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid #c9a35a; background: linear-gradient(#5a3d28, #33210f); color: #ffd877; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.5); z-index: 2; }
.favstar.on { background: linear-gradient(#e6b33a, #9a6a10); color: #fff8d0; }
.favicons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; } .favicons button { width: 38px; height: 38px; border-radius: 8px; border: 1px solid #6a5238; background: #2a1c12; font-size: 18px; cursor: pointer; } .favicons button.on { border-color: #ffd877; background: #6a4a1a; }
.fav .fav-ic { font-size: 24px; width: 34px; text-align: center; } .fav .btn.inline { margin-left: 4px; }
#stage[data-tab=map] .hud.tl { top: 52px; }

/* ---- 2026-11-14 night: build list shows every building; unavailable ones are greyed with the reason ---- */
.bopt.off { background: rgba(60,58,54,.55); border-color: #5a564e; }
.bopt.off > img { filter: grayscale(1) brightness(.7); }
.bopt.off b, .bopt.off .bdesc, .bopt.off .cost, .bopt.off .tiny:not(.why) { opacity: .55; }
.bopt.off .why { opacity: 1; font-weight: 700; font-size: 12px; margin-top: 2px; }
.bopt.off .btn { background: #55514a; color: #b9b2a4; border-color: #6a655c; box-shadow: none; cursor: not-allowed; }

/* ==== 2026-11-14 night: COMPACT layout (body.compact = app, phone or small window; set in core.js applyCompact) ==== */
/* step 3: the small resource capsules sit on top of the City view too; the big stores panel is hidden */
body.compact .cres { display: none; }
body.compact #resbar { padding: 4px 4px 0; padding-top: max(4px, env(safe-area-inset-top)); }
body.compact #resbar .res { gap: 3px; width: 100%; justify-content: space-between; }
body.compact #resbar .rc { min-width: 0; flex: 1; height: 30px; padding: 0 4px 0 24px; border-radius: 15px; }
body.compact #resbar .rc .ri { width: 28px; height: 28px; left: -4px; }
body.compact #resbar .rc b { font-size: 12px; } body.compact #resbar .rc em { display: none; } body.compact #resbar .rc .fill { left: 22px; right: 6px; }
body.compact #lpanel { top: 42px; }
body.compact #stage[data-tab=city] #win { padding-top: 40px; }
/* step 4: City / World / Menu at the top right instead of the icon rail; Menu drops down the other pages */
body.compact #tabs.top { top: 40px; right: 4px; transform: none; flex-direction: row; gap: 4px; max-height: none; overflow: visible; z-index: 9; }
body.compact #tabs.top > button { width: 46px; height: 42px; }
body.compact #tabs.top > button .lb { display: block; }
body.compact #tabs .tmenu { position: absolute; top: calc(100% + 4px); right: 0; width: 180px; max-height: calc(100vh - 120px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: 11px; border: 1.5px solid #c9a35a; background: linear-gradient(#3a2618f7, #1e130cf7); box-shadow: 0 8px 24px rgba(0,0,0,.7); }
body.compact #tabs .tmenu button { width: 100%; height: 40px; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 0 10px; font-size: 14px; border-radius: 8px; border: 1px solid transparent; background: none; box-shadow: none; }
body.compact #tabs .tmenu button:hover, body.compact #tabs .tmenu button.on { background: rgba(201,163,90,.22); border-color: #a07a3a; }
body.compact #tabs .tmenu button .ic { font-size: 20px; width: 26px; text-align: center; }
body.compact #tabs .tmenu button .lb { line-height: 1; }
body.compact #tabs .tmenu .badge { position: static; margin-left: auto; }
/* nothing has to make room for a rail on the right any more */
body.compact .page { padding-right: 10px; } body.compact .subtabs { padding-right: 8px; }
body.compact #win, body.compact #stage[data-tab=map] #win, body.compact #stage[data-tab=city] #win { padding: 88px 4px 4px; }
body.compact #lpanel { max-width: calc(100% - 160px); }
body.compact .fabs.r, body.compact .town-zoom { right: 6px; }
body.compact .minimap { right: 4px; top: 88px; }
body.compact .town-top { padding-left: 6px; padding-right: 6px; }
/* step 5: the chat box runs across 3/4 of the screen on a laptop / desktop, and across the whole bottom in compact mode */
body:not(.compact) #bl { width: 75%; }
body.compact #bl { left: 0; right: 0; bottom: 0; width: auto; max-width: none; gap: 4px; padding-bottom: env(safe-area-inset-bottom); }
body.compact #lordbox { padding-left: 6px; }
body.compact #bl #chatbox { border-radius: 10px 10px 0 0; border-left: 0; border-right: 0; border-bottom: 0; }
body.compact .fabs.r, body.compact .town-zoom { bottom: 150px; }
body.compact .town-top { top: auto; bottom: 150px; padding-left: 6px; padding-right: 56px; }
/* step 6: compact layout — a Map button instead of the minimap; it opens the full-screen world map */
.mapbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 11px; border: 1px solid #a07a3a; background: linear-gradient(#4a3020ee, #24160cee); box-shadow: 0 2px 6px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,220,150,.22); color: #e8dcc0; font-size: 22px; line-height: 24px; cursor: pointer; }
.mapbtn span { font-size: 10px; line-height: 11px; }
body.compact #fmini { display: none; }
#fullmap { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: rgba(12,8,4,.96); padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
#fullmap .fm-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; background: linear-gradient(#7a2018, #4a100c); border-bottom: 2px solid #c9a35a; color: #ffe9a8; }
#fullmap .fm-head b { font-family: var(--title); font-size: 18px; } #fullmap #fmxy { flex: 1; font-size: 12px; color: #f2e2bb; font-variant-numeric: tabular-nums; }
#fullmap #fmx { width: 36px; height: 36px; border-radius: 8px; border: 1px solid #e6b33a; background: linear-gradient(#5a3d28, #33210f); color: #ffe9a8; font-size: 18px; cursor: pointer; }
#fullmap .fm-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#fullmap canvas { border: 2px solid #c9a35a; border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.8); cursor: crosshair; touch-action: none; }
#fullmap .fm-key { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: center; align-items: center; padding: 6px 8px 10px; font-size: 12px; color: #e8dcc0; }
#fullmap .fm-key i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px 0 0; border: 1px solid #000; vertical-align: -1px; }
/* step 8: Home button next to the lord card (the map's crown / + / − / home buttons and the town's + / − are gone) */
#lordbox { display: flex; align-items: center; gap: 6px; }
.homebtn { flex: none; width: 44px; height: 44px; border-radius: 11px; border: 1.5px solid #c9a35a; background: linear-gradient(rgba(90,61,40,.95), rgba(40,25,12,.95)); box-shadow: 0 3px 8px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,220,150,.25); color: var(--gold); font-size: 24px; line-height: 1; cursor: pointer; }
.homebtn:hover { filter: brightness(1.2); }
/* step 10: Saved window — Public countries grid and the Searches form */
.favgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 5px; }
.favc { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 8px; border-radius: 8px; border: 1px solid #6a5238; background: linear-gradient(#3a2618, #24160c); color: #f2e2bb; text-align: left; cursor: pointer; }
.favc:hover { border-color: #c9a35a; filter: brightness(1.15); } .favc b { font-size: 13px; color: var(--gold); } .favc span { font-size: 10.5px; color: #c8b898; } .favc span.gold { color: var(--gold); } .favc span.good { color: #9fd18b; } .favc span.muted { opacity: .7; }
.srch { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 8px; }
.srch label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #d8c8a8; }
.srch select { min-width: 70px; padding: 5px 6px; border-radius: 6px; background: #1e130c; color: #f2e2bb; border: 1px solid #a07a3a; font-size: 14px; }

/* ---- hero profile sheet (2026-11-15, heroes.js heroProfile) ---- */
[data-hprof] { cursor: pointer; }
a.hpbtn { color: #ffd98a; text-decoration: underline; font-style: normal; }
.hprof { display: flex; gap: 16px; align-items: flex-start; }
.hprof-art { flex: none; filter: drop-shadow(0 6px 14px rgba(0,0,0,.6)); }
.hprof-txt { flex: 1; min-width: 0; }
.hprof-txt h2 { margin: 2px 0 0; font-family: Georgia, 'Times New Roman', serif; font-size: 24px; letter-spacing: .3px; text-shadow: 0 2px 4px rgba(0,0,0,.6); }
.hprof-title { font-style: italic; color: #e8d6b0; font-size: 14px; }
.hprof-bio { font-family: Georgia, 'Times New Roman', serif; font-size: 14.5px; line-height: 1.55; color: #f1e6cf; margin: 4px 0 8px; padding: 10px 12px; background: linear-gradient(180deg, rgba(60,40,20,.55), rgba(30,18,8,.55)); border: 1px solid rgba(230,179,58,.35); border-radius: 8px; }
.hprof-stats { display: flex; gap: 8px; }
.hprof-stats div { flex: 1; background: rgba(0,0,0,.3); border-radius: 6px; padding: 5px 8px; display: flex; flex-direction: column; align-items: center; }
.hprof-stats span { font-size: 11px; color: #c8b898; } .hprof-stats b { font-size: 17px; color: #ffe7a8; }
@media (max-width: 560px) { .hprof { flex-direction: column; align-items: center; } .hprof-txt { width: 100%; } .hprof-txt h2 { text-align: center; } .hprof-title { text-align: center; } }

/* 2026-11-15: soft cloud shadows drifting slowly over the town (over the art, under the labels; no pointer events) */
.town-clouds { position: absolute; inset: -20%; pointer-events: none; mix-blend-mode: multiply; opacity: .5;
  background: radial-gradient(ellipse 22% 16% at 20% 30%, rgba(40,50,70,.55), transparent 70%), radial-gradient(ellipse 18% 13% at 70% 20%, rgba(40,50,70,.45), transparent 70%),
    radial-gradient(ellipse 26% 18% at 55% 70%, rgba(40,50,70,.5), transparent 70%), radial-gradient(ellipse 15% 11% at 10% 85%, rgba(40,50,70,.4), transparent 70%);
  animation: townClouds 90s linear infinite; }
@keyframes townClouds { from { transform: translate(-12%, -6%); } to { transform: translate(12%, 6%); } }
@media (prefers-reduced-motion: reduce) { .town-clouds { animation: none; } }

/* 2026-11-15: rarity glow on hero cards + a light sweep across legendary portraits */
.hcard.r-legendary { box-shadow: 0 0 0 1px rgba(230,179,58,.55), 0 0 14px rgba(230,179,58,.25); animation: legGlow 3.2s ease-in-out infinite; }
.hcard.r-epic { box-shadow: 0 0 0 1px rgba(160,102,211,.5), 0 0 12px rgba(160,102,211,.2); }
@keyframes legGlow { 50% { box-shadow: 0 0 0 1px rgba(255,214,120,.85), 0 0 22px rgba(230,179,58,.45); } }
.hprof.r-legendary .hprof-art { position: relative; }
.hcard.r-legendary .hport::after, .hprof.r-legendary .hprof-art::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  border-radius: 6px; background: linear-gradient(115deg, transparent 40%, rgba(255,246,210,.38) 50%, transparent 60%) no-repeat; background-size: 300% 100%; background-position: 100% 0; animation: legSweep 4.5s ease-in-out infinite; }
@keyframes legSweep { 0%, 55% { background-position: 100% 0; } 85%, 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .hcard.r-legendary, .hcard.r-legendary .hport::after, .hprof.r-legendary .hprof-art::after { animation: none; } }

/* 2026-11-15: one-tap gates pill, wall defence icons */
.gate-pill i { font-style: normal; opacity: .6; font-size: 10px; margin-left: 4px; }
.gate-pill:active { transform: scale(.96); }
.fort-ic { font-size: 34px; width: 56px; text-align: center; flex: none; }
.fort-ic img { width: 56px; height: 56px; object-fit: contain; }
.ab.found { background: linear-gradient(#6fa84f, #3f7a1f 48%, #2f5c14 52%, #3a6e1c); border-color: #183008; } .ab.found .ic { background: radial-gradient(circle at 35% 30%, #fff, #b9d98f); }
.ab.fort { background: linear-gradient(#b08a4f, #7a5a1f 48%, #5c4214 52%, #6e501c); border-color: #30200a; } .ab.fort .ic { background: radial-gradient(circle at 35% 30%, #fff, #c9b98f); }
/* 2026-11-15: town layers with z-index, swinging gates, moving wagons and walkers */
.town-world .tz { position: absolute; left: 0; top: 0; }
.town-world .tgate { position: absolute; pointer-events: none; background-repeat: no-repeat; }
.town-world .tprops { position: absolute; left: 0; top: 0; pointer-events: none; z-index: auto; }
.town-world .tprops .tprop { position: absolute; pointer-events: none; background-size: 800% 100%; background-repeat: no-repeat; filter: drop-shadow(1px 3px 2px rgba(0,0,0,.35)); }
.fort-ic.sm img { width: 26px; height: 26px; vertical-align: middle; } .fort-ic.sm { font-size: 0; width: auto; }
/* 2026-11-15: lord portrait paintings + picker */
img.lordpic { object-fit: cover; object-position: 50% 30%; border-radius: 6px; border: 1px solid rgba(201,163,90,.8); background: #2a1c12; display: block; }
.pchange { position: relative; cursor: pointer; flex: none; }
.pchange span { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-size: 10px; background: rgba(0,0,0,.6); color: #ffd98a; border-radius: 0 0 6px 6px; padding: 1px 0; }
.picgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; margin: 10px 0; max-height: 60vh; overflow: auto; }
.picc { padding: 0; border: 2px solid transparent; border-radius: 8px; background: none; cursor: pointer; aspect-ratio: 4 / 5; overflow: hidden; }
.picc img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picc.on { border-color: #ffd36a; box-shadow: 0 0 10px rgba(255,211,106,.6); }
.picc:hover { border-color: rgba(255,211,106,.6); }

/* ===== 2026-11-15 update: tiers, cities, quests, events (events.js) ===== */
.unitwrap { position: relative; display: inline-block; flex: none; }
.unitwrap b { position: absolute; right: -2px; bottom: -2px; background: linear-gradient(#f6d77a, #b8862a); color: #3a2400; font: 700 10px/1 serif; padding: 2px 4px; border-radius: 6px; border: 1px solid #5a3c0c; box-shadow: 0 1px 2px #0008; }
.unitwrap.t3 b { background: linear-gradient(#ffd0f0, #b04a9a); color: #2a0020; }
.citybtn { background: rgba(30, 22, 12, .86); color: #f3e2b8; border: 1px solid #a8823c; border-radius: 14px; padding: 3px 10px; font: 600 12px/1.6 inherit; margin-right: 6px; cursor: pointer; white-space: nowrap; }
/* 2026-11-17: big screens list every city as a tab after the Home button (cityPill in events.js) */
.citytabs { order: 9; display: flex; gap: 4px; margin-left: 6px; flex-wrap: wrap; align-items: center; }
.ctab { height: 44px; box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; background: rgba(30, 22, 12, .86); color: #f3e2b8; border: 1px solid #a8823c; border-radius: 11px; padding: 0 14px; font: 600 14px/1 inherit; cursor: pointer; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.ctab:hover:not(:disabled) { filter: brightness(1.3); }
.ctab.on { background: linear-gradient(#8a6a2a, #4e3510); color: #fff3cf; border-color: #f0c860; cursor: default; }
.ctab:disabled:not(.on) { opacity: .6; cursor: default; }
.ctab.more { padding: 0 11px; }
/* 2026-11-17: chat box minimize (Chat.min, localStorage cs_chatmin) */
#chatbox .cbmax { display: none; }
#chatbox.min { width: auto !important; border-radius: 9px !important; border: 1px solid #a07a3a !important; }
#chatbox.min .cbm, #chatbox.min form { display: none; }
#chatbox.min .cbmax { display: block; background: linear-gradient(#5a3d28, #33210f); color: #f2e2bb; border: 0; padding: 6px 12px; font: 600 13px/1.3 inherit; cursor: pointer; white-space: nowrap; }
#chatbox.min .cbmax .badge { position: static; display: inline-block; margin-left: 5px; }
body.compact #bl #chatbox.min { margin-left: 6px; margin-bottom: 6px; }
.hpbar { height: 8px; background: #3a1d17; border-radius: 4px; overflow: hidden; margin: 4px 0; }
.hpbar i { display: block; height: 100%; background: linear-gradient(90deg, #d0473a, #f09a3a); }
.qrow .prog { margin-top: 4px; }
.logincal { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin: 8px 0; }
.lday { position: relative; background: rgba(40, 30, 18, .85); border: 1px solid #6b5432; border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: #e8d8b6; }
.lday b { color: #f6d77a; } .lday.got { opacity: .55; } .lday.now { border-color: #f6d77a; box-shadow: 0 0 8px #f6d77a88; } .lday.big { grid-column: span 2; background: rgba(70, 40, 80, .85); }
.lday i { position: absolute; right: 6px; top: 4px; color: #8fd47f; font-style: normal; }
.rmem { display: inline-block; background: rgba(0, 0, 0, .3); border-radius: 8px; padding: 1px 6px; margin: 2px 2px 0 0; } .rmem.mine { outline: 1px solid #f6d77a; }
svg.arena { width: 100%; max-width: 460px; display: block; margin: 6px auto; background: radial-gradient(#5d7a3a, #3b4f26); border-radius: 10px; }
svg.arena .pulse { animation: arpulse 1.2s ease-in-out infinite; } @keyframes arpulse { 50% { stroke-opacity: .35; } }
.arlog { max-height: 120px; overflow: auto; margin-top: 4px; border-top: 1px solid #5a4630; padding-top: 4px; }
.shopgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin-top: 6px; }
.shopit { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; } .shopit.off { opacity: .55; }
.stsearch { display: flex; gap: 6px; margin: 4px 0 6px; } .stsearch input { flex: 1; } .stsearch button { padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--mid); color: #efe3c8; }
/* turning windmill sails over the farm pictures (2026-11-16, see millSvg in city.js) */
.town-world svg.tmill { position: absolute; pointer-events: none; overflow: visible; transform-origin: 130px 130px; filter: drop-shadow(1px 2px 1px rgba(0,0,0,.3)); }
.town-world svg.tmill g.spin { animation: millspin 8s linear infinite; will-change: transform; }
.town-world svg.tmill g.gust { animation: millgust 9s ease-in-out infinite alternate; }
@keyframes millspin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes millgust { from { transform: rotate(0deg); } to { transform: rotate(55deg); } }
@media (prefers-reduced-motion: reduce) { .town-world svg.tmill g.spin, .town-world svg.tmill g.gust { animation: none; } }
/* living water over the town backdrop (2026-11-16, see waterMask in city.js) */
.town-world .twater { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: hidden; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.town-world .twater.tint { background: linear-gradient(180deg, rgb(112,162,176), rgb(126,172,180)); mix-blend-mode: multiply; }
/* (2026-11-16 night) the ripple box is a QUARTER of the town's size, scaled up 4x. At full size its two moving layers were
   each 2912 x 2674 CSS px (x the phone's pixel ratio), which blew the WebView's tile memory on phones: "tile memory limits
   exceeded" in logcat, and buildings, the front fields and even the lord card / chat were not drawn. Keep it small. */
.town-world .twater.rip { mix-blend-mode: screen; opacity: .55; width: 25%; height: 25%; transform: scale(4); transform-origin: 0 0; }
.town-world .twater.rip i { position: absolute; left: -64px; top: -64px; right: -64px; bottom: -64px; background-size: 64px 64px; animation: waterA 14s linear infinite; }
.town-world .twater.rip i.b { background-size: 48px 48px; opacity: .8; animation: waterB 9s linear infinite; }
@keyframes waterA { from { transform: translate(0, 0); } to { transform: translate(64px, 0); } }
@keyframes waterB { from { transform: translate(0, 0); } to { transform: translate(-48px, 48px); } }
@media (prefers-reduced-motion: reduce) { .town-world .twater.rip i { animation: none; } }

/* ===== 2026-11-18: bottom row = portrait card | city tabs or pill | Home, all 44px tall; alliance Help box at the bottom right ===== */
#lordbox .me { height: 44px; box-sizing: border-box; flex: none; }
.citybtn { height: 44px; box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; border-radius: 11px; padding: 0 14px; font: 600 14px/1 inherit; margin-right: 0; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.citybtn:hover { filter: brightness(1.3); }
.citytabs { order: 0; margin-left: 0; }
.helpbox { position: relative; flex: none; width: 54px; height: 54px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border-radius: 11px; border: 1.5px solid #8fb6e0; background: linear-gradient(#3d6a9a, #1d3a5c); box-shadow: 0 3px 8px rgba(0,0,0,.55), inset 0 1px 0 rgba(200,230,255,.3); color: #eaf4ff; cursor: pointer; padding: 0; }
.helpbox:hover { filter: brightness(1.2); }
.helpbox .hi { font-size: 24px; line-height: 1; }
.helpbox .hl { font: 600 11px/1 inherit; letter-spacing: .3px; }
.helpbox .hn { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; box-sizing: border-box; padding: 0 5px; border-radius: 10px; background: #d0342c; border: 1.5px solid #fff2d0; color: #fff; font: 700 12px/17px system-ui, sans-serif; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.6); }
.helpbox.none { opacity: .6; filter: saturate(.5); }
#helpfab { position: absolute; right: 58px; bottom: 8px; z-index: 5; }
#stage[data-tab=map] #helpfab { right: 102px; }   /* left of the map's minimap / 2D buttons */
body:not(.compact) #lordbox .helpbox { display: none; }
body.compact #helpfab { display: none; }
body.compact #lordbox .helpbox { width: 44px; height: 44px; margin: 0 8px 0 auto; }
body.compact #lordbox .helpbox .hi { font-size: 20px; } body.compact #lordbox .helpbox .hl { font-size: 10px; }
body.compact #lordbox { padding-top: 7px; align-self: stretch; }   /* room for the number on the Help box; full width so it sits at the right end */

/* ===== 2026-11-18: resources on a march (marchForm), saved searches (Saved → Searches) ===== */
.cargo { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.cargo .cg { display: flex; align-items: center; gap: 4px; background: var(--panel); border-radius: 6px; padding: 4px 6px; }
.cargo .cg input { flex: 1; min-width: 0; width: 60px; padding: 4px 6px; }
.ssl { display: flex; flex-wrap: wrap; gap: 6px; }
.ssc { display: inline-flex; align-items: stretch; border: 1px solid var(--gold); border-radius: 8px; overflow: hidden; max-width: 100%; }
.ssb { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; background: rgba(230,179,58,.12); border: 0; color: inherit; padding: 5px 9px; cursor: pointer; text-align: left; min-width: 0; }
.ssb b { font-size: 13px; } .ssb i { font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.ssb:hover { background: rgba(230,179,58,.25); }
.ssx { background: none; border: 0; border-left: 1px solid rgba(230,179,58,.4); color: var(--muted); padding: 0 8px; cursor: pointer; }
.ssx:hover { color: var(--bad); }
/* 2026-11-18: everything under the resource bar follows its real height (--rb, set in core.js), so boost chips or an alert
   in the bar never cover the activity bars (sieges, builds) or the City / World / Menu buttons */
#stage[data-tab] #lpanel { top: calc(var(--rb, 0px) + 6px); }
body.compact #tabs.top { top: calc(var(--rb, 34px) + 6px); }
body.compact #win, body.compact #stage[data-tab=map] #win, body.compact #stage[data-tab=city] #win { padding-top: calc(var(--rb, 34px) + 54px); }
/* ===== 2026-11-19: Admin button + window (web/admin.js), hero "+" experience dialog (web/heroes.js) ===== */
.adminbox { position: relative; flex: none; width: 54px; height: 54px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border-radius: 11px; border: 1.5px solid #e0b860; background: linear-gradient(#8a3a2a, #4a1a12); box-shadow: 0 3px 8px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,220,180,.3); color: #fff2d8; cursor: pointer; padding: 0; }
.adminbox:hover { filter: brightness(1.2); }
.adminbox .hi { font-size: 22px; line-height: 1; }
.adminbox .hl { font: 600 11px/1 inherit; letter-spacing: .3px; }
.adminbox .hn { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; box-sizing: border-box; padding: 0 5px; border-radius: 10px; background: #d0342c; border: 1.5px solid #fff2d0; color: #fff; font: 700 12px/17px system-ui, sans-serif; text-align: center; }
#adminfab { position: absolute; right: 58px; bottom: 8px; z-index: 5; }
#stage[data-tab=map] #adminfab { right: 102px; }
body.isadmin:not(.compact) #helpfab { right: 120px; }
body.isadmin:not(.compact) #stage[data-tab=map] #helpfab { right: 164px; }
body:not(.compact) #lordbox .adminbox { display: none; }
body.compact #adminfab { display: none; }
body.compact #lordbox .adminbox { width: 44px; height: 44px; margin: 0 8px 0 auto; }
body.compact #lordbox .helpbox + .adminbox { margin-left: 0; }
body.compact #lordbox .adminbox .hi { font-size: 19px; } body.compact #lordbox .adminbox .hl { font-size: 10px; }
.adrow.banned { border-color: var(--bad); opacity: .85; }
.adrow.done { opacity: .6; }
.adrow .tag { font-size: 11px; padding: 1px 6px; border-radius: 8px; background: rgba(255,255,255,.1); }
.adrow .tag.bad { background: #7a1f18; color: #ffd8d0; }
.adbtns { display: flex; gap: 6px; flex: none; }
.adchk { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; flex: none; min-width: 52px; cursor: pointer; }
.adchk input { width: 22px; height: 22px; }
.adtext { white-space: pre-wrap; word-break: break-word; margin-top: 4px; font-size: 14px; }
.adphotos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.adphotos img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid rgba(255,255,255,.2); cursor: pointer; background: rgba(0,0,0,.3); }
.adph { position: relative; display: inline-block; }
.adph button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 11px; border: 0; background: #d0342c; color: #fff; cursor: pointer; padding: 0; }
.xpplus { margin-left: 6px; width: 22px; height: 22px; border-radius: 11px; border: 1.5px solid #c9a0ff; background: #5a2a8a; color: #fff; font: 700 15px/1 system-ui, sans-serif; cursor: pointer; padding: 0; vertical-align: middle; }
.xpplus:hover { filter: brightness(1.25); }
.hxp .xpplus { flex: none; }
.xprow { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.08); flex-wrap: wrap; }
.xprow.none { opacity: .5; }
.xpstep { display: flex; align-items: center; gap: 4px; }
.xpstep input { width: 56px; text-align: center; padding: 4px; }
/* 2026-11-19: war report heroes (portrait + name + level above the troops each led), share buttons, shared-report links */
.rheroes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.rh-side { min-width: 0; background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; padding: 6px; }
.rh-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.rhero { width: 92px; display: flex; flex-direction: column; align-items: center; text-align: center; font-size: 11px; }
.rh-art { position: relative; width: 56px; height: 67px; border-radius: 6px; overflow: hidden; border: 1px solid rgba(255,215,140,.45); background: rgba(0,0,0,.3); line-height: 0; }
.rh-art .portrait, .rh-art svg { width: 56px; height: 67px; }
.rh-none { display: flex; align-items: center; justify-content: center; font-size: 22px; line-height: 1; opacity: .55; }
.rh-lv { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.7); color: #ffe7a8; font: 700 10px/14px system-ui, sans-serif; }
.rh-up { margin-top: 2px; font: 700 10px/13px system-ui, sans-serif; color: #b6f0a0; background: rgba(40,90,30,.55); border-radius: 4px; padding: 0 4px; display: inline-block; }
.rh-name { font-weight: 700; margin-top: 2px; line-height: 1.2; word-break: break-word; }
.rh-tr { margin-top: 2px; color: #d9cbb0; line-height: 1.3; }
/* 2026-11-20: the heroes are a row of the troop table, each side centred over its "count | lost" columns */
.rtab { width: 100%; }
.rh-row td { border-bottom: 0; padding-top: 6px; padding-bottom: 6px; }
.rh-cell .rh-list { justify-content: center; margin-top: 0; }
.rshare { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rshare .btn { font-size: 12px; padding: 4px 10px; }
.replink { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; text-align: left; }
#dialog:has(.shrep) { max-width: 560px; }
/* (2026-11-26) battle replay (battle.js) */
#dialog:has(.bview) { max-width: 680px; padding: 14px; }
.bview h2 { margin: 0 0 8px; font-size: 17px; }
.bv-stage { width: 100%; display: flex; justify-content: center; }
.bv-cv { border-radius: 10px; display: block; box-shadow: 0 2px 10px rgba(0,0,0,.45); touch-action: manipulation; }
.bv-ctl { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.bv-watch { margin-top: 6px; }
.shrep .t { width: 100%; }
@media (max-width: 420px) { .rhero { width: 76px; } }
/* (2026-11-20) beginner tips (tutorial.js): a card under the top bar, or a small 📘 pill when hidden */
#tut { position: absolute; top: 104px; left: 50%; transform: translateX(-50%); z-index: 6; width: min(400px, calc(100% - 140px)); pointer-events: none; }
#tut > * { pointer-events: auto; }
.tutcard { background: linear-gradient(#3a2716f5, #22160cf5); border: 2px solid #c9a35a; border-radius: 12px; padding: 10px 12px; box-shadow: 0 8px 26px rgba(0,0,0,.6); color: var(--text, #efe3c8); }
.tutcard.fresh { animation: tutpop .5s ease-out; }
@keyframes tutpop { 0% { transform: scale(.85); opacity: 0; } 70% { transform: scale(1.03); } 100% { transform: scale(1); opacity: 1; } }
.tuthead { display: flex; align-items: center; gap: 8px; }
.tuthead b { color: #ffe9a8; font-size: 15px; }
.tutic { font-size: 26px; line-height: 1; }
.tutx { width: 28px; height: 28px; border-radius: 7px; border: 1px solid #8a6a3a; background: rgba(0,0,0,.25); color: #ffe9a8; cursor: pointer; flex: none; }
.tuttext { margin: 6px 0 8px; line-height: 1.4; }
.tutbtns { gap: 6px; align-items: center; }
.tutpill { display: block; margin: 0 auto; padding: 6px 12px; border-radius: 16px; border: 1.5px solid #c9a35a; background: linear-gradient(#5a3d28, #33210f); color: #ffe9a8; font: 600 13px/1 inherit; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.5); animation: tutglow 2.4s ease-in-out infinite; }
@keyframes tutglow { 50% { box-shadow: 0 0 0 2px rgba(255,214,120,.55), 0 3px 10px rgba(0,0,0,.5); } }
body.compact #tut { top: 96px; width: calc(100% - 16px); }
/* (2026-12-02) the Watchtower as a lighthouse on an island in the pond (web/city.js watchtowerSvg) */
.town-world svg.tlight.ghost { opacity: .45; filter: grayscale(.6); }
/* (2026-12-02) restyled as a stone war tower: flickering signal fire on the roof + a waving banner instead of the lamp beam */
.town-world svg.tlight .wtglow { animation: wtglow 1.7s ease-in-out infinite; }
.town-world svg.tlight .wtfire { animation: wtfire .9s ease-in-out infinite alternate; }
.town-world svg.tlight .wtflag { animation: wtflag 2.2s ease-in-out infinite alternate; }
@keyframes wtglow { 50% { opacity: .6; } }
@keyframes wtfire { 0% { transform: scale(1, 1) skewX(0); } 50% { transform: scale(.92, 1.12) skewX(-4deg); } 100% { transform: scale(1.05, .9) skewX(3deg); } }
@keyframes wtflag { 0% { transform: scaleX(1) skewY(0); } 100% { transform: scaleX(.86) skewY(4deg); } }
@media (prefers-reduced-motion: reduce) { .town-world svg.tlight .wtglow, .town-world svg.tlight .wtfire, .town-world svg.tlight .wtflag { animation: none; } }

/* (2026-12-02) the compact Map button sat at a fixed top: 88px, so when the resource bar grew (boost chips) the City / World /
   Menu buttons moved down over it; it now follows the bar's real height like the buttons do */
body.compact .minimap { top: calc(var(--rb, 34px) + 60px); }

/* ---- 2026-12-02 (i): lord pages, clickable names ---- */
#dialog.wide { max-width: 720px; }
.cm .who, .cbwho, .lordlink { cursor: pointer; }
.cm .who:hover, .cbwho:hover, .lordlink:hover { text-decoration: underline; }
.lordlink { color: inherit; }
.lordpage .online { color: #6fd36f; font-size: 13px; }
.lordpage .kv.click { cursor: pointer; border-radius: 6px; padding: 4px 6px; }
.lordpage .kv.click:hover { background: rgba(255,255,255,.05); }
.lplegs { display: flex; gap: 10px; flex-wrap: wrap; }
.lpleg { width: 84px; text-align: center; cursor: pointer; line-height: 1.2; }/* (2026-12-02 i) the city stores panel also floats over the World map on PCs; ⚔ Troops opens a list of every troop type */
#cresg.cres.float { position: absolute; right: 58px; top: calc(var(--rb, 44px) + 8px); z-index: 6; }
.cres .crtr { cursor: pointer; } .cres .crtr:hover { background: rgba(255,255,255,.12); }
.cres .crlist { background: rgba(0,0,0,.18); max-height: 46vh; overflow-y: auto; }
.cres .cr.sub { font-size: 11.5px; padding: 2px 8px; gap: 5px; } .cres .cr.sub img { width: 20px; height: 20px; object-fit: contain; }
.cres .cr.sub .l { flex: 1; color: #dbe7ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .cres .cr.sub b { flex: 0 0 auto; }
.cres .cr.sub.away .l { color: #ffd98a; }
.cres.open { width: 184px; }
.town-world .twater.rip { opacity: .32; }
.town-world .ttreb, .town-world .ttrap { pointer-events: none; }/* (2026-12-02 i) painted hero portraits (img/heroes, web/portraits.js heroArt) */
img.portrait.hpic { object-fit: cover; object-position: 50% 30%; border: 2px solid #9a9a9a; border-radius: 7px; background: #2a1a10; display: inline-block; vertical-align: middle; }
.hprof-credit { font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.hprof-credit a { color: inherit; }