.support-dont-show { width: 100%; margin-top: 10px; }
:root {
  --bg: #161616;
  --panel: rgba(30, 30, 32, 0.94);
  --panel-border: #3a3a3c;
  --surface: #262628;
  --surface-2: #313134;
  --accent: #38bdf8;
  --accent-2: #f59e0b;
  --text: #e4e4e6;
  --muted: #8a8a92;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
body { display: flex; flex-direction: row; }
#app-row { display: contents; }
#stage {
  flex: 1 1 auto;
  position: relative;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}
#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #161616;
}
#wind-canvas {
  position: absolute;
  inset: 0;
  z-index: 400;
  pointer-events: none;
}
#brush-layer {
  position: absolute;
  inset: 0;
  z-index: 450;
  cursor: crosshair;
  touch-action: none;
}
#mode-toggle { display: none; }
#sheet-handle { display: none; }
.phone-only { display: none; }
#zoom-ctrl { display: none; }
#btn-layers {
  position: absolute;
  bottom: 36px;
  right: 14px;
  z-index: 600;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  background: rgba(30, 30, 32, 0.85);
  backdrop-filter: blur(12px);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
#btn-layers:hover { background: rgba(49, 49, 52, 0.9); }
#btn-layers.active { background: rgba(56, 189, 248, 0.18); border-color: var(--accent); }
#damage-canvas {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}
#radar-canvas {
  position: absolute;
  inset: 0;
  z-index: 55;
  pointer-events: none;
}
.layer-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
#damage-legend {
  position: absolute;
  bottom: 84px;
  right: 62px;
  z-index: 600;
  display: none;
  align-items: stretch;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(22, 22, 24, 0.9);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  backdrop-filter: blur(12px);
}
#damage-legend.visible { display: flex; }
.dmg-bar {
  width: 10px;
  border-radius: 3px;
  background: linear-gradient(to top,
    rgb(80, 210, 80) 0%,
    rgb(230, 220, 30) 40%,
    rgb(230, 110, 20) 65%,
    rgb(210, 20, 20) 82%,
    rgb(140, 0, 180) 100%
  );
}
.dmg-labels {
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  gap: 2px;
  font-size: 10px;
  color: var(--muted);
}
#layers-menu {
  position: absolute;
  bottom: 84px;
  right: 14px;
  z-index: 600;
  min-width: 160px;
  padding: 10px 12px;
  background: rgba(22, 22, 24, 0.95);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
  gap: 8px;
}
#layers-menu.open { display: flex; }
.layers-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 2px;
}
.layer-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.layer-group.dragging {
  z-index: 2;
  opacity: 0.92;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  pointer-events: none;
}
.layer-group-placeholder {
  border: 1px dashed rgba(56, 189, 248, 0.4);
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.06);
}
.layer-row { display: flex; gap: 6px; align-items: center; }
.layer-item {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  background: rgba(38, 38, 40, 0.6);
  color: var(--text);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.layer-item:hover { background: rgba(49, 49, 52, 0.8); }
.layer-item.active { background: var(--accent); color: #04222f; font-weight: 600; }
.layer-handle {
  flex-shrink: 0;
  width: 18px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  letter-spacing: -2px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}
.layer-handle:hover { background: rgba(49, 49, 52, 0.8); color: var(--text); }
.layer-group.dragging .layer-handle { cursor: grabbing; background: rgba(56, 189, 248, 0.15); color: var(--accent); }
.layer-cfg-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  background: rgba(38, 38, 40, 0.6);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.layer-cfg-btn:hover { background: rgba(49, 49, 52, 0.8); }
.layer-cfg-btn.active { border-color: var(--accent); background: rgba(56, 189, 248, 0.12); }
.layer-settings {
  display: none;
  flex-direction: column;
  gap: 7px;
  padding-top: 8px;
}
.layer-settings.open { display: flex; }
.layer-setting-row { display: flex; justify-content: space-between; align-items: center; }
.layer-setting-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.layer-setting-val { font-size: 10px; color: var(--accent); }
.layer-reset-btn {
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  background: rgba(38, 38, 40, 0.6);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.layer-reset-btn:hover { background: rgba(200, 30, 30, 0.2); border-color: rgba(200, 30, 30, 0.4); color: #ff9090; }
#brush-ring {
  position: absolute;
  border: 1.5px solid rgba(245, 158, 11, 0.9);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  display: none;
}
.leaflet-control-container { z-index: 500; }
#panel-toggle {
  position: absolute;
  top: 50%;
  left: calc(14px + var(--panel-width, 280px) + 4px);
  transform: translateY(-50%);
  z-index: 601;
  width: 20px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-left: none;
  border-radius: 0 4px 4px 0;
  background: rgba(30, 30, 32, 0.55);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.25s ease, color 0.15s, background 0.15s;
  backdrop-filter: blur(12px);
}
#panel-toggle:hover { color: var(--text); background: rgba(40, 40, 44, 0.7); }
#panel-toggle.panel-hidden {
  left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
}
#panel {
  transition: transform 0.25s ease;
}
#panel.panel-hidden {
  transform: translateX(calc(-100% - 20px));
}
#panel {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 600;
  width: var(--panel-width, 280px);
  max-height: calc(100% - 28px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 16px;
  background: rgba(0, 0, 0, 0.616);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
#panel::-webkit-scrollbar { width: 0; height: 0; display: none; }
.panel-header { position: relative; }
#panel-title {
  display: block;
  width: auto;
  max-width: 180px;
  height: auto;
  margin: 0 0 12px -6px;
}
.toggle-all {
  position: absolute;
  top: 0; right: 0;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  background: rgba(38, 38, 40, 0.6);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 10px;
  cursor: pointer;
}
.toggle-all:hover { background: rgba(49, 49, 52, 0.8); }
.group { border-top: 1px solid var(--panel-border); padding-top: 12px; margin-top: 12px; }
.group h2 {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.group h2:hover { color: var(--text); }
.group h2::after {
  content: "\2212";
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
}
.group.collapsed h2 { margin-bottom: 0; }
.group.collapsed h2::after { content: "+"; }
.group.collapsed > :not(h2) { display: none !important; }
.row { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 10px; }
.tool {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 6px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  background: rgba(38, 38, 40, 0.6);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.tool-icon { width: 16px; height: 16px; flex-shrink: 0; }
.spr {
  --n: 12;
  --i: 0;
  display: inline-block;
  background-image: url(Icon/Icons.png);
  background-repeat: no-repeat;
  background-size: 100% calc(var(--n) * 100%);
  background-position: 0 calc(var(--i) / (var(--n) - 1) * 100%);
}
.spr-curve          { --i: 0; }
.spr-gear           { --i: 1; }
.spr-remove-station { --i: 2; }
.spr-sink           { --i: 3; }
.spr-source         { --i: 4; }
.spr-station        { --i: 5; }
.spr-stream         { --i: 6; }
.spr-vortex         { --i: 7; }
.spr-save { --i: 8; }
.spr-load { --i: 9; }
.spr-layer { --i: 10; }
.spr-cloud { --i: 11; }
/* @spr-insert (add_icon.py inserts new .spr-* rules above this line — don't remove) */
.tool:hover { background: rgba(49, 49, 52, 0.8); }
.tool.active { background: var(--accent-2); color: #2a1a02; font-weight: 600; }
.tool.active .tool-icon { filter: brightness(0); }
.seg { display: flex; flex: 1; border-radius: 4px; overflow: hidden; gap: 2px; }
.seg-btn { flex: 1; padding: 6px; border: 1px solid rgba(255, 255, 255, 0.07); background: rgba(38, 38, 40, 0.6); backdrop-filter: blur(6px); color: var(--text); font-size: 11.5px; cursor: pointer; }
.seg-btn.active { background: var(--accent); color: #04222f; font-weight: 600; }
#rotation-row label { font-size: 12px; color: var(--muted); min-width: 56px; }
.slider { display: block; margin-bottom: 12px; font-size: 12px; }
.slider span { display: flex; align-items: center; gap: 4px; margin-bottom: 5px; color: var(--text); }
.slider span .info-tip { margin-left: auto; }
.slider b { color: var(--accent); }
.kmh-ruler {
  position: relative;
  height: 16px;
  margin-bottom: 2px;
}
.kmh-tick {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
}
.kmh-tick::before {
  content: "";
  display: block;
  width: 1px;
  height: 4px;
  background: var(--panel-border);
}
.kmh-label {
  font-size: 9px;
  color: var(--muted);
  line-height: 1;
  margin-top: 1px;
}
.kmh-unit {
  position: absolute;
  right: 0;
  top: 0;
  font-size: 9px;
  color: var(--muted);
  transform: translateY(-1px);
}
input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; outline: none; }
input[type="range"]:focus { outline: none; }
.select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.select:focus { outline: none; border-color: var(--accent); }
.legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--muted);
}
.legend canvas {
  flex: 1;
  height: 10px;
  border-radius: 3px;
  display: block;
}
.stops { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.stop { position: relative; width: 30px; height: 26px; }
.stop input[type="color"] {
  width: 100%; height: 100%; padding: 0; border: none;
  border-radius: 4px; background: none; cursor: pointer;
}
.stop input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.stop input[type="color"]::-webkit-color-swatch { border: none; border-radius: 3px; }
.stop .rm {
  position: absolute; top: -5px; right: -5px;
  width: 14px; height: 14px; line-height: 12px; text-align: center;
  font-size: 11px; border: none; border-radius: 50%;
  background: #444; color: #fff; cursor: pointer; padding: 0;
}
.stop .rm:hover { background: #c0392b; }
.add-stop { margin-top: 8px; font-size: 11px; width: 100%; }
.check { font-size: 12px; color: var(--text); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { accent-color: var(--accent); }
.big-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(38, 38, 40, 0.6);
  border: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.big-toggle input { display: none; }
.big-toggle:hover { border-color: var(--accent); color: var(--text); }
.big-toggle-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.15s, box-shadow 0.15s;
}
.big-toggle:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: #04222f;
}
.big-toggle:has(input:checked) .big-toggle-dot {
  background: #04222f;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.55);
}
#hurricane-cat {
  display: none;
  align-items: center;
  gap: 8px;
  margin: -4px 0 10px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--hurr-color, var(--panel-border));
  background: rgba(0,0,0,0.25);
  font-size: 11.5px;
  transition: border-color 0.2s, background 0.2s;
}
#hurricane-cat.visible { display: flex; }
.hurr-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--hurr-color, var(--muted));
  flex-shrink: 0;
  box-shadow: 0 0 5px var(--hurr-color, transparent);
}
.hurr-name { font-weight: 700; color: var(--hurr-color, var(--text)); }
.hurr-range { color: var(--muted); font-size: 10.5px; }
#interactive-options {
  display: none;
  padding-left: 10px;
  border-left: 2px solid var(--panel-border);
  margin-bottom: 0;
}
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  cursor: default;
  flex-shrink: 0;
  position: relative;
  vertical-align: middle;
  line-height: 1;
}
.info-tip::after {
  content: attr(aria-label);
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  width: 200px;
  background: #1e1e20;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 900;
  white-space: normal;
}
.info-tip:hover::after { opacity: 1; }
.action {
  flex: 1;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  background: rgba(38, 38, 40, 0.6);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.action:hover { background: rgba(49, 49, 52, 0.8); }
.action.active { background: var(--accent); color: #04222f; font-weight: 600; }
.action.active .btn-icon { filter: brightness(0); }
#stations { position: absolute; inset: 0; z-index: 460; pointer-events: none; }
.station {
  position: absolute;
  transform: translate(-50%, -115%);
  background: rgba(20, 20, 22, 0.92);
  border-radius: 5px;
  padding: 5px 7px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  pointer-events: none;
}
.station::after {
  content: "";
  position: absolute;
  bottom: -5px; left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid rgba(20, 20, 22, 0.92);
}
.st-rm {
  position: absolute; top: -6px; right: -6px;
  width: 14px; height: 14px; line-height: 12px; text-align: center;
  font-size: 11px; border: none; border-radius: 50%;
  background: #444; color: #fff; cursor: pointer; padding: 0;
  pointer-events: auto;
}
.st-rm:hover { background: #c0392b; }
.st-arrow-rot {
  display: block;
  transform-origin: 50% 50%;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
.st-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 120px;
  pointer-events: auto;
}
.st-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
  opacity: 0.45;
  pointer-events: auto;
}
.st-name:hover { opacity: 1; }
.st-name-input {
  font-size: 10px;
  width: 90px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: var(--text);
  padding: 1px 4px;
  outline: none;
  pointer-events: auto;
}
.st-loc {
  font-size: 10px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  pointer-events: auto;
  flex-shrink: 0;
}
.st-loc:hover { color: var(--accent); }
.st-spd { font-weight: 600; font-variant-numeric: tabular-nums; }
.st-dir { font-size: 9px; color: var(--muted); letter-spacing: 0.5px; }
.hint {
  margin-top: 14px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  border-top: 1px solid var(--panel-border);
  padding-top: 10px;
}
.hint b { color: var(--accent); }
#settings-btn {
  position: absolute;
  top: 14px;
  right: 12px;
  z-index: 600;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  background: rgba(30, 30, 32, 0.6);
  backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}
#settings-btn:hover { background: rgba(49, 49, 52, 0.85); }
#settings-btn .spr { width: 18px; height: 18px; opacity: 0.65; transition: opacity 0.15s; }
#settings-btn:hover .spr { opacity: 1; }
#support-btn {
  position: absolute;
  top: 14px;
  right: 54px;
  z-index: 600;
  height: 34px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-radius: 6px;
  background: #ffdd00;
  color: #2a1a02;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: filter 0.15s, transform 0.15s;
}
#support-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
#settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
}
#settings-overlay.open { display: flex; }
#settings-panel {
  background: rgba(0, 0, 0, 0.616);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  backdrop-filter: blur(8px);
  padding: 20px;
  min-width: 260px;
  max-height: calc(100% - 28px);
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.settings-header span {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
#settings-close {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
#settings-close:hover { color: var(--text); }
.settings-section { margin-bottom: 16px; }
.settings-section:last-child { margin-bottom: 0; }
#vortex-ramp-btn { flex: 1; text-align: center; }
.btn-icon { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 6px; }
#ramp-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
}
#ramp-overlay.open { display: flex; }
#ramp-panel {
  background: rgba(0, 0, 0, 0.616);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  backdrop-filter: blur(8px);
  padding: 20px;
  width: 340px;
  max-width: calc(100% - 28px);
  max-height: calc(100% - 28px);
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.ramp-instructions { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 0 0 12px; }
.ramp-instructions b { color: var(--text); }
#ramp-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: rgba(12, 12, 14, 0.6);
  border: 1px solid var(--panel-border);
  cursor: crosshair;
  touch-action: none;
}
.ramp-axis {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 5px 2px 0;
}
.ramp-presets { display: flex; gap: 6px; margin-top: 12px; }
.ramp-presets .seg-btn { border-radius: 4px; }
#ramp-preview {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 6px;
  border-radius: 6px;
  background: #07070a;
  border: 1px solid var(--panel-border);
}
.settings-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.key-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 12px; color: var(--text); }
.key-btn {
  min-width: 44px;
  padding: 4px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-family: ui-monospace, "Consolas", monospace;
  font-size: 12px;
  cursor: pointer;
}
.key-btn:hover { border-color: var(--accent); }
.key-btn.listening { border-color: var(--accent); color: var(--accent); }
.key-hint { font-size: 10.5px; color: var(--muted); line-height: 1.4; margin: 8px 0 0; }
#support-overlay {
  position: fixed;
  inset: 0;
  z-index: 850;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}
