/* Thành phố Lumiere — pastel isometric city UI */
:root {
  --city-bg: #f3e8ff;
  --city-panel: rgba(255, 255, 255, 0.92);
  --city-accent: #a78bfa;
  --city-pink: #f9a8d4;
  --city-ink: #4c1d95;
}
[data-theme="dark"] {
  --city-bg: #1e1033;
  --city-panel: rgba(30, 20, 50, 0.94);
  --city-ink: #ede9fe;
}

.city-page { background: linear-gradient(160deg, #fce7f3, #ede9fe 40%, #e0f2fe); min-height: 100vh; }
[data-theme="dark"] .city-page { background: linear-gradient(160deg, #1e1033, #2e1065 50%, #0f172a); }

.city-shell {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  height: calc(100vh - var(--header-h, 60px));
  max-height: calc(100vh - var(--header-h, 60px));
  overflow: hidden;
}

.city-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--city-panel);
  border-bottom: 1px solid rgba(167, 139, 250, 0.35);
  z-index: 20;
  flex-wrap: wrap;
}
.city-hud-left, .city-hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.city-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--city-accent);
  background: #ddd6fe;
}
.city-stat {
  display: flex; flex-direction: column; font-size: 0.78rem; color: var(--city-ink);
}
.city-stat strong { font-size: 0.95rem; }
.city-badge {
  background: linear-gradient(135deg, #c4b5fd, #f9a8d4);
  color: #4c1d95;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

.city-map-wrap {
  position: relative;
  overflow: hidden;
  touch-action: none;
  background:
    radial-gradient(circle at 20% 30%, rgba(249, 168, 212, 0.25), transparent 40%),
    radial-gradient(circle at 80% 60%, rgba(167, 139, 250, 0.2), transparent 45%),
    #c4b5fd33;
}
.city-map {
  position: absolute;
  width: 1200px;
  height: 900px;
  left: 50%;
  top: 40%;
  transform-origin: center center;
  cursor: grab;
  user-select: none;
}
.city-map.dragging { cursor: grabbing; }

/* Isometric-ish ground */
.city-ground {
  position: absolute;
  inset: 80px 60px 60px;
  background: linear-gradient(145deg, #bbf7d0 0%, #86efac 40%, #a7f3d0 100%);
  border-radius: 40% 45% 40% 45%;
  box-shadow: 0 20px 40px rgba(76, 29, 149, 0.15);
  transform: rotateX(0deg);
}

.city-zone {
  position: absolute;
  width: 160px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s;
  z-index: 2;
}
.city-zone:hover, .city-zone.active { transform: scale(1.06); z-index: 3; }
.city-zone-icon {
  width: 88px; height: 72px;
  margin: 0 auto 6px;
  border-radius: 18px 18px 22px 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  box-shadow: 0 8px 16px rgba(0,0,0,0.12);
  border: 3px solid #fff;
}
.city-zone[data-zone="park"] .city-zone-icon { background: linear-gradient(160deg, #86efac, #4ade80); }
.city-zone[data-zone="market"] .city-zone-icon { background: linear-gradient(160deg, #fde68a, #fbbf24); }
.city-zone[data-zone="residential"] .city-zone-icon { background: linear-gradient(160deg, #fda4af, #fb7185); }
.city-zone[data-zone="arcade"] .city-zone-icon { background: linear-gradient(160deg, #c4b5fd, #8b5cf6); }
.city-zone[data-zone="bakery"] .city-zone-icon { background: linear-gradient(160deg, #fdba74, #f97316); }
.city-zone-label {
  display: inline-block;
  background: #fff;
  color: #5b21b6;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Positions on map */
.city-zone[data-zone="park"] { left: 48%; top: 42%; }
.city-zone[data-zone="market"] { left: 22%; top: 28%; }
.city-zone[data-zone="residential"] { left: 68%; top: 24%; }
.city-zone[data-zone="arcade"] { left: 72%; top: 58%; }
.city-zone[data-zone="bakery"] { left: 28%; top: 60%; }

/* Player avatars on map */
.city-player {
  position: absolute;
  width: 36px; height: 36px;
  margin-left: -18px; margin-top: -36px;
  z-index: 5;
  transition: left 0.35s ease, top 0.35s ease;
  pointer-events: none;
}
.city-player img, .city-player .chibi {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  object-fit: cover;
  background: #ddd6fe;
}
.city-player.me { z-index: 6; }
.city-player.me img, .city-player.me .chibi { border-color: #a78bfa; box-shadow: 0 0 0 2px #f9a8d4; }
.city-player-name {
  position: absolute;
  left: 50%; top: 100%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.65rem;
  background: rgba(255,255,255,0.9);
  color: #4c1d95;
  padding: 1px 6px;
  border-radius: 6px;
  margin-top: 2px;
}

.city-dock {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  background: var(--city-panel);
  border-top: 1px solid rgba(167, 139, 250, 0.3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.city-dock button {
  flex-shrink: 0;
  border: none;
  background: #ede9fe;
  color: #5b21b6;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.city-dock button.active, .city-dock button:hover {
  background: linear-gradient(135deg, #a78bfa, #f9a8d4);
  color: #fff;
}

.city-panel {
  position: absolute;
  right: 10px;
  top: 60px;
  width: min(320px, calc(100vw - 20px));
  max-height: calc(100% - 80px);
  background: var(--city-panel);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(76, 29, 149, 0.18);
  z-index: 15;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(167, 139, 250, 0.35);
}
.city-panel.open { display: flex; }
.city-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  font-weight: 700;
  color: var(--city-ink);
  border-bottom: 1px solid rgba(167,139,250,0.25);
}
.city-panel-body {
  padding: 12px 14px;
  overflow-y: auto;
  flex: 1;
  font-size: 0.9rem;
  color: var(--city-ink);
}
.city-panel-body .row {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  align-items: center;
}
.city-chat-log {
  max-height: 180px; overflow-y: auto;
  background: rgba(237, 233, 254, 0.5);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.city-chat-log div { margin-bottom: 6px; }
.city-chat-form { display: flex; gap: 6px; }
.city-chat-form input {
  flex: 1; min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #c4b5fd;
  background: #fff;
  color: #4c1d95;
}

.online-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e; display: inline-block; margin-right: 6px;
}

@media (max-width: 640px) {
  .city-panel {
    left: 8px; right: 8px; width: auto;
    top: auto; bottom: 56px;
    max-height: 45%;
  }
  .city-zone { width: 120px; }
  .city-zone-icon { width: 64px; height: 54px; font-size: 1.5rem; }
}

/* Boot screen — never pure white empty */
.city-boot {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #fce7f3, #ede9fe 50%, #e0f2fe);
  padding: 20px;
}
.city-boot-card {
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 40px rgba(124, 58, 237, 0.15);
}
.city-boot-logo { font-size: 1.4rem; font-weight: 800; color: #6d28d9; margin-bottom: 12px; }
.city-boot-status { font-weight: 600; color: #4c1d95; }
.city-boot-detail { font-size: 0.85rem; color: #6b7280; margin-top: 8px; line-height: 1.4; }

/* Character wizard */
.char-wizard {
  position: fixed;
  inset: 0;
  z-index: 280;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(76, 29, 149, 0.35);
  padding: 12px;
  overflow-y: auto;
}
.char-wizard-card {
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  max-width: 480px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.char-wizard-card h2 { margin: 0 0 12px; color: #6d28d9; }
.char-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.char-steps span {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3e8ff;
  color: #7c3aed;
}
.char-steps span.active { background: #7c3aed; color: #fff; font-weight: 700; }
.wiz-panel { display: none; }
.wiz-panel.active { display: block; }
.wiz-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.wiz-choice {
  border: 1.5px solid #e9d5ff;
  background: #faf5ff;
  color: #5b21b6;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.9rem;
}
.wiz-choice.active {
  background: linear-gradient(135deg, #a78bfa, #f9a8d4);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}
.chibi-preview {
  font-size: 4rem;
  text-align: center;
  margin: 12px 0;
  line-height: 1;
}

.city-river {
  position: absolute;
  left: 10%;
  top: 35%;
  width: 80%;
  height: 40px;
  background: linear-gradient(90deg, #7dd3fc, #38bdf8, #67e8f9);
  border-radius: 50%;
  opacity: 0.55;
  transform: rotate(-8deg);
  z-index: 1;
}
.city-side-card {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 200px;
  background: rgba(255,255,255,0.92);
  border-radius: 16px;
  padding: 14px;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(124,58,237,0.12);
  font-size: 0.85rem;
  color: #4c1d95;
}
.city-side-card h3 { margin: 0 0 6px; font-size: 1rem; }
.city-side-list { margin: 8px 0 0; padding-left: 0; list-style: none; }
.city-side-list li { padding: 4px 0; }
.hud-chibi { font-size: 1.8rem; line-height: 1; }
.city-avatar-wrap {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c4b5fd, #f9a8d4);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.city-player .chibi {
  display: flex;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  font-size: 1.6rem;
  background: linear-gradient(135deg, #ddd6fe, #fbcfe8);
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
@media (max-width: 640px) {
  .city-side-card { display: none; }
}
