/* Invasion und Belagerung (ui/invasion.js): the window #invasion, the call #inv-call, the arena #inv-hud, #inv-result and the
   choice of the Truhe des Feldherrn #inv-chest. The tab at the left edge is an .edge-tab (fortune.css). Everything under its
   id. Phones at the end (html.touch). */
#ui.in-inv #quest-tracker, html.touch #ui.in-inv #quest-tracker { display: none; }
/* (the way to town is closed in the arena - "Verlassen" in the box does it; the box takes its place under the map) */
#ui.in-inv #travel-btn { display: none; }

/* the window */
#invasion .iv-tabs .tab { flex: 1 1 0; min-width: 0; padding: 0 2px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#invasion .iv-body { display: flex; flex-direction: column; }
#invasion .iv-page { display: flex; flex-direction: column; gap: 4px; height: 268px; overflow-y: auto; padding-right: 1px; }
#invasion .iv-head { flex: none; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 5px; align-items: center; padding: 4px 6px;
  background: linear-gradient(180deg, rgba(120, 30, 22, .45), rgba(20, 12, 10, .2) 70%), linear-gradient(180deg, #1c1814, #110e0c);
  box-shadow: 0 0 0 1px var(--edge), inset 0 0 0 1px var(--bronze); }
#invasion .iv-emb { width: 26px; height: 26px; object-fit: contain; image-rendering: auto; }
#invasion .iv-ht { min-width: 0; }
#invasion .iv-cap { font-size: 6px; line-height: 7px; color: var(--dim); }
#invasion .iv-name { font-size: 11px; line-height: 12px; color: #ffe2a0; text-shadow: 0 1px 0 #000; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#invasion .iv-time { font-size: 13px; line-height: 14px; color: var(--gold); text-shadow: 0 1px 0 #000; }
#invasion .iv-go { flex: none; }
#invasion .iv-line { flex: none; font-size: 7px; line-height: 8px; padding: 0 2px; overflow-wrap: anywhere; }
#invasion .iv-note { flex: none; font-size: 7px; line-height: 9px; color: var(--dim); text-align: center; padding: 3px 4px; overflow-wrap: anywhere; }
#invasion .iv-hint { font-size: 6px; line-height: 7px; color: var(--dim); overflow-wrap: anywhere; }
#invasion .iv-box { flex: none; display: flex; flex-direction: column; gap: 2px; padding: 3px 5px 4px; background: linear-gradient(180deg, #1c1814, #110e0c); box-shadow: inset 0 0 0 1px #47423a; }
#invasion .iv-btitle { font-size: 8px; line-height: 9px; }
#invasion .iv-row { display: grid; grid-template-columns: minmax(0, 58px) minmax(0, 1fr) auto; gap: 4px; align-items: center; font-size: 7px; line-height: 9px; }
#invasion .iv-row.on .iv-k, #invasion .iv-row.on .iv-gain { color: #b6f0a0; }
#invasion .iv-k { color: var(--dim); min-width: 0; overflow-wrap: anywhere; }
#invasion .iv-v { min-width: 0; overflow-wrap: anywhere; }
#invasion .iv-gain { display: inline-flex; align-items: center; gap: 2px; justify-content: flex-end; text-align: right; color: var(--gold); max-width: 124px; overflow-wrap: anywhere; }
#invasion .iv-gain img, #invasion .iv-wallet img, #invasion .iv-price img { flex: none; width: 10px; height: 10px; image-rendering: auto; }
#invasion .iv-auto { flex-direction: row; align-items: center; gap: 6px; }
#invasion .iv-autot { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#invasion .btn.opt-tog { flex: none; min-width: 30px; display: flex; align-items: center; justify-content: center; gap: 3px; }
#invasion .opt-tog .opt-dot { width: 4px; height: 4px; flex: none; background: #5a4d3c; box-shadow: inset 0 0 0 1px #2a2018; }
#invasion .opt-tog .opt-st { color: var(--dim); text-transform: uppercase; }
#invasion .btn.opt-tog.on { color: #d6ffc4; background: linear-gradient(#2e4a22, #1c2f15); box-shadow: inset 0 0 0 1px #79d653, 0 0 5px #79d65399; }
#invasion .opt-tog.on .opt-dot { background: #8dff5e; box-shadow: 0 0 4px #8dff5e; }
#invasion .opt-tog.on .opt-st { color: #d6ffc4; }
#invasion .iv-set { display: flex; align-items: center; gap: 4px; margin-top: 1px; }
#invasion .iv-set .sel { flex: 1; min-width: 0; }
#invasion .iv-set .btn { flex: none; }
#invasion .iv-rank { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 26px; gap: 4px; font-size: 7px; line-height: 9px; padding: 0 3px; }
#invasion .iv-rank.me { color: var(--gold); background: rgba(58, 44, 18, .45); }
#invasion .iv-rname, #inv-hud .iv-rname, #inv-result .iv-rname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#invasion .iv-rch { text-align: right; color: var(--dim); }
/* the shop */
#invasion .iv-wallet { flex: none; display: flex; align-items: center; gap: 3px; padding: 2px 5px; font-size: 8px; line-height: 12px; background: linear-gradient(180deg, #1c1814, #110e0c); box-shadow: inset 0 0 0 1px #47423a; }
#invasion .iv-shop { flex: none; display: grid; grid-template-columns: 20px minmax(0, 1fr) 30px 44px; gap: 5px; align-items: center; padding: 2px 5px 2px 3px; background: linear-gradient(180deg, #1c1814, #110e0c); box-shadow: inset 0 0 0 1px #47423a; }
#invasion .iv-pic { display: flex; align-items: center; justify-content: center; }
#invasion .iv-st { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
#invasion .iv-sname { font-size: 8px; line-height: 9px; overflow-wrap: anywhere; }
#invasion .iv-st .sel { width: 100%; }
#invasion .iv-bound { font-size: 6px; line-height: 7px; color: var(--dim); }
#invasion .iv-price { display: inline-flex; align-items: center; justify-content: flex-end; gap: 2px; font-size: 9px; line-height: 10px; color: var(--gold); }
#invasion .iv-price.no { color: #ff8a72; }
#invasion .iv-shop .btn { width: 100%; padding-left: 0; padding-right: 0; }
/* the trophies */
#invasion .iv-trophy { flex: none; display: grid; grid-template-columns: 20px minmax(0, 1fr) minmax(0, 74px); gap: 5px; align-items: center; padding: 3px 5px 3px 3px; background: linear-gradient(180deg, #1c1814, #110e0c); box-shadow: inset 0 0 0 1px #47423a; }
#invasion .iv-trophy:not(.got) .slot img { filter: grayscale(.9) brightness(.6); }
#invasion .iv-trophy.got { box-shadow: inset 0 0 0 1px var(--gold-d); }
#invasion .iv-tt { min-width: 0; }
#invasion .iv-tname { font-size: 8px; line-height: 9px; color: #ffe2a0; overflow-wrap: anywhere; }
#invasion .iv-tbonus { font-size: 7px; line-height: 8px; color: #b0dfb4; overflow-wrap: anywhere; }
#invasion .iv-tfrom { font-size: 6px; line-height: 7px; color: var(--dim); }
#invasion .iv-tst { font-size: 7px; line-height: 8px; text-align: right; overflow-wrap: anywhere; }
#invasion .iv-trophy.got .iv-tst { color: var(--gold); }

