:root {
  --bg-color: #81c784;
  --text-primary: #1f2937;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --accent: #2563eb;
}

body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: "Outfit", sans-serif;
  color: var(--text-primary);
  user-select: none;
  -webkit-user-select: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  cursor: grab;
}

canvas:active {
  cursor: grabbing;
}

/* UI Layer */
#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none; /* Let clicks pass through to canvas */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem;
  box-sizing: border-box;
}

header {
  pointer-events: auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

h1 {
  font-size: 3rem;
  font-weight: 800;
  margin: 0;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  color: #fff;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.1);
}

.badge {
  background: #fbbf24;
  color: #78350f;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 800;
  transform: rotate(-5deg);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.subtitle {
  margin: 0;
  color: #f0fdf4;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  font-size: 1.1rem;
}

.controls-hint {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  padding: 1rem;
  border-radius: 12px;
  align-self: flex-start; /* Left align */
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.hint-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
}

/* Clean HUD */
.hud-header {
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

#city-title {
    font-size: 1.5rem;
    color: #fff;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.5px;
    opacity: 0.9;
}

.hud-footer {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    pointer-events: none;
}

.hud-footer a {
    pointer-events: auto;
    text-decoration: none;
}

#city-badge {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Loading Screen */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #81c784;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease-out;
}

#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-content {
  text-align: center;
  color: white;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Mobile Tweaks */
@media (max-width: 600px) {
  #ui-layer {
    padding: 1rem;
  }
  h1 {
    font-size: 2rem;
  }
  .controls-hint {
    display: none; /* Hide hints on mobile to save space, or simplify */
  }
}

/* City Directory & Search */
.interactive-panel {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 300px;
    z-index: 100;
    pointer-events: auto;
    font-family: "Outfit", sans-serif;
}

.search-box {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: transform 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
    border-color: var(--accent);
}

.search-icon {
    font-size: 1.2rem;
    opacity: 0.6;
}

#search-input {
    border: none;
    background: transparent;
    font-size: 1rem;
    width: 100%;
    outline: none;
    color: var(--text-primary);
    font-weight: 600;
}

#search-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.results-list {
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: slideDown 0.2s ease-out;
}

.results-list.hidden {
    display: none;
}

.result-item {
    padding: 0.8rem 1rem;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.1s;
}

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

.result-item:hover {
    background: rgba(37, 99, 235, 0.1);
}

.result-name {
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.result-meta {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.2rem;
}

.ghost-tag {
    background: #e5e7eb;
    color: #4b5563;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Scrollbar Polish */
.results-list::-webkit-scrollbar {
    width: 6px;
}
.results-list::-webkit-scrollbar-track {
    background: transparent;
}
.results-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    .interactive-panel {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        width: auto;
    }
}
