/* Royal Game of Ur 3D — scoped styles */
.ur3d-root {
    max-width: 780px;
    margin: 2rem auto;
    font-family: 'Crimson Text', Georgia, serif;
    background: linear-gradient(175deg, #f5ede0 0%, #ede1cc 100%);
    border: 2px solid #c19a6b;
    border-radius: 10px;
    padding: 1rem 1rem 1.25rem;
    box-shadow: 0 6px 24px rgba(44, 24, 16, 0.18);
}

.ur3d-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
}

.ur3d-status {
    font-size: 1.05rem;
    font-weight: 600;
    color: #6b4a2b;
    min-height: 1.4em;
    flex: 1 1 auto;
}
.ur3d-status[data-tone="gold"] { color: #a87c17; }
.ur3d-status[data-tone="warn"] { color: #8e2f28; }

.ur3d-stage {
    position: relative;
    width: 100%;
    min-height: 320px;
    border-radius: 8px;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 38%, #453522 0%, #241a10 70%);
}
.ur3d-stage canvas { display: block; width: 100% !important; height: auto !important; }

.ur3d-fallback {
    color: #f5ede0;
    padding: 2.5rem 1.5rem;
    text-align: center;
    font-size: 1rem;
}

.ur3d-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.9rem;
}

.ur3d-roll,
.ur3d-new {
    border: none;
    border-radius: 6px;
    padding: 0.55rem 1.6rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.ur3d-roll {
    background: linear-gradient(180deg, #d4af37, #b8860b);
    color: #2c1810;
    box-shadow: 0 2px 6px rgba(44, 24, 16, 0.35);
}
.ur3d-roll:not(:disabled):hover { transform: translateY(-1px); }
.ur3d-roll:disabled { opacity: 0.45; cursor: default; }
.ur3d-new { background: #6b4a2b; color: #f5ede0; }
.ur3d-new:hover { background: #7d5834; }

.ur3d-mode {
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.45rem 0.6rem;
    border: 1.5px solid #c19a6b;
    border-radius: 6px;
    background: #fdf8ee;
    color: #2c1810;
}

.ur3d-sound {
    border: 1.5px solid #c19a6b;
    background: #fdf8ee;
    border-radius: 6px;
    font-size: 1.05rem;
    line-height: 1;
    padding: 0.42rem 0.55rem;
    cursor: pointer;
}

.ur3d-counters {
    display: flex;
    justify-content: center;
    gap: 1.6rem;
    flex-wrap: wrap;
    margin-top: 0.7rem;
    font-size: 0.92rem;
    color: #4a3520;
}
.ur3d-counters strong { color: #2c1810; }

.ur3d-moves {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: center;
    margin-top: 0.6rem;
}
.ur3d-movebtn {
    border: 1.5px solid #b8860b;
    background: #fdf8ee;
    color: #6b4a2b;
    font-family: inherit;
    font-size: 0.86rem;
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    cursor: pointer;
}
.ur3d-movebtn:hover,
.ur3d-movebtn:focus-visible {
    background: #b8860b;
    color: #fff;
    outline: 2px solid #6b4a2b;
    outline-offset: 1px;
}

/* win modal — the [hidden] rule is load-bearing (display:flex would override
   the hidden attribute otherwise) */
.ur3d-winmodal {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(36, 26, 16, 0.72);
    z-index: 5;
}
.ur3d-winmodal[hidden] { display: none; }
.ur3d-winbox {
    background: #f5ede0;
    border: 2px solid #b8860b;
    border-radius: 10px;
    padding: 1.6rem 2rem;
    text-align: center;
    max-width: 320px;
}
.ur3d-wintext {
    font-size: 1.15rem;
    font-weight: 700;
    color: #2c1810;
    margin: 0 0 1rem;
}
.ur3d-again {
    background: linear-gradient(180deg, #d4af37, #b8860b);
    color: #2c1810;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.5rem 1.5rem;
    cursor: pointer;
}

.ur3d-help {
    margin-top: 1rem;
    background: #fdf8ee;
    border: 1px solid #d4c4a8;
    border-radius: 8px;
    padding: 0.8rem 1rem;
}
.ur3d-help summary {
    cursor: pointer;
    font-weight: 700;
    color: #6b4a2b;
}
.ur3d-help div {
    font-size: 0.92rem;
    line-height: 1.55;
    color: #2c1810;
    margin-top: 0.5rem;
}

@media (max-width: 560px) {
    .ur3d-root { padding: 0.7rem 0.7rem 1rem; }
    .ur3d-counters { gap: 0.9rem; font-size: 0.85rem; }
}
