:root {
  --bg-obsidian: #0c0e14;
  --bg-panel: rgba(16, 20, 30, 0.92);
  --bg-panel-solid: #121722;
  --bg-card: rgba(24, 30, 44, 0.88);
  --border-gold: rgba(212, 168, 83, 0.42);
  --border-gold-strong: rgba(240, 198, 108, 0.82);
  --gold-light: #f6d786;
  --gold: #d4a853;
  --gold-deep: #9c7228;
  --crimson: #c43c3c;
  --crimson-bright: #e95959;
  --emerald: #38b57d;
  --azure: #4da3ff;
  --text-main: #f2ece1;
  --text-muted: #a9a295;
  --shadow-deep: 0 14px 40px rgba(0, 0, 0, 0.65);
  --font-display: 'Cinzel', 'Noto Sans TC', serif;
  --font-sans: 'Noto Sans TC', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-obsidian);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease, border-color 0.14s ease, background 0.14s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.btn-gold {
  background: linear-gradient(180deg, #e5be6a 0%, #b5832c 100%);
  color: #161006;
  border-color: #f6dc9b;
  box-shadow: 0 4px 16px rgba(212, 168, 83, 0.28);
}
.btn-gold-outline {
  background: rgba(212, 168, 83, 0.14);
  color: var(--gold-light);
  border-color: var(--border-gold-strong);
}
.btn-crimson {
  background: linear-gradient(180deg, #d84b4b 0%, #992525 100%);
  color: #fff;
  border-color: #f48787;
}
.btn-emerald {
  background: linear-gradient(180deg, #3ec488 0%, #24885a 100%);
  color: #061b11;
  border-color: #7ee3b4;
}
.btn-dark {
  background: rgba(25, 32, 48, 0.92);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.14);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.14);
}
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 9px; font-size: 12px; border-radius: 6px; }

.link-btn {
  background: none;
  border: none;
  color: var(--gold-light);
  font-size: 12px;
  cursor: pointer;
  font-weight: 700;
}
.link-btn:hover { text-decoration: underline; }

.icon-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-close:hover { background: rgba(212, 168, 83, 0.25); color: var(--gold-light); }

/* ===== AUTH SCREEN ===== */
.auth-screen {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, rgba(10, 12, 20, 0.52) 0%, rgba(10, 13, 22, 0.86) 62%, rgba(8, 10, 16, 0.94) 100%),
    url('/assets/images/login-keyart.jpg') center/cover no-repeat;
  z-index: 0;
}

.auth-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1040px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 44px;
  align-items: center;
}

.auth-hero {
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.85);
}
.royal-crest {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: radial-gradient(circle at 35% 30%, #f5d887, #9c6e22);
  border: 2px solid #fbe6ad;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 8px 28px rgba(212, 168, 83, 0.4);
  margin-bottom: 16px;
}
.auth-eyebrow {
  font-family: var(--font-display);
  letter-spacing: 3px;
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.auth-title {
  font-family: var(--font-display);
  font-size: 42px;
  line-height: 1.18;
  font-weight: 800;
  background: linear-gradient(180deg, #fff5d6 0%, #e4b65e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 14px;
}
.auth-subtitle {
  color: #ddd4c3;
  font-size: 15px;
  line-height: 1.7;
  max-width: 480px;
  margin-bottom: 24px;
}
.auth-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.highlight-pill {
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(15, 20, 32, 0.78);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-size: 13px;
  font-weight: 500;
}

.auth-card {
  background: rgba(14, 18, 28, 0.9);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  padding: 26px;
  box-shadow: var(--shadow-deep), 0 0 40px rgba(212, 168, 83, 0.1);
  backdrop-filter: blur(12px);
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: 10px;
}
.auth-tab {
  padding: 9px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.auth-tab.active {
  background: linear-gradient(180deg, rgba(212, 168, 83, 0.3), rgba(156, 114, 40, 0.25));
  color: var(--gold-light);
  border: 1px solid var(--border-gold);
}
.form-group {
  margin-bottom: 15px;
}
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--gold-light);
  margin-bottom: 6px;
  font-weight: 700;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 11, 18, 0.85);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 168, 83, 0.2);
}
.form-error {
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(196, 60, 60, 0.22);
  border: 1px solid rgba(233, 89, 89, 0.55);
  color: #ffb8b8;
  font-size: 13px;
}

/* ===== GAME SHELL ===== */
.game-shell {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-obsidian);
}

/* TOP HUD */
.top-hud {
  height: 62px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 16px;
  background: linear-gradient(180deg, #1b2131 0%, #101520 100%);
  border-bottom: 1px solid var(--border-gold);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

.hud-lord {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-width: 215px;
}
.lord-avatar {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: radial-gradient(circle at 35% 30%, #f7da8c, #996d22);
  border: 2px solid var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.lord-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 14px;
}
.alliance-tag {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(77, 163, 255, 0.2);
  border: 1px solid rgba(77, 163, 255, 0.5);
  color: #8cc5ff;
  font-size: 11px;
  font-weight: 800;
}
.lord-sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 12px;
}
.power-badge {
  color: var(--gold-light);
}
.coords-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #d0d7e8;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 11px;
  cursor: pointer;
}
.coords-btn:hover { border-color: var(--gold); color: var(--gold-light); }

.hud-resources {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
  min-width: 0;
}
.res-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 9px;
  background: rgba(7, 10, 16, 0.65);
  border: 1px solid rgba(212, 168, 83, 0.24);
  min-width: 106px;
}
.res-item.res-special {
  border-color: rgba(235, 114, 62, 0.45);
  background: rgba(45, 18, 12, 0.6);
}
.res-icon { font-size: 18px; }
.res-values {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.res-num {
  font-weight: 800;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.res-rate {
  font-size: 10px;
  color: #7ee3b4;
}
.res-special .res-rate { color: #ffba8c; }

.hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(56, 181, 125, 0.15);
  border: 1px solid rgba(56, 181, 125, 0.4);
  font-size: 12px;
  color: #a9f0cc;
}
.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38e58d;
  box-shadow: 0 0 8px #38e58d;
}

/* MAIN STAGE */
.main-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.stage-view {
  position: absolute;
  inset: 0;
  display: none;
}
.stage-view.active {
  display: block;
}

/* INNER CITY SCENE — 1B LOCKED 1600x900 PANORAMA + PAN/ZOOM (ZERO DRIFT!) */
.city-scene {
  position: relative;
  width: 100%;
  height: 100%;
  background: #090e14;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.city-scene:active {
  cursor: grabbing;
}
.city-pan-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1600px;
  height: 900px;
  transform-origin: 0 0;
  will-change: transform;
}
.city-panorama-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  user-select: none;
  pointer-events: none;
}
.city-buildings-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
}
.city-cam-controls {
  position: absolute;
  bottom: 14px;
  right: 78px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(11, 15, 24, 0.86);
  border: 1px solid var(--border-gold);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  z-index: 15;
}
.building-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}
.building-hotspot .hotspot-hover-ring {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(253, 224, 71, 0.22) 0%, rgba(253, 224, 71, 0.05) 55%, rgba(253, 224, 71, 0) 76%);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}
.building-hotspot:hover .hotspot-hover-ring,
.building-hotspot:focus-visible .hotspot-hover-ring {
  opacity: 1;
  transform: scale(1.04);
}
.building-hotspot.is-busy .hotspot-hover-ring {
  opacity: 0.9;
  background: radial-gradient(ellipse at center, rgba(74, 222, 128, 0.26) 0%, rgba(74, 222, 128, 0.06) 55%, rgba(74, 222, 128, 0) 78%);
  animation: pulseHotspot 1.8s ease-in-out infinite;
}
@keyframes pulseHotspot {
  0%, 100% { transform: scale(0.96); opacity: 0.65; }
  50% { transform: scale(1.06); opacity: 1; }
}
.building-hotspot.is-stronghold-slot {
  z-index: 44 !important;
}
.stronghold-plaza-shadow {
  position: absolute;
  bottom: 4%;
  left: 50%;
  transform: translateX(-50%);
  width: 82%;
  height: 32%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(10, 12, 16, 0.66) 0%, rgba(10, 12, 16, 0.3) 58%, rgba(10, 12, 16, 0) 100%);
  pointer-events: none;
}
.stronghold-evolving-sprite {
  position: relative;
  width: 102%;
  height: 126%;
  object-fit: contain;
  transform: translateY(-10%);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55));
  transition: transform 0.2s ease, filter 0.2s ease;
  pointer-events: none;
  user-select: none;
}
.building-hotspot.is-stronghold-slot:hover .stronghold-evolving-sprite {
  transform: translateY(-12%) scale(1.035);
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.65)) drop-shadow(0 0 18px rgba(253, 224, 71, 0.45));
}
.stronghold-morph-preview {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 12px;
  padding: 10px 14px;
  background: radial-gradient(ellipse at center, rgba(246, 215, 134, 0.08) 0%, rgba(16, 22, 34, 0.85) 75%);
  border-color: rgba(246, 215, 134, 0.32);
}
.smp-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.smp-item img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6));
  flex-shrink: 0;
}
.smp-item.next img {
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.65)) drop-shadow(0 0 14px rgba(253, 224, 71, 0.28));
}
.smp-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.smp-arrow {
  font-size: 22px;
  font-weight: 900;
  color: #fde39d;
  text-shadow: 0 0 10px rgba(253, 224, 71, 0.45);
}
.smp-max-tag {
  font-size: 13px;
  font-weight: 800;
  color: #fde39d;
}
.hotspot-label-stack {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -25%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  z-index: 6;
}
.building-hotspot:hover .building-plate {
  border-color: #fde39d;
  background: rgba(24, 18, 10, 0.96);
  transform: scale(1.06);
}
.building-hotspot .harvest-bubble {
  top: -4%;
  z-index: 12;
}

.building-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  z-index: 3;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.building-pin:hover {
  transform: translate(-50%, -54%) scale(1.06);
  z-index: 20 !important;
}
.building-pin.has-sprite .city-bldg-visual {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
.building-pin.has-sprite .city-bldg-shadow {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 82%;
  height: 28%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(4, 8, 12, 0.72) 0%, rgba(4, 8, 12, 0.36) 55%, rgba(4, 8, 12, 0) 100%);
  pointer-events: none;
}
.building-pin.has-sprite .city-bldg-sprite {
  position: relative;
  width: 118px;
  height: 118px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55));
  transition: filter 0.2s ease;
  user-select: none;
}
.building-pin.has-sprite.size-stronghold .city-bldg-sprite {
  width: 158px;
  height: 158px;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.65)) drop-shadow(0 0 16px rgba(246, 215, 134, 0.3));
}
.building-pin.has-sprite.size-major .city-bldg-sprite {
  width: 124px;
  height: 124px;
}
.building-pin.has-sprite.size-resource .city-bldg-sprite {
  width: 106px;
  height: 106px;
}
.building-pin.has-sprite:hover .city-bldg-sprite {
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.68)) drop-shadow(0 0 18px rgba(253, 224, 71, 0.55));
}
.building-pin.has-sprite.is-busy .city-bldg-sprite {
  animation: pulseSpriteBusy 1.8s ease-in-out infinite;
}
@keyframes pulseSpriteBusy {
  0%, 100% { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 10px rgba(74, 222, 128, 0.45)); }
  50% { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 22px rgba(246, 215, 134, 0.85)); }
}
.building-emblem {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(30, 37, 56, 0.94) 0%, rgba(14, 18, 28, 0.95) 100%);
  border: 2px solid var(--border-gold-strong);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 240, 196, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.building-plate {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: -10px;
  padding: 2px 9px 2px 4px;
  border-radius: 999px;
  background: rgba(10, 14, 22, 0.92);
  border: 1px solid var(--border-gold);
  font-size: 11.5px;
  font-weight: 700;
  color: #faf2e3;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
  position: relative;
  z-index: 2;
}
.building-plate .bp-lv {
  padding: 1px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f5d37e, #a87522);
  color: #161006;
  font-size: 10.5px;
  font-weight: 900;
}
.building-pin.is-stronghold .building-plate {
  border-color: #fde39d;
  background: rgba(24, 18, 10, 0.94);
  font-size: 12.5px;
}
.building-lv-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f3ce77, #a87522);
  color: #161006;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid #fff0c2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