#support-overlay.open,
#support-overlay.closing { display: flex; }
#support-overlay.open { opacity: 1; }
#support-panel {
  background: rgba(0, 0, 0, 0.616);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  backdrop-filter: blur(8px);
  padding: 20px;
  max-width: 320px;
  text-align: center;
  transform: scale(0.9) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#support-overlay.open #support-panel { transform: scale(1) translateY(0); }
#support-close {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
#support-close:hover { color: var(--text); }
.support-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin: 0 0 16px;
}
.support-text b { color: var(--accent); }
.support-btn { display: inline-block; }
.support-btn img { height: 48px; width: auto; vertical-align: middle; }
#waypoints { position: absolute; inset: 0; z-index: 462; pointer-events: none; }
.text-input {
  display: block; width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,0.06); border: 1px solid var(--panel-border);
  border-radius: 4px; color: var(--text); font-size: 12px;
  padding: 5px 8px; margin-bottom: 8px;
}
.text-input::placeholder { opacity: 0.4; }
.text-input:focus { outline: none; border-color: var(--accent); }
.wp-storm-label {
  position: absolute; transform: translate(-50%, calc(-100% - 44px));
  pointer-events: none; font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
  color: #fff; text-shadow: 0 1px 5px rgba(0,0,0,0.9); white-space: nowrap;
  text-transform: uppercase; z-index: 1;
}
.wp-path-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.wp-path-line { fill: none; stroke: var(--accent-2); stroke-width: 2; stroke-dasharray: 6 5; opacity: 0.75; }
.wp {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.9);
  border: 2px solid var(--cat-color, #2a1a02);
  color: #2a1a02;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: grab;
  pointer-events: auto;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  border-color: var(--cat-color, var(--storm-color, #2a1a02));
}
.wp:active { cursor: grabbing; }
.wp-cat {
  position: absolute; top: -27px; left: 50%;
  transform: translateX(-50%);
  font-size: 9px; font-weight: 700;
  background: rgba(0, 0, 0, 0.7);
  padding: 0 4px; border-radius: 3px;
  white-space: nowrap; pointer-events: none;
}
.wp-str {
  position: absolute; top: -15px; left: 50%;
  transform: translateX(-50%);
  font-size: 9px; color: var(--text);
  background: rgba(0, 0, 0, 0.65);
  padding: 0 4px; border-radius: 3px;
  white-space: nowrap; pointer-events: none;
}
.wp-rm {
  position: absolute; top: -9px; right: -9px;
  width: 15px; height: 15px; border-radius: 50%;
  background: #444; color: #fff; border: none;
  font-size: 11px; line-height: 1; cursor: pointer;
  pointer-events: auto; display: none; padding: 0;
}
.wp:hover .wp-rm { display: block; }
.wp-rm:hover { background: #c0392b; }
.vp-divider { border-top: 1px dashed var(--panel-border); margin: 12px 0; }
.vp-subtitle { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
#wp-sliders.disabled { opacity: 0.4; pointer-events: none; }
.wp.selected { background: var(--accent); color: #04222f; box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(0, 0, 0, 0.5); }
.wp-ring {
  position: absolute;
  border: 1.5px dashed rgba(56, 189, 248, 0.8);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#vortex-path { display: none; border-top: 1px dashed var(--panel-border); margin-top: 10px; padding-top: 10px; }
#btn-wp-add.active, #btn-wp-play.active, #btn-storm-play-all.active { background: var(--accent); color: #04222f; font-weight: 600; }
#btn-storm-play-all { background: #16803c; color: #fff; }
#btn-storm-play-all:hover:not(:disabled) { background: #1b9a4a; }
#btn-storm-play-all.active { background: #20a957; color: #fff; }
.wp-hint { font-size: 10.5px; color: var(--muted); line-height: 1.4; margin: 8px 0 0; }

#storm-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; max-height: 180px; overflow-y: auto; }
.storm-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 5px; cursor: pointer;
  background: rgba(255, 255, 255, 0.04); border: 1px solid transparent;
}
.storm-row:hover { background: rgba(255, 255, 255, 0.08); }
.storm-row.selected { border-color: var(--accent); background: rgba(56, 189, 248, 0.14); }
.storm-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.storm-name-lbl {
  flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; min-width: 0;
}
.storm-play, .storm-rm {
  flex: none; width: 20px; height: 20px; border-radius: 4px; border: none;
  background: rgba(255, 255, 255, 0.08); color: var(--text); cursor: pointer;
  font-size: 11px; line-height: 1; display: flex; align-items: center;
  justify-content: center; padding: 0;
}
.storm-play:hover { background: var(--accent); color: #04222f; }
.storm-rm:hover { background: #c0392b; color: #fff; }
#btn-wp-add:disabled, #btn-wp-clear:disabled, #btn-wp-play:disabled, #btn-storm-play-all:disabled,
#storm-name:disabled, #s-pathspeed:disabled, #s-pathsmooth:disabled,
#c-path-loop:disabled, #c-show-path:disabled { opacity: 0.4; pointer-events: none; }
#side-panel {
  position: absolute;
  top: 14px;
  left: calc(14px + var(--panel-width, 280px) + 8px);
  z-index: 599;
  width: 240px;
  max-height: calc(100% - 28px);
  overflow-y: auto;
  scrollbar-width: none;
  background: rgba(0, 0, 0, 0.616);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateX(-12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#side-panel::-webkit-scrollbar { display: none; }
#side-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.side-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
#side-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
#side-min { border: none; background: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1; }
#side-min:hover { color: var(--text); }
.side-section { display: none; }
#side-panel.minimized { padding-bottom: 14px; }
#side-panel.minimized .side-header { margin-bottom: 0; }
#side-panel.minimized #side-body { display: none; }
.credit-popup {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 900;
  width: 560px;
  max-width: calc(100vw - 28px);
  background: rgba(0, 0, 0, 0.651);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  padding: 20px 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  display: none;
  font-size: 13px;
  color: var(--text);
}
.credit-popup.open { display: block; }
.credit-text { margin: 0 0 12px; line-height: 1.55; }
.credit-text a { color: var(--accent); text-decoration: none; font-weight: 600; }
.credit-text a:hover { text-decoration: underline; }
.credit-dont-show { font-size: 11.5px; color: var(--muted); margin-bottom: 12px; }
.credit-ok { width: 100%; }
.hint-popup {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 905;
  width: 300px;
  max-width: calc(100% - 28px);
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  padding: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  display: none;
  font-size: 12.5px;
  color: var(--text);
}
.hint-popup.open { display: block; }
.hint-img {
  width: 100%;
  display: block;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  margin-bottom: 12px;
}
.hint-text { margin: 0 0 14px; line-height: 1.5; }
.hint-text b { color: var(--accent); }
.hint-popup .action { width: 100%; }
#bottom-bar {
  position: absolute;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  right: 12px;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: ui-monospace, "Consolas", monospace;
}
#fps {
  color: var(--muted);
  background: rgba(22, 22, 22, 0.7);
  padding: 3px 8px;
  border-radius: 4px;
}
#tiktok-link {
  color: var(--muted);
  background: rgba(22, 22, 22, 0.7);
  padding: 3px 8px;
  border-radius: 4px;
  text-decoration: none;
  transition: color 0.15s;
}
#tiktok-link:hover { color: var(--text); }
#version {
  color: var(--muted);
  background: rgba(22, 22, 22, 0.7);
  padding: 3px 8px;
  border-radius: 4px;
}
/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE TIERS

   app.js (applyDeviceTier) stamps <body> with exactly one of
   dev-phone | dev-tablet | dev-desktop, plus `is-touch` on coarse pointers and
   `phone-landscape` on a phone held sideways. Layout keys off those classes
   rather than raw media queries so the JS (which owns the sheet drag / drawer
   state) and the CSS can never disagree about which tier is active.

   phone   → bottom sheet (portrait) / left drawer (landscape)
   tablet  → desktop-style floating panels, touch-sized
   desktop → unchanged
   ═══════════════════════════════════════════════════════════════════════════ */

#side-grabber { display: none; }
#sheet-peek-label { display: none; }
#panel-resize-handle {
  position: absolute;
  top: 18%;
  right: -7px;
  width: 14px;
  height: 64%;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.18), rgba(255, 255, 255, 0.08));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32), inset 0 0 0 3px rgba(0, 0, 0, 0.14);
  cursor: ew-resize;
  touch-action: none;
  opacity: 0.72;
  transition: opacity 0.18s, transform 0.18s, background 0.18s;
}
#panel-resize-handle::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 4px;
  height: 28px;
  transform: translateY(-50%);
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  border-radius: 2px;
}
#panel-resize-handle:hover,
#panel-resize-handle:focus-visible {
  opacity: 1;
  transform: scaleX(1.15);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.38), rgba(255, 255, 255, 0.14));
  outline: none;
}
#panel.panel-resizing #panel-resize-handle { opacity: 1; }
.btn-emoji { line-height: 1; }

