/* =========================================================
   Olympiades 2026 — Styles
   Thème sombre, sobre, responsive (desktop = 2 colonnes,
   mobile = colonne unique avec les contrôles en haut).
   ========================================================= */

:root {
  --bg: #12141a;
  --panel-bg: #1a1d26;
  --field-bg: #22252f;
  --border: #2e3240;
  --text: #edeef1;
  --text-muted: #9aa0ad;
  --accent: #e3b23c;
  --accent-hover: #f0c25a;
  --danger: #e05a5a;
  --danger-bg: #3a2226;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* jamais de débordement horizontal */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

/* ===================== LAYOUT GENERAL ===================== */

.app {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ===================== PANNEAU DE CONTROLE ===================== */

.panel {
  flex: 0 0 340px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: sticky;
  top: 24px;
}

.panel__title {
  margin: 0 0 6px;
  font-size: 1.6rem;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.panel__subtitle {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.panel__hint {
  margin-top: 18px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.field {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

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

select {
  background: var(--field-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
}

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

.file-name {
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
}

/* ===================== BOUTONS ===================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
  text-align: center;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--accent);
  color: #1a1305;
  flex: 1;
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--secondary {
  background: var(--field-bg);
  color: var(--text);
  border: 1px solid var(--border);
  flex: 1;
}

.btn--secondary:hover {
  background: #2a2e3a;
}

.btn--file {
  background: var(--field-bg);
  color: var(--text);
  border: 1px dashed var(--border);
  width: 100%;
}

.btn--file:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===================== STATUS / ERREURS ===================== */

.status {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: #ffb3b3;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.82rem;
  margin-bottom: 18px;
  line-height: 1.4;
}

.status--info {
  background: #20303a;
  border-color: #3a6a82;
  color: #a9d6ea;
}

/* ===================== APERÇU ===================== */

.preview {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0; /* évite l'overflow flex */
}

.preview__frame {
  width: 100%;
  max-width: 640px; /* aperçu limité, pas plein écran */
}

#stage {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 1402 / 1122;
  background: #000;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  cursor: grab;
  touch-action: none; /* on gère nous-mêmes le pan tactile */
}

#stage:active {
  cursor: grabbing;
}

/* Boutons sous l'aperçu : n'apparaissent qu'une fois une photo ajoutée */
.actions {
  width: 100%;
  max-width: 640px;
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.actions .btn {
  flex: 1;
}

.actions[hidden] {
  display: none;
}

/* ===================== RESPONSIVE ===================== */

@media (max-width: 900px) {
  .app {
    flex-direction: column;
    padding: 16px;
    gap: 20px;
  }

  .panel {
    flex: 1 1 auto;
    width: 100%;
    position: static;
  }

  .preview {
    width: 100%;
  }

  .preview__frame {
    max-width: 100%;
  }
}
