/* World Map "Draw" drawer, redesigned: icon tool strip, colour dots, compact layouts row and
 * card-style sections (Animations, Build a route, Country tour). Loaded after worldmap-ui.css and
 * worldmap-route-builder.css; those use !important broadly, hence the !important here. */
#wmDrawTools.wm-draw-tools {
  --d-fg: #f5f5f2;
  --d-muted: rgba(245, 245, 242, .55);
  --d-faint: rgba(255, 255, 255, .1);
  --d-soft: rgba(255, 255, 255, .05);
  --d-hover: rgba(255, 255, 255, .09);
  --d-accent: #ef4444;
  width: 344px !important;
  padding: 14px !important;
  gap: 10px !important;
  border-radius: 16px !important;
  border: 1px solid var(--d-faint) !important;
  background: rgba(10, 10, 12, .94) !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55) !important;
  backdrop-filter: blur(18px) saturate(1.2) !important;
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif !important;
  color: var(--d-fg) !important;
}
#wmDrawTools.wm-draw-tools > .wm-panel-close {
  top: 10px !important; right: 10px !important; min-height: 0 !important;
  width: 28px; height: 28px; padding: 0 !important; display: none;
  border: 0 !important; border-radius: 8px !important; background: transparent !important;
  color: var(--d-muted) !important; font-size: 0 !important;
}
#wmDrawTools.wm-draw-tools.open > .wm-panel-close { display: grid !important; place-items: center; }
#wmDrawTools.wm-draw-tools > .wm-panel-close::before { content: '✕'; font-size: 13px; }
#wmDrawTools.wm-draw-tools > .wm-panel-close:hover { background: var(--d-hover) !important; color: var(--d-fg) !important; }

/* Header */
#wmDrawTools .wmd-head { flex: 0 0 100%; display: flex; align-items: baseline; gap: 10px; padding: 2px 36px 2px 2px; }
#wmDrawTools .wmd-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
#wmDrawTools .wmd-hint { font-size: 12px; color: var(--d-muted); }

/* Tool strip */
#wmDrawTools .wmd-tools { flex: 0 0 100%; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--d-faint); border-radius: 12px; background: var(--d-soft); }
#wmDrawTools .wmd-tools button {
  display: grid; place-items: center; height: 34px; min-width: 0; padding: 0 !important;
  border: 0 !important; border-radius: 8px !important; background: transparent !important; color: var(--d-fg) !important; cursor: pointer;
  transition: background .12s, color .12s;
}
#wmDrawTools .wmd-tools button:hover { background: var(--d-hover) !important; }
#wmDrawTools .wmd-tools button.active { background: var(--d-fg) !important; color: #0a0a0c !important; }
#wmDrawTools .wmd-tools svg, #wmDrawTools .wmd-clear svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Colours + clear */
#wmDrawTools .wmd-row { flex: 0 0 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px; }
#wmDrawTools .wm-draw-swatches { display: flex; gap: 8px; }
#wmDrawTools .wm-draw-swatches button {
  width: 20px !important; height: 20px !important; min-width: 0 !important; padding: 0 !important;
  border-radius: 50% !important; border: 0 !important; background: var(--swatch) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35); cursor: pointer;
}
#wmDrawTools .wm-draw-swatches button.active { box-shadow: 0 0 0 2px #0a0a0c, 0 0 0 4px var(--d-fg) !important; }
#wmDrawTools .wmd-clear {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px !important;
  border: 1px solid var(--d-faint) !important; border-radius: 8px !important; background: transparent !important;
  color: var(--d-muted) !important; font-family: inherit !important; font-weight: 600 !important; font-size: 12px !important; cursor: pointer;
}
#wmDrawTools .wmd-clear:hover { color: #fca5a5 !important; border-color: rgba(239, 68, 68, .45) !important; background: rgba(239, 68, 68, .08) !important; }
#wmDrawTools .wmd-clear svg { width: 15px; height: 15px; }

/* Layouts row */
#wmDrawTools .wm-layout-bar { flex: 0 0 100%; display: flex; align-items: center; gap: 6px; margin: 0 !important; padding: 10px 2px 0 !important; border-top: 1px solid var(--d-faint) !important; }
#wmDrawTools .wm-layout-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--d-muted) !important; font-size: 12px; font-weight: 600; }
#wmDrawTools .wm-layout-bar button {
  height: 28px; padding: 0 10px !important; border: 1px solid var(--d-faint) !important; border-radius: 8px !important;
  background: transparent !important; color: var(--d-fg) !important; font-family: inherit !important; font-weight: 600 !important; font-size: 12px !important; cursor: pointer;
}
#wmDrawTools .wm-layout-bar button:hover { background: var(--d-hover) !important; }

