/* Polices du site (D19), auto-hébergées. Fichiers à déposer dans fonts/ (voir README) ; sinon polices système. */
@font-face { font-family: 'Righteous'; src: url('fonts/Righteous-Regular.woff2') format('woff2'), url('fonts/Righteous-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Open Sans'; src: url('fonts/OpenSans-Variable.woff2') format('woff2'), url('fonts/OpenSans-VariableFont_wdth,wght.ttf') format('truetype'); font-weight: 300 700; font-display: swap; }

:root {
  --text: #3c4858; --bg: #e5e5e5; --card: #ffffff; --muted: #6b7684;
  --primary: #3c4858; --on-primary: #ffffff; --won: #2e7d32; --delivered: #1565c0; --forfeited: #ef6c00; --danger: #c62828;
  --title-font: 'Righteous', system-ui, sans-serif; --body-font: 'Open Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--body-font); color: var(--text); background: var(--bg); min-height: 100dvh; display: flex; flex-direction: column; }

header { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: .75rem 1rem; background: var(--primary); color: var(--on-primary); }
.title { display: flex; flex-direction: column; }
.title { gap: .2rem; }
.title .logo { height: 2.75rem; width: auto; align-self: flex-start; }
.title span { font-size: .85rem; opacity: .85; }
.badges { display: flex; gap: .5rem; flex-wrap: wrap; }
.badge { background: rgba(255,255,255,.15); border-radius: 999px; padding: .25rem .75rem; font-size: .85rem; }
.badge.warn { background: var(--forfeited); }
.banner { background: #fff3cd; padding: .5rem 1rem; text-align: center; }

main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 1rem 1rem 6rem; }
nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); box-shadow: 0 -2px 8px rgba(0,0,0,.1); }
nav button { flex: 1; border: 0; border-radius: 0; background: none; padding: 1rem .5rem; font-size: 1rem; }
nav button.active { background: var(--primary); color: var(--on-primary); }