.building-queue-pill {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(19, 64, 45, 0.95);
  border: 1px solid #4ee09c;
  color: #b7ffda;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* WORLD MAP VIEW */
.world-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  background: #0d1613;
}
.world-canvas:active { cursor: grabbing; }

.world-toolbar {
  position: absolute;
  top: 12px;
  left: calc(50% + 120px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-gold);
  box-shadow: var(--shadow-deep);
  z-index: 10;
  flex-wrap: nowrap;
}
.world-coord-jump {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--gold-light);
  font-weight: 700;
}
.world-coord-jump input {
  width: 48px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(6, 9, 14, 0.9);
  color: var(--text-main);
  text-align: center;
  font-size: 12px;
}
.zoom-controls {
  display: flex;
  gap: 4px;
}
.world-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  color: var(--text-muted);
}
.world-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-self { background: #f6d786; }
.dot-ally { background: #4da3ff; }
.dot-enemy { background: #e95959; }
.dot-monster { background: #c058ff; }
.dot-res { background: #38b57d; }

.world-target-card {
  position: absolute;
  right: 84px;
  bottom: 18px;
  width: 332px;
  padding: 16px;
  border-radius: 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-gold-strong);
  box-shadow: var(--shadow-deep);
  z-index: 16;
  backdrop-filter: blur(10px);
}
.target-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.target-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--gold-light);
}
.target-coords {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.target-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.stat-chip {
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}
.stat-chip strong {
  display: block;
  color: var(--gold-light);
  font-size: 13px;
  margin-top: 2px;
}

/* LEFT RAIL (QUEUES & QUESTS) */
.left-rail {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 248px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 11;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.game-shell.chat-drawer-open .left-rail {
  opacity: 0;
  transform: translateX(-12px);
  pointer-events: none;
}
.left-rail.collapsed .rail-body,
.left-rail.collapsed #quickQuestPanel {
  display: none;
}
.rail-toggle-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--gold-light);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 11px;
  cursor: pointer;
}
.rail-toggle-btn:hover { background: rgba(212, 168, 83, 0.2); }
.rail-card {
  pointer-events: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-deep);
  backdrop-filter: blur(8px);
}
.rail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(212, 168, 83, 0.12);
  border-bottom: 1px solid rgba(212, 168, 83, 0.2);
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-light);
}
.mini-badge {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #ddd;
  font-size: 11px;
}
.rail-body {
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 270px;
  overflow-y: auto;
}
.empty-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 0;
}

.queue-row {
  padding: 8px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.queue-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
}
.queue-timer {
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
}
.progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #d4a853, #5ee6a8);
  transition: width 0.5s linear;
}
.progress-fill.march-fill {
  background: linear-gradient(90deg, #ff7a59, #f6d786);
}
.queue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.quest-mini {
  padding: 8px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.quest-mini.ready {
  border-color: var(--border-gold-strong);
  background: rgba(212, 168, 83, 0.12);
}
.quest-mini-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 2px;
}
.quest-mini-desc {
  font-size: 11px;
  color: #ccc5b8;
  margin-bottom: 6px;
}

/* TOAST STACK */
.toast-stack {
  position: absolute;
  top: 64px;
  right: 16px;
  width: 310px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 240;
  pointer-events: none;
}
.toast-item {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(15, 20, 32, 0.95);
  border-left: 4px solid var(--gold);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-size: 13px;
  box-shadow: var(--shadow-deep);
  animation: slideIn 0.22s ease;
}
.toast-item.success { border-left-color: #38e58d; }
.toast-item.danger { border-left-color: #e95959; }
.toast-item.royal {
  border-left-color: #fde39d;
  background: linear-gradient(135deg, rgba(64, 44, 12, 0.96), rgba(20, 16, 28, 0.96));
  color: #fff2c6;
  font-weight: 700;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

/* BOTTOM BAR */
.bottom-bar {
  height: 68px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: linear-gradient(0deg, #0d1018 0%, #171e2d 100%);
  border-top: 1px solid var(--border-gold);
  z-index: 22;
}

/* CHAT WIDGET */
.chat-anchor {
  position: relative;
  width: 310px;
  flex-shrink: 0;
}
.chat-preview-btn {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(8, 11, 18, 0.88);
  border: 1px solid var(--border-gold);
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
}
.chat-preview-btn:hover { border-color: var(--border-gold-strong); }
.chat-pill-tag {
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(212, 168, 83, 0.2);
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.chat-last-text {
  font-size: 12px;
  color: #d6d0c4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-drawer {
  position: absolute;
  bottom: 54px;
  left: 0;
  width: 380px;
  height: 360px;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border-gold-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-deep);
  overflow: hidden;
  backdrop-filter: blur(12px);
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(212, 168, 83, 0.12);
  border-bottom: 1px solid rgba(212, 168, 83, 0.22);
}
.chat-tabs { display: flex; gap: 6px; }
.chat-tab {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.chat-tab.active {
  background: rgba(212, 168, 83, 0.24);
  border-color: var(--border-gold);
  color: var(--gold-light);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-msg {
  font-size: 13px;
  line-height: 1.45;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}
.chat-msg.sys {
  background: rgba(212, 168, 83, 0.14);
  border: 1px solid rgba(212, 168, 83, 0.3);
  color: #fce8b2;
}
.chat-sender {
  font-weight: 700;
  color: var(--gold-light);
  margin-right: 6px;
}
.chat-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 6px;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(7, 9, 15, 0.85);
}
.chat-input-row input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(18, 23, 35, 0.9);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}

/* ACTION DOCK */
.action-dock {
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-world-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  background: linear-gradient(180deg, #eec874 0%, #b17b24 100%);
  border: 2px solid #ffebb8;
  color: #1a1204;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(212, 168, 83, 0.42);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn-world-switch:hover { transform: translateY(-2px); filter: brightness(1.08); }
.switch-icon { font-size: 20px; }

.dock-buttons {
  display: flex;
  align-items: center;
  gap: 7px;
}
.dock-btn {
  position: relative;
  width: 64px;
  height: 50px;
  border-radius: 10px;
  background: rgba(24, 31, 46, 0.92);
  border: 1px solid rgba(212, 168, 83, 0.34);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.dock-btn:hover {
  transform: translateY(-2px);
  border-color: var(--border-gold-strong);
  background: rgba(38, 48, 70, 0.96);
}
.dock-icon { font-size: 18px; line-height: 1; }
.dock-text { font-size: 11px; font-weight: 700; color: #e2dac9; }
.dock-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e94848;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ffd4d4;
}
.dock-sub-num {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 9px;
  color: var(--gold-light);
  font-weight: 800;
}

/* ===== MODAL SYSTEM ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 11, 0.76);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}
.modal-box {
  width: 100%;
  max-width: 780px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #192030 0%, #10141f 100%);
  border: 1px solid var(--border-gold-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-deep), 0 0 50px rgba(212, 168, 83, 0.15);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(212, 168, 83, 0.12);
  border-bottom: 1px solid var(--border-gold);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--gold-light);
}
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* SHARED MODAL CARDS & GRIDS */
.panel-card {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.panel-card.gold-accent {
  border-color: var(--border-gold);
  background: rgba(212, 168, 83, 0.08);
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.cost-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  margin: 8px 0;
}
.cost-chip {
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.cost-chip.ok { color: #8ef2bd; border-color: rgba(56, 181, 125, 0.4); }
.cost-chip.lack { color: #ff9c9c; border-color: rgba(233, 89, 89, 0.5); }

/* DRAGON MODAL */
.dragon-hero {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 18px;
  align-items: center;
}
.dragon-portrait-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid var(--border-gold-strong);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 24px rgba(235, 114, 62, 0.25);
  aspect-ratio: 1 / 1;
}
.dragon-portrait-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dragon-stage-tag {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  text-align: center;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(10, 12, 18, 0.86);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
}
.xp-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin: 6px 0 10px;
}
.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #e0522b, #f6c95e);
}

/* TROOP & MARCH ROWS */
.counter-banner {
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(212, 168, 83, 0.12);
  border: 1px solid var(--border-gold);
  font-size: 13px;
  color: var(--gold-light);
  text-align: center;
}
.troop-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.troop-card.locked { opacity: 0.55; }
.troop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.troop-name { font-weight: 800; font-size: 14px; color: var(--gold-light); }
.troop-stats-line { font-size: 12px; color: var(--text-muted); }

.march-troop-row {
  display: grid;
  grid-template-columns: 150px 1fr 74px;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.march-troop-row input[type="range"] {
  accent-color: var(--gold);
  width: 100%;
}
.march-troop-row input[type="number"] {
  width: 72px;
  padding: 5px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(7, 10, 16, 0.9);
  color: var(--text-main);
  text-align: center;
}

/* TABLE STYLE */
.royal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.royal-table th, .royal-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.royal-table th {
  color: var(--gold-light);
  font-weight: 700;
  background: rgba(212, 168, 83, 0.08);
}

/* REPORTS */
.report-card {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.report-card.win { border-left: 4px solid #38e58d; }
.report-card.lose { border-left: 4px solid #e95959; }
.report-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.report-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.report-badge.win { background: rgba(56, 229, 141, 0.2); color: #7ff0b6; }
.report-badge.lose { background: rgba(233, 89, 89, 0.22); color: #ffabab; }

/* RESPONSIVE ADJUSTMENTS */
@media (max-width: 1160px) {
  .hud-resources .res-item { min-width: 84px; padding: 4px 8px; }
  .world-legend { display: none; }
  .chat-anchor { width: 220px; }
}
@media (max-width: 920px) {
  .auth-content { grid-template-columns: 1fr; max-width: 460px; }
  .auth-hero { text-align: center; }
  .royal-crest { margin-inline: auto; }
  .auth-highlights { justify-content: center; }
  .grid-2, .grid-3, .dragon-hero { grid-template-columns: 1fr; }
  .left-rail { width: 205px; }
}

/* ===== AUDIO CONTROLS & GAME ANIMATIONS / VFX ===== */
.fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}
#cityFxCanvas {
  z-index: 98;
}
@media (max-width: 980px), (max-height: 560px) {
  .building-pin.has-sprite.size-stronghold .city-bldg-sprite { width: 112px; height: 112px; }
  .building-pin.has-sprite.size-major .city-bldg-sprite { width: 88px; height: 88px; }
  .building-pin.has-sprite.size-resource .city-bldg-sprite { width: 78px; height: 78px; }
}

.auth-backdrop {
  animation: kenBurnsDrift 26s ease-in-out infinite alternate;
}
@keyframes kenBurnsDrift {
  0% { transform: scale(1) translate3d(0, 0, 0); }
  100% { transform: scale(1.07) translate3d(-1.2%, -0.8%, 0); }
}

.auth-audio-bar {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 5;
  display: flex;
  gap: 8px;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.audio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border-gold);
  background: rgba(212, 168, 83, 0.16);
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease, opacity 0.14s ease;
}
.audio-btn:hover {
  transform: translateY(-1px);
  background: rgba(212, 168, 83, 0.28);
}
.audio-btn.muted {
  opacity: 0.48;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

/* Smooth view & modal transitions */
.stage-view.active {
  animation: stageFadeIn 0.26s ease;
}
@keyframes stageFadeIn {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

.modal-box {
  animation: modalPopIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Inner city building hover & floating harvest bubbles */
.building-pin {
  z-index: 4;
}
.building-emblem::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 20px;
  border: 1px solid rgba(246, 215, 134, 0.24);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.building-pin:hover .building-emblem::after {
  opacity: 1;
  transform: scale(1.06);
}

.harvest-bubble {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(246, 215, 134, 0.96), rgba(196, 142, 42, 0.96));
  color: #1a1104;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid #fff2c6;
  box-shadow: 0 4px 14px rgba(246, 215, 134, 0.5);
  white-space: nowrap;
  cursor: pointer;
  z-index: 4;
  z-index: 12;
  animation: bubbleBob 2.1s ease-in-out infinite;
}
.harvest-bubble:hover {
  filter: brightness(1.12);
  transform: translateX(-50%) scale(1.1);
}
@keyframes bubbleBob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-6px); }
}

/* HUD counter pop animation */
.hud-pop {
  animation: hudPopGlow 0.45s ease;
}
@keyframes hudPopGlow {
  0% { transform: scale(1); color: #fff; }
  40% { transform: scale(1.16); color: #ffe599; text-shadow: 0 0 12px rgba(246, 215, 134, 0.9); }
  100% { transform: scale(1); }
}

/* Dragon roar & flame burst */
.dragon-roar-pulse {
  animation: dragonShakeGlow 0.65s ease;
}
@keyframes dragonShakeGlow {
  0% { transform: scale(1); box-shadow: 0 0 24px rgba(235, 114, 62, 0.3); }
  22% { transform: scale(1.05) rotate(-1.4deg); box-shadow: 0 0 48px rgba(255, 128, 42, 0.95); }
  48% { transform: scale(1.04) rotate(1.4deg); box-shadow: 0 0 56px rgba(255, 198, 72, 0.95); }
  75% { transform: scale(1.02) rotate(-0.6deg); }
  100% { transform: scale(1) rotate(0); }
}

.fx-dom-spark {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff4b8 0%, #ff8533 65%, transparent 100%);
  pointer-events: none;
  z-index: 255;
  animation: sparkFly 0.72s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes sparkFly {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2); }
}

/* Floating feedback text */
.fx-float-text {
  position: fixed;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 900;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  z-index: 250;
  white-space: nowrap;
  animation: floatUpFade 1.1s ease-out forwards;
}
@keyframes floatUpFade {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.85); }
  18% { opacity: 1; transform: translate(-50%, -65%) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -175%) scale(1); }
}

/* Cinematic Royal Crest Banner */
.cinematic-banner {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.86);
  min-width: 320px;
  max-width: 520px;
  padding: 16px 32px;
  border-radius: 16px;
  text-align: center;
  background: linear-gradient(135deg, rgba(28, 22, 12, 0.94), rgba(14, 18, 28, 0.95));
  border: 2px solid var(--border-gold-strong);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.8), 0 0 42px rgba(246, 215, 134, 0.35);
  pointer-events: none;
  opacity: 0;
  z-index: 230;
  transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.cinematic-banner.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.cinematic-banner.theme-victory {
  border-color: #5ee6a8;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.8), 0 0 44px rgba(74, 222, 128, 0.38);
}
.cinematic-banner.theme-defeat {
  border-color: #e95959;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.8), 0 0 38px rgba(233, 89, 89, 0.35);
}
.cinematic-banner.theme-dragon {
  border-color: #ff9c47;
  background: linear-gradient(135deg, rgba(56, 20, 10, 0.95), rgba(18, 14, 26, 0.96));
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.8), 0 0 48px rgba(255, 132, 48, 0.48);
}
.cb-icon {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 12px rgba(246, 215, 134, 0.65));
}
.cb-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #fff2c6;
  letter-spacing: 0.5px;
}
.cb-sub {
  margin-top: 4px;
  font-size: 13px;
  color: #dcd3c4;
}

/* ===== WORLD RADAR FINDER & REWARD PREVIEW ===== */
.world-radar-panel {
  position: absolute;
  top: 62px;
  left: calc(50% + 120px);
  transform: translateX(-50%);
  width: 380px;
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-gold-strong);
  box-shadow: var(--shadow-deep);
  backdrop-filter: blur(10px);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: modalPopIn 0.18s ease;
}
.radar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  color: var(--gold-light);
  font-size: 14px;
}
.radar-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.radar-tab {
  padding: 6px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.radar-tab.active {
  border-color: var(--border-gold-strong);
  background: rgba(212, 168, 83, 0.22);
  color: var(--gold-light);
}
.radar-body label {
  display: block;
  font-size: 11px;
  color: var(--gold-light);
  margin-bottom: 4px;
  font-weight: 700;
}
.radar-body select {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 12, 20, 0.94);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
}
.radar-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.reward-preview {
  padding: 9px 10px;
  border-radius: 9px;
  background: rgba(212, 168, 83, 0.08);
  border: 1px solid rgba(212, 168, 83, 0.25);
  margin-bottom: 11px;
}
.reward-preview-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold-light);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lucky-tag {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 146, 52, 0.22);
  border: 1px solid rgba(255, 166, 77, 0.6);
  color: #ffd399;
  font-size: 10px;
}
.reward-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.reward-pills span {
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: #e9e1d2;
}

/* ===== FLAGSHIP ROYAL BARRACKS SHOWCASE ===== */
.modal-box.modal-wide {
  max-width: 880px;
}

.barracks-summary-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.bs-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: #dcd4c6;
}

