* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: #1a1a1a;
  color: #eee;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: #252525;
  align-items: center;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}

.btn {
  padding: 6px 12px;
  background: #3a3a3a;
  color: #eee;
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: #444; }
.btn:active { background: #2e2e2e; }
.btn.toggled {
  background: #213a4d;
  border-color: #3a86b8;
  color: #fff;
}
.btn.toggled:hover { background: #284a63; }

.ruler-system {
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 5px 6px;
  font-size: 12px;
  cursor: pointer;
}
.ruler-system:focus { outline: none; border-color: #3a86b8; }

.status {
  margin-left: 12px;
  color: #999;
  font-size: 12px;
}

.campaign-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 12px;
  color: #aaa;
  padding: 4px 8px;
  background: #232323;
  border: 1px solid #333;
  border-radius: 4px;
}
.campaign-badge.hidden { display: none; }
.campaign-badge .campaign-badge-label {
  color: #777;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
}
.campaign-badge #campaignName {
  color: #fff;
  font-weight: 600;
}
.campaign-badge #switchCampaign {
  width: 22px;
  height: 22px;
  font-size: 12px;
  line-height: 1;
}

.campaign-picker {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.campaign-picker.hidden { display: none; }
.campaign-picker-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 28px 32px;
  width: 520px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  color: #eee;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.campaign-picker-content h1 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: 0.01em;
}
.campaign-picker-hint {
  color: #888;
  font-size: 12px;
  margin: 0 0 20px;
  line-height: 1.5;
}
#campaignPickerList {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}
.campaign-picker-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: #232323;
  border-radius: 4px;
  border: 1px solid #2e2e2e;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.campaign-picker-item:hover {
  background: #213a4d;
  border-color: #3a86b8;
}
.campaign-picker-item-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.campaign-picker-item-name {
  font-size: 14px;
  color: #fff;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.campaign-picker-item-meta {
  font-size: 11px;
  color: #888;
}
.campaign-picker-empty {
  color: #666;
  font-style: italic;
  padding: 12px;
  text-align: center;
}
.campaign-picker-add {
  display: flex;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid #2e2e2e;
}
.campaign-picker-add input {
  flex: 1;
  min-width: 0;
  background: #2a2a2a;
  color: #eee;
  border: 1px solid #444;
  border-radius: 3px;
  padding: 8px 10px;
  font-size: 13px;
}
.campaign-picker-add input:focus {
  outline: none;
  border-color: #3a86b8;
}
.campaign-picker-add .btn {
  padding: 8px 16px;
}
.campaign-picker-rename,
.campaign-picker-delete {
  background: transparent;
  border: 1px solid #444;
  color: #888;
  width: 28px;
  height: 28px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 13px;
  padding: 0;
  flex-shrink: 0;
}
.campaign-picker-rename:hover { color: #fff; background: #2a2a2a; }
.campaign-picker-delete:hover { color: #f55; background: #2a1212; border-color: #533; }

.mode-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #1f1f1f;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}
.mode-label {
  color: #777;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.btn-toggle {
  padding: 4px 12px;
  background: #2a2a2a;
  color: #aaa;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.btn-toggle.active {
  background: #213a4d;
  border-color: #3a86b8;
  color: #fff;
}
.btn-toggle:hover:not(.active) { background: #333; color: #fff; }

.brush-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid #333;
}
.brush-controls.hidden { display: none; }

.brush-group {
  display: flex;
  gap: 4px;
}
.brush-size {
  height: 26px;
  padding: 0 10px;
  background: #2a2a2a;
  color: #aaa;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}
.brush-size.active {
  background: #213a4d;
  border-color: #3a86b8;
  color: #fff;
}
.brush-size:hover:not(.active) { background: #333; color: #fff; }

.btn-icon {
  width: 26px;
  height: 26px;
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
}
.btn-icon:hover { background: #333; color: #fff; }

#minSizeInput {
  width: 56px;
  height: 26px;
  text-align: center;
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 3px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
  -moz-appearance: textfield;
}
#minSizeInput::-webkit-outer-spin-button,
#minSizeInput::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#minSizeInput:focus {
  outline: none;
  border-color: #3a86b8;
  color: #fff;
}

.radial-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: transparent;
}
.radial-backdrop.hidden { display: none; }

.radial-menu {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
}
.radial-menu.hidden { display: none; }

.radial-item {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(38, 38, 38, 0.96);
  border: 2px solid #555;
  color: #ddd;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  transition: transform 0.1s, border-color 0.1s, background 0.1s, color 0.1s;
  user-select: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
/* 8 кнопок октагоном на радиусе 92px (углы кратны 45°). */
.radial-item[data-pos="0"] { left: 0;    top: -92px; }
.radial-item[data-pos="1"] { left: 65px; top: -65px; }
.radial-item[data-pos="2"] { left: 92px; top: 0;     }
.radial-item[data-pos="3"] { left: 65px; top: 65px;  }
.radial-item[data-pos="4"] { left: 0;    top: 92px;  }
.radial-item[data-pos="5"] { left: -65px; top: 65px; }
.radial-item[data-pos="6"] { left: -92px; top: 0;    }
.radial-item[data-pos="7"] { left: -65px; top: -65px; }

.radial-item:hover {
  transform: translate(-50%, -50%) scale(1.12);
  border-color: #3a86b8;
  background: rgba(60, 60, 60, 0.98);
  color: #fff;
}

.radial-center {
  left: 0;
  top: 0;
  width: 38px;
  height: 38px;
  background: rgba(15, 15, 15, 0.96);
  color: #888;
  font-size: 14px;
}
.radial-center:hover {
  border-color: #533;
  background: rgba(40, 18, 18, 0.96);
  color: #f55;
  transform: translate(-50%, -50%) scale(1.12);
}
.status.connected { color: #6c6; }
.status.disconnected { color: #c66; }

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0e0e0e;
  overflow: hidden;
  padding: 12px;
  position: relative;
}

#canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
  cursor: crosshair;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.6);
}

.placeholder {
  color: #555;
  font-size: 14px;
  text-align: center;
}

.sidebar {
  background: #1f1f1f;
  padding: 12px;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-left {
  width: 268px;
  border-right: 1px solid #333;
}
.sidebar-right {
  width: 320px;
  border-left: 1px solid #333;
  padding-top: 0;
}

.tabs {
  display: flex;
  margin: 0 -12px 12px;
  border-bottom: 1px solid #333;
  position: sticky;
  top: 0;
  background: #1f1f1f;
  z-index: 1;
}
.tab-btn {
  flex: 1;
  padding: 10px 6px;
  background: transparent;
  color: #888;
  border: none;
  border-right: 1px solid #2a2a2a;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tab-btn:last-child { border-right: none; }
.tab-btn:hover { color: #ccc; background: #232323; }
.tab-btn.active {
  color: #fff;
  border-bottom-color: #3a86b8;
  background: #1a1a1a;
}
.tab-panel.hidden { display: none; }

.sidebar h3 {
  margin: 16px 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #aaa;
}
.sidebar h3:first-child { margin-top: 0; }

#sceneList {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}
.scene-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  margin-bottom: 4px;
  background: #2a2a2a;
  border-radius: 3px;
  border: 1px solid transparent;
}
.scene-item.active {
  background: #213a4d;
  border-color: #3a86b8;
}
.scene-name {
  flex: 1;
  text-align: left;
  background: transparent;
  border: none;
  color: #eee;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scene-name:hover { color: #fff; }
.scene-presenting {
  color: #3a86b8;
  margin-right: 5px;
  font-size: 10px;
  vertical-align: 2px;
}
.scene-rename,
.scene-delete {
  background: transparent;
  border: 1px solid #444;
  color: #999;
  width: 24px;
  height: 22px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.scene-rename:hover { color: #fff; background: #333; }
.scene-delete:hover { color: #f55; background: #2a1212; border-color: #533; }
.scene-empty {
  color: #666;
  font-size: 12px;
  padding: 6px 0;
  font-style: italic;
}

.btn-new {
  flex: 1;
  padding: 6px;
  background: #232323;
  color: #999;
  border: 1px dashed #555;
  cursor: pointer;
  border-radius: 3px;
  font-size: 12px;
}
.btn-new:hover { background: #2c2c2c; color: #fff; border-color: #777; }

.scene-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.folder-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px;
  margin-bottom: 3px;
  background: #1a1a1a;
  border-radius: 3px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #aaa;
  border: 1px solid transparent;
}
.folder-header.drop-target {
  background: #213a4d;
  border-color: #3a86b8;
  color: #fff;
}
.folder-toggle {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 0;
  width: 18px;
  height: 18px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.folder-toggle:hover { color: #fff; }
.folder-name {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}
.folder-rename,
.folder-delete {
  background: transparent;
  border: 1px solid #333;
  color: #888;
  width: 22px;
  height: 22px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 11px;
  padding: 0;
  line-height: 1;
}
.folder-rename:hover { color: #fff; background: #2a2a2a; }
.folder-delete:hover { color: #f55; background: #2a1212; border-color: #533; }

.scene-item.in-folder {
  margin-left: 14px;
}
.scene-item.dragging {
  opacity: 0.4;
}
#sceneList.drop-root-target {
  outline: 1px dashed #3a86b8;
  outline-offset: -1px;
}

.sidebar p.hint {
  color: #777;
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 16px;
}

#regionList {
  list-style: none;
  padding: 0;
  margin: 0;
}

#regionList li {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #2a2a2a;
}

#regionList li .name {
  flex: 1;
  font-size: 13px;
  color: #ccc;
}

#regionList select {
  background: #2a2a2a;
  color: #eee;
  border: 1px solid #444;
  padding: 3px 4px;
  font-size: 12px;
  border-radius: 3px;
}

#regionList .del {
  background: transparent;
  color: #c66;
  border: 1px solid #533;
  width: 26px;
  height: 26px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 14px;
  line-height: 1;
}
#regionList .del:hover { background: #2a1212; }

#regionList .move {
  background: transparent;
  color: #aaa;
  border: 1px solid #444;
  width: 26px;
  height: 26px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 13px;
  line-height: 1;
  padding: 0;
}
#regionList .move:hover { color: #fff; background: #333; }
#regionList .move.active {
  color: #fff;
  background: #213a4d;
  border-color: #3a86b8;
}

/* === Audio === */

/* Контейнер для YouTube iframe-плееров. Браузеры тормозят / паузят видео,
 * которое off-screen или меньше определённого размера — поэтому держим его
 * в viewport, но с opacity 0 и z-index ниже всего, чтобы не мешало. */
#audioPlayersHidden {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 200px;
  height: 200px;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.audio-master {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.audio-master-icon { font-size: 14px; }
.audio-master input[type="range"] { flex: 1; min-width: 0; }
#masterVolumeLabel {
  font-size: 11px;
  color: #aaa;
  min-width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.audio-subhead {
  margin: 10px 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  font-weight: 600;
}

.audio-add {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.audio-add input {
  flex: 1;
  min-width: 0;
  background: #2a2a2a;
  color: #eee;
  border: 1px solid #444;
  border-radius: 3px;
  padding: 4px 6px;
  font-size: 12px;
}
.audio-add input:focus {
  outline: none;
  border-color: #3a86b8;
}
.audio-add .btn-new {
  flex: 0 0 32px;
  padding: 4px 0;
}

#activeAudioList,
#sceneAudioList {
  list-style: none;
  padding: 0;
  margin: 0 0 4px;
}

.audio-empty {
  color: #555;
  font-size: 11px;
  font-style: italic;
  padding: 3px 2px;
}

.audio-track {
  background: #232323;
  border: 1px solid #2e2e2e;
  border-radius: 3px;
  padding: 6px 8px;
  margin-bottom: 4px;
}
.audio-track.playing { border-color: #3a86b8; }
.audio-track-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.audio-title {
  flex: 1;
  font-size: 12px;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.audio-play,
.audio-loop,
.audio-rename,
.audio-delete {
  background: transparent;
  color: #aaa;
  border: 1px solid #444;
  width: 24px;
  height: 24px;
  cursor: pointer;
  border-radius: 3px;
  padding: 0;
  line-height: 1;
  font-size: 12px;
  flex-shrink: 0;
}
.audio-play:hover,
.audio-rename:hover { color: #fff; background: #333; }
.audio-loop:hover { color: #fff; background: #333; }
.audio-loop.on { color: #fff; background: #213a4d; border-color: #3a86b8; }
.audio-delete:hover {
  color: #f55;
  background: #2a1212;
  border-color: #533;
}
.audio-track .audio-volume {
  width: 100%;
  margin-top: 6px;
  display: block;
}

/* === Tokens === */

/* Старый flat layout убран — теперь #tokenLibrary это контейнер групп */
.token-library { /* no-op fallback */ }

.token-group { margin-bottom: 10px; }
.token-group-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px;
  margin-bottom: 4px;
  background: #1a1a1a;
  border-radius: 3px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #aaa;
  border: 1px solid transparent;
}
.token-group-header.drop-target {
  background: #213a4d;
  border-color: #3a86b8;
  color: #fff;
}
.token-group-toggle {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 0;
  width: 18px;
  height: 18px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.token-group-toggle:hover { color: #fff; }
.token-group-name {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.token-group-rename,
.token-group-delete {
  background: transparent;
  border: 1px solid #333;
  color: #888;
  width: 22px;
  height: 22px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 11px;
  padding: 0;
  line-height: 1;
}
.token-group-rename:hover { color: #fff; background: #2a2a2a; }
.token-group-delete:hover { color: #f55; background: #2a1212; border-color: #533; }
.token-group-place-all {
  background: transparent;
  border: 1px solid #333;
  color: #888;
  width: 22px;
  height: 22px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 11px;
  padding: 0;
  line-height: 1;
}
.token-group-place-all:hover {
  color: #fff;
  background: #213a4d;
  border-color: #3a86b8;
}

.token-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 48px);
  gap: 6px;
  padding: 2px 0;
  min-height: 16px;
}
.token-group-grid.drop-target {
  outline: 1px dashed #3a86b8;
  outline-offset: 2px;
  border-radius: 3px;
}
.token-group-empty {
  color: #555;
  font-size: 11px;
  font-style: italic;
  grid-column: 1 / -1;
  padding: 2px 6px;
}
.token-tile.dragging { opacity: 0.4; }

.token-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.token-actions .btn-new { flex: 1; }
.token-tile {
  position: relative;
  width: 48px;
  height: 48px;
  cursor: pointer;
  background: transparent;
  padding: 0;
}
.token-tile-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #444;
  display: block;
  pointer-events: none;
  user-select: none;
  background: #232323;
  box-sizing: border-box;
}
.token-tile:hover .token-tile-img { border-color: #3a86b8; }
.token-tile.active .token-tile-img {
  border-color: #fff;
  box-shadow: 0 0 0 2px #3a86b8;
}
.token-tile .token-del {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c44;
  color: #fff;
  border: 1px solid #1a1a1a;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: none;
  z-index: 2;
}
.token-tile:hover .token-del { display: block; }
.token-del:hover { background: #e55; }

#uploadTokenBtn {
  display: block;
  text-align: center;
}

#placedTokens {
  list-style: none;
  padding: 0;
  margin: 0 0 4px;
}
.placed-token {
  background: #232323;
  border: 1px solid #2e2e2e;
  border-radius: 3px;
  padding: 6px 8px;
  margin-bottom: 4px;
}
.placed-token.selected { border-color: #3a86b8; }
.placed-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.placed-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #444;
}
.placed-name {
  flex: 1;
  font-size: 12px;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.placed-delete {
  background: transparent;
  color: #c66;
  border: 1px solid #533;
  width: 22px;
  height: 22px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 12px;
  padding: 0;
}
.placed-delete:hover { background: #2a1212; }

.placed-hide {
  background: transparent;
  color: #aaa;
  border: 1px solid #444;
  width: 22px;
  height: 22px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 11px;
  padding: 0;
  line-height: 1;
}
.placed-hide:hover { background: #2a2a2a; color: #fff; }
.placed-hide.on {
  background: #3b2818;
  border-color: #864;
  color: #f90;
}
.placed-token.is-hidden { opacity: 0.75; }
.placed-token.is-hidden .placed-name { font-style: italic; }

.context-menu {
  position: fixed;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 4px 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
  list-style: none;
  margin: 0;
  z-index: 2200;
  min-width: 200px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.context-menu.hidden { display: none; }
.context-menu li {
  padding: 7px 14px;
  font-size: 12px;
  color: #ddd;
  cursor: pointer;
  user-select: none;
}
.context-menu li:hover { background: #213a4d; color: #fff; }
.context-menu li.disabled,
.context-menu li.disabled:hover {
  color: #555;
  background: transparent;
  cursor: default;
}
.context-menu li.hidden { display: none; }
.context-menu li.danger { color: #f88; }
.context-menu li.danger:hover { background: #2a1212; color: #f55; }
.context-menu-separator {
  height: 1px;
  background: #2a2a2a;
  margin: 4px 0;
  padding: 0 !important;
  pointer-events: none;
}

/* === Emoji marks picker === */
.emoji-picker {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2300;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.emoji-picker.hidden { display: none; }
.emoji-picker-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 20px;
  width: 380px;
  max-width: 92vw;
  color: #eee;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.emoji-picker-content h3 {
  margin: 0 0 12px;
  font-size: 16px;
}
.emoji-current {
  min-height: 36px;
  background: #232323;
  border: 1px solid #2e2e2e;
  border-radius: 4px;
  padding: 6px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.emoji-current:empty::before {
  content: 'Меток пока нет';
  color: #666;
  font-size: 11px;
  font-style: italic;
  align-self: center;
}
.emoji-current-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 3px;
  padding: 2px 4px 2px 6px;
  font-size: 18px;
  line-height: 1;
}
.emoji-current-item button {
  background: transparent;
  color: #c66;
  border: 1px solid #533;
  width: 18px;
  height: 18px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 11px;
  padding: 0;
  line-height: 1;
}
.emoji-current-item button:hover { background: #2a1212; color: #f55; }
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 14px;
}
.emoji-btn {
  font-size: 22px;
  background: #232323;
  border: 1px solid #2e2e2e;
  border-radius: 4px;
  padding: 6px 0;
  cursor: pointer;
  line-height: 1;
}
.emoji-btn:hover {
  background: #213a4d;
  border-color: #3a86b8;
}
.emoji-picker-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.emoji-picker-actions .btn { padding: 6px 14px; }

.placed-token .placed-scale {
  width: 100%;
  margin-top: 5px;
  display: block;
}

/* === Token "Show all" overlay === */

.token-show-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2400;
  cursor: pointer;
}
.token-show-overlay.hidden { display: none; }
.token-show-overlay img {
  pointer-events: none;
  display: block;
}

/* === Crop modal === */

.crop-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2100;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.crop-modal.hidden { display: none; }
.crop-modal-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 24px;
  width: 480px;
  max-width: 92vw;
  color: #eee;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.crop-modal-content h2 {
  margin: 0 0 6px;
  font-size: 18px;
}
.crop-modal-hint {
  color: #888;
  font-size: 12px;
  margin: 0 0 14px;
  line-height: 1.5;
}
.crop-stage {
  position: relative;
  width: 432px;
  height: 432px;
  max-width: 100%;
  margin: 0 auto 14px;
  background: #0a0a0a;
  border-radius: 4px;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}
.crop-stage img {
  position: absolute;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.crop-circle {
  position: absolute;
  border: 2px solid #3a86b8;
  border-radius: 50%;
  background: transparent;
  cursor: move;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  box-sizing: border-box;
}
.crop-form { margin-bottom: 14px; }
.crop-form input {
  width: 100%;
  background: #2a2a2a;
  color: #eee;
  border: 1px solid #444;
  border-radius: 3px;
  padding: 8px 10px;
  font-size: 13px;
  box-sizing: border-box;
}
.crop-form input:focus { outline: none; border-color: #3a86b8; }
.crop-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.crop-actions .btn { padding: 8px 16px; }
#cropSave {
  background: #213a4d;
  border-color: #3a86b8;
  color: #fff;
}
#cropSave:hover { background: #284a63; }
