:root {
  color-scheme: dark;
  --bg: #07120f;
  --panel: #101b17;
  --panel-strong: #16241f;
  --glass: rgba(13, 27, 22, 0.78);
  --line: rgba(196, 230, 207, 0.16);
  --line-bright: rgba(109, 239, 163, 0.42);
  --text: #edf8ef;
  --muted: #9bb4a4;
  --green: #35c982;
  --green-2: #9ee85f;
  --amber: #f0bd4a;
  --blue: #5fb4f2;
  --red: #dc695e;
  --soil: #6d5035;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 24% 12%, rgba(53, 201, 130, 0.18), transparent 26rem),
    linear-gradient(135deg, #07120f 0%, #0f1c17 48%, #122018 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    filter 0.12s ease,
    border-color 0.12s ease,
    background-color 0.12s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.app-shell {
  min-height: 100vh;
}

.splash {
  position: relative;
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.35fr) minmax(350px, 440px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(7, 18, 15, 0.25), rgba(7, 18, 15, 0.94)),
    linear-gradient(145deg, #0a1814, #193124);
}

.splash-map {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 40px;
}

.map-card {
  position: relative;
  width: min(720px, 92vw);
  aspect-ratio: 1.26;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(101, 255, 163, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(101, 255, 163, 0.07) 1px, transparent 1px),
    radial-gradient(circle at 55% 40%, rgba(53, 201, 130, 0.28), transparent 16rem),
    #0b1713;
  background-size: 34px 34px, 34px 34px, auto, auto;
  box-shadow: 0 42px 120px rgba(0, 0, 0, 0.42);
}

.splash-leaflet-map {
  position: absolute;
  inset: 0;
}

.splash-leaflet-map::after {
  position: absolute;
  inset: 0;
  z-index: 500;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 18, 15, 0.08), rgba(7, 18, 15, 0.32)),
    linear-gradient(rgba(101, 255, 163, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(101, 255, 163, 0.07) 1px, transparent 1px);
  background-size: auto, 34px 34px, 34px 34px;
}

.scanline {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(158, 232, 95, 0.16), transparent);
  animation: scan 6s linear infinite;
}

.ukraine-shape {
  position: absolute;
  inset: 13% 8% 12%;
  border: 2px solid rgba(158, 232, 95, 0.55);
  clip-path: polygon(8% 42%, 17% 31%, 29% 32%, 36% 20%, 52% 17%, 62% 25%, 78% 21%, 88% 32%, 82% 48%, 93% 61%, 75% 72%, 62% 68%, 53% 82%, 39% 72%, 24% 78%, 17% 65%, 6% 58%);
  background:
    linear-gradient(120deg, rgba(53, 201, 130, 0.22), rgba(95, 180, 242, 0.12)),
    repeating-linear-gradient(30deg, rgba(237, 248, 239, 0.08) 0 7px, transparent 7px 21px);
}

.map-label {
  position: absolute;
  z-index: 2;
  padding: 3px 7px;
  border: 1px solid rgba(237, 248, 239, 0.22);
  border-radius: 999px;
  background: rgba(7, 18, 15, 0.72);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 850;
}

.label-kyiv { left: 47%; top: 32%; }
.label-lviv { left: 18%; top: 43%; }
.label-odesa { left: 49%; top: 72%; }
.label-kharkiv { left: 71%; top: 37%; }

.node,
.route {
  position: absolute;
  display: block;
}

.node {
  width: 13px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 8px rgba(240, 189, 74, 0.16);
}

.node-a { left: 27%; top: 42%; }
.node-b { left: 47%; top: 33%; }
.node-c { left: 63%; top: 54%; }
.node-d { left: 39%; top: 66%; }

.route {
  height: 2px;
  transform-origin: left center;
  background: rgba(240, 189, 74, 0.68);
}

.route-a {
  left: 29%;
  top: 44%;
  width: 210px;
  transform: rotate(-11deg);
}

.route-b {
  left: 41%;
  top: 67%;
  width: 170px;
  transform: rotate(-31deg);
}

