/* Insider, client mobile. Tokens et règles du handoff (docs/design/handoff-2026-09-21). */

:root {
    --red: #DE3C31;
    --ink: #14100F;
    --yellow: #FFC107;
    --cream: #FFF7EF;
    --muted: #9A8F86;
    /* Sur le rouge, l'encre pure ne dépasse pas 4,3:1 : les encadrés éclaircissent le fond au lieu de l'assombrir
       (5,2:1 pour l'encre dessus) et le texte reste toujours en encre pleine, l'alpha est réservé aux fonds et bordures */
    --well: rgba(255, 255, 255, 0.14);
    --well-strong: rgba(255, 255, 255, 0.22);
    --disabled-bg: rgba(0, 0, 0, 0.2);
    --disabled-fg: rgba(20, 16, 15, 0.55);
    --display: 'Oswald', 'Arial Narrow', sans-serif;
    --text: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
    --dock-h: 120px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html, body {
    margin: 0;
    background: var(--red);
    color: var(--ink);
    font-family: var(--text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
}

/* Coquille : colonne pleine hauteur, quatre régions */
.app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.banner {
    flex: none;
    padding: 8px;
    background: var(--ink);
    color: var(--yellow);
    text-align: center;
    font-weight: 700;
}

.top {
    flex: none;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 16px;
}

.top-eye {
    display: block;
    height: 34px;
}

.top-logo {
    display: block;
    height: 20px;
}

.counter {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--display);
    font-weight: 600;
    font-size: 18px;
}

.phasebar {
    flex: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 16px;
    background: var(--ink);
}

.phasebar-label {
    font-family: var(--display);
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--yellow);
}

.phasebar-rank {
    font-size: 12px;
    color: var(--muted);
}

.content {
    flex: 1;
    padding: 20px 20px calc(var(--dock-h) + 8px);
    text-align: left;
}

.screen.enter {
    animation: rise 0.25s ease both;
}

.dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 20px calc(26px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, #DE3C31 62%, rgba(222, 60, 49, 0));
    z-index: 5;
}

.dock:empty {
    display: none;
}

.dock-note {
    margin: 0;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--dock-h) + 12px);
    transform: translateX(-50%);
    max-width: calc(100vw - 40px);
    padding: 12px 18px;
    border-radius: 10px;
    background: var(--ink);
    color: var(--cream);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    z-index: 6;
}

/* Typographie */
.h-xl, .h1, .h2, .h3 {
    margin: 0;
    font-family: var(--display);
    font-weight: 600;
    text-transform: uppercase;
    color: var(--ink);
}

.h-xl { font-size: 42px; line-height: 1; }
.h1 { font-size: 34px; line-height: 1.05; }
.h2 { font-size: 32px; line-height: 1.05; }
.h3 { font-size: 28px; line-height: 1.05; }

.eyebrow {
    margin: 0 0 6px;
    font-family: var(--display);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink);
}

.label {
    margin: 0 0 8px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
}

.lead {
    margin: 8px 0 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    max-width: 30ch;
}

.p {
    margin: 8px 0 0;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
}

.p.narrow { max-width: 32ch; }
.center { text-align: center; }
.center .lead, .center .p { margin-left: auto; margin-right: auto; }
.stack > * + * { margin-top: 18px; }
.stack-sm > * + * { margin-top: 8px; }
.mt-14 { margin-top: 14px; }
.mt-20 { margin-top: 20px; }

/* Encadrés */
.well {
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--well);
    font-size: 13px;
    line-height: 1.5;
}

.well-lg {
    padding: 16px 18px;
    border-radius: 16px;
    font-size: 15px;
}

.well p { margin: 0; }
.well .label { margin: 0 0 8px; }
.well strong { font-weight: 700; }

.share-url {
    display: block;
    margin-top: 6px;
    font-weight: 700;
    font-size: 15px;
    word-break: break-all;
    color: var(--ink);
}

/* Pastilles et avatars */
.avatar {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-family: var(--display);
    font-weight: 600;
    font-size: 15px;
    background: var(--well-strong);
    color: var(--ink);
}

.avatar.on { background: var(--ink); color: var(--yellow); }
.avatar.ink { background: var(--ink); color: var(--yellow); }
.avatar.gold { background: var(--yellow); color: var(--ink); }
.avatar-40 { width: 40px; height: 40px; font-size: 17px; }
.avatar-44 { width: 44px; height: 44px; font-size: 18px; }
.avatar-52 { width: 52px; height: 52px; font-size: 22px; }

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

.progress .label { margin-bottom: 0; }

.pill {
    display: inline-flex;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--yellow);
    font-family: var(--display);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.chip-host {
    flex: none;
    padding: 3px 7px;
    border: 1.5px solid var(--ink);
    border-radius: 6px;
    font-family: var(--display);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* Lignes de liste */
.rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    padding: 0 12px 0 10px;
    border-radius: 14px;
    background: var(--well);
}

