/* Americana Wonder styles. Mobile first, sunset palette. */

:root {
  --sunset-1: #ff9a5a;
  --sunset-2: #ff6b9d;
  --sunset-3: #7b5cff;
  --deep: #1d1333;
  --ink: #2b2144;
  --paper: #fff8f2;
  --card: #ffffff;
  --gold: #f5b942;
  --teal: #2dd4bf;
  --muted: #8a7fa8;
  --danger: #e5484d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  padding-bottom: 76px;
  background: var(--paper);
}

/* Screens */
.screen { display: none; padding: 16px 16px 24px; }
.screen.active { display: block; }

/* Landing */
.landing {
  min-height: calc(100vh - 76px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: linear-gradient(180deg, #2b1a4e 0%, #7b2d5e 45%, #ff7a4d 100%);
  color: #fff;
  border-radius: 0 0 24px 24px;
  padding: 48px 24px;
}
.landing h1 {
  font-size: 2.6rem;
  margin: 12px 0 4px;
  letter-spacing: 1px;
}
.landing .tagline {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 32px;
}
.landing .sun {
  width: 110px;
  height: 110px;
}
.landing .credit {
  margin-top: 40px;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: 14px 18px;
  margin: 8px 0;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--sunset-2), var(--sunset-1));
  color: #fff;
}
.btn:active { transform: scale(0.98); }
.btn.secondary {
  background: #efe9fb;
  color: var(--ink);
}
.btn.ghost {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.6);
}
.btn.small {
  width: auto;
  display: inline-block;
  padding: 10px 16px;
  font-size: 0.9rem;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Cards */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: 0 2px 10px rgba(43,33,68,0.08);
}
.card h3 { margin: 0 0 6px; }
.card p { margin: 6px 0; color: #4a4266; }
.card .price { font-weight: 800; color: var(--ink); }

/* Stats bar */
.stats {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.stat {
  flex: 1;
  background: var(--deep);
  color: #fff;
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}
.stat .label { font-size: 0.7rem; opacity: 0.7; text-transform: uppercase; }
.stat .value { font-size: 1.05rem; font-weight: 800; }

/* Weekly banner */
.weekly {
  background: linear-gradient(135deg, var(--sunset-3), var(--sunset-2));
  color: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  margin: 12px 0;
}
.weekly strong { display: block; margin-bottom: 2px; }
.weekly span { font-size: 0.9rem; opacity: 0.95; }

/* Origin picker */
.origin {
  border: 2px solid #e4dcf5;
  border-radius: 14px;
  padding: 14px;
  margin: 8px 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
  background: var(--card);
  font: inherit;
}
.origin.selected { border-color: var(--sunset-2); background: #fff5fa; }
.origin .t { font-weight: 800; font-size: 1.05rem; }
.origin .trade { font-size: 0.85rem; color: var(--muted); font-style: italic; }

input[type="text"] {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 2px solid #e4dcf5;
  font-size: 1rem;
  margin: 8px 0;
}

/* Map */
.map-wrap { position: relative; }
#aw-map { width: 100%; height: auto; display: block; }
.pin { cursor: pointer; }
.pin circle.dot { fill: var(--sunset-2); stroke: #fff; stroke-width: 2; }
.pin circle.hit { fill: transparent; }
.loc-list { margin-top: 12px; }
.loc-list button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin: 4px 0;
  border-radius: 10px;
  border: 1px solid #e4dcf5;
  background: var(--card);
  font: inherit;
  cursor: pointer;
}

/* Modal */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(29,19,51,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-back.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  max-width: 420px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal h3 { margin-top: 0; }

/* Feed */
.feed-item {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 8px 0;
  font-size: 0.95rem;
  box-shadow: 0 1px 6px rgba(43,33,68,0.06);
}
.feed-item .day { font-size: 0.75rem; color: var(--muted); }
.feed-item.milestone { border-left: 4px solid var(--gold); }
.ad-slot {
  border: 2px dashed #c9bfe0;
  border-radius: 12px;
  padding: 18px;
  margin: 8px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  background: #faf8ff;
}
.ad-slot .ad-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  background: #e4dcf5;
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

/* Quests */
.quest { border-left: 4px solid var(--sunset-3); }
.quest.done { border-left-color: var(--teal); opacity: 0.85; }
.progress {
  height: 10px;
  background: #efe9fb;
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0;
}
.progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--sunset-2), var(--sunset-1));
}

/* Home art */
.home-art { width: 100%; height: auto; border-radius: 16px; display: block; }

/* Bottom nav */
#nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  display: flex;
  background: var(--deep);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}