.barracks-queue-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border-radius: 11px;
  background: linear-gradient(90deg, rgba(22, 68, 48, 0.72), rgba(24, 34, 52, 0.85));
  border: 1px solid rgba(94, 230, 168, 0.55);
  box-shadow: 0 4px 20px rgba(56, 181, 125, 0.18);
}
.bq-info { flex: 1; min-width: 0; }
.bq-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #e9fff3;
}
.bq-timer {
  font-weight: 800;
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
}
.bq-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.barracks-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 16px;
  align-items: start;
}

.barracks-roster {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.branch-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.branch-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.14s ease;
}
.branch-tab:hover { border-color: var(--border-gold); transform: translateY(-1px); }
.branch-tab.active {
  border-color: var(--border-gold-strong);
  background: linear-gradient(180deg, rgba(212, 168, 83, 0.25), rgba(156, 114, 40, 0.16));
  color: var(--gold-light);
}
.bt-icon { font-size: 18px; line-height: 1; }
.bt-name { font-size: 12px; font-weight: 800; }
.bt-count { font-size: 10px; color: #cfc7b8; }

.tier-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tier-select-card {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.14s ease;
}
.tier-select-card:hover { border-color: var(--border-gold); }
.tier-select-card.active {
  border-color: var(--border-gold-strong);
  background: rgba(212, 168, 83, 0.14);
  box-shadow: 0 0 18px rgba(212, 168, 83, 0.18);
}
.tier-select-card.locked { opacity: 0.62; }
.tsc-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}
.tsc-name { font-size: 14px; color: var(--gold-light); flex: 1; }
.tsc-owned { font-size: 11px; color: #cfc7b8; white-space: nowrap; }
.tsc-sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.tier-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 900;
}
.tier-pill.t1 { background: rgba(148, 163, 184, 0.25); color: #e2e8f0; border: 1px solid rgba(203, 213, 225, 0.4); }
.tier-pill.t2 { background: rgba(59, 130, 246, 0.28); color: #93c5fd; border: 1px solid rgba(96, 165, 250, 0.6); }
.tier-pill.t3 { background: rgba(212, 168, 83, 0.32); color: #fde68a; border: 1px solid rgba(250, 204, 21, 0.75); }

.counter-mini-card {
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(212, 168, 83, 0.08);
  border: 1px solid rgba(212, 168, 83, 0.28);
  text-align: center;
}
.cmc-title { font-size: 11px; font-weight: 700; color: var(--gold-light); margin-bottom: 3px; }
.cmc-flow { font-size: 11px; color: #dcd4c6; }
.cmc-flow span { color: var(--gold); margin: 0 2px; }

.barracks-showcase {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.unit-hero-card {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 16px;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(28, 34, 52, 0.9), rgba(16, 20, 32, 0.94));
  border: 1px solid var(--border-gold);
}
.unit-portrait-frame {
  position: relative;
  border-radius: 11px;
  overflow: hidden;
  border: 2px solid var(--border-gold-strong);
  aspect-ratio: 1 / 1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.unit-portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.unit-portrait-tier {
  position: absolute;
  top: 7px;
  left: 7px;
}
.unit-portrait-owned {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  text-align: center;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(8, 11, 18, 0.86);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 800;
}

.uhd-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.uhd-title-row h3 {
  font-size: 18px;
  font-weight: 900;
  color: var(--gold-light);
}
.power-pill {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(212, 168, 83, 0.16);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.uhd-counters {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.tag-pro, .tag-con {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}
.tag-pro { background: rgba(56, 181, 125, 0.18); color: #8ff2c2; border: 1px solid rgba(56, 181, 125, 0.4); }
.tag-con { background: rgba(233, 89, 89, 0.18); color: #ffadad; border: 1px solid rgba(233, 89, 89, 0.4); }
.uhd-desc {
  font-size: 12px;
  color: #cfc7b8;
  line-height: 1.45;
  margin-bottom: 9px;
}

.unit-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}
.unit-stat-row {
  display: grid;
  grid-template-columns: 32px 1fr 24px;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.usr-label { color: var(--text-muted); }
.usr-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.usr-fill { height: 100%; border-radius: 999px; transition: width 0.25s ease; }
.usr-val { text-align: right; color: #f6efe2; font-variant-numeric: tabular-nums; }

.train-console {
  padding: 13px 15px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.11);
}
.locked-console {
  text-align: center;
  padding: 22px 16px;
}
.tc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--gold-light);
}
.tc-presets { display: flex; gap: 5px; }
.tc-slider-row {
  display: grid;
  grid-template-columns: 1fr 78px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.tc-slider-row input[type="range"] {
  accent-color: var(--gold);
  width: 100%;
}
.tc-slider-row input[type="number"] {
  width: 78px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 11, 18, 0.9);
  color: var(--text-main);
  text-align: center;
  font-weight: 700;
}
.tc-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.tc-est { font-size: 12px; color: #d6d0c4; }

.promote-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  border-radius: 11px;
  background: rgba(212, 168, 83, 0.08);
  border: 1px dashed var(--border-gold-strong);
}
.promote-meta { font-size: 12px; color: var(--gold-light); }

@media (max-width: 820px) {
  .barracks-layout, .unit-hero-card { grid-template-columns: 1fr; }
  .barracks-queue-banner { flex-direction: column; align-items: stretch; }
}

/* ===== UPGRADED MODALS (ACADEMY, BUILDING, REPORTS DOSSIER, LEADERBOARD) ===== */
.barracks-queue-banner.theme-azure {
  background: linear-gradient(90deg, rgba(20, 52, 92, 0.78), rgba(24, 34, 52, 0.88));
  border-color: rgba(77, 163, 255, 0.62);
}
.barracks-queue-banner.theme-gold {
  background: linear-gradient(90deg, rgba(72, 52, 16, 0.78), rgba(24, 30, 46, 0.88));
  border-color: rgba(246, 215, 134, 0.68);
}

.pip-track {
  display: flex;
  gap: 4px;
  margin: 4px 0;
}
.pip {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}
.pip.filled {
  background: linear-gradient(90deg, #d4a853, #fde39d);
  box-shadow: 0 0 6px rgba(246, 215, 134, 0.5);
}

.pill-filter-group {
  display: inline-flex;
  gap: 5px;
  background: rgba(0, 0, 0, 0.32);
  padding: 3px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.pill-filter {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.pill-filter.active {
  background: rgba(212, 168, 83, 0.24);
  border-color: var(--border-gold);
  color: var(--gold-light);
}

/* Building diff cards */
.building-modal-emblem {
  width: 66px;
  height: 66px;
  border-radius: 15px;
  background: radial-gradient(circle at 35% 30%, rgba(246, 215, 134, 0.25), rgba(14, 18, 28, 0.92));
  border: 2px solid var(--border-gold-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  flex-shrink: 0;
}
.stat-diff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.stat-diff-card {
  padding: 10px 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.sdc-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.sdc-vals {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.sdc-arrow { color: var(--gold); font-weight: 900; }

/* Academy rich tech cards */
.tech-card-rich {
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color 0.16s ease;
}
.tech-card-rich.is-active-tech {
  border-color: rgba(77, 163, 255, 0.72);
  background: rgba(24, 52, 86, 0.22);
}
.tech-card-rich.is-maxed-tech {
  border-color: rgba(212, 168, 83, 0.45);
  background: rgba(212, 168, 83, 0.07);
}
.tcr-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.tcr-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(212, 168, 83, 0.14);
  border: 1px solid var(--border-gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.bonus-diff-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.34);
  font-size: 12px;
  color: #e6dec8;
}
.cost-compact {
  gap: 6px;
  margin: 2px 0;
}
.cost-compact .cost-chip {
  padding: 3px 7px;
  font-size: 11px;
}
.tcr-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 4px;
}
.tech-max-badge {
  margin-top: auto;
  padding: 8px;
  border-radius: 8px;
  text-align: center;
  background: rgba(56, 181, 125, 0.14);
  border: 1px solid rgba(56, 181, 125, 0.35);
  color: #8ef2bd;
  font-size: 12px;
  font-weight: 700;
}

/* Flagship Battle Reports Master-Detail Dossier */
.reports-layout {
  display: grid;
  grid-template-columns: 276px 1fr;
  gap: 14px;
  min-height: 410px;
  max-height: 60vh;
}
.reports-inbox {
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  padding-right: 4px;
}
.report-list-item {
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 3px solid #38e58d;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.report-list-item.lose { border-left-color: #e95959; }
.report-list-item:hover { background: rgba(255, 255, 255, 0.07); }
.report-list-item.active {
  background: rgba(212, 168, 83, 0.15);
  border-color: var(--border-gold-strong);
  border-left-width: 4px;
}
.rli-top {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 5px;
}
.rli-ico { font-size: 14px; flex-shrink: 0; }
.rli-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rli-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-muted);
}

.reports-dossier {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
}
.dossier-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-gold);
}
.dossier-banner.theme-win {
  background: linear-gradient(135deg, rgba(22, 68, 46, 0.72), rgba(16, 22, 34, 0.92));
  border-color: rgba(94, 230, 168, 0.55);
}
.dossier-banner.theme-lose {
  background: linear-gradient(135deg, rgba(84, 24, 28, 0.72), rgba(16, 22, 34, 0.92));
  border-color: rgba(233, 89, 89, 0.58);
}
.dossier-banner.theme-gather {
  background: linear-gradient(135deg, rgba(64, 48, 16, 0.72), rgba(16, 24, 34, 0.92));
  border-color: rgba(246, 215, 134, 0.55);
}
.db-icon { font-size: 28px; }

.dossier-section {
  padding: 12px 13px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.ds-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-light);
  margin-bottom: 9px;
}

.loot-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 8px;
}
.loot-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(8, 11, 18, 0.65);
  border: 1px solid rgba(212, 168, 83, 0.25);
}
.lt-ico { font-size: 18px; }
.lt-label { font-size: 10px; color: var(--text-muted); }
.lt-val { font-size: 13px; color: #7ee3b4; }

.side-summary-card {
  padding: 10px 11px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.side-summary-card.side-atk { border-top: 2px solid #5ee6a8; }
.side-summary-card.side-def { border-top: 2px solid #ff8b5e; }
.ssc-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}
.ssc-buffs {
  font-size: 11px;
  color: var(--gold-light);
  margin-bottom: 5px;
}
.ssc-nums {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  font-size: 11px;
  margin-top: 5px;
}

.dragon-report-strip {
  margin-top: 10px;
  padding: 8px 11px;
  border-radius: 8px;
  background: rgba(78, 28, 14, 0.42);
  border: 1px solid rgba(255, 138, 64, 0.45);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #ffd9b3;
}

.dossier-tables-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dossier-table-wrap {
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.dtw-title {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(212, 168, 83, 0.1);
  color: var(--gold-light);
}
.compact-table th, .compact-table td {
  padding: 6px 9px;
  font-size: 12px;
}

.row-self {
  background: rgba(212, 168, 83, 0.14);
}

@media (max-width: 820px) {
  .reports-layout { grid-template-columns: 1fr; max-height: none; }
}

.report-list-item.is-fresh {
  animation: freshPulse 1.4s ease;
}
@keyframes freshPulse {
  0% { background: rgba(94, 230, 168, 0.28); }
  100% { background: rgba(255, 255, 255, 0.035); }
}
.fresh-tag {
  padding: 1px 5px;
  border-radius: 4px;
  background: #e94848;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.4px;
}

/* ===== MARCH FORMATION PRESETS & TRI-COLOR COMPOSITION BAR ===== */
.formation-presets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.formation-btn {
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.045);
  color: #dcd4c6;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}
.formation-btn:hover:not(:disabled) {
  border-color: var(--border-gold);
  color: var(--gold-light);
  transform: translateY(-1px);
}
.formation-btn.active {
  border-color: var(--border-gold-strong);
  background: linear-gradient(180deg, rgba(212, 168, 83, 0.28), rgba(156, 114, 40, 0.2));
  color: #fff2c6;
  box-shadow: 0 0 14px rgba(212, 168, 83, 0.25);
}
.formation-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.march-metrics-box {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.comp-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: flex;
}
.comp-seg {
  height: 100%;
  transition: width 0.22s ease;
}
.seg-inf { background: linear-gradient(90deg, #3b82f6, #67d4ff); }
.seg-cav { background: linear-gradient(90deg, #d9534f, #ff8f5e); }
.seg-arc { background: linear-gradient(90deg, #28a768, #6ef0ad); }

/* ===== PHASE 1: HOSPITAL, PEACE SHIELD & SCOUT STYLES ===== */
.shield-hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(126, 227, 255, 0.35);
  background: rgba(20, 48, 68, 0.55);
  color: #b7ebff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.shield-hud-btn:hover {
  transform: translateY(-1px);
  border-color: #7ee3ff;
}
.shield-hud-btn.active {
  border-color: #7ee3ff;
  background: linear-gradient(180deg, rgba(36, 128, 178, 0.55), rgba(16, 62, 94, 0.72));
  color: #e4f9ff;
  box-shadow: 0 0 14px rgba(126, 227, 255, 0.38);
}

.wounded-pill {
  background: rgba(120, 22, 26, 0.94) !important;
  border-color: #ff7b7b !important;
  color: #ffd6d6 !important;
  animation: pulseWounded 1.6s infinite;
}
@keyframes pulseWounded {
  0%, 100% { box-shadow: 0 0 6px rgba(233, 89, 89, 0.4); }
  50% { box-shadow: 0 0 16px rgba(255, 118, 118, 0.85); }
}

.target-action-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.war-fervor-warn {
  padding: 8px 12px;
  border-radius: 9px;
  background: rgba(176, 48, 36, 0.28);
  border: 1px solid rgba(255, 124, 108, 0.65);
  color: #ffd0ca;
  font-size: 12px;
  font-weight: 700;
}

.shield-active-card {
  border-color: rgba(126, 227, 255, 0.72);
  background: linear-gradient(135deg, rgba(16, 64, 96, 0.65), rgba(14, 22, 36, 0.9));
  box-shadow: 0 0 26px rgba(126, 227, 255, 0.2);
}

.dossier-banner.theme-scout {
  background: linear-gradient(135deg, rgba(16, 56, 88, 0.78), rgba(16, 22, 34, 0.92));
  border-color: rgba(126, 227, 255, 0.62);
}

.hospital-notice-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(24, 72, 54, 0.45);
  border: 1px solid rgba(94, 230, 168, 0.55);
  font-size: 12px;
  color: #d8ffec;
}

/* ===== PHASE 2: ROUND TABLE HEROES, TAVERN & COUNCIL STYLES ===== */
.heroes-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 14px;
  align-items: start;
}
.heroes-roster-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 455px;
  overflow-y: auto;
  padding-right: 3px;
}
.hero-roster-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.hero-roster-card:hover { transform: translateX(2px); border-color: var(--border-gold); }
.hero-roster-card.active {
  background: rgba(212, 168, 83, 0.16);
  border-color: var(--border-gold-strong);
}
.hero-roster-card.locked .hrc-avatar { filter: grayscale(0.85) brightness(0.6); }
.hrc-avatar {
  width: 48px;
  height: 48px;
  border-radius: 9px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}
.hero-roster-card.rarity-SSR .hrc-avatar { border-color: #fde39d; }
.hero-roster-card.rarity-SR .hrc-avatar { border-color: #c074ff; }
.hero-roster-card.rarity-R .hrc-avatar { border-color: #5bb8ff; }

.hrc-info { flex: 1; min-width: 0; }
.hrc-top { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.hrc-stars { font-size: 11px; color: #f6d786; margin-top: 2px; }
.hrc-sub { font-size: 10px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rarity-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 900;
}
.rarity-pill.rarity-SSR { background: linear-gradient(180deg, #f8d878, #b57b1b); color: #1a1003; border: 1px solid #fff0c2; }
.rarity-pill.rarity-SR { background: linear-gradient(180deg, #b866ff, #6c27b8); color: #fff; border: 1px solid #e2b8ff; }
.rarity-pill.rarity-R { background: linear-gradient(180deg, #4da3ff, #1f62b5); color: #fff; border: 1px solid #a8d4ff; }

.hero-showcase { display: flex; flex-direction: column; gap: 12px; }
.hero-portrait-frame.rarity-SSR { border-color: #fde39d; box-shadow: 0 0 24px rgba(246, 215, 134, 0.35); }
.hero-portrait-frame.rarity-SR { border-color: #c074ff; box-shadow: 0 0 22px rgba(192, 116, 255, 0.32); }
.hero-portrait-frame.rarity-R { border-color: #5bb8ff; }

.march-hero-select {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(212, 168, 83, 0.4);
  background: rgba(8, 12, 20, 0.94);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12px;
  max-width: 230px;
}

.summon-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 10px;
}
.summon-result-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px;
  border-radius: 11px;
  background: rgba(10, 14, 24, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.16);
  animation: modalPopIn 0.25s ease;
}
.summon-result-card.rarity-SSR { border-color: #fde39d; box-shadow: 0 0 24px rgba(246, 215, 134, 0.42); }
.summon-result-card.rarity-SR { border-color: #c074ff; box-shadow: 0 0 18px rgba(192, 116, 255, 0.32); }
.summon-result-card.rarity-R { border-color: #5bb8ff; }
.summon-result-card img {
  width: 92px;
  height: 92px;
  border-radius: 10px;
  object-fit: cover;
}
.src-tag {
  font-size: 11px;
  color: #cfc7b8;
}
.src-tag.new {
  color: #7ee3b4;
  font-weight: 800;
}

@media (max-width: 820px) {
  .heroes-layout { grid-template-columns: 1fr; }
}

/* ===== PHASE 3: BLACKSMITH FORGE, 6-SLOT EQUIPMENT & DOCK COMPACT FIT ===== */
.chat-anchor {
  width: 248px;
}
.dock-buttons {
  gap: 5px;
}
.dock-btn {
  width: 58px;
}

.set-resonance-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.set-pill {
  flex: 1;
  min-width: 195px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}
.set-pill.lit {
  background: linear-gradient(180deg, rgba(212, 168, 83, 0.25), rgba(156, 114, 40, 0.18));
  border-color: var(--border-gold-strong);
  color: #fff2c6;
  box-shadow: 0 0 14px rgba(212, 168, 83, 0.22);
}

.forge-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 14px;
  align-items: start;
}
.forge-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.eq-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.eq-slot-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 11px;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 24, 36, 0.88);
  color: var(--text-main);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.eq-slot-card:hover { transform: translateY(-2px); }
.eq-slot-card.active {
  box-shadow: 0 0 18px rgba(246, 215, 134, 0.35);
  background: rgba(212, 168, 83, 0.16);
}
.eq-slot-card.q1 { border-color: #5ee6a8; }
.eq-slot-card.q2 { border-color: #4da3ff; box-shadow: inset 0 0 12px rgba(77, 163, 255, 0.2); }
.eq-slot-card.q3 { border-color: #c074ff; box-shadow: inset 0 0 14px rgba(192, 116, 255, 0.24); }
.eq-slot-card.q4 { border-color: #fde39d; box-shadow: inset 0 0 18px rgba(246, 215, 134, 0.34); }
.eq-ico { font-size: 26px; line-height: 1; }
.eq-name { font-size: 11px; font-weight: 800; color: #f4ece0; white-space: nowrap; }
.eq-ready-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38e58d;
  box-shadow: 0 0 8px #38e58d;
}

.eq-q-pill {
  display: inline-flex;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 900;
}
.eq-q-pill.q0 { background: rgba(255, 255, 255, 0.08); color: #9a9489; }
.eq-q-pill.q1 { background: rgba(56, 181, 125, 0.24); color: #8ef2bd; border: 1px solid rgba(94, 230, 168, 0.5); }
.eq-q-pill.q2 { background: rgba(59, 130, 246, 0.28); color: #93c5fd; border: 1px solid rgba(96, 165, 250, 0.6); }
.eq-q-pill.q3 { background: rgba(168, 85, 247, 0.3); color: #e2b8ff; border: 1px solid rgba(192, 116, 255, 0.65); }
.eq-q-pill.q4 { background: linear-gradient(180deg, #f8d878, #b57b1b); color: #1a1003; border: 1px solid #fff0c2; }

.mat-vault-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mat-vault-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.28);
}

.forge-right {
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.forge-art-banner {
  position: relative;
  height: 128px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-gold-strong);
}
.forge-art-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.55);
}
.forge-art-overlay {
  position: absolute;
  inset: 0;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(90deg, rgba(10, 12, 20, 0.88) 0%, rgba(10, 12, 20, 0.45) 100%);
}
.fao-icon {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: rgba(16, 20, 32, 0.88);
  border: 2px solid var(--border-gold-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
}

@media (max-width: 820px) {
  .forge-layout { grid-template-columns: 1fr; }
}

/* ===== PHASE 4: ALLIANCE RALLY WAR ROOM & GARRISON REINFORCEMENTS ===== */
.rally-config-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border-radius: 11px;
  background: linear-gradient(90deg, rgba(78, 24, 18, 0.72), rgba(28, 22, 16, 0.85));
  border: 1px solid rgba(255, 159, 67, 0.58);
}
.rally-config-bar.theme-garrison {
  background: linear-gradient(90deg, rgba(16, 44, 76, 0.78), rgba(16, 26, 44, 0.88));
  border-color: rgba(77, 163, 255, 0.58);
}
.rcb-prep-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.progress-fill.rally-fill {
  background: linear-gradient(90deg, #e04f3d, #ff9f43, #fde39d);
}
.rally-rail-row {
  border-left: 3px solid #ff9f43;
  padding-left: 8px;
}

.rally-live-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(54, 18, 18, 0.62), rgba(18, 22, 34, 0.88));
  border: 1px solid rgba(255, 159, 67, 0.45);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rally-live-card.status-marching {
  border-color: rgba(255, 107, 107, 0.72);
  box-shadow: 0 0 22px rgba(233, 89, 89, 0.18);
}
.rally-live-card.status-returning {
  background: linear-gradient(135deg, rgba(18, 52, 38, 0.65), rgba(18, 24, 34, 0.88));
  border-color: rgba(94, 230, 168, 0.55);
}
.rlc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.rlc-timer-box {
  text-align: right;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.rally-timer-val {
  font-size: 16px;
  font-weight: 900;
  color: #fde39d;
  font-variant-numeric: tabular-nums;
}
.rally-status-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.rally-status-pill.gathering {
  background: rgba(255, 159, 67, 0.25);
  color: #ffd399;
  border: 1px solid rgba(255, 159, 67, 0.65);
}
.rally-status-pill.marching {
  background: rgba(233, 89, 89, 0.28);
  color: #ffb0b0;
  border: 1px solid rgba(233, 89, 89, 0.75);
}
.rally-status-pill.returning {
  background: rgba(56, 181, 125, 0.25);
  color: #9bf2ca;
  border: 1px solid rgba(94, 230, 168, 0.65);
}
.rlc-cap-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #dcd4c6;
}
.rlc-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rally-member-chip {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e6dfd0;
}
.rally-member-chip.is-leader {
  background: rgba(212, 168, 83, 0.2);
  border-color: var(--border-gold-strong);
  color: #fde68a;
}
.rlc-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.gar-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

/* ===== PHASE 5: ROYAL THRONE HALL, EVENTS, SUPPLY CHEST & FULL RWD ===== */
.toast-stack {
  right: 88px;
}

.royal-title-pill {
  padding: 1px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(246, 215, 134, 0.28), rgba(176, 122, 34, 0.22));
  border: 1px solid rgba(253, 227, 157, 0.65);
  color: #fde68a;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.edict-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 16;
  padding: 6px 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(46, 32, 10, 0.92), rgba(24, 18, 12, 0.94));
  border: 1px solid var(--border-gold-strong);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55), 0 0 18px rgba(246, 215, 134, 0.28);
  color: #fff2cc;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  max-width: calc(100vw - 420px);
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.16s ease, filter 0.16s ease;
}
.edict-banner:hover {
  transform: translateX(-50%) translateY(-1px);
  filter: brightness(1.12);
}

.right-utility-rail {
  position: absolute;
  top: 72px;
  right: 14px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.utility-pill {
  position: relative;
  width: 60px;
  height: 58px;
  border-radius: 14px;
  border: 1px solid var(--border-gold);
  background: linear-gradient(180deg, rgba(22, 26, 40, 0.92), rgba(10, 14, 24, 0.94));
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.utility-pill:hover {
  transform: translateY(-2px);
  border-color: var(--border-gold-strong);
  box-shadow: 0 8px 24px rgba(212, 168, 83, 0.28);
}
.up-icon {
  font-size: 20px;
  line-height: 1;
}
.up-label {
  font-size: 10px;
  font-weight: 800;
  color: #e8e0cf;
  font-variant-numeric: tabular-nums;
}
.up-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #5ee6a8;
  box-shadow: 0 0 8px #5ee6a8;
}
.supply-pill.ready {
  border-color: #fde39d;
  background: linear-gradient(180deg, rgba(94, 62, 16, 0.95), rgba(48, 30, 8, 0.96));
  animation: supplyGlow 1.9s ease-in-out infinite;
}
.supply-pill.ready .up-label {
  color: #fff2cc;
}
@keyframes supplyGlow {
  0%, 100% { box-shadow: 0 6px 18px rgba(246, 215, 134, 0.28); }
  50% { box-shadow: 0 6px 26px rgba(253, 227, 157, 0.72); }
}

.throne-hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.throne-crest-emblem {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: radial-gradient(circle, rgba(246, 215, 134, 0.3), rgba(44, 28, 8, 0.9));
  border: 2px solid var(--border-gold-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
}
.throne-select {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 12, 20, 0.94);
  color: var(--text-main);
  font-size: 12px;
  font-family: var(--font-sans);
}

/* ===== TABLET & MOBILE RESPONSIVE RWD (<= 960px & <= 768px) ===== */
.rail-toggle-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 960px) {
  .top-hud {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    padding: 6px 10px;
    gap: 6px;
  }
  .hud-resources {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
    justify-content: space-between;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-top: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .hud-resources::-webkit-scrollbar,
  .dock-buttons::-webkit-scrollbar {
    display: none;
  }
  .res-item {
    padding: 3px 6px;
    min-width: 0;
    flex-shrink: 0;
  }
  .left-rail {
    width: 215px;
    top: 10px;
    left: 8px;
  }
  .right-utility-rail {
    top: 66px;
    right: 8px;
    gap: 7px;
  }
  .utility-pill {
    width: 52px;
    height: 50px;
  }
  .toast-stack {
    right: 70px;
    max-width: 280px;
  }
  .world-toolbar {
    left: 50%;
    max-width: calc(100vw - 20px);
    overflow-x: auto;
    gap: 5px;
    padding: 6px 8px;
  }
  .world-legend {
    display: none;
  }
  .world-radar-panel {
    left: 50%;
    width: min(360px, calc(100vw - 24px));
  }
  .bottom-bar {
    height: auto;
    flex-direction: column;
    gap: 6px;
    padding: 6px 8px;
  }
  .chat-anchor {
    width: 100%;
    max-width: none;
  }
  .chat-drawer {
    width: min(380px, calc(100vw - 16px));
  }
  .action-dock {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  .btn-world-switch {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .dock-buttons {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .modal-box,
  .modal-box.modal-wide {
    width: 96vw;
    max-width: 96vw;
    max-height: 90vh;
  }
  .barracks-layout,
  .heroes-layout,
  .reports-layout {
    grid-template-columns: 1fr;
  }
  .reports-inbox {
    max-height: 190px;
  }
}

@media (max-width: 768px) {
  .auth-content {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }
  .auth-title {
    font-size: 26px;
  }
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .left-rail {
    width: 180px;
  }
  .edict-banner {
    max-width: calc(100vw - 160px);
    font-size: 11px;
    padding: 5px 10px;
  }
  .world-target-card {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 10px;
  }
  .btn-world-switch {
    padding: 0 11px;
    min-width: auto;
    height: 48px;
  }
  .switch-label {
    font-size: 12px;
  }
  .dock-btn {
    width: 50px;
    height: 48px;
    flex-shrink: 0;
  }
  .royal-table th,
  .royal-table td {
    padding: 7px 6px;
    font-size: 12px;
  }
  .royal-table th {
    white-space: nowrap;
    font-size: 11px;
  }
}

@media (max-width: 560px) {
  .hud-right .online-pill {
    display: none;
  }
  .res-rate {
    display: none;
  }
  .res-item {
    padding: 2px 5px;
    gap: 3px;
  }
  .res-icon {
    font-size: 13px;
  }
  .res-num {
    font-size: 11px;
  }
  .mini-badge {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .left-rail {
    width: 224px;
  }
  #quickQuestPanel {
    display: none;
  }
  .building-emblem {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }
  .building-tag {
    font-size: 10px;
    padding: 2px 6px;
  }
  .btn-world-switch {
    padding: 0 9px;
  }
  .btn-world-switch .switch-label {
    font-size: 11px;
  }
}

/* ===== SEASON 2 - PHASE 1: ROYAL AVATARS, LORD PROFILE & TELEPORT ===== */
.lord-avatar {
  overflow: hidden;
  padding: 0;
  position: relative;
}
.lord-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lord-avatar.is-king {
  border-color: #ffe999;
  box-shadow: 0 0 16px rgba(253, 227, 157, 0.85);
}

.lord-inspect-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.lord-inspect-link:hover strong {
  color: #fde39d;
  text-decoration: underline;
}
.mini-avatar-img,
.mini-av {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border-gold);
  flex-shrink: 0;
}
.lord-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 8px 3px 3px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.lord-link-btn:hover {
  background: rgba(246, 215, 134, 0.12);
  border-color: rgba(246, 215, 134, 0.35);
  color: #fde68a;
}

.profile-hero-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.phb-avatar {
  position: relative;
  width: 82px;
  height: 82px;
  border-radius: 18px;
  overflow: hidden;
  border: 2.5px solid var(--border-gold-strong);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55);
  flex-shrink: 0;
}
.phb-avatar.is-king {
  border-color: #fff0a8;
  box-shadow: 0 0 28px rgba(253, 227, 157, 0.7);
}
.phb-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.phb-crown {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 16px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9));
}

.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.avatar-choice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.avatar-choice-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-gold);
}
.avatar-choice-card.active {
  border-color: var(--border-gold-strong);
  background: rgba(212, 168, 83, 0.18);
  box-shadow: 0 0 20px rgba(212, 168, 83, 0.25);
}
.avatar-choice-card img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-gold);
}
.acc-name {
  font-size: 12px;
  font-weight: 800;
  color: #fde68a;
}
.acc-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.profile-gear-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.profile-gear-tile {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.profile-gear-tile.q-1 { border-color: rgba(148, 163, 184, 0.45); }
.profile-gear-tile.q-2 { border-color: rgba(96, 165, 250, 0.65); }
.profile-gear-tile.q-3 { border-color: rgba(192, 132, 252, 0.72); }
.profile-gear-tile.q-4 { border-color: rgba(250, 204, 21, 0.85); box-shadow: 0 0 10px rgba(250, 204, 21, 0.2); }
.pgt-ico { font-size: 16px; }

.profile-hero-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.profile-hero-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.profile-hero-chip.rarity-SSR { border-color: rgba(250, 204, 21, 0.7); }
.profile-hero-chip.rarity-SR { border-color: rgba(192, 132, 252, 0.65); }
.profile-hero-chip img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
}
.phc-meta {
  display: flex;
  flex-direction: column;
  font-size: 11px;
}
.phc-meta strong { color: #f6d786; font-size: 12px; }
.phc-meta span { color: #b8b0a0; font-size: 10px; }

@media (max-width: 680px) {
  .avatar-picker-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-gear-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== SEASON 2 - PHASE 2: DRAGON RUNES & STAGE EVOLUTION GALLERY ===== */
.dragon-portrait-wrap.awakened-halo {
  box-shadow: 0 0 36px rgba(253, 227, 157, 0.72), 0 0 18px rgba(255, 138, 92, 0.55);
  border-color: #ffe999;
}
.dragon-awakened-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(246, 215, 134, 0.35);
}
.dragon-awakened-banner.active {
  background: linear-gradient(90deg, rgba(84, 38, 12, 0.72), rgba(44, 30, 12, 0.85));
  border-color: #fde39d;
  box-shadow: 0 0 24px rgba(246, 215, 134, 0.25);
}
.dragon-rune-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-color: rgba(255, 255, 255, 0.12);
}
.dragon-rune-card.is-awakened {
  border-color: var(--rune-color, #f6d786);
  box-shadow: 0 0 18px rgba(246, 215, 134, 0.14);
}
.drc-orb {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(10, 14, 24, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  filter: grayscale(0.55);
}
.drc-orb.lit {
  filter: none;
  border-color: var(--rune-color, #f6d786);
  box-shadow: 0 0 16px var(--rune-color, rgba(246, 215, 134, 0.55));
}

.dragon-evo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.dragon-evo-card {
  display: flex;
  flex-direction: column;
  text-align: center;
}
.dragon-evo-card.locked .dec-img-wrap img {
  filter: grayscale(0.45) brightness(0.75);
}
.dec-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--border-gold);
}
.dec-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dec-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(10, 14, 22, 0.88);
  border: 1px solid var(--border-gold);
  color: #fde68a;
  font-size: 10px;
  font-weight: 800;
}
@media (max-width: 768px) {
  .dragon-evo-grid { grid-template-columns: 1fr; }
}

/* ===== SEASON 2 - PHASE 3: ALLIANCE TECH, HONOR SHOP & TERRITORY ===== */
.territory-badge-strip {
  margin: 8px 0 2px;
  padding: 6px 10px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(16, 185, 129, 0.16));
  border: 1px solid rgba(96, 165, 250, 0.52);
  color: #bfe0ff;
  font-size: 11px;
  font-weight: 700;
}
.ally-tech-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ally-donate-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.ally-donate-row .btn {
  padding: 5px 4px;
  font-size: 11px;
  white-space: nowrap;
}
.ally-shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.ally-shop-card {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(14, 18, 30, 0.86);
  border: 1px solid rgba(246, 215, 134, 0.28);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.ally-shop-card.is-locked {
  opacity: 0.72;
  border-color: rgba(255, 255, 255, 0.1);
}
@media (max-width: 768px) {
  .ally-shop-grid { grid-template-columns: 1fr; }
  .ally-donate-row { grid-template-columns: 1fr; }
}

/* ===== SEASON 2 - PHASE 4: MERLIN'S TRIAL TOWER & WORLD BOSS NIDHOGG ===== */
.boss-pill-accent {
  border-color: rgba(192, 132, 252, 0.78);
  background: linear-gradient(180deg, rgba(64, 22, 86, 0.94), rgba(24, 12, 36, 0.96));
}
.boss-pill-accent:hover {
  border-color: #e9b3ff;
  box-shadow: 0 8px 24px rgba(192, 132, 252, 0.38);
}

.trial-hero-banner {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--border-gold);
  min-height: 158px;
  display: flex;
  align-items: flex-end;
  background-size: cover;
  background-position: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  max-width: 100%;
}
.modal-body {
  overflow-x: hidden;
}
.trial-hero-banner.boss-theme {
  border-color: rgba(192, 132, 252, 0.72);
  box-shadow: 0 10px 30px rgba(126, 34, 206, 0.3);
}
.trial-hero-overlay {
  width: 100%;
  padding: 16px 18px 14px;
  background: linear-gradient(180deg, rgba(8, 12, 22, 0.18) 0%, rgba(8, 12, 22, 0.86) 55%, rgba(8, 12, 22, 0.97) 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.boss-hp-wrap {
  width: 100%;
  height: 18px;
  border-radius: 999px;
  background: rgba(12, 8, 22, 0.92);
  border: 1px solid rgba(232, 121, 249, 0.55);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
}
.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #9333ea 0%, #db2777 52%, #f97316 100%);
  box-shadow: 0 0 14px rgba(219, 39, 119, 0.65);
  transition: width 0.35s ease;
}
.boss-hp-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.92);
  font-variant-numeric: tabular-nums;
}

.preset-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.preset-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(14, 18, 30, 0.86);
  color: #d8d0c0;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-chip.active {
  border-color: #f6d786;
  background: rgba(212, 168, 83, 0.22);
  color: #fff2cc;
}

.tower-floor-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}
.tower-floor-chip {
  padding: 7px 6px;
  border-radius: 9px;
  background: rgba(14, 18, 30, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tower-floor-chip.cleared {
  border-color: rgba(126, 227, 180, 0.52);
  background: rgba(16, 68, 48, 0.34);
  color: #a7f3d0;
}
.tower-floor-chip.current {
  border-color: #f6d786;
  background: rgba(114, 78, 18, 0.42);
  box-shadow: 0 0 12px rgba(246, 215, 134, 0.25);
  color: #fff2cc;
}
.tower-floor-chip.boss {
  border-color: rgba(244, 114, 182, 0.6);
}
.tower-floor-chip.locked {
  opacity: 0.52;
}

.strike-result-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(64, 20, 88, 0.62), rgba(20, 16, 36, 0.92));
  border: 1.5px solid rgba(232, 121, 249, 0.65);
  box-shadow: 0 0 22px rgba(168, 85, 247, 0.25);
}
.strike-result-card.win {
  background: linear-gradient(135deg, rgba(20, 74, 52, 0.65), rgba(14, 24, 34, 0.92));
  border-color: rgba(110, 231, 183, 0.68);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.22);
}
.strike-result-card.lose {
  background: linear-gradient(135deg, rgba(94, 24, 24, 0.62), rgba(24, 14, 18, 0.92));
  border-color: rgba(248, 113, 113, 0.62);
}

@media (max-width: 768px) {
  .tower-floor-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 560px) {
  .tower-floor-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== SEASON 2 - PHASE 5: CHAT REPORT SHARE CARDS & WORLD BOOKMARKS ===== */
.chat-report-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin-top: 5px;
  padding: 8px 10px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(28, 36, 56, 0.94), rgba(16, 20, 34, 0.96));
  border: 1px solid rgba(246, 215, 134, 0.45);
  color: #f6efe0;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.chat-report-card:hover {
  transform: translateY(-1px);
  border-color: #fde39d;
  box-shadow: 0 4px 16px rgba(246, 215, 134, 0.25);
}
.chat-report-card.win {
  border-color: rgba(110, 231, 183, 0.55);
}
.chat-report-card.lose {
  border-color: rgba(248, 113, 113, 0.52);
}
.crc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.crc-cta {
  font-size: 10px;
  font-weight: 800;
  color: #fde39d;
}
.crc-title {
  font-size: 12px;
  font-weight: 700;
  color: #fff4d6;
  line-height: 1.35;
}

.bm-star-btn {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(246, 215, 134, 0.4);
  background: rgba(20, 24, 38, 0.9);
  color: #e6dfd0;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}
.bm-star-btn:hover {
  border-color: #fde047;
  color: #fff2cc;
}
.bm-star-btn.saved {
  background: rgba(212, 168, 83, 0.24);
  border-color: #fde047;
  color: #fde047;
}

.world-bookmarks-panel {
  width: min(370px, calc(100vw - 24px));
}
.bm-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.bm-filter-row .pill-filter {
  padding: 3px 8px;
  font-size: 11px;
}
.bm-list {
  max-height: 230px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}
.bm-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 9px;
  background: rgba(14, 18, 30, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== SQUAD 1/2/3 FORMATIONS, EQUIP TOGGLE & TIMED GATHER TELEMETRY ===== */
.squad-slot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.squad-slot-card {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(14, 18, 30, 0.86);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  text-align: left;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.15s ease;
}
.squad-slot-card.is-set {
  border-color: rgba(126, 227, 180, 0.45);
}
.squad-slot-card.active {
  border-color: #f6d786;
  background: rgba(94, 68, 22, 0.34);
  box-shadow: 0 0 16px rgba(246, 215, 134, 0.2);
}
.squad-quick-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(16, 22, 36, 0.86);
  border: 1px solid rgba(246, 215, 134, 0.28);
}
.squad-load-btn.is-configured {
  border-color: rgba(126, 227, 180, 0.55);
  color: #a7f3d0;
}
.gather-telemetry-strip {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(16, 62, 48, 0.35);
  border: 1px solid rgba(110, 231, 183, 0.45);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: #e4f7ee;
}
.eq-slot-card.is-unequipped {
  opacity: 0.62;
  border-style: dashed;
}
.eq-wear-tag {
  margin-top: 3px;
  font-size: 10px;
  font-weight: 800;
}
.eq-wear-tag.on { color: #7ee3b4; }
.eq-wear-tag.off { color: #cbd5e1; }
@media (max-width: 680px) {
  .squad-slot-grid { grid-template-columns: 1fr; }
}

/* ===== KINGDOM EXPANSION: 120x120 MINIMAP, DARK FOREST, FIRE, BATTLE REPORT REFS & FALLEN KNIGHTS ===== */
.dot-camp { background: #f97316; }

.world-minimap-wrap {
  position: absolute;
  left: 16px;
  bottom: 18px;
  z-index: 14;
  padding: 6px;
  border-radius: 10px;
  background: rgba(11, 15, 24, 0.88);
  border: 1px solid var(--border-gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  transition: opacity 0.18s ease;
}
.chat-drawer-open .world-minimap-wrap {
  opacity: 0;
  pointer-events: none;
}
.minimap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #f6d786;
  margin-bottom: 4px;
}
#worldMiniMap {
  display: block;
  width: 144px;
  height: 144px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: crosshair;
}

.world-threat-pill {
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(88, 28, 135, 0.28);
  border: 1px solid rgba(192, 132, 252, 0.45);
  color: #e9d5ff;
  font-size: 11px;
  line-height: 1.4;
}

.castle-fire-strip {
  margin: 6px 0 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(154, 34, 18, 0.58), rgba(180, 68, 14, 0.45));
  border: 1px solid rgba(251, 146, 60, 0.72);
  color: #ffedd5;
  font-size: 12px;
  line-height: 1.45;
}

.report-ref-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.report-ref-card {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(14, 18, 30, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.report-ref-card.ref-atk { border-color: rgba(246, 215, 134, 0.38); }
.report-ref-card.ref-def { border-color: rgba(99, 179, 255, 0.38); }
.rrc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #fff2cc;
}
.rrc-base-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}
.rrc-metric {
  padding: 5px 6px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
}
.rrc-metric span {
  font-size: 10px;
  color: #a9a295;
}
.rrc-metric strong {
  font-size: 12px;
  color: #f8f2e4;
}
.rrc-branch-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 11px;
  color: #d6d0c4;
}
.rrc-buff-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rrc-buff-title {
  font-size: 11px;
  color: #cfc7b8;
}
.rrc-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.buff-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #ece6d8;
}
.buff-pill.atk {
  border-color: rgba(251, 146, 60, 0.45);
  background: rgba(124, 45, 18, 0.35);
  color: #fed7aa;
}
.buff-pill.def {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(30, 58, 138, 0.35);
  color: #bfdbfe;
}
.buff-pill.muted {
  opacity: 0.65;
}
.rrc-dragon-foot {
  font-size: 11px;
  color: #fdba74;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 5px;
}

.fk-wave-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.fk-wave-card {
  padding: 8px 9px;
  border-radius: 9px;
  background: rgba(16, 20, 32, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.fk-wave-card.is-boss {
  border-color: rgba(244, 63, 94, 0.55);
  background: rgba(68, 14, 28, 0.55);
}
.fk-wave-card.is-active {
  border-color: #fde047;
  box-shadow: 0 0 14px rgba(253, 224, 71, 0.32);
}
.fk-wave-card.is-done {
  border-color: rgba(126, 227, 180, 0.45);
}
@media (max-width: 820px) {
  .report-ref-grid { grid-template-columns: 1fr; }
  .fk-wave-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===== UNDER-ATTACK PULSING RED ALERT VIGNETTE & TOP WARNING BANNER ===== */
.under-attack-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  box-shadow:
    inset 0 0 65px rgba(255, 24, 58, 0.58),
    inset 0 0 18px rgba(255, 42, 72, 0.85);
  animation: underAttackPulse 1.05s ease-in-out infinite;
}
@keyframes underAttackPulse {
  0%, 100% { opacity: 0.48; }
  50% { opacity: 1; }
}

.under-attack-banner {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: min(680px, calc(100vw - 150px));
  padding: 8px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(124, 12, 28, 0.96), rgba(168, 24, 34, 0.94));
  border: 1.5px solid #ff4d6d;
  box-shadow: 0 8px 28px rgba(255, 24, 58, 0.45);
  backdrop-filter: blur(8px);
  color: #fff1f2;
  animation: underAttackBarPulse 1.1s ease-in-out infinite;
}
@keyframes underAttackBarPulse {
  0%, 100% { box-shadow: 0 6px 22px rgba(255, 24, 58, 0.35); border-color: #ff4d6d; }
  50% { box-shadow: 0 8px 34px rgba(255, 24, 58, 0.78); border-color: #fda4af; }
}
.uab-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.uab-siren {
  font-size: 20px;
  flex-shrink: 0;
  animation: sirenBounce 0.7s ease-in-out infinite;
}
@keyframes sirenBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
.uab-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12px;
  min-width: 0;
}
.uab-text strong {
  color: #ffe4e6;
  font-size: 13px;
}
.uab-text span {
  color: #fecdd3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.uab-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.incoming-rail-row {
  border-color: rgba(255, 36, 68, 0.85) !important;
  background: linear-gradient(135deg, rgba(114, 14, 28, 0.78), rgba(62, 12, 22, 0.86)) !important;
  box-shadow: 0 0 14px rgba(255, 30, 66, 0.32);
}

/* ===== MOBILE TOUCH ERGONOMICS & PORTRAIT HINT ===== */
html, body {
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
.game-shell {
  height: 100dvh;
}
.world-canvas,
#worldMiniMap {
  touch-action: none;
}

.portrait-hint-bar {
  display: none;
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  width: min(94vw, 420px);
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(16, 22, 36, 0.96);
  border: 1px solid var(--border-gold-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #fff2cc;
}
.portrait-hint-bar.dismissed {
  display: none !important;
}
@media (max-width: 600px) and (orientation: portrait) {
  .portrait-hint-bar {
    display: flex;
  }
  .world-minimap-wrap {
    display: none;
  }
}

/* ===== MOBILE LANDSCAPE HANDHELD GAME MODE (e.g. 844x390, 915x412, 667x375, 1024x520) ===== */
@media (max-height: 540px) and (orientation: landscape), (max-width: 960px) and (max-height: 540px) {
  /* Auth screen fits cleanly side-by-side in landscape */
  .auth-screen {
    overflow-y: auto;
    padding: 8px max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
  }
  .auth-content {
    grid-template-columns: 0.95fr 1fr;
    gap: 14px;
    padding: 8px 10px;
    width: 100%;
    max-width: min(820px, calc(100vw - 24px));
    box-sizing: border-box;
  }
  .royal-crest { font-size: 30px; margin-bottom: 4px; }
  .auth-title { font-size: 22px; margin-bottom: 6px; }
  .auth-subtitle { font-size: 12px; margin-bottom: 8px; }
  .auth-highlights { gap: 5px; }
  .highlight-pill { padding: 4px 8px; font-size: 11px; }
  .auth-card { padding: 12px 14px; }
  .form-group { margin-bottom: 7px; }
  .form-group input { padding: 7px 10px; font-size: 13px; }

  /* Single-row slim 40px Top HUD with safe-area padding */
  .top-hud {
    height: 40px;
    min-height: 40px;
    flex-wrap: nowrap;
    padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
    gap: 6px;
  }
  .hud-lord {
    gap: 6px;
    padding: 2px 6px 2px 2px;
    flex-shrink: 0;
  }
  .lord-avatar {
    width: 30px;
    height: 30px;
  }
  .lord-name-row { font-size: 11px; gap: 4px; }
  .lord-name { max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .royal-title-pill { display: none !important; }
  .lord-sub-row { gap: 4px; font-size: 10px; }
  .coords-btn { padding: 1px 4px; font-size: 10px; }

  .hud-resources {
    order: 0;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    border-top: none;
    padding-top: 0;
    justify-content: center;
    gap: 3px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .res-item {
    padding: 2px 5px;
    gap: 3px;
    min-width: 0;
    flex-shrink: 0;
  }
  .res-icon { font-size: 12px; }
  .res-num { font-size: 11px; font-weight: 800; }
  .res-rate { display: none; }

  .hud-right {
    order: 0;
    gap: 3px;
    flex-shrink: 0;
  }
  .hud-right .online-pill { display: none; }
  .shield-hud-btn {
    height: 26px;
    padding: 0 7px;
    font-size: 10px;
  }
  .audio-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    font-size: 12px;
  }
  #logoutBtn {
    padding: 3px 7px;
    font-size: 10px;
  }

  /* Compact Left Rail */
  .left-rail {
    top: 6px;
    left: max(6px, env(safe-area-inset-left));
    width: 192px;
    gap: 5px;
    max-height: calc(100dvh - 102px);
    overflow-y: auto;
  }
  .left-rail.collapsed {
    width: auto;
  }
  .rail-header {
    padding: 5px 8px;
    font-size: 11px;
  }
  .rail-body {
    padding: 6px;
  }
  #quickQuestPanel {
    display: none;
  }

  /* Compact Right Utility Rail: all 5 buttons fit cleanly in 300px height! */
  .right-utility-rail {
    top: 8px;
    right: max(6px, env(safe-area-inset-right));
    gap: 4px;
  }
  .utility-pill {
    width: 40px;
    height: 36px;
    border-radius: 9px;
    gap: 1px;
  }
  .up-icon { font-size: 14px; line-height: 1; }
  .up-label { font-size: 9px; line-height: 1; }

  /* Under-Attack Banner slim & cleanly below world toolbar for mobile landscape */
  .under-attack-banner {
    top: 40px;
    padding: 5px 10px;
    gap: 8px;
    max-width: calc(100vw - 110px);
  }
  .uab-siren { font-size: 16px; }
  .uab-text strong { font-size: 11px; }
  .uab-text span { font-size: 10px; }

  /* Inner City building pins compact & cleanly spaced on 390px tall phones */
  .city-building-pin {
    transform: translate(-50%, -50%) scale(0.74);
  }
  .city-building-pin:hover {
    transform: translate(-50%, -52%) scale(0.8);
  }
  .edict-banner {
    top: 4px;
    font-size: 10px;
    padding: 3px 8px;
  }

  /* World Map Toolbar sits cleanly between collapsed Left Rail & Right Utility Rail (zero overlap!) */
  .world-toolbar {
    top: 6px;
    left: max(218px, calc(env(safe-area-inset-left) + 214px));
    right: max(54px, calc(env(safe-area-inset-right) + 52px));
    transform: none;
    max-width: none;
    padding: 3px 7px;
    gap: 4px;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .world-toolbar::-webkit-scrollbar { display: none; }
  .world-coord-jump { display: none; }
  .world-legend { display: none; }

  .world-minimap-wrap {
    display: block;
    left: max(8px, env(safe-area-inset-left));
    bottom: 8px;
    padding: 4px;
  }
  .minimap-header {
    font-size: 9px;
    margin-bottom: 2px;
  }
  #worldMiniMap {
    width: 88px;
    height: 88px;
  }

  .world-target-card {
    right: max(54px, calc(env(safe-area-inset-right) + 52px));
    left: auto;
    bottom: 8px;
    width: 278px;
    padding: 10px;
    max-height: calc(100dvh - 102px);
    overflow-y: auto;
  }
  .world-target-card .target-title { font-size: 13px; }
  .world-target-card .target-coords { font-size: 10px; }
  .world-target-card .stat-chip { padding: 5px 7px; font-size: 10px; }
  .world-target-card .reward-preview { padding: 6px 8px; margin-bottom: 7px; }

  .world-radar-panel {
    top: 42px;
    left: 50%;
    width: min(350px, calc(100vw - 100px));
    padding: 10px;
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
  }

  /* Single-row slim 48px Bottom Bar (Chat icon + View Switch + swipeable Dock!) */
  .bottom-bar {
    height: 48px;
    min-height: 48px;
    flex-direction: row;
    align-items: center;
    padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
    gap: 6px;
  }
  .chat-anchor {
    width: auto;
    max-width: none;
    flex-shrink: 0;
  }
  .chat-preview-btn {
    width: auto;
    padding: 0 9px;
    height: 36px;
  }
  .chat-last-text {
    display: none;
  }
  .chat-drawer {
    width: min(340px, calc(100vw - 24px));
    height: min(260px, calc(100dvh - 96px));
    bottom: 44px;
  }
  .action-dock {
    flex: 1;
    min-width: 0;
    gap: 6px;
    align-items: center;
  }
  .btn-world-switch {
    height: 38px;
    padding: 0 10px;
    min-width: auto;
    border-radius: 10px;
    gap: 4px;
    flex-shrink: 0;
  }
  .switch-icon { font-size: 15px; }
  .switch-label { font-size: 11px; }
  .dock-buttons {
    flex: 1;
    min-width: 0;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0;
  }
  .dock-btn {
    width: 44px;
    height: 38px;
    border-radius: 9px;
    flex-shrink: 0;
  }
  .dock-icon { font-size: 15px; }
  .dock-text { font-size: 9px; }

  /* Modals fit cleanly inside 390px tall mobile landscape screens */
  .modal-overlay {
    padding: 6px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  }
  .modal-box,
  .modal-box.modal-wide {
    width: min(96vw, 760px);
    max-width: 96vw;
    max-height: calc(100dvh - 12px);
    border-radius: 12px;
  }
  .modal-header {
    padding: 8px 12px;
  }
  .modal-title {
    font-size: 14px;
  }
  .modal-body {
    padding: 10px 12px;
  }
  .barracks-layout,
  .heroes-layout,
  .reports-layout {
    grid-template-columns: 210px 1fr;
    gap: 10px;
  }
  .reports-inbox {
    max-height: calc(100dvh - 110px);
  }
  .report-ref-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .fk-wave-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .toast-stack {
    top: 46px;
    right: 54px;
    max-width: 250px;
  }
  .toast-item {
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* ===== LATE-GAME EXPANSION 1A: T4/T5, SIEGE, LORD TALENTS, BLACK MARKET & ALLIANCE GIFTS ===== */
.lord-avatar {
  position: relative;
}
.lord-lv-chip {
  position: absolute;
  right: -5px;
  bottom: -4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b, #b45309);
  border: 1px solid #fef08a;
  color: #161006;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.25;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.tier-pill.t4 {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.28), rgba(245, 158, 11, 0.34));
  border: 1px solid rgba(251, 191, 36, 0.72);
  color: #fef08a;
}
.tier-pill.t5 {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.36), rgba(245, 158, 11, 0.4));
  border: 1px solid #e879f9;
  color: #fdf4ff;
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.32);
}

.branch-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.right-utility-rail {
  max-height: calc(100dvh - 150px);
  overflow-y: auto;
  scrollbar-width: none;
}
.right-utility-rail::-webkit-scrollbar {
  display: none;
}
.talent-pill-accent {
  border-color: rgba(250, 204, 21, 0.55);
  background: linear-gradient(180deg, rgba(66, 46, 14, 0.9), rgba(26, 18, 10, 0.92));
}
.merchant-pill-accent {
  border-color: rgba(52, 211, 153, 0.5);
  background: linear-gradient(180deg, rgba(14, 52, 46, 0.9), rgba(10, 24, 24, 0.92));
}

/* Lord Talent Tree */
.talent-branch-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 8px;
}
.talent-branch-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(14, 18, 30, 0.86);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}
.talent-branch-tab:hover {
  border-color: rgba(246, 215, 134, 0.45);
}
.talent-branch-tab.active {
  border-color: var(--branch-accent, #f6d786);
  background: linear-gradient(135deg, rgba(32, 36, 54, 0.96), rgba(18, 22, 34, 0.95));
  box-shadow: 0 0 18px rgba(246, 215, 134, 0.16);
}
.tbt-ico {
  font-size: 22px;
  line-height: 1;
}
.tbt-name {
  font-size: 14px;
  font-weight: 800;
  color: #fde39d;
}
.tbt-pts {
  font-size: 11px;
  color: #b8b0a0;
  margin-top: 2px;
}
.talent-card {
  padding: 12px 14px;
  border-radius: 11px;
  background: rgba(15, 19, 32, 0.9);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.talent-card.is-learned {
  border-color: rgba(246, 215, 134, 0.52);
  background: linear-gradient(160deg, rgba(44, 34, 18, 0.42), rgba(15, 19, 32, 0.94));
}
.talent-card.is-locked {
  opacity: 0.68;
  border-style: dashed;
}
.tc-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.tc-ico {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(246, 215, 134, 0.1);
  border: 1px solid rgba(246, 215, 134, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.tc-lv-badge {
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(8, 12, 22, 0.9);
  border: 1px solid rgba(246, 215, 134, 0.35);
  color: #fde39d;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.tc-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* Black Market Merchant */
.merchant-card {
  position: relative;
  padding: 13px 14px;
  border-radius: 12px;
  background: linear-gradient(155deg, rgba(16, 28, 36, 0.94), rgba(12, 16, 26, 0.94));
  border: 1.5px solid rgba(52, 211, 153, 0.32);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.merchant-card.is-sold {
  opacity: 0.58;
  border-color: rgba(255, 255, 255, 0.12);
}
.merch-discount-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.4px;
}
.mc-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-right: 64px;
}
.mc-ico {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.merch-rw-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.merch-rw-pill {
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(246, 215, 134, 0.12);
  border: 1px solid rgba(246, 215, 134, 0.3);
  color: #fef08a;
  font-size: 11px;
  font-weight: 700;
}
.mc-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Alliance Gift Chests */
.gift-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 390px;
  overflow-y: auto;
}
.gift-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 19, 32, 0.9);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
}
.gift-card.rarity-silver { border-color: rgba(96, 165, 250, 0.45); }
.gift-card.rarity-gold { border-color: rgba(251, 191, 36, 0.55); background: rgba(42, 32, 14, 0.42); }
.gift-card.rarity-royal { border-color: rgba(192, 132, 252, 0.62); background: rgba(42, 18, 56, 0.42); }
.gift-card.is-claimed { opacity: 0.62; }
.gc-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(10, 14, 24, 0.85);
  border: 1.5px solid #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.gc-body {
  flex: 1;
  min-width: 0;
}
.gc-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #f8f2e4;
}
.gc-meta {
  font-size: 11px;
  color: #a8a090;
  margin-top: 4px;
}
.gc-action {
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .talent-branch-tabs { grid-template-columns: 1fr; }
  .branch-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===== MODAL SCROLL SAFETY & TOP-100 LEADERBOARD STICKY SCROLL ===== */
.modal-body > * {
  flex-shrink: 0;
}
.leaderboard-table-wrap {
  padding: 0 !important;
  flex: 1 1 auto !important;
  min-height: 260px;
  max-height: 54vh;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(246, 215, 134, 0.55) rgba(10, 14, 24, 0.6);
}
.leaderboard-table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.leaderboard-table-wrap::-webkit-scrollbar-track {
  background: rgba(10, 14, 24, 0.6);
  border-radius: 0 12px 12px 0;
}
.leaderboard-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(246, 215, 134, 0.48);
  border-radius: 999px;
}
.leaderboard-table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(246, 215, 134, 0.78);
}
.leaderboard-table-wrap .royal-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #1b2233;
  box-shadow: inset 0 -1px 0 rgba(246, 215, 134, 0.28);
}