.row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.row-name {
    font-weight: 600;
    font-size: 18px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.row-status {
    font-weight: 600;
    font-size: 12px;
    color: var(--ink);
}

.row-status.off { font-weight: 500; font-style: italic; }

.icon-btn {
    flex: none;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.confirm-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.confirm-inline .mini {
    min-height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    border: 0;
    font-weight: 700;
    font-size: 13px;
}

.mini-yes { background: var(--ink); color: var(--cream); }
.mini-no { background: transparent; color: var(--ink); text-decoration: underline; }

/* Boutons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 60px;
    padding: 0 20px;
    border: 0;
    border-radius: 16px;
    font-family: var(--display);
    font-weight: 600;
    font-size: 19px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
}

.btn-primary {
    background: var(--ink);
    color: var(--cream);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.btn-accent {
    background: var(--yellow);
    color: var(--ink);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.btn-registered {
    background: var(--ink);
    color: var(--yellow);
}

.btn-disabled,
.btn[aria-disabled="true"] {
    background: var(--disabled-bg);
    color: var(--disabled-fg);
    box-shadow: none;
    cursor: default;
}

.btn.btn-registered[aria-disabled="true"] {
    background: var(--ink);
    color: var(--yellow);
}

.btn-secondary {
    min-height: 50px;
    background: transparent;
    color: var(--ink);
    box-shadow: none;
}

.btn-outline {
    min-height: 56px;
    border: 2px solid var(--ink);
    border-radius: 14px;
    background: transparent;
    color: var(--ink);
    font-family: var(--text);
    font-weight: 600;
    font-size: 17px;
    letter-spacing: 0;
    text-transform: none;
}

/* Champs */
.field-label {
    display: block;
    margin: 18px 0 8px;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
}

.field {
    display: block;
    width: 100%;
    min-height: 60px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    background: var(--cream);
    color: var(--ink);
    font-family: var(--text);
    font-weight: 600;
    font-size: 20px;
}

.field::placeholder {
    color: rgba(20, 16, 15, 0.4);
    font-weight: 500;
}

/* Anneau de focus global, jaune sur les fonds sombres */
.field:focus-visible,
.btn:focus-visible,
.opt:focus-visible,
.cand:focus-visible,
.pick:focus-visible,
.icon-btn:focus-visible,
.mini:focus-visible,
.card:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 2px;
}

.dark :focus-visible,
.found-banner :focus-visible,
.reveal :focus-visible,
.phasebar :focus-visible,
.timer-block.urgent :focus-visible {
    outline-color: var(--yellow);
}

.field-error {
    min-height: 22px;
    margin: 8px 0 0;
    font-weight: 600;
    font-size: 13px;
}

.or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink);
}

.or::before, .or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(20, 16, 15, 0.3);
}

/* Cartes à retourner */
.card {
    position: relative;
    display: block;
    width: 100%;
    height: 250px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 22px;
    background: transparent;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
    perspective: 1000px;
}

.card-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    border-radius: 22px;
    overflow: hidden;
    backface-visibility: hidden;
    transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.card-front { background: var(--ink); }
.card-back { background: var(--yellow); transform: rotateY(180deg); }
.card[data-flipped] .card-front { transform: rotateY(180deg); }
.card[data-flipped] .card-back { transform: rotateY(0deg); }

.card-eye {
    width: 56px;
    height: 56px;
    border: 3px solid var(--yellow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-eye::after {
    content: '';
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--yellow);
}

.card-title {
    font-family: var(--display);
    font-weight: 600;
    font-size: 24px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--cream);
}

.card-hint { font-size: 14px; color: var(--muted); }

.card-over {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink);
}

.card-secret {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--display);
    font-weight: 600;
    text-transform: uppercase;
    line-height: 1;
    color: var(--ink);
}

.card-secret.role { font-size: 42px; }
.card-secret.word { font-size: clamp(24px, 12vw, 46px); }
.card-secret.neutral { font-size: 22px; }

.card-text {
    max-width: 32ch;
    min-height: calc(2 * 1.45em); /* deux lignes réservées : même silhouette quel que soit le texte */
    text-align: center;
    font-size: 14px;
    line-height: 1.45;
    color: var(--ink);
}

.timebar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 5px;
    background: var(--ink);
    transform-origin: left;
    transform: scaleX(1);
}

.card[data-flipped] .timebar { animation: shrink 5s linear both; }

/* Rappel du rôle (attente) */
.role-recall {
    max-width: 300px;
    text-align: left;
}

.role-recall .name {
    margin: 2px 0 6px;
    font-family: var(--display);
    font-weight: 600;
    font-size: 26px;
    text-transform: uppercase;
    line-height: 1;
}