/* Top-right cluster. A flex row that packs itself: these were three separately
   absolute-positioned buttons with hand-tuned `right:` offsets, which silently
   overlap as soon as anything changes their width (e.g. touch sizing them up to
   44px). Two-ID selectors so they beat the children's own #id positioning. */
#top-right-bar {
  position: absolute;
  top: 14px;
  right: 12px;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
#top-right-bar > #support-btn,
#top-right-bar > #settings-btn {
  position: static;
  top: auto;
  right: auto;
}
/* Touch: the 34px chrome buttons are under the 44px minimum target. The cluster
   also goes icon-only — the labelled version is ~300px wide, which does not fit
   beside the panels on a portrait tablet, let alone on a phone. */
body.is-touch #settings-btn,
body.is-touch #support-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
  border-radius: 12px;
}
body.is-touch #support-btn .btn-label { display: none; }
body.is-touch #support-btn .btn-emoji { font-size: 20px; }
body.dev-tablet #top-right-bar { top: var(--safe-t); right: var(--safe-r); }

/* ── Shared touch affordances (phone + tablet) ───────────────────────────── */
body.is-touch { overscroll-behavior: none; }
body.is-touch .phone-only { display: block; }
body.is-touch .phone-hide { display: none; }
/* The desktop collapse tab is meaningless against a sheet. The tablet and
   phone-landscape rules below re-enable it as their drawer pull-tab. */
