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

:root {
  --bg: #080b11;
  --surface: #0f1520;
  --surface2: #161e2e;
  --surface3: #1d2840;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --accent: #f0c040;
  --cyan: #4af0ff;
  --green: #4af0a0;
  --red: #ff4d6a;
  --orange: #ff8c44;
  --text: #e8eaf0;
  --text-dim: #6b7a99;
  --radius: 12px;
}

html, body { height: 100%; font-family: 'Outfit', sans-serif; background: var(--bg); color: var(--text); overflow: hidden; }

.app { display: flex; flex-direction: column; height: 100vh; }

/* HEADER */
.header {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  background: rgba(8,11,17,0.96); backdrop-filter: blur(20px);
  z-index: 20; flex-shrink: 0;
}
.logo { display: flex; align-items: center; gap: 9px; font-size: 1rem; font-weight: 600; white-space: nowrap; }
.logo strong { color: var(--accent); }
.version-badge { font-size: 0.6rem; padding: 2px 7px; border-radius: 20px; background: rgba(240,192,64,0.15); color: var(--accent); font-weight: 700; border: 1px solid rgba(240,192,64,0.3); }

.header-center { flex: 1; display: flex; justify-content: center; }
.phase-selector { display: flex; align-items: center; gap: 6px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 5px 10px; }
.phase-label { font-size: 0.7rem; color: var(--text-dim); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; margin-right: 4px; }
.phase-btn {
  padding: 5px 12px; border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--text-dim); font-family: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.phase-btn:hover { color: var(--text); border-color: var(--border2); }
.phase-btn.active { background: rgba(240,192,64,0.15); border-color: var(--accent); color: var(--accent); }
.phase-btn.drawn { color: var(--green); border-color: rgba(74,240,160,0.3); }
.phase-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.header-right { display: flex; align-items: center; gap: 8px; }
.tag { font-size: 0.65rem; font-weight: 700; letter-spacing: 1.5px; padding: 3px 10px; border-radius: 20px; background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim); }
.tag-status { background: rgba(74,240,160,0.1); border-color: rgba(74,240,160,0.35); color: var(--green); }
.tag-status.simulating { background: rgba(240,192,64,0.1); border-color: rgba(240,192,64,0.35); color: var(--accent); }
.tag-status.predicted { background: rgba(255,77,106,0.1); border-color: rgba(255,77,106,0.35); color: var(--red); }

/* MAIN */
.main { display: flex; flex: 1; overflow: hidden; min-height: 0; }