/* Chrono */
.timer {
    margin: 0;
    text-align: center;
    font-family: var(--display);
    font-weight: 600;
    font-size: 88px;
    line-height: 0.9;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.timer-sm { font-size: 52px; line-height: 1; text-align: left; }

/* Sous 30 s : le bloc entier passe en sombre, chiffres en jaune. Pas d'animation, le contraste tient sans mouvement */
.timer-block {
    padding: 12px 16px 14px;
    border-radius: 18px;
    transition: background 0.3s ease;
}

.timer-block.urgent { background: var(--ink); }
.timer-block.urgent .timer,
.timer-block.urgent .eyebrow { color: var(--yellow); }

.timer.urgent {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    background: var(--ink);
    color: var(--yellow);
}

.timer-track {
    height: 6px;
    margin: 14px 0 0;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.16);
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    width: 100%;
    border-radius: 3px;
    background: var(--ink);
    transform-origin: left;
}

/* Blocs sombres */
.dark {
    padding: 16px 18px;
    border-radius: 16px;
    background: var(--ink);
    color: var(--cream);
}

.dark-label {
    margin: 0;
    font-family: var(--display);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.dark-word {
    margin: 4px 0 6px;
    font-family: var(--display);
    font-weight: 600;
    font-size: 34px;
    line-height: 1;
    text-transform: uppercase;
    color: var(--yellow);
}

.dark-note { margin: 0; font-size: 13px; color: var(--muted); }
.dark .gold, .found-banner .gold { color: var(--yellow); font-weight: 600; }

.found-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    background: var(--ink);
    color: var(--cream);
}

.found-banner .title {
    margin: 0;
    font-family: var(--display);
    font-weight: 600;
    font-size: 22px;
    line-height: 1;
    text-transform: uppercase;
}

.found-banner .sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

/* Attente animée */
.dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 14px;
}

.dots i {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--ink);
    animation: breathe 1.4s ease-in-out infinite;
}

.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }

/* Choix du trouveur */
.pick {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 64px;
    padding: 0 14px;
    border: 0;
    border-radius: 14px;
    background: var(--ink);
    color: var(--cream);
    font-weight: 600;
    font-size: 19px;
    text-align: left;
}

.pick .icon { margin-left: auto; color: var(--muted); }

/* Vote 1 */
.vote1 {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.opt {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-height: 76px;
    padding: 0 17px;
    border: 3px solid transparent;
    border-radius: 16px;
    font-family: var(--display);
    font-weight: 600;
    font-size: 26px;
    text-transform: uppercase;
}

.opt-yes { background: var(--yellow); color: var(--ink); }
.opt-no { background: var(--well); color: var(--ink); }
.opt.selected { background: var(--ink); color: var(--yellow); }
.opt-yes.selected { border-color: var(--yellow); }
.opt .icon { visibility: hidden; }
.opt.selected .icon { visibility: visible; }

/* Vote 2 et égalité */
.cand {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 64px;
    padding: 0 14px;
    border: 2px solid transparent;
    border-radius: 14px;
    background: var(--well);
    color: var(--ink);
    font-weight: 600;
    font-size: 19px;
    text-align: left;
}

.cand .avatar { background: var(--well-strong); color: var(--ink); }
.cand .score { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink); }
.cand .icon { margin-left: auto; visibility: hidden; }
.cand .score + .icon { margin-left: 8px; }
.cand.selected { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.cand.selected .avatar { background: var(--yellow); color: var(--ink); }
.cand.selected .score { color: var(--muted); }
.cand.selected .icon { visibility: visible; }

.cand-center {
    justify-content: center;
    min-height: 60px;
    margin-top: 14px;
    border: 2px dashed rgba(20, 16, 15, 0.45);
    background: transparent;
    color: var(--ink);
    font-size: 17px;
}

.cand-center.selected { border-style: solid; }

/* Résultat */
.reveal {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: 18px;
    background: var(--ink);
    color: var(--cream);
}

.reveal-name {
    margin: 2px 0 0;
    font-family: var(--display);
    font-weight: 600;
    font-size: 28px;
    line-height: 1;
    text-transform: uppercase;
}

.word-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.word-line .label { margin: 0; }

.word-value {
    font-family: var(--display);
    font-weight: 600;
    font-size: 26px;
    text-transform: uppercase;
}

.tally { margin-top: 10px; }
.tally + .tally { margin-top: 12px; }

.tally-row {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

.tally-track {
    height: 10px;
    margin-top: 6px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.14);
    overflow: hidden;
}

.tally-fill {
    height: 100%;
    border-radius: 5px;
    background: rgba(20, 16, 15, 0.4);
}

.tally-fill.top { background: var(--ink); }

.tally-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--yellow);
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    vertical-align: 2px;
}

/* Les mots longs (40 caractères maxi) se coupent au lieu de déborder de la carte ou du bloc noir */
.card-secret,
.dark-word,
.word-value { overflow-wrap: anywhere; }

/* Animations */
@keyframes shrink {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@keyframes breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@media (hover: hover) {
    .icon-btn:hover { background: rgba(0, 0, 0, 0.12); }
    .pick:hover { background: #2A2320; }
    .btn-primary:hover { background: #2A2320; }
}

@media (prefers-reduced-motion: reduce) {
    .screen.enter { animation: none; }
    .dots i { animation: none; }
    .timer-block { transition: none; }
    .card-face { transition: none; }
}
