/* ==========================================================================
   OsmoTools : outils de hasard (pile ou face, roue aléatoire, nombre aléatoire)
   ========================================================================== */

.ohz {
    --ohz-noir: #0A0A0A;
    --ohz-gris: #6B6B6B;
    --ohz-gris-bg: #F3F4F6;
    --ohz-border: #E5E7EB;
    --ohz-blue: #0064FF;
    --ohz-or: #C8961E;
    --ohz-or-bg: #FBF3DC;
    --ohz-rouge: #B42318;
    --ohz-mono: 'JetBrains Mono', monospace;
    margin: 0 0 40px;
    padding: 28px;
    border: 1px solid var(--ohz-border);
    border-radius: 16px;
    background: #fff;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--ohz-noir);
}

.ohz *,
.ohz *::before,
.ohz *::after {
    box-sizing: border-box;
}

.ohz [hidden] {
    display: none !important;
}

.ohz__badge {
    display: inline-block;
    margin: 0 0 12px;
    padding: 4px 10px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--ohz-blue) 10%, white);
    color: var(--ohz-blue);
    font: 700 11px/1.4 var(--ohz-mono);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.ohz .ohz__title {
    margin: 0 0 8px;
    font-size: 1.5rem;
    line-height: 1.25;
}

.ohz__intro {
    margin: 0 0 20px;
    color: var(--ohz-gris);
    font-size: 15px;
}

.ohz-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* -- Boutons, champs, puces -- */
.ohz-btn {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border: 1px solid var(--ohz-border);
    border-radius: 10px;
    background: #fff;
    color: var(--ohz-noir);
    font: 700 14px/1.2 'Plus Jakarta Sans', sans-serif;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, transform .1s;
}

.ohz-btn:hover:not(:disabled) {
    border-color: var(--ohz-noir);
}

.ohz-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.ohz-btn:disabled {
    opacity: .55;
    cursor: default;
}

.ohz-btn--main {
    width: 100%;
    padding: 15px 20px;
    border-color: var(--ohz-blue);
    background: var(--ohz-blue);
    color: #fff;
    font-size: 16px;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--ohz-blue) 28%, transparent);
}

.ohz-btn--main:hover:not(:disabled) {
    border-color: #0050CC;
    background: #0050CC;
}

.ohz-btn:focus-visible,
.ohz-chip:focus-visible,
.ohz-wheel__hub:focus-visible,
.ohz-check input:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--ohz-blue) 45%, white);
    outline-offset: 2px;
}

.ohz-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ohz-field label,
.ohz-label {
    font-size: 13px;
    font-weight: 700;
}

.ohz input[type="text"],
.ohz input[type="number"],
.ohz textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--ohz-border);
    border-radius: 10px;
    background: #fff;
    font: 600 16px/1.35 'Plus Jakarta Sans', sans-serif;
    color: var(--ohz-noir);
}

.ohz input[type="text"],
.ohz input[type="number"] {
    font-family: var(--ohz-mono);
    font-weight: 700;
}

.ohz textarea {
    min-height: 180px;
    resize: vertical;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
}

.ohz input:focus,
.ohz textarea:focus {
    border-color: var(--ohz-blue);
    outline: 0;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ohz-blue) 15%, white);
}

.ohz input[aria-invalid="true"] {
    border-color: var(--ohz-rouge);
}

.ohz-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ohz-chip {
    padding: 8px 13px;
    border: 1px solid var(--ohz-border);
    border-radius: 999px;
    background: #fff;
    color: var(--ohz-noir);
    font: 600 13px/1.2 'Plus Jakarta Sans', sans-serif;
    cursor: pointer;
    transition: border-color .15s, background-color .15s, color .15s;
}

.ohz-chip:hover {
    border-color: var(--ohz-blue);
    color: var(--ohz-blue);
}

.ohz-chip.is-on {
    border-color: var(--ohz-blue);
    background: var(--ohz-blue);
    color: #fff;
}

.ohz-check {
    display: inline-flex;
    gap: 9px;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.ohz-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--ohz-blue);
}