.hex-cloud {
  position: absolute;
  inset: 10% 7%;
  display: grid;
  grid-template-columns: repeat(5, 42px);
  gap: 8px 13px;
  align-content: end;
  justify-content: end;
}

.hex-cloud span {
  width: 42px;
  height: 48px;
  clip-path: polygon(50% 0, 94% 25%, 94% 75%, 50% 100%, 6% 75%, 6% 25%);
  background: rgba(53, 201, 130, 0.2);
  border: 1px solid rgba(158, 232, 95, 0.28);
}

.auth-panel {
  align-self: center;
  margin: 30px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 22, 18, 0.86);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green-2);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(3.1rem, 8vw, 6.6rem);
  line-height: 0.88;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3.1rem);
}

h2 {
  display: flex;
  align-items: center;
  gap: 12px;
}

.company-logo {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

h3 {
  margin-bottom: 12px;
}

.intro,
.muted-text {
  color: var(--muted);
  line-height: 1.55;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 22px 0 16px;
}

.auth-tab,
.primary-action,
.secondary-action,
.guest-action {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 10px 14px;
  color: var(--text);
  font-weight: 850;
}

.auth-tab:hover:not(:disabled),
.primary-action:hover:not(:disabled),
.secondary-action:hover:not(:disabled),
.guest-action:hover:not(:disabled),
.danger-action:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 0 0 3px rgba(53, 201, 130, 0.12);
}

.auth-tab:active:not(:disabled),
.primary-action:active:not(:disabled),
.secondary-action:active:not(:disabled),
.guest-action:active:not(:disabled),
.danger-action:active:not(:disabled),
button.is-pressed:not(:disabled) {
  transform: translateY(2px) scale(0.985);
  filter: brightness(0.92);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.34);
}

.auth-tab,
.secondary-action,
.guest-action {
  background: rgba(255, 255, 255, 0.05);
}

.auth-tab.is-active {
  background: rgba(53, 201, 130, 0.18);
  border-color: var(--line-bright);
}

.auth-form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 760;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.primary-action {
  border-color: rgba(53, 201, 130, 0.82);
  background: linear-gradient(135deg, var(--green), #21895d);
}

.danger-action {
  border: 1px solid rgba(220, 105, 94, 0.65);
  border-radius: 8px;
  background: rgba(220, 105, 94, 0.14);
  color: var(--text);
  font-weight: 850;
}

.guest-action {
  width: 100%;
  margin-top: 12px;
}

.status-line,
.game-message {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--amber);
  font-weight: 760;
}

.game {
  display: flex;
  height: 100vh;
  min-height: 720px;
  flex-direction: column;
  overflow: hidden;
  padding: 18px;
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  width: min(1440px, 100%);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.wallet {
  display: grid;
  gap: 2px;
  min-width: 150px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass);
}

.wallet span {
  color: var(--muted);
  font-size: 0.78rem;
}

.wallet strong {
  color: var(--amber);
  font-size: 1.1rem;
}

.game-grid {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(620px, 1fr) 300px;
  gap: 14px;
  width: min(1700px, 100%);
  max-width: none;
  margin: 0 auto;
}

.intel-panel,
.map-stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass);
}

