@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Orbitron:wght@600;700;900&display=swap');

:root {
  --bg-deep: #050b1a;
  --bg: #0a1428;
  --bg-grid: #11203b;
  --panel: rgba(13, 24, 47, 0.92);
  --panel-2: rgba(20, 36, 64, 0.85);
  --panel-3: #0f1d38;
  --text: #e2e8f0;
  --text-dim: #8da4c8;
  --border: rgba(56, 189, 248, 0.22);
  --border-strong: rgba(56, 189, 248, 0.6);
  --border-cyan: rgba(56, 189, 248, 0.45);
  --accent: #38bdf8;
  /* electric blue */
  --accent-cyan: #67e8f9;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --danger: #ef4444;
  --green: #22c55e;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: 'Rajdhani', system-ui, sans-serif;
  font-weight: 500;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(56, 189, 248, 0.06), transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(56, 189, 248, 0.05), transparent 55%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 100%);
  background-attachment: fixed;
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  letter-spacing: 0.2px;
}

/* ===== Header ===== */
header {
  position: relative;
  background:
    linear-gradient(180deg, #061226 0%, #0a1c3a 45%, #061226 100%);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.35);
  flex-wrap: wrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

header::before {
  /* Top neon edge accent */
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 30%, var(--accent) 70%, transparent 100%);
  box-shadow: 0 0 10px var(--accent);
}

header::after {
  /* Subtle bottom shine */
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.35), transparent);
}

header h1 {
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2.5px;
  font-style: italic;
  color: #fff;
  text-shadow:
    0 0 12px rgba(56, 189, 248, 0.7),
    0 2px 0 rgba(0, 0, 0, 0.8);
  text-transform: uppercase;
}

.modes {
  display: flex;
  gap: 6px;
}

.mode-btn {
  background: linear-gradient(180deg, rgba(20, 36, 64, 0.6), rgba(10, 20, 40, 0.6));
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mode-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.mode-btn.active {
  background: linear-gradient(180deg, var(--accent), #0284c7);
  color: #042037;
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.spacer {
  flex: 1;
}

/* ===== Form controls ===== */
select,
button,
input,
textarea {
  font-family: inherit;
  font-size: 13px;
}

select,
.small-btn,
input[type="text"],
input[type="number"] {
  background: var(--panel-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 9px;
  font-weight: 500;
  transition: border-color .15s, box-shadow .15s;
}

select:focus,
input:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.25);
}

.small-btn {
  cursor: pointer;
}

.small-btn:hover {
  border-color: var(--border-strong);
  background: var(--accent-soft);
}

button.primary {
  background: linear-gradient(180deg, var(--accent), #0284c7);
  color: #042037;
  border: none;
  padding: 9px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  width: 100%;
  margin-top: 6px;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

button.primary:hover:not(:disabled) {
  filter: brightness(1.15);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

button.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

button.danger {
  background: linear-gradient(180deg, var(--danger), #991b1b);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-size: 12px;
}

button.danger:hover {
  filter: brightness(1.15);
}

/* ===== Layout ===== */
main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

aside {
  position: relative;
  width: 340px;
  background:
    linear-gradient(180deg, #050d1f 0%, #0a1830 60%, #050d1f 100%);
  padding: 16px 14px;
  overflow-y: auto;
  border-right: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 4px 0 18px rgba(0, 0, 0, 0.5);
}

.right-panel {
  position: relative;
  width: 340px;
  background:
    linear-gradient(180deg, #050d1f 0%, #0a1830 60%, #050d1f 100%);
  padding: 16px 14px;
  overflow-y: auto;
  border-left: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: -4px 0 18px rgba(0, 0, 0, 0.5);
}

aside::before {
  /* Cyan top stripe like the in-game card */
  content: '';
  position: sticky;
  display: block;
  height: 3px;
  margin: -16px -14px 14px;
  background: linear-gradient(90deg, transparent, var(--accent) 20%, #67e8f9 50%, var(--accent) 80%, transparent);
  box-shadow: 0 0 12px var(--accent);
  z-index: 2;
}

aside::-webkit-scrollbar {
  width: 8px;
}

aside::-webkit-scrollbar-track {
  background: transparent;
}

aside::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 4px;
}

aside::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.55);
}

aside h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-style: italic;
  color: #fff;
  margin: 14px 0 10px;
  padding-bottom: 6px;
  text-shadow:
    0 0 12px rgba(56, 189, 248, 0.6),
    2px 2px 0 rgba(0, 0, 0, 0.6);
  position: relative;
}

aside h3::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
}

aside h3:first-child {
  margin-top: 0;
}

aside h4 {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent-cyan);
  margin: 10px 0 6px;
}

.canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(56, 189, 248, 0.04), transparent 60%),
    linear-gradient(180deg, #050b1a 0%, #0a1428 100%);
}

.canvas-wrap::before {
  /* faint hex-grid backdrop, subtly visible behind tiles */
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

#map {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  display: block;
  position: relative;
  /* Block text selection on the canvas so shift+drag (and any drag across
     tile coord labels) doesn't trigger a selection rectangle. */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  touch-action: none;
  z-index: 1;
}

#map.dragging {
  cursor: grabbing;
  will-change: transform;
}

/* ===== Footer ===== */
footer {
  background: linear-gradient(0deg, rgba(10, 20, 40, 0.95), rgba(10, 20, 40, 0.6));
  border-top: 1px solid var(--border);
  padding: 6px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-dim);
  gap: 10px;
}

