/* ============================================================
   LAGOS HUSTLE — Stylesheet
   ============================================================ */

:root {
  --bg: #000000;
  --surface: #0E0E0E;
  --surface-2: #141414;
  --divider: #1A1A1A;
  --text: #F5F7FF;
  --dim: #8E97B8;
  --dim-2: #606B8E;
  --accent: #8B5CF6;
  --accent-2: #6C63FF;
  --success: #10B981;
  --warn: #F59E0B;
  --danger: #EF4444;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  user-select: none;
  touch-action: none;
}

#app {
  max-width: 520px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}

/* ============ SCREENS ============ */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.screen.active {
  display: flex;
}

/* ============ WELCOME ============ */
#screen-welcome {
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 40%, rgba(139, 92, 246, 0.18), transparent 60%);
}

.welcome-box {
  text-align: center;
  width: 100%;
  max-width: 340px;
}

.logo-circle {
  width: 88px;
  height: 88px;
  margin: 0 auto 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.4);
}

.welcome-box h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.tagline {
  color: var(--dim);
  font-size: 15px;
  margin-bottom: 40px;
}

/* ============ BUTTONS ============ */
.btn {
  display: block;
  width: 100%;
  padding: 15px 24px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
  font-family: inherit;
  margin-bottom: 10px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

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

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--divider);
}

.btn-ghost {
  background: transparent;
  color: var(--dim);
}

/* ============ CHARACTER CREATE ============ */
#screen-create {
  padding: 24px;
  overflow-y: auto;
}

.create-box {
  width: 100%;
}

.create-box h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.subtle {
  color: var(--dim);
  font-size: 14px;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--dim);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 8px;
  margin-top: 20px;
}

#input-name {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

#input-name:focus {
  border-color: var(--accent);
}

.hustle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.hustle-card {
  background: var(--surface);
  border: 1.5px solid var(--divider);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.hustle-card.selected {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.1);
}

.hustle-emoji { font-size: 28px; margin-bottom: 6px; }
.hustle-name { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.hustle-desc { font-size: 11px; color: var(--dim); line-height: 1.4; }

#btn-begin-life { margin-top: 28px; }

/* ============ GAME SCREEN ============ */
#screen-game {
  display: flex;
  flex-direction: column;
}

.hud {
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  padding: 10px 14px;
  flex-shrink: 0;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.hud-player {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 15px;
}

.hud-name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.hud-hustle {
  font-size: 11px;
  color: var(--dim);
}

.hud-day { text-align: right; }
.hud-day-label {
  font-size: 8px;
  font-weight: 800;
  color: var(--dim-2);
  letter-spacing: 1.5px;
}
.hud-day-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -1px;
  line-height: 1;
}

.hud-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px;
  background: var(--surface-2);
  border-radius: 8px;
}

.hud-stat-icon {
  font-size: 12px;
  line-height: 1;
}

.hud-stat-val {
  font-size: 11px;
  font-weight: 800;
  margin-top: 2px;
  color: var(--text);
}

/* ============ CANVAS ============ */
.canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #0a0a12;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.interaction-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(139, 92, 246, 0.9);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(10px);
  animation: pulse 1.5s ease-in-out infinite;
  z-index: 10;
}

@keyframes pulse {
  0%, 100% { opacity: 0.85; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

.hidden {
  display: none !important;
}

.toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 14px 22px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  max-width: 80%;
  z-index: 100;
  border: 1.5px solid var(--accent);
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -60%); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

.toast.good { border-color: var(--success); }
.toast.bad  { border-color: var(--danger); }

/* ============ MOBILE CONTROLS ============ */
.mobile-controls {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 140px;
  z-index: 20;
  opacity: 0.7;
}

.dpad-btn {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(20, 20, 26, 0.85);
  border: 1.5px solid var(--divider);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}

.dpad-btn:active {
  background: var(--accent);
  border-color: var(--accent);
}

.dpad-up    { top: 0; left: 48px; }
.dpad-left  { top: 48px; left: 0; }
.dpad-right { top: 48px; right: 0; }
.dpad-down  { bottom: 0; left: 48px; }

/* Hide dpad on desktop with keyboard */
@media (min-width: 900px) {
  .mobile-controls { display: none; }
}

/* ============ BOTTOM BAR ============ */
.bottom-bar {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-top: 1px solid var(--divider);
  flex-shrink: 0;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--divider);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: background 0.15s;
}

.icon-btn:active {
  background: var(--accent);
  border-color: var(--accent);
}

/* ============ MODALS ============ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-box h3 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 16px;
}

.help-list {
  list-style: none;
  margin: 16px 0;
}

.help-list li {
  padding: 10px 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  border-bottom: 1px solid var(--divider);
}

.help-list li:last-child { border-bottom: none; }

.help-list strong { color: var(--accent); }

.building-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

.building-actions .btn {
  margin: 0;
  text-align: left;
}