:root {
  --bg: #070a14;
  --bg-soft: #0f1528;
  --panel: rgba(12, 17, 33, 0.9);
  --line: rgba(88, 116, 173, 0.45);
  --line-strong: rgba(103, 132, 190, 0.5);
  --text: #ecf3ff;
  --muted: #9db0d6;
  --accent: #32d2ff;
  --accent-2: #8dff6a;
  --danger: #ff6f6f;
}

* { box-sizing: border-box; }

html,
body {
  overscroll-behavior-y: none;
  background-color: #070a14;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -15%;
  pointer-events: none;
  z-index: 0;
}

/* Safari iOS memory guard: reduce heavy compositing layers */
@media (max-width: 900px) {
  body::before,
  body::after,
  .bg-glow {
    display: none !important;
  }

  .app-header,
  .panel,
  .site-footer,
  .lang-global {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

/* Fumee animée */
body::before {
  background:
    radial-gradient(52% 38% at 18% 62%, rgba(170, 210, 255, 0.10), transparent 70%),
    radial-gradient(44% 32% at 82% 38%, rgba(214, 198, 255, 0.10), transparent 72%),
    radial-gradient(40% 30% at 56% 78%, rgba(152, 182, 255, 0.09), transparent 74%);
  filter: blur(30px) saturate(128%);
  opacity: 0.68;
  animation: smokeDrift 18s linear infinite;
}

/* Spots mobiles style club */
body::after {
  background:
    radial-gradient(38% 52% at 12% -8%, rgba(76, 176, 255, 0.20), transparent 72%),
    radial-gradient(34% 48% at 88% -10%, rgba(255, 110, 188, 0.16), transparent 72%),
    radial-gradient(32% 46% at 48% -14%, rgba(146, 255, 168, 0.14), transparent 72%);
  mix-blend-mode: screen;
  filter: blur(12px) saturate(142%);
  opacity: 0.72;
  animation: spotSweep 9s linear infinite;
}

@keyframes bgTravel {
  0% { background-position: 0% 0%, 100% 0%, 50% 50%; }
  25% { background-position: 18% 10%, 84% 14%, 44% 62%; }
  50% { background-position: 30% 24%, 72% 26%, 60% 66%; }
  75% { background-position: 14% 16%, 88% 12%, 48% 58%; }
  100% { background-position: 0% 0%, 100% 0%, 50% 50%; }
}

body {
  overscroll-behavior-y: none;
  margin: 0;
  position: relative;
  overflow-x: hidden;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(900px 500px at 0% 0%, #193666, transparent 55%),
              radial-gradient(800px 500px at 100% 0%, #4c2450, transparent 55%),
              linear-gradient(160deg, var(--bg), var(--bg-soft));
  background-size: 160% 160%, 170% 170%, 120% 120%;
  background-position: 0% 0%, 100% 0%, 50% 50%;
  animation: bgTravel 14s linear infinite;
  min-height: 100vh;
}

.bg-glow {
  position: fixed;
  width: 36vw;
  height: 36vw;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.24;
  pointer-events: none;
  animation: glowTravel 8s linear infinite;
}

.bg-glow-a { top: -12vw; left: -12vw; background: var(--accent); }
.bg-glow-b { right: -12vw; bottom: -12vw; background: var(--accent-2); animation-delay: 1.5s; }

@keyframes smokeDrift {
  0% { transform: translate3d(-6%, 2%, 0) scale(1.00); }
  25% { transform: translate3d(5%, -3%, 0) scale(1.08); }
  50% { transform: translate3d(7%, 4%, 0) scale(1.16); }
  75% { transform: translate3d(-4%, 2%, 0) scale(1.08); }
  100% { transform: translate3d(-6%, 2%, 0) scale(1.00); }
}

@keyframes spotSweep {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); opacity: 0.66; }
  25% { transform: translate3d(3.4%, -2.5%, 0) rotate(2.1deg) scale(1.12); opacity: 0.86; }
  50% { transform: translate3d(-3.2%, 2.8%, 0) rotate(-2.4deg) scale(0.94); opacity: 0.72; }
  75% { transform: translate3d(2.2%, -1.6%, 0) rotate(1.2deg) scale(1.06); opacity: 0.82; }
  100% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); opacity: 0.66; }
}

