:root {
  --bg: #12151c;
  --bg-2: #1a1f29;
  --bg-3: #232a37;
  --border: #2e3645;
  --text: #e6e9ef;
  --muted: #8c95a6;
  --accent: #4cc9f0;
  --danger: #ff5a5f;
  --topbar-h: 48px;
  --toolbar-w: 52px;
  --panel-w: 300px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 8px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; width: 100%; }
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  padding: 7px 12px; border-radius: 6px; cursor: pointer; font: inherit; line-height: 1;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: #0b1220; border-color: transparent; font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 9px; font-size: 13px; }
.btn.big { padding: 12px 20px; font-size: 16px; }
button:disabled { opacity: 0.4; cursor: default; }
button, .btn { touch-action: manipulation; } /* no double-tap page zoom on rapid taps */

input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; width: 100%;
}
input[type="color"] { padding: 2px; height: 32px; cursor: pointer; }
input[type="range"] { padding: 0; }
input[type="file"] { padding: 4px; }
textarea { resize: vertical; }

.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.gap { gap: 6px; }
.spacer { flex: 1; }
.hint { color: var(--muted); font-size: 12px; }
.error { color: var(--danger); }
.card { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: grid; gap: 12px; margin: 16px 0; }
.card label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }

.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 12px;
  background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.me { display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; }
.avatar { border-radius: 50%; border: 2px solid transparent; background: var(--bg-3); object-fit: cover; }

/* ---------- lobby ---------- */
.lobby-main { max-width: 1100px; margin: 0 auto; padding: 32px 20px; }
#signed-out { text-align: center; padding: 60px 0; }
#signed-out h1 { font-size: 32px; margin-bottom: 8px; }
#signed-out p { color: var(--muted); font-size: 16px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.map-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.map-card .thumb { display: block; aspect-ratio: 16 / 9; background: var(--bg-3) center / cover no-repeat; }
.map-meta { padding: 12px; display: grid; gap: 6px; }
.map-name { font-weight: 600; font-size: 15px; color: var(--text); }

/* ---------- access + sharing ---------- */
.tag { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 7px; border-radius: 999px; background: var(--bg-3); color: var(--muted); white-space: nowrap; }
.tag.admin { color: var(--accent); }
.tag.readonly { color: #ffd60a; }
.access-admin { margin-top: 40px; }
.access-admin h1 { font-size: 20px; }
.access-admin form { margin: 12px 0; flex-wrap: wrap; }
.access-admin input[name=id] { width: 320px; max-width: 100%; }
.access-admin form select { width: auto; }
.access-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.access-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.access-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.access-table tr.implicit td { color: var(--muted); }
.access-table select { padding: 3px 6px; font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.dialog.sharing { min-width: min(520px, 94vw); }
.dialog.sharing .radio { display: flex; justify-content: flex-start; gap: 8px; align-items: baseline; font-size: 14px; color: var(--text); margin-bottom: 6px; cursor: pointer; }
.dialog.sharing .radio input { width: auto; margin: 0; }
.dialog.sharing .member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 40vh; overflow-y: auto; }
.dialog.sharing .member-list li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; background: var(--bg-3); border-radius: 6px; font-size: 13px; }
.dialog.sharing .member-list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog.sharing .member-list select, .dialog.sharing .add-member select { width: auto; padding: 3px 6px; font-size: 12px; }
.dialog.sharing .add-member { flex-wrap: wrap; margin-bottom: 12px; }
.dialog.sharing .add-member input { width: 190px; }
.avatar.ghost { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-3); display: inline-block; }
body.readonly .toolbar [data-tool]:not([data-tool=select]):not([data-tool=pan]), body.readonly #undo, body.readonly #redo, body.readonly #target-toggle,
body.readonly #sel-actions, body.readonly #selection-actions, body.readonly #alliance-add, body.readonly #groups-edit, body.readonly .alliance-list .btn,
body.readonly #import-json, body.readonly #replace-image, body.readonly #clear-all { display: none !important; }
body.readonly .panel .props input, body.readonly .panel .props select, body.readonly .panel .props textarea, body.readonly .palette button { pointer-events: none; opacity: 0.6; }

