:root {
  --bg-deep: #0c0f11;
  --bg-panel: #232018;
  --bg-panel-2: #2c281f;
  --edge: #746547;
  --edge-soft: #4f4635;
  --text-main: #ebdfbd;
  --text-dim: #b5a583;
  --good: #8ecb7b;
  --bad: #ca6b5d;
  --rare: #8fc0e0;
  --epic: #b58fdd;
  --legendary: #e1b367;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 8px;
  background: radial-gradient(circle at center, #0a1418, #020507);
  color: var(--text-main);
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

#game-root {
  position: relative;
  width: min(1600px, 96vw);
  height: min(900px, 92vh);
  margin: 0;
  display: grid;
  grid-template-rows: 1fr;
  border: 2px solid #8f7440;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
  background: linear-gradient(180deg, rgba(40, 31, 20, 0.96), rgba(18, 14, 10, 0.96));
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
  background: #171b1e;
}

#fog-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(0, 0, 0, 0) 42%, rgba(8, 11, 13, 0.48) 100%),
    linear-gradient(180deg, rgba(41, 45, 52, 0.12), rgba(7, 10, 12, 0.1));
}

#gameplay-frame {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  padding: 10px;
  height: 100%;
  min-height: 0;
}

.gameplay-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

.gameplay-main.with-side-panel {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 29%);
}

#canvas-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #6f5f45;
  box-shadow: inset 0 0 0 1px #3a3124;
  overflow: hidden;
  background: #171b1e;
}

.hud-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  padding: 8px 10px;
  border: 2px solid var(--edge);
  background:
    linear-gradient(180deg, rgba(53, 47, 36, 0.96), rgba(28, 25, 19, 0.96)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0 3px, rgba(0, 0, 0, 0) 3px 7px);
  box-shadow: inset 0 0 0 1px #3d3426;
  font-size: 14px;
  backdrop-filter: blur(1px);
}

.hud-strip.wave-flash {
  animation: waveHudFlash 420ms ease-out;
}

#hud {
  position: relative;
  z-index: 20;
}

.label {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.screen-panel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 10px;
  z-index: 40;
  background: rgba(6, 7, 9, 0.5);
  animation: fadeInPanel 180ms ease-out;
}

.modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  z-index: 50;
  background: rgba(6, 7, 9, 0.66);
  animation: fadeInPanel 180ms ease-out;
}

.panel {
  background:
    linear-gradient(180deg, rgba(56, 50, 38, 0.96), rgba(29, 26, 20, 0.96)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 2px, rgba(0, 0, 0, 0) 2px 6px);
  border: 3px solid var(--edge);
  box-shadow:
    inset 0 0 0 1px #3f3527,
    inset 0 0 0 3px rgba(15, 13, 10, 0.85),
    0 16px 32px rgba(0, 0, 0, 0.45),
    0 2px 0 rgba(202, 174, 117, 0.12);
  padding: 16px;
  max-width: 1280px;
  width: min(1280px, calc(100% - 20px));
  animation: riseIn 180ms ease-out;
}

.screen-panel .panel {
  min-height: calc(100% - 20px);
}

.title-panel {
  max-width: 760px;
}

.screen-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.screen-header {
  display: grid;
  gap: 4px;
}

.screen-content {
  min-height: 0;
}

.screen-footer {
  margin-top: auto;
}

