/* ══════════════════════════════════════════════════
   TIRAGE MACHINES — Style industriel / mobile-first
   Bebas Neue + DM Mono · Palette acier & ambre
   ══════════════════════════════════════════════════ */

:root {
  --bg:        #0f1117;
  --bg2:       #181c27;
  --bg3:       #1f2435;
  --border:    #2a3045;
  --border2:   #3a4560;
  --amber:     #f5a623;
  --amber-dim: #c4821a;
  --amber-glow:#f5a62330;
  --green:     #22c55e;
  --green-dim: #166534;
  --red:       #ef4444;
  --text:      #e8eaf0;
  --text2:     #8892a4;
  --text3:     #555f73;
  --mono:      'DM Mono', monospace;
  --display:   'Bebas Neue', sans-serif;
  --body:      'Inter', sans-serif;
  --radius:    12px;
  --shadow:    0 4px 24px rgba(0,0,0,.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── Utilitaires ─────────────────────────────── */
.hidden { display: none !important; }

/* ── Header ──────────────────────────────────── */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  max-width: 480px; margin: 0 auto;
}
.header-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  font-size: 28px;
  animation: spin-slow 8s linear infinite;
  display: inline-block;
  filter: drop-shadow(0 0 6px var(--amber));
}
@keyframes spin-slow { to { transform: rotate(360deg); } }
.logo-title {
  font-family: var(--display);
  font-size: 20px; letter-spacing: 2px;
  color: var(--amber);
  line-height: 1;
}
.logo-sub { font-size: 10px; color: var(--text3); letter-spacing: 1px; text-transform: uppercase; }

/* ── Boutons ─────────────────────────────────── */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px; font-family: var(--body); font-weight: 500;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: all .2s;
}
.btn-ghost:hover { border-color: var(--amber); color: var(--amber); }

.btn-primary {
  width: 100%;
  background: var(--amber);
  color: #000;
  border: none;
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--display);
  font-size: 20px; letter-spacing: 2px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all .2s;
  box-shadow: 0 0 20px var(--amber-glow);
  margin-top: 8px;
}
.btn-primary:hover { background: #ffc14d; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-icon { font-size: 18px; }

.btn-draw {
  width: 100%;
  background: linear-gradient(135deg, #1a2540 0%, #0f1117 100%);
  border: 2px solid var(--amber);
  color: var(--amber);
  border-radius: var(--radius);
  padding: 18px 16px;
  font-family: var(--display);
  font-size: 26px; letter-spacing: 3px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  transition: all .25s;
  box-shadow: 0 0 30px var(--amber-glow), inset 0 0 20px rgba(245,166,35,.05);
  margin-top: 4px;
}
.btn-draw:hover {
  background: var(--amber-glow);
  box-shadow: 0 0 40px rgba(245,166,35,.5);
  transform: scale(1.01);
}
.btn-draw:active { transform: scale(.98); }
.btn-draw:disabled {
  opacity: .4; cursor: not-allowed; transform: none;
  box-shadow: none;
}
.btn-draw-icon { font-size: 28px; }

.btn-reset {
  margin-top: 20px; width: 100%; justify-content: center;
  font-size: 13px;
}

.btn-close {
  background: none; border: none; color: var(--text2); font-size: 20px;
  cursor: pointer; padding: 4px 8px; border-radius: 6px;
  transition: color .2s;
}
.btn-close:hover { color: var(--text); }

/* ── Main / Cards ────────────────────────────── */
.main {
  padding: 16px;
  max-width: 480px; margin: 0 auto;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-tag {
  font-family: var(--mono);
  font-size: 11px; color: var(--amber);
  letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 8px;
}
.card-title {
  font-family: var(--display);
  font-size: 30px; letter-spacing: 1px;
  color: var(--text); line-height: 1; margin-bottom: 8px;
}
.card-desc { font-size: 13px; color: var(--text2); line-height: 1.5; margin-bottom: 20px; }

/* ── Inputs ──────────────────────────────────── */
.field-group { margin-bottom: 16px; }
.label {
  display: block; font-size: 12px; color: var(--text3);
  letter-spacing: 1px; text-transform: uppercase;
  font-family: var(--mono); margin-bottom: 6px;
}
.input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 13px 14px;
  color: var(--text);
  font-size: 15px; font-family: var(--body);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-glow);
}
.input::placeholder { color: var(--text3); }
.input-tech { font-family: var(--mono); font-size: 16px; }

/* ── Session badge ───────────────────────────── */
.session-badge {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 13px; color: var(--amber);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}
.session-badge::before { content: '📁'; font-size: 16px; }

/* ── Grille machines ─────────────────────────── */
.machines-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.machine-chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  transition: all .3s;
  position: relative; overflow: hidden;
}
.machine-chip.available {
  border-color: var(--green-dim);
  box-shadow: 0 0 0 1px #166534;
}
.machine-chip.drawn {
  opacity: .4;
  border-color: var(--border);
  background: var(--bg);
}
.machine-chip.drawn::after {
  content: '✓';
  position: absolute; top: 8px; right: 10px;
  color: var(--green); font-size: 16px; font-weight: bold;
}
.chip-num {
  font-family: var(--mono);
  font-size: 11px; color: var(--text3);
  margin-bottom: 4px; letter-spacing: 1px;
}
.chip-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  line-height: 1.2;
}
.chip-status {
  font-size: 11px; margin-top: 4px;
  color: var(--green); font-family: var(--mono);
}
.machine-chip.drawn .chip-status { color: var(--text3); }

