:root {
  /* Jack of All Voices Color Palette */
  --bg-dark: #0b0f19;
  --panel-bg: rgba(18, 26, 43, 0.75);
  --accent-cyan: #00f0ff;
  --accent-blue: #0066ff;
  --accent-gold: #ffb703;
  --text-main: #f0f4f8;
  --text-muted: rgba(240, 244, 248, 0.55);
  --border-light: rgba(0, 240, 255, 0.15);
  --shadow-glow: 0 0 20px rgba(0, 240, 255, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Roboto', 'Segoe UI', -apple-system, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  height: -webkit-fill-available;
  overflow: hidden;
  overscroll-behavior: none;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-dark);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(0, 102, 255, 0.12) 0%, transparent 70%),
    radial-gradient(circle at 80% 100%, rgba(0, 240, 255, 0.05) 0%, transparent 50%);
}

.container {
  height: 100dvh;
  width: 100%;
  max-width: 900px;
  padding: 24px 20px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px; /* Even 14px spacing between all top controls */
  box-sizing: border-box;
}

/* Header & Titles */
h1 {
  font-size: 1.8rem;
  font-weight: 200;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #2f47ff 30%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: var(--shadow-glow);
  text-align: center;
}

/* Centered Control Buttons Row */
.controls-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 420px; /* Keeps buttons constrained and centered */
  margin: 0 auto;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 8px 16px; /* Slimmer vertical height */
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.controls-row button {
  flex: 1; /* Equal button widths */
}

/* Fixed: Matches JS ID `toggleViewBtn` */
#toggleViewBtn {
  background: linear-gradient(135deg, var(--accent-blue), #0040b3);
  color: #ffffff;
  border: 1px solid rgba(0, 240, 255, 0.25);
  box-shadow: 0 3px 10px rgba(0, 102, 255, 0.25);
}

#toggleViewBtn:hover {
  background: linear-gradient(135deg, #0073ff, var(--accent-blue));
  box-shadow: 0 4px 15px rgba(0, 102, 255, 0.4);
  transform: translateY(-1px);
}

/* Start / Pause Button - Initial State (Light Blue to Cyan) */
#startBtn {
  background: linear-gradient(135deg, #00d2ff, var(--accent-cyan));
  color: #0b0f19;
  font-weight: 700;
  border: 1px solid rgba(0, 240, 255, 0.4);
  box-shadow: 0 3px 10px rgba(0, 240, 255, 0.3);
}

/* Start / Pause Button - Flipped State when scrolling */
#startBtn.active {
  background: linear-gradient(135deg, var(--accent-cyan), #0088ff);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

#startBtn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

/* Speed Control Row */
#speedControl {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  font-size: 0.85rem;
  color: var(--text-muted);
}

input[type="range"] {
  accent-color: var(--accent-cyan);
  cursor: pointer;
  width: 160px;
}

/* Metrics Bar - Slimmed and Centered */
#metricsBar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  /* padding: 6px 16px;  */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.metric-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.metric-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

/* Dynamic Flex Box for Text Area & Prompter Container */
#scriptInput,
#prompterContainer {
  flex: 1;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: rgba(5, 8, 15, 0.95);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

#scriptInput {
  background: var(--panel-bg);
  color: var(--text-main);
  font-size: 1.1rem;
  line-height: 1.6;
  resize: none;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#scriptInput:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

#prompterText {
  font-size: 1.5rem;
  line-height: 1.8;
  color: #ffffff;
  font-weight: 500;
}

/* Hidden Utility */
.hidden {
  display: none !important;
}

/* Footer Accent */
footer {
  text-align: center;
  padding-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}