/* ── AMBIENT GLOW ── */
.ttv-ambient {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.ttv-ambient::before {
  content: '';
  position: absolute; top: -20%; left: -5%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,0,127,0.05) 0%, transparent 70%);
  border-radius: 50%;
  animation: ttvDrift1 18s ease-in-out infinite alternate;
}
.ttv-ambient::after {
  content: '';
  position: absolute; bottom: -20%; right: -5%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,238,252,0.04) 0%, transparent 70%);
  border-radius: 50%;
  animation: ttvDrift2 22s ease-in-out infinite alternate;
}
@keyframes ttvDrift1 { from { transform: translate(0,0); } to { transform: translate(60px,40px); } }
@keyframes ttvDrift2 { from { transform: translate(0,0); } to { transform: translate(-50px,-60px); } }

/* ── BODY & WRAPPER ── */
body {
  font-family: 'Space Grotesk', sans-serif;
  padding-top: 72px;
  min-height: 100vh;
}

.ttv-wrap {
  width: 90%;
  max-width: 680px;
  margin: 2rem auto 4rem;
  position: relative;
  z-index: 1;
}

/* ── PAGE TITLE ── */
.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  color: var(--on-surface, #f8f5fd);
  margin: 0 0 0.4rem;
}

.gradient-text {
  background: linear-gradient(90deg, #FF007F, #00eefc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(255,0,127,0.3));
}

.ttv-description {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(248,245,253,0.4);
  margin: 0 0 1.75rem;
}

/* ── CARD ── */
.ttv-card {
  background: rgba(37,37,44,0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ttv-panel-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(248,245,253,0.35);
}

/* ── TEXTAREA ── */
#textInput {
  width: 100%;
  min-height: 200px;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 0.6rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.88rem;
  line-height: 1.65;
  resize: vertical;
  box-sizing: border-box;
  background: rgba(14,14,19,0.6);
  color: var(--on-surface, #f8f5fd);
  outline: none;
  transition: border-color 0.2s;
}
#textInput:focus { border-color: rgba(255,0,127,0.4); }
#textInput::placeholder { color: rgba(248,245,253,0.2); }

/* ── META ROW ── */
.ttv-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(248,245,253,0.35);
  letter-spacing: 0.04em;
}

/* ── CONTROLS ── */
.ttv-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.ttv-select-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 0;
}

.ttv-select-group label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(248,245,253,0.35);
}

.ttv-select-group select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: rgba(14,14,19,0.6);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.5rem;
  color: var(--on-surface, #f8f5fd);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(248,245,253,0.3)' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 2rem;
  box-sizing: border-box;
}
.ttv-select-group select:focus { border-color: rgba(255,0,127,0.4); }
.ttv-select-group select option { background: #1a1a22; color: #f8f5fd; }

/* ── BUTTONS ── */
.ttv-buttons {
  display: flex;
  gap: 0.6rem;
}

.ttv-buttons button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.6rem 0.8rem;
  border: none;
  border-radius: 9999px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}
.ttv-buttons button .material-symbols-outlined { font-size: 1rem; }
.ttv-buttons button:disabled { opacity: 0.4; cursor: not-allowed; }

#startSpeech {
  background: linear-gradient(135deg, #FF007F, #cc0066);
  color: #fff;
  box-shadow: 0 0 20px rgba(255,0,127,0.3);
}
#startSpeech:not(:disabled):hover { transform: scale(1.02); box-shadow: 0 0 28px rgba(255,0,127,0.45); }
#startSpeech:active { transform: scale(0.98); }

#pauseSpeech {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(248,245,253,0.7);
}
#pauseSpeech:hover { border-color: rgba(255,255,255,0.2); color: #f8f5fd; }

#stopSpeech {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(248,245,253,0.5);
}
#stopSpeech:hover { border-color: rgba(255,0,127,0.3); color: rgba(248,245,253,0.8); }

/* ── TIME REMAINING ── */
.ttv-time-remaining {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(248,245,253,0.35);
  letter-spacing: 0.04em;
  min-height: 1em;
  margin: 0;
}

/* ── SUBTITLE ── */
.ttv-subtitle {
  margin-top: 1.25rem;
  padding: 1.25rem 1.5rem;
  background: rgba(0,238,252,0.04);
  border: 1px solid rgba(0,238,252,0.12);
  border-radius: 0.75rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(248,245,253,0.85);
  display: none;
  word-break: break-word;
  position: relative;
  z-index: 1;
}
.ttv-subtitle:not(:empty) { display: block; }

.ttv-subtitle span.highlight {
  background: rgba(255,0,127,0.25);
  color: #fff;
  border-radius: 3px;
  padding: 0 2px;
}

/* ── RESPONSIVE ── */
@media (max-width: 520px) {
  .ttv-controls { flex-direction: column; }
  .ttv-buttons { flex-wrap: wrap; }
}
