.rgu-shell {
    --rgu-lapis: #1c3f7a;
    --rgu-lapis2: #0f2650;
    --rgu-gold: #e3b458;
    --rgu-clay: #f1dcb4;
    --rgu-sand: #d8b98a;
    max-width: 940px;
    margin: 0 auto;
    padding: 0 12px 20px;
    color: var(--cg-ink);
    font-family: Inter, Arial, sans-serif;
}

.cg-shell-game .cg-stage-main #game-root > .rgu-shell {
    max-width: min(100%, 940px) !important;
}

.rgu-hidden,
.rgu-end[hidden] {
    display: none !important;
}

.rgu-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.rgu-stats {
    display: flex;
    gap: 6px;
    min-width: 0;
}

.rgu-stat {
    padding: 4px 9px;
    border: 1px solid var(--cg-line);
    border-radius: 9px;
    background: var(--cg-panel);
    box-shadow: 0 3px 10px rgba(33, 43, 40, 0.06);
}

.rgu-stat span {
    display: block;
    color: var(--cg-muted);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rgu-stat strong {
    display: block;
    font-size: 15px;
    line-height: 1.1;
}

.rgu-actions {
    display: flex;
    gap: 6px;
}

.rgu-ico {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--cg-line);
    border-radius: 10px;
    background: var(--cg-panel);
    color: var(--cg-ink);
    font: 800 18px/1 Inter, Arial, sans-serif;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(33, 43, 40, 0.07);
    -webkit-tap-highlight-color: transparent;
}

.rgu-ico:disabled {
    opacity: 0.35;
    cursor: default;
}

.rgu-ico.rgu-muted {
    opacity: 0.55;
    text-decoration: line-through;
}

