.dice-scene { position:relative; }
.dice-station { position:absolute; background:transparent; border:0; padding:0; touch-action:manipulation; cursor:pointer; }
.dice-station:hover { backdrop-filter:brightness(1.08); }
.dice-station:focus-visible { outline:2px solid #ffe0a0; outline-offset:-2px; }
#dice-dialog { width:min(1067px,calc(100vw - 24px)); max-width:calc(100vw - 24px); max-height:92dvh; min-width:0; margin:auto; padding:0; border:0; border-radius:0; background:#352015 url('/assets/archive-wood.webp') center/cover; color:#29160a; overflow:auto; overscroll-behavior:contain; box-shadow:0 20px 80px #000c; scrollbar-width:thin; scrollbar-color:#92602f #2b180e; }
#dice-dialog::backdrop { background:#100a06be; }
.instrument-head { position:sticky; inset:auto; top:0; z-index:4; min-height:76px; padding:10px 64px 10px 22px; display:flex; align-items:center; justify-content:center; background:#372116 url('/assets/archive-wood.webp') center/cover; border-top:8px solid transparent; border-image:url('/assets/record-bottom.webp') 24 stretch; box-shadow:0 3px 7px #0008; }
.instrument-heading { text-align:center; min-width:0; color:#f3d49b; }
.instrument-heading span { font:bold 10px/1.2 Arial,sans-serif; letter-spacing:.18em; color:#cda86c; }
.instrument-heading h2 { font:bold clamp(21px,3vw,32px)/1.1 Georgia,serif; margin:5px 0; text-shadow:0 2px #1a0d07; }
.instrument-head .close { position:absolute; right:13px; top:50%; transform:translateY(-50%); width:44px; height:44px; border-radius:50%; border:2px solid #5d3218; background:radial-gradient(circle at 35% 25%,#f3d091,#bc853d 53%,#865021 78%,#e0b76c 81%,#573019 98%); box-shadow:0 2px 4px #000b,inset 0 0 2px #ffe1a1; color:#2c1709; font:bold 30px/1 Arial; padding:0; }
.instrument-cabinet { display:grid; grid-template-columns:minmax(0,40%) minmax(0,60%); padding:8px 3.4% 0; background:url('/assets/record-left.webp') left top/3.4% 100% no-repeat,url('/assets/record-right.webp') right top/3.4% 100% no-repeat; align-items:stretch; }
.instrument-exhibit { min-width:0; margin:0; padding:16px 12px; display:flex; flex-direction:column; justify-content:center; align-items:center; background:#50191b url('/assets/record-velvet.webp') center/cover; box-shadow:inset 0 0 25px #180607; border:13px solid transparent; border-image:url('/assets/record-exhibit.webp') 27 stretch; }
.instrument-stage { width:100%; min-width:0; display:grid; place-items:center; }
.instrument-stage>img { width:100%; height:auto; max-height:330px; object-fit:contain; filter:drop-shadow(0 5px 8px #0009); }
.instrument-caption { color:#e9c990; text-shadow:0 1px #251207; text-align:center; font:bold 11px/1.3 Arial; letter-spacing:.1em; margin:15px 0 3px; }
.instrument-foot { height:28px; background:url('/assets/record-bottom.webp') center/100% 100% no-repeat; }
.instrument-paper { min-width:0; min-height:360px; margin:0; padding:clamp(26px,3vw,42px); background:var(--parchment) center/100% 100% no-repeat; font:16px/1.55 Arial,sans-serif; overflow-wrap:anywhere; }
.instrument-paper>p:first-child { margin-top:0; }
.instrument-paper h3 { font:bold 20px/1.2 Georgia,serif; margin:18px 0 8px; }
.instrument-paper label { display:block; font-weight:bold; font-size:14px; margin:10px 0 5px; }
.instrument-paper select,.instrument-paper input { font:inherit; min-height:44px; width:100%; max-width:100%; padding:8px 10px; color:#2d1a0b; background:#e9c98e url('/assets/archive-paper.webp') center/cover; border:1px solid #865a34; border-radius:2px; box-shadow:inset 0 2px 5px #78512742; }
.instrument-paper button { position:relative; display:inline-block; max-width:100%; min-height:44px; padding:10px 25px; margin:14px 8px 4px 0; color:#2b1709; font:bold 14px/1.3 Arial; background:linear-gradient(180deg,#91602b,#e9bb74 20%,#bf8946 57%,#8b5525 96%); border:1px solid #6e411f; border-radius:5px; box-shadow:inset 0 1px #ffe2a2,0 3px 5px #43270c66; text-shadow:0 1px #f1cc8c80; clip-path:polygon(6px 0,calc(100% - 6px) 0,100% 6px,100% calc(100% - 6px),calc(100% - 6px) 100%,6px 100%,0 calc(100% - 6px),0 6px); }
.instrument-paper button::before,.instrument-paper button::after { content:''; position:absolute; top:50%; width:6px; height:6px; border-radius:50%; background:radial-gradient(circle at 30% 25%,#ffe2a3,#7b461c 65%,#2e160b); transform:translateY(-50%); }
.instrument-paper button::before { left:8px; }
.instrument-paper button::after { right:8px; }
.instrument-paper button:hover { filter:brightness(1.08); }
.instrument-paper button:active { transform:translateY(1px); }
.instrument-paper button:disabled { opacity:.65; cursor:wait; }
.instrument-paper :focus-visible,.instrument-head .close:focus-visible { outline:2px solid #3b200c; outline-offset:2px; }
.instrument-head .close:focus-visible { outline-color:#ffe0a0; }
.instrument-paper .result { margin-top:18px; font-weight:bold; overflow-wrap:anywhere; }
.instrument-paper .result:empty { display:none; }
.dice-results { display:flex; flex-wrap:wrap; gap:9px; margin:10px 0 15px; }
.die-result { display:grid; place-items:center; width:48px; height:48px; border-radius:50%; background:radial-gradient(circle at 30% 20%,#f4d394,#b37d39 60%,#70411b 93%); border:2px solid #69401e; box-shadow:inset 0 0 0 2px #d9ac64,0 3px 4px #47270c55; color:#291508; font:bold 22px Georgia,serif; text-shadow:0 1px #eec489; }
.prob-row { display:grid; grid-template-columns:24px minmax(0,1fr) 58px; align-items:center; gap:8px; margin:5px 0; font-size:13px; font-variant-numeric:tabular-nums; }
.prob-track { height:10px; background:#8d612e30; box-shadow:inset 0 1px 3px #65421c50; }
.prob-fill { height:100%; background:linear-gradient(#9c642f,#5c3215); }
.instrument-paper dl { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px 12px; font-size:14px; }
.instrument-paper dd { margin:0; font-weight:bold; }
.instrument-paper ul { padding-left:20px; }
.wheel-mechanism { position:relative; width:min(100%,320px); padding-top:9px; filter:drop-shadow(0 6px 6px #0009); }
.wheel-visual { width:100%; height:auto; transition:transform .7s ease; transform-origin:50% 50%; border-radius:50%; aspect-ratio:1; object-fit:fill; }
.wheel-needle { position:absolute; left:50%; top:0; width:15px; height:29px; transform:translateX(-50%); z-index:2; background:linear-gradient(90deg,#75421b,#f5d38c,#a36a2e); clip-path:polygon(0 0,100% 0,50% 100%); filter:drop-shadow(0 2px 1px #000); }
.dice-controls { display:flex; flex-wrap:wrap; gap:12px; align-items:end; }
.dice-controls>div { flex:1 1 120px; min-width:0; }
@media(max-width:760px) {
  #dice-dialog { width:calc(100vw - 16px); max-width:calc(100vw - 16px); max-height:94dvh; }
  .instrument-head { min-height:70px; padding:9px 51px 9px 12px; }
  .instrument-heading span { font-size:9px; letter-spacing:.07em; }
  .instrument-heading h2 { font-size:21px; }
  .instrument-head .close { right:5px; width:42px; height:42px; }
  .instrument-cabinet { display:flex; flex-direction:column; background-image:url('/assets/record-mobile-left.webp'),url('/assets/record-mobile-right.webp'); padding-top:4px; }
  .instrument-exhibit { padding:9px; border-width:10px; }
  .instrument-stage>img { max-height:190px; width:auto; max-width:100%; }
  .instrument-caption { margin:8px 0 2px; font-size:10px; }
  .instrument-paper { padding:25px 19px 30px; min-height:0; font-size:15px; }
  .instrument-foot { height:18px; background-image:url('/assets/record-mobile-bottom.webp'); }
  .wheel-mechanism { width:min(100%,205px); }
  .instrument-paper button { margin-right:3px; font-size:13px; }
  .dice-controls>div { flex-basis:100px; }
}
@media(prefers-reduced-motion:reduce) {
  .wheel-visual { transition:none; }
}

.dice-page .dice-station[data-station="0"] { left:5%; top:19%; width:28%; height:32%; }
.dice-page .dice-station[data-station="1"] { left:69%; top:17%; width:28%; height:33%; }
.dice-page .dice-station[data-station="2"] { left:0; top:54%; width:23%; height:30%; }
.dice-page .dice-station[data-station="3"] { left:24%; top:51%; width:18%; height:35%; }
.dice-page .dice-station[data-station="4"] { left:57%; top:54%; width:17%; height:32%; }
.dice-page .dice-station[data-station="5"] { left:75%; top:51%; width:24%; height:34%; }
@media(max-width:700px) {
  .dice-page .dice-station[data-station="0"] { left:3%; top:27%; width:45%; height:26%; }
  .dice-page .dice-station[data-station="1"] { left:57%; top:31%; width:40%; height:22%; }
  .dice-page .dice-station[data-station="2"] { left:2%; top:53%; width:43%; height:17%; }
  .dice-page .dice-station[data-station="3"] { left:54%; top:53%; width:44%; height:17%; }
  .dice-page .dice-station[data-station="4"] { left:2%; top:71%; width:45%; height:23%; }
  .dice-page .dice-station[data-station="5"] { left:55%; top:71%; width:43%; height:23%; }
}

.legends-page .dice-station[data-station="0"] { left:27%; top:39%; width:48%; height:35%; }
.legends-page .dice-station[data-station="1"] { left:2%; top:12%; width:33%; height:28%; }
.legends-page .dice-station[data-station="2"] { left:73%; top:1%; width:27%; height:40%; }
.legends-page .dice-station[data-station="3"] { left:0%; top:40%; width:27%; height:35%; }
.legends-page .dice-station[data-station="4"] { left:42%; top:0%; width:30%; height:34%; }
.legends-page .dice-station[data-station="5"] { left:77%; top:44%; width:23%; height:39%; }
@media(max-width:700px) {
  .legends-page .dice-station[data-station="0"] { left:0%; top:36%; width:100%; height:33%; }
  .legends-page .dice-station[data-station="1"] { left:0%; top:20%; width:46%; height:17%; }
  .legends-page .dice-station[data-station="2"] { left:54%; top:16%; width:46%; height:21%; }
  .legends-page .dice-station[data-station="3"] { left:0%; top:66%; width:47%; height:17%; }
  .legends-page .dice-station[data-station="4"] { left:24%; top:0%; width:52%; height:20%; }
  .legends-page .dice-station[data-station="5"] { left:55%; top:65%; width:45%; height:19%; }
}

.rules-page .dice-station[data-station="0"] { left:8%; top:31%; width:34%; height:21%; }
.rules-page .dice-station[data-station="1"] { left:58%; top:31%; width:35%; height:21%; }
.rules-page .dice-station[data-station="2"] { left:7%; top:51%; width:37%; height:19%; }
.rules-page .dice-station[data-station="3"] { left:56%; top:52%; width:38%; height:18%; }
.rules-page .dice-station[data-station="4"] { left:2%; top:69%; width:42%; height:18%; }
.rules-page .dice-station[data-station="5"] { left:57%; top:69%; width:42%; height:18%; }
@media(max-width:700px) {
  .rules-page .dice-station[data-station="0"] { left:3%; top:33%; width:43%; height:17%; }
  .rules-page .dice-station[data-station="1"] { left:55%; top:33%; width:44%; height:17%; }
  .rules-page .dice-station[data-station="2"] { left:0%; top:48%; width:46%; height:16%; }
  .rules-page .dice-station[data-station="3"] { left:54%; top:49%; width:46%; height:15%; }
  .rules-page .dice-station[data-station="4"] { left:0%; top:66%; width:47%; height:19%; }
  .rules-page .dice-station[data-station="5"] { left:54%; top:66%; width:46%; height:22%; }
}

.instrument-paper .legend-choice { display: block; width: 100%; text-align: left; }
.legend-log { font-size: 14px; }
.legend-stats { font-weight: bold; }
.legend-epilogue { padding-top: 8px; border-top: 1px solid #86633a; }
.rules-page .instrument-paper textarea, .rules-page .instrument-paper select {
  width: 100%; max-width: 100%; font: inherit; background: #f3d8a2;
  color: #29160a; border: 1px solid #85562d; padding: 8px;
}
.rules-page .instrument-paper textarea { min-height: 75px; resize: vertical; }
