:root {
  color-scheme: dark;
  --bg: #101319;
  --surface: #171c24;
  --surface-2: #202732;
  --line: #343d4a;
  --muted: #96a1b3;
  --text: #f5f7fb;
  --teal: #1db8a6;
  --amber: #f2b84b;
  --rose: #ed6a82;
  --blue: #6aa8ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.topbar {
  height: 72px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 19, 25, 0.92);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark,
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--teal), var(--amber));
  color: #091015;
  font-weight: 900;
}

.brand h1,
.brand p,
.panel-head h2,
.spot-card h3 {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.1;
}

.brand p {
  color: var(--muted);
  font-size: 13px;
}

.auth-panel,
.user-panel,
.map-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-panel {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auth-status {
  width: 100%;
  margin: 0;
  color: var(--amber);
  font-size: 12px;
  text-align: right;
}

.provider,
.primary-button,
.ghost-button,
.icon-button,
.segmented button,
.vote-row button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface-2);
  border-radius: 8px;
  min-height: 38px;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.provider,
.primary-button,
.ghost-button,
.segmented button {
  padding: 0 14px;
}

.provider:hover,
.primary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.segmented button:hover,
.vote-row button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.36);
}

.provider-google {
  background: #f5f7fb;
  color: #161a22;
}

.provider-discord {
  background: #5865f2;
  border-color: #7280ff;
}

.primary-button {
  background: var(--teal);
  border-color: var(--teal);
  color: #061213;
  font-weight: 800;
}

.ghost-button {
  background: transparent;
}

.ghost-button.danger {
  color: #ff9cab;
  border-color: rgba(237, 106, 130, 0.5);
  margin-right: auto;
}

.icon-button,
.vote-row button {
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
}

.user-copy {
  display: grid;
  line-height: 1.15;
}

.user-copy span {
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 30vw, 390px);
  min-height: 0;
  height: 100%;
  transition: grid-template-columns 180ms ease;
}

.workspace.panel-collapsed {
  grid-template-columns: minmax(0, 1fr) 52px;
}

.map-column {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.map-toolbar {
  min-height: 58px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #121720;
}

.segmented {
  display: flex;
  padding: 4px;
  background: #0c1017;
  border: 1px solid var(--line);
  border-radius: 10px;
  gap: 4px;
}

.segmented button {
  min-height: 32px;
  background: transparent;
  border-color: transparent;
}

.segmented button.active {
  background: var(--surface-2);
  border-color: var(--line);
}

.zoom-readout {
  width: 54px;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.map-frame {
  overflow: auto;
  min-height: 0;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%),
    #0a0d12;
  background-size: 32px 32px;
  position: relative;
  overscroll-behavior: contain;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.map-frame.dragging {
  cursor: grabbing;
}

.add-cursor {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 4px;
  background: var(--amber);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -100%) rotate(-45deg) scale(0.9);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
  z-index: 6;
}

.add-cursor.visible {
  opacity: 0.92;
  transform: translate(-50%, -100%) rotate(-45deg) scale(1);
}

.add-cursor span {
  color: #17100a;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  transform: rotate(45deg);
}

.map-stage {
  position: relative;
  width: 3140px;
  height: 3869px;
  transform-origin: top left;
}

.map-image {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
}

.marker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.marker {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  padding: 0;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  z-index: 2;
  cursor: pointer;
}

.marker-dot {
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 50% 4px;
  border: 2px solid #fff;
  background: var(--teal);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
  transform: rotate(-45deg);
}

.marker-dot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #081014;
  position: absolute;
  inset: 0;
  margin: auto;
}

.marker.private .marker-dot {
  background: var(--rose);
}

.marker.active {
  z-index: 4;
}

.marker.active .marker-dot {
  background: var(--amber);
}

.marker-preview {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  width: 176px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(17, 23, 32, 0.96);
  box-shadow: var(--shadow);
  padding: 8px;
  display: grid;
  gap: 6px;
  color: var(--text);
  text-align: left;
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.marker-preview::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.24);
  border-bottom: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(17, 23, 32, 0.96);
  transform: translateX(-50%) rotate(45deg);
}

.marker:hover,
.marker:focus-visible {
  z-index: 5;
}

.marker:hover .marker-preview,
.marker:focus-visible .marker-preview {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.marker-preview img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  background: #0b0f15;
}

.marker-preview strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.marker-preview small {
  color: var(--muted);
  font-size: 11px;
}

.spot-panel {
  min-width: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-height: 0;
  overflow: hidden;
}

.panel-head {
  min-height: 88px;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spot-panel.collapsed {
  grid-template-rows: auto;
}

.spot-panel.collapsed .panel-head {
  min-height: auto;
  height: 100%;
  padding: 10px 6px;
  align-items: start;
  justify-content: center;
}

.spot-panel.collapsed .panel-head > div:first-child,
.spot-panel.collapsed .spot-count,
.spot-panel.collapsed .search-wrap,
.spot-panel.collapsed .spot-list {
  display: none;
}

.spot-panel.collapsed .panel-actions {
  width: 100%;
  justify-content: center;
}

.eyebrow {
  display: block;
  color: var(--amber);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

.panel-head h2 {
  font-size: 24px;
}

.spot-count {
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #0d1118;
  color: var(--muted);
}

.search-wrap {
  padding: 0 18px 14px;
}

.search-wrap input,
.spot-form input[type="text"],
.spot-form select,
.spot-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1118;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

.search-wrap input:focus,
.spot-form input:focus,
.spot-form select:focus,
.spot-form textarea:focus {
  border-color: var(--teal);
}

.spot-list {
  overflow: auto;
  padding: 0 18px 18px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.empty-state {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  line-height: 1.45;
}

.spot-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111720;
  overflow: hidden;
}

.spot-card-main {
  width: 100%;
  padding: 0;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
}

.spot-thumb {
  width: 96px;
  height: 108px;
  object-fit: cover;
  background: #0b0f15;
}

.spot-text {
  min-width: 0;
  padding: 12px;
}

.spot-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.spot-card h3 {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visibility {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 3px 8px;
  font-size: 11px;
  flex: 0 0 auto;
}

.spot-card p {
  margin: 7px 0 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.spot-meta {
  color: var(--blue);
  font-size: 12px;
}

.vote-row {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  padding: 8px;
  gap: 8px;
}

.vote-row span {
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.vote-row button.active {
  background: var(--amber);
  border-color: var(--amber);
  color: #17100a;
}

.vote-row button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
  transform: none;
}

.spot-dialog {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 0;
}

.spot-dialog::backdrop {
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(5px);
}

.spot-form {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.dialog-head h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.spot-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.spot-form textarea {
  resize: vertical;
}

.upload-box {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
}

.preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.switch-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.switch-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--teal);
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 38vw);
  }

  .workspace.panel-collapsed {
    grid-template-columns: minmax(0, 1fr) 52px;
  }
}

@media (max-width: 700px) {
  .topbar {
    height: auto;
    min-height: 72px;
    flex-wrap: wrap;
    gap: 10px;
    padding-block: 12px;
  }

  .auth-panel,
  .user-panel {
    width: 100%;
    justify-content: flex-start;
  }

  .map-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 42vw);
  }

  .segmented {
    overflow-x: auto;
  }

  .spot-card-main {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .spot-thumb {
    width: 82px;
  }
}
