﻿body {
  font-family: system-ui, Arial;
  margin: 0;
  padding: 24px;
  background: #0b1216;
  color: #e7f0f3;
}
.box {
  max-width: 1100px;
  margin: auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 18px;
}
.flex {
  display: flex;
  align-items: center;
  gap: 12px;
}
.row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.btn {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}
.btn:hover {
  border-color: rgba(46, 242, 163, 0.4);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
canvas {
  display: none;
}
.hint {
  opacity: 0.8;
  line-height: 1.35;
}
code {
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 6px;
  border-radius: 10px;
}
.panel {
  flex: 1 1 520px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px;
  min-width: min(420px, 92vw);
}
label {
  display: block;
  font-weight: 800;
  margin: 0.25rem 0 0.4rem;
}
input[type="file"],
input[type="url"],
select,
input[type="number"] {
  /* width:100%; */
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.25);
  color: #e7f0f3;
  outline: none;
}
input[type="url"]::placeholder {
  color: rgba(231, 240, 243, 0.55);
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.opt {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 14px;
}
.opt .line {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.opt .col {
  flex: 1;
  min-width: 220px;
}
.opt label {
  margin: 0;
  font-weight: 800;
}
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #2ef2a3;
}
input[type="range"] {
  width:100%;
}
input[type="color"] {
  width: 50px;
  height: 42px;
  border: 0;
  background: transparent;
  padding: 0;
}
.small {
  opacity: 0.7;
  font-size: 0.95rem;
  margin-top: 8px;
}
.warn {
  color: #ffd28f;
  opacity: 0.9;
}

/* AperÃ§u principal */
#preview {
  width: clamp(180px, 24vw, 260px);
  aspect-ratio: 1 / 1;
  display: block;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0px;
  padding: 0;
  object-fit: cover;
  object-position: center;
  overflow: hidden;
}
#preview.is-empty {
  opacity: 0;
  border-color: transparent;
}

/* Grid multi-aperÃ§u */
.grid {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 14px;
}
.grid h2 {
  margin: 0 0 10px 0;
  font-size: 1.05rem;
}
.grid__wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  align-items: start;
}
.tile {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tile img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #070b0e;
  object-fit: cover;
  display: block;
}
.tile .meta {
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  opacity: 0.9;
  font-size: 0.95rem;
}

/* Historique */
.history {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 14px;
}
.history h2 {
  margin: 0 0 10px 0;
  font-size: 1.05rem;
}
.history__wrap {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.hist {
  width: 72px;
  aspect-ratio: 1/1;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #070b0e;
  object-fit: cover;
  cursor: pointer;
  opacity: 0.9;
}
.hist:hover {
  border-color: rgba(46, 242, 163, 0.4);
  opacity: 1;
}

/* Dev panel */
details {
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  padding: 10px 12px;
}
summary {
  cursor: pointer;
  font-weight: 900;
}
pre {
  margin: 10px 0 0 0;
  padding: 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: auto;
  font-size: 0.95rem;
}

/* ================================
       STICKY PREVIEW (desktop)
       - le bloc gauche (preview + grid + history + dev) reste visible
    ================================ */
@media (min-width: 980px) {
  .leftCol {
    flex: 0 0 clamp(240px, 30vw, 360px);
    min-width: 220px;
    position: sticky;
    top: 18px;
    align-self: flex-start;
    max-height: calc(100vh - 36px);
    overflow: auto;
    padding-right: 10px;
    z-index: 1;
  }
  .leftCol::-webkit-scrollbar {
    width: 10px;
  }
  .leftCol::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
  }
}

@media (max-width: 979px) {
  .row {
    flex-direction: column;
  }
  .leftCol {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    z-index: 1;
    padding-top: 190px;
  }
  #preview {
    position: fixed;
    top: 30%;
    left: 25px;
    width: 180px;
    max-width: 55vw;
    margin: 0;
    z-index: 10;
    background-color: #000000ad;
  }
  .panel {
    width: 100%;
    min-width: 0;
  }
  .opt {
    width: 100%;
  }
  input[type="file"],
  input[type="url"],
  select,
  input[type="number"] {
    width: 80%;
  }
  input[type="range"] {
    width: min(260px, 85vw);
  }
}

.stats {
  margin: 12px 0 16px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
}
.stats h2 {
  margin: 0 0 8px 0;
  font-size: 1.05rem;
}
.stats__table {
  width: 100%;
  border-collapse: collapse;
}
.stats__table th,
.stats__table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.stats__table th {
  text-align: left;
  font-weight: 800;
  opacity: 0.9;
}
.stats__table td {
  text-align: right;
  font-weight: 900;
}
.stats__table tr:last-child th,
.stats__table tr:last-child td {
  border-bottom: 0;
}
.stats__note {
  margin-top: 6px;
  font-size: 0.9rem;
  opacity: 0.7;
}
