/* Partida activa (/partida). Reutiliza las superficies y fichas del tema. */

.match-setup { display: grid; gap: 14px; margin-bottom: 18px; }
.match-setup p { margin: 0; }
.match-pick__title {
    margin: 0;
    font-family: var(--punk-font-display); font-size: 1rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--punk-ink);
}

/* Bandas cargadas del rival: tinta y borde a trazos, con su sello, para no confundirlas con las tuyas. */
.faction-tile--rival {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    background-color: var(--punk-ink); background-image: none;
    color: var(--punk-accent);
    border-style: dashed; border-color: var(--punk-accent);
}
.faction-tile--rival.is-selected { color: var(--punk-text); border-style: solid; border-color: var(--punk-black); }
.faction-tile__tag {
    display: inline-flex; align-items: center; gap: 4px;
    font-family: var(--punk-font-body); font-size: .72rem; letter-spacing: .1em; opacity: .85;
}
.faction-tile__tag svg { width: 12px; height: 12px; }

.match-join { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.match-join .field { flex: 1 1 180px; }
.match-join__code { font-family: var(--punk-font-display); font-size: 1.4rem; letter-spacing: .25em; text-transform: uppercase; }

.match-code {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    padding: 14px; margin-bottom: 16px;
}
.match-code__value { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; }
.match-code__seed { font-size: 1.7rem; letter-spacing: .2em; }

.match-status { background: var(--punk-surface-2); color: var(--punk-text-muted); }
.match-status--online { background: var(--punk-toxic); color: var(--punk-ink); }
.match-status--offline { background: var(--punk-rust); color: var(--punk-text); }

/* Partidas en línea por código: aún experimentales. */
.match-experimental { justify-self: start; font-size: .75rem; padding: 2px 8px 1px; border-width: 2px; }
.match-code .match-experimental { flex: none; align-self: center; }
.match-experimental__note { font-size: .9rem; font-style: italic; }


.match-sides { display: grid; gap: 18px; }
@media (min-width: 900px) {
    .match-sides { grid-template-columns: 1fr 1fr; }
}

.match-side__count { margin: -4px 0 10px; color: var(--punk-text-muted); }

.match-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.match-member {
    display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px;
    padding: 8px 10px;
    background-color: var(--punk-surface);
    background-image: var(--punk-tex-metal);
    border-left: 4px solid var(--punk-accent);
}
.match-member.is-activated { border-left-color: var(--punk-steel); }
/* Caído: foto en gris y una X de pintura roja encima del retrato y el nombre */
.match-member.is-down { border-left-color: var(--punk-rust); }
.match-member.is-down .match-member__name { opacity: .6; }
.match-member.is-down .match-member__name strong { text-decoration: line-through; text-decoration-color: var(--punk-blood); }
.match-member.is-down .portrait img { filter: grayscale(1) contrast(1.15) brightness(.85); }
.match-member__open { position: relative; }
.match-member.is-down .match-member__open::after {
    content: ""; position: absolute; left: -4px; top: 50%; width: min(160px, 100%); height: 50px;
    transform: translateY(-50%) rotate(-4deg);
    background: var(--punk-paint-x) center / 100% 100% no-repeat;
    pointer-events: none;
    animation: paint-x .22s ease-out;
}
@keyframes paint-x { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: reduce) { .match-member.is-down .match-member__open::after { animation: none; } }
.match-member__name { display: flex; flex-direction: column; min-width: 0; }
.match-member__name strong, .match-member__name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-member__name small { color: var(--punk-text-muted); }

.match-toggle { border: 0; cursor: pointer; min-height: 44px; background: var(--punk-surface-2); color: var(--punk-text); font: inherit; }
.match-toggle[aria-pressed="true"] { background: var(--punk-steel); color: var(--punk-ink); }
.match-toggle--down[aria-pressed="true"] { background: var(--punk-rust); color: var(--punk-text); }
.match-toggle:disabled { cursor: default; }
/* Por actuar: pegatina de arena con rombo estarcido, salta a la vista frente a las que ya han ido */
.match-toggle--pending {
    position: relative; gap: 8px; justify-content: center;
    background: var(--punk-accent) var(--punk-tex-paper, none) center / cover;
    background-blend-mode: multiply;
    color: var(--punk-ink);
    font-family: var(--punk-font-display); font-size: .95rem; letter-spacing: .1em;
    clip-path: var(--punk-rough);
    transform: rotate(-1.2deg);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .28);
}
.match-toggle--pending::before {
    content: ""; flex: none; width: 10px; height: 10px;
    background: var(--punk-blood); transform: rotate(45deg);
    animation: pending-blink 1.6s ease-in-out infinite;
}
@keyframes pending-blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .match-toggle--pending::before { animation: none; } }