body.is-touch #panel-toggle { display: none; }

/* Hit targets: nothing interactive below ~44px. */
body.is-touch .tool { min-height: 50px; padding: 10px 6px; font-size: 12px; }
body.is-touch .action { min-height: 44px; font-size: 13px; }
body.is-touch .seg-btn { min-height: 44px; font-size: 12.5px; }
body.is-touch .layer-item,
body.is-touch .layer-reset-btn { min-height: 44px; padding: 10px 12px; font-size: 13px; }
body.is-touch .layer-cfg-btn { width: 44px; height: 44px; }
body.is-touch .layer-handle { width: 32px; height: 44px; font-size: 16px; }
body.is-touch .big-toggle { min-height: 50px; }
body.is-touch .check { min-height: 40px; font-size: 13px; }
body.is-touch .check input { width: 20px; height: 20px; }
body.is-touch .group h2 { min-height: 44px; display: flex; align-items: center; }
body.is-touch #side-min { width: 44px; height: 44px; font-size: 26px; padding: 0; }
body.is-touch .text-input { min-height: 44px; font-size: 15px; }
body.is-touch .wp-rm { width: 28px; height: 28px; }

/* Sliders: the native thumb is far too small to grab with a thumb. */
body.is-touch input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 30px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
body.is-touch input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
}
body.is-touch input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0d0d0f;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
body.is-touch input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
}
body.is-touch input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0d0d0f;
}

