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

:root {
  --bg: #0d0d0d;
  --surface: #1a1a1a;
  --surface2: #252525;
  --border: #333;
  --text: #e0e0e0;
  --text-dim: #888;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --green: #3ba55c;
  --red: #ed4245;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 800px; margin: 0 auto; padding: 24px; }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header h1 { font-size: 20px; font-weight: 700; }
.header h1 span { color: var(--accent); }

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-discord {
  background: var(--accent);
  color: white;
}
.btn-discord:hover { background: var(--accent-hover); }

.btn-primary {
  background: var(--green);
  color: white;
}
.btn-primary:hover { background: #2d8a4e; }

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

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

/* Forms */
input, textarea, select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
  font-family: inherit;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
}

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

/* Landing page */
.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
  gap: 24px;
}

.landing h1 { font-size: 48px; }
.landing h1 span { color: var(--accent); }
.landing p { color: var(--text-dim); font-size: 18px; max-width: 500px; line-height: 1.6; }

/* Dashboard */
.dashboard { padding-top: 32px; }

.section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

.room-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.room-card h3 { margin-bottom: 4px; }
.room-card .meta { font-size: 12px; color: var(--text-dim); }

.server-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.server-tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  color: var(--text-dim);
}

/* Server picker */
.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.server-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s;
}

.server-option.selected { border-color: var(--accent); }

.server-option img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
}

.server-option .name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chat */
.room-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.room-header {
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.room-header h2 { font-size: 16px; }
.room-header .origin { font-size: 12px; color: var(--text-dim); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message {
  display: flex;
  gap: 10px;
  padding: 6px 0;
}

.message img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-top: 2px;
  flex-shrink: 0;
}

.message .body { flex: 1; }

.message .author {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.message .author .via {
  font-weight: 400;
  color: var(--text-dim);
  font-size: 11px;
  margin-left: 6px;
}

.message .author .time {
  font-weight: 400;
  color: var(--text-dim);
  font-size: 10px;
  margin-left: 8px;
}

.message .text {
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.chat-input-area {
  padding: 12px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.chat-input-area form { display: flex; gap: 8px; }

.chat-input-area input {
  flex: 1;
}

/* Presence sidebar */
.presence {
  padding: 8px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}

/* Bio snippet */
.bio-snippet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.bio-snippet pre {
  background: var(--surface2);
  padding: 12px;
  border-radius: 4px;
  font-size: 13px;
  white-space: pre-wrap;
  margin: 8px 0;
  color: var(--text);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h2 { margin-bottom: 16px; }

/* Gate screen */
.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  gap: 16px;
}

.gate h2 { font-size: 24px; }
.gate p { color: var(--text-dim); max-width: 400px; }

.gate .server-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 8px 0;
}

.denied {
  background: var(--red);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 600;
}

/* Responsive */
@media (max-width: 600px) {
  .landing h1 { font-size: 32px; }
  .server-grid { grid-template-columns: 1fr; }
}
