*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0c12;
  --surf: #131720;
  --surf2: #1a2030;
  --surf3: #212840;
  --border: #1e2840;
  --gold: #f0a500;
  --gold2: #c07a00;
  --goldf: #ffe066;
  --green: #22c55e;
  --greeng: rgba(34,197,94,0.25);
  --red: #ef4444;
  --redg: rgba(239,68,68,0.3);
  --text: #e2e8f0;
  --text2: #8898aa;
  --text3: #4a5568;
  --r: 6px;
  --r2: 10px;
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); overflow: hidden; height: 100vh; user-select: none; }
#app { display: flex; flex-direction: column; height: 100vh; }

/* ═══ TELA DE SALA ═══════════════════════════════════════════════════ */
.room-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.room-card {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 360px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.8);
}
.room-logo { font-size: 48px; filter: drop-shadow(0 0 20px var(--gold)); }
.room-title { font-size: 22px; font-weight: 900; letter-spacing: 4px; color: var(--gold); text-transform: uppercase; }
.room-subtitle { font-size: 12px; color: var(--text3); margin-top: -8px; }
.room-btn { width: 100%; padding: 12px; font-size: 14px; margin-top: 8px; }
.room-divider { width: 100%; display: flex; align-items: center; gap: 10px; color: var(--text3); font-size: 11px; }
.room-divider::before, .room-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.room-join-row { display: flex; gap: 8px; width: 100%; }
.room-code-inp { flex: 1; text-transform: uppercase; letter-spacing: 3px; font-weight: 800; font-size: 15px; text-align: center; }
.room-btn-join { white-space: nowrap; }
.room-error { color: var(--red); font-size: 12px; font-weight: 600; text-align: center; }
.room-loading { color: var(--text3); font-size: 12px; font-style: italic; }

/* ═══ TITLEBAR ════════════════════════════════════════════════════════ */
.titlebar { display: flex; align-items: center; height: 42px; background: var(--surf); border-bottom: 1px solid var(--border); padding: 0 12px; flex-shrink: 0; }
.titlebar-left { display: flex; align-items: center; gap: 8px; min-width: 160px; }
.app-logo { font-size: 18px; filter: drop-shadow(0 0 8px var(--gold)); }
.app-title { font-size: 13px; font-weight: 800; letter-spacing: 3px; color: var(--gold); text-transform: uppercase; }
.titlebar-tabs { display: flex; align-items: center; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; padding: 0 8px; }
.titlebar-tabs::-webkit-scrollbar { display: none; }
.titlebar-right { display: flex; align-items: center; gap: 6px; min-width: 80px; justify-content: flex-end; }

.room-badge {
  background: rgba(240,165,0,0.12);
  border: 1px solid rgba(240,165,0,0.35);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s;
}
.room-badge:hover { background: rgba(240,165,0,0.2); }