.menu-content {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.menu-actions {
  display: grid;
  gap: 10px;
  width: min(340px, 100%);
}

.subtitle {
  color: var(--text-dim);
}

h1,
h2,
h3,
h4 {
  font-family: "Book Antiqua", "Palatino Linotype", serif;
  letter-spacing: 0.02em;
}

.btn {
  border: 2px solid var(--edge);
  background: linear-gradient(180deg, #3b3428, #29231a);
  color: var(--text-main);
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
  font-family: "Palatino Linotype", serif;
  transition: transform 100ms ease, filter 140ms ease, box-shadow 140ms ease, border-color 120ms ease;
}

.btn:hover {
  background: linear-gradient(180deg, #4b4233, #31291f);
  filter: brightness(1.06);
  transform: translateY(-1px);
  border-color: #8e7a54;
}

.btn.primary {
  border-color: #a18851;
  background: linear-gradient(180deg, #6d5730, #4a3b23);
  box-shadow: inset 0 0 0 1px rgba(224, 188, 112, 0.25);
}

.btn.primary:hover {
  border-color: #c29f56;
  box-shadow: inset 0 0 0 1px rgba(244, 206, 118, 0.35), 0 0 8px rgba(214, 163, 66, 0.2);
}

.btn:active {
  transform: translateY(0);
  filter: brightness(0.96);
  box-shadow: inset 0 0 0 1px rgba(255, 235, 168, 0.2), 0 0 10px rgba(194, 140, 44, 0.28);
}

.btn.small {
  padding: 6px 10px;
}

.hidden {
  display: none !important;
}

.active {
  display: flex;
}

.card-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  border: 2px solid var(--edge-soft);
  background: linear-gradient(180deg, rgba(33, 30, 23, 0.95), rgba(23, 20, 16, 0.95));
  box-shadow: inset 0 0 0 1px rgba(98, 87, 66, 0.5);
  padding: 10px;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #7b6a4c;
  box-shadow: inset 0 0 0 1px rgba(142, 123, 87, 0.64), 0 6px 12px rgba(0, 0, 0, 0.25);
  filter: brightness(1.04);
}

.upgrade-card {
  border-color: #6b5a3f;
}

.upgrade-card:hover {
  border-color: #b79454;
  box-shadow: inset 0 0 0 1px rgba(182, 146, 72, 0.75), 0 8px 14px rgba(0, 0, 0, 0.32);
}

.card h3,
.card h4 {
  margin: 0 0 6px;
}

.row-end {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.sigils-readout {
  color: #d7c590;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.campaign-upgrade-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
}

.campaign-upgrades-panel .screen-content {
  overflow: auto;
  padding-right: 4px;
}

.campaign-branch h3 {
  margin: 0 0 8px;
  color: #e8d5a5;
}

.campaign-upgrade-item {
  display: grid;
  gap: 6px;
}

.war-table-panel {
  max-width: none;
  width: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.war-table-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.war-table-layout {
  display: grid;
  grid-template-columns: minmax(0, 68%) minmax(300px, 32%);
  gap: 12px;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

.war-table-panel .screen-content {
  min-height: 0;
  overflow: hidden;
}

.campaign-war-map {
  position: relative;
  overflow: hidden;
  border: 2px solid #79664a;
  background:
    radial-gradient(circle at 75% 18%, rgba(85, 106, 117, 0.22), transparent 34%),
    radial-gradient(circle at 25% 72%, rgba(58, 74, 62, 0.26), transparent 37%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0 2px, rgba(0, 0, 0, 0) 2px 5px),
    linear-gradient(180deg, #5b4e38, #403623);
  box-shadow: inset 0 0 0 1px rgba(34, 27, 18, 0.8);
  min-height: 420px;
  height: 100%;
  aspect-ratio: auto;
}

.campaign-ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fog-drift {
  background:
    radial-gradient(circle at 24% 55%, rgba(142, 171, 142, 0.12), transparent 24%),
    radial-gradient(circle at 34% 48%, rgba(118, 146, 118, 0.1), transparent 26%);
  mix-blend-mode: screen;
  animation: fogDrift 18s linear infinite alternate;
}

.sea-shimmer {
  background:
    linear-gradient(105deg, transparent 62%, rgba(153, 186, 205, 0.15) 68%, transparent 74%),
    linear-gradient(125deg, transparent 74%, rgba(111, 150, 171, 0.12) 80%, transparent 86%);
  opacity: 0.45;
  animation: seaShimmer 6.8s ease-in-out infinite;
}

.dust-drift {
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 226, 165, 0.11) 0 1px, transparent 2px),
    radial-gradient(circle at 42% 62%, rgba(230, 198, 140, 0.1) 0 1px, transparent 2px),
    radial-gradient(circle at 78% 31%, rgba(255, 220, 152, 0.09) 0 1px, transparent 2px),
    radial-gradient(circle at 64% 74%, rgba(230, 198, 140, 0.08) 0 1px, transparent 2px);
  opacity: 0.35;
  animation: dustDrift 14s linear infinite;
}

.campaign-map-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 55%, rgba(16, 12, 9, 0.3) 100%),
    linear-gradient(180deg, rgba(66, 46, 24, 0.08), rgba(0, 0, 0, 0));
}

.campaign-region {
  position: absolute;
  border-radius: 18px;
  border: 1px solid rgba(45, 33, 22, 0.45);
  filter: saturate(0.9);
}

.region-coast {
  left: 2%;
  top: 58%;
  width: 96%;
  height: 34%;
  background: linear-gradient(180deg, rgba(59, 81, 95, 0.35), rgba(39, 58, 69, 0.35));
  border-radius: 32px;
}

.region-bog {
  left: 14%;
  top: 42%;
  width: 20%;
  height: 20%;
  background: linear-gradient(180deg, rgba(64, 84, 50, 0.42), rgba(48, 64, 38, 0.42));
}

.region-ruins {
  left: 30%;
  top: 28%;
  width: 20%;
  height: 18%;
  background: linear-gradient(180deg, rgba(96, 84, 66, 0.34), rgba(71, 61, 50, 0.34));
}

.region-cliffs {
  left: 46%;
  top: 18%;
  width: 18%;
  height: 18%;
  background: linear-gradient(180deg, rgba(89, 95, 105, 0.33), rgba(61, 66, 74, 0.33));
}

.region-warrens {
  left: 60%;
  top: 35%;
  width: 20%;
  height: 20%;
  background: linear-gradient(180deg, rgba(70, 67, 89, 0.33), rgba(52, 49, 68, 0.33));
}

.region-rise {
  left: 75%;
  top: 47%;
  width: 18%;
  height: 21%;
  background: linear-gradient(180deg, rgba(92, 63, 66, 0.36), rgba(70, 47, 50, 0.36));
}

.region-thornreach {
  left: 86%;
  top: 66%;
  width: 11%;
  height: 18%;
  background: linear-gradient(180deg, rgba(118, 93, 57, 0.4), rgba(88, 70, 43, 0.4));
}

.campaign-routes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.route-line {
  stroke-linecap: round;
  stroke-width: 1.1;
}

.route-line.unlocked {
  stroke: rgba(207, 185, 129, 0.85);
  filter: drop-shadow(0 0 2px rgba(224, 183, 80, 0.35));
  animation: routeGlow 2.4s ease-in-out infinite;
}

.route-line.locked {
  stroke: rgba(93, 79, 58, 0.55);
  stroke-dasharray: 1.2 1.2;
}

.campaign-node-layer {
  position: absolute;
  inset: 0;
}

.campaign-node {
  position: absolute;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid #584a33;
  background: radial-gradient(circle at 40% 30%, #6f5d43, #3f3425);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, filter 120ms ease;
}

.campaign-node .node-core {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 35%, #ccbb8f, #8a744f);
}

.campaign-node.locked {
  filter: grayscale(0.7) brightness(0.64);
  cursor: default;
}

.campaign-node.unlocked {
  border-color: #9f8455;
  box-shadow: 0 0 10px rgba(199, 159, 85, 0.18);
  animation: nodePulse 2.8s ease-in-out infinite;
}

.campaign-node.cleared {
  border-color: #9ec995;
  box-shadow: 0 0 10px rgba(118, 186, 108, 0.24);
  animation: clearedShimmer 4.2s ease-in-out infinite;
}

.campaign-node.selected {
  transform: translate(-50%, -50%) scale(1.09);
  border-color: #d8b36a;
  box-shadow: 0 0 14px rgba(223, 174, 80, 0.45), 0 0 26px rgba(234, 188, 90, 0.35);
  animation: selectedPulse 1.6s ease-in-out infinite;
}

.campaign-node:not(.locked):hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.node-clear-mark {
  position: absolute;
  right: -5px;
  top: -7px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #2e5e39;
  border: 1px solid #9ec995;
  color: #d7f2d3;
  font-size: 10px;
  line-height: 13px;
  text-align: center;
  animation: clearMarkShimmer 3.8s ease-in-out infinite;
}

.campaign-mission-panel {
  border: 2px solid #79664a;
  background: linear-gradient(180deg, rgba(41, 35, 25, 0.95), rgba(25, 21, 16, 0.95));
  box-shadow: inset 0 0 0 1px rgba(59, 49, 34, 0.85);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 170ms ease, box-shadow 200ms ease, transform 180ms ease;
  animation: panelEnter 220ms ease-out;
  align-self: start;
  min-height: 0;
  max-width: 100%;
  height: fit-content;
}

.campaign-mission-panel:hover {
  border-color: #9f8455;
  box-shadow: inset 0 0 0 1px rgba(103, 82, 45, 0.9), 0 6px 14px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.campaign-mission-panel h3 {
  margin: 0 0 6px;
}

.campaign-mission-panel p {
  margin: 0;
}

.war-table-footer {
  margin-top: 0;
}

.campaign-map-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
}

.campaign-map-footer-left,
.campaign-map-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

#campaign-mission-panel .row-end {
  margin-top: auto;
}

#btn-campaign-deploy {
  box-shadow: inset 0 0 0 1px rgba(244, 206, 118, 0.36), 0 0 8px rgba(214, 163, 66, 0.22);
  animation: deployPulse 2.2s ease-in-out infinite;
}

#btn-campaign-deploy:disabled {
  animation: none;
  box-shadow: none;
}

.floating-panel {
  position: absolute;
  z-index: 30;
  min-width: 320px;
  max-width: 368px;
  border: 2px solid var(--edge);
  background: linear-gradient(180deg, rgba(42, 36, 27, 0.97), rgba(26, 22, 17, 0.97));
  box-shadow: inset 0 0 0 1px #3d3528, 0 10px 16px rgba(0, 0, 0, 0.42);
  padding: 7px;
  transition: opacity 120ms ease, transform 120ms ease;
}

#build-menu h4 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.build-menu-sub {
  margin: 1px 0 6px;
  font-size: 12px;
}

