/* Nova Creekstone Voice — Mobile-first for iPad Safari */

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

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --accent: #0f3460;
  --green: #4ecca3;
  --red: #e74c3c;
  --yellow: #f39c12;
  --text: #eaeaea;
  --text-dim: #8a8a9a;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  -webkit-text-size-adjust: 100%;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* ── Join Screen ─────────────────────────────────── */

#join-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 360px;
}

.input-group {
  width: 100%;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.input-group input:focus {
  border-color: var(--green);
}

.input-group input::placeholder {
  color: var(--text-dim);
}

.input-group input.room-code {
  text-transform: uppercase;
  letter-spacing: 4px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
}

.btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

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

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

.btn-primary {
  background: var(--green);
  color: var(--bg);
}

.btn-danger {
  background: var(--red);
  color: white;
}

/* ── Voice Screen ────────────────────────────────── */

#voice-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 400px;
  gap: 20px;
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

.status-dot.disconnected {
  background: var(--red);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-text {
  font-size: 0.9rem;
  flex: 1;
}

.room-badge {
  font-size: 0.8rem;
  background: var(--accent);
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 2px;
  font-weight: 600;
}

/* ── Mic indicator ───────────────────────────────── */

.mic-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.mic-ring {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.mic-ring.speaking {
  border-color: var(--green);
  box-shadow: 0 0 20px rgba(78, 204, 163, 0.3);
}

.mic-ring.muted {
  border-color: var(--red);
}

.mic-icon {
  font-size: 2.5rem;
}

.mic-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ── Nearby players ──────────────────────────────── */

.nearby-section {
  width: 100%;
}

.nearby-title {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.nearby-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nearby-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: 8px;
}

.nearby-player .name {
  flex: 1;
  font-size: 0.95rem;
}

.nearby-player .volume-bar {
  width: 60px;
  height: 6px;
  background: var(--accent);
  border-radius: 3px;
  overflow: hidden;
}

.nearby-player .volume-bar .fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.3s;
}

.nearby-player .speaker-icon {
  font-size: 1rem;
  opacity: 0.5;
}

.nearby-player .speaker-icon.active {
  opacity: 1;
}

/* ── Error/info messages ─────────────────────────── */

.message {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  width: 100%;
  text-align: center;
}

.message.error {
  background: rgba(231, 76, 60, 0.15);
  color: var(--red);
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.message.info {
  background: rgba(78, 204, 163, 0.1);
  color: var(--green);
  border: 1px solid rgba(78, 204, 163, 0.2);
}

/* ── Dashboard-specific ──────────────────────────── */

.dashboard-container {
  width: 100%;
  max-width: 1200px;
  padding: 20px;
}

.map-canvas {
  width: 100%;
  aspect-ratio: 1;
  max-height: 500px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px solid var(--accent);
}

.controls-panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.player-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-card .tag {
  flex: 1;
  font-size: 0.9rem;
}

.player-card .actions {
  display: flex;
  gap: 6px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  opacity: 0.8;
}

.btn-icon.active {
  background: var(--red);
}

.transcript-viewer {
  margin-top: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.transcript-line {
  padding: 6px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.transcript-line .speaker {
  color: var(--green);
  font-weight: 600;
  margin-right: 8px;
}

.transcript-line .time {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-right: 8px;
}
