/* Full-screen 4X game presentation. The map is the primary surface. */
:root {
  --ink: #f6ecd7;
  --muted: #b7c4c6;
  --gold: #e8c786;
  --panel: #23343d;
  --line: #aab8b535;
  color-scheme: dark;
}
body {
  background: #172730;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
}
body.playing {
  overflow-x: hidden;
}
.playing header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-width: none;
  z-index: 10;
  height: calc(65px + env(safe-area-inset-top));
  padding: calc(6px + env(safe-area-inset-top)) 12px 6px;
  background: linear-gradient(#152730f5, #152730cc);
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  border-bottom: 1px solid #e4c58144;
}
.playing .brand > span:last-child {
  display: none;
}
.playing .crest {
  display: grid;
  place-items: center;
  width: 44px;
  height: 46px;
  padding: 0;
  background: linear-gradient(140deg, #d2b876, #827140);
  color: #152832;
  border: 2px solid #efdcb2;
  border-radius: 9px 9px 18px 18px;
  box-shadow: 0 3px 8px #0005;
}
.playing .power {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 2px 12px;
}
.playing .power span {
  font-size: 8px;
  letter-spacing: 0.13em;
}
.playing .power strong {
  font-size: 26px;
  line-height: 1.1;
  text-shadow: 0 2px 4px #0008;
}
.playing .account {
  font-size: 10px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0;
}
.playing .account button {
  font-size: 10px;
  min-height: 25px;
  padding: 1px 8px;
  background: #2b4148;
}
.playing .resourcebar {
  position: fixed;
  top: calc(65px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  z-index: 10;
  height: 34px;
  padding: 3px 12px;
  gap: 20px;
  background: #20343ce8;
  border-bottom: 1px solid #d6cfb63a;
  box-shadow: 0 4px 12px #0002;
}
.playing .resourcebar span {
  gap: 6px;
}
.playing .resourcebar b {
  font-size: 13px;
}
.playing .resourcebar small {
  display: none;
}
#connection {
  font-size: 8px;
  letter-spacing: 0.03em;
}
#game {
  max-width: none;
  padding: calc(113px + env(safe-area-inset-top)) 12px
    calc(92px + env(safe-area-inset-bottom));
  margin: 0;
}
.on-map #game {
  padding: 0;
}
.on-map .workspace,
.on-map .panel-open .workspace {
  display: block;
}
.on-map .scene-shell {
  border: 0;
  border-radius: 0;
  background: none;
  overflow: visible;
}
.on-map .scene-heading,
.on-map .scene-caption,
.on-map #sceneChoices {
  display: none !important;
}
.map-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: #788b6e;
  outline: none;
}
.map-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.map-objects {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.map-hit {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  opacity: 0;
  background: none !important;
  border: 0 !important;
  border-radius: 0;
  padding: 0;
  min-height: 0;
  outline: none !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.map-hit:focus-visible {
  opacity: 1;
  background: #e8c78612 !important;
  outline: 2px solid #ffdf95 !important;
  outline-offset: -6px;
  border-radius: 50%;
}
.location-badge {
  position: absolute;
  left: 14px;
  top: calc(113px + env(safe-area-inset-top));
  pointer-events: none;
  filter: drop-shadow(0 1px 4px #0009);
}
.location-badge span {
  display: block;
  color: #f5deb0;
  font-size: 9px;
  letter-spacing: 0.16em;
}
.location-badge b {
  font-size: 18px;
  font-weight: 650;
  color: #fff8e7;
  text-shadow: 0 2px 6px #15251d;
}
.map-tools {
  position: absolute;
  right: 12px;
  top: calc(118px + env(safe-area-inset-top));
  display: grid;
  gap: 8px;
}
.map-tools button {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 10px;
  border-radius: 11px;
  background: linear-gradient(145deg, #40545de8, #233640ed);
  border: 1px solid #e3d3aa96;
  box-shadow: 0 2px 7px #0004;
  color: #f3db9f;
}
.map-tools svg,
.bottom-nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.on-map #game #scene .map-tools svg {
  width: 22px;
  height: 22px;
  min-height: 0;
  display: block;
}
.map-tools button[aria-pressed="true"] {
  background: #657b648f;
  border-color: #e7d29a;
}
.map-readout {
  position: absolute;
  bottom: calc(86px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 3px;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}
.coordinate-readout {
  color: #fff3d7;
  font-size: 11px;
  letter-spacing: 0.08em;
  background: #1c303ad9;
  border: 1px solid #e0d4af66;
  border-radius: 20px;
  padding: 5px 14px;
  box-shadow: 0 2px 8px #0003;
}
.map-help {
  font-size: 10px;
  color: #fff9e6;
  text-shadow: 0 1px 3px #000;
}
.bottom-nav {
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  z-index: 10;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  min-height: 74px;
  background: linear-gradient(#334650, #172b35);
  border-top: 2px solid #a4936799;
  box-shadow: 0 -5px 20px #14242f55;
  backdrop-filter: blur(10px);
}
.bottom-nav button {
  gap: 4px;
  padding: 6px 3px;
  min-height: 56px;
  font-size: 10px;
  color: #e3e0d2;
  text-shadow: 0 1px 2px #0008;
}
.bottom-nav svg {
  width: 26px;
  height: 26px;
  color: #e9d39d;
  filter: drop-shadow(0 2px 2px #0008);
}
#mapToggle {
  border: 1px solid #ffe4a26b;
  border-radius: 10px;
  background: linear-gradient(#637c7b, #314d56);
  color: #fff2c4;
}
.bottom-nav button[aria-pressed="true"] {
  color: #ffe4a2;
  background: #edce8d14;
  border-radius: 10px;
}
#panelWrap {
  position: relative;
  z-index: 9;
}
.on-map #panelWrap {
  position: fixed;
  left: auto;
  right: 16px;
  bottom: calc(89px + env(safe-area-inset-bottom));
  width: 350px;
  max-height: min(65svh, 620px);
  overflow: auto;
  overscroll-behavior: contain;
  background: #243740;
  border: 1px solid #e8d4a081;
  border-radius: 17px;
  box-shadow: 0 8px 40px #0007;
  animation: drawer-rise 0.2s ease-out;
}
#panelWrap aside {
  padding: 20px;
  border: 0;
  background: linear-gradient(135deg, #304650, #1b2f39);
  border-radius: 15px;
}
#closePanel {
  position: sticky;
  float: right;
  top: 8px;
  margin: 8px 8px -48px 0;
  width: 38px;
  min-height: 38px;
  padding: 6px;
  background: #41555d;
  border: 1px solid #b5b8a64a;
  z-index: 2;
}
#panelWrap h2 {
  font-size: 22px;
  padding-right: 35px;
}
#panelWrap .eyebrow {
  font-size: 9px;
  display: block;
  padding-right: 32px;
}
#panelWrap .muted {
  font-size: 12px;
  line-height: 1.5;
}
.metric-grid {
  margin: 12px 0;
}
.metric {
  background: #13273166;
  border-color: #b7c5bb30;
  padding: 9px 12px;
}
.metric b {
  font-size: 23px;
}
.row {
  padding: 9px 0;
  font-size: 12px;
}
.card {
  background: #13273166;
}
.primary {
  background: linear-gradient(#edce8e, #bfa367) !important;
  border-color: #f6d994 !important;
  color: #273036 !important;
  box-shadow: 0 2px 0 #806b45;
  font-weight: 700;
}
.status {
  color: #c9ddbe;
  background: #638e6333;
  border-color: #c1d6a947;
}
.full {
  min-height: 44px;
}
.operation-choice {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  gap: 10px;
  margin: 10px 0;
  padding: 15px;
  background: #1b303b;
  border: 1px solid #bfb88b66;
}
.operation-choice small {
  display: block;
  color: #bac9c9;
  font-size: 11px;
  margin-top: 4px;
}
.operation-choice b {
  font-size: 26px;
  color: var(--gold);
}
#toast {
  bottom: calc(90px + env(safe-area-inset-bottom));
  background: #e6cc94;
  z-index: 30;
}
dialog {
  background: #263c46;
  border-color: #d9c38b;
  z-index: 40;
}
.scene-shell {
  background: #273d46;
}
.scene-heading {
  background: linear-gradient(#213741, transparent);
}
.scene-caption {
  background: #243944;
}
.list-content {
  padding-top: 105px;
  min-height: 200px;
}
.map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1d303beb;
  padding: 12px 20px;
  border-radius: 12px;
  color: #f2deb6;
  font-size: 13px;
}
@keyframes drawer-rise {
  from {
    opacity: 0.5;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (max-width: 680px) {
  .on-map #panelWrap {
    left: 8px;
    right: 8px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 51svh;
    border-radius: 18px;
  }
  .playing header {
    padding-left: 10px;
    padding-right: 10px;
  }
  .playing .account {
    font-size: 9px;
  }
  .location-badge b {
    font-size: 17px;
  }
  .map-tools {
    right: 9px;
  }
  .map-tools button {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 9px;
  }
  #panelWrap aside {
    padding: 19px;
  }
  #game:not([data-view="base"]):not([data-view="world"]) .workspace {
    display: block;
  }
  .scene-shell {
    border-radius: 12px;
  }
  input {
    font-size: 16px;
  }
  .auth {
    margin-top: 24px;
  }
  .map-help {
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #panelWrap {
    animation: none !important;
  }
  * {
    transition: none !important;
  }
}