/* Tooltips: there is no hover on touch, so app.js toggles .tip-open on tap. */
body.is-touch .info-tip { width: 24px; height: 24px; font-size: 12px; }
body.is-touch .info-tip:hover::after { opacity: 0; }
body.is-touch .info-tip::after { width: min(240px, 68vw); pointer-events: none; }
body.is-touch .info-tip.tip-open::after { opacity: 1; }

/* Canvases inside dialogs must not eat the page scroll. */
body.is-touch #ramp-canvas { width: 100%; height: auto; touch-action: none; }

/* ── Phone ──────────────────────────────────────────────────────────────── */
body.dev-phone {
  --safe-l: max(12px, env(safe-area-inset-left, 0px));
  --safe-r: max(12px, env(safe-area-inset-right, 0px));
  --safe-t: max(12px, env(safe-area-inset-top, 0px));
  /* Floating map chrome clears the collapsed sheet in portrait; in landscape
     the panel is a side drawer, so the bottom edge is free. */
  --chrome-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}
body.dev-phone.phone-landscape {
  --chrome-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

body.dev-phone #panel-title { max-width: 150px; }
body.dev-phone .tool-grid { grid-template-columns: repeat(3, 1fr); }

/* Portrait: bottom sheet. app.js owns the transform (inline) so it can drag. */
body.dev-phone:not(.phone-landscape) #panel {
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: none;
  height: var(--panel-sheet-height, 88dvh);
  max-height: var(--panel-sheet-height, 88dvh);
  padding: 0 16px calc(24px + env(safe-area-inset-bottom, 0px));
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.55);
}
/* While a finger is down the sheet must track it 1:1, not ease. */
body.dev-phone #panel.sheet-dragging { transition: none; }

