/* ===================================================
   AccessibleAI — Voice-Only Interface
   Cały ekran to przycisk mikrofonu.
   =================================================== */

:root {
  --bg: #0a0e17;
  --surface: #0d1117;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #d4a843;
  --accent-light: #f0c050;
  --accent-dim: rgba(212, 168, 67, 0.12);
  --accent-glow: rgba(212, 168, 67, 0.25);
  --accent-glow-strong: rgba(212, 168, 67, 0.4);
  --danger: #f85149;
  --success: #3fb950;
  --font: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* === LAYOUT === */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: relative;
}

/* === STATUS BAR === */
#status-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10;
  pointer-events: none;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.status-dot.offline { background: var(--danger); }
.status-dot.busy { background: var(--accent); animation: pulse-dot 1s ease-in-out infinite; }
.status-dot.listening { background: var(--accent-light); animation: pulse-dot 0.6s ease-in-out infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* === RESPONSE AREA === */
#response-area {
  position: absolute;
  top: 3rem;
  left: 0;
  right: 0;
  bottom: 40%;
  padding: 1.5rem;
  overflow-y: auto;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
}

#response-text {
  font-size: 1.25rem;
  line-height: 1.7;
  color: var(--text);
  max-height: 100%;
  overflow-y: auto;
  pointer-events: auto;
}

/* === TALK BUTTON — CAŁY DOLNY EKRAN === */
#talk-btn {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 55%;
  background: linear-gradient(180deg, transparent 0%, var(--accent-dim) 30%, rgba(212, 168, 67, 0.08) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 1;
  transition: background 0.3s;
  -webkit-tap-highlight-color: transparent;
}

#talk-btn:active {
  background: linear-gradient(180deg, transparent 0%, rgba(212, 168, 67, 0.2) 30%, rgba(212, 168, 67, 0.15) 100%);
}

.talk-icon {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 40px var(--accent-glow-strong), 0 0 80px var(--accent-dim);
  transition: transform 0.2s, box-shadow 0.3s;
}

#talk-btn:active .talk-icon {
  transform: scale(0.95);
}

.talk-icon svg {
  width: 48px;
  height: 48px;
  stroke: var(--bg);
  stroke-width: 2;
  fill: none;
}

#talk-label {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  font-family: var(--font);
}

/* === ACTIVE / LISTENING STATE === */
#talk-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, transparent 0%, rgba(212, 168, 67, 0.25) 30%, rgba(212, 168, 67, 0.2) 100%);
}

#talk-btn[aria-pressed="true"] .talk-icon {
  background: var(--accent-light);
  transform: scale(1.1);
  box-shadow: 0 4px 60px var(--accent-glow-strong), 0 0 120px var(--accent-glow);
}

#talk-btn[aria-pressed="true"] .talk-icon::before,
#talk-btn[aria-pressed="true"] .talk-icon::after {
  content: '';
  position: absolute;
  inset: -15px;
  border-radius: 50%;
  border: 2px solid rgba(212, 168, 67, 0.5);
  animation: mic-pulse 1.6s ease-out infinite;
  pointer-events: none;
}
#talk-btn[aria-pressed="true"] .talk-icon::after {
  inset: -8px;
  animation-delay: 0.5s;
}

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

#talk-btn[aria-pressed="true"] #talk-label {
  color: var(--accent-light);
}

/* === THINKING STATE === */
#app.thinking #talk-label {
  animation: thinking-dots 1.5s ease-in-out infinite;
}
@keyframes thinking-dots {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

#app.thinking .talk-icon {
  animation: thinking-pulse 2s ease-in-out infinite;
}
@keyframes thinking-pulse {
  0%, 100% { box-shadow: 0 4px 40px var(--accent-glow), 0 0 80px var(--accent-dim); }
  50% { box-shadow: 0 4px 60px var(--accent-glow-strong), 0 0 120px var(--accent-glow); }
}

/* === SPEAKING STATE === */
#app.speaking .talk-icon {
  background: var(--accent);
  box-shadow: 0 4px 50px var(--accent-glow-strong), 0 0 100px var(--accent-glow);
}

/* === RESPONSIVE === */
@media (max-height: 500px) {
  .talk-icon { width: 80px; height: 80px; }
  .talk-icon svg { width: 32px; height: 32px; }
  #talk-btn { height: 50%; }
  #response-area { bottom: 50%; }
  #response-text { font-size: 1rem; }
}

@media (min-height: 800px) {
  .talk-icon { width: 140px; height: 140px; }
  .talk-icon svg { width: 56px; height: 56px; }
  #response-text { font-size: 1.375rem; }
}

/* === HIGH CONTRAST === */
@media (prefers-contrast: high) {
  :root {
    --text: #fff;
    --bg: #000;
    --surface: #000;
  }
  .talk-icon { border: 4px solid #fff; }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
