/* Haunted Street - Cute Spooky Cartoon Aesthetic */
:root {
  --bg-dark: #0d0819;
  --bg-surface: #191228;
  --bg-card: #241a38;
  --bg-card-hover: #2e2246;
  --border-color: #3b2c58;
  --orange-primary: #ff7a00;
  --orange-glow: #ffa500;
  --purple-accent: #9d4edd;
  --green-slime: #00e676;
  --green-glow: rgba(0, 230, 118, 0.4);
  --red-blood: #ff1744;
  --text-main: #f8f9fa;
  --text-muted: #b3a4c8;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-fun: 'Fredoka', 'Comic Neue', cursive, var(--font-main);
  --shadow-glow: 0 0 15px rgba(255, 122, 0, 0.35);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
  height: 100vh;
  position: relative;
  overflow: hidden;
  background-image: 
    radial-gradient(circle at 50% 10%, #2a154d 0%, transparent 60%),
    radial-gradient(circle at 90% 80%, #1f0f35 0%, transparent 50%),
    radial-gradient(circle at 10% 90%, #170b28 0%, transparent 50%);
}

/* Background Animated Fog */
.fog-layer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 200%;
  height: 180px;
  background: linear-gradient(to top, rgba(157, 78, 221, 0.12), transparent);
  pointer-events: none;
  z-index: 1;
  animation: fogDrift 25s ease-in-out infinite alternate;
}

@keyframes fogDrift {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Header & Tickers */
.app-header {
  position: relative;
  z-index: 100;
  background: rgba(13, 8, 25, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--border-color);
  padding: 8px 16px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.logo-icon {
  font-size: 26px;
  animation: floatPumpkin 3s ease-in-out infinite;
}

@keyframes floatPumpkin {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-4px) rotate(3deg); }
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--orange-primary);
  text-shadow: 0 0 10px rgba(255, 122, 0, 0.5);
  letter-spacing: 0.5px;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.12s ease;
}

.stat-pill.bounce {
  transform: scale(1.18);
  border-color: #ffd54f !important;
}

.stat-pill.candy {
  border-color: rgba(255, 122, 0, 0.4);
  color: #ffb049;
}

.stat-pill.mischief {
  border-color: rgba(157, 78, 221, 0.4);
  color: #d199ff;
}

/* Event Ticker / Countdown Banner */
.event-banner {
  background: linear-gradient(90deg, #35145f, #5b1b74);
  border-bottom: 1px solid var(--purple-accent);
  padding: 6px 12px;
  font-size: 0.85rem;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  font-weight: 600;
}

.event-banner.blood-moon {
  background: linear-gradient(90deg, #8a0c24, #b71c1c);
  border-color: #ff5252;
  animation: bloodMoonPulse 2s infinite alternate;
}

@keyframes bloodMoonPulse {
  0% { box-shadow: inset 0 0 10px #ff1744; }
  100% { box-shadow: inset 0 0 25px #ff5252; }
}

.countdown-box {
  background: rgba(0, 0, 0, 0.4);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: monospace;
  font-weight: 700;
  color: #ffd54f;
}

/* Navigation Tabs */
.nav-bar {
  display: flex;
  gap: 8px;
  max-width: 1200px;
  margin: 8px auto 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-bar::-webkit-scrollbar { display: none; }

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  color: #fff;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* --- MAIN MAP AREA (Landgrab Map Screen) --- */
.main-map-area {
  position: relative;
  width: 100%;
  height: calc(100vh - 105px);
  overflow: hidden;
}

/* Onboarding banner for players choosing a plot */
.onboarding-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #ff7a00, #9d4edd);
  color: #fff;
  padding: 8px 20px;
  border-radius: 24px;
  font-size: 0.88rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  z-index: 60;
  pointer-events: none;
  animation: bounceNotice 2.5s infinite;
  text-align: center;
  max-width: 90%;
}

@keyframes bounceNotice {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -5px); }
}

/* Pannable & Zoomable Viewport */
.map-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  background: #090514;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
  background-image: 
    radial-gradient(#1e1333 1px, transparent 1px),
    radial-gradient(#150c24 1px, #090514 1px);
  background-size: 30px 30px;
}

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

/* Spooky Neighbourhood Map Surface */
.map-world {
  position: absolute;
  top: 0;
  left: 0;
  padding: 100px 120px 240px;
  transform-origin: 0 0;
  transition: transform 0.05s ease-out;
}

/* Neighborhood Blocks & Streets */
.neighbourhood-container {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.neighbourhood-street {
  background: rgba(18, 12, 30, 0.85);
  border: 1px solid rgba(59, 44, 88, 0.6);
  border-radius: 20px;
  padding: 18px 22px 22px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

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

.street-sign {
  font-size: 0.85rem;
  font-weight: 800;
  color: #ffaa33;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: rgba(13, 8, 25, 0.9);
  padding: 4px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.street-road {
  height: 28px;
  background: #140e22;
  border-top: 2px solid #2b1f42;
  border-bottom: 2px solid #2b1f42;
  margin: 12px 0;
  display: flex;
  align-items: center;
  border-radius: 4px;
}

.road-divider {
  width: 100%;
  height: 2px;
  background: repeating-linear-gradient(90deg, #ffaa00 0, #ffaa00 16px, transparent 16px, transparent 32px);
  opacity: 0.45;
}

.plots-grid {
  display: grid;
  grid-template-columns: repeat(6, 122px);
  gap: 16px;
}

/* Individual Plot Card */
.map-plot {
  width: 122px;
  height: 144px;
  background: rgba(28, 19, 44, 0.92);
  border: 2px solid #3b2c58;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 6px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.map-plot:hover {
  transform: translateY(-5px) scale(1.05);
  border-color: var(--orange-primary);
  box-shadow: 0 8px 24px rgba(255, 122, 0, 0.35);
  z-index: 10;
}

.map-plot.selected {
  border-color: #ffaa00 !important;
  box-shadow: 0 0 25px rgba(255, 170, 0, 0.8), inset 0 0 10px rgba(255, 170, 0, 0.3);
  transform: translateY(-6px) scale(1.08);
  z-index: 15;
}

.map-plot.plot-empty {
  border: 2px dashed rgba(157, 78, 221, 0.45);
  background: rgba(18, 11, 30, 0.55);
}

.map-plot.plot-empty:hover {
  border-color: var(--orange-glow);
  background: rgba(38, 18, 60, 0.75);
}

.map-plot.plot-mine {
  border-color: #ffd54f;
  background: linear-gradient(180deg, rgba(65, 35, 105, 0.95), rgba(30, 18, 55, 0.95));
  box-shadow: 0 0 16px rgba(255, 213, 79, 0.35);
}

.plot-top-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.plot-num {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  background: rgba(0,0,0,0.35);
  padding: 2px 6px;
  border-radius: 8px;
}

.plot-mine .plot-num {
  color: #ffd54f;
  background: rgba(255, 213, 79, 0.2);
}

.plot-mine-pill {
  font-size: 0.65rem;
  font-weight: 800;
  background: #ffd54f;
  color: #170b2c;
  padding: 1px 5px;
  border-radius: 6px;
}

.plot-house-icon {
  font-size: 42px;
  line-height: 1;
  margin: 4px 0;
  transition: transform 0.12s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.map-plot:active .plot-house-icon {
  transform: scale(0.9);
}

.plot-owner {
  font-size: 0.74rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
  text-align: center;
}

.plot-bottom-info {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.plot-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 8px;
}

.badge-scare {
  background: rgba(255, 23, 68, 0.2);
  color: #ff5252;
}

.badge-bowl {
  background: rgba(255, 170, 0, 0.2);
  color: #ffb049;
}

.badge-available {
  background: rgba(0, 230, 118, 0.15);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.3);
  animation: pulseAvailable 2s infinite;
}

@keyframes pulseAvailable {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; transform: scale(1.05); }
}

/* Floating Map HUD Controls */
.map-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}

.map-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(25, 18, 40, 0.92);
  border: 1px solid var(--border-color);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.2s;
}

.map-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--orange-primary);
  transform: scale(1.08);
}

/* --- ACTION DRAWER (Landgrab Side / Bottom Panel) --- */
.action-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 75vh;
  background: rgba(20, 13, 34, 0.98);
  backdrop-filter: blur(20px);
  border-top: 3px solid var(--border-color);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
  z-index: 80;
  display: flex;
  flex-direction: column;
  transform: translateY(105%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.action-drawer.open {
  transform: translateY(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

.drawer-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--orange-primary);
}

.drawer-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

.drawer-content {
  padding: 16px 20px 24px;
  overflow-y: auto;
  max-height: calc(75vh - 60px);
}

@media (min-width: 860px) {
  .action-drawer {
    bottom: 20px;
    right: 20px;
    left: auto;
    width: 440px;
    max-height: calc(100% - 40px);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    transform: translateX(110%);
  }
  .action-drawer.open {
    transform: translateX(0);
  }
  .drawer-content {
    max-height: calc(100vh - 220px);
  }
}

/* --- CLICK HOUSE FOR CANDY (Clicker Mechanic) --- */
.tap-house-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0 16px;
  text-align: center;
}

.tap-house-btn {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: radial-gradient(circle, #3d1b66 0%, #1e0d36 100%);
  border: 3px solid #ff7a00;
  box-shadow: 0 0 25px rgba(255, 122, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.08s ease;
  position: relative;
}

.tap-house-btn:active, .tap-house-btn.pulse-click {
  transform: scale(0.92);
  border-color: #ffd54f;
  box-shadow: 0 0 35px rgba(255, 213, 79, 0.6);
}

.tap-house-emoji {
  font-size: 54px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
  pointer-events: none;
}

.tap-hint-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffaa33;
  margin-top: 8px;
}

/* Floating Candy Particles */
.floating-candy {
  position: fixed;
  pointer-events: none;
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffb049;
  text-shadow: 0 0 8px #ff7a00, 0 2px 4px #000;
  z-index: 9999;
  animation: floatUpFade 0.65s ease-out forwards;
}

@keyframes floatUpFade {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -85px) scale(1.25);
  }
}

/* Candy Bowl Collect Button */
.btn-collect {
  background: linear-gradient(135deg, #ff7a00, #ff9100);
  border: none;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 122, 0, 0.4);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.btn-collect:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 122, 0, 0.5);
}

.btn-collect:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Drawer Sections */
.drawer-section-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #ffaa33;
  margin: 16px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.compact-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.compact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.compact-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.82rem;
}

.compact-card-info {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin: 4px 0 8px;
}

.btn-action {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action:hover:not(:disabled) {
  border-color: var(--orange-primary);
  background: var(--bg-card-hover);
}

.btn-action.primary {
  background: var(--purple-accent);
  border-color: var(--purple-accent);
}

.btn-action.primary:hover:not(:disabled) {
  background: #7b2cbf;
}

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

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.modal-dialog.modal-large {
  max-width: 650px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

/* Form Styles */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}

.form-input:focus {
  border-color: var(--orange-primary);
  box-shadow: 0 0 10px rgba(255, 122, 0, 0.3);
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(25, 18, 40, 0.95);
  border: 1px solid var(--orange-primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  animation: toastIn 0.3s ease-out;
}

.toast.error {
  border-color: var(--red-blood);
  color: #ff5252;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive tweaks */
@media (max-width: 640px) {
  .logo-text { display: none; }
  .header-stats { gap: 6px; }
  .stat-pill { padding: 4px 8px; font-size: 0.8rem; }
  .nav-btn { padding: 6px 10px; font-size: 0.82rem; }
  .plots-grid { grid-template-columns: repeat(6, 110px); gap: 10px; }
  .map-plot { width: 110px; height: 136px; }
}