body.dev-phone:not(.phone-landscape) #sheet-handle {
  display: block;
  position: sticky;
  top: 0;
  margin: 0 -16px 10px;
  padding: 10px 0 8px;
  background: rgba(18, 18, 20, 0.94);
  backdrop-filter: blur(10px);
  border-radius: 18px 18px 0 0;
  cursor: grab;
  touch-action: none;
  text-align: center;
  z-index: 3;
}
body.dev-phone:not(.phone-landscape) #panel-resize-handle {
  top: 5px;
  right: 50%;
  width: 72px;
  height: 8px;
  transform: translateX(50%);
  border: none;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
  cursor: ns-resize;
}
body.dev-phone:not(.phone-landscape) #panel-resize-handle::after {
  display: none;
}
body.dev-phone:not(.phone-landscape) #panel-resize-handle:hover,
body.dev-phone:not(.phone-landscape) #panel-resize-handle:focus-visible {
  transform: translateX(50%) scaleY(1.35);
}
body.dev-phone:not(.phone-landscape) #sheet-handle::before {
  content: "";
  display: block;
  width: 44px;
  height: 5px;
  margin: 0 auto 6px;
  border-radius: 3px;
  background: var(--muted);
}
body.dev-phone:not(.phone-landscape) #sheet-peek-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Landscape: left drawer, so the short viewport keeps its full height.
   #panel-toggle becomes the drawer's pull tab (it already toggles
   .panel-hidden on desktop, so the existing handler just works). */