/* Sections as cards */
#wmDrawTools .wm-animation-disclosure,
#wmDrawTools .wm-route-builder {
  flex: 0 0 100%; margin: 0 !important; padding: 0 !important; border: 1px solid var(--d-faint) !important;
  border-radius: 12px !important; background: var(--d-soft) !important; overflow: hidden;
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif !important;
}
#wmDrawTools .wm-animation-toggle,
#wmDrawTools .wm-route-builder > summary {
  display: flex !important; align-items: center; justify-content: space-between; width: 100%;
  min-height: 42px !important; padding: 0 14px !important; border: 0 !important; border-radius: 0 !important;
  background: transparent !important; color: var(--d-fg) !important;
  font-family: inherit !important; font-weight: 600 !important; font-size: 13px !important; letter-spacing: 0 !important; text-transform: none !important; cursor: pointer;
}
#wmDrawTools .wm-animation-toggle:hover,
#wmDrawTools .wm-route-builder > summary:hover,
#wmDrawTools .wm-route-builder[open] > summary { background: var(--d-hover) !important; }
#wmDrawTools .wm-animation-toggle::after,
#wmDrawTools .wm-route-builder > summary::after {
  content: '' !important; width: 8px; height: 8px; margin-right: 2px; border-right: 1.6px solid var(--d-muted); border-bottom: 1.6px solid var(--d-muted);
  transform: rotate(45deg) translateY(-2px); transition: transform .15s;
}
#wmDrawTools .wm-animation-toggle[aria-expanded="true"]::after,
#wmDrawTools .wm-route-builder[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
#wmDrawTools .wm-animation-panel,
#wmDrawTools .wm-route-panel { padding: 4px 14px 14px !important; border: 0 !important; background: transparent !important; }

/* Controls inside sections */
#wmDrawTools :is(.wm-route-panel, .wm-animation-panel) :is(input[type="text"], input[type="search"], input[type="url"], input:not([type]), select) {
  min-height: 34px; padding: 6px 10px !important; border: 1px solid var(--d-faint) !important; border-radius: 8px !important;
  background: rgba(0, 0, 0, .35) !important; color: var(--d-fg) !important; font-size: 12.5px !important;
}
#wmDrawTools :is(.wm-route-panel, .wm-animation-panel) :is(input, select):focus { border-color: rgba(255, 255, 255, .45) !important; outline: none; }
#wmDrawTools :is(.wm-route-panel, .wm-animation-panel) button:not(.wm-tour-icon):not([data-color]):not(.wm-route-stop-name) {
  min-height: 32px; padding: 0 12px !important; border: 1px solid var(--d-faint) !important; border-radius: 8px !important;
  background: transparent !important; color: var(--d-fg) !important; font-size: 12.5px !important; font-weight: 600; text-transform: none !important; letter-spacing: 0 !important;
}
#wmDrawTools :is(.wm-route-panel, .wm-animation-panel) button:not(.wm-tour-icon):not([data-color]):not(.wm-route-stop-name):hover:not(:disabled) { background: var(--d-hover) !important; }
#wmDrawTools :is(.wm-route-panel, .wm-animation-panel) :is(.wm-route-primary, .wm-animation-play):not(:disabled) { background: var(--d-fg) !important; color: #0a0a0c !important; border-color: var(--d-fg) !important; }
#wmDrawTools :is(.wm-route-panel, .wm-animation-panel) button:disabled { opacity: .4; }
#wmDrawTools :is(.wm-route-label, .wm-route-intro, .wm-route-status, .wm-animation-status, .wm-animation-note, .wm-animation-field label) { color: var(--d-muted) !important; font-family: inherit !important; text-transform: none !important; letter-spacing: 0 !important; }
#wmDrawTools .wm-route-label { font-size: 11.5px !important; font-weight: 600; }
#wmDrawTools :is(.wm-route-progress, .wm-animation-progress) { width: 100%; height: 4px; appearance: none; border: 0; border-radius: 4px; background: var(--d-faint); overflow: hidden; }
#wmDrawTools :is(.wm-route-progress, .wm-animation-progress)::-webkit-progress-bar { background: var(--d-faint); }
#wmDrawTools :is(.wm-route-progress, .wm-animation-progress)::-webkit-progress-value { background: var(--d-fg); border-radius: 4px; }
#wmDrawTools .wm-route-stops { border-radius: 10px !important; border-color: var(--d-faint) !important; }

