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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #16213e;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
  text-align: center;
}

.modal h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.subtitle {
  color: #888;
  margin-bottom: 24px;
}

.setup-form {
  text-align: left;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #aaa;
  font-size: 0.9rem;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 12px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
}

.emoji-picker, .color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.emoji-option, .color-option {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
}

.emoji-option:hover, .color-option:hover {
  transform: scale(1.1);
}

.emoji-option.selected, .color-option.selected {
  border-color: #fff;
  box-shadow: 0 0 10px rgba(255,255,255,0.3);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(90deg, #00b894, #00cec9);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

/* App Container */
#app.hidden {
  display: none;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0,0,0,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-size: 1.2rem;
  background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-left, .header-right {
  min-width: 80px;
}

.header-right {
  text-align: right;
  font-size: 0.85rem;
  color: #00b894;
}

.avatar-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
}

/* Tabs */
.tabs {
  display: flex;
  background: rgba(0,0,0,0.2);
  position: sticky;
  top: 56px;
  z-index: 99;
}

.tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: #888;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab.active {
  color: #fff;
  border-bottom-color: #00b894;
}

/* Tab Content */
.tab-content {
  padding: 16px;
  padding-bottom: 80px;
}

.tab-content.hidden {
  display: none;
}

/* Posts */
.compose {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.compose textarea {
  width: 100%;
  min-height: 60px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1rem;
  resize: none;
  outline: none;
}

.compose textarea::placeholder {
  color: #666;
}

.compose-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

#char-count {
  color: #666;
  font-size: 0.85rem;
}

#post-btn {
  background: linear-gradient(90deg, #6c5ce7, #a29bfe);
  border: none;
  padding: 8px 16px;
  border-radius: 16px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

#post-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.posts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 12px;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.post-author {
  font-weight: bold;
  font-size: 0.9rem;
}

.post-content {
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 8px;
}

.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #666;
}

.post-votes {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vote-btn {
  background: none;
  border: none;
  color: #666;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
}

.vote-btn:hover { color: #00b894; }
.vote-btn.down:hover { color: #ff6b6b; }

/* Nearby Chat */
.chat-messages {
  height: calc(100vh - 200px);
  overflow-y: auto;
  padding-bottom: 16px;
}

.chat-message {
  margin-bottom: 12px;
}

.chat-message.me {
  text-align: right;
}

.message-bubble {
  display: inline-block;
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.1);
  text-align: left;
}

.chat-message.me .message-bubble {
  background: #00b894;
}

.message-author {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 2px;
}

.message-text {
  word-wrap: break-word;
}

.message-time {
  font-size: 0.7rem;
  color: #666;
  margin-top: 4px;
}

.chat-input {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  padding: 12px;
  background: #1a1a2e;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.chat-input input {
  flex: 1;
  padding: 12px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 20px;
  color: #fff;
  font-size: 1rem;
  margin-right: 8px;
}

.chat-input button {
  background: #00b894;
  border: none;
  padding: 12px 20px;
  border-radius: 20px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

/* People List */
.people-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.person {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.person:hover {
  background: rgba(255,255,255,0.1);
}

.person-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.person-info {
  flex: 1;
}

.person-name {
  font-weight: bold;
}

.person-distance {
  font-size: 0.85rem;
  color: #888;
}

/* DM Modal */
.dm-modal {
  height: 80vh;
  display: flex;
  flex-direction: column;
  max-width: 500px;
}

.dm-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.dm-header .close-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
}

.dm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.dm-input {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.dm-input input {
  flex: 1;
  padding: 10px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 16px;
  color: #fff;
}

.dm-input button {
  background: #00b894;
  border: none;
  padding: 10px 16px;
  border-radius: 16px;
  color: #fff;
  cursor: pointer;
}

/* Status Bar */
.status-bar {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: #888;
  z-index: 50;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

/* Responsive */
@media (max-width: 480px) {
  .modal-content {
    width: 95%;
    padding: 20px;
  }

  .header h1 {
    font-size: 1rem;
  }
}

/* Map Modal */
.map-modal-content {
  max-width: 95vw;
  width: 95vw;
  max-height: 90vh;
  height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

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

.map-header h3 {
  font-size: 1.1rem;
}

.location-map {
  flex: 1;
  min-height: 300px;
  border-radius: 12px;
  overflow: hidden;
  z-index: 1;
}

.map-controls {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.radius-control {
  margin-bottom: 12px;
}

.radius-control label {
  display: block;
  margin-bottom: 6px;
  color: #aaa;
  font-size: 0.9rem;
}

.radius-control input[type="range"] {
  width: 100%;
  accent-color: #00b894;
}

.map-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: #888;
}

.activity-indicator {
  color: #ff6b6b;
}

.activity-indicator.hot {
  color: #ff9500;
}

.activity-indicator.warm {
  color: #ffcc00;
}

.activity-indicator.cool {
  color: #00b894;
}

.map-actions {
  display: flex;
  gap: 12px;
}

.btn-secondary {
  flex: 1;
  padding: 12px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.15);
}

.map-actions .btn-primary {
  flex: 1;
  padding: 12px;
}

/* Main Map Tab */
.main-map {
  width: 100%;
  height: calc(100vh - 180px);
  border-radius: 12px;
  overflow: hidden;
}

.map-overlay-info {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  display: flex;
  gap: 16px;
  z-index: 1000;
}

#map-radius-display {
  color: #74b9ff;
}

#map-activity-display {
  color: #ff9500;
}

.location-hint {
  margin-top: 12px;
  font-size: 0.85rem;
  color: #ff6b6b;
  cursor: pointer;
  text-decoration: underline;
}

.location-hint:hover {
  color: #ff9500;
}

.close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
}

.close-btn:hover {
  color: #fff;
}