#nav button {
  flex: 1;
  background: none;
  border: none;
  color: #b9aede;
  font-size: 0.72rem;
  padding: 8px 2px;
  cursor: pointer;
  font-weight: 700;
}
#nav button .ico { font-size: 1.3rem; display: block; }
#nav button.active { color: #fff; }

/* Toast */
#toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--deep);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 0.9rem;
  display: none;
  z-index: 60;
  max-width: 90%;
  text-align: center;
}
#toast.show { display: block; }

h2 { margin: 8px 0 4px; }
.sub { color: var(--muted); font-size: 0.9rem; margin-top: 0; }
.row { display: flex; gap: 8px; }
.row .btn { margin: 4px 0; }
.demo-note {
  font-size: 0.8rem;
  color: var(--muted);
  background: #faf8ff;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 12px 0;
}

/* NPC street life */
.npc-row { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0; }
.npc-chip {
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 12px; border-radius:999px;
  background:#f6f1ff; border:1px solid #d9c9f2;
  cursor:pointer; font-size:0.85rem; color:#2b2144;
  font-family:inherit; text-align:left;
}
.npc-chip:active { transform:scale(0.97); }
.npc-chip.celeb { background:#fff7e0; border-color:#e8c96a; }
.npc-chip.pap { background:#fdeaea; border-color:#e8a0a0; }
.npc-avatar { font-size:1.4rem; line-height:1; }
.npc-label { font-size:0.75rem; color:#6f6390; }

/* Multiplayer */
#mp-auth { margin: 14px 0 4px; }
#mp-auth .row { justify-content: center; }
.mp-session { font-size: 0.9rem; margin-bottom: 6px; }
.linklike {
  background: none; border: none; color: #7b2d5e; cursor: pointer;
  text-decoration: underline; font-size: 0.85rem; padding: 0 2px;
  font-family: inherit;
}
#mp-auth select {
  font-family: inherit; font-size: 0.85rem; padding: 4px 6px;
  border-radius: 8px; border: 1px solid #d9c9f2; background: #fff;
}
.npc-chip.live { background: #e8f9ef; border-color: #4caf7d; }
.live-badge {
  background: #e53935; color: #fff; font-size: 0.65rem; font-weight: 800;
  border-radius: 6px; padding: 2px 6px; vertical-align: middle;
}
.lb-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.lb-table th, .lb-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #eee4f7; }
.lb-table tr.me td { background: #fff3d6; font-weight: 800; }
#chat-drawer {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(110%);
  bottom: 0; width: 100%; max-width: 520px; height: 46vh;
  background: #fff; border-radius: 18px 18px 0 0; z-index: 70;
  display: flex; flex-direction: column;
  box-shadow: 0 -6px 30px rgba(43, 20, 68, 0.25);
  transition: transform 0.25s ease;
}
#chat-drawer.open { transform: translateX(-50%) translateY(0); }
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid #eee4f7;
}
.chat-head strong { color: #2b1444; }
#chat-close {
  background: #f1eafb; border: none; border-radius: 50%;
  width: 30px; height: 30px; font-size: 1rem; cursor: pointer; color: #2b1444;
}
#chat-messages { flex: 1; overflow-y: auto; padding: 10px 14px; }
.chat-msg { margin: 6px 0; font-size: 0.9rem; }
.chat-msg strong { color: #7b2d5e; }
.chat-msg.mine strong { color: #2e8b57; }
.chat-input {
  display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #eee4f7;
}
.chat-input input {
  flex: 1; font-family: inherit; font-size: 0.95rem;
  padding: 10px 12px; border-radius: 12px; border: 1px solid #d9c9f2;
}
.modal label { display: block; margin: 8px 0; font-size: 0.9rem; }
.modal input {
  display: block; width: 100%; box-sizing: border-box;
  font-family: inherit; font-size: 1rem; padding: 10px 12px; margin-top: 4px;
  border-radius: 12px; border: 1px solid #d9c9f2;
}
