/* VTT Map — client styles. Colors follow GM Tools (assets/css/style.css there). */

@font-face {
  font-family: "Share Tech Mono";
  src: url("../fonts/ShareTechMono-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg-deep: #070b12;
  --bg: #0c121c;
  --bg-panel: #111a28;
  --bg-card: #152033;
  --bg-hover: #1c2a40;
  --border: #2a3d5c;
  --border-soft: #1e2d45;
  --text: #e6eef8;
  --text-muted: #8fa3bd;
  --text-dim: #5c708a;
  --accent: #2dd4bf;
  --accent-ink: #042f2e;
  --accent-glow: rgba(45, 212, 191, 0.28);
  --magenta: #e879f9;
  --gold: #fbbf24;
  --link: #67e8f9;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Share Tech Mono", "Cascadia Code", Consolas, monospace;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg-deep); color: var(--text); font: 14px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); }
kbd { font: 12px var(--mono); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-card); }
.noscript { padding: 40px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- controls ---------- */
.btn {
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(12, 18, 28, 0.9); color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap; transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
.btn:hover { background: var(--bg-hover); border-color: #3b5378; }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; box-shadow: 0 0 20px var(--accent-glow); }
.btn.primary:hover { background: #5eead4; }
.btn.danger { color: var(--danger); border-color: rgba(248, 113, 113, 0.45); background: transparent; }
.btn.ghost { background: transparent; }
.btn.small { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; }
.btn.wide { width: 100%; }
.icon-btn { width: 40px; padding: 0; }
.icon-btn svg, .btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.link-btn { border: 0; background: none; color: var(--link); padding: 4px 0; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.chip {
  height: 34px; min-width: 40px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg-panel); color: var(--text-muted);
}
.chip.on { border-color: var(--accent); background: rgba(45, 212, 191, 0.14); color: var(--accent); font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span, .label { font: 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.input, .field input[type=text], .field input[type=url], .field input[type=number], .field textarea {
  height: 38px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-panel); color: var(--text); outline: none; width: 100%;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; font: 14px/1.5 var(--mono); }
.input:focus, .field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.15); }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.hint-text { font-size: 12px; color: var(--text-muted); margin: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; padding: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35); }
.sw.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset; }
.sw-pick { width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- stage + board ---------- */
.stage {
  position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
  background-color: var(--bg-deep); background-image: radial-gradient(circle, rgba(143, 163, 189, 0.08) 1px, transparent 1px); background-size: 26px 26px;
}
.stage.panning { cursor: grabbing; }
.stage.mode-stamp, .stage.mode-zones, .stage.mode-measure, .stage.mode-calibrate { cursor: crosshair; }
.board { position: absolute; left: 0; top: 0; transform-origin: 0 0; border-radius: 6px; box-shadow: 0 0 0 1px var(--border), 0 30px 80px rgba(0, 0, 0, 0.6); }
.b-surface, .b-image, .b-grid, .b-zones, .b-guides, .b-tokens, .b-fx { position: absolute; inset: 0; }
.b-surface { border-radius: 6px; background: #1b1f27; }
.b-surface.bs-parchment { background: radial-gradient(ellipse at 30% 20%, rgba(255, 240, 200, 0.35), transparent 60%), #c4a574; }
.b-surface.bs-stone { background-color: #565a62; background-image: radial-gradient(rgba(255, 255, 255, 0.05) 18%, transparent 19%), radial-gradient(rgba(0, 0, 0, 0.12) 15%, transparent 16%); background-size: 23px 23px, 37px 37px; }
.b-surface.bs-grass { background-color: #3a6a30; background-image: radial-gradient(rgba(120, 180, 80, 0.25) 20%, transparent 21%); background-size: 19px 19px; }
.b-surface.bs-wood { background-color: #6b4423; background-image: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 48px), repeating-linear-gradient(0deg, rgba(255, 220, 160, 0.05) 0 1px, transparent 1px 7px); }
.b-surface.bs-slate { background: #2a3140; }
.b-surface.bs-sand { background-color: #d4b878; background-image: radial-gradient(rgba(120, 90, 40, 0.18) 12%, transparent 13%); background-size: 17px 17px; }
.b-image { width: 100%; height: 100%; object-fit: fill; border-radius: 6px; pointer-events: none; }
.b-grid { pointer-events: none; border-radius: 6px; }
.b-zones { pointer-events: none; }
.zone { position: absolute; border: 2px solid; border-radius: 3px; display: flex; align-items: flex-start; justify-content: flex-start; }
.zone.circle { border-radius: 50%; align-items: center; justify-content: center; }
.zone span { font: 12px var(--mono); padding: 3px 6px; color: #fff; text-shadow: 0 1px 2px #000; pointer-events: none; }
.stage.mode-zones .b-zones { pointer-events: auto; }
.stage.mode-zones .zone { cursor: move; }
.zone.sel { box-shadow: 0 0 0 2px var(--bg-deep), 0 0 0 4px var(--accent); }
.zone .handle { position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px; border-radius: 4px; background: var(--accent); border: 2px solid var(--bg-deep); cursor: nwse-resize; }
.zone.circle .handle { right: 50%; bottom: auto; top: 50%; transform: translate(50%, -50%); margin-right: calc(-50% - 0px); cursor: ew-resize; }
.b-tokens { z-index: 1; }
.b-guides { pointer-events: none; z-index: 2; }
.b-fx { z-index: 3; pointer-events: none; }
.b-guides svg { position: absolute; inset: 0; overflow: visible; }
.g-origin { position: absolute; border: 2px dashed rgba(230, 238, 248, 0.45); }
.g-target { position: absolute; border: 2px solid var(--accent); background: rgba(45, 212, 191, 0.12); border-radius: 8px; }
.g-label, .m-label {
  position: absolute; padding: 3px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--accent); color: var(--accent);
  font: 13px var(--mono); white-space: nowrap; transform: translate(10px, -50%);
}
.m-label { border-color: var(--gold); color: var(--gold); }
.g-ghost { position: absolute; border: 3px dashed; border-radius: 50%; opacity: 0.6; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.g-draw { position: absolute; border: 2px dashed var(--gold); background: rgba(251, 191, 36, 0.15); }
.g-draw.circle { border-radius: 50%; }

/* ---------- tokens ---------- */
.tok { position: absolute; touch-action: none; cursor: grab; transition: left 0.24s var(--ease-pop), top 0.24s var(--ease-pop); }
.stage.mode-zones .tok, .stage.mode-measure .tok, .stage.mode-calibrate .tok { pointer-events: none; }
.tok-face {
  position: absolute; inset: 0; border-radius: 6px; border: 0 solid #000; overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.2s, filter 0.4s, opacity 0.4s;
}
/* Own images are stretched to the cell like the original tool did (object-fit: fill), never cropped:
   people draw round/oval tokens on purpose. No plate behind them; the shadow follows their transparency. */
.tok-face img { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.tok:not(.glyph) .tok-face { filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.55)); }
.tok-face .glyph { position: absolute; inset: 0; -webkit-mask: none center / 100% 100% no-repeat; mask: none center / 100% 100% no-repeat; }
.tok.glyph .tok-face { background: #0a0f17; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5); }
.tok.round .tok-face { border-radius: 50%; }
.tok:hover .tok-face { box-shadow: 0 6px 12px rgba(0, 0, 0, 0.55), 0 0 0 2px rgba(230, 238, 248, 0.3); }
.tok.sel .tok-face { box-shadow: 0 0 0 3px var(--accent), 0 0 20px var(--accent-glow); }
.tok.lifted { transition: none; z-index: 60; cursor: grabbing; }
.tok.lifted .tok-face { transform: scale(1.14); box-shadow: 0 20px 22px rgba(0, 0, 0, 0.55), 0 0 0 3px rgba(45, 212, 191, 0.7); }
.tok.down .tok-face { transform: rotate(-24deg) scale(0.88); filter: grayscale(1) brightness(0.7); opacity: 0.7; }
.tok-bars { position: absolute; left: 10%; right: 10%; top: 100%; margin-top: 2px; display: flex; flex-direction: column; gap: 1px; pointer-events: none; }
.tok-bars i { display: block; height: 4px; border-radius: 2px; background: rgba(0, 0, 0, 0.75); overflow: hidden; }
.tok-bars b { display: block; height: 100%; border-radius: 2px; transition: width 0.35s ease, background 0.35s; }
.tok-name {
  position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -3px); white-space: nowrap; pointer-events: none;
  font-size: 11px; padding: 1px 8px; border-radius: 999px; background: rgba(12, 18, 28, 0.94); border: 1px solid var(--border);
  opacity: 0; transition: opacity 0.15s;
}
.tok:hover .tok-name, .tok.sel .tok-name, .tok.lifted .tok-name, .names-on .tok-name { opacity: 1; }
.float {
  position: absolute; width: 80px; margin-left: -40px; text-align: center; pointer-events: none; z-index: 70;
  font: 700 28px var(--mono); text-shadow: 0 2px 0 #000, 0 0 14px currentColor; animation: floatup 1s ease-out forwards;
}

/* ---------- HUD ---------- */
.hud-top { position: fixed; top: 0; left: 0; right: 0; padding: max(14px, env(safe-area-inset-top)) 16px 0; display: flex; gap: 10px; align-items: flex-start; pointer-events: none; z-index: 20; }
.hud-top > * { pointer-events: auto; }
.title-chip {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px 0 8px; border-radius: 12px; min-width: 0; max-width: 46vw;
  border: 1px solid var(--border-soft); background: rgba(12, 18, 28, 0.9); color: var(--text); font-weight: 600;
}
.title-chip .logo { width: 28px; height: 28px; flex-shrink: 0; border-radius: 7px; border: 1px solid var(--accent); display: grid; place-items: center; color: var(--accent); }
.title-chip .logo svg { width: 16px; height: 16px; }
.title-chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0; transition: background 0.2s; }
.save-dot.busy { background: var(--gold); }
.hud-actions { margin-left: auto; display: flex; gap: 8px; }
.hud-actions .btn { height: 44px; border-radius: 12px; }
.hud-actions .icon-btn { width: 44px; }
.hud-zoom { position: fixed; left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 4px; z-index: 20; }
.hud-zoom .btn { width: 40px; height: 40px; padding: 0; border-color: var(--border-soft); color: var(--text-muted); }
.fab { display: none; }
.toast {
  position: fixed; left: 50%; top: max(70px, calc(env(safe-area-inset-top) + 60px)); transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 10px; padding: 7px 7px 7px 16px; border-radius: 999px; background: var(--bg-panel); border: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45); font-size: 13px; white-space: nowrap; max-width: calc(100vw - 32px);
}
.toast.plain { padding-right: 16px; }
.toast .btn { height: 28px; border-radius: 999px; background: var(--bg-hover); border: 0; color: var(--link); padding: 0 12px; }
.banner {
  position: fixed; left: 50%; top: max(70px, calc(env(safe-area-inset-top) + 60px)); transform: translateX(-50%); z-index: 85;
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 999px; background: var(--bg); border: 1px solid var(--accent);
  box-shadow: 0 0 24px var(--accent-glow); max-width: calc(100vw - 32px);
}
.banner .btn { height: 30px; border-radius: 999px; }
.first-hint {
  position: fixed; left: 50%; bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px)); transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px; border-radius: 14px; background: rgba(17, 26, 40, 0.97);
  border: 1px solid var(--border); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); color: #c9d6e6; white-space: nowrap;
}
.first-hint b { color: var(--text); }
.first-hint .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text-dim); }

/* ---------- menu ---------- */
.menu {
  position: fixed; z-index: 80; min-width: 250px; padding: 6px; overflow-y: auto; overscroll-behavior: contain; border-radius: 14px; background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.menu button, .menu .mi { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border: 0; border-radius: 9px; background: none; text-align: left; color: var(--text); }
.menu button:hover { background: var(--bg-hover); }
.menu svg { width: 17px; height: 17px; color: var(--text-muted); flex-shrink: 0; }
.menu .k { margin-left: auto; font: 11px var(--mono); color: var(--text-dim); }
.menu hr { border: 0; border-top: 1px solid var(--border-soft); margin: 5px 4px; }
.menu .seg { margin-left: auto; display: flex; gap: 2px; }
.menu .seg button { min-height: 26px; width: auto; padding: 0 8px; font-size: 12px; border-radius: 6px; color: var(--text-muted); }
.menu .seg button.on { background: rgba(45, 212, 191, 0.16); color: var(--accent); }

/* ---------- token card ---------- */
.card {
  position: fixed; z-index: 70; width: 284px; padding: 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--border);
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; cursor: default;
}
.card-head { display: flex; align-items: center; gap: 8px; }
.card-head .dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.card-head strong { flex: 1 1 auto; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head .x { width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--text-muted); font-size: 16px; }
.card-head .x:hover { background: var(--bg-hover); }
.hp-row { display: flex; align-items: center; gap: 8px; }
.hp-btn { width: 46px; height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-card); font-size: 22px; line-height: 1; transition: transform 0.08s; }
.hp-btn:active { transform: scale(0.9); }
.hp-bar { flex: 1 1 auto; height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-panel); position: relative; overflow: hidden; display: grid; place-items: center; }
.hp-bar i { position: absolute; left: 0; top: 0; bottom: 0; opacity: 0.3; transition: width 0.35s, background 0.35s; }
.hp-bar span { position: relative; font: 17px var(--mono); }
.dmg-input { height: 36px; font-family: var(--mono); }
.card-sec { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.card-sec .lab { width: 54px; flex-shrink: 0; font-size: 12px; color: var(--text-muted); }
.mini-num { width: 64px !important; height: 32px !important; padding: 0 8px !important; }
.bar-row { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.bar-row .bd { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.bar-row .bn { width: 70px; color: var(--text-muted); }

/* ---------- drawers, sheets, panels ---------- */
.backdrop { position: fixed; inset: 0; z-index: 75; background: rgba(7, 11, 18, 0.62); }
.sheet {
  position: fixed; z-index: 76; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(540px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  overflow-y: auto; padding: 22px; border-radius: 18px; background: var(--bg-panel); border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 16px;
}
.sheet h2 { margin: 0; font-size: 19px; font-weight: 600; flex: 1 1 auto; }
.sheet-head { display: flex; align-items: center; gap: 10px; }
.sheet ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: #c9d6e6; }
.side {
  position: fixed; z-index: 60; top: 72px; right: 16px; bottom: 16px; width: 340px; overflow-y: auto; padding: 18px; border-radius: 16px;
  background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px;
}
.side h2 { margin: 0; font-size: 17px; font-weight: 600; flex: 1 1 auto; }
.drawer {
  position: fixed; z-index: 65; left: 50%; bottom: 0; transform: translateX(-50%); width: min(1040px, 100vw); max-height: min(62vh, 520px);
  display: flex; flex-direction: column; border-radius: 20px 20px 0 0; background: var(--bg); border: 1px solid var(--border); border-bottom: 0;
  box-shadow: 0 -16px 50px rgba(0, 0, 0, 0.55); padding-bottom: env(safe-area-inset-bottom);
}
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 10px; }
.drawer-head h2 { margin: 0 8px 0 0; font-size: 16px; font-weight: 600; }
.tabs { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--bg-panel); border: 1px solid var(--border); }
.tabs button { height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: none; color: var(--text-muted); }
.tabs button.on { background: rgba(45, 212, 191, 0.16); color: var(--accent); font-weight: 600; }
.drawer-body { overflow-y: auto; padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.drawer-body > *, .side > *, .zones-bar > *, .sheet > * { flex-shrink: 0; }
.cat-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.cat-row .chip { flex-shrink: 0; height: 30px; border-radius: 999px; font-size: 13px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 8px; }
.icon-tile {
  height: 88px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-panel); color: #c9d6e6; font-size: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 4px; transition: transform 0.12s, border-color 0.12s;
}
.icon-tile:hover { transform: translateY(-2px); border-color: #5c708a; }
.icon-tile.on { border-color: var(--accent); background: rgba(45, 212, 191, 0.12); color: var(--accent); }
.icon-tile .ico { width: 44px; height: 44px; border-radius: 9px; background: #0a0f17; position: relative; overflow: hidden; }
.icon-tile .ico i { position: absolute; inset: 0; -webkit-mask: none center / 100% 100% no-repeat; mask: none center / 100% 100% no-repeat; }
.icon-tile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-opts { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; }
.roster-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.roster-chips { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.rchip { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 4px; border-radius: 999px; background: var(--bg-panel); border: 1px solid var(--border); font-size: 13px; }
.rchip .ico { width: 24px; height: 24px; border-radius: 50%; background: #0a0f17; position: relative; overflow: hidden; }
.rchip .ico i { position: absolute; inset: 0; -webkit-mask: none center / 100% 100% no-repeat; mask: none center / 100% 100% no-repeat; }
.zones-bar {
  position: fixed; z-index: 60; left: 16px; top: 72px; width: 300px; padding: 14px; border-radius: 16px; background: var(--bg); border: 1px solid var(--border);
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 90px); overflow-y: auto;
}
.zones-bar h2 { margin: 0; font-size: 16px; font-weight: 600; flex: 1 1 auto; }
.share-preview { height: 190px; border-radius: 12px; border: 1px solid var(--border); background: #0a0f17; overflow: hidden; display: grid; place-items: center; }
.share-preview img { width: 100%; height: 100%; object-fit: contain; }
.big-copy { display: flex; gap: 8px; }
.big-copy .input { height: 48px; font-family: var(--mono); }
.big-copy .btn { height: 48px; padding: 0 22px; font-size: 15px; }
.share-more { border-top: 1px solid var(--border-soft); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.share-more .line { display: flex; align-items: center; gap: 10px; }
.share-more .line span { flex: 1 1 auto; color: #c9d6e6; }
.warn { color: var(--gold); font-size: 12px; margin: 0; }

/* ---------- new map ---------- */
.newmap { position: fixed; inset: 0; overflow-y: auto; z-index: 10; padding: 40px 16px; display: flex; justify-content: center; }
.nm-wrap { width: min(980px, 100%); display: flex; flex-direction: column; gap: 22px; }
.nm-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nm-head h1 { margin: 0; font-size: 26px; font-weight: 600; flex: 1 1 auto; }
.steps { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-muted); }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps li b { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); display: grid; place-items: center; font: 12px var(--mono); }
.steps li.on { color: var(--accent); font-weight: 600; }
.steps li.on b { border-color: var(--accent); background: rgba(45, 212, 191, 0.15); }
.steps li.done { color: var(--ok); }
.steps li.done b { border-color: var(--ok); }
.steps .sep { width: 24px; height: 1px; background: var(--border); }
.nm-card { padding: 22px; border-radius: 18px; background: var(--bg-panel); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px; }
.nm-card h2 { margin: 0; font-size: 19px; font-weight: 600; }
.board-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.board-pick button { height: 78px; border-radius: 12px; border: 2px solid var(--border); position: relative; overflow: hidden; padding: 0; }
.board-pick button span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px; font-size: 12px; background: rgba(7, 11, 18, 0.75); }
.board-pick button.on { border-color: var(--accent); box-shadow: 0 0 18px var(--accent-glow); }
.board-pick .b-surface { position: absolute; inset: 0; border-radius: 0; }
.nm-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.nm-foot .btn { height: 50px; padding: 0 26px; font-size: 16px; }
.recent a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 9px; color: var(--text); text-decoration: none; }
.recent a:hover { background: var(--bg-hover); }
.recent time { color: var(--text-muted); font-size: 12px; }
.nm-error { padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(248, 113, 113, 0.5); color: #fecaca; background: rgba(248, 113, 113, 0.08); }

/* ---------- embed (GM Tools table iframe) ---------- */
.embed .hide-embed { display: none !important; }

/* ---------- phone ---------- */
@media (max-width: 680px) {
  .hud-top { padding-left: 10px; padding-right: 10px; gap: 6px; }
  .title-chip { max-width: none; flex: 1 1 auto; }
  .hud-actions .add-btn { display: none; }
  .hud-actions .btn.share-btn span { display: none; }
  .hud-actions .btn.share-btn { width: 44px; padding: 0; }
  .hud-zoom { display: none; }
  .fab {
    display: grid; place-items: center; position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 25; width: 60px; height: 60px;
    border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px rgba(45, 212, 191, 0.35);
  }
  .fab svg { width: 26px; height: 26px; }
  .card-open .fab, .card-open .first-hint { display: none; }
  .card { left: 8px !important; right: 8px; top: auto !important; bottom: max(8px, env(safe-area-inset-bottom)); width: auto; max-height: 70vh; overflow-y: auto; border-radius: 18px; }
  .hp-btn { width: 60px; height: 52px; }
  .hp-bar { height: 52px; }
  .side, .zones-bar { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 62vh; }
  .drawer { max-height: 78vh; }
  .roster-grid { grid-template-columns: minmax(0, 1fr); }
  .first-hint { flex-wrap: wrap; white-space: normal; width: calc(100vw - 32px); justify-content: center; }
  .first-hint .dot { display: none; }
  .toast, .banner { white-space: normal; }
}

/* ---------- motion (same switch as GM Tools: full / reduced / off) ---------- */
.fx-land .tok-face { animation: land 0.34s ease-out; }
.fx-hitA .tok-face { animation: hitA 0.42s ease-out; }
.fx-hitB .tok-face { animation: hitB 0.42s ease-out; }
.fx-hitA .tok-face::after, .fx-hitB .tok-face::after { content: ""; position: absolute; inset: 0; background: #ef4444; animation: flash 0.45s ease-out forwards; }
.fx-heal .tok-face { animation: heal 0.7s ease-out; }
.fx-drop .tok-face { animation: drop 0.5s var(--ease-pop); }
.down.fx-hitA .tok-face, .down.fx-hitB .tok-face { animation: fall 0.5s ease-out; }
.pop-in { animation: pop 0.16s ease-out; }
.slide-up { animation: slideup 0.22s var(--ease-pop); }
.g-target { animation: pulse 1s ease-in-out infinite; }
.g-ghost { animation: breathe 1.1s ease-in-out infinite; }
@keyframes land { 0% { transform: scale(1.14); } 55% { transform: scale(0.92); } 100% { transform: scale(1); } }
@keyframes hitA { 0% { transform: none; } 15% { transform: translateX(-7px) rotate(-7deg); } 35% { transform: translateX(6px) rotate(5deg); } 55% { transform: translateX(-4px) rotate(-3deg); } 75% { transform: translateX(2px); } 100% { transform: none; } }
@keyframes hitB { 0% { transform: none; } 15% { transform: translateX(7px) rotate(7deg); } 35% { transform: translateX(-6px) rotate(-5deg); } 55% { transform: translateX(4px) rotate(3deg); } 75% { transform: translateX(-2px); } 100% { transform: none; } }
@keyframes flash { 0% { opacity: 0.75; } 100% { opacity: 0; } }
@keyframes heal { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.95); } 100% { box-shadow: 0 0 0 22px rgba(74, 222, 128, 0); } }
@keyframes drop { 0% { transform: translateY(-80px) scale(1.4); opacity: 0; } 60% { transform: translateY(6px) scale(0.94); opacity: 1; } 100% { transform: none; } }
@keyframes fall { 0% { transform: none; filter: none; opacity: 1; } 100% { transform: rotate(-24deg) scale(0.88); } }
@keyframes floatup { 0% { transform: translateY(8px) scale(0.5); opacity: 0; } 15% { transform: translateY(-8px) scale(1.3); opacity: 1; } 100% { transform: translateY(-64px) scale(1); opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.96); } }
@keyframes slideup { from { opacity: 0; transform: translate(-50%, 30px); } }
@keyframes pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes breathe { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.75; } }
html[data-motion="reduced"] *, html[data-motion="reduced"] *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
html[data-motion="reduced"] .float { animation: fadeout 1s linear forwards !important; }
@keyframes fadeout { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
html[data-motion="off"] *, html[data-motion="off"] *::after { animation: none !important; transition: none !important; }
html[data-motion="off"] .float { display: none; }

/* Square / round chips share the card row, so long labels (Spanish "Cuadrada") never spill out */
.chip.shape-chip {
  flex: 1 1 0; min-width: 0; padding: 0 6px; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* =====================================================================
   Game feel, round 2 (2026-10-08): ghost drag + hop, movement range,
   drop from the sky + dust, knockouts, conditions, living zones.
   ===================================================================== */

/* ---------- movement range + ghost drag + hop ---------- */
.b-range { position: absolute; inset: 0; pointer-events: none; }
.range {
  position: absolute; border-radius: 6px; animation: rangein 0.22s ease-out;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10'%3E%3Crect x='.7' y='.7' width='8.6' height='8.6' rx='1.6' fill='%232dd4bf' fill-opacity='.27' stroke='%232dd4bf' stroke-opacity='.7' stroke-width='.35'/%3E%3C/svg%3E");
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.35), 0 0 30px rgba(45, 212, 191, 0.18);
}
.g-target.far { border-color: var(--gold); background: rgba(251, 191, 36, 0.14); }
.g-label.far { border-color: var(--gold); color: var(--gold); }
.tok.waiting .tok-face { opacity: 0.45; filter: saturate(0.5); }
.tok.waiting .tok-cond, .tok.waiting .tok-fx { opacity: 0.4; }
.tok.ghost { pointer-events: none; opacity: 0.85; z-index: 900 !important; }
.tok.hop { transition: left var(--hop, 300ms) cubic-bezier(0.45, 0.05, 0.55, 0.95), top var(--hop, 300ms) cubic-bezier(0.45, 0.05, 0.55, 0.95); z-index: 800 !important; }
.tok.hop .tok-face { animation: hop var(--hop, 300ms) ease-in-out; }
.tok.pending { visibility: hidden; }
@keyframes hop { 0% { transform: none; } 45% { transform: translateY(-34%) scale(1.14); box-shadow: 0 26px 18px rgba(0, 0, 0, 0.45); } 100% { transform: none; } }
@keyframes rangein { from { opacity: 0; transform: scale(0.96); } }

/* ---------- drop from the sky + dust ---------- */
.fx-drop .tok-face { animation: skydrop 0.62s cubic-bezier(0.5, 0, 0.75, 0) both, squash 0.32s ease-out 0.38s; }
.tok.fx-drop::before {
  content: ""; position: absolute; left: 12%; right: 12%; bottom: -6%; height: 18%; border-radius: 50%;
  background: rgba(0, 0, 0, 0.5); animation: dropshadow 0.4s ease-in both; pointer-events: none;
}
@keyframes skydrop { 0% { transform: translateY(-260%) scale(1.25); opacity: 0; } 20% { opacity: 1; } 61% { transform: translateY(0) scale(1); } 100% { transform: translateY(0); } }
@keyframes squash { 0% { transform: scale(1.18, 0.78); } 45% { transform: scale(0.94, 1.08); } 100% { transform: none; } }
@keyframes dropshadow { from { transform: scale(0.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.dust { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 5; }
.dust i {
  position: absolute; left: 0; top: 0; width: var(--sz); height: var(--sz); border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 214, 190, 0.75), rgba(180, 165, 140, 0.35) 60%, transparent 72%);
  transform: translate(-50%, -50%) scale(0.4); animation: puff 0.75s ease-out forwards;
}
@keyframes puff { to { transform: translate(calc(var(--dx) - 50%), calc(var(--dy) - 50%)) scale(1.6); opacity: 0; } }

/* ---------- knockouts ---------- */
.ko-skull {
  position: absolute; color: #f1f5f9; transform: translate(-50%, -40%); pointer-events: none; z-index: 6;
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.9)) drop-shadow(0 3px 0 #000); animation: koskull 1.25s ease-out forwards;
}
.ko-skull svg { width: 100%; height: 100%; }
@keyframes koskull {
  0% { transform: translate(-50%, -10%) scale(0.2); opacity: 0; }
  18% { transform: translate(-50%, -60%) scale(1.25); opacity: 1; }
  32% { transform: translate(-50%, -55%) scale(1); }
  100% { transform: translate(-50%, -150%) scale(0.9); opacity: 0; }
}
.stage.shake { animation: shake 0.4s ease-out; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translate(-5px, 3px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-3px, 2px); } 80% { transform: translate(2px, -1px); } }
.cleared {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 95; pointer-events: none;
  display: grid; place-items: center; animation: clearedin 0.5s var(--ease-pop) both, clearedout 0.5s ease-in 2.7s forwards;
}
.cleared strong {
  position: relative; padding: 16px 34px; border-radius: 16px; background: rgba(12, 18, 28, 0.92); border: 2px solid var(--gold);
  font: 34px var(--mono); letter-spacing: 0.06em; color: var(--gold); white-space: nowrap;
  text-shadow: 0 0 18px rgba(251, 191, 36, 0.8); box-shadow: 0 0 40px rgba(251, 191, 36, 0.35);
}
.cleared .rays {
  position: absolute; width: 520px; height: 520px; border-radius: 50%; opacity: 0.55;
  background: repeating-conic-gradient(rgba(251, 191, 36, 0.35) 0 8deg, transparent 8deg 22deg);
  mask: radial-gradient(circle, #000 20%, transparent 68%); -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%);
  animation: spin 8s linear infinite;
}
@keyframes clearedin { from { transform: translate(-50%, -50%) scale(0.4); opacity: 0; } }
@keyframes clearedout { to { transform: translate(-50%, -60%) scale(1.05); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 680px) { .cleared strong { font-size: 22px; padding: 12px 20px; } .cleared .rays { width: 320px; height: 320px; } }

/* ---------- conditions: badges ---------- */
.tok-cond { position: absolute; left: 0; right: -14%; top: -14%; display: flex; justify-content: flex-end; gap: 2%; pointer-events: none; z-index: 3; }
.tok-cond i {
  width: 30%; max-width: 26px; min-width: 12px; aspect-ratio: 1; border-radius: 50%; background: var(--cc); color: #0a0f17;
  display: grid; place-items: center; box-shadow: 0 0 0 2px #0a0f17, 0 2px 6px rgba(0, 0, 0, 0.5); animation: badgein 0.32s var(--ease-pop);
}
.tok-cond svg { width: 68%; height: 68%; }
@keyframes badgein { from { transform: scale(0); } }
.fx-cond .tok-face { animation: condpop 0.42s ease-out; }
@keyframes condpop { 0% { transform: none; } 40% { transform: scale(1.12); filter: brightness(1.35); } 100% { transform: none; } }

/* ---------- conditions: effects on the token ---------- */
.tok-fx { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.tok-fx b { position: absolute; display: block; }
/* poisoned: green bubbles */
.tok-fx .bub { bottom: 6%; width: 14%; aspect-ratio: 1; border-radius: 50%; border: 2px solid #4ade80; background: rgba(74, 222, 128, 0.25); animation: bubble 1.8s ease-in infinite; }
.tok-fx .b1 { left: 18%; } .tok-fx .b2 { left: 48%; animation-delay: 0.6s; width: 10%; } .tok-fx .b3 { left: 72%; animation-delay: 1.2s; }
@keyframes bubble { 0% { transform: translateY(0) scale(0.4); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-140%) scale(1); opacity: 0; } }
.tok.c-p .tok-face { box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.7), 0 0 14px rgba(74, 222, 128, 0.45); }
/* burning: glow at the feet + rising embers */
.tok-fx .flame { left: -6%; right: -6%; bottom: -10%; height: 55%; border-radius: 50% 50% 40% 40%; background: radial-gradient(ellipse at 50% 100%, rgba(251, 146, 60, 0.75), rgba(239, 68, 68, 0.35) 45%, transparent 72%); animation: flicker 0.35s ease-in-out infinite alternate; z-index: -1; }
.tok-fx .emb { bottom: 10%; width: 7%; aspect-ratio: 1; border-radius: 50%; background: #fdba74; box-shadow: 0 0 6px #fb923c; animation: ember 1.4s ease-out infinite; }
.tok-fx .e1 { left: 25%; } .tok-fx .e2 { left: 55%; animation-delay: 0.5s; } .tok-fx .e3 { left: 75%; animation-delay: 0.95s; }
@keyframes flicker { from { opacity: 0.7; transform: scaleY(0.92); } to { opacity: 1; transform: scaleY(1.08); } }
@keyframes ember { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(30%, -260%); opacity: 0; } }
/* bleeding: drops falling */
.tok-fx .drp { top: 70%; width: 9%; aspect-ratio: 0.7; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #dc2626; animation: drip 1.5s ease-in infinite; }
.tok-fx .d1 { left: 30%; } .tok-fx .d2 { left: 62%; animation-delay: 0.75s; }
@keyframes drip { 0% { transform: translateY(0) scale(0.5); opacity: 0; } 25% { opacity: 1; transform: translateY(0) scale(1); } 100% { transform: translateY(260%); opacity: 0; } }
/* frozen: frost over the face */
.tok-fx .frost { inset: 0; border-radius: inherit; background: linear-gradient(135deg, rgba(186, 230, 253, 0.55), rgba(125, 211, 252, 0.15) 50%, rgba(224, 242, 254, 0.45)); box-shadow: inset 0 0 0 2px rgba(186, 230, 253, 0.85); animation: frost 2.4s ease-in-out infinite; }
.tok.round .tok-fx .frost { border-radius: 50%; }
@keyframes frost { 50% { opacity: 0.7; } }
.tok.c-f .tok-face { filter: saturate(0.4) brightness(1.1); }
/* stunned: stars circling the head */
.tok-fx .orbit { left: 15%; right: 15%; top: -24%; height: 30%; animation: orbit 1.4s linear infinite; }
.tok-fx .orbit i { position: absolute; top: 20%; width: 34%; color: #facc15; filter: drop-shadow(0 0 3px #000); }
.tok-fx .orbit i:nth-child(1) { left: 0; } .tok-fx .orbit i:nth-child(2) { left: 33%; top: -20%; } .tok-fx .orbit i:nth-child(3) { left: 66%; }
.tok-fx .orbit svg { width: 100%; fill: #facc15; }
@keyframes orbit { from { transform: rotate(0deg) scaleY(0.6); } to { transform: rotate(360deg) scaleY(0.6); } }
/* asleep: z z Z */
.tok-fx .zz { right: 4%; top: 0; font: 700 22px var(--mono); color: #c4b5fd; text-shadow: 0 2px 0 #000; animation: zz 2.4s ease-out infinite; }
.tok-fx .z2 { animation-delay: 0.8s; font-size: 18px; } .tok-fx .z3 { animation-delay: 1.6s; font-size: 26px; }
@keyframes zz { 0% { transform: translate(0, 0) scale(0.5); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(60%, -160%) scale(1.1); opacity: 0; } }
.tok.c-z .tok-face { filter: brightness(0.8); }
/* prone: lying down */
.tok.c-o:not(.down) .tok-face { transform: rotate(90deg) scale(0.8); }
/* restrained: a chain ring */
.tok-fx .chain { inset: -6%; border-radius: 10px; border: 3px dashed #a1a1aa; box-shadow: 0 0 0 1px #0a0f17; }
.tok.round .tok-fx .chain { border-radius: 50%; }
/* invisible: barely there, shimmering */
.tok.c-i .tok-face { opacity: 0.3; animation: shimmer 2.6s ease-in-out infinite; }
@keyframes shimmer { 50% { opacity: 0.5; } }
/* shielded: blue bubble */
.tok-fx .shield { inset: -14%; border-radius: 50%; border: 2px solid rgba(96, 165, 250, 0.9); background: radial-gradient(circle at 35% 30%, rgba(191, 219, 254, 0.35), rgba(96, 165, 250, 0.12) 55%, transparent 70%); box-shadow: 0 0 14px rgba(96, 165, 250, 0.55); animation: shieldpulse 2s ease-in-out infinite; }
@keyframes shieldpulse { 50% { transform: scale(1.04); box-shadow: 0 0 22px rgba(96, 165, 250, 0.75); } }
/* blessed: golden aura */
.tok-fx .aura { inset: -22%; border-radius: 50%; background: radial-gradient(circle, rgba(253, 224, 71, 0.45), rgba(253, 224, 71, 0.12) 50%, transparent 70%); z-index: -1; animation: aura 1.8s ease-in-out infinite; }
@keyframes aura { 50% { transform: scale(1.12); opacity: 0.7; } }
/* marked: a red crosshair turning over it */
.tok-fx .mark { inset: -12%; color: #f87171; animation: spin 6s linear infinite; filter: drop-shadow(0 0 3px #000); }
.tok-fx .mark svg { width: 100%; height: 100%; }
/* hacked: glitch */
.tok-fx .glitch { inset: 0; border-radius: inherit; background: repeating-linear-gradient(0deg, rgba(232, 121, 249, 0.35) 0 2px, transparent 2px 7px); mix-blend-mode: screen; animation: glitchbars 0.9s steps(4) infinite; }
.tok.c-x .tok-face { animation: glitchface 2.2s steps(1) infinite; }
@keyframes glitchbars { 0% { transform: translateY(0); opacity: 0.9; } 50% { transform: translateY(8%); opacity: 0.4; } 100% { transform: translateY(-6%); opacity: 0.8; } }
@keyframes glitchface { 0%, 86%, 100% { transform: none; filter: none; } 88% { transform: translate(-6%, 2%); filter: hue-rotate(90deg); } 92% { transform: translate(5%, -2%); filter: hue-rotate(-60deg) saturate(2); } 95% { transform: translate(-2%, 0); } }

/* ---------- conditions: card controls ---------- */
.cond-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cchip, .cadd {
  height: 28px; padding: 0 9px 0 6px; border-radius: 999px; font-size: 12px; display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid color-mix(in srgb, var(--cc, #8fa3bd) 55%, transparent); background: color-mix(in srgb, var(--cc, #8fa3bd) 14%, transparent); color: var(--cc, #c9d6e6);
}
.cchip svg { width: 14px; height: 14px; }
.cchip:hover { background: color-mix(in srgb, var(--cc) 26%, transparent); }
.cadd { padding: 0 11px; border-style: dashed; background: transparent; color: var(--text-muted); border-color: var(--border); }
.cadd.on { color: var(--accent); border-color: var(--accent); }
.cgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.cpick {
  min-height: 52px; padding: 5px 3px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-panel); color: var(--cc);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px;
}
.cpick span { color: #c9d6e6; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpick svg { width: 18px; height: 18px; }
.cpick.on { border-color: var(--cc); background: color-mix(in srgb, var(--cc) 18%, transparent); }

/* ---------- living zones ---------- */
.zone .zfx { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; overflow: hidden; }
.zone.z-fire .zfx {
  background: radial-gradient(ellipse at 30% 100%, rgba(253, 186, 116, 0.55), transparent 55%), radial-gradient(ellipse at 75% 100%, rgba(251, 146, 60, 0.5), transparent 50%);
  animation: flicker 0.5s ease-in-out infinite alternate;
}
.zone.z-fire .zfx::before {
  content: ""; position: absolute; inset: 0; background-image: radial-gradient(circle, rgba(254, 215, 170, 0.95) 0 1.5px, transparent 2.5px);
  background-size: 23px 31px; animation: embersup 2.6s linear infinite;
}
@keyframes embersup { from { background-position: 0 0; } to { background-position: 6px -62px; } }
.zone.z-water .zfx {
  background-image: repeating-linear-gradient(160deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 16px), repeating-linear-gradient(20deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 22px);
  animation: waves 4s linear infinite;
}
@keyframes waves { to { background-position: 64px 0, -44px 0; } }
.zone.z-poison .zfx {
  background: radial-gradient(circle at 20% 30%, rgba(134, 239, 172, 0.35), transparent 40%), radial-gradient(circle at 70% 60%, rgba(74, 222, 128, 0.3), transparent 45%), radial-gradient(circle at 45% 85%, rgba(187, 247, 208, 0.25), transparent 40%);
  background-size: 160% 160%; animation: fog 7s ease-in-out infinite alternate;
}
@keyframes fog { from { background-position: 0% 0%; } to { background-position: 100% 60%; } }
.zone.z-magic .zfx {
  background-image: radial-gradient(circle, rgba(233, 213, 255, 0.95) 0 1.2px, transparent 2px), radial-gradient(circle, rgba(192, 132, 252, 0.8) 0 1px, transparent 2px);
  background-size: 29px 29px, 17px 19px; animation: twinkle 1.6s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 1; } }
.zone.z-dark { border-color: transparent !important; box-shadow: 0 0 22px 14px rgba(11, 15, 23, 0.5); }
.zone.z-dark .zfx { background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.35) 100%); animation: twinkle 3.5s ease-in-out infinite alternate; }
.zone.z-difficult .zfx { background: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.22) 0 3px, transparent 3px 12px); }
.zone.z-cover .zfx { background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 2px, transparent 2px 10px), repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 10px); }

/* Reduced / Off: keep the badges and tints, drop the looping effects */
html[data-motion="reduced"] .tok-fx b:not(.frost):not(.chain):not(.shield):not(.aura), html[data-motion="off"] .tok-fx b:not(.frost):not(.chain):not(.shield):not(.aura) { display: none; }
html[data-motion="reduced"] .zone .zfx::before, html[data-motion="off"] .zone .zfx::before { display: none; }
html[data-motion="off"] .dust, html[data-motion="off"] .ko-skull, html[data-motion="reduced"] .dust { display: none; }

/* Token card never taller than the screen: it scrolls inside. Advanced opens as a right-hand panel. */
.card { overflow-y: auto; overscroll-behavior: contain; }
.card > * { flex-shrink: 0; }
@media (min-width: 681px) {
  .card { max-height: calc(100vh - 86px); }
  .card.side-card { left: auto !important; right: 16px; top: 72px !important; bottom: 16px; width: 340px; max-height: none; border-radius: 16px; }
}

/* "Add a condition" reads as a real button (it was a faint dashed chip that people missed) */
.cadd {
  height: 32px; padding: 0 12px 0 9px; border-style: solid; border-color: var(--border); background: var(--bg-card);
  color: #c9d6e6; font-size: 13px; gap: 6px;
}
.cadd svg { width: 15px; height: 15px; color: var(--gold); }
.cadd:hover { border-color: #3b5378; background: var(--bg-hover); color: var(--text); }
.cadd.on { border-color: var(--accent); color: var(--accent); background: rgba(45, 212, 191, 0.1); }

/* =====================================================================
   Hex grids (2026-10-08): pointy/flat hexes, no-grid, grid-type picker
   ===================================================================== */
.b-grid svg.hexgrid { position: absolute; left: 0; top: 0; overflow: visible; }
.hrange { position: absolute; left: 0; top: 0; overflow: visible; animation: hrangein 0.22s ease-out; }
.hrange path { fill: rgba(45, 212, 191, 0.27); stroke: rgba(45, 212, 191, 0.7); stroke-width: 0.8px; filter: drop-shadow(0 0 10px rgba(45, 212, 191, 0.22)); }
@keyframes hrangein { from { opacity: 0; } }
.g-hex { fill: rgba(45, 212, 191, 0.14); stroke: var(--accent); animation: pulse 1s ease-in-out infinite; }
.g-hex.far { fill: rgba(251, 191, 36, 0.14); stroke: var(--gold); }
.grid-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.grid-pick .chip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: auto; min-width: 0; padding: 7px 4px; font-size: 12px; }
.grid-pick .chip svg { width: 22px; height: 22px; flex-shrink: 0; }
.grid-pick .chip span { max-width: 100%; text-align: center; line-height: 1.15; overflow-wrap: break-word; }

/* Own images can be transparent (round/oval tokens): the hit flash tints the picture itself instead of
   laying a red square over it, so the token's shape stays intact. */
.tok:not(.glyph).fx-hitA .tok-face::after, .tok:not(.glyph).fx-hitB .tok-face::after { display: none; }
.tok:not(.glyph).fx-hitA .tok-face img, .tok:not(.glyph).fx-hitB .tok-face img { animation: hittint 0.45s ease-out; }
@keyframes hittint {
  0% { filter: sepia(1) saturate(12) hue-rotate(-48deg) brightness(0.75); }
  100% { filter: none; }
}

/* =====================================================================
   Status strip (map option `ps`, 2026-10-08): faces, HP and conditions
   down the left side. ".min" = faces + bars only (per viewer).
   ===================================================================== */
.strip {
  position: fixed; z-index: 15; left: 16px; top: 72px; bottom: 156px; width: 214px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none;
}
.strip > * { pointer-events: auto; }
.strip.empty { display: none; }
.strip.min { width: auto; }
.strip-tog {
  height: 28px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border-soft); background: rgba(12, 18, 28, 0.9);
  color: var(--text-muted); font-size: 12px; white-space: nowrap;
}
.strip-tog:hover { color: var(--text); border-color: var(--border); }
.strip.min .strip-tog { width: 48px; padding: 0; font-size: 16px; }
.strip-list {
  align-self: stretch; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  display: flex; flex-direction: column; gap: 2px; padding: 6px; border-radius: 14px;
  background: rgba(12, 18, 28, 0.82); border: 1px solid var(--border-soft); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.srow {
  flex-shrink: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 9px; align-items: center; padding: 5px 6px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; position: relative;
  transition: background 0.15s;
}
.srow:hover { background: rgba(255, 255, 255, 0.06); }
.srow.sel { background: rgba(45, 212, 191, 0.14); box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.5); }
.srow.gap { margin-top: 9px; }
.srow.gap::before { content: ""; position: absolute; left: 8px; right: 8px; top: -6px; height: 1px; background: rgba(248, 113, 113, 0.35); }
.s-av { display: block; position: relative; width: 34px; height: 34px; border-radius: 7px; overflow: hidden; transition: filter 0.4s, opacity 0.4s; }
.s-av.glyph { background: #0a0f17; }
.s-av.round { border-radius: 50%; }
.s-av img { display: block; width: 100%; height: 100%; object-fit: fill; }
.s-av .glyph { position: absolute; inset: 0; -webkit-mask: none center / 100% 100% no-repeat; mask: none center / 100% 100% no-repeat; }
.s-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.s-top { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.s-nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.s-hp { flex-shrink: 0; font: 11px var(--mono); color: var(--text-muted); }
.s-bar { display: block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.s-bar.none { display: none; }
.s-bar b { display: block; height: 100%; border-radius: 3px; transition: width 0.45s var(--ease-pop), background 0.45s; }
.s-cd { display: flex; flex-wrap: wrap; gap: 3px; }
.s-cd:empty { display: none; }
.s-cd i { display: block; width: 14px; height: 14px; color: var(--cc); }
.s-cd svg { display: block; width: 100%; height: 100%; }
.srow.down .s-av { filter: grayscale(1) brightness(0.55); opacity: 0.75; }
.srow.down .s-nm { color: var(--text-muted); text-decoration: line-through; text-decoration-color: rgba(248, 113, 113, 0.7); }
.srow.hurt .s-av { animation: hitA 0.42s ease-out; }
.srow.hurt { animation: srowhurt 0.6s ease-out; }
.srow.healed { animation: srowheal 0.6s ease-out; }
@keyframes srowhurt { from { background: rgba(239, 68, 68, 0.35); } }
@keyframes srowheal { from { background: rgba(74, 222, 128, 0.3); } }
/* faces only */
.strip.min .srow { grid-template-columns: 36px; gap: 4px; padding: 5px; }
.strip.min .s-av { width: 36px; height: 36px; }
.strip.min .s-top, .strip.min .s-cd { display: none; }
.strip.min .s-bar { height: 4px; }
/* pointing at a row lights its token */
.tok.spot .tok-face { box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(251, 191, 36, 0.65); }
.tok.glyph.spot .tok-face { box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(251, 191, 36, 0.65); }
.board.glide { transition: transform 0.38s cubic-bezier(0.2, 0.8, 0.2, 1); }
@media (max-width: 680px) {
  .strip { left: 8px; top: 64px; bottom: 96px; width: 190px; }
}
/* Map panel switch */
.tgl-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; text-align: left;
  border: 1px solid var(--border); background: var(--bg-panel); color: var(--text);
}
.tgl-row > span { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tgl-row b { font-size: 14px; }
.tgl-row small { font-size: 12px; color: var(--text-muted); line-height: 1.35; }
.tgl { flex-shrink: 0; position: relative; width: 40px; height: 22px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); transition: background 0.2s; }
.tgl::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #e6eef8; transition: transform 0.2s var(--ease-pop); }
.tgl-row[aria-checked="true"] { border-color: rgba(45, 212, 191, 0.55); }
.tgl-row[aria-checked="true"] .tgl { background: var(--accent); }
.tgl-row[aria-checked="true"] .tgl::after { transform: translateX(18px); background: var(--accent-ink); }

/* Quick rows for bars 2/3 in the token card (2026-10-08) */
.xbar-row { display: flex; align-items: center; gap: 6px; }
.xb-btn { width: 36px; height: 32px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-card); font-size: 18px; line-height: 1; transition: transform 0.08s; }
.xb-btn:active { transform: scale(0.9); }
.xbar {
  flex: 1 1 auto; min-width: 0; height: 32px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-panel);
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 4px; padding: 0 10px; cursor: text;
}
.xbar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bc); opacity: 0.28; transition: width 0.35s; pointer-events: none; }
.xbar::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--bc); }
.xb-nm { position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-muted); }
.xb-in {
  position: relative; width: 4.2ch; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--text); text-align: right;
  font: 15px var(--mono); -moz-appearance: textfield; appearance: textfield;
}
.xb-in::-webkit-outer-spin-button, .xb-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.xb-in:focus { outline: none; text-decoration: underline; text-decoration-color: var(--bc); }
.xb-of { position: relative; font: 15px var(--mono); color: var(--text-muted); }
/* …and in the status strip */
.s-x { display: flex; align-items: center; gap: 6px; }
.s-x[hidden] { display: none; }
.s-x .s-bar { flex: 1 1 auto; height: 3px; }
.s-x em { font: 10px var(--mono); font-style: normal; color: var(--text-muted); }
.strip.min .s-x em { display: none; }
/* Share sheet: the link opens zoomed where you're looking */
.view-note { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(45, 212, 191, 0.08); border: 1px solid rgba(45, 212, 191, 0.25); color: var(--text); }
.view-note svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--accent); }

