.alpha-game {
  --hud-height: 0px;
  --hud-light: #f4e5c5;
  --hud-line: #9d7f52;
}
.alpha-game .top {
  position: sticky;
  z-index: 8;
  top: 0;
}
.alpha-game .top-inner {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(310px, 440px);
  min-height: 0;
  gap: 7px clamp(12px, 3vw, 36px);
  padding-block: 9px;
}
.alpha-game .top-inner:has(.heading[hidden]) { display: flex; }
.top .brand { font-size: clamp(20px, 2.2vw, 27px); }
.top .brand .crest { width: 29px; height: 34px; flex: none; }
.alpha-game .top .heading {
  display: flex;
  align-items: center;
  justify-content: start;
  min-width: 0;
  padding: 0;
  gap: clamp(4px, 1.3vw, 15px);
}
.alpha-game .top .heading[hidden], .storage-panel[hidden] { display: none; }
.top .heading > div:first-child { min-width: 0; }
.top .heading h1 {
  margin-top: 0;
  font-size: clamp(23px, 3vw, 35px);
  overflow-wrap: anywhere;
}
.top .heading .region { font-size: 10px; }
#city-picker:empty { display: none; }
.storage-panel { min-width: 0; color: var(--hud-light); }
#stock-city { margin: 0 0 3px; font-size: 12px; color: #ead9b6; }
.storage-panel .resources { width: 100%; }
.storage-panel .near-capacity { border-color: #efa76f; background: #643f2b; }
.storage-panel .near-capacity progress { --storage-tint: #ffad78; }

.alpha-game .activity { grid-column: 1/-1; width: 100%; margin: 0; }
.alpha-game .activity:has(#queues:empty):has(#raid-warnings:empty) { display: none; }
.alpha-game #queues {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 1px;
  padding: 0;
  box-shadow: none;
  background: #293832;
}
.alpha-game #queues:empty { display: none; }
.alpha-game .queue { min-height: 31px; padding: 3px 8px; gap: 6px; background: #293832; box-shadow: inset 0 2px #c29a62; }
.alpha-game .queue > .icon { width: 17px; height: 17px; }
.alpha-game .queue > div { display: flex; align-items: baseline; min-width: 0; gap: 5px; }
.alpha-game .queue small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.alpha-game .queue time { flex: none; }
.alpha-game #raid-warnings:not(:empty) {
  display: flex;
  max-height: 46px;
  gap: 4px;
  overflow: auto;
  margin-bottom: 4px;
}
.alpha-game #raid-warnings > p {
  display: flex;
  align-items: center;
  margin: 0;
  min-width: min(245px, 100%);
  gap: 6px;
  padding: 3px 8px;
  overflow-wrap: anywhere;
  line-height: 1.2;
  background: #733c2c;
}
.alpha-game #raid-warnings time { margin-inline-start: auto; }
.alpha-game #raid-warnings .icon { width: 16px; height: 16px; color: #ffcc87; }

.alpha-game main > .tabs { margin-top: 9px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.alpha-game main > .tabs[hidden] { display: none; }
.alpha-game .tabs button { min-width: 0; padding-inline: 3px; }
.alpha-game .tabs .icon { flex: 0 0 15px; }
.alpha-game .tabs #report-count { flex: none; }
.alpha-game .board { scroll-margin-top: calc(var(--hud-height) + 8px); }
.alpha-game .map { scroll-margin-top: calc(var(--hud-height) + 8px); }
.alpha-game .place-heading svg { flex: none; }

.game-picker { position: relative; z-index: 3; }
.game-picker[open] { z-index: 5; }
.game-picker > summary {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 4px 7px;
  cursor: pointer;
  list-style: none;
  color: var(--hud-light);
  background: linear-gradient(#4d5546, #293630);
  border: 1px solid var(--hud-line);
  border-radius: 2px;
  font-size: 13px;
}
.game-picker > summary::-webkit-details-marker { display: none; }
.game-picker > summary::after { content: '▾'; margin-inline-start: auto; color: #f3ca8e; }
.game-picker[open] > summary::after { content: '▴'; }
.game-picker > summary .icon { width: 17px; height: 17px; color: #e8ba7e; }
.picker-options {
  position: absolute;
  inset-block-start: calc(100% + 4px);
  inset-inline-start: 0;
  z-index: 2;
  width: min(235px, calc(100vw - 32px));
  max-height: min(50dvh, 290px);
  overflow: auto;
  padding: 5px;
  color: #362818;
  background: #f0e1c0;
  border: 2px solid #a07c4b;
  box-shadow: 0 5px 18px #1e251c75;
  font-size: 14px;
}
.picker-options button, .force-picker #troops > p {
  display: flex;
  width: 100%;
  min-height: 35px;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 4px 6px;
  text-align: start;
  background: #f6ebcf;
  color: #362818;
  border: 1px solid #bda37b;
  overflow-wrap: anywhere;
}
.picker-options button + button, .force-picker #troops > p + p { border-block-start: 0; }
.picker-options :is(button:hover,button[aria-pressed=true]) { background: #ebcb8b; }
.picker-options small { display: block; font-size: 11px; }
.picker-options .icon { color: #815527; width: 18px; height: 18px; }
.force-picker #troops > p > span:not(.icon) { flex: 1; }
.top .force-picker { margin-inline-start: auto; }
.top .force-picker .picker-options, .atlas-toolbar .picker-options { inset-inline: auto 0; }
.top .game-picker :focus-visible { outline: 2px solid #815321; outline-offset: -2px; }
.top .game-picker summary:focus-visible { outline-color: #ffe0a5; }

.alpha-game .has-list .city-scene { height: clamp(178px, 30vw, 350px); aspect-ratio: auto; min-height: 0; }
.alpha-game .city-scene .city-backdrop { object-position: center 57%; }
.alpha-game .city-plan { padding-block: 7px 14px; }
.alpha-game .city-plan .building-group { margin-top: 8px; }
.city-plan .building-group h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 5px;
  padding: 5px 8px;
  border-block-end: 1px solid #af8d5b;
  background: linear-gradient(90deg, #e6cda0, #ead9b3 75%, #f5e7c900);
  font: 700 20px/1.1 var(--serif);
}
.building-group h2 .icon { width: 17px; height: 17px; color: #795023; }
.alpha-game .building-list { grid-template-columns: repeat(auto-fit, minmax(min(165px, 100%), 1fr)); }
.alpha-game .building-list button { gap: 8px; min-height: 60px; }
.alpha-game .building-list button > span { hyphens: auto; }
.alpha-game .building-list img { width: 44px; height: 44px; flex: 0 0 44px; object-fit: contain; }

.atlas-toolbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 45px;
  padding: 5px 8px 5px 12px;
  color: var(--hud-light);
  background: linear-gradient(90deg, #26382c, #26382ca8), url("../assets/views/atlas.webp") center 56% / cover #2b433b;
  border-block-end: 1px solid #b48d56;
}
.atlas-toolbar h2 { display: flex; gap: 6px; align-items: center; margin: 0; font: 700 clamp(20px, 2.5vw, 28px)/1 var(--serif); }
.atlas-toolbar .game-picker > summary { white-space: nowrap; }
.alpha-game #visual[data-view=map] { overflow: visible; }
.alpha-game .map-tools button { min-width: 36px; min-height: 36px; }

.drawer-bar { display: none; }
@media (min-width: 701px) {
  .alpha-game .board:has(.city-plan) > .detail { top: calc(var(--hud-height) + 8px); }
}
@media (max-width: 1100px) {
  .alpha-game .top .brand small { display: none; }
  .alpha-game .top-inner { gap: 6px 13px; }
  .top .heading h1 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .top .heading .region { white-space: nowrap; }
  .top #city-switch summary > span:not(.icon) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .top #city-switch summary { padding-inline: 4px; }
  .top .force-picker summary { white-space: nowrap; }
}
@media (min-width: 701px) and (max-width: 1100px) {
  .alpha-game .top-inner { grid-template-columns: auto minmax(0, 1fr) minmax(285px, 41%); }
  .top .heading { gap: 5px; }
  .top .heading h1 { font-size: 27px; }
}
@media (max-width: 700px) {
  .alpha-game .top-inner { position: relative; grid-template-columns: auto minmax(0, 1fr); padding-block: 5px; gap: 3px 8px; }
  .alpha-game .top .heading { flex-direction: row; gap: 6px; align-items: center; }
  .alpha-game .storage-panel { grid-column: 1/-1; }
  .alpha-game .top .brand .crest { width: 23px; height: 29px; }
  .alpha-game .top .brand { font-size: 19px; gap: 4px; }
  .top .heading h1 { font-size: 23px; }
  .top .heading .region { font-size: 9px; }
  .top #city-switch { position: static; }
  .top #city-switch .picker-options { inset-inline: 0 auto; inset-block-start: 39px; }
  .top .force-picker .icon { width: 13px; height: 13px; }
  .alpha-game #queues { grid-template-columns: repeat(auto-fit, minmax(min(128px, 100%), 1fr)); }
  .alpha-game .queue { padding: 2px 4px; min-height: 26px; gap: 4px; }
  .alpha-game .queue > div { display: block; }
  .alpha-game .queue strong { font-size: 11px; }
  .alpha-game .queue small { display: none; }
  .alpha-game .queue > .icon { width: 14px; height: 14px; }
  .alpha-game .queue time { font-size: 11px; }
  .alpha-game main > .tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 6px; margin-bottom: 9px; }
  .alpha-game .tabs button { min-height: 34px; }
  .alpha-game .has-list .city-scene { height: clamp(135px, 40vw, 235px); }
  .alpha-game .building-list { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); }
  .alpha-game .atlas-toolbar { min-height: 41px; }
  .alpha-game[data-drawer] .board > #detail {
    display: block;
    position: fixed;
    z-index: 7;
    inset: auto max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
    width: auto;
    max-height: 46dvh;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 0 12px calc(12px + env(safe-area-inset-bottom));
    border: 2px solid #94704a;
    box-shadow: 0 -6px 24px #0f271c80;
  }
  .alpha-game[data-drawer] .drawer-bar {
    display: flex;
    position: sticky;
    z-index: 2;
    top: 0;
    justify-content: flex-end;
    padding: 4px 0;
    background: #f1e1c1;
    border-bottom: 1px solid #b99a6c;
  }
  .alpha-game[data-drawer] .drawer-bar button { min-height: 32px; padding: 2px 8px; }
  .alpha-game[data-drawer] main { padding-bottom: 46dvh; }
}
@media (max-width: 359px) {
  .alpha-game .top .brand > div { display: none; }
  .alpha-game .building-list { grid-template-columns: 1fr; }
}
