/* SpinWheel – feuille de style */

:root {
  --ink: #1d2433;
  --ink-soft: #5b6475;
  --paper: #eef0f3;
  --panel: #ffffff;
  --line: #d4d8df;
  --blue: #2457c5;
  --blue-dark: #1b449e;
  --yellow: #ffc83d;
  --red: #c8372d;
  --r: 6px;
  --top-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 400 16px/1.5 'Barlow', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; display: flex; flex-direction: column; }
a { color: var(--blue); }
h1, h2, h3 { font-family: 'Barlow Condensed', 'Barlow', sans-serif; font-weight: 700; line-height: 1.15; margin: 0; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; font-weight: 600; margin: 1.4rem 0 .6rem; }
h3:first-child { margin-top: 0; }
.muted { color: var(--ink-soft); }
small.muted { font-weight: 400; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Barre du haut ---------- */
.top {
  height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: .5rem;
  font: 700 1.6rem/1 'Barlow Condensed', sans-serif;
  color: var(--ink); text-decoration: none; letter-spacing: .01em;
}
.menu { display: flex; align-items: center; gap: 1.4rem; font-weight: 500; white-space: nowrap; }
.menu a { color: var(--ink); text-decoration: none; padding: .2rem 0; border-bottom: 2px solid transparent; }
.menu a:hover { border-bottom-color: var(--line); }
.menu a[aria-current="page"] { border-bottom-color: var(--ink); }
.menu .who { color: var(--ink-soft); }
.menu .menu-btn {
  border: 1px solid var(--ink); border-radius: var(--r); padding: .35rem .8rem;
}
.menu .menu-btn:hover { background: var(--ink); color: #fff; border-bottom-color: var(--ink); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 1rem;
  font: 600 1rem/1 'Barlow', sans-serif;
  color: #fff; background: var(--blue);
  border: 1px solid var(--blue); border-radius: var(--r);
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-quiet { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { background: var(--paper); border-color: var(--ink-soft); }

.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 500 .95rem 'Barlow', sans-serif; color: var(--blue);
  text-decoration: underline; text-underline-offset: 3px;
}
.link-btn.danger { color: var(--red); }

/* ---------- Formulaires ---------- */
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%;
  font: inherit; color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: .55rem .7rem;
}
input:focus, textarea:focus, select:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(36, 87, 197, .15); }
select {
  appearance: none; padding-right: 2.2rem; cursor: pointer;
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231d2433' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right .8rem center / 12px;
}
label { display: block; }
.field { font-weight: 500; margin-bottom: 1rem; }
.field input { margin-top: .3rem; }
.check { display: flex; align-items: center; gap: .55rem; margin: .5rem 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); margin: 0; }
input[type=range] { accent-color: var(--blue); width: 100%; }

/* ---------- Pages simples (connexion, inscription, mes roues) ---------- */
.auth-card {
  width: min(400px, calc(100% - 2rem));
  margin: 3.5rem auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 1.8rem;
}
.auth-card h1 { margin-bottom: .2rem; }
.auth-card > p.muted:first-of-type { margin-top: 0; margin-bottom: 1.4rem; }
.auth-card label { font-weight: 500; margin-bottom: 1rem; }
.auth-card label input { margin-top: .3rem; }
.auth-card .btn { width: 100%; margin-top: .4rem; }
.alert {
  border-left: 3px solid var(--red); background: #fbeceb;
  padding: .6rem .8rem; margin-bottom: 1.2rem; border-radius: 0 var(--r) var(--r) 0;
}