/* ── Draw zone ───────────────────────────────── */
.draw-zone { margin-bottom: 16px; }

/* ── Result card ─────────────────────────────── */
.result-card {
  background: linear-gradient(135deg, #1a2540 0%, #0f1117 100%);
  border: 2px solid var(--amber);
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 0 40px var(--amber-glow);
  animation: result-appear .5s cubic-bezier(.175,.885,.32,1.275);
  margin-top: 16px;
}
@keyframes result-appear {
  from { opacity: 0; transform: scale(.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.result-tech {
  font-family: var(--mono); font-size: 14px; color: var(--text2);
  letter-spacing: 1px; margin-bottom: 8px;
}
.result-arrow { font-size: 20px; color: var(--amber); margin-bottom: 10px; animation: bounce .8s infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
.result-machine { padding: 16px; background: rgba(245,166,35,.08); border-radius: 10px; margin-bottom: 12px; }
.result-machine-num { font-family: var(--mono); font-size: 13px; color: var(--amber-dim); margin-bottom: 6px; }
.result-machine-name { font-family: var(--display); font-size: 32px; letter-spacing: 1px; color: var(--amber); line-height: 1; margin-bottom: 6px; }
.result-machine-desc { font-size: 12px; color: var(--text2); }
.result-order { font-family: var(--mono); font-size: 12px; color: var(--text3); }

/* ── Finished card ───────────────────────────── */
.finished-card {
  text-align: center; padding: 32px 16px;
  animation: result-appear .5s ease;
}
.finished-icon { font-size: 64px; margin-bottom: 12px; }
.finished-title { font-family: var(--display); font-size: 32px; color: var(--amber); margin-bottom: 8px; }
.finished-sub { font-size: 14px; color: var(--text2); margin-bottom: 24px; }

/* ── Slot machine overlay ────────────────────── */
.slot-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
}
.slot-container {
  text-align: center; padding: 40px 24px;
  animation: slot-in .3s ease;
}
@keyframes slot-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
.slot-label {
  font-family: var(--mono); font-size: 14px; color: var(--text2);
  letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 32px;
}
.slot-reels {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 24px;
}
.slot-reel {
  width: 80px; height: 80px;
  background: var(--bg2);
  border: 2px solid var(--amber);
  border-radius: 12px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 20px var(--amber-glow);
}
.slot-reel-inner {
  font-family: var(--display);
  font-size: 36px; color: var(--amber);
  animation: reel-spin .1s steps(1) infinite;
}
.slot-reel.locked .slot-reel-inner {
  animation: none;
  color: var(--green);
  text-shadow: 0 0 12px rgba(34,197,94,.6);
}
@keyframes reel-spin {
  0%   { content: ''; }
}
.slot-sep { font-size: 24px; color: var(--border2); }
.slot-suspense {
  font-family: var(--mono); font-size: 13px; color: var(--text3);
  letter-spacing: 2px; animation: pulse-text 1s infinite;
}
@keyframes pulse-text { 0%,100% { opacity: .4; } 50% { opacity: 1; } }

/* ── Historique panel ────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
}
.historique-panel {
  position: fixed; right: 0; top: 0; bottom: 0; z-index: 160;
  width: min(100vw, 420px);
  background: var(--bg2);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,.6);
  animation: slide-in .3s ease;
}
@keyframes slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.panel-title { font-family: var(--display); font-size: 22px; letter-spacing: 1px; color: var(--amber); }
.panel-body { flex: 1; overflow-y: auto; padding: 16px; }

/* Session dans l'historique */
.histo-session {
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.histo-session-header {
  background: var(--bg3);
  padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer;
}
.histo-session-name { font-weight: 600; font-size: 14px; color: var(--text); }
.histo-session-date { font-family: var(--mono); font-size: 11px; color: var(--text3); }
.histo-session-count {
  font-family: var(--mono); font-size: 12px; color: var(--amber);
  background: var(--amber-glow); border-radius: 6px; padding: 2px 8px;
}
.histo-session-body { padding: 10px 14px; display: none; }
.histo-session.open .histo-session-body { display: block; }

.histo-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.histo-row:last-child { border-bottom: none; }
.histo-order {
  font-family: var(--mono); font-size: 11px;
  color: var(--text3); min-width: 20px;
}
.histo-info { flex: 1; }
.histo-tech { font-size: 13px; font-weight: 500; color: var(--text); }
.histo-machine { font-family: var(--mono); font-size: 12px; color: var(--amber); }

.loading-text { color: var(--text3); font-size: 14px; text-align: center; padding: 32px 0; }
.empty-text { color: var(--text3); font-size: 13px; text-align: center; padding: 20px 0; font-style: italic; }

/* ── Confetti (petits éléments animés) ──────── */
.confetti-piece {
  position: fixed; z-index: 300;
  width: 8px; height: 8px;
  border-radius: 2px;
  pointer-events: none;
  animation: confetti-fall 1.8s ease-in forwards;
}
@keyframes confetti-fall {
  0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: translateY(60vh) rotate(720deg); }
}

/* ── Responsive ──────────────────────────────── */
@media (min-width: 480px) {
  .main { padding: 24px 20px; }
  .card { padding: 28px 24px; }
  .card-title { font-size: 36px; }
}