/* =====================================================================
   3D view (assets/vtt3d.js, 2026-10-08): the same map as a tabletop scene
   ===================================================================== */
.v3 { position: absolute; inset: 0; z-index: 1; }
.v3-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.v3-labels, .v3-fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.v3-fx { z-index: 4; }
body.is3d .board { visibility: hidden; }
/* floating tag over each mini: conditions, name (when names are on / hovered / selected), bars — bottom sits on the head */
.v3-tag { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding-bottom: 4px; will-change: transform; }
.v3-name {
  white-space: nowrap; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: rgba(12, 18, 28, 0.94);
  border: 1px solid var(--border); color: var(--text); display: none;
}
.v3-tag.named .v3-name { display: block; }
.v3-tag.sel .v3-name { border-color: var(--accent); color: var(--accent); }
.v3-tag.down .v3-name { color: var(--text-muted); text-decoration: line-through; }
.v3-bars { width: 46px; display: flex; flex-direction: column; gap: 1px; }
.v3-bars:empty { display: none; }
.v3-bars i { display: block; height: 4px; border-radius: 2px; background: rgba(0, 0, 0, 0.75); overflow: hidden; }
.v3-bars b { display: block; height: 100%; border-radius: 2px; transition: width 0.35s ease, background 0.35s; }
.v3-cond { display: flex; gap: 2px; }
.v3-cond:empty { display: none; }
.v3-cond i { width: 16px; height: 16px; border-radius: 50%; background: rgba(12, 18, 28, 0.9); color: var(--cc); display: grid; place-items: center; box-shadow: 0 0 0 1px var(--cc); }
.v3-cond svg { width: 11px; height: 11px; }
.v3-float { position: fixed; z-index: 80; }
.v3-skull { position: fixed; width: 54px; height: 54px; z-index: 80; }
.v3-label { position: fixed; transform: translate(14px, -50%); z-index: 80; }
/* HUD: 2D/3D switch + turn buttons, a row beside the zoom column */
.hud-3d { position: fixed; left: 64px; bottom: max(16px, env(safe-area-inset-bottom)); display: flex; gap: 4px; z-index: 20; }
.hud-3d .btn { width: 40px; height: 40px; padding: 0; border-color: var(--border-soft); color: var(--text-muted); }
.hud-3d .v3-toggle { font: 700 13px var(--mono); color: var(--accent); border-color: rgba(45, 212, 191, 0.45); }
.hud-3d .v3-only { display: none; font-size: 18px; }
body.is3d .hud-3d .v3-only { display: grid; place-items: center; }
body.is3d .hud-3d .v3-toggle { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 680px) {
  .hud-3d { left: 12px; bottom: max(18px, env(safe-area-inset-bottom)); }
  .hud-3d .btn { width: 44px; height: 44px; }
  .card-open .hud-3d { display: none; }
}