.map-tab { padding: 4px 14px; border-radius: 5px 5px 0 0; font-size: 12px; font-weight: 600; color: var(--text2); background: transparent; border: none; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; transition: all 0.2s; }
.map-tab:hover { color: var(--text); background: var(--surf2); }
.map-tab.active { color: var(--gold); border-bottom-color: var(--gold); background: var(--surf2); }
.btn-tab-add { width: 26px; height: 26px; border-radius: 50%; background: var(--surf3); border: 1px solid var(--border); color: var(--text2); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; font-weight: 300; line-height: 1; }
.btn-tab-add:hover { background: var(--gold); color: #000; border-color: var(--gold); }
.btn-icon-title { background: none; border: none; font-size: 14px; cursor: pointer; padding: 4px; border-radius: 4px; opacity: 0.5; transition: all 0.2s; }
.btn-icon-title:hover, .btn-icon-title.active { opacity: 1; background: var(--surf3); }

/* ═══ TOOLBAR ════════════════════════════════════════════════════════ */
.toolbar { display: flex; align-items: center; justify-content: space-between; height: 40px; background: var(--surf); border-bottom: 1px solid var(--border); padding: 0 12px; flex-shrink: 0; gap: 8px; }
.toolbar-left { display: flex; align-items: center; gap: 8px; flex: 1; overflow: hidden; }
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.map-name-label { font-size: 12px; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; }
.vsep { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }
.lbl-sm { font-size: 11px; color: var(--text2); white-space: nowrap; }
.inp-unit { font-size: 11px; color: var(--text3); white-space: nowrap; }
.num-inp { width: 48px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); color: var(--text); font-size: 12px; padding: 3px 6px; text-align: center; outline: none; font-family: 'Inter'; }
.num-inp.w40 { width: 40px; }
.num-inp:focus { border-color: var(--gold); }
.num-inp::-webkit-inner-spin-button, .num-inp::-webkit-outer-spin-button { display: none; }
.num-inp { -moz-appearance: textfield; }
.inp-text::-webkit-inner-spin-button, .inp-text::-webkit-outer-spin-button { display: none; }
.inp-text[type="number"] { -moz-appearance: textfield; }
.tog-wrap { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.tog-wrap input { display: none; }
.tog-track { width: 34px; height: 18px; border-radius: 9px; background: var(--surf3); border: 1px solid var(--border); position: relative; transition: all 0.2s; flex-shrink: 0; }
.tog-track::after { content: ''; position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--text3); top: 2px; left: 2px; transition: all 0.2s; }
.tog-wrap input:checked + .tog-track { background: var(--gold); border-color: var(--gold); }
.tog-wrap input:checked + .tog-track::after { left: 18px; background: #000; }
.tog-text { font-size: 11px; font-weight: 600; color: var(--text2); white-space: nowrap; }
.btn-map-cfg { background: var(--surf3); border: 1px solid var(--border); color: var(--text2); padding: 5px 12px; border-radius: var(--r); font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.btn-map-cfg:hover { border-color: var(--gold); color: var(--gold); }
.btn-reset-all { background: linear-gradient(135deg, #7f1d1d, #991b1b); border: 1px solid #b91c1c; color: #fca5a5; padding: 5px 14px; border-radius: var(--r); font-size: 12px; font-weight: 700; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.btn-reset-all:hover { background: linear-gradient(135deg, #991b1b, #b91c1c); color: white; }

/* ═══ MAIN ═══════════════════════════════════════════════════════════ */
.main { display: flex; flex: 1; overflow: hidden; }

/* ═══ MAP ════════════════════════════════════════════════════════════ */
.map-area { flex: 1; display: flex; align-items: center; justify-content: center; background: #08090e; overflow: hidden; padding: 8px; }
.map-empty-state { text-align: center; padding: 40px; }
.empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.3; }
.empty-title { font-size: 18px; font-weight: 700; color: var(--text2); margin-bottom: 8px; }
.empty-sub { font-size: 13px; color: var(--text3); }
.empty-sub strong { color: var(--gold); }
.map-wrapper { position: relative; width: 100%; max-height: 100%; overflow: hidden; }
.map-no-img { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--surf); border: 2px dashed var(--border); border-radius: var(--r2); }
.btn-upload { display: flex; flex-direction: column; align-items: center; gap: 10px; background: none; border: none; color: var(--text2); font-size: 14px; font-family: 'Inter'; cursor: pointer; padding: 20px; border-radius: var(--r2); transition: all 0.2s; }
.btn-upload span:first-child { font-size: 36px; }
.btn-upload:hover { color: var(--gold); background: rgba(240,165,0,0.05); }
.map-img { display: block; width: 100%; height: 100%; }
.spots-overlay { position: absolute; inset: 0; }

/* ═══ SPOT MARKERS ════════════════════════════════════════════════════ */
.spot-marker { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; z-index: 10; transition: transform 0.1s; }
.spot-marker:hover { z-index: 20; }
.spot-badge { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; border: 2px solid rgba(255,255,255,0.2); box-shadow: 0 2px 8px rgba(0,0,0,0.6); transition: all 0.3s; background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #000; }
.spot-label { font-size: 9px; font-weight: 700; color: white; background: rgba(0,0,0,0.75); padding: 1px 5px; border-radius: 3px; white-space: nowrap; text-shadow: none; max-width: 72px; overflow: hidden; text-overflow: ellipsis; }
.spot-marker.running .spot-badge { background: linear-gradient(135deg, #16a34a, var(--green)); color: white; border-color: var(--green); box-shadow: 0 2px 12px var(--greeng); }
.spot-marker.alerting .spot-badge { background: linear-gradient(135deg, #b91c1c, var(--red)); color: white; border-color: var(--red); box-shadow: 0 2px 16px var(--redg); animation: pulse-badge 0.7s ease-in-out infinite; }
.spot-marker.spawned .spot-badge { background: linear-gradient(135deg, #1e3a5f, #2563eb); color: white; border-color: #3b82f6; }
.spot-marker.edit-mode { cursor: grab; }
.spot-marker.edit-mode:active { cursor: grabbing; }
.spot-marker.edit-mode .spot-badge { box-shadow: 0 0 0 3px rgba(240,165,0,0.4); }
@keyframes pulse-badge { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.spot-marker.uncertain .spot-badge { background: linear-gradient(135deg, #92400e, #f59e0b); color: #000; border-color: #f59e0b; box-shadow: 0 2px 12px rgba(245,158,11,0.5); }

/* ═══ SPAWN POPUP ════════════════════════════════════════════════════ */
.spawn-popup { position: absolute; z-index: 100; background: rgba(10,14,22,0.97); border: 1px solid rgba(59,130,246,0.5); border-radius: 10px; padding: 10px 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 1px rgba(59,130,246,0.15); display: flex; flex-direction: column; gap: 8px; min-width: 160px; pointer-events: all; animation: popup-in 0.15s cubic-bezier(0.34,1.56,0.64,1); backdrop-filter: blur(8px); }
@keyframes popup-in { from { opacity:0; transform: scale(0.85) translateY(4px); } to { opacity:1; transform: scale(1) translateY(0); } }
.spawn-popup-title { font-size: 12px; font-weight: 800; color: #60a5fa; text-align: center; letter-spacing: 0.5px; }
.spawn-popup-btns { display: flex; gap: 6px; }
.spawn-popup-btns .btn-kill, .spawn-popup-btns .btn-miss { flex: 1; padding: 6px 4px; font-size: 11px; }

/* ═══ SIDEBAR ════════════════════════════════════════════════════════ */
.channels-sidebar { width: 200px; background: var(--surf); border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0; }
.channels-sidebar .channel-list { flex: 1; overflow-y: auto; padding: 4px; }
.sidebar { width: 420px; background: var(--surf); border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0; }

/* Abas da sidebar */
.sidebar-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sidebar-tab { flex: 1; padding: 8px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; background: none; border: none; color: var(--text3); cursor: pointer; transition: all 0.2s; border-bottom: 2px solid transparent; }
.sidebar-tab:hover { color: var(--text2); background: var(--surf2); }
.sidebar-tab.active { color: var(--gold); border-bottom-color: var(--gold); background: var(--surf2); }

.sidebar-tabcontent { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.sidebar-sec { display: flex; flex-direction: column; border-bottom: 1px solid var(--border); }
.sidebar-sec.grow { flex: 1; overflow: hidden; }
.sec-hdr { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text2); background: var(--surf2); }
.btn-sm-icon { width: 20px; height: 20px; border-radius: 50%; background: var(--surf3); border: 1px solid var(--border); color: var(--text2); font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; line-height: 1; font-weight: 300; }
.btn-sm-icon:hover { background: var(--gold); color: #000; border-color: var(--gold); }

/* ═══ CHANNELS ════════════════════════════════════════════════════════ */
.channel-list { display: flex; flex-direction: column; gap: 2px; padding: 6px; }
.channel-btn { width: 100%; text-align: left; padding: 6px 10px; border-radius: var(--r); background: none; border: 1px solid transparent; color: var(--text2); font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: space-between; position: relative; }
.channel-btn:hover { background: var(--surf2); color: var(--text); }
.channel-btn.active { background: rgba(240,165,0,0.1); border-color: rgba(240,165,0,0.3); color: var(--gold); }
.channel-del { opacity: 0; font-size: 10px; color: var(--red); background: none; border: none; cursor: pointer; padding: 0 2px; }
.channel-btn:hover .channel-del { opacity: 1; }
.ch-badge { background: var(--red); color: white; font-size: 9px; font-weight: 800; min-width: 15px; height: 15px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; padding: 0 3px; animation: badge-pulse 1.4s ease-in-out infinite; margin-left: 2px; }
.channel-btn.has-alert { border-color: rgba(239,68,68,0.35) !important; }
.channel-btn.active.has-alert { background: rgba(239,68,68,0.12) !important; }

/* ═══ SPOTS LIST ══════════════════════════════════════════════════════ */
.spots-list { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 3px; scrollbar-width: thin; scrollbar-color: var(--surf3) transparent; }
.spot-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--r); background: var(--surf2); border: 1px solid transparent; transition: all 0.2s; }
.spot-row.running { border-color: rgba(34,197,94,0.2); }
.spot-row.alerting { border-color: rgba(239,68,68,0.3); animation: pulse-row 0.7s ease-in-out infinite; }
.spot-row.spawned { border-color: rgba(59,130,246,0.4); background: rgba(59,130,246,0.06); flex-wrap: wrap; }
.spot-row.uncertain { border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.04); }
@keyframes pulse-row { 0%,100% { background: var(--surf2); } 50% { background: rgba(239,68,68,0.08); } }
.spot-num { width: 22px; height: 22px; border-radius: 50%; background: var(--gold); color: #000; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.spot-row.running .spot-num { background: var(--green); color: white; }
.spot-row.alerting .spot-num { background: var(--red); color: white; }
.spot-row.spawned .spot-num { background: #3b82f6; color: white; }
.spot-row.uncertain .spot-num { background: #f59e0b; color: #000; }
.spot-info { flex: 1; min-width: 0; }
.spot-timer { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.spot-row.uncertain .spot-timer { color: #fbbf24; }
.spot-status { font-size: 10px; font-weight: 600; color: var(--text3); }
.spot-status.running { color: var(--green); }
.spot-status.alerting { color: var(--red); }
.spot-status.spawned { color: #60a5fa; }
.spot-status.uncertain { color: #f59e0b; }
.spot-actions { display: flex; gap: 4px; width: 100%; padding-top: 4px; border-top: 1px solid rgba(59,130,246,0.15); margin-top: 2px; }

/* ═══ MAPPING SECTION ════════════════════════════════════════════════ */
.mapping-info { padding: 10px 12px; font-size: 11px; color: var(--text3); line-height: 1.5; border-bottom: 1px solid var(--border); background: var(--surf2); }
.mapping-spots-list { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; scrollbar-color: var(--surf3) transparent; }
.mapping-spot-row { background: var(--surf2); border: 1px solid var(--border); border-radius: var(--r); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.mapping-spot-top { display: flex; align-items: center; gap: 8px; }
.mapping-spot-num { width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: #000; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mapping-spot-info { flex: 1; min-width: 0; }
.mapping-spot-name { font-size: 12px; font-weight: 700; color: var(--text); }
.mapping-spot-stats { font-size: 10px; color: var(--text3); margin-top: 1px; }
.mapping-spot-stats.has-data { color: var(--green); }
.mapping-spot-btns { display: flex; gap: 4px; }
.btn-map-kill { flex: 1; background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; padding: 5px 8px; border-radius: var(--r); font-size: 10px; font-weight: 700; cursor: pointer; transition: all 0.2s; font-family: 'Inter'; }
.btn-map-kill:hover { background: rgba(34,197,94,0.25); border-color: var(--green); }
.btn-map-clear { background: none; border: 1px solid var(--border); color: var(--text3); padding: 5px 8px; border-radius: var(--r); font-size: 10px; cursor: pointer; transition: all 0.2s; font-family: 'Inter'; }
.btn-map-clear:hover { border-color: var(--red); color: var(--red); }
.mapping-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.mapping-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold2), var(--gold)); border-radius: 2px; transition: width 0.5s; }
.mapping-empty { padding: 20px 12px; font-size: 11px; color: var(--text3); text-align: center; font-style: italic; }

/* ═══ RESUMO ══════════════════════════════════════════════════════════ */
.resumo-list { display: flex; flex-direction: column; gap: 0; overflow-y: auto; padding: 4px 0; }
.resumo-hdr { display: grid; grid-template-columns: 1fr 44px 72px 80px; gap: 6px; padding: 6px 12px; font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
.resumo-row { display: grid; grid-template-columns: 1fr 44px 72px 80px; gap: 6px; padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.03); align-items: center; }
.resumo-row:hover { background: var(--surf2); }
.resumo-label { font-size: 12px; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resumo-kills { font-size: 12px; color: var(--text2); text-align: center; }
.resumo-amostras { font-size: 12px; color: var(--text2); text-align: center; }
.resumo-timer-cell { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.resumo-timer { font-size: 12px; font-weight: 700; color: var(--text3); cursor: pointer; padding: 2px 4px; border-radius: 3px; }
.resumo-timer:hover { background: var(--surf3); color: var(--text); }
.resumo-timer.has-data { color: var(--gold); }
.resumo-timer.override { color: #60a5fa; }
.resumo-timer-inp { width: 52px; background: var(--surf3); border: 1px solid #60a5fa; border-radius: 3px; color: var(--text); font-size: 12px; font-weight: 700; padding: 2px 4px; text-align: center; outline: none; }
.resumo-clr { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 10px; padding: 0 2px; line-height: 1; }
.resumo-clr:hover { color: var(--red); }

/* ═══ BUTTONS ════════════════════════════════════════════════════════ */
.btn-kill { flex: 1; background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; padding: 4px 6px; border-radius: var(--r); font-size: 10px; font-weight: 700; cursor: pointer; transition: all 0.2s; font-family: 'Inter'; }
.btn-kill:hover { background: rgba(34,197,94,0.2); border-color: var(--green); }
.btn-miss { flex: 1; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #f87171; padding: 4px 6px; border-radius: var(--r); font-size: 10px; font-weight: 700; cursor: pointer; transition: all 0.2s; font-family: 'Inter'; }
.btn-miss:hover { background: rgba(239,68,68,0.2); border-color: var(--red); }
.btn-primary { background: linear-gradient(135deg, var(--gold2), var(--gold)); color: #000; border: none; padding: 8px 20px; border-radius: var(--r); font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.2s; font-family: 'Inter'; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-sec { background: var(--surf3); border: 1px solid var(--border); color: var(--text2); padding: 7px 14px; border-radius: var(--r); font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: 'Inter'; white-space: nowrap; }
.btn-sec:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--red); padding: 8px 16px; border-radius: var(--r); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: 'Inter'; }
.btn-danger:hover { background: rgba(239,68,68,0.2); border-color: var(--red); }
.btn-danger-sm { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: var(--red); padding: 5px 8px; border-radius: var(--r); font-size: 11px; cursor: pointer; transition: all 0.2s; font-family: 'Inter'; }
.btn-danger-sm:hover { background: rgba(239,68,68,0.2); }

/* ═══ STATUSBAR ══════════════════════════════════════════════════════ */
.statusbar { height: 24px; background: var(--surf); border-top: 1px solid var(--border); padding: 0 12px; display: flex; align-items: center; font-size: 10px; color: var(--text3); gap: 8px; }
.status-conn { font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 3px; }
.status-conn.online { background: rgba(34,197,94,0.15); color: var(--green); }
.status-conn.offline { background: rgba(239,68,68,0.15); color: var(--red); }

/* ═══ MODAL ══════════════════════════════════════════════════════════ */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(4px); }
.modal { background: var(--surf); border: 1px solid var(--border); border-radius: var(--r2); width: 460px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.7); }
.modal-hdr { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-hdr h2 { font-size: 15px; font-weight: 700; color: var(--gold); }
.btn-close-modal { background: none; border: none; color: var(--text2); font-size: 16px; cursor: pointer; padding: 4px; border-radius: 4px; transition: all 0.2s; }
.btn-close-modal:hover { color: var(--red); background: rgba(239,68,68,0.1); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border); }
.fg { display: flex; flex-direction: column; gap: 6px; }
.fg label { font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }
.inp-text { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); color: var(--text); font-size: 13px; padding: 8px 10px; outline: none; width: 100%; font-family: 'Inter'; transition: border-color 0.2s; }
.inp-text:focus { border-color: var(--gold); }
.inp-text.w80 { width: 80px; }
.inp-text.w60 { width: 60px; }
.inp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.img-row { display: flex; align-items: center; gap: 10px; }
.ms-thumb { width: 80px; height: 50px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--text3); overflow: hidden; flex-shrink: 0; }
.ms-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sound-name { font-size: 12px; color: var(--text2); flex: 1; }
.danger-zone { padding-top: 8px; border-top: 1px solid rgba(239,68,68,0.15); }

/* ═══ CUSTOM DIALOG ══════════════════════════════════════════════════ */
.dialog-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.65); display: flex; align-items: center; justify-content: center; z-index: 2000; backdrop-filter: blur(6px); animation: dlg-fadein 0.15s ease; }
@keyframes dlg-fadein { from { opacity: 0; } to { opacity: 1; } }
.dialog-box { background: var(--surf); border: 1px solid var(--border); border-radius: 14px; padding: 32px 28px 24px; min-width: 280px; max-width: 380px; box-shadow: 0 24px 64px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.04); display: flex; flex-direction: column; align-items: center; gap: 16px; animation: dlg-popin 0.18s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes dlg-popin { from { transform: scale(0.88); opacity:0; } to { transform: scale(1); opacity:1; } }
.dialog-icon { font-size: 36px; line-height: 1; }
.dialog-msg { font-size: 14px; font-weight: 600; color: var(--text); text-align: center; line-height: 1.5; }
.dialog-btns { display: flex; gap: 10px; margin-top: 4px; }
.dlg-btn { min-width: 90px; justify-content: center; }

/* ═══ ALERT SIDEBAR ══════════════════════════════════════════════════ */
.alert-sidebar { width: 268px; background: var(--surf); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0; transition: border-color 0.3s; }
.alert-sidebar.has-alerts { border-right-color: rgba(239,68,68,0.35); }
.alert-panel-hdr { display: flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text2); background: var(--surf2); cursor: pointer; user-select: none; transition: background 0.2s; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.alert-sidebar.has-alerts .alert-panel-hdr { color: #fca5a5; background: rgba(239,68,68,0.08); }
.alert-panel-hdr:hover { background: var(--surf3); }
.alert-panel-title { flex: 1; }
.alert-panel-count { background: var(--red); color: white; font-size: 9px; font-weight: 800; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; opacity: 0; transform: scale(0.8); transition: all 0.2s; }
.alert-sidebar.has-alerts .alert-panel-count { opacity: 1; transform: scale(1); animation: badge-pulse 1.4s ease-in-out infinite; }
.alert-panel-chevron { font-size: 9px; color: var(--text3); }
.alert-panel-list { display: flex; flex-direction: column; gap: 2px; padding: 6px; flex: 1; overflow-y: auto; }
.alert-empty { font-size: 10px; color: var(--text3); padding: 10px 6px; text-align: center; font-style: italic; }
.alert-item { display: grid; grid-template-columns: 10px 48px 1fr 48px 52px; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 4px; font-size: 11px; cursor: pointer; transition: background 0.15s; border: 1px solid transparent; }
.alert-item.alerting { background: rgba(239,68,68,0.07); border-color: rgba(239,68,68,0.15); animation: pulse-row 0.9s ease-in-out infinite; }
.alert-item.spawned { background: rgba(59,130,246,0.07); border-color: rgba(59,130,246,0.2); }
.alert-item:hover { filter: brightness(1.3); }
.ai-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.alert-item.alerting .ai-dot { background: var(--red); box-shadow: 0 0 6px var(--red); }
.alert-item.spawned .ai-dot { background: #3b82f6; box-shadow: 0 0 6px #3b82f6; }
.ai-channel { font-weight: 700; color: var(--gold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-sep { display: none; }
.ai-map { color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-spot { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-time { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; text-align: right; }
.alert-item.alerting .ai-time { color: var(--red); }
.alert-item.spawned .ai-time { color: #60a5fa; }
.alert-item.uncertain .ai-time { color: #f59e0b; }
.alert-item.uncertain .ai-spot { color: #f59e0b; }

/* ═══ SHARE MODAL ════════════════════════════════════════════════════ */
.share-modal { width: 500px; }
.share-section { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--surf2); border: 1px solid var(--border); border-radius: var(--r2); transition: border-color 0.2s; }
.share-section:hover { border-color: var(--gold); }
.share-icon { font-size: 28px; flex-shrink: 0; }
.share-info { flex: 1; min-width: 0; }
.share-info strong { display: block; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.share-info p { font-size: 12px; color: var(--text2); line-height: 1.5; margin: 0; }
.share-info code { background: var(--bg); border: 1px solid var(--border); border-radius: 3px; padding: 1px 5px; font-size: 11px; color: var(--gold); }
.share-warn { color: #f59e0b; font-weight: 600; }
.share-divider { height: 1px; background: var(--border); margin: 0 4px; }
.share-note { background: rgba(240,165,0,0.06); border: 1px solid rgba(240,165,0,0.2); border-radius: var(--r); padding: 10px 14px; font-size: 12px; color: var(--text2); line-height: 1.5; }

/* ═══ SCROLLBAR ══════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surf3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* ═══ KEYFRAMES ══════════════════════════════════════════════════════ */
@keyframes badge-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); } 50% { box-shadow: 0 0 0 4px rgba(239,68,68,0); } }