body.dev-phone.phone-landscape #panel {
  top: 0;
  bottom: 0;
  left: 0;
  right: auto;
  width: min(var(--panel-width, 320px), 78vw);
  height: 100dvh;
  max-height: 100dvh;
  padding: 14px max(14px, env(safe-area-inset-right, 0px)) 20px
           max(14px, env(safe-area-inset-left, 0px));
  border-radius: 0 16px 16px 0;
  border-left: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
body.dev-phone.phone-landscape #panel.panel-hidden { transform: translateX(-100%); }
body.dev-phone.phone-landscape #panel-toggle {
  display: block;
  top: 50%;
  left: min(var(--panel-width, 320px), 78vw);
  width: 24px;
  height: 64px;
  transition: left 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
body.dev-phone.phone-landscape #panel-toggle.panel-hidden { left: 0; }
body.dev-phone.phone-landscape #panel-resize-handle {
  display: none;
}
body.dev-phone #panel.panel-hidden #panel-resize-handle { pointer-events: none; }

/* Side panel (Typhoon path): a second sheet in portrait, right drawer in
   landscape. Previously it kept its 240px desktop offset and sat off-screen. */
body.dev-phone:not(.phone-landscape) #side-panel {
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 640;
  width: 100%;
  max-width: none;
  max-height: 74dvh;
  padding: 0 16px calc(20px + env(safe-area-inset-bottom, 0px));
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  opacity: 1;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.6);
}
body.dev-phone:not(.phone-landscape) #side-panel.open { transform: translateY(0); }
body.dev-phone:not(.phone-landscape) #side-grabber {
  display: block;
  position: sticky;
  top: 0;
  margin: 0 -16px 8px;
  padding: 10px 0 8px;
  background: rgba(18, 18, 20, 0.94);
  backdrop-filter: blur(10px);
  border-radius: 18px 18px 0 0;
  z-index: 2;
}
body.dev-phone:not(.phone-landscape) #side-grabber::before {
  content: "";
  display: block;
  width: 44px;
  height: 5px;
  margin: 0 auto;
  border-radius: 3px;
  background: var(--muted);
}
body.dev-phone.phone-landscape #side-panel {
  top: 0;
  bottom: 0;
  right: 0;
  left: auto;
  z-index: 640;
  width: min(300px, 76vw);
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  border-radius: 16px 0 0 16px;
  border-right: none;
  opacity: 1;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
body.dev-phone.phone-landscape #side-panel.open { transform: translateX(0); }

/* Map chrome. Paint/Move sits bottom-left in thumb reach; zoom + layers
   stack bottom-right; the fps/credit strip moves out of their way. */
body.dev-phone #mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: absolute;
  top: auto;
  bottom: var(--chrome-bottom);
  left: var(--safe-l);
  z-index: 620;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
body.dev-phone #zoom-ctrl {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: absolute;
  top: auto;
  transform: none;
  bottom: calc(var(--chrome-bottom) + 56px);
  right: var(--safe-r);
  z-index: 620;
}
body.dev-phone #btn-layers {
  bottom: var(--chrome-bottom);
  right: var(--safe-r);
  width: 48px;
  height: 48px;
  border-radius: 24px;
}
body.dev-phone #layers-menu {
  bottom: calc(var(--chrome-bottom) + 56px);
  right: var(--safe-r);
  z-index: 630;
  min-width: 220px;
}
body.dev-phone #damage-legend {
  bottom: calc(var(--chrome-bottom) + 56px);
  left: var(--safe-l);
  right: auto;
}
body.dev-phone #bottom-bar {
  top: var(--safe-t);
  bottom: auto;
  left: var(--safe-l);
  right: auto;
  font-size: 10px;
}

/* Map chrome floats above the panel (z 620 vs 600) and the sheet is translucent,
   so a raised sheet would have the Paint pill and zoom buttons showing straight
   through it. Fade the chrome out whenever a sheet is up — at that point you are
   editing settings, not the map — and restore it the moment the sheet drops. */