/* Terrain in 2D: shaded raised cells with their height in feet (canvas under the grid) */
.hl-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; }
.hl-key { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text); }
.hl-key img { width: 22px; height: 22px; border-radius: 5px; }
.b-terrain, .b-mark { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* Terrain brush (3D): toolbar above the bottom buttons */
.hud-3d .v3-terrain svg { width: 20px; height: 20px; }
.hud-3d .v3-terrain.on { color: var(--accent-ink); background: var(--gold); border-color: var(--gold); }
.v3-tbar {
  position: fixed; z-index: 30; left: 50%; bottom: max(70px, calc(env(safe-area-inset-bottom) + 64px)); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 16px;
  background: rgba(12, 18, 28, 0.94); border: 1px solid var(--border); box-shadow: var(--shadow); max-width: calc(100vw - 20px);
}
.tb-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.tb-tool {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 62px; padding: 6px 8px; border-radius: 11px;
  border: 1px solid var(--border-soft); background: var(--bg-panel); color: var(--text-muted); font-size: 12px;
}
.tb-tool svg { width: 22px; height: 22px; color: var(--tc); }
.tb-tool.on { border-color: var(--tc); color: var(--text); background: color-mix(in srgb, var(--tc) 16%, var(--bg-panel)); box-shadow: 0 0 14px color-mix(in srgb, var(--tc) 35%, transparent); }
.tb-done { height: 34px; padding: 0 14px; margin-left: 6px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.tb-hint { margin: 0; font-size: 11px; color: var(--text-muted); text-align: center; }
@media (max-width: 680px) {
  .v3-tbar { bottom: max(76px, calc(env(safe-area-inset-bottom) + 70px)); }
  .tb-tool { min-width: 56px; }
  .tb-hint { display: none; }
}

/* Lighting (2026-10-08): 2D darkness + glow layer, dimmed tokens, light tools */
.b-light { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tok-face > img, .tok-face > .glyph { filter: brightness(var(--lit, 1)); transition: filter 0.4s; }
.hud-3d .v3-lights svg { width: 20px; height: 20px; }
.hud-3d .v3-lights.on { color: #1a1206; background: #ffae55; border-color: #ffae55; }
.tb-mode { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-soft); background: var(--bg-panel); color: var(--text-muted); font-size: 12px; }
.tb-mode.on { border-color: var(--accent); color: var(--accent); background: rgba(45, 212, 191, 0.12); font-weight: 700; }
.tb-dot { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle, #fff 0 18%, var(--tc) 40%, transparent 72%); box-shadow: 0 0 10px var(--tc); }
.tb-dot.tb-x { background: none; box-shadow: none; border: 2px solid var(--tc); position: relative; }
.tb-dot.tb-x::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: var(--tc); transform: translateX(-50%) rotate(45deg); }
.light-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; font-size: 12px; }
.light-chip i { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle, #fff 0 20%, var(--lc) 45%, transparent 75%); box-shadow: 0 0 8px var(--lc); }

/* Light picker (popup) — 3D light toolbar and the token card's "Carries a light" */
.v3-lbar { position: fixed; }
.tb-pick {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border-radius: 11px;
  border: 1px solid var(--border-soft); background: var(--bg-panel); color: var(--text); font-size: 13px;
}
.tb-pick svg { width: 18px; height: 18px; color: #ffcf7a; }
.tb-pick b { font-weight: 400; color: var(--text-muted); font-size: 11px; }
.tb-pick.on { border-color: color-mix(in srgb, #ffae55 60%, transparent); }
.tb-pick.open { background: var(--bg-card); border-color: var(--accent); }
.tb-pick .tb-dot { width: 16px; height: 16px; }
.tb-small { min-width: 0; flex-direction: row; gap: 6px; height: 38px; padding: 0 10px; }
.tb-small .tb-dot { width: 14px; height: 14px; }
.tb-pop {
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: min(360px, calc(100vw - 20px));
  padding: 10px; border-radius: 14px; background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow); animation: lpfade 0.16s ease-out;
}
.lp-modes { display: flex; gap: 6px; }
.lp-grid { display: grid; grid-template-columns: repeat(3, minmax(88px, 1fr)); gap: 6px; }
.lp-item {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border-soft);
  background: var(--bg-panel); color: var(--text-muted); font-size: 12px; text-align: left;
}
.lp-item i { width: 14px; height: 14px; flex-shrink: 0; border-radius: 50%; background: radial-gradient(circle, #fff 0 18%, var(--lc) 42%, transparent 74%); box-shadow: 0 0 9px var(--lc); }
.lp-item i.lp-rainbow { background: conic-gradient(#ff6a3d, #ffd166, #72f0a0, #8db2ff, #c084fc, #ff6a3d); box-shadow: 0 0 8px rgba(255, 255, 255, 0.35); }
.lp-item[style*="--lc"] i.lp-rainbow { background: radial-gradient(circle, #fff 0 18%, var(--lc) 42%, transparent 74%), conic-gradient(#ff6a3d, #ffd166, #72f0a0, #8db2ff, #c084fc, #ff6a3d); }
.lp-item i.lp-none { background: none; box-shadow: none; border: 1.5px dashed var(--text-muted); }
.lp-item.on { border-color: var(--accent); color: var(--text); background: rgba(45, 212, 191, 0.1); }
.lp-edit { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.lp-row { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-muted); }
.lp-row input[type=range] { width: 100%; }
.lp-sw { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.lp-sw button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; padding: 0; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5) inset; }
.lp-sw button.on { border-color: #fff; }
.lp-sw input[type=color] { width: 30px; height: 24px; padding: 0; border: 0; background: none; }
.lp-fl { display: flex; gap: 4px; flex-wrap: wrap; }
.lp-fl button { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border-soft); background: var(--bg-panel); color: var(--text-muted); font-size: 12px; }
.lp-fl button.on { border-color: var(--accent); color: var(--accent); }
.card .lp-pop { padding: 10px; border-radius: 12px; background: var(--bg-panel); border: 1px solid var(--border-soft); animation: lpfade 0.16s ease-out; }
.card .lp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 680px) { .lp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@keyframes lpfade { from { opacity: 0; } }

/* Props (2026-10-08): Add → Props tab */
.prop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 8px; }
.prop-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--border-soft); background: var(--bg-panel); color: var(--text-muted); font-size: 12px; transition: transform 0.12s, border-color 0.12s; }
.prop-tile img { width: 56px; height: 56px; }
.prop-tile:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--text); }
.prop-tile.on { border-color: var(--accent); color: var(--text); background: rgba(45, 212, 191, 0.1); }
.lib-pic { display: inline-block; background-repeat: no-repeat; flex-shrink: 0; }
.prop-tile .pt-pic { width: 56px; height: 56px; }
.prop-tile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer .cat-row .chip { white-space: nowrap; }
.lib-credit { font-size: 11px; opacity: 0.8; }
.stage.mode-prop { cursor: crosshair; }

/* ---------- floors: the ▼ name ▲ switcher, its list, the map panel rows, the card chips ---------- */
.floor-sw {
  position: fixed; z-index: 21; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 14px; background: rgba(12, 18, 28, 0.9); border: 1px solid var(--border-soft);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
.floor-sw .fl-step { width: 34px; height: 34px; padding: 0; border-radius: 10px; font-size: 12px; color: var(--accent); border-color: transparent; background: transparent; }
.floor-sw .fl-step:hover:not(:disabled) { background: var(--bg-hover); }
.floor-sw .fl-step:disabled { color: var(--text-dim); opacity: 0.4; cursor: default; }
.floor-sw .fl-name {
  height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 10px; border: 0; background: transparent;
  font-weight: 600; max-width: 220px;
}
.floor-sw .fl-name:hover { background: var(--bg-hover); }
.floor-sw .fl-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.floor-sw small, .fl-pop small, .fl-go, .s-fl {
  font: 700 11px var(--mono); color: var(--accent-ink); background: var(--accent); border-radius: 6px; padding: 1px 5px; flex-shrink: 0;
}
/* dragging a token: the arrows say "drop me here" */
body.tok-drag .floor-sw .fl-step:not(:disabled) { border: 1px dashed rgba(45, 212, 191, 0.6); }
.floor-sw .fl-step.drop { background: var(--accent); color: var(--accent-ink); transform: scale(1.15); box-shadow: 0 0 18px var(--accent-glow); }
.fl-pop {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); min-width: 200px; display: flex; flex-direction: column; gap: 2px;
  padding: 6px; border-radius: 12px; background: var(--bg-panel); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.fl-item { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: 8px; border: 0; background: transparent; text-align: left; }
.fl-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-item em { font: 11px var(--mono); color: var(--text-muted); font-style: normal; }
.fl-item:hover { background: var(--bg-hover); }
.fl-item.on { background: rgba(45, 212, 191, 0.14); box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.45); }
.fl-item:not(.on) small { background: var(--bg-hover); color: var(--text-muted); }
@media (max-width: 680px) {
  /* phones: an elevator on the right edge, above the add button */
  .floor-sw { left: auto; right: 12px; top: auto; bottom: max(96px, calc(env(safe-area-inset-bottom) + 90px)); transform: none; flex-direction: column-reverse; }
  .floor-sw .fl-name { padding: 0 6px; height: 30px; }
  .floor-sw .fl-name span { display: none; }
  .fl-pop { top: auto; bottom: 0; left: auto; right: calc(100% + 8px); transform: none; }
}
/* open floor (no image of its own): open air, with the floor below showing faintly */
.b-surface.open { background: #06090f repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.025) 0 6px, transparent 6px 14px); }
.b-image.under { opacity: 0.32; filter: grayscale(0.6) brightness(0.8); }
/* map panel */
.fl-sec { gap: 6px; }
.fl-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 6px; align-items: center; padding: 4px; border-radius: 10px; }
.fl-row.on { background: rgba(45, 212, 191, 0.1); box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.35); }
.fl-row .input { height: 32px; }
.fl-go { border: 0; min-width: 30px; height: 26px; cursor: pointer; }
.fl-row:not(.on) .fl-go { background: var(--bg-hover); color: var(--text-muted); }
.fl-h { display: inline-flex; align-items: center; gap: 2px; font: 12px var(--mono); color: var(--text-muted); }
.fl-h b { min-width: 46px; text-align: center; font-weight: 400; }
.fl-h button, .fl-del { width: 26px; height: 26px; padding: 0; border-radius: 7px; border: 1px solid var(--border-soft); background: transparent; color: var(--text-muted); display: grid; place-items: center; }
.fl-h button:hover, .fl-del:hover { background: var(--bg-hover); color: var(--text); }
.fl-del svg { width: 14px; height: 14px; }
span.fl-del { border: 0; }
/* card */
.fl-chips .chip.on { pointer-events: none; }
/* status strip: someone on another floor */
.s-fl:empty { display: none; }
.s-fl { align-self: center; font-size: 10px; padding: 0 4px; background: var(--bg-hover); color: var(--text-muted); }
.srow.away { opacity: 0.62; }
.srow.away:hover { opacity: 1; }
.strip.min .s-fl { display: none; }
.fl-chips { flex-wrap: wrap; gap: 4px; align-items: center; }
.fl-chips .lab { font-size: 12px; color: var(--text-muted); margin-right: 4px; }
.b-under { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0.42; filter: grayscale(0.45) brightness(0.8); }
/* the placing banner: long prop names and the size buttons wrap instead of squeezing the text */
.banner { flex-wrap: wrap; justify-content: center; border-radius: 22px; }
.banner > span:first-child { flex: 1 1 200px; min-width: 0; }

/* =====================================================================
   Build mode (2026-10-11): tools down the left, materials / props on the right
   ===================================================================== */
body.building .strip, body.building .fab { display: none; }
.bld-tools {
  position: fixed; z-index: 30; left: 12px; top: 68px; bottom: 156px; width: 128px; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 16px;
  background: rgba(12, 18, 28, 0.94); border: 1px solid var(--border); box-shadow: var(--shadow); animation: lpfade 0.16s ease-out;
  scrollbar-width: thin;
}
.bld-tools > * { flex-shrink: 0; }
.bld-lab { margin: 2px 2px 0; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.bld-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.bld-tool {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px 4px; border-radius: 10px;
  border: 1px solid var(--border-soft); background: var(--bg-panel); color: var(--text-muted); font-size: 11px; line-height: 1.2;
}
.bld-tool svg { width: 22px; height: 22px; color: var(--tc); }
.bld-tool span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bld-tool:hover { background: var(--bg-hover); color: var(--text); }
.bld-tool.on { border-color: var(--tc); color: var(--text); background: color-mix(in srgb, var(--tc) 18%, var(--bg-panel)); box-shadow: 0 0 12px color-mix(in srgb, var(--tc) 35%, transparent); }
.bld-tool:disabled { opacity: 0.35; cursor: not-allowed; }
/* the tool's settings: a panel beside the tools (the selected prop / light, the prop in hand, brush size…) */
.bld-set {
  position: fixed; z-index: 30; left: 148px; top: 68px; width: 236px; max-height: calc(100vh - 224px); overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 5px; padding: 8px; border-radius: 16px;
  background: rgba(12, 18, 28, 0.94); border: 1px solid var(--border); box-shadow: var(--shadow); animation: lpfade 0.16s ease-out;
  scrollbar-width: thin;
}
.bld-ptitle { margin: 0 2px 2px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.bld-opts { display: flex; flex-direction: column; gap: 5px; }
.bld-set .bld-hand { padding: 2px 0 4px; font-size: 13px; }
.bld-set .bld-hand .bh-pic { width: 48px; height: 48px; }
.bld-set .bld-lab { margin-top: 6px; }
.bld-set .bld-item { height: auto; min-height: 32px; font-size: 12px; }
.bld-set .bld-danger { margin-top: 8px; }
.bld-row { display: flex; gap: 4px; }
.bld-opt {
  flex: 1 1 0; min-width: 0; height: 32px; padding: 0 4px; border-radius: 9px; border: 1px solid var(--border-soft); background: var(--bg-panel);
  color: var(--text-muted); font: 12px var(--mono); display: grid; place-items: center;
}
.bld-opt i { width: var(--d); height: var(--d); border-radius: 50%; background: var(--text-muted); }
.bld-opt.on { border-color: var(--accent); color: var(--accent); }
.bld-opt.on i { background: var(--accent); }
.bld-opt.wide { flex: none; width: 100%; font-family: var(--font); display: flex; align-items: center; justify-content: center; gap: 7px; }
.bld-check i { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--text-muted); background: none; }
.bld-check.on i { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2px var(--bg-panel); }
.bld-hand { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text); line-height: 1.2; }
.bld-hand span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bh-pic { width: 40px; height: 40px; flex-shrink: 0; border-radius: 8px; background-color: var(--bg-panel); object-fit: contain; }
.bld-done { flex-shrink: 0; position: sticky; bottom: 0; margin-top: auto; height: 36px; box-shadow: 0 -8px 12px rgba(12, 18, 28, 0.94); border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.bld-pal {
  position: fixed; z-index: 30; right: 12px; top: 68px; width: 300px; max-height: calc(100vh - 84px);
  display: flex; flex-direction: column; border-radius: 16px; overflow: hidden;
  background: rgba(12, 18, 28, 0.94); border: 1px solid var(--border); box-shadow: var(--shadow); animation: lpfade 0.16s ease-out;
}
.bld-pal.tall { bottom: 16px; }
.bld-pal.shut { width: auto; }
.bld-head { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 0; background: none; color: var(--text); text-align: left; flex-shrink: 0; }
.bld-head b { flex: 1 1 auto; font-size: 14px; }
.bld-head:hover { background: var(--bg-hover); }
.bld-chev { width: 9px; height: 9px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(-45deg); }
.bld-pal.shut .bld-chev { transform: rotate(135deg); }
.bld-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }
.bld-body > * { flex-shrink: 0; }
.bld-hint { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.bld-body .hl-legend { justify-content: flex-start; font-size: 12px; }
.bld-mats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.bld-mat { display: flex; flex-direction: column; gap: 3px; padding: 4px; border-radius: 10px; border: 1px solid var(--border-soft); background: var(--bg-panel); color: var(--text-muted); font-size: 11px; line-height: 1.2; }
.bld-mat span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-sw.mat-map { background: linear-gradient(135deg, #3b4b2e, #6b5a3a 50%, #2a3140); }
.bm-sw { display: block; width: 100%; aspect-ratio: 16 / 10; border-radius: 6px; background-size: 64px 64px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5) inset; }
.bld-mat:hover { color: var(--text); background: var(--bg-hover); }
.bld-mat.on { border-color: var(--accent); color: var(--text); background: rgba(45, 212, 191, 0.12); box-shadow: 0 0 12px var(--accent-glow); }
.bld-q, .bld-packs { height: 36px; width: 100%; }
.bld-props { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.bld-prop { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; border-radius: 10px; border: 1px solid var(--border-soft); background: var(--bg-panel); color: var(--text-muted); font-size: 10.5px; line-height: 1.2; }
.bld-prop span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-pic { width: 64px; height: 64px; object-fit: contain; }
.bld-prop:hover { color: var(--text); background: var(--bg-hover); }
.bld-prop.on { border-color: var(--accent); color: var(--text); background: rgba(45, 212, 191, 0.12); box-shadow: 0 0 12px var(--accent-glow); }
/* the prop in hand, see-through, under the pointer (2D) */
.g-propghost { position: absolute; opacity: 0.8; pointer-events: none; border-radius: 10%; outline: 2px dashed rgba(45, 212, 191, 0.9); background: rgba(45, 212, 191, 0.14); }
.g-propghost .pg-pic { display: block; width: 100%; height: 100%; }
@media (max-width: 680px) {
  .bld-tools { left: 8px; top: 62px; bottom: 132px; width: 64px; padding: 6px; }
  .bld-set { left: 78px; top: 62px; width: 210px; max-height: 44vh; padding: 6px; }
  .bld-set .bld-row { flex-direction: row; }
  .bld-set .bld-lab, .bld-set .bld-hand span { display: block; }
  .bld-grid { grid-template-columns: 1fr; }
  .bld-tool span, .bld-lab, .bld-hand span { display: none; }
  .bld-row { flex-direction: column; }
  .bld-pal { left: 80px; right: 8px; top: auto; bottom: 72px; width: auto; max-height: 42vh; }
  .bld-pal.tall { bottom: 72px; }
  .bld-pal.shut { left: auto; }
  .bld-mats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bld-props { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .bp-pic { width: 52px; height: 52px; }
}

/* 3D minis (2026-10-11): the token card's chooser (card → More → 3D mini) */
.mini-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; font-size: 12px; }
.mini-chip .mini-pic { border-radius: 5px; }
.mini-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; max-height: 260px; overflow-y: auto; overscroll-behavior: contain; }
.mini-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; border-radius: 10px; border: 1px solid var(--border-soft); background: var(--bg-panel); color: var(--text-muted); font-size: 10.5px; line-height: 1.2; }
.mini-tile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-tile:hover { color: var(--text); background: var(--bg-hover); }
.mini-tile.on { border-color: var(--accent); color: var(--text); background: rgba(45, 212, 191, 0.12); }
.mini-pic { display: block; flex-shrink: 0; }
.mini-tile .lib-pic, .mini-chip .lib-pic { background-color: #3a465c; border-radius: 8px; }
.mini-pic.mini-card { width: 48px; height: 48px; border-radius: 8px; background: linear-gradient(160deg, #2a3140, #151b26); box-shadow: inset 0 0 0 2px #3b4b66; }
.mini-pic.mini-card::after { content: "▣"; display: grid; place-items: center; height: 100%; color: var(--text-muted); font-size: 20px; }
/* Add → SKCombat: the creatures as token portraits */
.drawer .drawer-minis { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-height: none; overflow: visible; }
.drawer .drawer-minis .mini-tile { font-size: 12px; padding: 6px 4px; }
.bld-danger { color: var(--danger); border-color: rgba(248, 113, 113, 0.45); }
.bld-modes .bld-opt { font-family: var(--font); font-weight: 700; height: 34px; }
.bld-modes .bld-opt.on { background: rgba(45, 212, 191, 0.12); }
.bh-pic.bh-light { border-radius: 50%; background: radial-gradient(circle, #fff 0 18%, var(--tc) 40%, transparent 72%); box-shadow: 0 0 12px var(--tc); }
/* lights in the props palette */
.lp-glow { display: block; border-radius: 50%; background: radial-gradient(circle, #fff 0 14%, var(--lc) 34%, transparent 66%); box-shadow: 0 0 14px var(--lc); }
.bld-prop .lp-glow { width: 56px; height: 56px; margin: 4px; }
/* Select: a stacked square lists its items */
.bld-stack { display: flex; flex-direction: column; gap: 3px; }
.bld-item { justify-content: flex-start; text-align: left; padding: 3px 6px; }
.bld-item span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bs-pic { width: 22px; height: 22px; flex-shrink: 0; border-radius: 5px; background-color: var(--bg-panel); object-fit: contain; }
.bld-item .lp-glow { width: 18px; height: 18px; margin: 2px; }
/* Select: a light's settings in the narrow strip */
.bld-row.bld-wrap { flex-wrap: wrap; }
.bld-row.bld-wrap .bld-opt { flex: 0 0 calc(33.33% - 3px); }
.bld-lp .lp-grid { grid-template-columns: 1fr 1fr; gap: 4px; }
.bld-lp .lp-item { height: 30px; padding: 0 8px; gap: 6px; }
.bld-lp .lp-edit { gap: 7px; margin-top: 7px; padding-top: 7px; }
.bld-lp .lp-row { font-size: 11px; }
.bld-lvls .bld-opt { flex-basis: calc(33.33% - 3px); font-size: 11px; padding: 0 4px; }
/* the map's sun (map panel) */
.sun-box { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.sun-box .btn.small { align-self: flex-start; }