/* Country tour transport: round icon buttons */
#wmDrawTools .wm-tour-transport { display: flex; align-items: center; gap: 8px; }
#wmDrawTools .wm-tour-icon {
  display: grid; place-items: center; width: 38px; height: 38px; min-width: 0; padding: 0 !important;
  border: 1px solid var(--d-faint) !important; border-radius: 50% !important; background: transparent !important; color: var(--d-fg) !important; cursor: pointer;
}
#wmDrawTools .wm-tour-icon svg { width: 18px; height: 18px; }
#wmDrawTools .wm-tour-icon:hover:not(:disabled) { background: var(--d-hover) !important; }
#wmDrawTools .wm-tour-icon.wm-tour-play { width: 44px; height: 44px; background: var(--d-fg) !important; color: #0a0a0c !important; border-color: var(--d-fg) !important; }
#wmDrawTools .wm-tour-icon.wm-tour-play:hover:not(:disabled) { background: #fff !important; transform: scale(1.04); }
#wmDrawTools .wm-tour-icon:disabled { opacity: .35; cursor: default; }
#wmDrawTools .wm-tour-transport .wm-route-speed-label { margin-left: auto; }
#wmDrawTools .wm-country-tour .wm-tour-pick { width: 100%; }

@media (max-width: 480px) {
  #wmDrawTools.wm-draw-tools { width: calc(100vw - 24px) !important; }
}
#wmDrawTools .wm-country-tour .wm-route-panel button.wm-tour-pick.is-active { background: var(--d-accent) !important; border-color: var(--d-accent) !important; color: #fff !important; }

#wmDrawTools .wm-tour-transport button { flex: 0 0 auto !important; }
#wmDrawTools .wm-tour-transport select { flex: 1; min-width: 0; }
#wmDrawTools .wm-route-panel button.wm-route-stop-name { flex: 1; min-width: 0; padding: 0 4px !important; border: 0 !important; background: transparent !important; color: var(--d-fg) !important; font-size: 13px !important; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#wmDrawTools .wm-route-panel button.wm-route-stop-name.is-current { color: var(--d-accent) !important; }
#wmDrawTools .wm-route-stop { border-radius: 8px !important; }
#wmDrawTools .wm-route-stop-tools button { min-height: 26px !important; width: 26px; padding: 0 !important; border-radius: 6px !important; }
#wmDrawTools .wm-country-tour .wm-tour-colors { gap: 8px; }
#wmDrawTools .wm-country-tour .wm-tour-colors button { width: 22px !important; height: 22px !important; border: 0 !important; border-radius: 50% !important; background: var(--c) !important; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35) !important; outline: 0 !important; }
#wmDrawTools .wm-country-tour .wm-tour-colors button.active { box-shadow: 0 0 0 2px #0a0a0c, 0 0 0 4px var(--d-fg) !important; }
#wmDrawTools .wm-country-tour .wm-tour-check { display: flex !important; justify-content: flex-start !important; align-items: center; gap: 10px; width: 100%; margin: 4px 0 !important; color: var(--d-fg) !important; font-size: 12.5px !important; text-align: left; }
#wmDrawTools .wm-country-tour .wm-tour-check input { flex: 0 0 auto; width: 15px !important; min-height: 0 !important; height: 15px; margin: 0; padding: 0 !important; accent-color: var(--d-fg); }
#wmDrawTools .wm-country-tour .wm-tour-seg { display: inline-flex; gap: 2px; padding: 3px; margin: 2px 0 10px; border: 1px solid var(--d-faint); border-radius: 10px; }
#wmDrawTools .wm-country-tour .wm-route-panel .wm-tour-seg button { min-height: 28px !important; padding: 0 14px !important; border: 0 !important; border-radius: 7px !important; background: transparent !important; color: var(--d-muted) !important; }
#wmDrawTools .wm-country-tour .wm-route-panel .wm-tour-seg button.active { background: var(--d-fg) !important; color: #0a0a0c !important; }
#wmDrawTools .wm-country-tour [hidden] { display: none !important; }

