:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif,
    Consolas, monospace;
  background-color: #05070d;
  color: #d0e0ff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  user-select: none;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

main.app {
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: stretch;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.control-hint {
  font-size: 0.8rem;
  opacity: 0.6;
  text-align: center;
}

.tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    position: fixed;
    inset: auto 0 20px;
    justify-content: center;
    margin: auto;
    width: fit-content;
    background: #0f1322;
    border-radius: 999px;
    padding: 10px;
}

.tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.tile-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.tile-label {
  font-size: 0.7rem;
  color: #d0e0ff;
  opacity: 0.7;
  white-space: nowrap;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-name {
  font-size: 0.95rem;
  background-color: #5149e5;
  border-radius: 999px;
  aspect-ratio: 1;
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

@keyframes soundwave {
  0% {
    box-shadow: 
      0 0 0 0 rgba(139, 92, 246, 0.7),
      0 0 0 0 rgba(139, 92, 246, 0.7),
      0 0 0 0 rgba(139, 92, 246, 0.7);
  }
  20% {
    box-shadow: 
      0 0 0 4px rgba(139, 92, 246, 0.5),
      0 0 0 0 rgba(139, 92, 246, 0.7),
      0 0 0 0 rgba(139, 92, 246, 0.7);
  }
  40% {
    box-shadow: 
      0 0 0 8px rgba(139, 92, 246, 0.3),
      0 0 0 4px rgba(139, 92, 246, 0.5),
      0 0 0 0 rgba(139, 92, 246, 0.7);
  }
  60% {
    box-shadow: 
      0 0 0 12px rgba(139, 92, 246, 0.1),
      0 0 0 8px rgba(139, 92, 246, 0.3),
      0 0 0 4px rgba(139, 92, 246, 0.5);
  }
  80% {
    box-shadow: 
      0 0 0 16px rgba(139, 92, 246, 0),
      0 0 0 12px rgba(139, 92, 246, 0.1),
      0 0 0 8px rgba(139, 92, 246, 0.3);
  }
  100% {
    box-shadow: 
      0 0 0 16px rgba(139, 92, 246, 0),
      0 0 0 16px rgba(139, 92, 246, 0),
      0 0 0 12px rgba(139, 92, 246, 0);
  }
}

.tile-name {
  border: 2px solid #5149e5;
  position: relative;
  transition: box-shadow 0.3s ease-out, border-color 0.3s ease-out;
}

.tile-name-active {
  color: currentColor;
}

.tile-name-speaking {
  animation: soundwave 1.5s ease-out infinite;
  border-color: #8b5cf6;
}

.tile-name-muted {
  opacity: 0.2;
  border-color: rgba(81, 73, 229, 0.3);
}

.tile-avatar {
  border-radius: 999px;
  aspect-ratio: 1;
  width: 32px;
  height: 32px;
  object-fit: cover;
  border: 2px solid #5149e5;
  position: relative;
  transition: box-shadow 0.3s ease-out, border-color 0.3s ease-out;
}

.tile-avatar-active {
  opacity: 1;
}

.tile-avatar-speaking {
  animation: soundwave 1.5s ease-out infinite;
  border-color: #8b5cf6;
}

.tile-avatar-muted {
  opacity: 0.2;
  border-color: rgba(81, 73, 229, 0.3);
}

.error {
  text-align: center;
  font-size: 0.8rem;
  color: tomato;
  opacity: 0.9;
}

audio {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 13, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
}

.modal {
  width: min(400px, 92vw);
  background: #0f1322;
  border: 1px solid rgba(71, 86, 105, 0.3);
  box-shadow: 0 12px 32px rgba(5, 7, 13, 0.45);
  border-radius: 1rem;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.04em;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-form-input-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.modal-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(71, 86, 105, 0.45);
  background: rgba(15, 19, 34, 0.85);
  color: #d0e0ff;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.modal-input:focus {
  border-color: #5149e5;
}

.modal-actions {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

svg {
  display: block;
  outline: none;
  color: #5149e5;
}

.modal-button {
  flex: 1 1 auto;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: none;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease,
    color 0.18s ease;
}

.modal-button.primary {
  background: #5149e5;
  color: #f4f8ff;
  width: fit-content;
}

.modal-button.primary:hover {
  background: #635aff;
}

.modal-button.secondary {
  background: rgba(71, 86, 105, 0.35);
  color: rgba(208, 224, 255, 0.9);
}

.modal-button.secondary:hover {
  background: rgba(99, 115, 135, 0.45);
}

.modal-button:disabled {
  cursor: default;
  opacity: 0.6;
  transform: none;
}

.muted-indicator {
  opacity: .2;
}

.invite-button {
  padding: 0.5rem 1.5rem;
  border-radius: 999px;
  border: 1px solid rgba(71, 86, 105, 0.45);
  background: rgba(15, 19, 34, 0.85);
  color: #d0e0ff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.invite-button:hover {
  background: rgba(81, 73, 229, 0.2);
  border-color: #5149e5;
}