.ad-slot {
  border: 1px dashed var(--border);
  padding: 4px 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 10px;
  letter-spacing: 0.5px;
}

/* ===== Stat rows — quest-slot style ===== */
.stat {
  position: relative;
  background:
    linear-gradient(180deg, #050d1f 0%, #081428 100%);
  padding: 9px 13px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-left: 3px solid rgba(56, 189, 248, 0.4);
  border-radius: 2px;
  /* Chamfered corners — top-left + bottom-right */
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: border-color .12s, transform .08s;
  font-weight: 500;
}

.stat:hover {
  border-left-color: var(--accent);
  transform: translateX(1px);
}

.stat .v {
  color: var(--accent);
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 14px;
  font-style: italic;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.55), 1px 1px 0 rgba(0, 0, 0, 0.6);
}

.sim-result {
  background: var(--panel-3);
  padding: 8px;
  border-radius: 4px;
  font-size: 11px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
}

.sim-result .step {
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}

.sim-result .step:last-child {
  border-bottom: none;
}

/* ===== Badges ===== */
.pro-badge {
  background: linear-gradient(180deg, #f59e0b, #d97706);
  color: #1e1b4b;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}

.locked-free-tier {
  opacity: 0.35 !important;
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' style='font-size:16px'><text y='18'>💵</text></svg>") 10 10, pointer !important;
}

.notice {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-left: 3px solid var(--accent);
  color: #bae6fd;
  padding: 9px 10px;
  border-radius: 4px;
  font-size: 12px;
  margin: 6px 0;
  line-height: 1.4;
}

label {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 8px 0 3px;
}

input[type="number"],
input[type="text"] {
  width: 100%;
}

.tile-details {
  background: var(--panel-3);
  border: 1px solid var(--border);
  padding: 9px;
  border-radius: 4px;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
}

.tile-details b {
  color: var(--accent);
}

.help {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
  line-height: 1.5;
  font-style: italic;
}

.legend {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 10px;
}

.legend span {
  padding: 2px 6px;
  border-radius: 3px;
  color: #000;
  font-weight: 600;
}

/* ===== Radial picker ===== */
.radial-picker {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  width: 0;
  height: 0;
}

.radial-btn {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(20, 36, 64, 0.95), rgba(10, 20, 40, 0.95));
  color: var(--text);
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3), 0 4px 12px rgba(0, 0, 0, 0.6);
  transition: all .15s;
}

.radial-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.7), 0 4px 12px rgba(0, 0, 0, 0.6);
  transform: scale(1.05);
}