@keyframes glowTravel {
  0% { transform: translate3d(0, 0, 0) scale(0.92); opacity: 0.18; }
  25% { transform: translate3d(28px, -18px, 0) scale(1.06); opacity: 0.34; }
  50% { transform: translate3d(-24px, 22px, 0) scale(1.14); opacity: 0.38; }
  75% { transform: translate3d(16px, -12px, 0) scale(1.02); opacity: 0.28; }
  100% { transform: translate3d(0, 0, 0) scale(0.92); opacity: 0.18; }
}

.reveal { animation: fadeUp 0.7s ease both; }
.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.16s; }
.delay-3 { animation-delay: 0.24s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-header,
.vibe-ticker,
.site-footer {
  width: min(1440px, 96vw);
  margin-left: auto;
  margin-right: auto;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(10, 16, 30, 0.78);
  position: relative;
  z-index: 2;
}

.lang-global {
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 120;
  padding: 8px 10px;
  border: 1px solid rgba(104, 139, 205, 0.5);
  border-radius: 12px;
  background: rgba(7, 13, 26, 0.86);
  backdrop-filter: blur(10px);
}

.app-header {
  position: relative;
  z-index: 10;
  margin-top: 58px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  padding: 18px 22px;
  backdrop-filter: blur(8px);
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.2vw, 2.7rem);
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.header-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.header-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  color: #d5e6ff;
}

.header-note {
  max-width: 320px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(14, 22, 40, 0.76);
}

.header-note strong {
  display: block;
  color: var(--accent-2);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.header-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.suite-switch {
  margin-top: 14px;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border-radius: 13px;
  border: 1px solid rgba(99, 132, 192, 0.48);
  background: rgba(10, 18, 34, 0.72);
}

.suite-switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: #d7e9ff;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(15, 26, 48, 0.82);
}

.suite-switch-btn:hover {
  border-color: rgba(127, 170, 245, 0.62);
}

.suite-switch-btn.is-active {
  background: linear-gradient(130deg, rgba(47, 92, 168, 0.86), rgba(30, 63, 120, 0.9));
  border-color: rgba(141, 191, 255, 0.64);
  color: #f4fbff;
}

.vibe-ticker {
  width: min(1440px, 96vw);
  margin: 0 auto;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 26, 0.65);
  border-radius: 12px;
}

.ticker-track {
  display: flex;
  gap: 28px;
  white-space: nowrap;
  padding: 10px 16px;
  animation: tickerMove 24s linear infinite;
  color: #d2e3ff;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.73rem;
}

@keyframes tickerMove {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.layout {
  position: relative;
  z-index: 2;
  width: min(1440px, 96vw);
  margin: 18px auto 22px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: var(--panel);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.33);
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 1.16rem;
}

.intro-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.intro-cards article {
  border: 1px solid rgba(105, 135, 196, 0.35);
  border-radius: 11px;
  background: rgba(12, 19, 34, 0.72);
  padding: 10px;
}

.intro-cards h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.intro-cards p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.step {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed rgba(117, 142, 194, 0.38);
}

.step:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.step-index {
  width: 38px;
  height: 38px;
  margin: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-weight: 700;
  background: rgba(24, 35, 60, 0.75);
}

