:root {
  --font-size: 8vw;
  --bg: #000000;
  --fg: #ffffff;
  --fg-dim: #8a8a8a;
  --accent: #ffd54a;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#app {
  height: 100dvh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#history {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  gap: 0.4em;
  padding: 1rem 1.2rem 0;
  scrollbar-width: none;
  width: 100%;
  max-width: 1400px;
  margin-inline: auto;
}
#history::-webkit-scrollbar {
  display: none;
}
#history p {
  margin: 0;
  font-size: clamp(1rem, calc(var(--font-size) * 0.55), 3.3rem);
  line-height: 1.3;
  color: var(--fg-dim);
  font-weight: 500;
}
#history p.new-turn {
  margin-top: 0.9em;
  padding-top: 0.7em;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

#live {
  flex: 0 0 auto;
  width: 100%;
  max-width: 1400px;
  margin-inline: auto;
  padding: 0.6rem 1.2rem calc(1.4rem + env(safe-area-inset-bottom));
  font-size: clamp(1.75rem, var(--font-size), 6rem);
  line-height: 1.25;
  font-weight: 700;
  color: var(--fg);
  min-height: 1.6em;
  word-wrap: break-word;
}
#live:empty::after {
  content: "Ouvindo…";
  color: var(--fg-dim);
  font-weight: 400;
}

#start-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
  padding: 2rem;
  background: var(--bg);
}
#start-screen h1 {
  font-size: 3rem;
  margin: 0;
  letter-spacing: 0.03em;
}
#start-screen p {
  color: var(--fg-dim);
  font-size: 1.1rem;
  max-width: 30ch;
  margin: 0;
}
#start-btn {
  margin-top: 1rem;
  font-size: 1.3rem;
  font-weight: 700;
  padding: 1rem 2rem;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #000;
  cursor: pointer;
}
#start-btn:active {
  transform: scale(0.97);
}
.error {
  color: #ff6b6b;
  font-size: 0.95rem;
  max-width: 32ch;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.75);
}
.modal-content {
  background: #111111;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 36ch;
  max-height: 80vh;
  overflow-y: auto;
  text-align: center;
}
.modal-content h2 {
  margin: 0 0 0.6rem;
  color: var(--accent);
}
.modal-content p {
  color: var(--fg-dim);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 0.8rem;
}
.modal-content a {
  color: var(--fg);
}
.modal-content button {
  margin-top: 0.6rem;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: var(--fg);
  cursor: pointer;
}
.modal-content button:active {
  background: rgba(255, 255, 255, 0.24);
}

#top-bar {
  position: fixed;
  top: env(safe-area-inset-top);
  right: env(safe-area-inset-right);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem;
}
#controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
#top-bar button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg);
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.95rem;
  line-height: 1;
}
#top-bar button:active {
  background: rgba(255, 255, 255, 0.2);
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff6b6b;
  margin-left: 0.2rem;
}
.status-dot.live {
  background: #4ade80;
}

[hidden] {
  display: none !important;
}