.radial-btn.sel {
  background: linear-gradient(180deg, var(--accent), #0284c7);
  color: #042037;
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.8);
}

.radial-close {
  position: absolute;
  pointer-events: auto;
  background: linear-gradient(180deg, var(--danger), #991b1b);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

/* ===== Pills + status ===== */
.event-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  padding: 4px 10px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.event-info b {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

#submit-edits {
  background: linear-gradient(180deg, var(--accent), #0284c7);
  color: #042037;
  border: none;
  padding: 7px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

#submit-edits:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

#submit-edits .badge {
  background: #042037;
  color: var(--accent);
  padding: 0 7px;
  border-radius: 8px;
  margin-left: 5px;
  font-size: 11px;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 3px;
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.status-pill[data-state="online"] {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
}

.status-pill[data-state="offline"] {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.status-pill[data-state="local"] {
  background: rgba(141, 164, 200, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(141, 164, 200, 0.4);
}

.header-energy-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.energy-pill {
  cursor: default;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-size: 18px;
  padding: 6px 16px;
  border-radius: 6px;
}

.header-energy-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 220px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(56, 189, 248, 0.1);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.header-energy-wrap:hover .header-energy-dropdown {
  opacity: 1;
  transform: translateX(-50%) translateY(8px);
}

.header-energy-dropdown .stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  color: var(--text-dim);
}

.header-energy-dropdown .stat .v {
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
}

#user-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: linear-gradient(180deg, var(--bg-deep), var(--bg));
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 26px;
  min-width: 340px;
  max-width: 420px;
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.2), 0 20px 60px rgba(0, 0, 0, 0.7);
  position: relative;
}

.modal-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), transparent 50%);
  pointer-events: none;
}

.modal-card h3 {
  margin: 0 0 8px;
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  letter-spacing: 1.2px;
  color: var(--accent);
  text-transform: uppercase;
}

.modal-card .muted {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 16px;
}

.modal-card input[type="email"] {
  width: 100%;
  box-sizing: border-box;
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 10px;
}

.modal-card input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.modal-card button#auth-submit {
  width: 100%;
  background: linear-gradient(180deg, var(--accent), #0284c7);
  color: #042037;
  border: none;
  padding: 9px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.modal-card button#auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.modal-card .auth-google {
  width: 100%;
  margin-top: 8px;
}

.modal-card .modal-close {
  width: 100%;
  margin-top: 12px;
}

#auth-msg {
  font-size: 12px;
  min-height: 1em;
  margin: 8px 0 0;
}

#auth-msg.error {
  color: #f87171;
}

#auth-msg.success {
  color: #4ade80;
}

/* ===== Settings modal ===== */
.settings-card {
  min-width: 520px;
  max-width: 720px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}
.settings-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 4px 0 14px;
}
.settings-tab {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--text-dim);
  padding: 6px 14px;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 4px 4px 0 0;
}
.settings-tab.active {
  color: var(--accent);
  border-color: var(--border-strong);
  background: var(--panel-3);
}
.settings-body {
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
}
.settings-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  align-items: center;
}
.settings-row label {
  color: var(--text-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.settings-row input,
.settings-row select {
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 9px;
  border-radius: 4px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}
.settings-row input:focus,
.settings-row select:focus {
  outline: none;
  border-color: var(--accent);
}
.event-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.event-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.18);
}
.event-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.event-card-head .badge-active {
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.5);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
}
.event-card-head .spacer { flex: 1; }
.holo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.holo-grid .settings-row {
  grid-template-columns: 80px 1fr;
}
.event-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.event-add-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  margin-bottom: 4px;
}
.event-add-row .muted {
  font-size: 11px;
  color: var(--text-dim);
}
.event-collapsed {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.25);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-dim);
  transition: background 120ms ease, border-color 120ms ease;
}
.event-collapsed:hover {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.4);
}
.event-collapsed.active {
  border-color: var(--accent);
}
.event-collapsed-id {
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text);
}
.event-collapsed-date,
.event-collapsed-layout {
  flex: 0 0 auto;
}
.event-collapsed-layout {
  margin-left: auto;
  font-family: monospace;
  color: var(--text);
}
.event-collapsed .badge-active {
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.5);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
}
.layout-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.4);
}
.layout-row .name {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  letter-spacing: 0.6px;
  color: var(--text);
  flex: 1;
}
.layout-row .meta {
  color: var(--text-dim);
  font-size: 11px;
  margin-right: 8px;
}
.layout-save {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}
.layout-save input {
  flex: 1;
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 9px;
  border-radius: 4px;
  font-size: 13px;
}
.danger-btn {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.55);
  color: #fca5a5;
}
.danger-btn:hover { background: rgba(220, 38, 38, 0.28); }