/* the call: the look of the world boss (social.css #wb-call), in the red of the Invasion */
#inv-call { position: absolute; left: 50%; top: 106px; transform: translateX(-50%); width: 200px; padding: 5px 7px 6px; z-index: 6;
  background: linear-gradient(180deg, rgba(130, 28, 20, .55), rgba(20, 12, 10, .2) 60%), var(--panel, #17110d);
  box-shadow: 0 0 0 1px var(--edge), inset 0 0 0 1px #b8483a, inset 0 0 0 2px var(--edge), 0 0 10px rgba(255, 90, 60, .4);
  animation: inv-call-in .45s ease-out; }
#inv-call.hidden { display: none; }
#inv-call .wc-top { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 5px; align-items: center; }
#inv-call .wc-emb { width: 26px; height: 26px; object-fit: contain; image-rendering: auto; }
#inv-call .wc-head { min-width: 0; }
#inv-call .wc-kick { font-size: 6px; line-height: 7px; letter-spacing: 1px; text-transform: uppercase; color: #ff9a7a; }
#inv-call .wc-name { font-size: 11px; line-height: 11px; color: #ffe2a0; overflow-wrap: anywhere; text-shadow: 0 1px 0 #000; }
#inv-call .wc-time { text-align: right; min-width: 36px; }
#inv-call .wc-tl { font-size: 6px; line-height: 7px; color: var(--dim); white-space: nowrap; }
#inv-call .wc-t { font-size: 15px; line-height: 15px; color: var(--gold); text-shadow: 0 1px 0 #000; }
#inv-call .wc-sub { margin-top: 3px; font-size: 7px; line-height: 8px; color: #e8dcc4; overflow-wrap: anywhere; }
#inv-call .wc-btns { gap: 4px; margin-top: 5px; }
@keyframes inv-call-in { from { opacity: 0; translate: 0 -8px; scale: 1.06; } }
#ui.compact #inv-call { top: 48px; }
/* another call stands there already (world boss, Drachenspiele, OX, „Wo bin ich?“): below it */
:is(#wb-call, #fest-call, #ox-call, #geo-call):not(.hidden) ~ #inv-call { top: 184px; }
#ui.compact :is(#wb-call, #fest-call, #ox-call, #geo-call):not(.hidden) ~ #inv-call { top: 126px; }

/* in an arena */
#inv-hud { position: absolute; right: 4px; top: 111px; width: 132px; padding: 3px 4px 4px; display: flex; flex-direction: column; gap: 2px; }
#inv-hud.hidden { display: none; }
#inv-hud .iv-hhead { display: flex; align-items: center; gap: 3px; font-size: 8px; line-height: 10px; }
#inv-hud .iv-hhead img { flex: none; width: 12px; height: 12px; image-rendering: auto; }
#inv-hud .iv-htitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#inv-hud .iv-hclock { flex: none; font-size: 10px; }
#inv-hud .iv-hclock.warn { color: #ff8a72; }
#inv-hud .iv-hline { font-size: 7px; line-height: 8px; color: #ffe2a0; overflow-wrap: anywhere; }
#inv-hud .iv-hmech { font-size: 7px; line-height: 8px; color: #ff9a7a; overflow-wrap: anywhere; }
#inv-hud .iv-hdmg { display: flex; justify-content: space-between; gap: 4px; font-size: 7px; line-height: 9px; padding-top: 2px; border-top: 1px solid rgba(90, 72, 52, .45); }
#inv-hud .iv-hdmg b { font-weight: normal; color: var(--gold); }
#inv-hud .iv-pips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
#inv-hud .iv-pip { display: flex; flex-direction: column; gap: 1px; font-size: 6px; line-height: 7px; color: var(--dim); text-align: center; min-width: 0; }
#inv-hud .iv-pip span { overflow: hidden; text-overflow: clip; white-space: nowrap; }
#inv-hud .iv-pip.on { color: var(--gold); }
#inv-hud .iv-pbar { height: 4px; }
#inv-hud .iv-pbar i { display: block; height: 100%; background: linear-gradient(#e0a03a, #a8641c); }
#inv-hud .iv-pip.on .iv-pbar i { background: linear-gradient(#ffe08a, #e0a03a); }
#inv-hud .iv-rows { display: flex; flex-direction: column; gap: 1px; padding-top: 2px; border-top: 1px solid rgba(90, 72, 52, .45); }
#inv-hud .iv-hrow { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 3px; font-size: 7px; line-height: 8px; padding: 0 3px; }
#inv-hud .iv-hrow.me { color: var(--gold); background: rgba(58, 44, 18, .45); }
#ui #inv-hud .iv-hbtn { display: block; margin-top: 1px; }
#ui #inv-hud .iv-hbtn .btn { width: 100%; }

/* the end */
#inv-result { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); width: min(240px, calc(100% - 8px)); padding: 6px 8px 7px; z-index: 7000; display: flex; flex-direction: column; gap: 3px; }
#inv-result.hidden { display: none; }
#inv-result .iv-rtitle { text-align: center; font-size: 12px; line-height: 13px; text-shadow: var(--ol); overflow-wrap: anywhere; }
#inv-result .iv-rmine { text-align: center; font-size: 9px; line-height: 10px; color: #fff3d1; overflow-wrap: anywhere; }
#inv-result .iv-rgain { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 3px; font-size: 8px; line-height: 10px; text-align: center; overflow-wrap: anywhere; }
#inv-result .iv-rgain img { width: 11px; height: 11px; image-rendering: auto; }
#inv-result .iv-rtab { display: flex; flex-direction: column; gap: 1px; padding: 2px 3px; background: linear-gradient(180deg, #1c1814, #110e0c); box-shadow: inset 0 0 0 1px #47423a; }
#inv-result .iv-rrow { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 4px; align-items: center; font-size: 8px; line-height: 10px; }
#inv-result .iv-rrow.me { color: var(--gold); }
#inv-result .iv-rwait { text-align: center; font-size: 7px; line-height: 8px; color: var(--dim); }

/* Truhe des Feldherrn */
#inv-chest { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); width: 190px; padding: 6px 8px 7px; z-index: 7000; display: flex; flex-direction: column; gap: 4px; }
#inv-chest.hidden { display: none; }
#inv-chest .iv-ctitle { text-align: center; font-size: 11px; line-height: 12px; text-shadow: var(--ol); }
#inv-chest .iv-chint { text-align: center; font-size: 7px; line-height: 8px; color: var(--dim); }
#inv-chest .iv-crow { display: grid; grid-template-columns: minmax(0, 64px) minmax(0, 1fr); gap: 4px; align-items: center; font-size: 7px; line-height: 9px; }
#inv-chest .iv-crow .sel { min-width: 0; }

/* phones: the window as wide as the screen allows, buttons for fingers, the arena box at the left like the dungeon's */
html.touch #ui #invasion { width: min(300px, calc((100% - 8px) / var(--wz))) !important; }
html.touch #invasion .iv-page { height: auto; max-height: calc((100vh - 76px) / (var(--px) * var(--wz))); }
html.touch #invasion .btn, html.touch #invasion .tab, html.touch #invasion .sel { min-height: calc(44px / (var(--px) * var(--wz))); }
html.touch #invasion .tab, html.touch #invasion .btn { display: flex; align-items: center; justify-content: center; }
html.touch #invasion .iv-shop { grid-template-columns: 20px minmax(0, 1fr) 30px 52px; }
html.touch #ui #inv-call { width: 230px; top: 40px; }
html.touch #ui :is(#wb-call, #fest-call, #ox-call, #geo-call):not(.hidden) ~ #inv-call { top: 118px; }
html.touch #ui #inv-call .btn, html.touch #ui #inv-hud .btn { min-height: calc(44px / var(--px)); display: flex; align-items: center; justify-content: center; }
html.touch #ui #inv-hud .iv-hbtn { width: auto; }
html.touch #ui #inv-hud { left: 4px; right: auto; top: 70px; width: 132px; overflow-y: auto; }
html.touch #ui #inv-result, html.touch #ui #inv-chest { top: 4px; transform: none; translate: -50% 0; scale: var(--wz); transform-origin: top center; max-height: calc((100% - 8px) / var(--wz)); overflow-y: auto; }
html.touch #ui #inv-result { width: min(300px, calc((100% - 8px) / var(--wz))); }
html.touch #ui #inv-chest { width: min(240px, calc((100% - 8px) / var(--wz))); }
html.touch #ui :is(#inv-result, #inv-chest) .btn, html.touch #ui #inv-chest .sel { min-height: calc(44px / (var(--px) * var(--wz))); }
