:root {
  --bg: #0b1020;
  --panel-bg: #121a30;
  --panel-border: #24304f;
  --text: #e8ecf6;
  --muted: #9aa6c2;
  --accent: #ffd23f;
  --accent-2: #4f9dff;
  --danger: #ff5d5d;
  --ok: #46d18b;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

#topbar {
  position: absolute;
  z-index: 10;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(11, 16, 32, 0.95), rgba(11, 16, 32, 0.6) 70%, transparent);
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand .globe { font-size: 34px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: 0.3px; }
.tagline { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.handle-field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.handle-field input {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 14px;
  width: 150px;
}

main { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; }

.hint {
  position: absolute;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 26, 48, 0.9);
  border: 1px solid var(--panel-border);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  box-shadow: var(--shadow);
  z-index: 5;
  backdrop-filter: blur(6px);
}
.hint strong { color: var(--text); }

/* ---- Panel ---- */
.panel {
  position: absolute;
  top: 74px; right: 16px; bottom: 16px;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 8;
  padding: 18px;
  overflow-y: auto;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.panel.hidden { transform: translateX(24px); opacity: 0; pointer-events: none; }

.icon-btn {
  position: absolute;
  top: 12px; right: 12px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.icon-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }

.place-kind {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-2);
  font-weight: 700;
  margin: 2px 40px 2px 0;
}
.place-name {
  font-size: 22px;
  font-weight: 700;
  margin: 2px 40px 2px 0;
  line-height: 1.2;
  word-break: break-word;
}
.place-sub { font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.place-original { font-style: italic; }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  margin-right: 6px;
}
.badge.locked { color: var(--danger); border-color: rgba(255,93,93,.4); }
.badge.open { color: var(--ok); border-color: rgba(70,209,139,.4); }
.badge.held { color: var(--accent); border-color: rgba(255,210,63,.4); }

/* Bid input (auction model) */
.bid-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0 12px;
}
.bid-row:focus-within { outline: 2px solid var(--accent-2); border-color: transparent; }
.bid-currency { color: var(--muted); font-size: 15px; }
input.text.bid-input {
  border: none;
  background: transparent;
  padding: 11px 0;
}
input.text.bid-input:focus { outline: none; }
.price-meta.ok  { color: var(--ok); }
.price-meta.bad { color: var(--danger); }

.price-box {
  background: rgba(255, 210, 63, 0.08);
  border: 1px solid rgba(255, 210, 63, 0.3);
  border-radius: 12px;
  padding: 14px;
  margin: 12px 0;
}
.price-now { font-size: 30px; font-weight: 800; color: var(--accent); }
.price-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.countdown { font-variant-numeric: tabular-nums; color: var(--text); }

label.field { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
input.text {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
}
input.text:focus { outline: 2px solid var(--accent-2); border-color: transparent; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 14px;
  transition: transform 0.05s ease, filter 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #23200a; }
.btn-primary:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---- Label style editor ---- */
.style-box {
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px;
}
.style-head { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.style-locked {
  font-size: 11px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--panel-border); border-radius: 999px;
  padding: 1px 8px; margin-left: 6px;
}
.style-preview {
  display: inline-block;
  min-height: 28px;
  margin: 4px 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.3;
  word-break: break-word;
}
.style-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.style-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  flex: 1;
}
.style-row label.chk { flex-direction: row; align-items: center; gap: 6px; }
.style-row select,
.style-row input[type="range"] { width: 100%; }
.style-row select {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 14px;
}
.style-row input[type="color"] {
  width: 100%;
  height: 32px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
}
.style-row input[type="color"]:disabled { opacity: 0.4; cursor: not-allowed; }

.history { margin-top: 18px; }
.history h3 { font-size: 13px; color: var(--muted); margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.06em; }
.history-item {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 13px; padding: 7px 0; border-top: 1px solid var(--panel-border);
}
.history-item .hname { font-weight: 600; word-break: break-word; }
.history-item .hmeta { color: var(--muted); white-space: nowrap; }
.empty { color: var(--muted); font-size: 13px; }

/* ---- Map labels (custom overlay markers) ---- */
.nte-label {
  transform: translate(-50%, -130%);
  background: rgba(18, 26, 48, 0.92);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nte-label.locked { border-color: rgba(255,93,93,.5); }
.nte-label-icon { margin-right: 5px; }

/* ---- Hover preview bubble (follows the cursor) ---- */
.nte-hover-bubble {
  position: fixed;
  z-index: 15;
  pointer-events: none; /* never block map clicks/hover */
  max-width: 420px;
  background: rgba(14, 20, 38, 0.97);
  border: 2px solid #00e5ff; /* bright cyan, matches the outline */
  border-left: 6px solid #ff2d78; /* hot magenta accent */
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 229, 255, 0.25);
  color: var(--text);
  font-size: 18px;
  backdrop-filter: blur(8px);
  transition: opacity 0.08s ease;
}
.nte-hover-bubble.hidden { opacity: 0; visibility: hidden; }
.nte-hover-bubble .hb-top {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 22px; line-height: 1.15;
}
.nte-hover-bubble .hb-icon { font-size: 26px; }
.nte-hover-bubble .hb-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px;
}
.nte-hover-bubble .hb-meta { font-size: 15px; color: #ffd23f; margin-top: 6px; font-weight: 600; }
.nte-hover-bubble .hb-was { display: block; font-size: 14px; color: var(--muted); font-style: italic; margin-top: 4px; }

/* ---- Toasts ---- */
.toasts {
  position: absolute;
  bottom: 18px; right: 18px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-left: 4px solid var(--accent-2);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  box-shadow: var(--shadow);
  max-width: 320px;
  animation: slidein 0.2s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 560px) {
  .panel { top: auto; right: 8px; left: 8px; bottom: 8px; width: auto; max-height: 62vh; }
  .brand h1 { font-size: 17px; }
  .tagline { display: none; }
}
