:root {
  --bg: #0f1117;
  --surface: #171a23;
  --surface-2: #1f2330;
  --surface-3: #272c3d;
  --border: #2c3144;
  --text: #eef1f7;
  --muted: #98a1b5;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --green: #3ba55c;
  --green-soft: rgba(59, 165, 92, 0.16);
  --yellow: #faa61a;
  --yellow-soft: rgba(250, 166, 26, 0.16);
  --red: #ed4245;
  --red-soft: rgba(237, 66, 69, 0.16);
  --radius: 12px;
  --font-sans: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px;
}

.avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.avatar, .avatar-fallback {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-fallback {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
}

.status-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.status-dot.online { background: var(--green); }
.status-dot.standalone { background: var(--yellow); }
.status-dot.offline { background: var(--muted); }

.brand-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

.guild-picker label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-btn.active {
  background: rgba(88, 101, 242, 0.2);
  color: #fff;
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}

.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-session {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 9px;
}

.login-gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.local-pill {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  padding: 8px 10px;
  border-radius: 8px;
  text-align: center;
}

/* Main Area */
.main {
  padding: 24px 28px 40px;
  max-width: 1440px;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.banner {
  background: var(--yellow-soft);
  border: 1px solid rgba(250, 166, 26, 0.35);
  color: #fde68a;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
}

.banner code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 5px;
  font-family: var(--font-mono);
}

/* Tabs */
.tab-panel {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.tab-panel.active {
  display: flex;
}

/* Cards & Grids */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 6px;
}

.stat-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.levels-layout {
  grid-template-columns: 1.45fr 1fr;
  align-items: start;
}

.customize-layout {
  grid-template-columns: 1.25fr 0.95fr;
  align-items: start;
}

.poster-preview-card {
  position: sticky;
  top: 20px;
}

.poster-preview-wrap {
  display: flex;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.poster-preview-img {
  width: 100%;
  max-width: 380px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
}

.bounty-text {
  color: #f5c84c;
  font-weight: 700;
  font-family: var(--font-mono);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
}

.pill.green { background: var(--green-soft); color: #86efac; }
.pill.yellow { background: var(--yellow-soft); color: #fde68a; }

/* Inputs & Buttons */
input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.search-input {
  max-width: 230px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
  color: #fff;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary { background: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface-3);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { background: #343b52; }

.btn-danger { background: var(--red); }
.btn-danger:hover:not(:disabled) { background: #c93235; }

.btn-sm {
  padding: 5px 9px;
  font-size: 12px;
}

/* Forms */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 110px;
}

.field.grow, .control-group.grow {
  flex: 1;
}

.field label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}

.toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* Channel multi-picker */
.channel-picker-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.channel-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.channel-picker-head label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.channel-picker-head code, .field-hint code {
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.field-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.link-btn {
  background: none;
  border: none;
  color: #a5b4fc;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.channel-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
  padding: 2px 0;
}

.ch-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ch-chip:hover {
  border-color: var(--accent);
}

.ch-chip.selected {
  background: rgba(88, 101, 242, 0.22);
  border-color: var(--accent);
  color: #fff;
}

.ch-chip input {
  margin: 0;
  accent-color: var(--accent);
}

.manual-channel-row {
  display: flex;
  gap: 6px;
}

.manual-channel-row input {
  padding: 6px 9px;
  font-size: 12px;
}

/* Key-value list */
.kv-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.kv-row:last-child {
  border-bottom: none;
}

.kv-row dt {
  color: var(--muted);
}

.kv-row dd {
  margin: 0;
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Tables */
.inline-add-user {
  display: grid;
  grid-template-columns: 1.5fr 1fr auto;
  gap: 8px;
  margin-bottom: 14px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th, .data-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.empty-cell {
  text-align: center !important;
  color: var(--muted);
  padding: 24px !important;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.user-avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  object-fit: cover;
  flex-shrink: 0;
}

.user-sub {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.progress-mini {
  width: 76px;
  height: 5px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-mini > span {
  display: block;
  height: 100%;
  background: var(--green);
}

.row-actions {
  display: flex;
  gap: 5px;
}

/* Rewards & Curve */
.reward-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reward-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.curve-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
}

.chip strong {
  color: #a5b4fc;
}

/* Music Player */
.now-playing {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.np-art {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.track-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.track-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-3);
}

.np-title {
  font-size: 17px;
  font-weight: 700;
}

.np-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
}

.control-group select {
  width: auto;
  padding: 5px 8px;
}

.control-group input[type="range"] {
  accent-color: var(--accent);
  min-width: 120px;
}

/* Commands Directory */
.commands-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.cmd-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a5b4fc;
  font-weight: 700;
  margin-bottom: 6px;
}

.cmd-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 11px;
  margin-bottom: 6px;
}

.cmd-name {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #fff;
}

.cmd-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* Console */
.console-card {
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}

.console-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.console-toolbar select {
  width: auto;
}

.console-output {
  flex: 1;
  background: #0a0c10;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-y: auto;
  max-height: 62vh;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-line {
  display: flex;
  gap: 10px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.log-time {
  color: #64748b;
  flex-shrink: 0;
}

.log-lvl {
  font-weight: 700;
  width: 44px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.log-lvl.info { color: #60a5fa; }
.log-lvl.warn { color: #fbbf24; }
.log-lvl.error { color: #f87171; }

.log-msg {
  color: #e2e8f0;
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 9px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  max-width: 340px;
}

.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }

/* Sidebar section separation (General vs Admin) */
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 6px 12px 2px;
  user-select: none;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 6px 4px;
}

/* Rotating presence list editor */
.presence-list-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.presence-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.presence-row select {
  width: 195px;
  flex-shrink: 0;
}

.presence-row input {
  flex: 1;
  min-width: 0;
}

/* Discord-style Bot Profile Preview */
.bot-profile-preview {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #111214;
}

.bpp-banner {
  height: 96px;
  background: linear-gradient(135deg, var(--accent), #1e1b4b);
  background-size: cover;
  background-position: center;
}

.bpp-body {
  padding: 0 16px 16px;
}

.bpp-top {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: -34px;
  margin-bottom: 10px;
}

.bpp-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 4px solid #111214;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}

.bpp-cloud {
  background: #232428;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 14px;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.bpp-name {
  font-weight: 700;
  font-size: 15px;
  color: #f3f4f6;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bpp-app-badge {
  background: #5865f2;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.bpp-bio {
  margin-top: 6px;
  font-size: 12.5px;
  color: #b5bac1;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

/* Clean Playlists Browser Grid */
.pl-toolbar {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.pl-create-bar {
  display: grid;
  grid-template-columns: 1fr 1.6fr auto;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.pl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}

.pl-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.pl-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.pl-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.pl-card.pinned {
  border-style: dashed;
  border-color: var(--accent);
}

.pl-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pl-cover {
  width: 52px;
  height: 52px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}

.pl-meta {
  min-width: 0;
  flex: 1;
}

.pl-title {
  font-weight: 700;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.pl-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Interactive One Piece World Map (Accurate 4-Quadrant op-maps.com Globe) */
.world-map-stage {
  position: relative;
  width: 100%;
  height: 560px;
  border-radius: 14px;
  border: 2px solid var(--border);
  overflow: hidden;
  background:
    radial-gradient(circle at 24% 18%, rgba(59, 130, 246, 0.14), transparent 38%),
    radial-gradient(circle at 76% 18%, rgba(250, 204, 21, 0.12), transparent 38%),
    radial-gradient(circle at 24% 82%, rgba(168, 85, 247, 0.12), transparent 38%),
    radial-gradient(circle at 76% 82%, rgba(251, 146, 60, 0.12), transparent 38%),
    linear-gradient(135deg, #061224 0%, #0b223f 50%, #061224 100%);
  user-select: none;
}

.wm-calm-belt {
  position: absolute;
  left: 0;
  right: 0;
  height: 6%;
  background: rgba(20, 184, 166, 0.1);
  border-top: 1px dashed rgba(45, 212, 191, 0.35);
  border-bottom: 1px dashed rgba(45, 212, 191, 0.35);
  color: rgba(94, 234, 212, 0.45);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.25em;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
}
.wm-calm-belt.top { top: 29%; }
.wm-calm-belt.bottom { top: 65%; }

.wm-grand-line-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 35%;
  height: 30%;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.09) 0%, rgba(56, 189, 248, 0.1) 47%, rgba(220, 38, 38, 0.1) 51%, rgba(168, 85, 247, 0.12) 100%);
  pointer-events: none;
  z-index: 1;
}

.wm-red-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18px;
  background: linear-gradient(90deg, #521010, #b91c1c, #490d0d);
  border-left: 1px solid rgba(248, 113, 113, 0.55);
  border-right: 1px solid rgba(248, 113, 113, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}
.wm-red-line span {
  writing-mode: vertical-rl;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.24em;
  color: rgba(254, 202, 202, 0.72);
}
.wm-red-line.center { left: calc(48% - 9px); }

.wm-quad-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
}
.wm-quad-label.gl {
  font-size: 11px;
  letter-spacing: 0.14em;
}

.wm-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px;
  transition: transform 0.14s ease;
}

.wm-pin:hover, .wm-pin.selected {
  transform: translate(-50%, -50%) scale(1.22);
  z-index: 14;
}

.wm-pin-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #0b1120;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.65);
}

.wm-pin.terr-pirate .wm-pin-dot {
  box-shadow: 0 0 0 2.5px #ef4444, 0 0 10px rgba(239, 68, 68, 0.7);
}
.wm-pin.terr-marine .wm-pin-dot {
  box-shadow: 0 0 0 2.5px #3b82f6, 0 0 10px rgba(59, 130, 246, 0.7);
}

.wm-pin.selected .wm-pin-dot {
  border-color: #ffffff;
  box-shadow: 0 0 14px #facc15;
}

.wm-pin-label {
  font-size: 9px;
  font-weight: 700;
  color: #e2e8f0;
  text-shadow: 0 1px 4px #000, 0 0 6px #000;
  white-space: nowrap;
}

.wm-pin-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
.wm-pin-badge.marine { background: #3b82f6; }

.npc-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.npc-chip img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

@media (max-width: 960px) {
  .pl-toolbar, .pl-create-bar {
    grid-template-columns: 1fr;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .two-col, .levels-layout {
    grid-template-columns: 1fr;
  }
}
