/* Tarkov Position Mapper - single dark theme.
   Deliberately one theme: this sits over dark map imagery in a dark room, and a
   light variant would fight the maps rather than serve them. */

:root {
  --bg:        #101310;
  --panel:     #171b16;
  --sunk:      #0b0d0a;
  --line:      #22271f;
  --line-solid:#2a3027;
  --text:      #dfe4dc;
  --muted:     #8e988c;
  --accent:    #9cc062;
  --accent-dk: #4e6a29;
  --warn:      #e0a33f;
  --error:     #db7b60;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  display: grid;
  grid-template-columns: 310px 1fr;
  overflow: hidden;
}

body.panel-hidden { grid-template-columns: 0 1fr; }
body.panel-hidden .panel { transform: translateX(-100%); }
body.panel-hidden #btn-panel { transform: rotate(180deg); }

/* ---------- panel ---------- */

.panel {
  background: var(--panel);
  border-right: 1px solid var(--line-solid);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  transition: transform 200ms ease;
  z-index: 500;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line-solid);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}

.panel-head h1 {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.block {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lbl {
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.field {
  width: 100%;
  background: var(--sunk);
  color: var(--text);
  border: 1px solid var(--line-solid);
  border-radius: 3px;
  padding: 0.45rem 0.55rem;
  font-family: var(--sans);
  font-size: 0.88rem;
}
.field:focus-visible { outline: 2px solid var(--accent-dk); outline-offset: 1px; }

.folder {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
  background: var(--sunk);
  border: 1px solid var(--line-solid);
  border-radius: 3px;
  padding: 0.45rem 0.55rem;
  word-break: break-all;
}

.row { display: flex; gap: 0.5rem; }
.row > button { flex: 1; }

button {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  padding: 0.5rem 0.6rem;
  border-radius: 3px;
  border: 1px solid var(--line-solid);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.primary { background: var(--accent-dk); color: #eaf3dd; border-color: var(--accent-dk); }
.primary:hover:not(:disabled) { background: #5d7f31; }

.secondary { background: var(--sunk); color: var(--text); }
.secondary:hover:not(:disabled) { border-color: var(--accent-dk); }
.secondary[data-on="no"] { color: var(--muted); }

.ghost {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0.2rem 0.4rem;
  font-size: 0.85rem;
  transition: transform 200ms ease;
}
.ghost:hover { color: var(--text); }

.hint {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--muted);
}
.hint code {
  font-family: var(--mono);
  font-size: 0.95em;
  background: var(--sunk);
  padding: 0.05em 0.3em;
  border-radius: 2px;
}

.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4a4f47;
  margin-right: 0.35rem;
  vertical-align: middle;
}
.dot[data-on="yes"] { background: var(--accent); box-shadow: 0 0 6px var(--accent); }

.room-state { display: flex; flex-direction: column; gap: 0.5rem; }

.code-field {
  font-family: var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
}
.code-field::placeholder { letter-spacing: 0.18em; color: #5c645a; }

.room-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--sunk);
  border: 1px solid var(--line-solid);
  border-radius: 3px;
  padding: 0.45rem 0.6rem;
}

.room-code {
  font-family: var(--mono);
  font-size: 1.05rem;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.players li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8rem;
  padding: 0.25rem 0;
}
.players .empty { color: var(--muted); font-style: italic; grid-template-columns: 1fr; }
.swatch { width: 10px; height: 10px; border-radius: 2px; }
.pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcoord { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.panel-foot {
  margin-top: auto;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line-solid);
  position: sticky;
  bottom: 0;
  background: var(--panel);
}

.status { font-size: 0.76rem; line-height: 1.45; color: var(--muted); }
.status[data-kind="ok"]    { color: var(--accent); }
.status[data-kind="warn"]  { color: var(--warn); }
.status[data-kind="error"] { color: var(--error); }

/* ---------- map ---------- */

.stage { position: relative; overflow: hidden; }
.map { position: absolute; inset: 0; background: var(--bg); }

.leaflet-container { background: var(--bg); outline: none; }
.leaflet-control-zoom a {
  background: var(--panel);
  color: var(--text);
  border-color: var(--line-solid);
}
.leaflet-control-zoom a:hover { background: var(--sunk); }

/* ---------- markers ---------- */

.mk { background: none; border: none; }

.mk-wrap {
  position: relative;
  width: 60px;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}

.mk-label {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  padding: 2px 5px;
  margin-bottom: 3px;
  background: rgba(11, 13, 10, 0.85);
  border: 1px solid;
  border-radius: 2px;
  color: var(--text);
  white-space: nowrap;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: auto;
}

.mk-arrow {
  transform-origin: center center;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
  pointer-events: auto;
}

.leaflet-popup-content-wrapper {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line-solid);
  border-radius: 3px;
}
.leaflet-popup-tip { background: var(--panel); }
.leaflet-popup-content { margin: 0.6rem 0.8rem; font-family: var(--mono); font-size: 0.75rem; }

.pop-name { font-weight: 600; margin-bottom: 0.35rem; }
.pop-xyz { color: var(--muted); line-height: 1.5; font-variant-numeric: tabular-nums; }
.pop-meta { color: var(--muted); margin-top: 0.35rem; }
.pop-warn { color: var(--warn); margin-top: 0.4rem; }

/* ---------- narrow ---------- */

@media (max-width: 720px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  body.panel-hidden { grid-template-columns: 1fr; }
  .panel { max-height: 46vh; }
  body.panel-hidden .panel { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