/* ===== Contribute modal ===== */
.contribute-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 14px 0 8px;
  padding: 11px 14px;
  background: linear-gradient(180deg, #f96854, #d65643);
  color: #fff;
  border: none;
  border-radius: 4px;
  text-align: center;
  text-decoration: none;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 0 12px rgba(249, 104, 84, 0.35);
  cursor: pointer;
}
.contribute-btn:hover {
  background: linear-gradient(180deg, #ff7866, #e26450);
}

/* ===== Cooldown ===== */
.cooldown-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.5);
  padding: 3px 9px;
  border-radius: 4px;
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.25);
}

.cooldown-pill::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: cooldown-pulse 1s ease-in-out infinite;
  box-shadow: 0 0 6px var(--accent);
}

@keyframes cooldown-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* ===== Tile HUD (review mode) ===== */
.tile-hud {
  position: absolute;
  pointer-events: auto;
  z-index: 9;
  background: linear-gradient(180deg, rgba(13, 24, 47, 0.97), rgba(10, 20, 40, 0.97));
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 9px 11px;
  font-size: 12px;
  color: var(--text);
  min-width: 200px;
  max-width: 260px;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.2), 0 6px 16px rgba(0, 0, 0, 0.6);
  transform: translate(12px, -50%);
}

.tile-hud .row {
  margin: 3px 0;
}

.tile-hud .row b {
  color: var(--accent);
}

.tile-hud h4 {
  margin: 0 0 6px;
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 1.2px;
  color: var(--accent);
  text-transform: uppercase;
}

.tile-hud .hud-close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}

.tile-hud .hud-close:hover {
  color: var(--accent);
}

.tile-hud .variant {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 7px;
  margin: 5px 0;
  background: var(--panel-3);
}

.tile-hud .variant.disabled {
  opacity: 0.4;
}

.tile-hud .variant.dominant {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.25);
}

.tile-hud .variant .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.tile-hud .variant .users {
  color: var(--text-dim);
  font-size: 10px;
  margin-top: 2px;
}

.tile-hud .variant .users .voter-names {
  color: var(--text);
  font-style: italic;
}

.tile-hud .variant button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 3px 7px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
}

.tile-hud .variant button.apply {
  background: linear-gradient(180deg, var(--accent), #0284c7);
  color: #042037;
  border: none;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
}

.tile-hud .variant button.reject {
  background: linear-gradient(180deg, #dc2626, #991b1b);
  color: #fff;
  border: none;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.35);
}

.tile-hud .variant .diff {
  margin-top: 6px;
  font-size: 11px;
  border-top: 1px dashed var(--border);
  padding-top: 5px;
}

.tile-hud .variant .diff .diff-head {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
  padding: 0 2px;
}

.tile-hud .variant .diff .diff-row {
  display: grid;
  grid-template-columns: 70px 1fr 12px 1fr;
  gap: 4px;
  align-items: center;
  padding: 1px 2px;
  border-radius: 3px;
}

.tile-hud .variant .diff .diff-row.changed {
  background: rgba(56, 189, 248, 0.10);
}

.tile-hud .variant .diff .diff-row.added {
  background: rgba(74, 222, 128, 0.12);
}

.tile-hud .variant .diff .diff-row.removed {
  background: rgba(248, 113, 113, 0.12);
}

.tile-hud .variant .diff .diff-row.same {
  opacity: 0.55;
}

.tile-hud .variant .diff .kk {
  color: var(--text-dim);
  font-size: 10px;
}

.tile-hud .variant .diff .ko {
  color: #f87171;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-hud .variant .diff .kn {
  color: #4ade80;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-hud .variant .diff .diff-row.same .ko,
.tile-hud .variant .diff .diff-row.same .kn {
  color: var(--text-dim);
}

.tile-hud .variant .diff .arr {
  color: var(--text-dim);
  text-align: center;
}

.tile-hud .variant button:hover:not(:disabled) {
  filter: brightness(1.15);
}

/* ===== Targets list scrollbar ===== */
.targets-list {
  max-height: 200px;
  overflow-y: auto;
}

.targets-list::-webkit-scrollbar {
  width: 6px;
}

.targets-list::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.35);
  border-radius: 3px;
}