button, select, input { font: inherit; }
button { cursor: pointer; border: 1px solid var(--primary); background: var(--card); color: var(--text); border-radius: .6rem; padding: .7rem 1.1rem; min-height: 48px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--primary); color: var(--on-primary); }
button.warn { border-color: var(--forfeited); color: var(--forfeited); }
button.danger { border-color: var(--danger); color: var(--danger); }
button.big { font-size: 1.4rem; padding: 1rem 2rem; min-height: 64px; }
button.link { border: 0; background: none; text-decoration: underline; }
select, input { padding: .6rem; border: 1px solid #b8bec6; border-radius: .5rem; min-height: 44px; background: var(--card); }
label { display: block; margin: .5rem 0; }

.row { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; align-items: center; margin: .75rem 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.card { background: var(--card); border-radius: .8rem; padding: 1rem; margin-bottom: 1rem; }
h3 { font-family: var(--title-font); font-weight: 400; margin: 1rem 0 .5rem; }

.roll-zone { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 1.5rem 0; overflow: hidden; }
.draw-number { font-family: var(--title-font); font-size: clamp(6rem, 28vw, 14rem); line-height: 1; }
.roll-number { font-family: var(--title-font); font-size: clamp(4.5rem, 20vw, 9rem); line-height: 1; }
.roll-number:empty { display: none; }
.roll-number.pop { animation: pop .45s cubic-bezier(.3, 1.7, .5, 1); }
.roll-text { font-size: 1.3rem; text-align: center; margin: 0; }
.stage-logo { display: none; }

/* Dé 100 : deux d10 (styles des polygones, mouvement du lancer). */
.dice { display: flex; justify-content: center; gap: clamp(.75rem, 4vw, 2.5rem); perspective: 800px; }
.d10 { width: clamp(6.5rem, 26vw, 10rem); height: auto; overflow: visible; filter: drop-shadow(0 .6rem .5rem rgba(0, 0, 0, .25)); }
.d10-face { fill: #000; stroke: #160c0e; stroke-width: 2; stroke-linejoin: round; }
.d10-edge { fill: none; stroke: #160c0e; stroke-width: 4; stroke-linejoin: round; }
.d10-label { font-family: var(--title-font); fill: #fff; stroke: #160c0e; stroke-width: 3; paint-order: stroke; text-anchor: middle; dominant-baseline: central; }
.d10.idle { animation: d10-float 3.2s ease-in-out infinite; }
.d10.idle:nth-child(2) { animation-delay: -1.6s; }
.d10.tumbling { animation: d10-tumble .5s linear infinite; }
.d10.tumbling:nth-child(2) { animation-duration: .43s; animation-direction: reverse; }
.d10.tumbling:nth-child(3) { animation-duration: .57s; }
.dice.rolling { animation: dice-throw 1.4s cubic-bezier(.15, .8, .3, 1); } /* = ROLL_MS de app.js */
.d10.landed { animation: d10-land .55s cubic-bezier(.3, 1.7, .5, 1); }
@keyframes d10-float { 50% { transform: translateY(-6%) rotate(-3deg); } }
@keyframes d10-tumble {
  0% { transform: none; }
  25% { transform: translateY(-14%) rotateX(90deg) rotateZ(90deg); }
  50% { transform: rotateX(180deg) rotateZ(180deg); }
  75% { transform: translateY(-10%) rotateX(270deg) rotateZ(270deg); }
  100% { transform: rotateX(360deg) rotateZ(360deg); }
}
@keyframes dice-throw { from { transform: translate(-35%, -10%); } to { transform: none; } }
@keyframes d10-land { 0% { transform: scale(1.15, .85); } 60% { transform: scale(.95, 1.05); } 100% { transform: none; } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

.draw-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; font-weight: 600; }
.draw-stage { background: var(--card); border-radius: 1rem; padding: 1.5rem 1rem; display: flex; flex-direction: column; align-items: center; }
/* Plein écran simulé : seule la zone .stage de l'écran reste, sur toute la page. */
body.presenting header, body.presenting nav, body.presenting .banner, body.presenting #screen > :not(.stage) { display: none; }
body.presenting .stage { position: fixed; inset: 0; z-index: 10; border-radius: 0; justify-content: center; overflow: auto; }
body.presenting .draw-number { font-size: min(40vh, 45vw); }
body.presenting #draw-stage p { font-size: 1.5rem; }
body.presenting #roll-stage { background: var(--bg); padding: 1rem; gap: 1.5vh; }
body.presenting .stage-logo { display: block; width: min(70vw, 28rem); height: auto; }
body.presenting .d10 { width: min(30vw, 26vh); }
body.presenting .roll-number { font-size: min(20vh, 28vw); }
.fs-corner { min-height: 40px; padding: .4rem .9rem; font-size: .9rem; }
body.presenting .fs-corner { position: absolute; top: .75rem; right: .75rem; opacity: .6; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { min-width: 2.6rem; text-align: center; padding: .35rem .5rem; border-radius: .5rem; background: #d5d9de; font-weight: 600; }
.chip.won { background: var(--won); color: #fff; }
.chip.delivered { background: var(--delivered); color: #fff; }
.chip.forfeited { background: var(--forfeited); color: #fff; }
.chip.voided { text-decoration: line-through; opacity: .5; }
button.chip { border: 0; min-height: 0; padding: .35rem .5rem; font-weight: 600; }
.chip.has-draw { outline: 2px solid rgba(0,0,0,.15); }
.chip.selected { box-shadow: 0 0 0 3px var(--text); }
.history li { cursor: pointer; padding: .2rem 0; }
.history li.selected { font-weight: 700; }
.legend { font-size: .85rem; }
.history { padding-left: 1.5rem; }
.history li.voided { text-decoration: line-through; opacity: .6; }

dialog { border: 0; border-radius: 1rem; padding: 1.5rem; max-width: 90vw; }
dialog::backdrop { background: rgba(0,0,0,.5); }
.ask-text { white-space: pre-line; max-width: 32rem; }
#ask-input { width: 100%; text-transform: uppercase; }
#pin-input { width: 100%; font-size: 1.5rem; letter-spacing: .3rem; text-align: center; }
.toast { position: fixed; z-index: 20; bottom: 5rem; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: .75rem 1.25rem; border-radius: .6rem; max-width: 90vw; }
.fatal { background: #fdecea; color: var(--danger); padding: 1rem; border-radius: .6rem; }

@media (min-width: 1024px) {
  nav { position: static; order: -1; max-width: 960px; margin: 1rem auto 0; border-radius: .8rem; overflow: hidden; }
  main { padding-bottom: 2rem; }
  .toast { bottom: 2rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
