/* ==========================================================================
   OsmoTools : tirage au sort de noms ([osmova_tirage_au_sort]) et dé virtuel ([osmova_de_virtuel])
   ========================================================================== */

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

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

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

.otr .otr__badge,
.otr .otr__count,
.otr .otr__die-n,
.otr .otr__die-t,
.otr .otr__hist li {
    font-family: var(--otr-mono) !important;
}

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

.otr__intro {
    margin: 0 0 20px;
    color: var(--otr-gris);
}

.otr :focus-visible {
    outline: 3px solid color-mix(in srgb, var(--otr-blue) 45%, white);
    outline-offset: 2px;
}

.otr__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.otr__field {
    display: flex;
    flex-direction: column;
    flex: 1 1 160px;
    gap: 6px;
    min-width: 0;
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--otr-gris);
}

.otr__field[hidden] {
    display: none;
}

.otr__field > span:first-child {
    display: flex;
    justify-content: space-between;
}

.otr__count {
    font-weight: 500;
}

.otr__field textarea,
.otr__field input[type="number"],
.otr__field select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--otr-border);
    border-radius: 10px;
    background: #fff;
    color: var(--otr-noir);
    font-family: inherit;
    font-weight: 500;
    font-size: 15px;
    line-height: 1.5;
}

.otr__field textarea {
    resize: vertical;
}

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

.otr__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0 16px;
}

.otr__check {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    min-height: 36px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.otr__check input {
    width: 18px;
    height: 18px;
    accent-color: var(--otr-blue);
}

.otr__modes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 16px;
}

.otr__mode {
    position: relative;
}

.otr__mode input {
    position: absolute;
    opacity: 0;
}

.otr__mode {
    padding: 9px 14px;
    border: 1px solid var(--otr-border);
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.otr__mode:has(input:checked) {
    border-color: var(--otr-noir);
    background: var(--otr-noir);
    color: #fff;
}

.otr__mode:has(input:focus-visible) {
    outline: 3px solid color-mix(in srgb, var(--otr-blue) 45%, white);
    outline-offset: 2px;
}

.otr__btn {
    min-height: 46px;
    padding: 10px 16px;
    border: 1px solid var(--otr-noir);
    border-radius: 10px;
    background: #fff;
    color: var(--otr-noir);
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}

.otr__btn:hover {
    background: var(--otr-gris-bg);
}

.otr__btn:disabled {
    opacity: .6;
    cursor: wait;
}

.otr__btn--main {
    width: 100%;
    border-color: var(--otr-blue);
    background: var(--otr-blue);
    color: #fff;
    font-size: 16px;
}

.otr__btn--main:hover {
    background: color-mix(in srgb, var(--otr-blue) 85%, black);
}

.otr__btn--small {
    min-height: 40px;
    font-size: 14px;
}

.otr__btn[hidden] {
    display: none;
}

.otr__status {
    min-height: 1.6em;
    margin: 12px 0;
    font-weight: 700;
    font-size: 18px;
    text-align: center;
    overflow-wrap: anywhere;
}

.otr__result {
    padding: 18px;
    border-radius: 12px;
    background: var(--otr-gris-bg);
}

.otr__result[hidden] {
    display: none;
}

.otr__when {
    margin: 0 0 10px;
    color: var(--otr-gris);
    font-size: 13px;
}

.otr__list {
    margin: 0 0 14px;
    padding-left: 1.6em;
    font-weight: 700;
    font-size: 20px;
    overflow-wrap: anywhere;
}

.otr__list:empty {
    display: none;
}

.otr__teams {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin: 0 0 14px;
}

.otr__teams:empty {
    display: none;
}

.otr__team {
    padding: 12px;
    border: 1px solid var(--otr-border);
    border-radius: 10px;
    background: #fff;
}

.otr .otr__team-t {
    margin: 0 0 6px;
    font-weight: 700;
}

.otr__team ul {
    margin: 0;
    padding-left: 1.1em;
    overflow-wrap: anywhere;
}

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

/* ---------- Dé ---------- */

.otr__row--de {
    align-items: flex-end;
}

.otr__seg {
    display: flex;
    gap: 6px;
}

.otr__seg label {
    flex: 1 1 0;
}

.otr__seg input {
    position: absolute;
    opacity: 0;
}

.otr__seg span {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 40px;
    min-height: 46px;
    border: 1px solid var(--otr-border);
    border-radius: 10px;
    color: var(--otr-noir);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
}

.otr__seg input:checked + span {
    border-color: var(--otr-noir);
    background: var(--otr-noir);
    color: #fff;
}

.otr__seg input:focus-visible + span {
    outline: 3px solid color-mix(in srgb, var(--otr-blue) 45%, white);
    outline-offset: 2px;
}

.otr__table {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    min-height: 150px;
    margin: 8px 0 12px;
    padding: 24px 12px;
    border-radius: 16px;
    background: radial-gradient(circle at 50% 30%, #1F7A4D 0%, #0F5132 100%);
}

.otr__die {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 96px;
    height: 96px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 6px 0 #D7DBE0, 0 10px 20px rgba(0, 0, 0, .3);
}

.otr__die--6 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 14px;
}

.otr__die--6 span {
    display: block;
}

.otr__pip {
    width: 18px;
    height: 18px;
    margin: auto;
    border-radius: 50%;
    background: var(--otr-noir);
}

.otr__die-n {
    font-weight: 800;
    font-size: 40px;
    line-height: 1;
}

.otr__die-t {
    margin-top: 4px;
    color: var(--otr-gris);
    font-size: 11px;
}

.otr__table--roll .otr__die {
    animation: otr-roll .12s linear infinite;
}

@keyframes otr-roll {
    0% { transform: rotate(-8deg) translateY(-2px); }
    50% { transform: rotate(8deg) translateY(2px); }
    100% { transform: rotate(-8deg) translateY(-2px); }
}

.otr__total {
    margin: 0 0 14px;
    font-weight: 800;
    font-size: 22px;
    text-align: center;
}

.otr .otr__hist-t {
    margin: 20px 0 6px;
    color: var(--otr-gris);
    font-weight: 700;
    font-size: 13px;
}

.otr__hist {
    margin: 0;
    padding-left: 2em;
    color: var(--otr-gris);
    font-size: 14px;
}

.otr__hist:empty {
    display: none;
}

@media (max-width: 760px) {
    .otr__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 480px) {
    .otr {
        padding: 18px;
    }

    .otr__die {
        width: 72px;
        height: 72px;
        border-radius: 14px;
    }

    .otr__die--6 {
        padding: 10px;
    }

    .otr__pip {
        width: 13px;
        height: 13px;
    }

    .otr__die-n {
        font-size: 30px;
    }

    .otr__seg span {
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .otr__table--roll .otr__die {
        animation: none;
    }
}
