/* Mon Petit Prompteur — styles globaux */
/* Thème sombre unique pour l'interface de l'appli (accueil, configuration, prompteur). */

:root {
  --bg: #111111;
  --text: #ffffff;
  --surface: #1c1c1c;
  --surface-2: #262626;
  --border: #3a3a3a;
  --muted: #a0a0a0;
  --accent: #ffcc00;
  --accent-text: #111111;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
}

.view {
  min-height: 100vh;
}

/* --- Boutons --- */

.btn {
  font: inherit;
  font-weight: 600;
  padding: 0.75em 1.5em;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
}

/* --- Écran d'accueil --- */

.home {
  max-width: 40rem;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  text-align: center;
}

.home__icon {
  display: block;
  margin: 0 auto 1.25rem;
  border-radius: 20%;
}

.home__title {
  margin-bottom: 0.5rem;
}

.home__lead {
  color: var(--muted);
  margin-bottom: 2rem;
}

.home__install {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  text-align: left;
}

.home__install p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9em;
}

.home__privacy {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  text-align: left;
}

.home__privacy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9em;
}

/* --- Écran de configuration --- */

.setup {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.5rem;
}

.setup__title {
  margin-top: 0;
}

.setup__body {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.setup__script {
  flex: 1 1 20rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.setup__script textarea {
  flex: 1;
  min-height: 16rem;
  resize: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  font: inherit;
  line-height: 1.4;
}

.setup__settings {
  flex: 1 1 18rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.setup__group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.setup__group legend {
  padding: 0 0.4em;
  color: var(--muted);
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field--inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.field label {
  color: var(--text);
}

.field__value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.field select,
.field input[type="range"] {
  width: 100%;
}

.field select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5em;
  font: inherit;
}

.field input[type="color"] {
  width: 3rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  flex: none;
}

.field--inline label {
  flex: 1;
}

.field input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--accent);
  flex: none;
}

.field input[type="range"] {
  accent-color: var(--accent);
}

.field input[type="range"]:disabled {
  opacity: 0.4;
}

.setup__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* --- Modale de confirmation (réinitialisation des réglages) --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 30;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 24rem;
  width: 100%;
}

.modal__message {
  margin: 0 0 1.25rem;
  color: var(--text);
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* --- Écran prompteur --- */

.prompter {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000000;
}

.prompter__viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent calc(var(--guide-pos, 50%) / 2), black var(--guide-pos, 50%), black 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, transparent calc(var(--guide-pos, 50%) / 2), black var(--guide-pos, 50%), black 100%);
}

.prompter__viewport.is-mirror {
  transform: scaleX(-1);
}

.prompter__text {
  position: absolute;
  left: 0;
  right: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  will-change: transform;
}

.prompter__guide {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 3px dashed rgba(255, 40, 40, 0.7);
  pointer-events: none;
  z-index: 5;
}

.prompter__countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  color: var(--accent);
  font-size: 30vh;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  z-index: 20;
  pointer-events: none;
}

/* Une règle d'auteur qui fixe `display` (ici `flex` ci-dessus) l'emporte
   toujours sur la règle par défaut du navigateur `[hidden] { display: none }`,
   même à spécificité égale (l'origine "auteur" prime sur l'origine
   "user-agent"). Sans cette règle explicite, poser l'attribut `hidden` en JS
   (voir clearCountdown() dans js/app.js) n'a donc aucun effet visuel : le
   dernier chiffre du décompte reste affiché à l'écran indéfiniment. */
.prompter__countdown[hidden] {
  display: none;
}

.prompter__controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10;
}

.prompter-btn {
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.prompter-btn--primary {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.6rem;
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.prompter-btn--small {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.3rem;
}

.prompter__speed {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  padding: 0 0.5rem;
}

.prompter__speed-value {
  min-width: 1.5em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