@media (max-width: 420px) {
    .match-member { grid-template-columns: 1fr 1fr; }
    .match-member__open { grid-column: 1 / -1; }
}

/* Tocar la foto o el nombre abre la ficha entera. */
.match-member__open {
    display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px;
    padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.match-member__open:focus-visible { outline: 2px solid var(--punk-accent); outline-offset: 2px; }
.match-member__open:hover .match-member__name strong { text-decoration: underline; text-decoration-color: var(--punk-blood); }

/* Marcador de chatarra: chapa atornillada con los tantos en placas estarcidas */
.match-score {
    position: relative;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
    margin-bottom: 14px; padding: 16px 14px 14px;
    color: var(--punk-text);
    background-color: var(--punk-bar);
    background-image:
        var(--punk-tex-rivet-rust), var(--punk-tex-rivet-rust), var(--punk-tex-rivet-rust), var(--punk-tex-rivet-rust),
        linear-gradient(to bottom, rgba(255, 255, 255, .08), rgba(255, 255, 255, 0) 40%, rgba(0, 0, 0, .22)),
        var(--punk-tex-shots),
        var(--punk-tex-grain), var(--punk-tex-plate);
    background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat, repeat;
    background-position: left 3px top 3px, right 3px top 3px, left 3px bottom 3px, right 3px bottom 3px, 0 0, -120px -40px, 0 0, 0 0;
    border: 2px solid var(--punk-black);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), inset -1px 0 0 rgba(0, 0, 0, .5), var(--punk-shadow);
}
.match-score::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: var(--punk-tex-rust) left 200px top 40px / 470px;
    opacity: .55;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .2), #000);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .2), #000);
}
.match-score > * { position: relative; }
.match-score__side { display: grid; justify-items: center; gap: 4px; min-width: 0; text-align: center; }
.match-score__name {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-family: var(--punk-font-display); text-transform: uppercase; letter-spacing: .04em; font-size: .9rem;
}
.match-score__name { text-shadow: 0 1px 0 rgba(0, 0, 0, .9); }
/* Placa del tanto: hueco oscuro hundido con una raya en medio, como un marcador de paletas */
.match-score__value {
    min-width: 2.2ch; padding: 6px 12px 2px;
    font-family: var(--punk-font-display); font-size: 3rem; line-height: 1; text-align: center;
    color: var(--punk-accent); font-variant-numeric: tabular-nums;
    background:
        linear-gradient(to bottom, transparent calc(50% - 1px), rgba(0, 0, 0, .85) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
        linear-gradient(to bottom, #1b1714, #0d0b09);
    border: 2px solid var(--punk-black);
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, .8), 0 1px 0 rgba(255, 255, 255, .12);
    text-shadow: 0 0 1px rgba(0, 0, 0, .6);
}
.match-score .stepper__btn { color: var(--punk-accent); }

/* Dial de rondas: un sector por ronda, rellenos en rojo hasta la actual */
.round-dial {
    --size: 74px;
    position: relative; flex: none;
    width: var(--size); height: var(--size); border-radius: 50%;
    display: grid; place-items: center;
    background:
        repeating-conic-gradient(from -3deg, var(--punk-black) 0 6deg, transparent 6deg calc(360deg / var(--rounds, 6))),
        conic-gradient(var(--punk-blood) 0 calc(360deg * var(--round, 1) / var(--rounds, 6)), #3a3430 0);
    border: 3px solid var(--punk-black);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .6), 0 2px 0 rgba(255, 255, 255, .25), 0 4px 8px rgba(0, 0, 0, .35);
}
.round-dial__value {
    display: grid; place-items: center;
    width: 56%; height: 56%; border-radius: 50%;
    background: radial-gradient(circle at 38% 34%, #6b6460, #2a2623 60%, #141210);
    color: var(--punk-accent); font-family: var(--punk-font-display); font-size: 1.35rem; line-height: 1;
    box-shadow: 0 2px 3px rgba(0, 0, 0, .7);
    text-shadow: 0 1px 0 rgba(0, 0, 0, .9);
}
.match-result { margin-bottom: 14px; }

/* Contadores de la banda (Ambrosía, Mojo…) */
.match-pool {
    display: grid; gap: 10px; margin-bottom: 12px; padding: 10px 12px;
    background-color: var(--punk-surface-2);
    background-image: var(--punk-tex-metal);
}
.match-pool__refill { justify-self: start; }

.aid { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.aid .stepper { flex: 0 1 auto; }
.aid__name { font-weight: 600; }
.aid__note { font-size: .85rem; color: var(--punk-accent); }
.aid__note--muted { color: var(--punk-text-muted); }
.aid__hint { flex-basis: 100%; font-size: .85rem; color: var(--punk-text-muted); }
.aid__once { border: 0; cursor: pointer; min-height: 36px; background: var(--punk-surface); color: var(--punk-text); font: inherit; font-size: .85rem; }
.aid__once[aria-pressed="true"] { background: var(--punk-steel); color: var(--punk-ink); text-decoration: line-through; }
.aid__once:disabled { cursor: default; }
.aid__toggle { border: 0; cursor: pointer; min-height: 36px; background: var(--punk-surface); color: var(--punk-text); font: inherit; font-size: .85rem; }
.aid__toggle--on { background: var(--punk-steel); color: var(--punk-ink); }
.aid__toggle:disabled { cursor: default; }
.aid__toggle-state { font-weight: 700; }
.aid__picked { display: inline-flex; align-items: center; text-decoration: none; }
.aid__once.aid__picked[aria-pressed="true"] { text-decoration: none; }
.aid__undo { font-size: .85rem; }
.match-member__aids .aid__undo { color: var(--punk-accent); }
.aid__choices { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.aid__ask { flex-basis: 100%; font-size: .85rem; font-weight: 600; }
.aid__choice { border: 1px solid var(--punk-blood); cursor: pointer; min-height: 36px; background: transparent; color: inherit; font: inherit; font-size: .85rem; }
.statbox--changed { background: var(--punk-blood); }
.statbox--changed dd { color: #fff; }

/* Número pequeño encima del Atributo: cuánto le suma o le resta lo que lleva o lo apuntado en la partida (también en la banda). */
.datacard__stats .statbox { position: relative; }
.statbox__mod {
    position: absolute; top: -8px; right: -6px; z-index: 1;
    min-width: 1.5em; padding: 1px 4px;
    font: 700 .72rem/1.15 var(--punk-font-body); text-align: center; color: #fff;
    background: var(--punk-blood); border: 1px solid var(--punk-black); border-radius: var(--punk-radius);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .6); pointer-events: none;
}
.statbox__mod--up { background: var(--punk-toxic); color: var(--punk-ink); }
.stat--changed { color: var(--punk-blood); font-weight: 700; }
.aid__readonly strong { font-family: var(--punk-font-display); }

.match-member__aids {
    grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 14px;
    padding-top: 6px; border-top: 1px dashed rgba(236, 194, 140, .25);
}

/* Ficha durante la partida (sobre papel) */
.match-sheet { max-height: min(88vh, 760px); }
.match-sheet__state { display: flex; flex-wrap: wrap; gap: 6px; }
.match-sheet__down { background: var(--punk-rust); color: var(--punk-text); }
.match-sheet__profile { display: flex; flex-wrap: wrap; gap: 4px 12px; font-family: var(--punk-font-display); }
.match-sheet__profile abbr { text-decoration: none; color: var(--punk-ink-muted); }
.match-aids--sheet { display: grid; gap: 12px; }
.match-sheet .aid__note, .match-sheet .aid__hint, .match-sheet .aid__note--muted { color: var(--punk-ink-muted); }
.match-sheet .aid__note { color: var(--punk-blood); }
.match-sheet .aid__name { color: var(--punk-ink); }

.match-waiting { margin: 0; }
.match-end { margin-top: 24px; justify-content: flex-end; }

/* La cabecera de la ficha es de chapa: texto claro aunque la ventana sea de papel. */
.match-sheet .datacard__head { color: var(--punk-text); }

/* Contadores de cada miembro: en una línea y pequeños, para que la lista no crezca. */
.match-member__aids .stepper { flex-direction: row; align-items: center; gap: 8px; }
.match-member__aids .stepper__label { font-size: .72rem; color: var(--punk-text-muted); }
.match-member__aids .stepper__controls { border-width: 2px; }
.match-member__aids .stepper__btn { width: 36px; height: 36px; font-size: 1.1rem; }
.match-member__aids .stepper__value { min-width: 28px; font-size: 1.1rem; }
.match-member__aids .aid { gap: 4px 8px; }
.match-pool .stepper__btn, .match-member__aids .stepper__btn { color: var(--punk-accent); }
.match-pool .gear-item__link { color: var(--punk-accent); }

/* ---------- Partidas guardadas ---------- */

.match-saved { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; }
.match-saved__item {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px;
    padding: 12px 14px;
}
.match-saved__info { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 220px; }
.match-saved__title { font-family: var(--punk-font-display); font-size: 1.15rem; font-weight: normal; overflow-wrap: anywhere; }
.match-saved__title span { color: var(--punk-accent); font-size: .85rem; margin: 0 4px; }
.match-saved__meta { font-size: .85rem; color: var(--punk-text-muted); }
.match-saved__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- Mapa, fotos y notas de la partida ---------- */

.match-record { margin-top: 26px; }
.match-map {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    padding: 14px; margin-bottom: 18px;
}
.match-map__hint, .match-map__note { margin: 0; flex: 1 1 100%; }
.match-map__note { font-size: .82rem; }
.match-map__form { flex: 1 1 260px; }

.match-photos { display: grid; gap: 12px; margin-bottom: 18px; }
.match-photos p { margin: 0; }
.match-photos__hint strong { color: var(--punk-blood); }
.photo-picker__actions label.is-disabled { opacity: .5; cursor: not-allowed; }
.match-photos__grid {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}
/* Cada foto, como una polaroid pegada en el papel */
.match-photos__thumb {
    display: flex; flex-direction: column; gap: 6px; width: 100%;
    padding: 6px 6px 8px; border: 0; cursor: pointer;
    background: #f4ede2; color: var(--punk-ink);
    box-shadow: 0 3px 8px rgba(0, 0, 0, .35);
    font: inherit; font-size: .78rem;
}
.match-photos__grid li:nth-child(odd) .match-photos__thumb { transform: rotate(-1.5deg); }
.match-photos__grid li:nth-child(even) .match-photos__thumb { transform: rotate(1.2deg); }
.match-photos__thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--punk-black); display: block; }

.match-notes { display: grid; gap: 6px; }
.match-notes textarea { width: 100%; min-height: 120px; font-family: var(--punk-font-body); line-height: 1.45; }
.match-notes__state { margin: 0; font-size: .8rem; }
.match-record__private { font-size: .82rem; margin: 10px 0 0; }

/* Foto a pantalla completa */
.photo-viewer {
    position: fixed; inset: 0; z-index: 60;
    display: flex; flex-direction: column;
    background: rgba(13, 11, 9, .95);
}
.photo-viewer__stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px; }
.photo-viewer__stage img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: var(--punk-shadow); }
.photo-viewer__bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--punk-bar);
}
.photo-viewer__bar > span { flex: 1 1 auto; color: var(--punk-text-muted); }