.rgu-status {
    min-height: 34px;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid var(--cg-line);
    background: linear-gradient(180deg, #fff, #f6f2e8);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.rgu-shell[data-turn="ai"] .rgu-status,
.rgu-shell[data-turn="p2"] .rgu-status {
    border-color: rgba(28, 63, 122, 0.4);
    background: linear-gradient(180deg, #fff, #e9eefa);
}

.rgu-shell[data-turn="p1"] .rgu-status {
    border-color: rgba(227, 180, 88, 0.7);
}

.rgu-stage {
    position: relative;
    display: grid;
    gap: 8px;
    padding: 10px;
    border-radius: 16px;
    background: radial-gradient(120% 90% at 50% 0%, #3a2a1a, #1e150d);
    box-shadow: var(--cg-shadow), inset 0 0 0 2px rgba(227, 180, 88, 0.35);
}

.rgu-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
    padding: 6px;
    aspect-ratio: 8 / 3;
    border-radius: 12px;
    background:
        linear-gradient(90deg, transparent 0 62.5%, transparent 62.5%),
        linear-gradient(180deg, #17346a, #0c1f45);
    box-shadow: inset 0 0 0 2px rgba(227, 180, 88, 0.7), inset 0 6px 18px rgba(0, 0, 0, 0.5);
    outline: none;
}

.rgu-board:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(227, 180, 88, 0.7), 0 0 0 3px rgba(120, 170, 255, 0.55);
}

.rgu-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background:
        radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 55%),
        linear-gradient(145deg, #e9d3a4, #c9a56c);
    box-shadow: inset 0 0 0 1px rgba(90, 58, 20, 0.45), inset 0 -3px 0 rgba(90, 58, 20, 0.22), 0 2px 3px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.rgu-cell.rgu-own1 {
    background:
        radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 55%),
        linear-gradient(145deg, #f4e2ba, #d4b27c);
}

.rgu-cell.rgu-own2 {
    background:
        radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 55%),
        linear-gradient(145deg, #a8b9dd, #6f86b8);
}

.rgu-cell.rgu-shared {
    background:
        radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0) 55%),
        linear-gradient(145deg, #dcc48f, #b48f56);
}

.rgu-cell.rgu-rose::before {
    content: "";
    position: absolute;
    inset: 16%;
    border-radius: 50%;
    background:
        radial-gradient(circle, #c0322b 0 16%, transparent 17%),
        conic-gradient(from 22deg, #1c3f7a 0 12.5%, #e3b458 0 25%, #1c3f7a 0 37.5%, #e3b458 0 50%, #1c3f7a 0 62.5%, #e3b458 0 75%, #1c3f7a 0 87.5%, #e3b458 0);
    box-shadow: 0 0 0 2px rgba(90, 58, 20, 0.55);
    opacity: 0.9;
}

.rgu-cell.rgu-entry::after,
.rgu-cell.rgu-exit::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 4px;
    width: 30%;
    height: 3px;
    border-radius: 2px;
    background: rgba(90, 58, 20, 0.5);
    transform: translateX(-50%);
}

.rgu-cell.rgu-cursor {
    box-shadow: inset 0 0 0 3px #7fb0ff, 0 2px 3px rgba(0, 0, 0, 0.45);
}

.rgu-cell.rgu-target {
    animation: rgu-glow 1s ease-in-out infinite;
}

.rgu-cell.rgu-target-stack {
    animation-duration: 0.6s;
}

@keyframes rgu-glow {
    0%, 100% { box-shadow: inset 0 0 0 3px #4fe08e, 0 0 6px rgba(79, 224, 142, 0.5); }
    50% { box-shadow: inset 0 0 0 3px #b9ffd6, 0 0 16px rgba(79, 224, 142, 0.95); }
}

.rgu-cell.rgu-target::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 24%;
    height: 24%;
    border-radius: 50%;
    background: #33c274;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
    transform: translate(-50%, -50%);
}

.rgu-cell.rgu-movable {
    animation: rgu-bob 0.9s ease-in-out infinite;
}

@keyframes rgu-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.rgu-cell.rgu-sel {
    transform: translateY(-4px) scale(1.06);
    box-shadow: inset 0 0 0 3px var(--rgu-gold), 0 8px 12px rgba(0, 0, 0, 0.5);
    animation: none;
    z-index: 2;
}

.rgu-token {
    position: absolute;
    left: 18%;
    right: 18%;
    top: 8%;
    bottom: 10%;
    border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%;
    animation: rgu-drop 260ms cubic-bezier(0.3, 1.5, 0.5, 1);
    pointer-events: none;
}

.rgu-token::before {
    content: "";
    position: absolute;
    left: 22%;
    top: 12%;
    width: 26%;
    height: 34%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
}

.rgu-t1 {
    background: radial-gradient(circle at 35% 28%, #fffaf0, #f0dcb0 45%, #b98d4f);
    box-shadow: 0 4px 5px rgba(0, 0, 0, 0.5), inset 0 -3px 0 rgba(120, 78, 20, 0.35);
}

.rgu-t2 {
    background: radial-gradient(circle at 35% 28%, #6f95e6, #1c3f7a 50%, #0a1a3d);
    box-shadow: 0 4px 5px rgba(0, 0, 0, 0.5), inset 0 -3px 0 rgba(0, 0, 0, 0.4);
}

@keyframes rgu-drop {
    from { transform: translateY(-14px) scale(1.25); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.rgu-tray {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 10px;
}

.rgu-dice {
    display: flex;
    gap: 10px;
    justify-content: center;
    min-height: 54px;
    align-items: center;
}

.rgu-dice.rgu-roll-anim .rgu-die {
    animation: rgu-tumble 520ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.rgu-die:nth-child(2) { animation-delay: 40ms; }
.rgu-die:nth-child(3) { animation-delay: 80ms; }
.rgu-die:nth-child(4) { animation-delay: 120ms; }

@keyframes rgu-tumble {
    0% { transform: translateY(-26px) rotate(-200deg) scale(0.7); opacity: 0.2; }
    70% { transform: translateY(3px) rotate(12deg) scale(1.05); opacity: 1; }
    100% { transform: none; }
}

.rgu-die {
    position: relative;
    display: block;
    width: 46px;
    height: 44px;
    background: linear-gradient(160deg, #f6ecd2, #cfae72);
    clip-path: polygon(50% 2%, 98% 96%, 2% 96%);
    filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.5));
}

.rgu-die::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 46%;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-radius: 50%;
    background: #b6b0a0;
    opacity: 0.45;
}

.rgu-die[data-v="1"]::before {
    background: #c0322b;
    opacity: 1;
    box-shadow: 0 0 6px rgba(192, 50, 43, 0.8);
}

.rgu-die .rgu-face {
    display: none;
}

.rgu-total {
    min-width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ffe6a3, #e3b458 60%, #a4772a);
    color: #3a2508;
    font: 900 24px/1 Inter, Arial, sans-serif;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
}

.rgu-roll {
    min-height: 48px;
    padding: 0 20px;
    border: 1px solid #17624b;
    border-radius: 12px;
    background: linear-gradient(180deg, #2fa576, #17624b);
    color: #f2fdf7;
    font: 800 15px/1 Inter, Arial, sans-serif;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(23, 98, 75, 0.4);
    -webkit-tap-highlight-color: transparent;
}

.rgu-roll:disabled {
    background: linear-gradient(180deg, #5b6b64, #46524c);
    border-color: #3a453f;
    box-shadow: none;
    cursor: default;
    opacity: 0.85;
}

.rgu-shell[data-state="await"][data-turn="p1"] .rgu-roll:not(:disabled) {
    animation: rgu-pulse 1.2s ease-in-out infinite;
}

@keyframes rgu-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.rgu-army {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
}

.rgu-army-tag {
    margin-right: 4px;
    color: #e8d6ab;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    min-width: 70px;
}

.rgu-peg {
    width: 18px;
    height: 22px;
    border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
    transition: transform 160ms ease, background 160ms ease;
}

#rgu-army1 .rgu-peg { background: radial-gradient(circle at 35% 28%, #fffaf0, #f0dcb0 45%, #b98d4f); }
#rgu-army2 .rgu-peg { background: radial-gradient(circle at 35% 28%, #6f95e6, #1c3f7a 50%, #0a1a3d); }
.rgu-peg.rgu-peg-on { opacity: 0.35; transform: scale(0.8); }
.rgu-peg.rgu-peg-home { opacity: 1; box-shadow: 0 0 0 2px var(--rgu-gold), 0 0 8px rgba(227, 180, 88, 0.7); transform: scale(1.05); }

.rgu-end {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: rgba(12, 10, 6, 0.72);
    backdrop-filter: blur(3px);
}

.rgu-end-card {
    width: min(86%, 380px);
    padding: 22px 18px;
    border-radius: 16px;
    border: 2px solid var(--rgu-gold);
    background: linear-gradient(180deg, #fff8e6, #f0e2bd);
    text-align: center;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    animation: rgu-drop 300ms ease;
}

.rgu-end-card h2 {
    margin: 0 0 6px;
    font-size: 22px;
}

.rgu-end-card p {
    margin: 0 0 14px;
    color: #5b4a2c;
    font-size: 14px;
    line-height: 1.4;
}

.rgu-end-actions {
    display: flex;
    gap: 8px;
}

.rgu-btn {
    flex: 1 1 0;
    min-height: 46px;
    border: 1px solid var(--cg-line);
    border-radius: 11px;
    background: #fff;
    color: var(--cg-ink);
    font: 800 14px/1 Inter, Arial, sans-serif;
    cursor: pointer;
}

.rgu-btn-primary {
    border-color: #17624b;
    background: linear-gradient(180deg, #2fa576, #17624b);
    color: #f2fdf7;
}

.rgu-below {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.rgu-seg {
    flex: none;
    display: flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--cg-line);
    border-radius: 12px;
    background: var(--cg-panel);
}

.rgu-seg-btn {
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--cg-muted);
    font: 800 13px/1 Inter, Arial, sans-serif;
    cursor: pointer;
}

.rgu-seg-btn.rgu-seg-on {
    background: linear-gradient(180deg, #23405f, #142a44);
    color: #eef4ff;
}

.rgu-hint {
    margin: 0;
    color: var(--cg-muted);
    font-size: 12px;
    line-height: 1.4;
}

.rgu-modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(12, 20, 22, 0.55);
}

.rgu-modal-card {
    position: relative;
    max-width: 480px;
    max-height: 82vh;
    overflow: auto;
    padding: 24px 22px 18px;
    border-radius: 14px;
    background: var(--cg-panel);
    box-shadow: 0 20px 50px rgba(10, 20, 20, 0.32);
}

.rgu-modal-card h2 {
    margin: 0 0 8px;
    font-size: 20px;
}

.rgu-modal-card p {
    margin: 0 0 10px;
    color: var(--cg-muted);
    font-size: 13.5px;
    line-height: 1.55;
}

.rgu-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--cg-line);
    border-radius: 10px;
    background: var(--cg-panel);
    color: var(--cg-ink);
    font: 800 22px/1 Inter, Arial, sans-serif;
    cursor: pointer;
}

@media (max-width: 640px) {
    .rgu-shell { padding: 0 6px 14px; }
    .rgu-stage { padding: 8px; border-radius: 12px; }
    .rgu-board { gap: 3px; padding: 4px; }
    .rgu-tray { grid-template-columns: 1fr auto; row-gap: 8px; }
    .rgu-dice { grid-column: 1 / -1; gap: 12px; }
    .rgu-die { width: 54px; height: 52px; }
    .rgu-roll { grid-column: 1 / 2; width: 100%; }
    .rgu-total { grid-column: 2; }
    .rgu-tray { grid-template-areas: "d d" "r t"; }
    .rgu-dice { grid-area: d; }
    .rgu-roll { grid-area: r; }
    .rgu-total { grid-area: t; }
    .rgu-hint { display: none; }
    .rgu-seg { width: 100%; }
    .rgu-seg-btn { flex: 1 1 0; }
    .rgu-army-tag { min-width: 62px; }
}