.page { width: min(860px, calc(100% - 2rem)); margin: 2.5rem auto; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.4rem; }
.empty { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2rem; }
.empty p { margin-top: 0; max-width: 46ch; }
.wheel-list { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.wheel-item { display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem; }
.wheel-item + .wheel-item { border-top: 1px solid var(--line); }
.wheel-thumb { flex-shrink: 0; }
.mini-wheel { width: 64px; height: 64px; display: block; }
.wheel-info { flex: 1; min-width: 0; }
.wheel-info p { margin: .1rem 0 0; font-size: .92rem; }
.wheel-link { font: 600 1.25rem 'Barlow Condensed', sans-serif; color: var(--ink); text-decoration: none; word-break: break-word; }
.wheel-link:hover { text-decoration: underline; }

/* ---------- Éditeur ---------- */
.board { flex: 1; display: grid; grid-template-columns: 1fr 360px; min-height: calc(100vh - var(--top-h)); }

.stage {
  --pointer: #c8372d; --hub-ring: #1d2433; --stage-text: #1d2433;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1.5rem 1rem 1rem;
  background: #dfe4ea;
  overflow: hidden;
}
.wheel-name {
  width: min(600px, 100%);
  background: transparent !important; border: 0 !important; border-bottom: 2px dashed transparent !important;
  border-radius: 0 !important; box-shadow: none !important;
  font: 700 2.2rem/1.1 'Barlow Condensed', sans-serif; text-align: center;
  color: var(--stage-text); padding: .1rem .3rem; margin-bottom: .8rem;
}
.wheel-name::placeholder { color: var(--stage-text); opacity: .45; }
.wheel-name:hover, .wheel-name:focus { border-bottom-color: currentColor !important; }

.wheel-wrap { position: relative; width: min(600px, 88vw, calc(100vh - 210px)); min-width: 260px; aspect-ratio: 1; }
#wheel { width: 100%; height: 100%; display: block; cursor: pointer; }
.pointer {
  position: absolute; z-index: 2; top: -4px; left: 50%; transform: translateX(-50%);
  width: 34px; height: 44px;
  background: var(--pointer);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .25));
}
.hub {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 19%; aspect-ratio: 1; border-radius: 50%;
  background: var(--yellow); color: var(--ink);
  border: 5px solid var(--hub-ring);
  font: 700 clamp(.78rem, 2.6vw, 1.45rem)/1 'Barlow Condensed', sans-serif; padding: 0;
  cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .14);
}
.hub:hover:not(:disabled) { background: #ffd462; }
.hub:active:not(:disabled) { box-shadow: inset 0 2px 0 rgba(0, 0, 0, .18); }
.hub:disabled { cursor: default; }
.hint { color: var(--stage-text); opacity: .7; font-size: .92rem; margin: .9rem 0 0; }

.side {
  display: flex; flex-direction: column; gap: .9rem;
  background: var(--panel); border-left: 1px solid var(--line);
  padding: 1rem 1.1rem 1.1rem;
  max-height: calc(100vh - var(--top-h)); position: sticky; top: 0;
}
.side-tabs { display: flex; gap: 1.2rem; border-bottom: 1px solid var(--line); }
.side-tab {
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: .3rem 0 .55rem; cursor: pointer;
  font: 600 1.05rem 'Barlow', sans-serif; color: var(--ink-soft);
}
.side-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.count { font-weight: 500; color: var(--ink-soft); margin-left: .15rem; }
.side-pane { flex: 1; display: flex; flex-direction: column; gap: .7rem; min-height: 0; }

.tools { display: flex; gap: .4rem; flex-wrap: wrap; }
.tool {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: .35rem .7rem; font: 500 .95rem 'Barlow', sans-serif; color: var(--ink); cursor: pointer;
}
.tool:hover { border-color: var(--ink-soft); }
.tool-main { margin-left: auto; border-color: var(--ink); }
#items { flex: 1; min-height: 260px; resize: none; line-height: 1.65; font-size: 1.05rem; }

.results { margin: 0; padding-left: 1.6rem; overflow-y: auto; flex: 1; }
.results li { padding: .25rem 0; border-bottom: 1px solid var(--paper); }
.results li::marker { color: var(--ink-soft); font-size: .9em; }
.results p { margin: 0; }
.side-save { display: grid; gap: .45rem; }

/* ---------- Fenêtres ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20, 25, 38, .55);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.dialog {
  background: var(--panel); border-radius: 8px;
  width: 100%; max-width: 440px; max-height: calc(100vh - 2rem);
  display: flex; flex-direction: column;
  box-shadow: 0 18px 50px rgba(20, 25, 38, .3);
}
.dialog-wide { max-width: 620px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.4rem .4rem; }
.x { background: none; border: 0; font-size: 1.8rem; line-height: 1; color: var(--ink-soft); cursor: pointer; padding: 0 .2rem; }
.x:hover { color: var(--ink); }
.tabs { display: flex; padding: 0 1.4rem; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: .8rem .5rem; cursor: pointer; font: 500 1rem 'Barlow', sans-serif; color: var(--ink-soft);
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--blue); font-weight: 600; }
.dialog-body { padding: 1.3rem 1.4rem; overflow-y: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.4rem 1.2rem; border-top: 1px solid var(--line); }

.sound-row { display: grid; grid-template-columns: 1fr 42px 42px; gap: .4rem; }
.sound-row select { height: 42px; }
.icon-btn {
  display: grid; place-items: center; width: 42px; height: 42px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { width: 15px; height: 15px; fill: var(--ink); }
.file-row { display: flex; justify-content: space-between; gap: 1rem; margin: .55rem 0 .9rem; }
.slider { display: grid; grid-template-columns: 72px 1fr 34px; align-items: center; gap: .7rem; margin: .4rem 0; }
.slider span { color: var(--ink-soft); }
.slider output { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.note { color: var(--ink-soft); font-size: .92rem; margin: 1rem 0 0; }

.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .4rem; }
.theme-btn {
  display: flex; align-items: center; gap: .55rem;
  padding: .45rem .55rem; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  font: 500 .95rem 'Barlow', sans-serif; color: var(--ink);
}
.theme-btn:hover { border-color: var(--ink-soft); }
.theme-btn[aria-pressed="true"] { border: 2px solid var(--ink); padding: calc(.45rem - 1px) calc(.55rem - 1px); }
.swatch { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }
.custom-box { margin-top: 1.2rem; padding-top: .2rem; border-top: 1px dashed var(--line); }
.custom-colors { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: .8rem; }
.cc { position: relative; }
.cc-x {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
  border: 0; background: var(--ink); color: #fff; font-size: 12px; line-height: 18px; padding: 0; cursor: pointer;
}
input[type=color] { width: 38px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); cursor: pointer; }
.pair { display: flex; gap: 1.4rem; }
.color-field { display: flex; align-items: center; gap: .5rem; }

.dialog-winner { max-width: 480px; text-align: center; }
.winner-msg { margin: 1.8rem 1.4rem 0; color: var(--ink-soft); font-size: 1.1rem; }
.winner-name {
  margin: .3rem 1.4rem 1.6rem;
  font: 700 clamp(2.4rem, 7vw, 3.6rem)/1.05 'Barlow Condensed', sans-serif;
  word-break: break-word;
}
.dialog-winner .dialog-foot { justify-content: center; }
.modal:not([hidden]) .dialog { animation: pop .22s ease-out; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }

#confettiCanvas { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

.toast {
  position: fixed; left: 50%; bottom: 1.4rem; z-index: 70;
  transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: var(--r);
  font-weight: 500; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }

/* ---------- Petits écrans ---------- */
@media (max-width: 900px) {
  .board { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; border-left: 0; border-top: 1px solid var(--line); }
  #items { min-height: 200px; }
  .wheel-wrap { width: min(560px, 92vw); }
}
@media (max-width: 560px) {
  .top { padding: 0 .8rem; }
  .menu { gap: .75rem; font-size: .9rem; }
  .menu .menu-btn { padding: .3rem .55rem; }
  .hub { border-width: 3px; }
  .hint { display: none; }
  .menu .who, .menu a[href="index.php"] { display: none; }
  .brand span { display: none; }
  .wheel-name { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .modal:not([hidden]) .dialog { animation: none; }
  .toast { transition: none; }
}