/* ===== Status tags (legacy) ===== */
.status-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.status-tag.approved {
  background: var(--green);
  color: #fff;
}

.status-tag.pending {
  background: var(--accent);
  color: #042037;
}

.status-tag.draft {
  background: var(--accent-cyan);
  color: #0f172a;
}

code {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 11px;
}

details summary {
  outline: none;
  padding: 4px 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

details summary:hover {
  color: var(--accent);
}

/* ===== Quest preset grid ===== */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 6px;
}

/* Portrait card buttons with icon above label */
.preset-grid .grid-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  aspect-ratio: 4 / 5;
  padding: 6px 4px;
  font-size: 11px;
  line-height: 1.1;
}

.preset-grid .grid-btn img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.6));
}

.preset-grid .grid-btn .emoji-icon {
  font-size: 28px;
  line-height: 1;
}

.grid-btn,
aside button:not(.primary):not(.danger):not(.small-btn):not(.grid-btn):not([data-rm-target]) {
  background: linear-gradient(180deg, #0a1830, #061226);
  color: var(--text);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-left: 2px solid var(--accent);
  padding: 7px 10px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter .12s, transform .08s;
  /* Same chamfer as primary buttons + .stat slots */
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.grid-btn:hover:not(:disabled),
aside button:not(.primary):not(.danger):not(.small-btn):not(.grid-btn):not([data-rm-target]):hover:not(:disabled) {
  filter: brightness(1.25);
  transform: translateY(-1px);
}

.grid-btn.primary {
  background: linear-gradient(180deg, var(--accent), #0284c7);
  color: #042037;
  /* Keep border + padding identical to inactive .grid-btn so size never shifts.
     Just paint the border transparent in the active state. */
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  padding: 7px 10px;
  font-size: 12px;
  letter-spacing: 0.6px;
  width: auto;
  margin-top: 0;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Disabled toggles keep their chamfered shape, just visually muted. */
button:disabled,
.grid-btn:disabled,
button.primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.5);
  /* shape stays — clip-path inherits */
}

button:disabled:hover,
.grid-btn:disabled:hover {
  filter: grayscale(0.5);
  transform: none;
}

/* Pin sidebar toggle/preset buttons to the same metrics in both states so
   the active/inactive switch never shifts box size. The catch-all rule
   (line ~577) sets the inactive baseline; this re-asserts the same values
   on .primary so both render identically except for color. */
aside button {
  padding: 7px 10px !important;
  font-size: 12px !important;
  letter-spacing: 0.6px !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  border-left: 2px solid var(--accent) !important;
}

aside button.primary {
  /* keep border footprint identical, just paint it transparent */
  border-color: transparent !important;
  border-left-color: transparent !important;
}

aside button.danger,
aside button.small-btn,
aside button[data-rm-target] {
  /* danger / small / target-remove keep their own size rules — opt out of the override */
  padding: revert !important;
  font-size: revert !important;
  letter-spacing: revert !important;
  border: revert !important;
  border-left: revert !important;
}

/* Lock single-line text on sidebar toggles so adding/removing a checkmark
   never wraps the label to two lines (which changes box height). */
aside button {
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
}