/* ===== Font laden ===== */
@font-face {
  font-family: "FormantVF";
  src: url("./fonts/FormantVF.woff2") format("woff2");
  font-display: swap;
}

/* ===== Startwerte für Variable Font ===== */
:root {
  --wght: 0;
  --shape: 0;
  --wdth: 87;
  --text-color: rgb(0, 0, 0); /* Standard: Schwarz */
  --text-align: left; /* Standard: Linksbündig */
  --accent-color: rgb(0, 0, 0); /* Akzentfarbe (gleicht Schriftfarbe) */
  --radio-color: rgb(0, 0, 0); /* Farbe für Radio-Buttons */
}

/* ===== Grundlayout ===== */
body {
  font-family: system-ui, sans-serif;
  padding: 24px;
  max-width: 1400px;
  position: relative;
}

.header-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
  position: relative;
}

h1 {
  color: var(--accent-color);
  font-family: "FormantVF", system-ui, sans-serif;
  font-variation-settings:
    "wght" 53,
    "SHAP" 70,
    "wdth" 137;
  margin: 0;
  font-size: 32pt;
}

.mode-btn {
  padding: 12px 16px 4px 16px;
  font-size: 14px;
  border: 1pt solid var(--accent-color);
  background: white;
  color: var(--accent-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "FormantVF", system-ui, sans-serif;
  font-variation-settings:
    "wght" 54,
    "SHAP" 47,
    "wdth" 88;
  pointer-events: auto;
  position: relative;
  z-index: 10;
}

.mode-btn:hover {
  background: var(--accent-color);
  color: white;
}

.mode-btn.active {
  background: var(--accent-color);
  color: white;
}

.main-container {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  position: relative;
  margin-top: calc(-32pt - 12px - 50px); /* Überschrift + gap + Button-Höhe (erhöht) */
  padding-top: calc(32pt + 12px + 50px); /* Überschrift + gap + Button-Höhe (erhöht) */
}


.header-section .mode-selection {
  position: relative;
}

.controls-column {
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 0;
}

.sample-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 800px;
}

/* ===== Buttons ===== */
button {
  padding: 10px 20px;
  font-size: 16px;
  border: 1pt solid var(--accent-color);
  background: white;
  color: var(--accent-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: system-ui, sans-serif;
}

#startBtn,
#stopBtn,
#resetBtn {
  font-family: "FormantVF", system-ui, sans-serif;
  font-variation-settings:
    "wght" 67,
    "SHAP" 200,
    "wdth" 86;
}

#startBtn {
  background: var(--accent-color);
  color: white;
  padding-top: 12px;
  padding-bottom: 8px;
}

#startBtn:hover:not(:disabled) {
  background: white;
  color: var(--accent-color);
}

button:hover:not(:disabled) {
  background: var(--accent-color);
  color: white;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #ccc;
  color: #999;
}

/* ===== Slider ===== */
.sliders {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sliders label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.sliders label .slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.sliders label .slider-label {
  text-align: left;
}

.sliders label .slider-value {
  text-align: right;
}

/* Slider Styling mit Akzentfarbe */
.sliders input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  --value: 0%;
}

.sliders input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  border: 1pt solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sliders input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  border: 1pt solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sliders input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--accent-color) 0%, var(--accent-color) var(--value, 0%), #ddd var(--value, 0%), #ddd 100%);
  height: 6px;
  border-radius: 3px;
}

/* ===== Beispieltext ===== */
#sample {
  font-family: "FormantVF", system-ui, sans-serif;
  font-size: 53.33pt; /* 80pt * 2/3 = 53.33pt (um 1/3 verkleinert) */
  line-height: 1.2;
  padding: 16px;
  border: none;
  border-radius: 12px;
  color: var(--text-color);
  text-align: var(--text-align);
}

/* Schriftgröße bei Echtzeit Modus */
body.mode-realtime #sample {
  font-size: 60pt;
}

/* Schriftgröße bei Your Voice Modus */
body.mode-average-freeze #sample {
  font-size: 60pt;
}

/* Schriftgröße im Typo-Karaoke Modus halbieren */
body.mode-karaoke #sample {
  font-size: 26.67pt; /* 40pt * 2/3 = 26.67pt (um 1/3 verkleinert) */
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Abspann-Container für Karaoke-Modus */
body.mode-karaoke .karaoke-scroll-container {
  position: absolute;
  width: 100%;
  animation: scrollKaraoke 90s linear infinite;
  will-change: transform;
}

/* Abspann-Animation - von unten nach oben */
@keyframes scrollKaraoke {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-50%);
  }
}

/* Einzelne Schlagzeile im Karaoke-Modus */
body.mode-karaoke .karaoke-headline {
  margin-bottom: 20px;
  text-align: var(--text-align);
  line-height: 1.5;
  padding: 5px 0;
}

/* ===== Einzelne Zeichen für Welleneffekt ===== */
#sample .char {
  display: inline-block;
  font-variation-settings:
    "wght" var(--wght, var(--wght, 0)),
    "SHAP" var(--shape, var(--shape, 0)),
    "wdth" var(--wdth, var(--wdth, 0));
  transition: font-variation-settings 0.1s ease-out;
}

/* Fallback für #sample wenn keine .char vorhanden */
#sample:not(:has(.char)) {
  font-variation-settings:
    "wght" var(--wght),
    "SHAP" var(--shape),
    "wdth" var(--wdth);
}
body { background: rgb(245, 245, 245); }

textarea {
  padding: 16px;
  font-size: 16px;
  font-family: system-ui, sans-serif;
  border: 1pt solid var(--accent-color);
  border-radius: 12px;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  color: var(--text-color);
}

/* ===== Modus-Auswahl ===== */
.mode-selection {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin: 0;
  justify-content: center;
  position: relative;
  z-index: 20;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  position: relative;
}

.radio-group input[type="radio"] {
  cursor: pointer;
  accent-color: var(--accent-color);
  width: 18px;
  height: 18px;
  position: relative;
  z-index: 1;
}


/* ===== Farbauswahl (rechts oben, vertikal) ===== */
.color-selection-fixed {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  pointer-events: auto;
}

.color-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.color-btn {
  width: 25px;
  height: 25px;
  border: 1pt solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.color-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.color-btn.active {
  border-color: white;
  border-width: 1pt;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.2);
}

/* ===== Textausrichtung ===== */
.alignment-selection {
  margin: 16px 0;
  padding: 0;
  background: transparent;
  border-radius: 8px;
}

.alignment-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
}

.align-btn {
  flex: 1;
  padding: 5px 8px;
  font-size: 10px;
  border: 1pt solid #ddd;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.align-btn:hover {
  background: #f5f5f5;
  border-color: #bbb;
}

.align-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}
