:root {
  --bg: #0b1020; --card: rgba(22, 30, 54, .78); --line: rgba(148, 163, 216, .18);
  --text: #eef2ff; --muted: #a5b0d6; --accent: #7c8cff; --accent2: #22d3ee;
  --danger: #ff5c7a; --ok: #34d399; --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--bg);
}
.glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(124, 140, 255, .35), transparent 60%),
    radial-gradient(800px 500px at 110% 10%, rgba(34, 211, 238, .22), transparent 60%),
    radial-gradient(700px 600px at 50% 120%, rgba(255, 92, 122, .16), transparent 60%);
}
[hidden] { display: none !important; }
.muted { color: var(--muted); }
h1, h2, h3 { margin: 0 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 26px; } h3 { font-size: 17px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; backdrop-filter: blur(14px); box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
input, textarea, select {
  width: 100%; margin: 6px 0 10px; padding: 11px 13px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(8, 12, 28, .7); color: var(--text); font: inherit;
}
input:focus, textarea:focus, select:focus, .btn:focus-visible, .find:focus-visible {
  outline: 2px solid var(--accent2); outline-offset: 2px;
}
select { width: auto; margin: 0 6px; }
label { display: block; color: var(--muted); font-size: 13px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
label.inline input { width: auto; margin: 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(124, 140, 255, .14); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: transform .08s, background .2s;
}
.btn:hover { background: rgba(124, 140, 255, .28); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #5b6cff); border-color: transparent; }
.btn.danger { background: rgba(255, 92, 122, .18); border-color: rgba(255, 92, 122, .5); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; padding: 13px; margin-top: 6px; }
.btn[disabled] { opacity: .55; cursor: progress; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); text-align: left; }
.logo {
  width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 26px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); margin-bottom: 14px;
}
.err { color: #ffb3c1; min-height: 1.5em; margin: 10px 0 0; }

main { max-width: 1180px; margin: 0 auto; padding: 18px 20px 40px; display: grid; gap: 18px; }
.top { display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.brand .muted { font-weight: 500; font-size: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(52, 211, 153, .2); }
.dot.off { background: var(--danger); }

.hero { display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(124, 140, 255, .22), rgba(34, 211, 238, .08)), var(--card); }
.hero-left { flex: 1 1 380px; }
.hero-right { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.find {
  width: 150px; height: 150px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  font: 800 22px/1 system-ui, sans-serif; letter-spacing: .12em;
  background: radial-gradient(circle at 30% 30%, #ff8aa0, var(--danger) 55%, #c0264a);
  box-shadow: 0 0 0 0 rgba(255, 92, 122, .6), 0 14px 40px rgba(255, 92, 122, .45);
  animation: pulse 2.2s infinite; transition: transform .1s;
}
.find:active { transform: scale(.95); }
.find.ringing { animation: pulse .7s infinite, shake .35s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 92, 122, .55), 0 14px 40px rgba(255, 92, 122, .45); }
  70% { box-shadow: 0 0 0 28px rgba(255, 92, 122, 0), 0 14px 40px rgba(255, 92, 122, .45); }
  100% { box-shadow: 0 0 0 0 rgba(255, 92, 122, 0), 0 14px 40px rgba(255, 92, 122, .45); }
}
@keyframes shake { 0%, 100% { rotate: 0deg; } 25% { rotate: -4deg; } 75% { rotate: 4deg; } }

.grid { display: grid; gap: 18px; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.actions { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.tile .k { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.tile .v { font-size: 30px; font-weight: 800; margin: 4px 0; }
.tile .s { color: var(--muted); font-size: 13px; }
.bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; margin: 6px 0; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), var(--accent2)); transition: width .6s; }

.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cardhead input { width: 260px; margin: 0; }
#map { height: 420px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #0d1428; }
.leaflet-container { font: inherit; }
.pin { width: 22px; height: 22px; border-radius: 50%; background: var(--accent2); border: 3px solid #fff;
  box-shadow: 0 0 0 8px rgba(34, 211, 238, .25), 0 0 24px rgba(34, 211, 238, .9); }

.shot { display: block; max-width: 100%; max-height: 420px; margin-top: 12px; border-radius: 12px; border: 1px solid var(--line); }
.pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.piece { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: rgba(8, 12, 28, .45); }
.piece summary { cursor: pointer; font-weight: 700; }
.piece summary .muted { font-weight: 400; display: block; font-size: 13px; }
.piece pre { white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto;
  background: rgba(0, 0, 0, .35); padding: 10px; border-radius: 10px; font-size: 12.5px; }
.piece label { margin-top: 8px; }

footer { text-align: center; font-size: 13px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; translate: -50% 20px; opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 12px; background: #1d2747; border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); transition: opacity .25s, translate .25s; max-width: 90vw;
}
.toast.show { opacity: 1; translate: -50% 0; }
.toast.bad { border-color: rgba(255, 92, 122, .6); }
@media (max-width: 640px) { .find { width: 120px; height: 120px; } #map { height: 320px; } }