/* ---------- Modo mesa: el móvil apoyado en la mesa, a un brazo de distancia ---------- */

.table-mode .punk-main { font-size: 1.12rem; }
.table-mode .match-score__value { font-size: 4.4rem; }
.table-mode .match-score__name { font-size: 1.1rem; }
.table-mode .stepper__btn { width: 58px; height: 58px; font-size: 1.9rem; }
.table-mode .stepper__value { font-size: 2.1rem; min-width: 58px; }
.table-mode .round-dial { --size: 96px; }
.table-mode .round-dial__value { font-size: 1.8rem; }
.table-mode .btn { min-height: 56px; font-size: 1.1rem; }
.table-mode .match-member { padding: 12px; gap: 12px; }
.table-mode .match-member__name strong { font-size: 1.15rem; }
.table-mode .match-toggle { min-height: 56px; padding: 6px 14px; font-size: .95rem; }
.table-mode .match-member__aids .stepper__btn { width: 46px; height: 46px; font-size: 1.4rem; }
.table-mode .match-member__aids .stepper__value { font-size: 1.4rem; min-width: 36px; }

/* ---------- Dado: botón flotante, bandeja con d10 que ruedan e interruptor de sacudir ---------- */

.dice-fab .icon { width: 1.4em; height: 1.4em; }
.dice-sheet { gap: 12px; }

