:root{
  --bgTop:#1f2937; --bgBottom:#0f172a; --text:#e5e7eb;
  --muted:#94a3b8; --dice:#0a1328; --pip:#ffffff;
  --btn:#38bdf8; --btnText:#001219;
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0; font-family: ui-sans-serif, system-ui;
  background: radial-gradient(1200px 600px at 10% -10%, var(--bgTop) 0%, var(--bgBottom) 60%);
  color:var(--text); display:flex; align-items:center; justify-content:center;}
.app{ width:min(800px, 92vw); margin:auto; }
.header{display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1rem}
.title{font-size:clamp(1.2rem, 2.5vw, 1.8rem); font-weight:800;}
.card{ background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02)); border:1px solid rgba(255,255,255,.08); border-radius:20px; padding:1rem; box-shadow:0 20px 30px rgba(0,0,0,.25); }
.dice-wrap{ display:flex; align-items:center; justify-content:center; padding:1rem; }
.dice{ width:min(300px, 70vw); aspect-ratio:1; border-radius:28px; background:var(--dice); border:1px solid rgba(255,255,255,.08); position:relative; display:grid; place-items:center; user-select:none; }
.pip{ width:56%; aspect-ratio:1; background:var(--pip); border-radius:50%; box-shadow: inset 0 0 8px rgba(0,0,0,.3); }
.face{ position:absolute; inset:0; display:grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(3,1fr); gap:10%; padding:12%; opacity:0; transform: scale(.9) rotate(-4deg); transition: all .28s ease; }
.face.show{ opacity:1; transform: scale(1) rotate(0deg); }
.slot{ display:grid; place-items:center; }
@keyframes jiggle {0%{transform: rotate(0deg) scale(1);}20%{transform: rotate(10deg) scale(1.03);}40%{transform: rotate(-8deg) scale(1.02);}60%{transform: rotate(6deg) scale(1.03);}80%{transform: rotate(-3deg) scale(1.01);}100%{transform: rotate(0deg) scale(1);}}
.dice.rolling { animation: jiggle .9s ease-in-out; }
.controls{ display:flex; justify-content:center; margin-top:1rem }
button.primary{ background: linear-gradient(180deg, var(--btn), var(--btn)); border:none; color:var(--btnText); font-weight:800; padding:.9rem 1.1rem; border-radius:14px; cursor:pointer; font-size:1.05rem; box-shadow:0 10px 18px rgba(34,211,238,.35); }
.kbd{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size:.85rem; color:var(--muted); padding: .2rem .45rem; border:1px solid rgba(255,255,255,.15); border-radius:8px; background:rgba(255,255,255,.06)}
.colorBtn{ background: linear-gradient(180deg, var(--btn), var(--btn)); border:none; color:#fff; font-weight:600; padding:.5rem .8rem; border-radius:10px; cursor:pointer; font-size:.9rem; box-shadow:0 6px 12px rgba(124,58,237,.35); }
.color-panel{ width:min(92vw, 320px); background: rgba(17,24,39,.98); color:var(--text); border:1px solid rgba(255,255,255,.12); border-radius:14px; box-shadow:0 20px 30px rgba(0,0,0,.35); padding:.8rem; }
.row{ display:flex; align-items:center; justify-content:space-between; margin:.35rem 0 }
.row label{ font-size:.9rem; color:var(--muted) }
.row input[type="color"]{ width:44px; height:28px; border:1px solid rgba(255,255,255,.25); border-radius:8px; background:transparent; cursor:pointer; }
.panel-actions{ display:flex; justify-content:space-between; margin-top:.6rem }
.btn-small{ background: linear-gradient(180deg, var(--btn), var(--btn)); color:var(--btnText); border:none; border-radius:10px; padding:.35rem .6rem; cursor:pointer }
.btn-ghost{ background: transparent; color:var(--muted); border:1px solid rgba(255,255,255,.18); border-radius:10px; padding:.35rem .6rem; cursor:pointer }
.sr-only{position:absolute !important; clip:rect(1px,1px,1px,1px); padding:0 !important; border:0 !important; height:1px !important; width:1px !important; overflow:hidden}
