/* Dice Roller — bandeja, overlay 3D y resultados (tema LTA). */
.dice-landing {text-align: center; padding: 18px 0 6px; background: radial-gradient(ellipse 60% 55% at 50% 30%, rgba(160,24,24,.22), transparent 70%);}
.dice-showcase {display: flex; justify-content: center; cursor: pointer; min-height: 240px;}
.dice-showcase canvas, .dice-idle-canvas {width: 320px; height: 262px;}
.dice-landing-title {margin: 6px 0 0;}
.dice-landing-sub {color: var(--muted); margin: 4px 0 14px;}
.dice-showcase .dice-fallback span {width: 170px; height: 170px; font-size: 3.8rem;}
.dice-tray {display: flex; flex-direction: column; gap: 14px;}
.dice-row {display: flex; gap: 8px; flex-wrap: wrap; align-items: center;}
.dice-die {min-width: 52px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,.04); color: #fff; font-weight: 800; cursor: pointer;}
.dice-die:hover {border-color: var(--gold); color: var(--gold-bright);}
.dice-field {display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: .8rem;}
.dice-field input, .dice-field select {background: rgba(255,255,255,.05); border: 1px solid var(--border); border-radius: 8px; color: #fff; padding: 8px 10px; min-width: 70px;}
.dice-field select option {background-color: #141828; color: #fff;}
.dice-seg {display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden;}
.dice-seg [data-adv] {background: transparent; border: none; color: var(--muted); padding: 9px 12px; font-weight: 700; cursor: pointer;}
.dice-seg [data-adv].on {background: var(--gold); color: #14101a;}
.dice-result {border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; background: rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 2px; min-height: 86px;}
.dice-result small {color: var(--muted); font-size: .78rem;}
.dice-result b {font-family: var(--font-display); font-size: 2rem; color: #fff; line-height: 1.1;}
.dice-result span {color: var(--muted); font-size: .85rem;}
.dice-result.crit b {color: var(--gold-bright); text-shadow: 0 0 18px rgba(216,185,120,.8);}
.dice-result.fumble b {color: #e05a4e; text-shadow: 0 0 18px rgba(224,90,78,.8);}
.dice-log {list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto;}
.dice-log li {display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--border-soft); padding: 4px 0; font-size: .88rem;}
.dice-log li.crit b {color: var(--gold-bright);}
.dice-log li.fumble b {color: #e05a4e;}
.dice-log small {color: var(--muted);}

/* Overlay central estilo BG3 */
body.dice-open {overflow: hidden;}
.dice-overlay {position: fixed; inset: 0; z-index: 400; background: rgba(4,6,16,.82); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px;}
.dice-overlay[hidden] {display: none;}
.dice-modal {text-align: center; max-width: 430px; width: 100%;}
.dice-modal-bg3 {position: relative; background: #14101f url('../../elements/marco-bg3.webp') center top / cover no-repeat; border-radius: 20px; padding: 44px 34px 34px; aspect-ratio: 1024 / 1536; max-height: 92vh; overflow-y: auto;}
@media (max-width: 640px) {
    .dice-modal-bg3 {aspect-ratio: auto; padding: 30px 20px 22px; max-height: 94vh;}
    #v2-overlay .dice-stage canvas {height: min(64vw, 300px);}
}
.dice-modal-bg3 .dice-title {letter-spacing: 3px; text-transform: uppercase; font-size: 1.5rem;}
.dice-modal-bg3 .dice-kind {letter-spacing: 1.5px; text-transform: uppercase; font-size: .8rem;}
.dice-corner {display: none;}
.dice-close {
    position: absolute; top: 10px; right: 10px; z-index: 5;
    width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid var(--gold); background: rgba(0,0,0,.55); color: var(--gold-bright);
    font-size: .95rem; line-height: 1; cursor: pointer;
}
.dice-close:hover {background: var(--gold); color: #14101a;}
.dice-corner.tl {top: 10px; left: 10px; border-right: none; border-bottom: none; border-top-left-radius: 10px;}
.dice-corner.tr {top: 10px; right: 10px; border-left: none; border-bottom: none; border-top-right-radius: 10px;}
.dice-corner.bl {bottom: 10px; left: 10px; border-right: none; border-top: none; border-bottom-left-radius: 10px;}
.dice-corner.br {bottom: 10px; right: 10px; border-left: none; border-top: none; border-bottom-right-radius: 10px;}
.dice-dc {color: var(--muted); letter-spacing: 2px; text-transform: uppercase; font-size: .8rem; margin: 6px 0 0;}
.dice-dc b {display: block; font-family: var(--font-display); font-size: 1.6rem; color: #fff; letter-spacing: 0;}
.dice-dc[hidden] {display: none;}
.dice-title {font-family: var(--font-display); font-size: 1.9rem; color: #fff; margin: 0; line-height: 1.15;}
.dice-kind {color: var(--muted); margin: 2px 0 12px; font-size: .95rem; text-shadow: 0 1px 6px rgba(0,0,0,.9);}
.dice-frame {position: relative; border: none; outline: none; background: transparent; padding: 10px 8px;}
.dice-frame::before, .dice-frame::after {content: none;}
.dice-parts {display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0 0; min-height: 0;}
.dice-parts:empty {display: none;}
.dice-part {border: 1px solid var(--gold); border-radius: 10px; padding: 6px 12px; font-weight: 800; font-size: .85rem; color: var(--gold-bright); background: rgba(216,185,120,.07);}
.dice-log time {color: var(--muted); font-size: .78rem; margin-left: auto;}
.dice-stage {display: flex; justify-content: center;}
.dice-stage canvas.dice-custom {width: 260px; height: 260px;}
#v2-overlay .dice-stage canvas {width: min(78vw, 440px); height: min(56vw, 320px);}
#v2-overlay .dice-modal {max-width: 560px;}
.dice-physics {width: 260px; height: 260px;}
.dice-physics[hidden] {display: none;}
.dice-physics canvas {width: 260px !important; height: 260px !important;}
.dice-fallback span {display: inline-flex; align-items: center; justify-content: center; width: 150px; height: 150px; font-family: var(--font-display); font-size: 3.4rem; color: var(--gold-bright); background: radial-gradient(circle at 50% 35%, #5a1414, #1c0a0a 75%); border: 2px solid var(--gold); clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);}
.dice-label {color: var(--muted); margin: 10px 0 0; font-size: .9rem;}
.dice-modal.rolling .dice-total, .dice-modal.rolling .dice-sub {visibility: hidden;}
.dice-total {margin: 2px 0;}
.dice-total b {font-family: var(--font-display); font-size: 4.2rem; color: #fff; line-height: 1;}
.dice-total.pop b {animation: dice-pop .45s ease;}
@keyframes dice-pop {0% {transform: scale(.4);} 60% {transform: scale(1.18);} 100% {transform: scale(1);}}
.dice-modal.show-crit .dice-total b {color: var(--gold-bright); text-shadow: 0 0 30px rgba(216,185,120,.9);}
.dice-modal.show-fumble .dice-total b {color: #e05a4e; text-shadow: 0 0 30px rgba(224,90,78,.9);}
.dice-sub {color: #d6dbee; min-height: 1.4em; text-shadow: 0 1px 6px rgba(0,0,0,.9);}
.dice-sub s {color: var(--muted);}
.dice-note {color: #ff7b6e; font-weight: 700; font-size: .85rem; margin: 6px 0 0;}
.dice-note[hidden] {display: none;}
.dice-hint {color: var(--muted); font-size: .8rem; margin-top: 10px;}
/* Tiradas armadas: input protagonista + chips + avanzado colapsado (v2). */
.dice-notation-row {align-items: stretch;}
.dice-notation {
    flex: 1 1 220px; min-width: 0; text-align: center;
    font-family: var(--font-display); font-size: 1.25rem; letter-spacing: 2px;
    color: #fff; background: rgba(0,0,0,.35);
    border: 1px solid var(--gold); border-radius: 12px; padding: 12px 16px;
}
.dice-notation::placeholder {color: #5d6579; letter-spacing: 2px;}
.dice-notation:focus {outline: none; border-color: var(--gold-bright); box-shadow: 0 0 16px rgba(216,185,120,.35);}
.dice-notation-row .btn {flex: 0 0 auto;}
.dice-notation-error {color: #ff7b6e; font-weight: 700; font-size: .85rem; margin: 0; min-height: 0;}
.dice-notation-error[hidden] {display: none;}
.dice-quick .dice-die {min-width: 0; padding: 8px 10px; font-size: .85rem;}
.dice-advanced {border: 1px solid var(--border-soft); border-radius: 12px; padding: 4px 14px 12px; background: rgba(0,0,0,.18);}
.dice-advanced summary {cursor: pointer; color: var(--muted); font-size: .85rem; letter-spacing: 1px; padding: 8px 0; list-style: none;}
.dice-advanced summary::-webkit-details-marker {display: none;}
.dice-advanced summary::before {content: '▸ '; color: var(--gold);}
.dice-advanced[open] summary::before {content: '▾ ';}
.dice-history {border: 1px solid var(--border-soft); border-radius: 12px; padding: 4px 14px 12px; background: rgba(0,0,0,.18);}
.dice-history summary {cursor: pointer; color: var(--muted); font-size: .85rem; letter-spacing: 1px; padding: 8px 0; list-style: none;}
.dice-history summary::-webkit-details-marker {display: none;}
.dice-history summary::before {content: '▸ '; color: var(--gold);}
.dice-history[open] summary::before {content: '▾ ';}
.dice-advanced .dice-row {margin-top: 8px;}
.dice-links {opacity: .92;}
.dice-links .btn {padding: 8px 12px; font-size: .85rem;}
/* Showcase: marco visible del area tocable para lanzar. */
#v2-showcase {
    border: 1px solid var(--gold); border-radius: 16px;
    background: radial-gradient(ellipse 70% 80% at 50% 40%, rgba(216,185,120,.08), rgba(0,0,0,.25));
    padding: 10px; cursor: pointer;
}
#v2-showcase:focus-visible {outline: 2px solid var(--gold-bright); outline-offset: 2px;}
/* Grupo propio de skin. */
.dice-skin-row {align-items: flex-end;}
.dice-skin-current {color: var(--muted); font-size: .85rem; margin: 0 0 10px;}
/* Macros (vista 1): 5 slots + ir a la mesa. */
.dice-macros {border: 1px solid var(--border-soft); border-radius: 12px; padding: 4px 14px 14px; background: rgba(0,0,0,.18);}
.dice-macros h3 {margin: 10px 0 4px;}
.dice-macros h3 small {color: var(--muted); font-weight: 400;}
.dice-macro-row {align-items: center;}
.dice-macro-row input {flex: 1 1 120px; min-width: 0; background: rgba(0,0,0,.3); border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 12px; color: #fff;}
.dice-macro-row input:focus {outline: none; border-color: var(--gold);}
/* Vista 2 (mesa): botonera inferior fija + panel de resultado. */
#v2-stage-page.dice-modal {max-width: 560px; margin: 0 auto;}
/* Mesa compacta: todo reducido para que quepa sin scroll. */
#v2-stage-page.dice-modal {padding: 26px 22px 20px;}
#v2-stage-page .dice-title {font-size: 1.4rem;}
#v2-stage-page .dice-kind {margin: 0 0 8px;}
#v2-stage-page .dice-frame {padding: 6px 4px;}
#v2-stage-page .dice-stage canvas {width: 100%; height: min(52vw, 240px);}
#v2-stage-page .dice-total {margin: 0;}
#v2-stage-page .dice-total b {font-size: 1.6rem;}
#v2-stage-page .dice-sub {min-height: 1.2em; font-size: .85rem;}
#v2-stage-page #v2-macro-bar {position: static; padding: 10px 4px 4px; background: none; border-top: none;}
#v2-stage-page .dice-history {margin-top: 8px;}
#v2-stage-page #v2p-log {max-height: 120px;}
#v2-stage-tap {cursor: pointer; border-radius: 12px;}
#v2-stage-tap:focus-visible {outline: 2px solid var(--gold-bright); outline-offset: 2px;}
#v2-macro-bar {position: sticky; bottom: 0; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 12px 8px; background: rgba(5,7,15,.94); border-top: 1px solid var(--border);}
#v2-macro-bar .btn {flex: 1 1 auto; max-width: 220px;}
.dice-result-panel {border: 1px solid var(--gold); border-radius: 14px; padding: 14px 16px; text-align: center; background: rgba(0,0,0,.3); margin-top: 12px;}
.dice-result-panel .dice-total b {font-size: 2.2rem;}
#v2p-log {list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto;}
@keyframes dice-shake {0%, 100% {transform: translateX(0);} 25% {transform: translateX(-6px);} 75% {transform: translateX(6px);}}
.dice-notation.shake {animation: dice-shake .25s ease 2;}
@media (prefers-reduced-motion: reduce) {
    .dice-notation.shake {animation: none;}
}