/* MAP */
.map-wrap { flex: 1; position: relative; background: #050810; overflow: hidden; cursor: crosshair; }
#mapCanvas, #overlayCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#overlayCanvas { z-index: 2; }

.map-hint { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.hint-card { background: rgba(8,11,17,0.88); backdrop-filter: blur(16px); border: 1px solid var(--border2); border-radius: 14px; padding: 18px 28px; text-align: center; animation: pulseFade 2.5s ease-in-out infinite; }
.hint-card p { font-size: 0.9rem; color: var(--text-dim); line-height: 1.9; }
.hint-card p strong { color: var(--accent); }
.hint-icon { font-size: 2rem; margin-bottom: 8px; }
.hint-sub { font-size: 0.75rem !important; color: var(--text-dim) !important; opacity: 0.7; }
@keyframes pulseFade { 0%,100%{opacity:1} 50%{opacity:0.65} }

.map-badge { position: absolute; bottom: 12px; left: 12px; z-index: 6; font-size: 0.65rem; font-weight: 700; letter-spacing: 1.5px; color: var(--text-dim); background: rgba(8,11,17,0.75); padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); text-transform: uppercase; }

.uncertainty-overlay { position: absolute; top: 12px; left: 12px; z-index: 6; background: rgba(8,11,17,0.85); backdrop-filter: blur(12px); border: 1px solid var(--border2); border-radius: 10px; padding: 10px 14px; min-width: 180px; }
.unc-label { font-size: 0.65rem; font-weight: 700; letter-spacing: 1.2px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 6px; }
.unc-bar-wrap { background: rgba(255,255,255,0.08); border-radius: 4px; height: 6px; overflow: hidden; margin-bottom: 4px; }
.unc-bar { height: 100%; border-radius: 4px; background: linear-gradient(to right, #f0c040, #4af0a0); transition: width 0.6s ease; width: 0%; }
.unc-pct { font-size: 0.85rem; font-weight: 700; color: var(--green); }

/* SIDEBAR */
.sidebar { width: 288px; border-left: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; overflow-y: auto; padding: 12px; gap: 10px; flex-shrink: 0; }
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }

/* PANELS */
.panel { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.panel-title { display: flex; align-items: center; gap: 7px; font-size: 0.68rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px; }
.dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-yellow { background: var(--accent); box-shadow: 0 0 6px rgba(240,192,64,0.7); }
.dot-cyan { background: var(--cyan); box-shadow: 0 0 6px rgba(74,240,255,0.7); }
.dot-green { background: var(--green); box-shadow: 0 0 6px rgba(74,240,160,0.7); }
.dot-red { background: var(--red); box-shadow: 0 0 6px rgba(255,77,106,0.7); }

/* BEST ZONE PANEL */
.best-zone-panel {
  background: linear-gradient(135deg, rgba(240,192,64,0.12), rgba(255,77,106,0.08));
  border: 1px solid rgba(240,192,64,0.3); border-radius: var(--radius); padding: 14px; text-align: center;
  animation: fadeSlide 0.4s ease;
}
.bz-header { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 0.65rem; font-weight: 700; letter-spacing: 1.5px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 8px; }
.bz-crown { font-size: 1rem; }
.bz-confidence { font-size: 2.8rem; font-weight: 900; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 0 30px rgba(240,192,64,0.4); }
.bz-coords { font-size: 0.78rem; color: var(--text-dim); margin-top: 4px; font-variant-numeric: tabular-nums; }
.bz-ring { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--accent); margin: 8px auto; opacity: 0.6; }
.bz-sub { font-size: 0.72rem; color: var(--text-dim); }

/* PHASE WINDOWS */
.phase-windows { display: flex; flex-direction: column; gap: 8px; }
.phase-window { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.pw-header { display: flex; align-items: center; gap: 7px; padding: 8px 10px; font-size: 0.7rem; font-weight: 600; color: var(--text-dim); border-bottom: 1px solid var(--border); }
.pw-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.pw-conf { margin-left: auto; font-weight: 700; color: var(--green); font-size: 0.75rem; }
.pw-canvas { display: block; width: 100%; height: 110px; background: #050810; }

/* DRAWN ZONES LIST */
.zone-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; background: rgba(255,255,255,0.03); margin-bottom: 5px; border: 1px solid var(--border); font-size: 0.8rem; }
.zone-item-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.zone-item-info { flex: 1; }
.zone-item-name { font-weight: 600; color: var(--text); }
.zone-item-sub { font-size: 0.68rem; color: var(--text-dim); }
.zone-item-del { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 0.9rem; padding: 2px 6px; border-radius: 4px; transition: all 0.15s; }
.zone-item-del:hover { color: var(--red); background: rgba(255,77,106,0.1); }
.empty-state { font-size: 0.78rem; color: var(--text-dim); text-align: center; padding: 10px 0; }

/* CONTROLS */
.ctrl-row { margin-bottom: 12px; }
.ctrl-lbl { font-size: 0.68rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; display: block; margin-bottom: 6px; }
.iter-btns { display: flex; gap: 5px; }
.iter-btn { flex: 1; padding: 6px 0; border-radius: 7px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); color: var(--text-dim); font-family: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.iter-btn:hover { border-color: var(--accent); color: var(--accent); }
.iter-btn.active { background: rgba(240,192,64,0.14); border-color: var(--accent); color: var(--accent); }

.toggle-list { display: flex; flex-direction: column; gap: 7px; }
.tog { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 0.82rem; color: var(--text-dim); user-select: none; }
.tog input { display: none; }
.tog-track { width: 32px; height: 17px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); position: relative; transition: all 0.2s; flex-shrink: 0; }
.tog-track::after { content:''; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--text-dim); transition: all 0.2s; }
.tog input:checked + .tog-track { background: rgba(240,192,64,0.18); border-color: var(--accent); }
.tog input:checked + .tog-track::after { left: 17px; background: var(--accent); }

.btn-primary { width: 100%; padding: 11px; border-radius: 10px; border: none; background: linear-gradient(135deg, #f0c040, #d4a020); color: #080b11; font-family: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s; margin-bottom: 7px; margin-top: 6px; }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(240,192,64,0.35); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.btn-secondary { width: 100%; padding: 9px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); font-family: inherit; font-size: 0.82rem; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.btn-secondary:hover { border-color: var(--red); color: var(--red); }

.legend-row { display: flex; align-items: center; gap: 8px; font-size: 0.65rem; color: var(--text-dim); padding: 0 2px; }
.legend-bar { flex: 1; height: 7px; border-radius: 4px; background: linear-gradient(to right, rgba(0,40,200,0.6), #00ccff, #ffee00, #ff4400); }

.footer-note { font-size: 0.65rem; color: var(--text-dim); text-align: center; padding: 2px 0; }

@keyframes fadeSlide { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:translateY(0)} }