.ohz-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
}

.ohz-help {
    margin: 0;
    color: var(--ohz-gris);
    font-size: 12.5px;
    line-height: 1.45;
}

.ohz-warn {
    margin: 0;
    color: var(--ohz-rouge);
    font-size: 13.5px;
    font-weight: 600;
}

.ohz-warn:empty {
    display: none;
}

.ohz-more {
    margin: 18px 0 0;
    color: var(--ohz-gris);
    font-size: 13px;
}

.ohz-hist__title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
}

.ohz-hist__title span {
    color: var(--ohz-gris);
    font-weight: 500;
}

/* ==========================================================================
   Pile ou face
   ========================================================================== */
.ohz-pf {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.ohz-pf__stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 380px;
    padding: 28px 16px 22px;
    border-radius: 14px;
    background:
        radial-gradient(circle at 50% 38%, #fff 0, rgba(255, 255, 255, 0) 60%),
        linear-gradient(180deg, color-mix(in srgb, var(--ohz-blue) 6%, white), var(--ohz-gris-bg));
}

.ohz-coin-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 40px;
    perspective: 900px;
}

.ohz-coin-jump {
    position: relative;
    z-index: 1;
}

.ohz-coin {
    position: relative;
    width: 200px;
    height: 200px;
    transform-style: preserve-3d;
    transition: transform 1s cubic-bezier(.18, .7, .28, 1);
}

.ohz-coin__side {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow: inset 0 0 0 1px rgba(90, 62, 6, .35), 0 10px 24px rgba(90, 62, 6, .22);
}

.ohz-coin__side svg {
    display: block;
    width: 100%;
    height: 100%;
}

.ohz-coin__side--pile {
    transform: rotateX(180deg);
}

.ohz-coin-shadow {
    width: 150px;
    height: 16px;
    margin-top: 16px;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(10, 10, 10, .22), rgba(10, 10, 10, 0));
}

.ohz-coin-jump.is-tossing {
    animation: ohz-saut 1s cubic-bezier(.3, .6, .4, 1);
}

.ohz-coin-wrap.is-tossing .ohz-coin-shadow {
    animation: ohz-ombre 1s cubic-bezier(.3, .6, .4, 1);
}

@keyframes ohz-saut {
    0% { transform: translateY(0) scale(1); }
    45% { transform: translateY(-120px) scale(1.08); }
    80% { transform: translateY(0) scale(1); }
    88% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

@keyframes ohz-ombre {
    0%, 100% { transform: scale(1); opacity: 1; }
    45% { transform: scale(.55); opacity: .45; }
}

.ohz-pf__res {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    margin: 18px 0 0;
    text-align: center;
}

.ohz-pf__res-main {
    font: 800 clamp(28px, 5vw, 40px)/1.1 'Plus Jakarta Sans', sans-serif;
    letter-spacing: -.01em;
}

.ohz[data-last="pile"] .ohz-pf__res-main {
    color: var(--ohz-blue);
}

.ohz[data-last="face"] .ohz-pf__res-main {
    color: var(--ohz-or);
}

.ohz-pf__res-sub {
    min-height: 1.4em;
    color: var(--ohz-gris);
    font-size: 14px;
}

/* Plusieurs pièces */
.ohz-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 440px;
}

.ohz-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font: 800 15px/1 var(--ohz-mono);
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .6), 0 2px 6px rgba(10, 10, 10, .12);
}

.ohz-grid.is-many .ohz-mini {
    width: 30px;
    height: 30px;
    font-size: 12px;
}

