.dr {
  --dr-accent: #b58aff;
  color: #f6efff;
  max-width: 1500px;
  margin: auto;
  padding: 24px;
  box-sizing: border-box;
}
.dr * { box-sizing: border-box; }
.dr [hidden] { display: none !important; }
.dr-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 30px; border: 1px solid #70508d; border-radius: 24px; background: linear-gradient(120deg,#3b2558,#201a31); margin-bottom: 22px; }
.dr-hero h1 { font-size: clamp(2rem,4vw,3rem); margin: 12px 0; line-height: 1.1; }
.dr-eyebrow { letter-spacing: .14em; font-size: .76rem; font-weight: 800; color: #d2adff; }
.dr-tags,.dr-inline,.dr-heading { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.dr-tags span { font-size: .8rem; border: 1px solid #71558c; border-radius: 20px; padding: 5px 12px; }
.dr-hero-dice { font-size: 80px; color: #c9a0ff; white-space: nowrap; }
.dr-hero-dice span { display: inline-grid; place-items: center; width: 90px; height: 90px; border: 3px solid #c9a0ff; border-radius: 25px; font-size: 42px; transform: rotate(12deg); }
.dr-layout { display: grid; grid-template-columns: 320px minmax(0,1fr); gap: 22px; align-items: start; }
.dr-panel { padding: 24px; background: #231b33; border: 1px solid #594468; border-radius: 18px; margin-bottom: 22px; min-width: 0; }
.dr h2 { margin: 0 0 18px; font-size: 1.25rem; }
.dr-main { min-width: 0; }
.dr button { font: inherit; color: #f9f3ff; background: #3b2b51; border: 1px solid #82629e; border-radius: 10px; padding: 10px 14px; min-height: 44px; cursor: pointer; }
.dr button:hover:not(:disabled) { background: #594075; border-color: #c9a4ef; }
.dr button:disabled { opacity: .5; cursor: default; }
.dr button:focus-visible,.dr input:focus-visible,.dr select:focus-visible { outline: 3px solid #d8bdff; outline-offset: 3px; }
.dr label { display: grid; gap: 7px; font-size: .86rem; color: #d4c7e3; min-width: 0; }
.dr input:not([type=checkbox]),.dr select { width: 100%; background: #151020; border: 1px solid #715a84; border-radius: 8px; padding: 11px; font: inherit; color: white; min-width: 0; }
.dr input[type=checkbox] { width: 18px; height: 18px; accent-color: #b58aff; }
.dr .dr-check { display: flex; align-items: center; gap: 10px; margin: 15px 0; }
.dr-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.dr-quick { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.dr-quick button { padding: 10px 4px; font-weight: 700; }
.dr-shortcuts { display: grid; gap: 10px; }
.dr details { border-top: 1px solid #594468; margin-top: 20px; padding-top: 16px; }
.dr summary { cursor: pointer; font-weight: 700; }
.dr-note { color: #c6b7d4; font-size: .85rem; line-height: 1.65; }
.dr-tray { border: 1px solid #9270ae; border-radius: 24px; padding: 26px; margin-bottom: 22px; background: radial-gradient(ellipse at 50% 20%,#403055,#1c1529 80%); box-shadow: inset 0 0 45px #110d1c; }
.dr-tray-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
#drNotation { font-size: 1.5rem; font-weight: 800; }
#drHint { color: #d3c2e1; margin-top: 7px; }
.dr-total { min-width: 120px; text-align: right; }
.dr-total span { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: #d0b6e6; }
.dr-total strong { font-size: clamp(2.5rem,5vw,4.5rem); line-height: 1.2; overflow-wrap: anywhere; }
.dr-dice { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; min-height: 180px; padding: 25px 0; align-content: center; max-height: 500px; overflow: auto; }
.dr .dr-die { position: relative; width: 82px; height: 90px; padding: 8px; border: 2px solid #d9bfff; border-radius: 16px; background: linear-gradient(145deg,#976bc8,#4c2b75); box-shadow: 0 7px 0 #130d1f,0 10px 17px #09070d70; font-weight: 800; display: grid; place-items: center; }
.dr-die strong { font-size: 2rem; line-height: 1; }
.dr-die small { font-size: .65rem; font-weight: 600; }
.dr .dr-die.locked { border-color: #7ff0cb; box-shadow: 0 7px 0 #163d35; }
.dr .dr-die.dropped { opacity: .45; background: #38303f; border-style: dashed; }
.dr-die .dr-pips { display: grid; grid-template-columns: repeat(3,9px); grid-template-rows: repeat(3,9px); gap: 4px; }
.dr-pip { border-radius: 50%; background: transparent; }
.dr-pip.on { background: white; }
.dr-roll-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.dr .dr-primary { background: #9460d8; border-color: #d3a8ff; padding: 15px 28px; font-size: 1.2rem; font-weight: 800; min-width: 210px; }
#drStatus { margin: 18px 0 0; text-align: center; color: #decdea; min-height: 1.6em; }
.dr-heading { justify-content: space-between; margin-bottom: 15px; }
.dr-heading h2 { margin: 0; }
.dr-inline label { flex: 1; min-width: 180px; }
.dr-favorites { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.dr-favorite { display: flex; gap: 4px; }
.dr-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin: 20px 0; }
.dr-stat { background: #171120; padding: 16px; border-radius: 12px; }
.dr-stat strong { display: block; font-size: 1.6rem; }
.dr-history-wrap { overflow: auto; max-height: 330px; }
.dr table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.dr th,.dr td { padding: 12px; border-bottom: 1px solid #554363; text-align: left; }
.dr th { background: #30213e; position: sticky; top: 0; }
.dr td:nth-child(3) { min-width: 160px; max-width: 650px; overflow-wrap: anywhere; }
.dr-guide li { margin: 12px 0; }
.dr.rolling .dr-die { animation: dr-tumble .48s ease-out; }
@keyframes dr-tumble { 0% { transform: translateY(-12px) rotate(-18deg) scale(.8); } 45% { transform: translateY(5px) rotate(12deg); } 100% { transform: none; } }
@media (max-width: 900px) { .dr-layout { grid-template-columns: 1fr; } .dr-hero-dice { display: none; } .dr-quick { grid-template-columns: repeat(7,1fr); } }
@media (max-width: 550px) { .dr { padding: 8px; } .dr-panel,.dr-hero,.dr-tray { padding: 18px; } .dr-quick { grid-template-columns: repeat(4,1fr); } .dr-total { min-width: 90px; } .dr-tray-top { align-items: start; } .dr-stats { grid-template-columns: 1fr; } .dr-dice { gap: 12px; } }
@media (prefers-reduced-motion: reduce) { .dr.rolling .dr-die { animation: none; } }

.dr-setup-link { display: none; color: #dec3ff; }
@media (max-width: 900px) { .dr-main { grid-row: 1; } .dr-setup-link { display: inline-block; padding: 8px 0; } #drSetup { scroll-margin-top: 100px; } }