body.dev-phone #mode-toggle,
body.dev-phone #zoom-ctrl,
body.dev-phone #btn-layers,
body.dev-phone #damage-legend,
body.dev-phone #layers-menu {
  transition: opacity 0.2s ease;
}
body.dev-phone.sheet-raised #mode-toggle,
body.dev-phone.sheet-raised #zoom-ctrl,
body.dev-phone.sheet-raised #btn-layers,
body.dev-phone.sheet-raised #damage-legend,
body.dev-phone.sheet-raised #layers-menu,
body.dev-phone.side-open #mode-toggle,
body.dev-phone.side-open #zoom-ctrl,
body.dev-phone.side-open #btn-layers,
body.dev-phone.side-open #damage-legend,
body.dev-phone.side-open #layers-menu {
  opacity: 0;
  pointer-events: none;
}

body.dev-phone #top-right-bar { top: var(--safe-t); right: var(--safe-r); }
/* The full strip ("60 fps · 1500 particles @localmcr Beta 7") is wider than the
   gap left beside the top-right cluster on a 360px phone. Keep the live fps
   readout; the credit and version are both still in the welcome card and About. */
body.dev-phone #tiktok-link,
body.dev-phone #version { display: none; }

/* Dialogs go near-fullscreen rather than floating in a 300px box. */
body.dev-phone #settings-panel,
body.dev-phone #ramp-panel {
  width: calc(100vw - 24px);
  min-width: 0;
  max-width: none;
  max-height: 86dvh;
  border-radius: 14px;
}
body.dev-phone .credit-popup,
body.dev-phone .hint-popup {
  width: calc(100vw - 24px);
  max-height: 86dvh;
  overflow-y: auto;
}

/* ── Tablet: floating panels, touch-sized ───────────────────────────────── */
body.dev-tablet {
  --safe-l: max(14px, env(safe-area-inset-left, 0px));
  --safe-r: max(14px, env(safe-area-inset-right, 0px));
  --safe-t: max(14px, env(safe-area-inset-top, 0px));
  /* Clears the fps/credit strip, which stays bottom-right on tablet — otherwise
     the Paint pill and the layers button land straight on top of it. */
  --safe-b: calc(40px + env(safe-area-inset-bottom, 0px));
}
body.dev-tablet #panel {
  top: var(--safe-t);
  left: var(--safe-l);
  width: 320px;
  max-height: calc(100dvh - var(--safe-t) - var(--safe-b));
  border-radius: 12px;
}
body.dev-tablet #sheet-handle { display: none; }
body.dev-tablet #panel-toggle {
  display: block;
  left: calc(var(--safe-l) + 320px + 4px);
  width: 24px;
  height: 56px;
}
body.dev-tablet #panel-toggle.panel-hidden { left: var(--safe-l); }
body.dev-tablet #panel.panel-hidden { transform: translateX(calc(-100% - 24px)); }
/* Sits clear of the collapse tab (which occupies +324px..+348px), not under it. */
body.dev-tablet #side-panel {
  top: var(--safe-t);
  left: calc(var(--safe-l) + 356px);
  width: 280px;
  max-height: calc(100dvh - var(--safe-t) - var(--safe-b));
  border-radius: 12px;
}
/* Bottom-right, tucked left of the layers button. Centring it would put it on
   top of the side panel, which runs the full height of the left column. */
body.dev-tablet #mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: absolute;
  top: auto;
  bottom: var(--safe-b);
  left: auto;
  right: calc(var(--safe-r) + 60px);
  transform: none;
  z-index: 620;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
body.dev-tablet #zoom-ctrl {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: absolute;
  right: var(--safe-r);
  top: 50%;
  transform: translateY(-50%);
  z-index: 620;
}
body.dev-tablet #btn-layers {
  bottom: var(--safe-b);
  right: var(--safe-r);
  width: 48px;
  height: 48px;
}
body.dev-tablet #layers-menu {
  bottom: calc(var(--safe-b) + 56px);
  right: var(--safe-r);
}
body.dev-tablet #damage-legend { bottom: calc(var(--safe-b) + 56px); right: calc(var(--safe-r) + 56px); }

/* ── Zoom buttons (shared by phone + tablet) ────────────────────────────── */
body.is-touch #zoom-ctrl button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
body.dev-phone #zoom-ctrl button { border-radius: 24px; }
body.is-touch #zoom-ctrl button:active { background: var(--accent); color: #04222f; }
body.is-touch #mode-toggle.move-mode {
  background: var(--accent);
  color: #04222f;
  border-color: var(--accent);
}

/* Two-finger gesture mode drives pan/pinch directly, so the paint/move
   toggle and the zoom buttons are redundant. Must stay last to win the
   specificity tie against the tier rules above. */
body.gesture-twofinger #mode-toggle { display: none; }
body.gesture-twofinger #zoom-ctrl { display: none; }
