/* Grila Live — B&W aesthetic */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0a;
  color: #e0e0e0;
  height: 100vh;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px;
}

/* Balance display */
#balance-display {
  text-align: right;
  padding: 8px 0;
}

#balance-time {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: #888;
  transition: color 0.3s;
}

#balance-time.low {
  color: #ff4444;
}

/* Main area */
#main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

/* Status text */
#status-text {
  font-size: 16px;
  color: #888;
  text-align: center;
  min-height: 24px;
  transition: opacity 0.3s;
}

/* Button wrapper with canvas */
#btn-wrapper {
  position: relative;
  width: 260px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#audio-viz {
  position: absolute;
  inset: 0;
  width: 260px;
  height: 260px;
  pointer-events: none;
}

/* Voice button */
#voice-btn {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 3px solid #333;
  background: #111;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.3s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

#voice-btn:hover {
  border-color: #555;
}

#voice-btn:active {
  transform: scale(0.95);
}

#voice-btn.active {
  border-color: #fff;
}

#voice-btn.speaking {
  border-color: #ccc;
}

/* Avatar */
#avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 0.5s;
}

#voice-btn.active #avatar {
  filter: grayscale(0%);
}

/* Pulse ring animation */
#pulse-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  opacity: 0;
  pointer-events: none;
}

#voice-btn.listening #pulse-ring {
  animation: pulse 2s ease-out infinite;
}

#voice-btn.speaking #pulse-ring {
  animation: pulse-speak 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

@keyframes pulse-speak {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.6;
  }
}

/* Transcript area */
#transcript-area {
  width: 100%;
  max-height: 30vh;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

#transcript-content {
  font-size: 14px;
  line-height: 1.6;
  color: #999;
}

#transcript-content .model {
  color: #ccc;
}

#transcript-content .entry {
  margin-bottom: 8px;
  padding: 4px 0;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* End button */
#end-btn {
  width: 100%;
  padding: 14px;
  border: 1px solid #ff4444;
  border-radius: 12px;
  background: transparent;
  color: #ff4444;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: env(safe-area-inset-bottom, 0);
}

#end-btn:hover {
  background: rgba(255, 68, 68, 0.1);
}

#end-btn.hidden {
  display: none;
}

/* Connection states */
.state-connecting #status-text { color: #888; }
.state-listening #status-text { color: #aaa; }
.state-speaking #status-text { color: #fff; }
.state-searching #status-text { color: #888; font-style: italic; }
.state-error #status-text { color: #ff4444; }
