/* Hidden "Dealer's Choice" die roller (dice-roller.js), shown in the shared
   SVP modal. Full-screen sheet on phones, taller centered card on desktop. */

.svp-modal-panel.svp-dice-panel {
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding-top: env(safe-area-inset-top, 0px);
}

.svp-dice-panel .svp-modal-body {
    position: relative;
    padding: 0;
    overflow: hidden;
    display: flex;
}

@media screen and (min-width: 481px) {
    .svp-modal-panel.svp-dice-panel {
        height: min(720px, 88dvh);
        max-height: min(720px, 88dvh);
        border-radius: 12px;
        padding-top: 0;
    }
}

.svp-dice {
    position: relative;
    flex: 1;
    min-height: 0;
    background: var(--felt-color);
    overflow: hidden;
}

.svp-dice-stage {
    position: absolute;
    inset: 0;
}

.svp-dice-stage canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
    -webkit-tap-highlight-color: transparent;
}

.svp-dice-stage canvas:active {
    cursor: grabbing;
}

.svp-dice-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    font-family: 'Zilla Slab', serif;
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--felt-text);
}

/* Start-up problems: message, the real error in small print, and buttons */
.svp-dice-status-box {
    width: min(100%, 340px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.svp-dice-status-detail {
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    font-size: 0.8rem;
    line-height: 1.35;
    opacity: 0.75;
    word-break: break-word;
}

.svp-dice-status-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

/* Light outline button on the felt */
.svp-dice-status .svp-dice-btn-secondary {
    color: var(--felt-text);
    border-color: var(--felt-text);
}

/* No-3D roll: no table behind the result, so center it */
.svp-dice--flat .svp-dice-result {
    justify-content: center;
    background: none;
}

.svp-dice-hint {
    position: absolute;
    left: 0;
    right: 0;
    top: 22px; /* in the dark space above the table, clear of the die */
    text-align: center;
    font-family: 'Lato', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--felt-text);
    opacity: 0.75;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    animation: svp-dice-hint-pulse 1.8s ease-in-out infinite;
}

@keyframes svp-dice-hint-pulse {
    0%, 100% { opacity: 0.45; transform: translateY(0); }
    50% { opacity: 0.85; transform: translateY(-4px); }
}

/* Result overlay: big game name across the top so the settled die stays
   visible below it. The footer button turns into Next Roll. */
.svp-dice-result {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 28px 16px 24px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 38%);
    pointer-events: none;
    animation: svp-dice-result-fade 0.25s ease-out;
}

.svp-dice-result-name {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(2.3rem, 12vw, 3.6rem);
    line-height: 1.05;
    letter-spacing: 0.03em;
    text-align: center;
    text-wrap: balance;
    color: var(--felt-text);
    text-shadow: 0 3px 0 var(--primary-color), 0 6px 18px rgba(0, 0, 0, 0.7);
    animation: svp-dice-result-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Shown when a swipe stops short of the back wall; the die then resets */
.svp-dice-warning {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(86%, 340px);
    box-sizing: border-box;
    padding: 18px 20px;
    border-radius: 12px;
    border: 2px solid var(--secondary-color);
    background: rgba(0, 0, 0, 0.72);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 7vw, 1.9rem);
    line-height: 1.15;
    letter-spacing: 0.03em;
    text-align: center;
    text-wrap: balance;
    color: var(--secondary-color);
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: svp-dice-warning-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes svp-dice-warning-pop {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes svp-dice-result-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes svp-dice-result-pop {
    from { opacity: 0; transform: scale(0.6); }
    to { opacity: 1; transform: scale(1); }
}

.svp-dice-status.hidden,
.svp-dice-hint.hidden,
.svp-dice-result.hidden,
.svp-dice-warning.hidden {
    display: none;
}

/* Footer buttons */
.svp-dice-actions {
    display: flex;
    gap: 10px;
}

.svp-dice-btn {
    flex: 1;
    min-height: 48px;
    padding: 12px 16px;
    font-family: 'Lato', sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    border-radius: 8px;
    cursor: pointer;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.svp-dice-btn-cta {
    border: none;
    background-color: var(--cta-color);
    color: var(--cta-text);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
}

.svp-dice-btn-cta:hover:not(:disabled) {
    background-color: var(--cta-hover);
}

.svp-dice-btn-cta:disabled {
    opacity: 0.5;
    cursor: default;
    box-shadow: none;
}

.svp-dice-btn-secondary {
    background: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-color);
}

.svp-dice-btn-secondary:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Settings: gear in the modal header opens felt / die color rows over the
   top of the table */
.svp-dice-gear {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1.5px solid var(--border-color);
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background 0.15s, color 0.15s;
}

.svp-dice-gear:hover,
.svp-dice-gear.is-active {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-color);
}

.svp-dice-settings {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px 10px;
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
    animation: svp-dice-settings-drop 0.18s ease-out;
}

.svp-dice-settings.hidden {
    display: none;
}

@keyframes svp-dice-settings-drop {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.svp-dice-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.svp-dice-settings-label {
    width: 40px;
    flex-shrink: 0;
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-color);
}

/* 40px circle inside a 44px tap target */
.svp-dice-swatch {
    width: 40px;
    height: 40px;
    margin: 2px;
    flex-shrink: 0;
    padding: 0;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1;
    box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.25);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.svp-dice-swatch.is-selected {
    border-color: var(--text-color);
    box-shadow: 0 0 0 3px var(--background-color), 0 0 0 5px var(--cta-color);
}