.build-menu-list {
  display: grid;
  gap: 6px;
  max-height: 300px;
  overflow: auto;
  padding-right: 2px;
}

.build-row {
  margin-bottom: 0;
  padding: 6px 7px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.build-row-main {
  min-width: 0;
}

.tower-title-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.build-cost {
  color: #d5be86;
  font-size: 12px;
  white-space: nowrap;
}

.build-meta {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.build-btn {
  min-width: 74px;
  justify-self: end;
}

.build-row.disabled {
  opacity: 0.72;
}

.side-panel {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  z-index: 30;
  border: 2px solid var(--edge);
  background: linear-gradient(180deg, rgba(39, 34, 26, 0.97), rgba(24, 21, 17, 0.97));
  box-shadow: inset 0 0 0 1px #3d3528;
  padding: 10px;
  max-height: 100%;
  overflow: auto;
  transition: opacity 130ms ease, transform 130ms ease;
}

#tower-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px;
}

.tower-panel-shell {
  flex: 1;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.tower-panel-fixed {
  display: grid;
  gap: 8px;
}

.guild-tower-panel .tower-panel-fixed {
  gap: 6px;
}

.guild-tower-panel .tower-section {
  padding: 5px 6px;
}

.tower-panel-header {
  border: 1px solid #5b4f3c;
  background: linear-gradient(180deg, rgba(47, 40, 29, 0.95), rgba(33, 28, 21, 0.95));
  padding: 8px;
}

.tower-panel-title-wrap h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.tower-level-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tower-level-label {
  font-size: 12px;
  color: #d8c292;
}

.tower-level-pips {
  display: inline-flex;
  gap: 4px;
}

.tower-level-pip {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  border: 1px solid #6f5d41;
  background: #2a241b;
}

.tower-level-pip.filled {
  background: linear-gradient(180deg, #e8d89f, #b89654);
  border-color: #bea064;
  box-shadow: 0 0 4px rgba(226, 190, 107, 0.3);
}

.tower-kill-count {
  margin-top: 6px;
  font-size: 12px;
  color: #c8b283;
}

.tower-xp-block {
  border: 1px solid #5b4f3c;
  background: linear-gradient(180deg, rgba(41, 35, 26, 0.95), rgba(27, 23, 18, 0.95));
  padding: 6px 8px;
}

.tower-xp-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #d8c292;
  margin-bottom: 4px;
}

.tower-xp-bar {
  height: 10px;
  border: 1px solid #5a4d36;
  background: #1d1913;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.tower-xp-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #8cae67, #d6bf79);
  box-shadow: inset 0 0 0 1px rgba(245, 230, 170, 0.22);
}

.tower-section {
  border: 1px solid #544835;
  background: linear-gradient(180deg, rgba(39, 34, 26, 0.95), rgba(27, 23, 18, 0.95));
  padding: 7px;
}

.tower-section h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: #e2cea1;
}

.guild-tower-panel .tower-section h4 {
  margin-bottom: 4px;
}

.guild-tower-panel .tower-stats-grid {
  gap: 2px;
}

.guild-tower-panel .tower-stat-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  padding-bottom: 1px;
}