.dice-tray {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px;
    min-height: 132px; padding: 16px 10px;
    border: 0; cursor: pointer;
    background-color: #3b2f22;
    background-image: radial-gradient(ellipse at 50% 40%, rgba(236, 194, 140, .14), rgba(13, 11, 9, .55) 75%), var(--punk-tex-metal, none);
    box-shadow: inset 0 0 0 2px var(--punk-black), inset 0 8px 18px rgba(0, 0, 0, .65);
    -webkit-tap-highlight-color: transparent;
}
.dice-tray:disabled { cursor: progress; }

.die {
    --die-body: var(--punk-blood); --die-face: #c2261a; --die-ink: var(--punk-text);
    position: relative; display: inline-grid; place-items: center;
    width: clamp(64px, 22vw, 92px); aspect-ratio: 1;
    animation: die-land .62s cubic-bezier(.2, .9, .3, 1.25) both;
    animation-delay: calc(var(--i) * 45ms);
    filter: drop-shadow(0 6px 4px rgba(0, 0, 0, .55));
}
.die svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.die__body { fill: var(--die-body); stroke: var(--punk-black); stroke-width: 3; stroke-linejoin: round; }
.die__face { fill: var(--die-face); stroke: var(--punk-black); stroke-width: 2.5; stroke-linejoin: round; }
.die__edge { fill: none; stroke: var(--punk-black); stroke-width: 2.5; stroke-linecap: round; }
.die__value {
    position: relative; margin-bottom: 10%;
    font-family: var(--punk-font-display); font-size: clamp(1.5rem, 7vw, 2.1rem); line-height: 1;
    color: var(--die-ink); text-shadow: 0 2px 0 rgba(13, 11, 9, .6);
}
.die--1 { --die-body: #c99a5e; --die-face: var(--punk-accent); --die-ink: var(--punk-ink); }
.die--2 { --die-body: #4f4f4f; --die-face: var(--punk-steel); }
.die--3 { --die-body: #5d7f22; --die-face: var(--punk-toxic); --die-ink: var(--punk-ink); }
.die--4 { --die-body: #2a2a2a; --die-face: #3d3d3d; --die-ink: var(--punk-accent); }
.die--5 { --die-body: #cfc6b8; --die-face: var(--punk-text); --die-ink: var(--punk-blood); }

.die--d6 .die__body, .die--d6 .die__face { stroke-width: 3; }
.die__pip { fill: var(--die-ink); stroke: rgba(13, 11, 9, .45); stroke-width: 1.5; }

.dice-kinds { display: flex; gap: 8px; }
.dice-kind {
    flex: 1 1 0; min-height: 44px; padding: 6px 12px;
    border: 0; cursor: pointer;
    font-family: var(--punk-font-display); font-size: 1.25rem; letter-spacing: .04em;
    color: var(--punk-ink); background: rgba(29, 23, 18, .08);
    box-shadow: inset 0 0 0 2px var(--punk-ink);
}
.dice-kind[aria-pressed="true"] { color: var(--punk-text); background: var(--punk-blood); box-shadow: inset 0 0 0 2px var(--punk-black); }
.dice-kind:disabled { cursor: progress; }
.dice-kind:focus-visible { outline: 2px solid var(--punk-blood); outline-offset: 2px; }

.dice-tray.is-rolling .die { animation: die-tumble .34s linear infinite; animation-delay: calc(var(--i) * -70ms); }
.dice-tray.is-rolling .die__value { opacity: .75; }

@keyframes die-tumble {
    0% { transform: translate(0, 0) rotate(0); }
    25% { transform: translate(6px, -14px) rotate(95deg) scale(.92); }
    50% { transform: translate(-4px, -4px) rotate(180deg) scale(1.04); }
    75% { transform: translate(-7px, -12px) rotate(275deg) scale(.94); }
    100% { transform: translate(0, 0) rotate(360deg); }
}
@keyframes die-land {
    0% { transform: translate(-18px, -26px) rotate(-200deg) scale(.7); }
    60% { transform: translate(3px, 2px) rotate(12deg) scale(1.08); }
    100% { transform: none; }
}

.dice-result { font-size: 1.05rem; text-align: center; min-height: 1.5em; }
.dice-result strong { font-family: var(--punk-font-display); font-size: 1.5rem; letter-spacing: .04em; color: var(--punk-blood); }
.dice-roll { flex: 1 1 auto; justify-content: center; }

.dice-shake { display: grid; gap: 4px; }
.dice-shake__switch {
    display: flex; align-items: center; gap: 12px;
    min-height: 44px; padding: 4px 0;
    border: 0; background: none; color: var(--punk-ink);
    font: inherit; font-weight: 500; text-align: left; cursor: pointer;
}
.dice-shake__knob {
    position: relative; flex: none; width: 48px; height: 26px;
    background: rgba(29, 23, 18, .2); box-shadow: inset 0 0 0 2px var(--punk-ink);
    transition: background-color .15s;
}
.dice-shake__knob::after {
    content: ""; position: absolute; top: 4px; left: 4px; width: 18px; height: 18px;
    background: var(--punk-ink); transition: transform .15s;
}
.dice-shake__switch[aria-checked="true"] .dice-shake__knob { background: var(--punk-blood); }
.dice-shake__switch[aria-checked="true"] .dice-shake__knob::after { transform: translateX(22px); background: var(--punk-text); }
.dice-shake__switch:focus-visible { outline: 2px solid var(--punk-blood); outline-offset: 2px; }
.dice-history { text-align: center; }

.table-mode .die { width: clamp(76px, 26vw, 110px); }
.table-mode .dice-result strong { font-size: 2rem; }

@media (prefers-reduced-motion: reduce) {
    .die, .dice-tray.is-rolling .die { animation: none; }
}

/* ---------- Barra de la partida: marcador y ronda pegados bajo la cabecera ---------- */

.match-bar {
    position: sticky; z-index: 8;
    top: calc(max(10px, env(safe-area-inset-top)) + 56px);
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 8px; padding: 14px 10px 10px; margin-bottom: 16px;
}
.match-bar .match-score__side { gap: 2px; }
.match-bar .match-score__name { font-size: .78rem; }
.match-bar .match-score__value { font-size: 2.1rem; padding: 4px 8px 1px; }
.match-score__count { display: flex; align-items: center; gap: 4px; }
.match-bar .stepper__btn {
    width: 36px; height: 40px; font-size: 1.3rem; color: var(--punk-accent);
    background: rgba(13, 11, 9, .55); border: 2px solid rgba(236, 194, 140, .5);
}
.match-bar .stepper__btn:disabled { opacity: .45; }
.match-bar__round { display: grid; justify-items: center; gap: 6px; }
.match-bar__dial { display: flex; align-items: center; gap: 4px; }
.match-bar .round-dial { --size: 46px; border-width: 2px; }
.match-bar .round-dial__value { font-size: 1.05rem; }
.match-bar .match-bar__back { width: 30px; height: 36px; font-size: 1.4rem; color: var(--punk-accent); }
.match-bar__of { font-family: var(--punk-font-display); font-size: .75rem; color: var(--punk-text-muted); text-shadow: 0 1px 0 rgba(0, 0, 0, .9); }
.match-bar__next { min-height: 40px; padding: 6px 12px; font-size: .9rem; white-space: nowrap; }
.match-bar__confirm {
    grid-column: 1 / -1;
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding-top: 8px; border-top: 1px dashed rgba(236, 194, 140, .3);
}
.match-bar__confirm span { flex: 1 1 100%; font-weight: 600; }
.match-bar__confirm .btn { flex: 1 1 0; min-height: 42px; }

/* En pantallas estrechas los botones del tanto van en columna junto a la placa. */
@media (max-width: 400px) {
    .match-bar { gap: 4px; padding-inline: 8px; }
    .match-bar .match-score__count { gap: 3px; }
    .match-bar .match-score__count .stepper__btn { width: 30px; height: 30px; font-size: 1.1rem; }
    .match-bar .match-score__count { display: grid; grid-template-columns: auto auto; }
    .match-bar .match-score__count .match-score__value { grid-column: 1; grid-row: 1 / 3; }
    .match-bar .match-score__plus { grid-column: 2; grid-row: 1; }
    .match-bar .match-score__minus { grid-column: 2; grid-row: 2; }
    .match-bar__next { padding-inline: 8px; font-size: .8rem; }
}

/* Pestañas Mi banda / Rival: solo en móvil y tablet; en escritorio van las dos columnas. */
.match-tabs { margin-bottom: 14px; }
.match-tabs__tab { display: grid; justify-items: center; gap: 2px; min-width: 0; padding-block: 6px; }
.match-tabs__name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.match-tabs__pending {
    font-family: var(--punk-font-body); font-size: .75rem; letter-spacing: 0; text-transform: none;
    color: var(--punk-accent);
}
.match-tabs__pending.is-done { color: var(--punk-text-muted); }
@media (max-width: 899px) {
    .match-sides[data-tab="own"] > .match-side--rival,
    .match-sides[data-tab="rival"] > .match-side--own { display: none; }
    .match-sides .match-side > .section-title { display: none; }
}
@media (min-width: 900px) {
    .match-tabs { display: none; }
}
@media (max-width: 899px) {
    .match-side__pending { display: none; }
}
@media (max-width: 360px) {
    .match-bar__next-word { display: none; }
}

/* Misión, mapa, fotos y notas: plegados, con lo esencial a la vista. */
.match-fold { margin-bottom: 4px; }
.match-fold__head { cursor: pointer; list-style: none; margin: 18px 0 12px; }
.match-fold__head::-webkit-details-marker { display: none; }
.match-fold__head::after { order: 2; }
.match-fold__meta {
    order: 3; display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--punk-font-body); font-size: .85rem; letter-spacing: 0; color: var(--punk-text-muted);
}
.match-fold__meta::after {
    content: ""; width: 9px; height: 9px;
    border-right: 2px solid var(--punk-accent); border-bottom: 2px solid var(--punk-accent);
    transform: rotate(-45deg); transition: transform .15s;
}
.match-fold[open] > .match-fold__head .match-fold__meta::after { transform: rotate(45deg); }
.match-fold__head:focus-visible { outline: 2px solid var(--punk-accent); outline-offset: 4px; }

.table-mode .match-bar .match-score__value { font-size: 2.8rem; }
.table-mode .match-bar .stepper__btn { width: 44px; height: 48px; font-size: 1.6rem; }
.table-mode .match-bar .round-dial { --size: 56px; }
.table-mode .match-bar .match-bar__next { min-height: 48px; font-size: 1rem; }

/* Modo mesa en móvil: la ronda queda en medio con su botón en una fila propia debajo,
   y los botones del tanto bajo la placa, para que todo quepa a lo ancho. */
@media (max-width: 599px) {
    .table-mode .match-bar { column-gap: 6px; row-gap: 10px; padding-inline: 8px; }
    .table-mode .match-bar__round { display: contents; }
    .table-mode .match-bar > .match-score__side { grid-row: 1; }
    .table-mode .match-bar > .match-score__side:first-child { grid-column: 1; }
    .table-mode .match-bar > .match-score__side ~ .match-score__side { grid-column: 3; }
    .table-mode .match-bar__dial {
        grid-column: 2; grid-row: 1;
        display: grid; grid-template-columns: auto auto; align-items: center; justify-items: center; gap: 2px 4px;
    }
    .table-mode .match-bar__of { grid-column: 2; }
    .table-mode .match-bar .match-bar__back { width: 32px; }
    .table-mode .match-bar .match-bar__next { grid-column: 1 / -1; grid-row: 2; width: 100%; }
    .table-mode .match-bar__next-word { display: inline; }
    .table-mode .match-bar__confirm { grid-row: 3; }
    .table-mode .match-bar .match-score__count {
        display: grid; grid-template-columns: auto auto; justify-content: center; gap: 6px;
    }
    .table-mode .match-bar .match-score__count .match-score__value { grid-column: 1 / -1; grid-row: 1; }
    .table-mode .match-bar .match-score__minus { grid-column: 1; grid-row: 2; }
    .table-mode .match-bar .match-score__plus { grid-column: 2; grid-row: 2; }
    .table-mode .match-bar .match-score__count .match-score__value:only-child { grid-column: auto; }
    .table-mode .match-bar .match-score__value { padding-inline: 6px; }
    .table-mode .match-bar .match-score__count .stepper__btn { width: 46px; height: 46px; }
}
@media (max-width: 360px) {
    .table-mode .match-bar .match-score__value { font-size: 2.2rem; }
    .table-mode .match-bar .match-score__count .stepper__btn { width: 40px; height: 42px; }
}
