/* v2.34 systems and interface refinement */

/* Persistent top command bar */
.top.compact-top.v234-has-end-turn {
  position: sticky;
  top: 0;
  z-index: 90;
}

.hud-controls .hud-end-turn {
  min-width: 92px;
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 7px 12px;
  border-color: rgba(222, 91, 70, .62);
  color: #fff0e9;
  background: linear-gradient(180deg, rgba(150, 50, 39, .96), rgba(91, 29, 25, .98));
  box-shadow: 0 5px 16px rgba(70, 11, 9, .28);
}

.hud-controls .hud-end-turn:hover:not(:disabled) {
  border-color: #ffb09e;
  transform: translateY(-1px);
}

.hud-controls .hud-end-turn small {
  color: rgba(255, 224, 215, .72);
  font-size: 8px;
  font-weight: 700;
}

.hud-controls .hud-end-turn:disabled {
  border-color: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .42);
  background: rgba(50, 50, 52, .75);
  box-shadow: none;
}

/* Second general trait */
.compact-general-trait.secondary,
.trait-description.secondary {
  border-color: rgba(93, 144, 189, .34);
  background: linear-gradient(90deg, rgba(48, 87, 121, .14), rgba(20, 25, 30, .08));
}

.compact-general-trait.secondary b,
.trait-description.secondary b,
.trait-chip.secondary {
  color: #a9d4f0;
}

.trait-chip.secondary {
  border-color: rgba(100, 163, 207, .5) !important;
  background: rgba(34, 67, 91, .42);
}

/* Generic synergy catalog */
.generic-combo-catalog {
  margin: 10px 0 16px;
  border: 1px solid rgba(118, 151, 177, .28);
  border-radius: 12px;
  background: rgba(18, 25, 31, .74);
}

.generic-combo-catalog summary {
  padding: 11px 13px;
  color: #b9d6e9;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.generic-combo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 0 10px 10px;
}

.generic-combo-grid article {
  display: grid;
  gap: 3px;
  min-height: 62px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 9px;
  background: rgba(255, 255, 255, .035);
}

.generic-combo-grid b {
  color: #e8d2a7;
  font-size: 11px;
}

.generic-combo-grid span {
  color: rgba(255, 255, 255, .62);
  font-size: 9px;
  line-height: 1.45;
}

/* Road legibility and exact action state */
.v234-route-help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 9px;
  margin: 4px 10px 7px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 9px;
  color: rgba(255, 255, 255, .62);
  background: rgba(10, 13, 15, .74);
  font-size: 8px;
}