.guild-tower-panel .tower-stat-label {
  white-space: nowrap;
}

.guild-tower-panel .tower-stat-value {
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 150px;
}

.tower-stats-grid {
  display: grid;
  gap: 4px;
}

.tower-stat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: baseline;
  border-bottom: 1px dashed rgba(102, 87, 61, 0.45);
  padding-bottom: 2px;
}

.tower-stat-label {
  font-size: 12px;
  color: #bca97f;
}

.tower-stat-value {
  font-size: 12px;
  color: #e5d8b7;
}

.tower-stat-bonus {
  color: #8fc0e0;
  font-style: normal;
  margin-left: 4px;
}

.tower-bonus-line {
  margin-top: 6px;
  font-size: 12px;
}

.tower-equip-section .list-item {
  margin-bottom: 5px;
  padding: 6px;
}

.tower-equip-section .btn.small {
  margin-top: 6px;
  margin-right: 6px;
}

.tower-slot-card .tower-slot-head {
  display: grid;
  gap: 2px;
}

.tower-slot-options {
  margin-top: 6px;
  display: grid;
  gap: 4px;
}

.guild-path-section {
  display: grid;
  gap: 4px;
}

.guild-path-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.guild-path-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
}

.btn.guild-path-btn {
  padding: 3px 5px;
  font-size: 10px;
  line-height: 1.2;
  min-height: 24px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn.guild-path-btn.active-path {
  border-color: #c8a869;
  box-shadow: inset 0 0 0 1px rgba(214, 176, 96, 0.35);
}

.guild-bonus-section {
  padding-top: 4px;
  padding-bottom: 4px;
}

.guild-bonus-inline {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guild-bonus-list {
  margin: 4px 0 0;
  padding-left: 15px;
  display: grid;
  gap: 2px;
}

.guild-bonus-list li {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.2;
}

.guild-tower-panel .tower-equip-section .list-item {
  padding: 5px;
  margin-bottom: 4px;
}

.guild-tower-panel .tower-equip-section .btn.small {
  margin-top: 4px;
  padding: 4px 7px;
  font-size: 11px;
}

.guild-tower-panel .tower-slot-head {
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 6px;
}

.guild-tower-panel .tower-slot-head .statline {
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-panel {
  max-width: 1080px;
  min-height: 0;
}

.audio-panel {
  max-width: 760px;
  width: min(760px, calc(100% - 40px));
}

.audio-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.audio-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid #5f533d;
  background: linear-gradient(180deg, rgba(45, 38, 29, 0.9), rgba(30, 26, 20, 0.9));
  padding: 8px 10px;
  color: var(--text-main);
}

.audio-row input[type="range"] {
  width: 260px;
}

.shop-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.list {
  border: 2px solid var(--edge-soft);
  background: linear-gradient(180deg, rgba(23, 20, 16, 0.96), rgba(15, 13, 11, 0.96));
  max-height: 320px;
  overflow: auto;
  padding: 8px;
}

.list-item {
  border: 1px solid #4d4535;
  padding: 8px;
  margin-bottom: 6px;
  background: linear-gradient(180deg, rgba(40, 35, 27, 0.95), rgba(28, 25, 20, 0.95));
  transition: border-color 120ms ease, background 120ms ease;
}

.list-item:hover {
  border-color: #79694d;
  background: linear-gradient(180deg, rgba(49, 43, 33, 0.95), rgba(35, 31, 25, 0.95));
}

.shop-item:hover {
  box-shadow: inset 0 0 0 1px rgba(173, 145, 92, 0.55);
}

.inventory-item:hover {
  box-shadow: inset 0 0 0 1px rgba(129, 171, 127, 0.45);
}

.tower-outfit-block {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tower-outfit-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin-top: 0;
  padding-right: 2px;
}

.tower-outfit-item {
  margin-bottom: 0;
  padding: 7px;
}

.tower-outfit-item .btn {
  margin-top: 6px;
}

.guild-tower-panel .tower-outfit-item {
  padding: 5px 6px;
}

.guild-tower-panel .tower-outfit-item .statline {
  font-size: 12px;
}

.guild-tower-panel .tower-outfit-item .btn {
  margin-top: 4px;
  padding: 4px 8px;
  font-size: 11px;
}

.tower-panel-shell.level-pulse .tower-panel-header,
.tower-panel-shell.level-pulse .tower-xp-block {
  box-shadow: 0 0 10px rgba(225, 190, 107, 0.32);
}

#build-menu:not(.hidden),
#tower-panel:not(.hidden) {
  transform: translateY(0);
  opacity: 1;
}

#build-menu.hidden,
#tower-panel.hidden {
  transform: translateY(6px);
  opacity: 0;
}