.intel-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.control-panel {
  position: fixed;
  left: 24px;
  top: 92px;
  z-index: 2300;
  display: grid;
  align-content: start;
  gap: 16px;
  width: min(380px, calc(100vw - 48px));
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 22, 18, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.cell-details {
  margin: 0 0 14px;
}

.cell-details div,
.metric-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

dt,
.metric-list span {
  color: var(--muted);
}

dd {
  margin: 0;
  text-align: right;
  font-weight: 850;
}

.action-stack {
  display: grid;
  gap: 9px;
}

.action-stack button {
  display: grid;
  gap: 3px;
  justify-items: center;
  min-height: 48px;
  line-height: 1.15;
}

.action-stack button small {
  max-width: 100%;
  color: rgba(230, 241, 226, 0.68);
  font-size: 0.68rem;
  font-weight: 760;
  white-space: normal;
}

.map-stage {
  position: relative;
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.map-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 12px;
  aspect-ratio: 1;
  border-radius: 50%;
}

.legend .free { background: rgba(237, 248, 239, 0.23); }
.legend .owned { background: var(--green); }
.legend .rival { background: var(--red); }

.map-board {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  margin-top: 14px;
  overflow: hidden;
  background: #f7f8f4;
}

.selection-popup {
  position: absolute;
  left: 0;
  top: 152px;
  z-index: 1200;
  display: grid;
  gap: 7px;
  width: min(260px, calc(100% - 8px));
  max-height: calc(100% - 166px);
  overflow: auto;
  padding: 10px;
  border: 1px solid rgba(240, 189, 74, 0.78);
  border-radius: 8px;
  background: rgba(12, 28, 22, 0.94);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
}

.selection-popup > strong {
  color: var(--text);
  padding-right: 28px;
  font-size: 0.88rem;
  line-height: 1.25;
}

.panel-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.map-mode-actions {
  display: grid;
  gap: 8px;
}

.map-mode-actions button,
.selection-popup .action-stack button {
  min-height: 38px;
  padding: 7px 8px;
  font-size: 0.78rem;
}

.selection-popup .action-stack button small {
  font-size: 0.58rem;
}

.map-quick-actions {
  display: none;
}

.map-quick-actions-control {
  clear: none !important;
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-left: 6px !important;
  margin-top: 10px !important;
}

.map-quick-actions-control button {
  width: auto;
  min-height: 32px;
  padding: 5px 9px;
  border-color: rgba(24, 35, 29, 0.24);
  background: rgba(12, 28, 22, 0.94);
  font-size: 0.74rem;
  line-height: 1.1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}

.secondary-action.is-active {
  border-color: var(--amber);
  background: rgba(240, 189, 74, 0.2);
}

.return-news-button {
  position: absolute;
  left: 50%;
  top: 94px;
  z-index: 1250;
  transform: translateX(-50%);
  width: min(330px, calc(100% - 32px));
  min-height: 42px;
  border: 1px solid rgba(139, 211, 255, 0.82);
  border-radius: 8px;
  background: rgba(23, 71, 112, 0.94);
  color: var(--text);
  font-weight: 900;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
  cursor: pointer;
}

.map-board.is-cluster-mode {
  cursor: crosshair;
  touch-action: none;
}

.selection-box {
  position: absolute;
  z-index: 900;
  border: 2px solid #ffb000;
  border-radius: 4px;
  background: rgba(255, 176, 0, 0.16);
  box-shadow: 0 0 0 1px rgba(7, 18, 15, 0.35);
  pointer-events: none;
}

/* Local Leaflet layout fallback. Keeps tiles and overlay panes aligned even if CDN CSS is blocked. */
.leaflet-container {
  position: relative;
  overflow: hidden;
  outline: 0;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute !important;
  left: 0;
  top: 0;
}

.leaflet-pane {
  z-index: 400;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-shadow-pane {
  z-index: 500;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 650;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-countryMask-pane {
  z-index: 350 !important;
}

.leaflet-h3-pane {
  z-index: 430 !important;
}

.leaflet-label-pane {
  z-index: 650 !important;
}

.building-cell-icon {
  display: grid;
  place-items: center;
  width: 28px !important;
  height: 28px !important;
  border: 1px solid rgba(7, 18, 15, 0.32);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 2px 8px rgba(7, 18, 15, 0.28);
  font-size: 17px;
  line-height: 1;
}

.land-cell-icon {
  display: grid;
  place-items: center;
  width: 24px !important;
  height: 24px !important;
  border: 1px solid rgba(20, 87, 52, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 1px 6px rgba(7, 18, 15, 0.18);
  font-size: 15px;
  line-height: 1;
}

.leaflet-map-pane canvas {
  z-index: 100;
}

.leaflet-map-pane svg {
  z-index: 200;
}

.leaflet-tile {
  width: 256px;
  height: 256px;
  user-select: none;
  -webkit-user-drag: none;
  max-width: none !important;
  max-height: none !important;
}

.leaflet-tile-loaded {
  visibility: inherit;
}

.leaflet-zoom-animated {
  transform-origin: 0 0;
}

.leaflet-interactive {
  cursor: pointer;
}

.leaflet-control {
  position: relative;
  z-index: 800;
  pointer-events: auto;
}

.leaflet-top,
.leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-top {
  top: 0;
}

.leaflet-right {
  right: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;
}

.leaflet-control {
  float: left;
  clear: both;
}

.leaflet-right .leaflet-control {
  float: right;
}

.leaflet-top .leaflet-control {
  margin-top: 10px;
}

.leaflet-left .leaflet-control {
  margin-left: 10px;
}

.leaflet-right .leaflet-control {
  margin-right: 10px;
}

.leaflet-bottom .leaflet-control {
  margin-bottom: 10px;
}

.leaflet-control-zoom {
  border: 1px solid rgba(24, 35, 29, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

.leaflet-control-zoom a {
  display: block;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  text-decoration: none;
}

.leaflet-control-attribution {
  padding: 2px 6px;
  font-size: 11px;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  background: #f7f8f4;
  color: #18231d;
  font: inherit;
}

.leaflet-tile {
  filter: saturate(1.02) contrast(1.02);
}

.leaflet-control-zoom a {
  border-color: rgba(24, 35, 29, 0.2);
  background: rgba(255, 255, 255, 0.94);
  color: #18231d;
  font-weight: 900;
}

.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.84);
  color: #405549;
}

.leaflet-tooltip {
  border: 1px solid rgba(24, 35, 29, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: #18231d;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  font-weight: 800;
}

.leaflet-tooltip.cell-tooltip {
  min-width: 190px;
  max-width: 260px;
  padding: 10px 12px;
  border: 1px solid rgba(17, 17, 17, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: #17251d;
  line-height: 1.25;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
}

.cell-tooltip strong,
.cell-tooltip span,
.cell-tooltip em {
  display: block;
}

.cell-tooltip strong {
  margin-bottom: 5px;
  color: #07120f;
  font-size: 0.95rem;
  font-weight: 950;
}

.cell-tooltip span {
  margin-bottom: 7px;
  color: #365346;
  font-size: 0.82rem;
  font-weight: 850;
}

.cell-tooltip em {
  color: #1c3328;
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 800;
}

.h3-cell {
  cursor: pointer;
  transition: fill-opacity 0.15s ease, stroke-width 0.15s ease;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
  pointer-events: auto;
}

.h3-cell.is-selected {
  filter: drop-shadow(0 0 6px rgba(240, 189, 74, 0.85));
}

.h3-cell.free {
  stroke: #111 !important;
  stroke-opacity: 0.88;
}

.h3-cell.owned {
  stroke: #0b442c !important;
  stroke-opacity: 0.95;
}

.h3-cell.rival {
  stroke: #5d211b !important;
  stroke-opacity: 0.95;
}

.h3-cell.is-selected {
  stroke: #ffb000 !important;
  stroke-opacity: 1;
}

.h3-aggregate {
  cursor: zoom-in;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.settlement-label {
  width: auto !important;
  height: auto !important;
  color: #202820;
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
  text-shadow:
    -1px -1px 0 rgba(255, 255, 255, 0.92),
    1px -1px 0 rgba(255, 255, 255, 0.92),
    -1px 1px 0 rgba(255, 255, 255, 0.92),
    1px 1px 0 rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  pointer-events: none;
}

.settlement-z10,
.settlement-z11 {
  font-size: 0.68rem;
  font-weight: 800;
  color: #344a3c;
}

.stage-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.stage-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--amber));
}

.leaderboard {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.leaderboard li.is-player {
  color: var(--text);
}

.building-cell-icon.is-rival,
.land-cell-icon.is-rival {
  border-color: rgba(239, 118, 105, 0.86);
  background: rgba(239, 118, 105, 0.24);
  box-shadow: 0 0 0 2px rgba(239, 118, 105, 0.22), 0 8px 18px rgba(44, 15, 11, 0.22);
}

.news-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.news-item {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.news-item[data-news-cell] {
  cursor: pointer;
}

.news-item[data-news-cell]:hover strong {
  text-decoration: underline;
}

.news-item strong {
  color: var(--text);
  font-size: 0.92rem;
}

.news-item p {
  margin: 0;
}

.news-item time {
  color: rgba(184, 213, 201, 0.62);
  font-size: 0.74rem;
}

.news-hot strong,
.news-leader strong {
  color: var(--amber);
}

.news-market strong {
  color: #9ee85f;
}

.news-build strong {
  color: #8bd3ff;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.54);
}

.modal-panel {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(620px, 94vw);
  max-height: min(820px, 92vh);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1b16;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.46);
}

.asset-panel {
  width: min(760px, 94vw);
}

.asset-options {
  display: none;
}

.asset-carousel-card {
  display: grid;
  gap: 12px;
}

.asset-carousel-title {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.asset-carousel-title strong {
  color: var(--text);
  font-size: clamp(1.7rem, 5vw, 3.1rem);
}

.asset-nav {
  display: grid;
  place-items: center;
  width: 38px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.75rem;
  line-height: 1;
}

.asset-nav-kind {
  background: #f3e84f;
  color: #1c2116;
}

.asset-nav-photo {
  background: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.asset-nav:disabled {
  opacity: 0.25;
  cursor: default;
}

.asset-carousel-media {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
}

.asset-image-frame {
  display: grid;
  place-items: center;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  font-size: 7rem;
}

.asset-image-frame img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.asset-characteristics,
.asset-total-main {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
}

.asset-characteristics div,
.asset-total-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
}

.logo-preview {
  display: grid;
  place-items: center;
  min-height: 88px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.logo-preview img {
  max-width: 120px;
  max-height: 80px;
  object-fit: contain;
}

.profile-stats,
.admin-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.profile-stats div,
.admin-summary div {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.profile-stats span,
.admin-summary span {
  color: var(--muted);
  font-size: 0.76rem;
}

.profile-stats strong,
.admin-summary strong {
  color: var(--text);
  font-size: 0.92rem;
}

.inline-owner-button {
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 900;
  text-align: right;
  cursor: pointer;
}

.inline-owner-button:hover {
  color: var(--amber);
  text-decoration: underline;
}

.owner-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.owner-card h3,
.owner-card p {
  margin: 0;
}

.owner-card p {
  color: var(--muted);
}

.owner-logo {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 2px solid var(--green);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  font-size: 2rem;
  font-weight: 900;
}

.owner-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.help-panel p {
  margin-bottom: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.admin-panel {
  width: min(1120px, 96vw);
}

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-tabs .is-active {
  border-color: rgba(53, 201, 130, 0.6);
  background: rgba(53, 201, 130, 0.22);
}

.admin-tab-panel {
  display: grid;
  gap: 12px;
}

.admin-users {
  display: grid;
  gap: 12px;
}

.admin-global-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-settings {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.admin-rivals-note {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(240, 189, 74, 0.08);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.admin-settings h4,
.admin-player-stats h4 {
  margin: 0;
  color: var(--text);
}

.admin-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.admin-settings-grid label {
  font-size: 0.76rem;
}

.admin-settings-grid textarea {
  min-height: 96px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.75rem;
}

.wide-field {
  grid-column: 1 / -1;
}

.settings-section {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.settings-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-section-head h5 {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
}

.settings-section-head button {
  width: auto;
  min-height: 36px;
}

.settings-section-save {
  justify-self: end;
  width: min(260px, 100%);
}

.settings-list {
  display: grid;
  gap: 10px;
}

.settings-card {
  display: grid;
  grid-template-columns: 70px repeat(3, minmax(120px, 1fr)) auto auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.settings-card label {
  min-width: 0;
}

.settings-card .wide-field {
  grid-column: span 2;
}

.settings-card button {
  width: auto;
}

.compact-list .settings-card,
.settings-card.compact-card {
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
}

.settings-card.stage-card {
  grid-template-columns: minmax(160px, 1fr) 120px minmax(220px, 2fr) auto;
}

.icon-preview {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  font-size: 1.6rem;
}

.icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.asset-photo-list,
.asset-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.asset-photo-button {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.asset-photo-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-user {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) repeat(5, minmax(90px, 1fr)) minmax(130px, 0.8fr);
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-user-title {
  display: grid;
  gap: 4px;
}

.admin-user-title span,
.admin-user-stats {
  color: var(--muted);
  font-size: 0.76rem;
}

.admin-user label {
  font-size: 0.78rem;
}

.admin-user-stats {
  grid-column: 1 / -2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding-top: 4px;
}

.admin-inventory-editor {
  grid-column: 1 / -2;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.admin-inventory-editor > strong {
  color: var(--text);
  font-size: 0.84rem;
}

.admin-inventory-editor > div {
  display: grid;
  gap: 6px;
}

.admin-inventory-editor > div > span {
  color: var(--muted);
  font-size: 0.76rem;
}

.admin-inventory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.admin-inventory-grid label {
  display: grid;
  grid-template-columns: auto 1fr 72px;
  gap: 6px;
  align-items: center;
}

.admin-inventory-grid .icon-preview,
.admin-inventory-grid .asset-icon {
  width: 28px;
  height: 28px;
  font-size: 1rem;
}

.admin-user-actions {
  display: grid;
  gap: 6px;
}

.admin-user-actions button {
  min-width: 0;
  white-space: normal;
}

.asset-options {
  display: grid;
  gap: 8px;
}

.asset-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.asset-option input {
  display: none;
}

.asset-option:has(input:checked) {
  border-color: rgba(53, 201, 130, 0.75);
  background: rgba(53, 201, 130, 0.12);
}

.asset-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.5rem;
  overflow: hidden;
}

.asset-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.asset-option small,
.asset-total span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.asset-total {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.asset-total-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.image-preview-panel {
  display: grid;
  gap: 12px;
  width: min(920px, 96vw);
  padding: 16px;
}

.image-preview-panel img {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  margin: 0 auto;
  border-radius: 8px;
  object-fit: contain;
}

.image-preview-toolbar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 12px;
}

.image-preview-toolbar span {
  color: var(--text);
  font-weight: 850;
  text-align: center;
}

.image-preview-toolbar button {
  width: 48px;
  min-height: 40px;
  padding: 0;
  font-size: 1.4rem;
}

.admin-player-stats {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.ledger-list {
  display: grid;
  max-height: 320px;
  gap: 8px;
  overflow: auto;
}

.ledger-list div {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ledger-list span {
  color: var(--muted);
  font-size: 0.78rem;
}

.ledger-list.compact {
  max-height: 220px;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.is-hidden {
  display: none !important;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(240, 189, 74, 0.42);
  outline-offset: 2px;
}

@keyframes scan {
  from { transform: translateY(-100%); }
  to { transform: translateY(100%); }
}

@media (max-width: 1180px) {
  .game {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .intel-panel {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 860px) {
  .splash,
  .game-grid {
    grid-template-columns: 1fr;
  }

  .splash-map {
    min-height: 46vh;
    padding: 18px;
  }

  .auth-panel {
    align-self: start;
    margin: -18px 14px 24px;
  }

  .topbar,
  .map-toolbar,
  .intel-panel {
    display: grid;
    grid-template-columns: 1fr;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .top-actions .wallet {
    grid-column: 1 / -1;
  }

  .map-stage {
    min-height: auto;
  }

  .map-board {
    width: 100%;
    height: min(66vh, 620px);
    min-height: 430px;
    flex: none;
  }

  .selection-popup {
    left: 0;
    top: 138px;
    width: min(180px, calc(100% - 8px));
    max-height: calc(100% - 150px);
  }

  .map-quick-actions-control {
    max-width: calc(100% - 64px);
    margin-left: 6px !important;
    margin-top: 10px !important;
  }

  .map-quick-actions-control button {
    min-height: 31px;
    padding-inline: 7px;
    font-size: 0.68rem;
  }

  .control-panel {
    inset: 14px;
    width: auto;
    max-height: calc(100vh - 28px);
  }
}

@media (max-width: 560px) {
  .game {
    padding: 12px;
  }

  .map-board {
    height: 62vh;
    min-height: 390px;
  }

  .auth-panel {
    padding: 22px;
  }
}