.ohz-mini--pile {
    background: radial-gradient(circle at 35% 30%, #fff, #D5DAE1 55%, #9AA3AE);
    color: #12376E;
    outline: 3px solid color-mix(in srgb, var(--ohz-blue) 55%, white);
    outline-offset: -3px;
}

.ohz-mini--face {
    background: radial-gradient(circle at 35% 30%, #FFF4CC, #E6BC55 55%, #B07F1F);
    color: #4A3303;
}

.ohz-mini.is-anim {
    animation: ohz-pop .35s cubic-bezier(.3, 1.4, .5, 1) both;
}

@keyframes ohz-pop {
    from { transform: scale(.2) rotateY(90deg); opacity: 0; }
    to { transform: scale(1) rotateY(0); opacity: 1; }
}

/* Panneau */
.ohz-pf__panel,
.ohz-roue__panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ohz-qty {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.ohz-qty input[type="number"] {
    width: 96px;
}

.ohz-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.ohz-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border: 1px solid var(--ohz-border);
    border-radius: 12px;
}

.ohz-stat__val {
    font: 800 22px/1.15 var(--ohz-mono);
    overflow-wrap: anywhere;
}

.ohz-stat__lab {
    color: var(--ohz-gris);
    font-size: 12.5px;
    font-weight: 600;
}

.ohz-stat--pile .ohz-stat__val {
    color: var(--ohz-blue);
}

.ohz-stat--face .ohz-stat__val {
    color: var(--ohz-or);
}

.ohz-bar {
    display: flex;
    height: 8px;
    margin-top: -8px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--ohz-gris-bg);
}

.ohz-bar span {
    width: 50%;
    transition: width .4s ease;
}

.ohz-bar__pile {
    background: var(--ohz-blue);
}

.ohz-bar__face {
    background: #E2B04A;
}

.ohz-hist__list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ohz-h {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0;
    border-radius: 50%;
    font: 800 12px/1 var(--ohz-mono);
}

.ohz-h--pile {
    background: color-mix(in srgb, var(--ohz-blue) 12%, white);
    color: var(--ohz-blue);
}

.ohz-h--face {
    background: var(--ohz-or-bg);
    color: #8A6410;
}

.ohz-hist__empty {
    margin: 0;
    color: var(--ohz-gris);
    font-size: 13px;
}

.ohz-pf__reset {
    align-self: flex-start;
}

/* ==========================================================================
   Roue aléatoire
   ========================================================================== */
.ohz-roue {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.ohz-roue__stage {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
}

.ohz-wheel {
    position: relative;
    width: 100%;
    max-width: 460px;
    padding-top: 14px;
}

.ohz-wheel__canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: 50%;
    filter: drop-shadow(0 14px 28px rgba(10, 10, 10, .16));
}

.ohz-wheel__pointer {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 2;
    width: 34px;
    height: 42px;
    transform: translateX(-50%);
    background: var(--ohz-noir);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .25));
}

.ohz-wheel__pointer::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    width: 10px;
    height: 10px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: #fff;
}

.ohz-wheel__hub {
    position: absolute;
    top: calc(50% + 7px);
    left: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 23%;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border: 4px solid #fff;
    border-radius: 50%;
    background: var(--ohz-noir);
    color: #fff;
    font: 800 clamp(12px, 2.6vw, 16px)/1 'Plus Jakarta Sans', sans-serif;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
    cursor: pointer;
    transition: transform .15s;
}

.ohz-wheel__hub:hover:not(:disabled) {
    transform: translate(-50%, -50%) scale(1.05);
}

.ohz-wheel__hub:disabled {
    cursor: default;
}

.ohz-roue__res {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    width: 100%;
    max-width: 460px;
    padding: 16px 18px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--ohz-blue) 7%, white);
    text-align: center;
}

