:root {
  --bg: #1A1410;
  --bg-2: #221a14;
  --bg-3: #2a201a;
  --amber: #E8A547;
  --amber-soft: rgba(232, 165, 71, 0.12);
  --text: #F5EBE0;
  --text-muted: rgba(245, 235, 224, 0.6);
  --text-dim: rgba(245, 235, 224, 0.4);
  --border: rgba(245, 235, 224, 0.08);
  --border-strong: rgba(245, 235, 224, 0.18);
  --green: #5DCAA5;
  --coral: #F0997B;
  --purple: #AFA9EC;
  --pink: #ED93B1;

  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Manrope', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: var(--amber); text-decoration: none; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  padding-bottom: 80px;
}

/* Loader */
.loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
}
.loader-text {
  font-family: var(--mono);
  color: var(--amber);
  font-size: 24px;
  font-weight: 500;
}
.loader-bar {
  width: 120px;
  height: 2px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}
.loader-fill {
  width: 40%;
  height: 100%;
  background: var(--amber);
  animation: load 1s ease-in-out infinite;
}
@keyframes load {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 16px;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--bg) 80%, transparent);
  z-index: 10;
  backdrop-filter: blur(12px);
}
.logo {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--amber);
}
.logo-sub {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--sans);
  font-weight: 400;
  margin-top: 2px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 13px;
  flex-shrink: 0;
}

/* Section header */
.section-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 8px 20px 12px;
}
.section-label::before {
  content: '// ';
  color: var(--amber);
  opacity: 0.5;
}

/* Meetup list */
.meetup-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 20px;
}

.meetup-card {
  background: var(--bg-2);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  transition: transform 0.15s ease, border-color 0.2s ease;
  cursor: pointer;
}
.meetup-card:active { transform: scale(0.98); }
.meetup-card.live {
  background: var(--amber-soft);
  border-color: rgba(232, 165, 71, 0.4);
}

.meetup-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--amber);
}
.meetup-card:not(.live) .meetup-meta { color: var(--text-muted); }

.badge-live {
  background: rgba(93, 202, 165, 0.15);
  color: var(--green);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-live::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.meetup-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
}
.meetup-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.meetup-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.attendees {
  display: flex;
  align-items: center;
}
.attendee-pill {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 10px;
  margin-left: -8px;
}
.attendee-pill:first-child { margin-left: 0; }
.meetup-card.live .attendee-pill { border-color: #2a1f15; }

.attendee-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
}

.btn {
  background: transparent;
  color: var(--amber);
  border: 0.5px solid var(--amber);
  padding: 8px 14px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: var(--amber);
  color: var(--bg);
}
.btn-joined {
  background: rgba(93, 202, 165, 0.15);
  color: var(--green);
  border-color: rgba(93, 202, 165, 0.4);
}

/* Create button */
.create-card {
  border: 0.5px dashed rgba(232, 165, 71, 0.4);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 13px;
  margin: 4px 20px 0;
  background: transparent;
  width: calc(100% - 40px);
  transition: all 0.2s ease;
}
.create-card:active {
  background: var(--amber-soft);
  transform: scale(0.99);
}

/* Bottom nav */
.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(26, 20, 16, 0.92);
  backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  z-index: 50;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  padding: 6px 16px;
  transition: color 0.15s ease;
}
.nav-item.active { color: var(--amber); }
.nav-icon {
  width: 22px;
  height: 22px;
}

/* Profile */
.profile-hero {
  text-align: center;
  padding: 24px 20px 28px;
}
.profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 28px;
  margin: 0 auto 14px;
}
.profile-name {
  font-size: 18px;
  font-weight: 600;
}
.profile-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 20px 20px;
}
.stat-card {
  background: var(--bg-2);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
}
.stat-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--amber);
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 20px 20px;
}
.tag {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text-muted);
}
.tag.amber { background: rgba(232, 165, 71, 0.15); color: var(--amber); }
.tag.green { background: rgba(93, 202, 165, 0.15); color: var(--green); }
.tag.coral { background: rgba(240, 153, 123, 0.15); color: var(--coral); }
.tag.purple { background: rgba(175, 169, 236, 0.15); color: var(--purple); }

.achievements {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 20px 20px;
}
.achievement {
  background: var(--bg-2);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
}
.achievement.locked { opacity: 0.35; }
.achievement-icon {
  font-size: 22px;
  margin-bottom: 6px;
}
.achievement-label {
  font-size: 11px;
  font-weight: 500;
}

/* Modal / sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 480px;
  background: var(--bg-2);
  border-radius: 24px 24px 0 0;
  padding: 8px 20px calc(28px + env(safe-area-inset-bottom));
  z-index: 95;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 85vh;
  overflow-y: auto;
}
.sheet.open { transform: translateX(-50%) translateY(0); }
.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 8px auto 16px;
}
.sheet-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.sheet-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.field {
  margin-bottom: 14px;
}
.field-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--bg);
  border: 0.5px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--amber);
}
.field textarea { resize: vertical; min-height: 70px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-block {
  width: 100%;
  padding: 14px;
  font-size: 14px;
  border-radius: 12px;
  margin-top: 10px;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.5;
}

/* Detail view */
.detail-back {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 8px;
  margin: 0 12px;
  border-radius: 8px;
}
.detail-back:active { background: var(--bg-2); }

.detail-hero {
  padding: 20px;
}
.detail-when {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--amber);
  margin-bottom: 8px;
}
.detail-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 10px;
}
.detail-where {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-desc {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  padding: 16px 20px;
  border-top: 0.5px solid var(--border);
  border-bottom: 0.5px solid var(--border);
  margin: 8px 0;
}

.detail-attendees {
  padding: 16px 20px;
}
.attendee-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-radius: 10px;
  margin: 0 -8px;
  transition: background 0.15s ease, transform 0.1s ease;
}
.attendee-row.clickable {
  cursor: pointer;
}
.attendee-row.clickable:active {
  background: var(--bg-2);
  transform: scale(0.99);
}
@media (hover: hover) {
  .attendee-row.clickable:hover {
    background: var(--bg-2);
  }
}
.attendee-info { flex: 1; min-width: 0; }
.attendee-name { font-size: 14px; font-weight: 500; }
.attendee-stack {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attendee-chevron {
  color: var(--text-dim);
  font-size: 22px;
  line-height: 1;
  padding-right: 4px;
  flex-shrink: 0;
}

.detail-actions {
  position: sticky;
  bottom: 76px;
  padding: 14px 20px;
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-3);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 999px;
  border: 0.5px solid var(--border-strong);
  font-size: 13px;
  font-family: var(--mono);
  z-index: 200;
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Auth screen */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 24px;
  text-align: center;
}
.auth-logo {
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 500;
  color: var(--amber);
  margin-bottom: 8px;
}
.auth-tag {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 48px;
  max-width: 280px;
}
.auth-emoji {
  font-size: 64px;
  margin-bottom: 24px;
}
.auth-btn {
  background: var(--amber);
  color: var(--bg);
  padding: 14px 28px;
  border-radius: 12px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  width: 100%;
  max-width: 300px;
}

.hidden { display: none !important; }