.step-body h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.step-body p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-btn {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(140deg, rgba(19, 28, 50, 0.95), rgba(11, 17, 31, 0.95));
  color: var(--text);
  padding: 10px;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.action-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.action-btn span {
  display: block;
  font-weight: 700;
}

.action-btn small {
  color: var(--muted);
}

.action-btn.on {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px rgba(130, 255, 105, 0.25);
}

.selected-actions {
  margin: 10px 0 8px;
  font-size: 0.88rem;
  color: #d7e4ff;
}

.rules {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.86rem;
}

.dropzone {
  position: relative;
  display: block;
  border: 1px dashed rgba(105, 145, 214, 0.75);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  background: rgba(10, 16, 30, 0.8);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.dropzone span {
  display: block;
  font-weight: 700;
}

.dropzone small {
  color: var(--muted);
}

.dropzone.drag {
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 1px var(--accent-2);
}

.list-head {
  margin: 10px 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-ghost {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 6px 10px;
  cursor: pointer;
}

.file-list,
.result-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.file-list li button {
  margin-left: 8px;
  border: 1px solid rgba(255, 111, 111, 0.55);
  border-radius: 6px;
  background: rgba(255, 111, 111, 0.13);
  color: #ffcfcf;
  cursor: pointer;
}

.empty { color: var(--muted); }

.option-group {
  border: 1px solid rgba(95, 123, 183, 0.35);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: rgba(11, 17, 31, 0.6);
}

.option-group h4 {
  margin: 0 0 8px;
  font-size: 0.92rem;
}

.option-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-row label {
  display: grid;
  gap: 4px;
  margin-bottom: 0;
}

select,
input[type="text"] {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: rgba(14, 23, 42, 0.9);
  color: var(--text);
}

.btn-run {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  background: linear-gradient(96deg, var(--accent), #6ca6ff 50%, var(--accent-2));
  color: #05101f;
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  transition: transform 0.16s ease;
}

.btn-run:hover {
  transform: translateY(-1px);
}

.btn-run:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.monitor-intro {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-grid article {
  border: 1px solid rgba(95, 123, 183, 0.35);
  border-radius: 10px;
  padding: 8px;
  background: rgba(11, 17, 31, 0.6);
}

.stat-grid p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.stat-grid strong {
  margin-top: 4px;
  display: block;
  font-size: 0.95rem;
  word-break: break-word;
}

.progress {
  margin: 12px 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
}

.results {
  margin-top: 14px;
  border: 1px solid rgba(95, 123, 183, 0.35);
  border-radius: 12px;
  padding: 10px;
  background: rgba(11, 17, 31, 0.62);
}

.results-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.results-head h3,
.help h3 { margin: 0; }

.results-head p { margin: 0; color: var(--muted); }

.failures {
  margin: 10px 0;
  border: 1px solid rgba(255, 111, 111, 0.55);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255, 111, 111, 0.12);
  color: #ffd5d5;
}

.help {
  margin-top: 14px;
  border-top: 1px dashed rgba(117, 142, 194, 0.38);
  padding-top: 10px;
}

.help ol {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.site-footer {
  margin-top: 8px;
  margin-bottom: 24px;
  overflow: hidden;
}

.footer-main {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  gap: 16px;
  padding: 18px;
}

.footer-main section {
  border: 1px solid rgba(98, 127, 188, 0.28);
  border-radius: 12px;
  background: rgba(12, 19, 34, 0.72);
  padding: 12px;
}

.footer-main h3,
.footer-main h4 {
  margin: 0 0 8px;
}

.footer-main h3 {
  color: var(--accent);
  font-size: 1.1rem;
}

.footer-main h4 {
  color: #d3e7ff;
  font-size: 0.95rem;
}

.footer-main p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.footer-badge {
  display: inline-block;
  margin-top: 6px;
  border: 1px solid rgba(130, 255, 105, 0.36);
  border-radius: 999px;
  padding: 5px 10px;
  color: #d5ffc7;
  font-size: 0.78rem;
}

.footer-main ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 5px;
  font-size: 0.84rem;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 11px 16px;
  border-top: 1px solid rgba(93, 121, 180, 0.35);
  background: rgba(8, 13, 24, 0.85);
}

.footer-bottom p {
  margin: 0;
  color: #c3d6ff;
  font-size: 0.78rem;
}

@media (max-width: 1150px) {
  .layout { grid-template-columns: 1fr; }
  .intro-cards { grid-template-columns: 1fr; }
  .footer-main { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .app-header {
    padding: 14px;
    margin-top: 62px;
    align-items: flex-start;
    flex-direction: column;
  }

  .header-note {
    max-width: 100%;
    width: 100%;
  }

  .suite-switch {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .vibe-ticker {
    border-radius: 10px;
  }

  .ticker-track {
    gap: 18px;
    font-size: 0.68rem;
  }

  .layout {
    gap: 12px;
  }

  .panel {
    padding: 14px;
  }

  .action-grid,
  .field-row,
  .stat-grid,
  .footer-main {
    grid-template-columns: 1fr;
  }

  .site-footer {
    margin-bottom: 16px;
  }

  .footer-main,
  .footer-bottom {
    padding: 12px;
  }

  .lang-global {
    top: 8px;
    right: 8px;
    padding: 6px 8px;
  }

  .lang-switch span {
    display: none;
  }
}

/* Shared language switch */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.lang-switch span {
  color: #b8cff4;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lang-switch select {
  border: 1px solid rgba(120, 152, 214, 0.5);
  border-radius: 10px;
  background: rgba(12, 20, 38, 0.88);
  color: #ecf5ff;
  font-size: 0.8rem;
  padding: 5px 8px;
}


.theme-toggle-btn {
  margin-left: 8px;
  border: 1px solid rgba(104, 139, 205, 0.5);
  border-radius: 10px;
  background: rgba(13, 22, 40, 0.9);
  color: #dff0ff;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.theme-toggle-btn:hover {
  border-color: rgba(50, 210, 255, 0.7);
}

body.theme-light {
  --bg: #edf3ff;
  --bg-soft: #f7faff;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(132, 156, 194, 0.42);
  --line-strong: rgba(118, 147, 192, 0.52);
  --text: #0f172a;
  --muted: #4b5d7a;
  --accent: #0ea5e9;
  --accent-2: #16a34a;
  background: radial-gradient(900px 500px at 0% 0%, #dcecff, transparent 58%),
              radial-gradient(800px 500px at 100% 0%, #e5f0ff, transparent 60%),
              linear-gradient(160deg, var(--bg), var(--bg-soft));
}

body.theme-light::before,
body.theme-light::after,
body.theme-light .bg-glow {
  opacity: 0.12;
}

body.theme-light .app-header,
body.theme-light .vibe-ticker,
body.theme-light .site-footer,
body.theme-light .panel,
body.theme-light .lang-global,
body.theme-light .header-note,
body.theme-light .suite-switch,
body.theme-light .option-group,
body.theme-light .dropzone,
body.theme-light .results,
body.theme-light .help,
body.theme-light .file-list li,
body.theme-light .stat-grid article,
body.theme-light .footer-main section,
body.theme-light .footer-bottom {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(132, 156, 194, 0.5);
  color: #0f172a;
}

body.theme-light .subtitle,
body.theme-light .hint,
body.theme-light .monitor-intro,
body.theme-light .header-note p,
body.theme-light .footer-main p,
body.theme-light .footer-main li,
body.theme-light .rules li,
body.theme-light .selected-actions,
body.theme-light .dropzone small {
  color: #475569;
}

body.theme-light .header-tags span,
body.theme-light .suite-switch-btn,
body.theme-light .btn-ghost,
body.theme-light .action-btn,
body.theme-light input,
body.theme-light select,
body.theme-light textarea {
  background: rgba(248, 251, 255, 0.92);
  color: #0f172a;
  border-color: rgba(132, 156, 194, 0.52);
}

body.theme-light .theme-toggle-btn {
  background: rgba(248, 251, 255, 0.95);
  color: #0f172a;
}