/* ---------- editor layout ---------- */
body.editor {
  display: grid; height: 100vh; height: 100dvh; overflow: hidden; /* dvh: excludes iOS Safari's toolbar */
  grid-template-rows: var(--topbar-h) 1fr auto;
  grid-template-columns: var(--toolbar-w) 1fr var(--panel-w);
  grid-template-areas: "top top top" "tools view panel" "tools chat panel";
}
body.editor .topbar { grid-area: top; }
#map-name { font-size: 16px; cursor: text; padding: 4px 8px; border-radius: 6px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#map-name:hover, #map-name:focus { background: var(--bg-3); outline: none; }
.status { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 8px; border-radius: 999px; background: var(--bg-3); color: var(--muted); }
.status.online { color: #7ee787; }
.status.offline, .status.reconnecting, .status.unauthorized { color: var(--danger); }
.presence { display: flex; align-items: center; }
.presence .avatar { margin-left: -6px; width: 28px; height: 28px; }
.presence .count { margin-left: 8px; font-size: 12px; color: var(--muted); }

.menu { position: relative; }
.menu-items {
  position: absolute; right: 0; top: 36px; z-index: 20; min-width: 240px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px; display: grid;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.menu-items button, .menu-items a {
  text-align: left; background: none; border: 0; color: var(--text); padding: 8px 10px; border-radius: 6px; cursor: pointer; font: inherit;
}
.menu-items button:hover, .menu-items a:hover { background: var(--bg-3); }
.danger-text { color: var(--danger) !important; }

.toolbar {
  grid-area: tools; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px;
  overflow-y: auto; min-height: 0; /* phones in landscape are shorter than the tool column */
  background: var(--bg-2); border-right: 1px solid var(--border);
}
.toolbar button {
  width: 40px; height: 40px; border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--text); font-size: 18px; cursor: pointer; display: grid; place-items: center;
}
.toolbar button:hover { background: var(--bg-3); }
.toolbar button.active { background: var(--accent); color: #0b1220; }
.toolbar button.big { font-size: 28px; width: 44px; height: 44px; }
.toolbar button:disabled { opacity: 0.3; cursor: default; filter: grayscale(1); }
.toolbar button:disabled:hover { background: transparent; }
#target-toggle.active { background: #ff3b30; box-shadow: 0 0 0 2px rgba(255,59,48,0.4); }

.viewport { grid-area: view; position: relative; overflow: hidden; background: #0b0d12; min-height: 0; }
#canvas { width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: default; }
#canvas.tool-pan, #canvas.panning { cursor: grab; }
#canvas.panning { cursor: grabbing; }
#canvas.tool-draw { cursor: crosshair; }
#canvas.tool-text { cursor: text; }
#annotations [data-id] { cursor: pointer; }
#annotations [data-id]:hover { filter: brightness(1.2); }
.hint-bar {
  position: absolute; left: 12px; bottom: 12px; background: rgba(20, 24, 32, 0.85); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; font-size: 12px; color: var(--muted); pointer-events: none; max-width: 70%;
}
.zoom-label { position: absolute; right: 12px; bottom: 12px; font-size: 12px; color: var(--muted); pointer-events: none; }

/* ---------- preset map layer (realm.js) ---------- */
.coord-readout {
  position: absolute; right: 12px; bottom: 32px; font-size: 13px; font-variant-numeric: tabular-nums; pointer-events: none;
  background: rgba(20, 24, 32, 0.85); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; color: var(--text);
}
/* The search bar and the planning panel stack in one column so neither covers the other, however tall they get. */
.realm-overlays { position: absolute; top: 12px; left: 12px; z-index: 4; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: calc(100% - 24px); pointer-events: none; }
.realm-overlays > * { pointer-events: auto; }
.realm-bar {
  display: flex; align-items: center; gap: 6px;
  background: rgba(20, 24, 32, 0.9); border: 1px solid var(--border); border-radius: 8px; padding: 6px;
}
.realm-bar { flex-wrap: wrap; max-width: 100%; }
.realm-bar input { width: 180px; }
/* ---------- zone layer (zones.js) ---------- */
.zone-controls {
  position: absolute; left: 12px; bottom: 44px; z-index: 4; display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  background: rgba(20, 24, 32, 0.9); border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px; max-width: calc(100% - 24px);
}
.zone-controls > .hint { margin-right: 4px; }
.viewport:has(.sel-actions:not([hidden])) .zone-controls { bottom: 12px; } /* the hint hides under the selection bar; take its spot */
.zone-controls .btn.active { background: var(--accent); color: #0b1220; border-color: transparent; }
.zone-layer.off, .zone-borders.off { display: none; }
.zone-layer polygon { pointer-events: none; transition: fill 0.15s; }
.zone-layer polygon.selected { stroke: #fff !important; stroke-width: 4; filter: drop-shadow(0 0 6px #fff); }
.zone-owner-labels { pointer-events: none; }
.zone-card, .zone-editor {
  position: absolute; z-index: 6; max-width: 320px; font-size: 13px; line-height: 1.45;
  background: rgba(20, 24, 32, 0.94); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.zone-card { pointer-events: none; }
.zone-card-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.zone-card-title .btn { margin-left: auto; }
.zone-editor label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin: 6px 0; }
.zone-editor label select, .zone-editor label input { flex: 1; }
.dialog.zone-list { min-width: min(820px, 94vw); max-height: 90vh; flex-direction: column; } /* display only while [open], or a closed one stays on screen */
.dialog.zone-list[open] { display: flex; }
.dialog.zone-list .row select { width: auto; padding: 3px 6px; font-size: 12px; }
.zone-totals { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; margin: 8px 0; }
.zone-total { border-left: 4px solid var(--border); padding-left: 6px; }
.zone-table-wrap { overflow: auto; flex: 1; min-height: 0; max-height: 60vh; border: 1px solid var(--border); border-radius: 6px; }
.zone-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.zone-table th { position: sticky; top: 0; background: var(--bg-3); text-align: left; padding: 6px 8px; font-size: 12px; color: var(--muted); }
.zone-table td { padding: 5px 8px; border-top: 1px solid var(--border); vertical-align: top; }
.zone-table tbody tr { cursor: pointer; }
.zone-table tbody tr:hover { background: var(--bg-3); }
.zone-table .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.realm-bar .btn.active { background: var(--accent); color: #0b1220; border-color: transparent; }
.realm-result { white-space: nowrap; }

.realm-plan {
  display: flex; flex-direction: column; gap: 8px;
  background: rgba(20, 24, 32, 0.55); border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  -webkit-backdrop-filter: blur(1.5px); backdrop-filter: blur(1.5px); /* translucent, map still visible */
  text-shadow: 0 1px 2px #000, 0 0 3px #000;
}
.realm-plan:hover { background: rgba(20, 24, 32, 0.8); } /* firmer while you're reading or using it */
.realm-plan.collapsed { background: rgba(20, 24, 32, 0.7); }
.realm-matrix { border-collapse: collapse; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.realm-matrix th, .realm-matrix td { padding: 3px 8px; border-bottom: 1px solid var(--border); }
.realm-matrix th { font-weight: 600; text-align: center; color: var(--text-muted); }
.realm-matrix td.row-label { text-align: left; font-weight: 600; }
.realm-matrix td.col-total { font-weight: 600; }
.realm-matrix .hint { font-size: 0.85em; opacity: 0.7; }
.realm-matrix tr.type td { font-weight: 700; border-top: 1px solid var(--border); padding-top: 6px; }
.realm-matrix tr.free td.row-label { color: var(--muted); font-weight: 500; }
.realm-matrix tr.holder td.row-label { font-weight: 500; white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.realm-matrix .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.realm-matrix .zero { opacity: 0.3; }
.realm-plan.collapsed .row, .realm-plan.collapsed .realm-matrix { display: none; }
.realm-plan .plan-toggle { align-self: flex-start; }
/* City markers are invisible until hovered (mouse) or picked (any input); the transparent hit
   circle still takes taps, so touch users tap the city on the map image itself. */
.realm-obj { cursor: pointer; }
/* Marker styles (class on .realm-markers): hover = outline only under the pointer / when picked;
   outline = every sprite polygon traced; sprite = the PNG cutouts, with the outline for hover/pick. */
.realm-obj .ring { transition: opacity 0.1s; opacity: 0; }
.realm-obj .sprite { display: none; }
.realm-markers.style-outline .ring { opacity: 0.85; }
.realm-markers.style-sprite .sprite { display: inline; }
.realm-obj.active .ring { stroke-width: 3; opacity: 1; fill: rgba(255,255,255,0.25); filter: drop-shadow(0 0 4px #fff); }
.realm-obj.claimed { display: none; }
/* City labels sit in #realm-labels above all shapes; realm.js toggles .hover / .active on them. */
.realm-label { display: none; pointer-events: none; }
.realm-label.active, .realm-label.hover, #realm-labels.measuring .realm-label { display: inline; }
@media (hover: hover) {
  .realm-obj:hover .ring { stroke-width: 2.5; opacity: 1; }
}
.claim-box {
  position: absolute; z-index: 6; width: 240px; max-width: calc(100% - 16px);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.claim-box h2 { font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0; }
.claim-box .hint { margin: 6px 0 0; }
.claim-box .claim-list { margin: 8px 0; max-height: 40vh; }
.claim-box #claim-new { width: 100%; justify-content: center; }
.realm-grid.off { display: none; }
.realm-grid line { stroke: rgba(255, 60, 60, 0.6); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.realm-grid text { font-size: 12px; font-weight: 700; fill: #ff3b30; stroke: #000; stroke-width: 2.5; paint-order: stroke; font-family: system-ui, sans-serif; }
.sel-actions {
  position: absolute; bottom: 44px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 5;
  background: rgba(20, 24, 32, 0.92); border: 1px solid var(--border); border-radius: 8px; padding: 6px;
}
.sel-actions .btn.active { background: var(--accent); color: #0b1220; border-color: transparent; }
.sel-actions .btn:disabled { opacity: 0.4; }
.viewport:has(.sel-actions:not([hidden])) .hint-bar { display: none; } /* the bar takes the hint's spot */
.check { display: flex !important; justify-content: flex-start !important; gap: 8px; align-items: center; color: var(--text) !important; cursor: pointer; }

/* Shape labels ("Alce Mine · Northwind") live in #ann-labels above every shape and stay out of the
   way: shown on hover (mouse), when the shape is selected (a tap), or all at once via the toolbar's
   label toggle. editor.js toggles .on for hover/selection; the filter hides with an inline style. */
#ann-labels .ann-label { display: none; pointer-events: none; }
#ann-labels .ann-label.on, body.show-labels #ann-labels .ann-label { display: inline; }
#ann-labels .ann-label.claim { display: inline; } /* who holds a city is always shown */
.toolbar button[aria-pressed="true"] { background: var(--accent); color: #0b1220; }

/* Highlighted targets: a soft glow in the shape's own color. The filters are SVG <filter>s built
   by editor.js (WebKit ignores CSS drop-shadow on SVG shapes); #hl-glow is resized with the zoom so
   the glow stays the same size on screen, #hl-glow-ns is for pins and text, which are screen-sized. */
#annotations .anim :is(ellipse, rect, polygon, polyline, line) { filter: url(#hl-glow); }
#annotations .anim[data-type="pin"] path, #annotations .anim[data-type="text"] text { filter: url(#hl-glow-ns); }


.alliance-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.alliance-list li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; background: var(--bg-3); font-size: 13px; }
.alliance-list .swatch { width: 18px; height: 18px; border-radius: 50%; border: 3px solid; flex: none; margin: 4px; } /* margin: room for outer border rings (box-shadow) */
.claim-count {
  flex: none; min-width: 22px; padding: 1px 6px; border-radius: 999px; text-align: center; cursor: help;
  background: var(--bg); border: 1px solid var(--border); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.claim-list .name { flex: 1; }
.alliance-list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; flex-direction: column; line-height: 1.25; }
.alliance-list .name small { font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.swatch.big { width: 30px; height: 30px; border-radius: 50%; flex: none; margin: 6px; border-width: 4px; }
.al-preview-row { margin: 4px 0 12px; }
.group-rows { display: grid; gap: 6px; margin: 6px 0 8px; }
.group-row { display: flex; gap: 6px; align-items: center; }
.group-row input[type="color"] { width: 44px; flex: none; }
.group-row input:not([type]) { flex: 1; }
#groups-dialog h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 14px 0 0; }
.groups-actions { margin-top: 16px; }
.alliances .row.between .spacer { flex: 1; }
.panel .alliances { border-bottom: 1px solid var(--border); max-height: 30%; overflow-y: auto; }
.panel .alliances .row { margin-bottom: 8px; }

.dialog { background: var(--bg-2); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 16px; min-width: min(360px, 92vw); max-width: 92vw; }
.dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.dialog h2 { font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--text); margin-bottom: 12px; }
.dialog .row .spacer { flex: 1; }
.claim-list { display: grid; gap: 6px; margin: 10px 0 14px; max-height: 50vh; overflow-y: auto; }
.claim-list button { display: flex; align-items: center; gap: 10px; text-align: left; font-size: 14px; padding: 10px 12px; }
.claim-list .swatch { width: 20px; height: 20px; border-radius: 50%; border: 3px solid; flex: none; margin: 4px; }

.poly-actions {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 5;
  background: rgba(20, 24, 32, 0.9); border: 1px solid var(--border); border-radius: 8px; padding: 6px;
}
.panel-btn { display: none; }
.panel-btn.active { background: var(--accent); color: #0b1220; border-color: transparent; }

.panel {
  grid-area: panel; background: var(--bg-2); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.panel section { padding: 12px; }
.panel .props { border-bottom: 1px solid var(--border); overflow-y: auto; max-height: 60%; }
.panel .layers { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panel .layers .row { margin-bottom: 8px; }
.panel .layers select { width: auto; padding: 3px 6px; font-size: 12px; }
.field { display: grid; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.field.two { grid-template-columns: 1fr 1fr; gap: 8px; }
.field.two label { margin-bottom: 4px; }
.palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.palette button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.palette button:hover { border-color: #fff; }
.meta { margin-top: 8px; line-height: 1.5; }

.layer-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.layer-list li {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.layer-list li:hover { background: var(--bg-3); }
.layer-list li.selected { background: var(--bg-3); outline: 1px solid var(--accent); }
.layer-list .swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.layer-list .kind { color: var(--muted); font-size: 11px; width: 44px; flex: none; }
.layer-list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-list .creator {
  flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10px; font-weight: 700; color: #0b1220; cursor: help;
}
.layer-list .owner { font-size: 11px; padding: 1px 6px; border-radius: 999px; color: #0b1220; font-weight: 600; flex: none; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 900px) {
  body.editor { grid-template-columns: var(--toolbar-w) 1fr; grid-template-areas: "top top" "tools view" "tools chat"; }
  .chat-dock:not(.collapsed) { height: min(var(--chat-h), 45dvh); }
  /* The panel becomes a slide-over drawer, opened from the ☰ button in the top bar. */
  .panel-btn { display: inline-flex; }
  .panel {
    position: fixed; top: var(--topbar-h); right: 0; bottom: 0; width: min(var(--panel-w), 88vw); z-index: 30;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    /* Hide only after the slide-out; show at once on open so a field inside can be focused immediately. */
    transform: translateX(100%); visibility: hidden; transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }
  body.panel-open .panel { transform: none; visibility: visible; transition: transform 0.2s ease, visibility 0s; }
  .panel .props { max-height: 65%; }
  .topbar { gap: 8px; padding: 0 8px; }
  #map-name { max-width: 30vw; }
  .realm-overlays { left: 8px; top: 8px; right: 8px; max-width: none; }
  .realm-bar input { flex: 1; min-width: 120px; }
  .coord-readout { bottom: 36px; }
}

/* Zone outline editor (zones.js, admins): handles sit above every shape while it is open. */
.zone-lines polygon { fill: none; stroke: rgba(11, 18, 32, 0.85); stroke-width: 2.5; stroke-linejoin: round; }
.zone-lines.off { display: none; }
body.zone-shaping #annotations, body.zone-shaping .realm-markers, body.zone-shaping #ann-labels { pointer-events: none; }
.zone-shape-edit polygon { pointer-events: none; stroke-linejoin: round; }
.zone-shape-edit polygon.main { fill: rgba(255, 214, 10, 0.12); stroke: #ffd60a; stroke-width: 2; }
.zone-shape-edit polygon.nb { fill: none; stroke: #fff; stroke-width: 1.5; stroke-dasharray: 6 4; opacity: 0.85; }
.zone-shape-edit circle { pointer-events: all; touch-action: none; }
.zone-shape-edit circle.pt { fill: #ffd60a; stroke: #0b1220; stroke-width: 1.5; cursor: grab; }
.zone-shape-edit circle.pt:hover { fill: #fff; }
.zone-shape-edit circle.mid { fill: rgba(255, 255, 255, 0.55); stroke: #0b1220; stroke-width: 1; cursor: copy; }
.zone-shape-bar {
  position: absolute; bottom: 44px; left: 50%; transform: translateX(-50%); z-index: 7; display: flex; align-items: center; gap: 8px;
  background: rgba(20, 24, 32, 0.95); border: 1px solid #ffd60a; border-radius: 8px; padding: 6px 10px; white-space: nowrap; max-width: calc(100% - 24px); flex-wrap: wrap;
}
.zone-shape-bar .check { font-size: 12px; }
.zone-shape-bar .check input { width: auto; margin: 0; }
body.zone-shaping .sel-actions, body.zone-shaping .zone-controls { display: none; } /* the bar takes their place */
.zone-shape-edit rect.catch { fill: transparent; pointer-events: all; cursor: crosshair; }
.zone-shape-edit.redraw circle { pointer-events: none; }
.zone-shape-edit.redraw circle.pt { r: 4; }
.zone-shape-edit polyline.sketch { fill: none; stroke: #ff3b30; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.zone-shape-bar .btn.active { background: #ffd60a; color: #0b1220; border-color: transparent; }
.zone-shape-edit line.cross-edge { stroke: #ff3b30; stroke-width: 3.5; pointer-events: none; }
.zone-shape-edit circle.cross { fill: rgba(255, 59, 48, 0.15); stroke: #ff3b30; stroke-width: 2.5; pointer-events: none; }
.zone-shape-edit circle.pt.bad { fill: #ff3b30; stroke: #fff; }
.zone-shape-bar .btn.danger { background: #ff3b30; color: #fff; border-color: transparent; }
/* Highlight ping (editor.js buildPing): color ring on a dark band; the group's `color` is the shape's. */
#annotations .ping { pointer-events: none; }
#annotations .ping circle { fill: none; }
#annotations .ping .ping-back { stroke: rgba(11, 18, 32, 0.75); stroke-width: 6; }
#annotations .ping .ping-ring { stroke: currentColor; stroke-width: 3; }

/* Target priority list (editor.js renderTargets) and the priority tag on each target on the map. */
.panel .targets { border-bottom: 1px solid var(--border); max-height: 32%; overflow-y: auto; flex: none; }
.panel .targets .row { margin-bottom: 6px; }
.target-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.target-list li.group { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11px; }
.target-list li.group:first-child { margin-top: 0; }
.target-list li.group .tag { color: #fff; font-weight: 700; padding: 1px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }
.target-list li.target { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.target-list li.target:hover, .target-list li.target:focus-visible { background: var(--bg-3); outline: none; }
.target-list li.target.selected { background: var(--bg-3); outline: 1px solid var(--accent); }
.target-list .badge { flex: none; min-width: 22px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; }
.target-list .swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.target-list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.target-list .owner { font-size: 11px; padding: 1px 6px; border-radius: 999px; color: #0b1220; font-weight: 600; flex: none; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#annotations .target-badge { pointer-events: none; }
#annotations .anim .target-badge rect { filter: none; }

/* Collapsible right-hand panel sections (editor.js): a collapsed section shows only its header row. */
.panel .sec-head { display: flex; align-items: center; gap: 6px; justify-content: flex-start; margin-bottom: 8px; }
.panel .sec-head h2 { cursor: pointer; user-select: none; margin: 0; flex: 1 0 auto; }
.panel .sec-head > .btn:not(.sec-toggle) { flex: 0 1 auto; white-space: normal; }
.panel .sec-toggle { padding: 0 6px; min-width: 24px; line-height: 20px; flex: none; }
.panel section.collapsed { flex: none !important; max-height: none !important; overflow: hidden; padding-bottom: 8px; }
.panel section.collapsed > :not(.sec-head) { display: none !important; }
.panel section.collapsed .sec-head { margin-bottom: 0 !important; }
.target-list .grip { flex: none; cursor: grab; color: var(--muted); font-size: 14px; line-height: 1; padding: 2px 2px; touch-action: none; user-select: none; }
.target-list .grip:hover { color: var(--text); }
.target-list li.target.dragging { opacity: 0.45; }
.target-list li.drop-line { height: 3px; margin: -1px 0; border-radius: 2px; background: var(--accent); list-style: none; }
.target-list li.drop-empty { padding: 4px 8px 4px 34px; font-size: 12px; font-style: italic; }
body:has(.target-list li.target.dragging) { cursor: grabbing; }
.sa-priority { display: inline-flex; gap: 2px; padding-left: 6px; margin-left: 2px; border-left: 1px solid var(--border); }
.sa-priority .btn { min-width: 28px; justify-content: center; font-weight: 700; }
.sa-priority .btn.active { background: var(--pri); color: #fff; border-color: transparent; }
.panel .targets select { width: auto; max-width: 140px; padding: 3px 6px; font-size: 12px; }

/* Invite codes (lobby.js): sign-in for people without Discord, and the admin's one-time view of a code. */
.btn.apple { background: #000; color: #fff; border-color: #000; margin-left: 10px; font-weight: 600; }
.btn.apple:hover { background: #1c1c1e; border-color: #1c1c1e; }
.pending { max-width: 560px; margin: 60px auto; text-align: center; }
.pending h1 { font-size: 26px; margin-bottom: 8px; }
.pending p { color: var(--muted); font-size: 15px; }
.intro-form { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 22px; text-align: left; }
.intro-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.intro-form input { font-size: 15px; }
.access-table .intro { color: var(--muted); font-style: italic; margin-left: 8px; font-size: 13px; }
.access-table tr.pending td { background: rgba(255, 214, 10, 0.08); }
.invite-login { max-width: 420px; margin: 28px auto 0; text-align: left; }
.invite-login label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.invite-login input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.06em; text-transform: uppercase; }
.invite-login .error { margin-top: 8px; font-size: 14px; }
.access-admin #invite-add input[name=name] { width: 320px; max-width: 100%; }
.invite-result { margin: 8px 0 16px; max-width: 640px; display: grid; gap: 8px; }
.invite-result input { flex: 1; font-size: 12px; }
.invite-result .invite-code { font-size: 22px; letter-spacing: 0.08em; font-weight: 700; }
#signed-out p.error { color: var(--danger); }

/* City limits (limits.js): the planning panel turns red and blinks while an alliance is over. */
@keyframes limit-blink { 0%, 100% { border-color: #ff3b30; box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.9), 0 0 18px rgba(255, 59, 48, 0.7); background: rgba(90, 16, 16, 0.82); } 50% { border-color: rgba(255, 59, 48, 0.35); box-shadow: 0 0 0 1px rgba(255, 59, 48, 0.3); background: rgba(40, 10, 12, 0.6); } }
.realm-plan.over-limit { border-color: #ff3b30; background: rgba(90, 16, 16, 0.8); animation: limit-blink 1s ease-in-out infinite; }
.realm-plan.over-limit:hover { background: rgba(90, 16, 16, 0.9); }
.realm-plan .limit-warn { color: #fff; font-weight: 700; font-size: 13px; max-width: 360px; }
.realm-plan.collapsed .limit-warn:not([hidden]) { display: block; }
.realm-matrix tr.holder.over td { color: #ff6b61; font-weight: 700; }
.realm-matrix .limit { opacity: 0.65; font-weight: 500; }
.realm-matrix tr.holder.over .limit { opacity: 1; }
.claim-count.full { box-shadow: inset 0 0 0 1px #ff9f0a; }
.claim-count.over { background: #ff3b30 !important; color: #fff !important; }
@media (prefers-reduced-motion: reduce) { .realm-plan.over-limit { animation: none; box-shadow: 0 0 0 2px #ff3b30; } }

/* ---------- map chat (chat.js) ---------- */
.chat-dock { grid-area: chat; display: flex; flex-direction: column; min-height: 0; --chat-h: 176px; /* open by default: the last couple of messages */ height: var(--chat-h); background: var(--bg-2); border-top: 1px solid var(--border); }
.chat-dock.collapsed { height: auto; }
.chat-dock.collapsed .chat-body-wrap { display: none; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 3px 10px; min-height: 32px; cursor: pointer; user-select: none; touch-action: none; }
.chat-head:hover { background: rgba(255, 255, 255, 0.03); }
.chat-hide { margin-left: auto; flex: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 6px; width: 30px; height: 26px; font-size: 14px; line-height: 1; cursor: pointer; }
.chat-hide:hover { background: var(--bg-3); }
.chat-toggle { background: none; border: none; color: var(--text); font: inherit; font-weight: 600; font-size: 13px; padding: 4px 6px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chat-toggle:hover { background: var(--bg-3); }
.badge { background: var(--accent); color: #0b1220; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 6px; line-height: 16px; }
.chat-peek { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chat-dock:not(.collapsed) .chat-peek { visibility: hidden; }
.chat-langlabel { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chat-langlabel select { font-size: 12px; padding: 2px 4px; max-width: 150px; }
@media (max-width: 600px) { .chat-langword { display: none; } .chat-langlabel select { max-width: 120px; } }
.chat-body-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-older { align-self: center; margin: 4px 0 0; }
.chat-log { flex: 1; overflow-y: auto; padding: 4px 10px; display: flex; flex-direction: column; gap: 3px; overscroll-behavior: contain; }
.chat-msg { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.4; padding: 2px 4px; border-radius: 6px; }
.chat-msg:hover { background: rgba(255, 255, 255, 0.03); }
.chat-msg .avatar { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.chat-body { min-width: 0; flex: 1; }
.chat-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chat-name { font-weight: 600; }
.chat-langtag { font: inherit; font-size: 10px; line-height: 15px; border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; background: transparent; color: var(--muted); cursor: pointer; margin-left: 4px; }
.chat-langtag.on { color: var(--accent); border-color: var(--accent); }
.chat-del { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0 4px; visibility: hidden; }
.chat-msg:hover .chat-del, .chat-msg:focus-within .chat-del { visibility: visible; }
@media (hover: none) { .chat-del { visibility: visible; } }
.chat-text { white-space: pre-wrap; word-break: break-word; }
.chip {
  display: inline-flex; align-items: center; gap: 2px; padding: 0 7px; border-radius: 999px; vertical-align: baseline; line-height: 1.45;
  border: 1px solid var(--chip, var(--accent)); color: var(--chip, var(--accent)); background: color-mix(in srgb, var(--chip, var(--accent)) 14%, transparent);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip:hover { background: color-mix(in srgb, var(--chip, var(--accent)) 30%, transparent); }
.chip small { font-weight: 400; opacity: 0.8; font-size: 10px; }
.chip.missing { opacity: 0.5; text-decoration: line-through; }
.chat-typing { padding: 0 12px; min-height: 15px; font-size: 11px; }
.chat-form { display: flex; gap: 6px; padding: 6px 10px 8px; align-items: flex-end; }
.chat-composer {
  flex: 1; min-height: 34px; max-height: 120px; overflow-y: auto; background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 14px; line-height: 1.4; outline: none; white-space: pre-wrap; word-break: break-word;
}
.chat-composer:focus { border-color: var(--accent); }
.chat-composer:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.chat-composer .chip { pointer-events: none; cursor: text; }
/* Long-press / right-click menu on the map */
.ctx-menu { position: absolute; z-index: 40; min-width: 190px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 4px; display: grid; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.ctx-menu button { text-align: left; background: none; border: none; color: var(--text); font: inherit; font-size: 14px; padding: 9px 12px; border-radius: 6px; cursor: pointer; }
.ctx-menu button:hover, .ctx-menu button:focus { background: var(--bg-3); outline: none; }
.ctx-menu button:disabled { opacity: 0.4; cursor: default; }
.ctx-menu .ctx-title { padding: 4px 12px 6px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }

/* @-mentions (chat.js): chips, the highlighted message, the jump bar and the people picker. */
.chip.user { cursor: default; --chip: var(--accent); }
.chip.user.me { background: color-mix(in srgb, #ff9f0a 35%, transparent); border-color: #ff9f0a; color: #fff; }
.chat-msg.mention { background: rgba(255, 159, 10, 0.12); box-shadow: inset 3px 0 0 #ff9f0a; }
.chat-msg.mention:hover { background: rgba(255, 159, 10, 0.18); }
@keyframes mention-flash { 0%, 60% { background: rgba(255, 159, 10, 0.45); } 100% { background: rgba(255, 159, 10, 0.12); } }
.chat-msg.flash { animation: mention-flash 1.4s ease-out; }
.chat-mention-bar {
  display: flex; align-items: center; gap: 6px; width: 100%; border: 0; border-bottom: 1px solid rgba(255, 159, 10, 0.5);
  background: rgba(255, 159, 10, 0.18); color: var(--text); font: inherit; font-size: 12px; padding: 5px 10px; cursor: pointer; text-align: left; flex: none;
}
.chat-mention-bar:hover { background: rgba(255, 159, 10, 0.28); }
.chat-mention-bar .hint { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-mention-bar .jump { font-weight: 700; color: #ff9f0a; white-space: nowrap; }
#chat-unread.mention { background: #ff3b30; color: #fff; }
.chat-form { position: relative; }
.chat-people {
  position: absolute; left: 8px; bottom: calc(100% + 4px); z-index: 20; list-style: none; margin: 0; padding: 4px; min-width: 200px; max-width: 320px;
  max-height: min(300px, 50vh); overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.chat-people li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.chat-people li.active, .chat-people li:hover { background: var(--bg-3); }
.chat-people li .avatar { width: 20px; height: 20px; }
.chat-people .online { width: 8px; height: 8px; border-radius: 50%; background: #30d158; margin-left: auto; }
.access-table .person { display: inline-flex; align-items: center; gap: 6px; }
.access-table .rename { padding: 0 6px; opacity: 0.55; }
.access-table tr:hover .rename, .access-table .rename:focus { opacity: 1; }

/* Import dialogs (editor.js): replace-or-add choice, and the result. */
.import-dialog { max-width: min(520px, 94vw); }
.import-dialog p { margin: 6px 0; }
.import-dialog .warn { color: #ffb340; }
.import-choices { display: grid; gap: 8px; margin: 12px 0; }
.import-choices .btn { display: block; text-align: left; white-space: normal; padding: 8px 12px; line-height: 1.35; }
.import-choices .btn .hint { color: inherit; opacity: 0.85; }

/* Emoji reactions (chat.js): pills under a message, the ☺ button, and the picker. */
.chat-react-btn { background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 0 4px; visibility: hidden; margin-left: auto; }
.chat-react-btn + .chat-del { margin-left: 0; }
.chat-msg:hover .chat-react-btn, .chat-msg:focus-within .chat-react-btn { visibility: visible; }
@media (hover: none) { .chat-react-btn { visibility: visible; opacity: 0.6; } }
.chat-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.react-pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-3); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.react-pill .e { font-size: 14px; line-height: 1; }
.react-pill .n { font-variant-numeric: tabular-nums; font-weight: 600; }
.react-pill:hover { border-color: var(--accent); }
.react-pill.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.react-pill.add { color: var(--muted); padding: 0 8px; visibility: hidden; }
.chat-msg:hover .react-pill.add, .chat-msg:focus-within .react-pill.add { visibility: visible; }
@media (hover: none) { .react-pill.add { visibility: visible; } }
.react-picker {
  position: fixed; z-index: 60; width: min(320px, calc(100vw - 16px)); background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); padding: 8px; display: grid; gap: 6px;
}
.react-quick, .react-tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.react-tabs { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px 0; }
.react-tabs button { background: none; border: none; font-size: 16px; padding: 2px 6px; border-radius: 6px; cursor: pointer; opacity: 0.6; }
.react-tabs button.active { opacity: 1; background: var(--bg-3); }
.react-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 176px; overflow-y: auto; }
.react-emoji { background: none; border: none; font-size: 20px; line-height: 1; padding: 4px; border-radius: 6px; cursor: pointer; }
.react-emoji:hover, .react-emoji:focus-visible { background: var(--bg-3); outline: none; }
.react-any { font-size: 13px; }
.delete-filters { display: grid; gap: 8px; margin: 10px 0; }
.delete-filters label { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.delete-filters select { width: 220px; }
.delete-dialog .btn.danger { background: var(--danger, #ff3b30); color: #fff; border-color: transparent; }
.delete-dialog .btn.danger:disabled { opacity: 0.4; }

/* Interface language picker (i18n.js langPicker) in the top bars. */
.ui-lang-wrap { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); }
.ui-lang-wrap select { width: auto; max-width: 150px; font-size: 12px; padding: 3px 6px; }
[dir="rtl"] .ui-lang-wrap { flex-direction: row-reverse; }
.topbar .ui-lang-wrap { margin-right: 6px; }
/* Phones: translations run longer than English, so the bars stay one line and give way gracefully. */
.status, .chat-toggle, .zone-controls .btn { white-space: nowrap; }
@media (max-width: 600px) {
  /* The language picker shrinks to its globe; the (invisible) select still covers it, so a tap opens the list. */
  .topbar .ui-lang-wrap { position: relative; width: 28px; height: 28px; justify-content: center; font-size: 18px; }
  .topbar .ui-lang-wrap select { position: absolute; inset: 0; width: 100%; max-width: none; opacity: 0; }
  .presence .count { display: none; } /* the avatars say who is here */
  .topbar h1 { min-width: 3em; }
  .zone-controls { flex-wrap: nowrap; overflow-x: auto; max-width: calc(100% - 24px); scrollbar-width: none; bottom: 66px; }
  /* The hint keeps to two lines (longer languages ran to four, under the zone controls). */
  .hint-bar { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; max-width: calc(100% - 24px); line-height: 16px; padding-top: 5px; padding-bottom: 5px; max-height: 42px; box-sizing: border-box; }
  @media (hover: none) { .coord-readout { display: none; } } /* it follows a mouse pointer; nothing to follow on touch */
  .zone-controls::-webkit-scrollbar { display: none; }
}

/* Suggest-a-translation mode (i18n-review.js): every click opens the form instead of acting. */
body.i18n-review, body.i18n-review * { cursor: help !important; }
body.i18n-review .i18n-hover { outline: 2px dashed #ffb340 !important; outline-offset: 1px; }
.i18n-review-bar {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  max-width: calc(100vw - 16px); background: #3a2a05; border: 1px solid #ffb340; color: #fff; border-radius: 10px; padding: 6px 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.i18n-review-bar, .i18n-review-bar *, .i18n-review-dialog, .i18n-review-dialog * { cursor: auto !important; }
.i18n-review-bar button, .i18n-review-dialog button { cursor: pointer !important; }
.i18n-review-bar .msg { font-size: 13px; }
.i18n-review-dialog { max-width: min(520px, 94vw); }
.i18n-review-dialog .field label { font-size: 12px; color: var(--muted); }
.i18n-review-dialog .i18n-src, .i18n-review-dialog .i18n-cur { padding: 6px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); font-size: 13px; white-space: pre-wrap; }
.i18n-review-dialog textarea { width: 100%; resize: vertical; font: inherit; }
.i18n-pick { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; }
.i18n-pick .btn { width: 100%; text-align: left; justify-content: flex-start; white-space: normal; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.i18n-search .btn .hint { font-size: 11px; }
.i18n-admin { margin-top: 32px; }
.i18n-admin h1 .badge { font-size: 12px; vertical-align: middle; background: #ff9f0a; color: #0b1220; border-radius: 999px; padding: 1px 8px; }
.i18n-table td { vertical-align: top; }
.i18n-table .i18n-en { color: var(--muted); max-width: 280px; }
.i18n-table textarea { width: 100%; min-width: 200px; font: inherit; }
.i18n-table td:last-child { white-space: nowrap; }