.rarity-common { color: var(--text-main); }
.rarity-elemental,
.rarity-tactical,
.rarity-support { color: var(--rare); }
.rarity-legendary { color: var(--legendary); }

.tooltip {
  position: absolute;
  z-index: 60;
  background: #13110e;
  border: 1px solid var(--edge);
  padding: 6px 8px;
  max-width: 260px;
  font-size: 12px;
}

.boot-status {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 80;
  background: rgba(0, 0, 0, 0.72);
  color: #ffe6a5;
  border: 1px solid #8f7a4c;
  padding: 4px 6px;
  font-size: 11px;
}

.item-actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}

.statline {
  font-size: 13px;
  color: var(--text-dim);
}

@keyframes fadeInPanel {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes riseIn {
  from {
    transform: translateY(6px);
    opacity: 0.92;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes waveHudFlash {
  0% {
    box-shadow: inset 0 0 0 1px #3d3426, 0 0 0 rgba(230, 190, 103, 0);
    filter: brightness(1);
  }
  30% {
    box-shadow: inset 0 0 0 1px #6a5832, 0 0 16px rgba(230, 190, 103, 0.35);
    filter: brightness(1.09);
  }
  100% {
    box-shadow: inset 0 0 0 1px #3d3426, 0 0 0 rgba(230, 190, 103, 0);
    filter: brightness(1);
  }
}

@keyframes nodePulse {
  0%, 100% { box-shadow: 0 0 8px rgba(199, 159, 85, 0.16); }
  50% { box-shadow: 0 0 14px rgba(214, 174, 96, 0.32); }
}

@keyframes selectedPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(223, 174, 80, 0.45), 0 0 22px rgba(234, 188, 90, 0.28); }
  50% { box-shadow: 0 0 18px rgba(234, 188, 90, 0.62), 0 0 30px rgba(245, 203, 112, 0.4); }
}

@keyframes clearedShimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

@keyframes clearMarkShimmer {
  0%, 100% { opacity: 0.82; }
  50% { opacity: 1; }
}

@keyframes routeGlow {
  0%, 100% { stroke-opacity: 0.78; }
  50% { stroke-opacity: 1; }
}

@keyframes fogDrift {
  0% { transform: translateX(-1.2%) translateY(0); opacity: 0.66; }
  50% { opacity: 0.82; }
  100% { transform: translateX(1.6%) translateY(-0.8%); opacity: 0.62; }
}

@keyframes seaShimmer {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.56; }
}

@keyframes dustDrift {
  0% { transform: translateY(0) translateX(0); opacity: 0.25; }
  50% { transform: translateY(-0.6%) translateX(0.5%); opacity: 0.42; }
  100% { transform: translateY(-1.1%) translateX(1.1%); opacity: 0.24; }
}

@keyframes panelEnter {
  from { opacity: 0.9; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes deployPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

@media (max-width: 860px) {
  body {
    padding: 6px;
  }

  #game-root {
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
  }

  #gameplay-frame {
    min-height: 0;
    padding: 8px;
  }

  .gameplay-main {
    grid-template-columns: 1fr;
  }

  .gameplay-main.with-side-panel {
    grid-template-columns: 1fr;
  }

  #canvas-wrapper {
    height: 60vh;
  }

  .war-table-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .campaign-war-map {
    min-height: 300px;
    height: auto;
  }

  .campaign-upgrade-grid {
    grid-template-columns: 1fr;
  }

  .shop-layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    width: 100%;
  }
}