.ohz-roue__res-lab {
    color: var(--ohz-gris);
    font: 700 11px/1.4 var(--ohz-mono);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.ohz-roue__res-val {
    max-width: 100%;
    font: 800 clamp(22px, 4.4vw, 34px)/1.2 'Plus Jakarta Sans', sans-serif;
    overflow-wrap: anywhere;
}

.ohz-roue__res.is-win .ohz-roue__res-val {
    color: var(--ohz-blue);
    animation: ohz-pop-txt .45s cubic-bezier(.3, 1.5, .5, 1);
}

@keyframes ohz-pop-txt {
    from { transform: scale(.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.ohz-roue__count {
    color: var(--ohz-gris);
    font-weight: 600;
}

.ohz-roue__winners {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ohz-roue__winners li {
    max-width: 100%;
    margin: 0;
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--ohz-gris-bg);
    font-size: 13px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.ohz-roue__winners li:first-child {
    background: color-mix(in srgb, var(--ohz-blue) 12%, white);
    color: var(--ohz-blue);
}

/* ==========================================================================
   Nombre aléatoire
   ========================================================================== */
.ohz-nb__presets {
    margin: 0 0 18px;
}

.ohz-nb__form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 14px;
}

.ohz-nb__opts {
    margin: 0 0 14px;
}

.ohz--nombre .ohz-warn {
    margin: 0 0 12px;
}

.ohz-nb__out {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 18px 0 12px;
    padding: 24px 18px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--ohz-blue) 7%, white);
    text-align: center;
}

.ohz-nb__out.is-stale .ohz-nb__big,
.ohz-nb__out.is-stale .ohz-nb__list,
.ohz-nb__out.is-stale .ohz-nb__meta {
    opacity: .4;
}

.ohz-nb__label {
    margin: 0;
    color: var(--ohz-gris);
    font: 700 11px/1.4 var(--ohz-mono);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.ohz-nb__big {
    margin: 4px 0;
    color: var(--ohz-blue);
    font: 800 clamp(56px, 12vw, 104px)/1.05 var(--ohz-mono);
    letter-spacing: -.03em;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

.ohz-nb__big.is-long {
    font-size: clamp(30px, 6.4vw, 56px);
}

.ohz-nb__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-height: 340px;
    margin: 10px 0 6px;
    padding: 0;
    overflow: auto;
    list-style: none;
}

.ohz-nb__list li {
    min-width: 46px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid color-mix(in srgb, var(--ohz-blue) 22%, white);
    border-radius: 10px;
    background: #fff;
    color: var(--ohz-noir);
    font: 700 16px/1.2 var(--ohz-mono);
    font-variant-numeric: tabular-nums;
}

.ohz-nb__list li.is-anim {
    animation: ohz-pop-txt .3s ease-out both;
}

.ohz-nb__meta {
    margin: 6px 0 0;
    color: var(--ohz-gris);
    font-size: 13.5px;
}

.ohz-nb__meta:empty {
    display: none;
}

.ohz-nb__copied {
    color: #067647;
    font-size: 13.5px;
    font-weight: 600;
}

.ohz-nb__hist {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--ohz-border);
}

.ohz-nb__prev {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ohz-nb__prev li {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    margin: 0;
    padding: 6px 0;
    border-bottom: 1px dashed var(--ohz-border);
    font-size: 13.5px;
}

.ohz-prev__range {
    flex: 0 0 auto;
    color: var(--ohz-gris);
    font-family: var(--ohz-mono);
    font-size: 12.5px;
}

.ohz-prev__val {
    min-width: 0;
    font: 700 13.5px/1.4 var(--ohz-mono);
    overflow-wrap: anywhere;
}

/* ==========================================================================
   Responsive et mouvement réduit
   ========================================================================== */
@media (max-width: 860px) {
    .ohz-pf,
    .ohz-roue {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 520px) {
    .ohz {
        padding: 18px;
    }

    .ohz-pf__stage {
        min-height: 320px;
    }

    .ohz-coin {
        width: 160px;
        height: 160px;
    }

    .ohz-coin-shadow {
        width: 120px;
    }

    .ohz-nb__form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ohz-nb__form .ohz-field:last-child {
        grid-column: 1 / -1;
    }

    .ohz-mini {
        width: 34px;
        height: 34px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ohz-coin,
    .ohz-bar span,
    .ohz-btn,
    .ohz-wheel__hub {
        transition: none;
    }

    .ohz-coin-jump.is-tossing,
    .ohz-coin-wrap.is-tossing .ohz-coin-shadow,
    .ohz-mini.is-anim,
    .ohz-nb__list li.is-anim,
    .ohz-roue__res.is-win .ohz-roue__res-val {
        animation: none;
    }
}
