.dice-body .site-layout { display: block; min-width: 0; }
.dice-page, .dice-admin { max-width: 1180px; margin: 0 auto; }
.dice-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.dice-heading h1 { font-size: clamp(2rem, 4vw, 3rem); margin: .3rem 0; }
.dice-heading p { margin: .3rem 0; }
.dice-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; align-items: start; }
.dice-main, .dice-settings { display: grid; gap: 1.5rem; min-width: 0; }
.dice-arena { display: grid; justify-items: center; padding: 2rem; border: 1px solid var(--border); border-radius: 1.25rem; background-color: #185b40; background-image: linear-gradient(var(--dice-table-shade, rgb(0 0 0 / 22%)), var(--dice-table-shade, rgb(0 0 0 / 22%))), url('../images/games/dice-table.webp'); background-position: 50% 50%; background-size: cover; background-repeat: no-repeat; overflow: hidden; }
:root[data-theme="dark"] .dice-arena { --dice-table-shade: rgb(0 0 0 / 38%); }
.dice-arena-caption { color: #fff; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-shadow: 0 1px 4px rgb(0 0 0 / 70%); }
.dice-pair { display: flex; gap: 2rem; align-items: center; min-height: 200px; perspective: 650px; }
.die { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 8px; padding: 18px; width: 112px; height: 112px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface-hover); box-shadow: 0 14px 24px var(--shadow), inset 0 -7px 0 var(--border); transform: rotate(-8deg); }
.die:nth-child(2) { transform: rotate(10deg); }
.die span { border-radius: 50%; background: var(--accent); }
.die .pip-off { visibility: hidden; }
.dice-total { font-size: 3rem; line-height: 1; letter-spacing: -.05em; color: #fff; text-shadow: 0 1px 4px rgb(0 0 0 / 70%); }
.dice-arena p { margin: .5rem 0 0; color: #fff; text-shadow: 0 1px 4px rgb(0 0 0 / 70%); }
.is-rolling .die { animation: dice-tumble 1s ease-in-out; }
.is-rolling .die:nth-child(2) { animation-direction: reverse; }
@keyframes dice-tumble { 0% { transform: rotate(-8deg); } 35% { transform: translateY(-30px) rotateX(210deg) rotateZ(100deg); } 75% { transform: translateY(7px) rotateX(355deg) rotateZ(340deg); } 100% { transform: rotate(352deg); } }
.dice-outcomes h2, .dice-history h2, .dice-rules h2 { margin-top: 0; }
.dice-option-group { border: 0; padding: 0; margin: 1.25rem 0 0; min-width: 0; }
.dice-option-group legend { font-size: .85rem; font-weight: 700; margin-bottom: .65rem; color: var(--text-muted); }
.dice-option-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.dice-option { display: grid; gap: .15rem; position: relative; cursor: pointer; padding: .7rem; border: 1px solid var(--border); border-radius: .7rem; background: var(--surface-hover); }
.dice-option:has(input:checked) { background: var(--accent-soft); color: var(--accent); }
.dice-option:has(input:disabled) { opacity: .65; cursor: default; }
.dice-option input { position: absolute; top: .7rem; right: .6rem; accent-color: var(--accent); margin: 0; width: 14px; height: 14px; }
.dice-option strong { font-size: .85rem; padding-right: 17px; }
.dice-option span { font-weight: 750; }
.dice-option small { color: var(--text-muted); font-size: .7rem; }
.dice-controls { display: grid; gap: .8rem; position: sticky; top: 120px; padding: 1.5rem; }
.dice-balance { display: grid; gap: .2rem; margin-bottom: .6rem; }
.dice-balance strong { font-size: 1.35rem; }
.dice-controls > label, .dice-setting-row label { font-size: .85rem; font-weight: 600; }
.dice-controls input[type=number], .dice-setting-row input[type=number], .dice-setting-row input[type=text] { width: 100%; min-width: 0; padding: .8rem; border: 1px solid var(--text-muted); border-radius: .65rem; background: var(--surface-hover); color: var(--text); font: inherit; }
.dice-presets { display: flex; gap: .4rem; }
.dice-presets button { flex: 1; min-width: 0; padding: .4rem; min-height: 36px; }
.dice-quote { display: grid; gap: .7rem; margin: .7rem 0; }
.dice-quote div { display: flex; gap: 1rem; justify-content: space-between; font-size: .8rem; }
.dice-quote dt { color: var(--text-muted); }
.dice-quote dd { margin: 0; text-align: right; font-weight: 700; }
.dice-throw { width: 100%; min-height: 52px; }
.dice-page button:disabled { opacity: .55; cursor: default; }
.dice-message { margin: 0; font-size: .85rem; overflow-wrap: anywhere; }
.dice-message:empty { display: none; }
.dice-error { color: var(--negative); }
.dice-rules, .dice-history { margin-top: 1.5rem; }
.dice-rules p { color: var(--text-muted); font-size: .875rem; line-height: 1.7; }
.dice-history-row { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: .9rem 0; border-top: 1px solid var(--border); font-size: .85rem; }
.dice-history-row small { color: var(--text-muted); }
.dice-history-row[data-won=true] > strong { color: var(--positive); }
.dice-history-row[data-won=false] > strong { color: var(--negative); }
.dice-check { display: flex; align-items: center; gap: .65rem; font-weight: 600; }
.dice-check input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.dice-setting-group { margin: 0; min-width: 0; }
.dice-setting-group legend { padding-inline: .5rem; font-weight: 750; }
.dice-setting-rows { margin-top: 1rem; }
.dice-setting-row { display: grid; grid-template-columns: minmax(140px, 1fr) 1fr 1fr; gap: 1rem; align-items: center; padding: .8rem 0; border-top: 1px solid var(--border); }
.dice-setting-row > label:not(.dice-check) { display: grid; gap: .4rem; }
@media (max-width: 900px) { .dice-layout { grid-template-columns: minmax(0, 1fr); } .dice-controls { position: static; } .dice-option-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 600px) { .dice-option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dice-arena { padding: 1.25rem; } .dice-setting-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dice-setting-row > .dice-check { grid-column: 1 / -1; } .dice-page .surface, .dice-admin .surface { padding: 1.25rem; } }
@media (prefers-reduced-motion: reduce) { .is-rolling .die { animation: none; } }

.dice-reduction-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: .8rem; margin: 1rem 0; }
.dice-reduction-row label { display: grid; gap: .4rem; font-size: .85rem; font-weight: 600; }
.dice-reduction-row input { width: 100%; min-width: 0; padding: .8rem; border: 1px solid var(--text-muted); border-radius: .65rem; background: var(--surface-hover); color: var(--text); font: inherit; }
@media (max-width: 600px) { .dice-reduction-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .dice-reduction-row button { grid-column: 1 / -1; justify-self: start; } }

@media (max-width: 480px) {
  .dice-pair { gap: 24px; min-height: 170px; }
  .die { width: 88px; height: 88px; padding: 14px; gap: 6px; border-radius: 18px; }
  .dice-presets { flex-wrap: wrap; }
  .dice-presets button { min-height: 44px; flex-basis: 40%; }
  .dice-quote div { flex-wrap: wrap; gap: 4px 12px; }
  .dice-quote dd { margin-left: auto; }
}
