/* Draft 4 geometry and palette are preserved from the original hand-drawn map prototype. */
.wt-map-shell { margin:12px 0; border:1px solid #365668; border-radius:12px; overflow:hidden; background:#122a3b; color:#eaf5fc; }
.wt-map-toolbar { display:flex;gap:12px;flex-wrap:wrap;padding:10px 12px;background:#142f41;font-size:13px; }
.wt-map-toolbar label { display:flex;align-items:center;gap:5px;cursor:pointer; }
.wt-map-scroll { overflow:auto; max-width:100%; background:#1a6782; }
#wtMap { width:100%; min-width:560px; height:auto; display:block; }
#wtOriginalSketch { opacity:0; pointer-events:none; }
.wt-route { fill:none;stroke:#62cffb;stroke-width:2.4;stroke-dasharray:8 7;opacity:.62;pointer-events:none; }
.wt-route.wt-land { stroke:#f2c28d;stroke-dasharray:none;stroke-width:4; }
.wt-route.wt-route-selected { stroke:#ffec83;stroke-width:5;stroke-dasharray:10 5;opacity:1; }
.wt-shape { stroke:#284b50;stroke-width:3;stroke-linejoin:round;cursor:pointer;transition:opacity .12s,stroke-width .12s; }
.wt-shape:hover,.wt-shape:focus-visible { stroke:white;stroke-width:6;outline:none; }
.wt-shape.wt-inactive { opacity:.23;cursor:default;pointer-events:none; }
.wt-shape.wt-selected { stroke:white;stroke-width:7;filter:drop-shadow(0 0 4px white); }
.wt-shape.wt-neighbor { stroke:#f6fcac;stroke-width:5; }
.wt-shape.wt-actionable { stroke-dasharray:7 3; }
.wt-label {font-size:18px;fill:#102b34;font-weight:800;text-anchor:middle;dominant-baseline:middle;pointer-events:none;paint-order:stroke;stroke:#ffffff99;stroke-width:3;}
.wt-army { font-size:14px; fill:#102b34; font-weight:900; text-anchor:middle;pointer-events:none;paint-order:stroke;stroke:#ffffffcf;stroke-width:3; }
.wt-muted { opacity:.2; }
.wt-country-label { font-size:12px;fill:#e7ffff;stroke:#163649;stroke-width:3;paint-order:stroke;pointer-events:none;font-weight:800;letter-spacing:.5px; }
.wt-map-info { padding:10px 12px;line-height:1.5;font-size:13px;border-top:1px solid #365668; }
.wt-player-legend { display:flex;gap:12px;flex-wrap:wrap;padding:0 12px 12px;font-size:13px; }
.wt-player-legend>span { display:inline-flex;align-items:center;gap:5px; }
.wt-player-dot { display:inline-block;width:12px;height:12px;border:1px solid #fff;border-radius:3px; }
.wt-territories[hidden] { display:none; }

.wt-shape.wt-placement-muted { opacity:.5; filter:saturate(.25); }
.wt-player-legend { align-items:center; }
.wt-placement-hint { margin-left:auto; opacity:.88; font-style:italic; }
.wt-army { font-size:18px; }
.wt-label { font-size:17px; }

/* Controls sit below the map so they remain touch-friendly on mobile. */
.wt-army-controls { margin:12px 0; padding:14px; border:1px solid #476276; border-radius:12px; background:#183449; color:#f3f7fa; }
.wt-army-controls[hidden] { display:none; }
.wt-army-controls-heading { display:flex; flex-direction:column; gap:5px; margin-bottom:12px; }
#wtArmyHelp { font-size:13px; line-height:1.5; }
.wt-army-stepper { display:flex; align-items:center; flex-wrap:wrap; gap:12px; }
.wt-army-stepper button { min-width:52px; min-height:48px; font-size:22px; }
.wt-army-stepper #wtArmyConfirm { font-size:15px; min-width:120px; }
#wtArmyCount { text-align:center; min-width:44px; font-weight:800; font-size:28px; }

/* Step 20: live reinforcement and turn-status interface. */
.wt-turn-controls { border-color:#79a6bd; }
#wtReinforcementControls[hidden],#wtBeginAttack[hidden],#wtTurnControls[hidden] { display:none; }
#wtReinforcementSelection { margin:0 0 12px; font-size:14px; }
.wt-turn-controls .wt-army-stepper button { min-height:48px; }
#wtReinforcementCount { min-width:44px; text-align:center; font-size:28px; font-weight:800; }
#wtReinforcementPlace { font-size:15px; }
.wt-turn-next-info { font-size:13px; line-height:1.5; margin:10px 0 0; }
.wt-turn-next-info:empty { display:none; }

/* Step 21: attack selection, dice, and server-generated battle report. */
#wtAttackControls[hidden],#wtLastBattle[hidden] {display:none;}
.wt-attack-controls {border-top:1px solid #476276;padding-top:12px;margin-top:12px;}
#wtAttackSelection {font-size:14px;line-height:1.5;margin:0 0 10px;}
#wtAttackDiceCount {min-width:44px;text-align:center;font-size:28px;font-weight:800;}
#wtAttackFire {font-size:15px;}
.wt-finish-attack {margin-top:12px;min-height:44px;}
.wt-battle-result {padding:12px;border:1px solid #79a6bd;border-radius:8px;background:#0d2737;line-height:1.6;}
.wt-shape.wt-attacker {stroke:#fff3a4;stroke-width:9;filter:drop-shadow(0 0 7px #fff3a4);}
.wt-shape.wt-defender {stroke:#ff6878;stroke-width:9;filter:drop-shadow(0 0 7px #ff6878);}

/* Step 22: Conquest Point redemption and independent bonus-army placement. */
#wtConquestControls[hidden],#wtBonusControls[hidden],#wtConquestRedeem[hidden] { display:none; }
.wt-conquest-controls { border-top:1px solid #476276; margin-top:14px; padding-top:14px; }
#wtConquestSummary { display:block; line-height:1.5; }
#wtConquestNotice { font-size:14px; line-height:1.5; margin:8px 0 12px; }
#wtConquestRedeem { min-height:44px; padding:10px 14px; }
.wt-bonus-controls { margin-top:12px; padding:12px; border:1px solid #79a6bd; border-radius:8px; background:#0d2737; }
#wtBonusSelection { font-size:14px; margin:0 0 10px; line-height:1.5; }
#wtBonusCount { min-width:44px; text-align:center; font-size:28px; font-weight:800; }
#wtBonusPlace { font-size:15px; }

/* Step 23: one optional connected-territory fortification and turn completion. */
#wtFortificationControls[hidden],#wtBeginFortification[hidden],#wtEndTurn[hidden] { display:none; }
.wt-fortification-controls { margin-top:14px;padding-top:14px;border-top:1px solid #476276; }
#wtFortificationSelection {font-size:14px;line-height:1.5;margin:10px 0;}
#wtFortificationCount {min-width:44px;text-align:center;font-size:28px;font-weight:800;}
.wt-turn-finish-actions {display:flex;flex-wrap:wrap;gap:10px;margin-top:12px;}
.wt-turn-finish-actions button {min-height:46px;padding:10px 14px;}
.wt-shape.wt-fortify-source {stroke:#fff3a4;stroke-width:9;filter:drop-shadow(0 0 7px #fff3a4);}
.wt-shape.wt-fortify-target {stroke:#66ffcf;stroke-width:9;filter:drop-shadow(0 0 7px #66ffcf);}

/* Step 27: the blind submission action lives in the army placement panel. */
.wt-blind-actions { margin-top:14px; padding-top:14px; border-top:1px solid #476276; display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.wt-blind-actions[hidden] { display:none !important; }
.wt-blind-actions p { flex-basis:100%; margin:0 0 4px; font-size:14px; line-height:1.5; }
.wt-blind-actions button { min-height:46px; padding:10px 14px; }

/* Step 27C: keep each route checkbox directly beside its own text.
   Shared input styles set width:100%, which must not apply to these checkboxes. */
.wt-map-toolbar {align-items:center;gap:8px 16px;}
.wt-map-toolbar .wt-route-option {
  display:inline-flex;flex:0 0 auto;align-items:center;justify-content:flex-start;
  gap:8px;margin:0;padding:6px 4px;white-space:nowrap;
  font-size:13px;line-height:1.4;max-width:100%;
}
.wt-map-toolbar .wt-route-option input[type="checkbox"] {
  appearance:auto;box-sizing:border-box;flex:none;
  display:inline-block;width:17px;height:17px;min-width:17px;
  margin:0;padding:0;border-radius:3px;vertical-align:middle;
  accent-color:#7ccfff;
}
.wt-map-toolbar .wt-route-option span {display:inline;flex:none;}
.wt-extra-advance {margin:12px 0;padding:12px;border:1px solid #79a6bd;border-radius:9px;background:#163649;}
.wt-extra-advance[hidden] {display:none!important;}
.wt-extra-advance p,.wt-extra-advance small {display:block;line-height:1.5;margin:8px 0;}
#wtExtraAdvanceCount {min-width:44px;text-align:center;font-size:28px;font-weight:800;}
#wtExtraAdvanceMove {font-size:15px;}

/* Step 28: one consistent action row beneath the map. The gameplay
   controls stay mounted in the DOM; unavailable actions are disabled. */
.wt-main-actions {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:8px;
  margin:10px 0 14px;
}
.wt-main-actions button {
  min-width:0;
  width:100%;
  min-height:42px;
  padding:8px 6px;
  font-size:13px;
  line-height:1.25;
  white-space:normal;
}
.wt-main-actions button:disabled {
  opacity:.35;
  cursor:not-allowed;
  filter:grayscale(1);
}
.wt-main-actions button[aria-current="step"]:disabled {
  opacity:.7;
  border:1px solid #a2bed0;
}
.wt-main-actions .wt-action-surrender {border-color:#b78b90;}
.wt-turn-controls {padding:10px 12px;}
.wt-turn-controls .wt-army-controls-heading {margin-bottom:6px;gap:2px;}
.wt-turn-controls #wtTurnDetails {font-size:13px;line-height:1.4;}
.wt-turn-controls .wt-attack-controls,
.wt-turn-controls .wt-conquest-controls,
.wt-turn-controls .wt-fortification-controls {margin-top:8px;padding-top:8px;}
@media(max-width:640px) {
  .wt-main-actions {grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;}
  .wt-main-actions button {font-size:12px;min-height:44px;}
}

/* Step 29: modal battle flow. Only combat controls move to the overlay. */
.wt-battle-overlay[hidden], .wt-battle-dialog [hidden] {display:none!important;}
.wt-battle-overlay {
  position:fixed; inset:0; z-index:1200; padding:18px;
  display:flex; align-items:center; justify-content:center;
  background:rgba(5,18,29,.82); overflow-y:auto;
}
.wt-battle-dialog {
  background:#183449; border:1px solid #79a6bd; border-radius:14px;
  width:min(100%,440px); max-height:calc(100dvh - 36px); overflow-y:auto;
  padding:22px; color:#f3f7fa; box-shadow:0 24px 60px #000a;
}
.wt-battle-dialog h2 {margin:0 0 8px;font-size:24px;}
.wt-battle-dialog p {line-height:1.5;}
.wt-battle-stepper {display:flex;align-items:center;gap:12px;margin:16px 0;flex-wrap:wrap;}
.wt-battle-stepper span {flex:1;min-width:110px;}
.wt-battle-stepper output {min-width:30px;text-align:center;font-size:24px;font-weight:800;}
.wt-battle-stepper button {min-width:46px;min-height:46px;font-size:20px;}
.wt-battle-primary {width:100%;min-height:46px;margin:6px 0;}
.wt-battle-result {margin:14px 0;padding:12px;border:1px solid #79a6bd;border-radius:8px;background:#0d2737;}
#wtAttackControls, #wtLastBattle, #wtExtraAdvanceControls {display:none!important;}

/* Stage-specific battle headings stay immediately above the relevant controls.
   Keep the dynamic dialog label available to screen readers. */
.wt-battle-accessible-title {
  position:absolute!important; width:1px!important; height:1px!important;
  padding:0!important; margin:-1px!important; overflow:hidden!important;
  clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important;
}
.wt-battle-dialog .wt-battle-stage-heading {
  display:block; margin:0 0 12px; font-size:26px; font-weight:800;
  line-height:1.25; text-align:center; color:#fff;
}

/* Step 30: all adjustment steppers live inside context dialogs, not beneath
   the persistent compact action bar. Battle flow remains in its own overlay. */
.wt-action-overlay[hidden], .wt-action-page[hidden] { display:none!important; }
.wt-action-dialog .wt-army-controls,
.wt-action-dialog .wt-conquest-controls,
.wt-action-dialog .wt-fortification-controls,
.wt-action-dialog .wt-bonus-controls {margin:0;border:0;padding:0;background:transparent;}
.wt-action-dialog #wtReinforcementControls {margin:0;padding:0;}
.wt-action-dialog .wt-army-stepper {gap:10px;margin:16px 0;}
.wt-action-dialog .wt-army-stepper output {min-width:34px;text-align:center;font-size:24px;font-weight:800;}
.wt-action-dialog .wt-army-stepper button {min-width:46px;min-height:46px;}
.wt-action-dialog .wt-army-stepper button.primary {font-size:15px;flex:1 1 100%;}
.wt-action-dialog .wt-blind-actions {flex-direction:column;align-items:stretch;}
.wt-action-dialog .wt-blind-actions button {width:100%;}
.wt-action-dialog [hidden] {display:none!important;}
.wt-turn-controls #wtTurnNextInfo {margin:3px 0 0;}
@media(max-width:420px) {
 .wt-action-dialog {padding:16px;}
 .wt-action-dialog .wt-army-stepper {gap:7px;}
}

/* Step 31: prevent unintended iOS Safari double-tap zoom during quick play.
   `manipulation` still permits ordinary scrolling and pinch-to-zoom. */
#wtMap,
#worldTacticsStage button,
#wtActionOverlay button,
#wtBattleOverlay button,
#gameRulesOverlay button,
#roomStatusOverlay button {
  touch-action: manipulation;
}


/* Step 32: apply double-tap suppression to the SVG descendants and entire
   gameplay surfaces, not just the parent SVG or buttons. Pinch zoom is kept. */
#worldTacticsStage, #worldTacticsStage *,
#wtActionOverlay, #wtActionOverlay *,
#wtBattleOverlay, #wtBattleOverlay * {
  touch-action: manipulation;
}

/* Step 34 — hybrid atlas: digital ocean / hand-illustrated terrain.
   Textures follow territory polygons, never block interactive hit targets. */
.wt-map-shell {border-color:#8c9e96;box-shadow:0 4px 18px #061a2450;}
.wt-map-scroll {background:#123c58;}
.wt-map-toolbar {background:#17354a;border-bottom:1px solid #8ba7a05c;}
#wtMap {background:#123c58;}
.wt-atlas-grid path {stroke:#d9e5d4;stroke-opacity:.085;stroke-width:1;fill:none;}
.wt-atlas-compass circle {stroke:#cce2dc;stroke-opacity:.65;fill:#0c30466b;stroke-width:1.5;}
.wt-atlas-compass .wt-compass-points {stroke:#e9e1c7;stroke-width:1.3;fill:#d8c99b;fill-opacity:.72;}
.wt-atlas-compass .wt-compass-north {font-size:19px;font-weight:800;fill:#f1e4c4;letter-spacing:2px;}
.wt-atlas-paper {opacity:.75;stroke:none;}
.wt-atlas-texture {opacity:.68;stroke:none;}
.wt-shape {stroke:#3f4e4a;stroke-width:3.5;stroke-linejoin:round;}
.wt-label {fill:#202f2e;stroke:#fffbeba8;stroke-width:4;font-weight:900;}
.wt-army {fill:#12232d;stroke:#fff6e5e8;stroke-width:4;}
.wt-country-label {fill:#f5e4bd;stroke:#12334e;stroke-width:4;letter-spacing:1px;}
.wt-route {stroke:#a5e6f1;stroke-width:3;opacity:.85;}
.wt-route.wt-land {stroke:#fce3a9;opacity:.7;}
@media (prefers-reduced-motion:reduce) { .wt-shape {transition:none;} }

/* Step 35 — restrained readability polish for the existing Game Room aesthetic.
   Only SVG presentation changes: no geometry, ownership, adjacency or events. */
.wt-map-shell {
  border-color:#658293;
  box-shadow:0 3px 13px rgba(2,15,25,.35);
}
.wt-map-toolbar { color:#edf5f7; }
.wt-map-toolbar .wt-route-option:focus-within {
  outline:2px solid #c3eaff;
  outline-offset:2px;
  border-radius:4px;
}
.wt-shape {
  stroke-width:3.25;
  stroke-linejoin:round;
  vector-effect:non-scaling-stroke;
}
.wt-shape.wt-selected,
.wt-shape.wt-attacker,
.wt-shape.wt-defender,
.wt-shape.wt-fortify-source,
.wt-shape.wt-fortify-target { stroke-width:6; }
.wt-shape.wt-neighbor { stroke-width:4.5; }
.wt-label {
  font-size:19px;
  font-weight:900;
  stroke-width:4.5;
  paint-order:stroke fill;
  letter-spacing:.2px;
}
.wt-army {
  font-size:18px;
  font-weight:900;
  stroke-width:4.5;
  paint-order:stroke fill;
}
.wt-country-label {
  font-size:13px;
  letter-spacing:1px;
  stroke-width:4.5;
  paint-order:stroke fill;
}
.wt-atlas-texture { opacity:.56; }
.wt-route { opacity:.77; }
.wt-route.wt-route-selected { opacity:1; }
@media(max-width:640px) {
  .wt-map-shell {border-radius:9px;}
  .wt-map-toolbar {gap:6px 12px;}
  .wt-map-toolbar .wt-route-option {min-height:36px;}
}