.v234-route-help b { color: #ead09a; }

.route-group[data-route="land"] .route-shadow {
  stroke-width: 4.6;
  opacity: .64;
}

.route-group[data-route="land"] .route-base {
  stroke-width: 2.45;
  opacity: .9;
}

.route-group[data-route="land"] .route-highlight {
  stroke-width: 1.15;
  opacity: .54;
}

.route-group.selected-connected-route.unavailable-route .route-base,
.route-group.selected-connected-route.unavailable-route .route-highlight {
  stroke: #77756e;
  opacity: .42;
}

.route-group.attackable-route .route-shadow {
  stroke: rgba(117, 16, 11, .78);
  stroke-width: 6.4;
}

.route-group.attackable-route .route-base {
  stroke: #f1674c;
  stroke-width: 3.8;
  filter: url(#routeGlow);
}

.route-group.attackable-route .route-highlight {
  stroke: #ffe5a8;
  stroke-width: 1.7;
  stroke-dasharray: 4 3;
  opacity: 1;
  animation: routeFlow .6s linear infinite;
}

.route-group.movable-route .route-shadow {
  stroke: rgba(17, 79, 48, .72);
  stroke-width: 5.8;
}

.route-group.movable-route .route-base {
  stroke: #6cc88b;
  stroke-width: 3.4;
}

.route-group.movable-route .route-highlight {
  stroke: #d8ffe3;
  stroke-width: 1.45;
  opacity: .9;
}

.route-group.sea-route .route-shadow {
  opacity: .22;
}

.route-group.sea-route .route-base {
  stroke: #4a8da8;
  stroke-width: 1.65;
  stroke-dasharray: 3 6;
  opacity: .48;
}

.route-group.sea-route .route-highlight {
  stroke: #a7ddea;
  stroke-width: .8;
  stroke-dasharray: 1 7;
  opacity: .58;
}

.legend-line.attackable { background: #f1674c !important; box-shadow: 0 0 5px #f1674c; }
.legend-line.movable { background: #6cc88b !important; box-shadow: 0 0 5px #6cc88b; }

/* Painted major cities should stay readable but not cover their roads. */
.node .city-castle-shell .city-node-icon[src*="/painted/"] {
  border-radius: 12px;
  object-fit: cover;
  clip-path: inset(4% round 11px);
  filter: saturate(.9) contrast(1.04) drop-shadow(0 5px 5px rgba(0, 0, 0, .62));
}

/* City command cleanup */
.city-doctrine-help {
  margin-top: 9px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
  background: rgba(255, 255, 255, .025);
}

.city-doctrine-help summary {
  padding: 9px 11px;
  color: #d8c49d;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

.city-doctrine-help > div {
  padding: 0 11px 8px;
}

.city-doctrine-help p {
  margin: 5px 0;
}

/* Strong battle hit feedback */
.battle-stage.round-sequence {
  overflow: hidden;
}

.battle-stage .v234-impact-shockwave {
  position: absolute;
  z-index: 30;
  left: 50%;
  top: 44%;
  width: 36px;
  height: 36px;
  border: 4px solid rgba(255, 226, 153, .92);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(.15);
  box-shadow: 0 0 25px rgba(255, 148, 63, .92), inset 0 0 18px rgba(255, 255, 255, .7);
  opacity: 0;
  pointer-events: none;
  animation: v234-shockwave .7s 1.45s cubic-bezier(.14, .8, .22, 1) both;
}

.battle-stage .v234-impact-shockwave.critical,
.battle-stage .v234-impact-shockwave.comeback {
  border-width: 6px;
  box-shadow: 0 0 38px rgba(255, 56, 33, .96), inset 0 0 22px rgba(255, 243, 192, .88);
}

.v234-impact-callout {
  position: absolute;
  z-index: 35;
  left: 50%;
  top: 34%;
  min-width: 180px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 10px 20px 11px;
  border: 2px solid rgba(255, 218, 145, .78);
  border-radius: 13px;
  transform: translate(-50%, -50%);
  background: linear-gradient(155deg, rgba(82, 25, 18, .96), rgba(20, 11, 12, .97));
  box-shadow: 0 15px 36px rgba(0, 0, 0, .7), 0 0 28px rgba(245, 109, 47, .44);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  animation: v234-impact-title 1.05s 1.62s cubic-bezier(.18, .85, .18, 1) both;
}

.v234-impact-callout strong {
  color: #fff3c8;
  font-size: clamp(26px, 5vw, 46px);
  line-height: 1;
  letter-spacing: -.04em;
  text-shadow: 0 3px 0 rgba(96, 22, 14, .9), 0 0 18px rgba(255, 172, 69, .8);
}

.v234-impact-callout span {
  color: rgba(255, 232, 199, .8);
  font-size: 10px;
  font-weight: 800;
}

.v234-impact-callout.scheme {
  border-color: rgba(137, 172, 255, .82);
  background: linear-gradient(155deg, rgba(34, 51, 111, .96), rgba(17, 19, 43, .97));
  box-shadow: 0 15px 36px rgba(0, 0, 0, .7), 0 0 30px rgba(96, 135, 255, .48);
}

.v234-impact-callout.fire {
  border-color: rgba(255, 155, 67, .9);
  background: linear-gradient(155deg, rgba(148, 47, 13, .98), rgba(54, 14, 9, .98));
}

.v234-impact-callout.comeback {
  border-color: rgba(255, 216, 87, .94);
  background: linear-gradient(155deg, rgba(146, 32, 24, .98), rgba(75, 18, 34, .98));
  box-shadow: 0 15px 36px rgba(0, 0, 0, .74), 0 0 42px rgba(255, 56, 39, .68);
}

.battle-screen.battle-visual-upgraded .damage-pop {
  min-width: 84px;
  padding: 4px 8px;
  border: 2px solid rgba(255, 232, 198, .5);
  border-radius: 10px;
  color: #fff1d1;
  background: rgba(117, 22, 17, .88);
  font-size: clamp(34px, 6vw, 62px);
  font-weight: 1000;
  line-height: 1;
  text-align: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5), 0 0 20px rgba(255, 71, 36, .46);
}

.battle-screen .damage-pop.v234-damage-critical,
.battle-screen .damage-pop.v234-damage-comeback {
  color: #fff6b5;
  background: rgba(158, 27, 18, .95);
  transform-origin: center;
}

.battle-stage.v234-impact-critical,
.battle-stage.v234-impact-comeback,
.battle-stage.v234-impact-heavy {
  animation: v234-stage-impact .38s 1.48s ease both;
}

.battle-stage.v234-impact-fire .fighter-visual-slot {
  box-shadow: inset 0 -38px 42px rgba(230, 60, 14, .24), 0 0 24px rgba(255, 77, 17, .18);
}

.battle-screen.visual-speed-2 .battle-stage .v234-impact-shockwave {
  animation-delay: .72s;
  animation-duration: .38s;
}

.battle-screen.visual-speed-2 .v234-impact-callout {
  animation-delay: .81s;
  animation-duration: .58s;
}

.battle-screen.visual-speed-2 .battle-stage.v234-impact-critical,
.battle-screen.visual-speed-2 .battle-stage.v234-impact-comeback,
.battle-screen.visual-speed-2 .battle-stage.v234-impact-heavy {
  animation-delay: .74s;
  animation-duration: .22s;
}

@keyframes v234-shockwave {
  0% { transform: translate(-50%, -50%) scale(.15); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(7.2); opacity: 0; }
}

@keyframes v234-impact-title {
  0% { transform: translate(-50%, -42%) scale(.55) rotate(-3deg); opacity: 0; }
  16% { transform: translate(-50%, -50%) scale(1.15) rotate(1deg); opacity: 1; }
  72% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -62%) scale(.96); opacity: 0; }
}

@keyframes v234-stage-impact {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-5px, 2px); }
  40% { transform: translate(6px, -2px); }
  60% { transform: translate(-3px, 1px); }
  80% { transform: translate(2px, -1px); }
}

@media (max-width: 760px) {
  .hud-controls .hud-end-turn {
    position: fixed;
    z-index: 96;
    top: max(8px, env(safe-area-inset-top));
    right: 8px;
    min-width: 78px;
    min-height: 42px;
    padding: 5px 8px;
  }

  .hud-controls .hud-end-turn small { font-size: 7px; }
  .hud-main { padding-right: 84px; }

  .generic-combo-grid { grid-template-columns: 1fr; }
  .v234-route-help { margin-inline: 5px; gap: 4px 7px; }

  .v234-impact-callout {
    top: 31%;
    min-width: 145px;
    padding: 8px 13px 9px;
  }

  .v234-impact-callout strong { font-size: 28px; }
  .v234-impact-callout span { font-size: 8px; }
  .battle-screen.battle-visual-upgraded .damage-pop { min-width: 56px; font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .v234-impact-callout,
  .battle-stage .v234-impact-shockwave,
  .battle-stage.v234-impact-critical,
  .battle-stage.v234-impact-comeback,
  .battle-stage.v234-impact-heavy {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
  }
}