/* Country tour mini player (shown while a tour plays and the Draw panel is folded away) */
.wm-tour-mini {
  position: absolute; left: 292px; bottom: 10px; z-index: 966;
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 6px 0 4px; max-width: calc(100% - 310px);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 999px; background: rgba(10, 10, 12, .92);
  backdrop-filter: blur(16px); box-shadow: 0 12px 34px rgba(0, 0, 0, .5);
  color: #f5f5f2; font: 12.5px/1.2 -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  animation: wm-tour-mini-in .28s cubic-bezier(.22, 1, .36, 1);
}
.wm-tour-mini[hidden] { display: none; }
@keyframes wm-tour-mini-in { from { opacity: 0; transform: translateY(10px); } }
.wm-tour-mini .wm-tour-icon {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0; flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 50%; background: transparent; color: #f5f5f2; cursor: pointer;
}
.wm-tour-mini .wm-tour-icon svg { width: 16px; height: 16px; }
.wm-tour-mini .wm-tour-icon.wm-tour-play { width: 36px; height: 36px; background: #f5f5f2; color: #0a0a0c; border-color: #f5f5f2; }
.wm-tour-mini .wm-tour-icon:hover { background: rgba(255, 255, 255, .1); }
.wm-tour-mini .wm-tour-icon.wm-tour-play:hover { background: #fff; }
.wm-tour-mini-info { display: flex; flex-direction: column; gap: 5px; min-width: 120px; max-width: 220px; padding: 0 4px; }
.wm-tour-mini-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.wm-tour-mini-bar { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.wm-tour-mini-bar span { display: block; height: 100%; width: 0; background: #ef4444; transition: width .4s ease; }
.wm-tour-mini-expand {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0; flex: 0 0 auto;
  border: 0; border-radius: 50%; background: transparent; color: rgba(245, 245, 242, .7); cursor: pointer;
}
.wm-tour-mini-expand svg { width: 18px; height: 18px; }
.wm-tour-mini-expand:hover { background: rgba(255, 255, 255, .1); color: #fff; }
@media (max-width: 900px) { .wm-tour-mini { left: 240px; max-width: calc(100% - 252px); } }
@media (max-width: 560px) { .wm-tour-mini { left: 12px; bottom: 58px; max-width: calc(100% - 24px); } }

/* Tour timeline slider (panel + mini player) */
.wm-tour-seek { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 6px 0 2px; padding: 0 !important; background: transparent !important; border: 0 !important; cursor: pointer; }
.wm-tour-seek:disabled { opacity: .35; cursor: default; }
.wm-tour-seek::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .18); }
.wm-tour-seek::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .18); }
.wm-tour-seek::-moz-range-progress { height: 4px; border-radius: 4px; background: #ef4444; }
.wm-tour-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 3px rgba(239, 68, 68, .55); }
.wm-tour-seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 3px rgba(239, 68, 68, .55); }
#wmDrawTools .wm-route-panel input.wm-tour-seek { min-height: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important; }
.wm-tour-mini .wm-tour-mini-info { min-width: 180px; max-width: 280px; gap: 2px; }
.wm-tour-mini .wm-tour-seek { margin: 0; height: 14px; }

/* Per-country flag choice */
#wmDrawTools .wm-route-panel button.wm-tour-flag-btn {
  flex: 0 0 auto; width: 30px; min-height: 20px !important; height: 20px; padding: 0 !important; margin-right: 2px;
  border: 1px solid rgba(255, 255, 255, .25) !important; border-radius: 4px !important; overflow: hidden; background: rgba(255, 255, 255, .06) !important; cursor: pointer;
}
#wmDrawTools .wm-route-panel button.wm-tour-flag-btn.is-open { box-shadow: 0 0 0 2px #fff; }
#wmDrawTools .wm-tour-flag-btn img { display: block; width: 100%; height: 100%; object-fit: cover; }
#wmDrawTools .wm-tour-flag-editor { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: -2px 0 6px; padding: 10px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 10px; background: rgba(0, 0, 0, .25); }
#wmDrawTools .wm-tour-flag-results { display: flex; flex-direction: column; gap: 2px; max-height: 180px; overflow-y: auto; }
#wmDrawTools .wm-tour-flag-results:empty { display: none; }
#wmDrawTools .wm-route-panel .wm-tour-flag-results button { display: flex !important; align-items: center; justify-content: flex-start; gap: 10px; min-height: 30px !important; border: 0 !important; text-align: left; }
#wmDrawTools .wm-tour-flag-results img { width: 24px; height: 16px; object-fit: cover; border-radius: 2px; flex: 0 0 auto; }
#wmDrawTools .wm-tour-flag-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#wmDrawTools .wm-tour-upload { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border: 1px dashed rgba(255, 255, 255, .3); border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
#wmDrawTools .wm-tour-upload:hover { background: rgba(255, 255, 255, .08); }
#wmDrawTools .wm-route-stop .wm-route-panel button.wm-tour-flag-btn,
#wmDrawTools .wm-route-panel .wm-route-stop button.wm-tour-flag-btn { width: 30px !important; min-width: 30px !important; max-width: 30px; height: 20px !important; flex: 0 0 30px !important; }
#wmDrawTools .wm-country-tour .wm-route-panel .wm-route-stop button.wm-tour-flag-btn.wm-tour-flag-btn { padding: 0 !important; min-height: 20px !important; }
#wmDrawTools .wm-country-tour .wm-route-panel .wm-tour-flag-editor button[data-flag-pick] { padding: 0 8px !important; }
