/* =========================================
   BetterAudio — style.css
   Dark glassmorphism + spatial audio UI
   ========================================= */

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

:root {
  --bg: #080c14;
  --glass: rgba(255,255,255,0.05);
  --glass-border: rgba(255,255,255,0.1);
  --accent: #00d4ff;
  --accent2: #7c3aed;
  --accent3: #10b981;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --error: #f87171;
  --radius: 20px;
  --shadow: 0 25px 60px rgba(0,0,0,0.5);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ── Background Orbs ── */
.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: drift 12s ease-in-out infinite alternate;
}
.orb-1 { width: 500px; height: 500px; background: var(--accent2); top: -100px; left: -150px; animation-delay: 0s; }
.orb-2 { width: 400px; height: 400px; background: var(--accent);  bottom: -80px; right: -100px; animation-delay: 4s; }
.orb-3 { width: 300px; height: 300px; background: var(--accent3); top: 40%; left: 60%; animation-delay: 8s; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.1); }
}

/* ── Screens ── */
.screen { display: none; position: relative; z-index: 1; width: 100%; justify-content: center; align-items: center; }
.screen.active { display: flex; }

/* ── Glass Card ── */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: fadeUp 0.5s ease both;
}
.card.wide { max-width: 640px; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Logo ── */
.logo-wrap { text-align: center; margin-bottom: 2rem; }
.logo-icon { font-size: 3rem; margin-bottom: 0.5rem; filter: drop-shadow(0 0 16px var(--accent)); }
.logo-text {
  font-size: 2rem; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.logo-subtitle { font-size: 0.9rem; color: var(--muted); margin-top: 0.25rem; }

/* ── Instruction ── */
.instruction { text-align: center; color: var(--muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.instruction code {
  background: rgba(255,255,255,0.08);
  border-radius: 6px; padding: 0.1rem 0.4rem;
  color: var(--accent); font-size: 0.9rem;
}

/* ── Code Inputs ── */
.code-inputs {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.code-digit {
  width: 48px; height: 60px;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text); font-size: 1.5rem; font-weight: 700;
  text-align: center; caret-color: var(--accent);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.code-digit:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.15);
}
.code-sep { font-size: 1.5rem; color: var(--muted); margin: 0 0.25rem; }

/* ── Buttons ── */
.btn-primary {
  width: 100%; padding: 0.85rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; border-radius: 12px;
  color: #fff; font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(0,212,255,0.25);
  margin-bottom: 1.25rem;
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary:not(:disabled):hover { opacity: 0.92; transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,212,255,0.35); }
.btn-primary:not(:disabled):active { transform: translateY(0); }

.btn-sm {
  background: rgba(255,255,255,0.08); border: 1px solid var(--glass-border);
  border-radius: 8px; padding: 0.35rem 0.8rem;
  color: var(--muted); font-size: 0.8rem; cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.btn-sm:hover { background: rgba(248,113,113,0.15); color: var(--error); border-color: var(--error); }

/* ── Server Row ── */
.server-row { display: flex; flex-direction: column; gap: 0.4rem; }
.server-row label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.server-row input {
  background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
  border-radius: 8px; padding: 0.5rem 0.75rem;
  color: var(--text); font-size: 0.85rem; font-family: monospace; outline: none;
  transition: border-color 0.2s;
}
.server-row input:focus { border-color: var(--accent); }

/* ── Error ── */
.error-msg { color: var(--error); font-size: 0.85rem; text-align: center; margin-bottom: 0.75rem; }
.hidden { display: none; }

/* ── Status Bar ── */
.status-bar {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 1.5rem;
}
.status-dot {
  width: 10px; height: 10px;
  background: var(--accent3); border-radius: 50%;
}
.status-dot.pulse { animation: statusPulse 2s ease-in-out infinite; }
.status-dot.disconnected { background: var(--error); animation: none; }
@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  50%       { box-shadow: 0 0 0 7px rgba(16,185,129,0); }
}
#status-label { flex: 1; font-size: 0.9rem; color: var(--muted); }

/* ── Mic ── */
.mic-section { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
.mic-ring {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(0,212,255,0.1);
  border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  position: relative; transition: box-shadow 0.2s;
}
.mic-ring.speaking { box-shadow: 0 0 0 8px rgba(0,212,255,0.15), 0 0 0 16px rgba(0,212,255,0.07); animation: micPulse 0.4s ease-in-out infinite alternate; }
@keyframes micPulse {
  from { box-shadow: 0 0 0 4px rgba(0,212,255,0.2); }
  to   { box-shadow: 0 0 0 12px rgba(0,212,255,0.07); }
}
.mic-icon { font-size: 2rem; }
.mic-label { font-size: 0.85rem; color: var(--muted); }

/* ── Players ── */
.players-section { margin-bottom: 1.5rem; }
.players-section h2, .log-section h2 {
  font-size: 0.75rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.75rem;
}
.players-list { display: flex; flex-direction: column; gap: 0.4rem; }
.player-entry {
  display: flex; align-items: center; gap: 0.6rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border); border-radius: 10px;
  padding: 0.5rem 0.75rem; font-size: 0.88rem;
  animation: fadeIn 0.3s ease both;
}
@keyframes fadeIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
.player-entry .p-head {
  width: 24px; height: 24px;
  border-radius: 4px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.player-entry .p-name { flex: 1; }
.player-entry .p-dist { font-size: 0.75rem; color: var(--muted); font-family: monospace; }
.empty-hint { font-size: 0.85rem; color: var(--muted); text-align: center; padding: 0.5rem 0; }

/* ── Translation Log ── */
.log-box {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  border-radius: 12px; padding: 0.75rem 1rem;
  height: 140px; overflow-y: auto;
  font-size: 0.83rem; line-height: 1.6;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.log-box::-webkit-scrollbar { width: 4px; }
.log-box::-webkit-scrollbar-track { background: transparent; }
.log-box::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.log-entry { display: flex; gap: 0.5rem; }
.log-entry .log-name { color: var(--accent); font-weight: 600; flex-shrink: 0; }
.log-entry .log-text { color: var(--text); }
.log-entry .log-orig { color: var(--muted); font-style: italic; font-size: 0.78rem; }
