*{box-sizing:border-box}body{margin:0;color:#f6e6c8;background:radial-gradient(ellipse at top,#473a2c,#1e1a16 75%);font:16px system-ui,sans-serif}main{max-width:1080px;height:100vh;height:100dvh;margin:auto;padding:max(8px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));display:flex;flex-direction:column;gap:6px}header,footer,.rail{display:flex;align-items:center;gap:12px}header h1{font:clamp(24px,4vh,38px) Georgia,serif;margin:0 auto 0 0}h1 i{color:#d8af72}header span,small{font-size:12px;color:#d5c4ab}button{touch-action:manipulation;font:inherit;color:inherit;background:#392e25;border:1px solid #78644e;border-radius:9px;padding:8px 14px;cursor:pointer}button:disabled{opacity:.45;cursor:default}.game{display:flex;flex:1;min-height:0;flex-direction:column}.rail{justify-content:space-between;font-size:11px;letter-spacing:.12em;min-height:24px}.rail b{letter-spacing:0;color:#d8af72}.rail button{font-size:12px;padding:3px 10px}#board{position:relative;isolation:isolate;flex:1;display:grid;grid-template-columns:repeat(6,1fr) .48fr repeat(6,1fr);grid-template-rows:1fr 1fr;border:clamp(6px,1.6vh,16px) ridge #8d592e;border-radius:12px;background:#94552f url(ceviz.jpg) center/50% 100%;box-shadow:0 7px 18px #120c0877,inset 0 0 25px #32180d}.point,.bar{position:relative;padding:0;border:0;border-radius:0;background:none;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;container-type:size}.point.bottom,.bar.bottom{flex-direction:column-reverse}.point:before{content:"";position:absolute;inset:0 2% 7%;background:linear-gradient(90deg,#cb9767,#efd3a1,#c99663);clip-path:polygon(0 0,100% 0,50% 100%);opacity:.93}.point.dark:before{background:linear-gradient(90deg,#512810,#734021,#41230f)}.bottom.point:before{transform:rotate(180deg);inset:7% 2% 0}.bar{background:linear-gradient(90deg,#57301c,#bd884e,#57301c)}.piece{z-index:1;width:min(94cqw,19cqh);aspect-ratio:1;border-radius:50%;border:2px solid #d1ae7c;box-shadow:inset 0 1px 3px #fff9,inset 0 -4px 5px #71522f99,0 2px 3px #2d140b;background:radial-gradient(circle at 34% 25%,#fff8e6,#e0c69b 60%,#fff1cc 78%,#b89260);display:grid;place-items:center;font-weight:bold;color:#452d16}.black{border-color:#65472f;color:#fff2cc;background:radial-gradient(circle at 35% 24%,#76614d,#39291f 62%,#645241 79%,#211811)}.chosen{outline:3px solid #fff1aa;outline-offset:-3px}.target:after{content:"";position:absolute;top:46%;width:13px;height:13px;border-radius:50%;background:#fff4ab;box-shadow:0 0 0 4px #53391f99;z-index:3}.target#off:after{display:none}#off.target{background:#99672c}footer{min-height:48px}footer>div:first-child{margin-right:auto}#status{font:600 18px Georgia,serif}#dice{display:flex;gap:4px;color:#f8dfae;font:36px/1 Georgia}.spent{opacity:.32}.gold{background:linear-gradient(#f3d39c,#c99b5b);font-weight:bold;color:#322318}dialog{background:#30261f;color:#f7e7ca;border:1px solid #987950;border-radius:16px;padding:25px;max-width:90vw}dialog::backdrop{background:#100c09aa}h2{font:30px Georgia;margin:0}#levels{display:flex;gap:6px}#warning{font-size:13px} @media(orientation:portrait){main{max-height:920px}#board{grid-template-columns:repeat(6,1fr) .55fr repeat(6,1fr)}.piece{width:98cqw}#offline{max-width:92px}footer{flex-wrap:wrap}#status{font-size:16px}} @media(max-height:450px){header button{padding:4px 12px}.rail{min-height:19px}main{gap:2px}footer{min-height:39px}#hint{font-size:11px}}
body{background:radial-gradient(ellipse at 50% 25%,#47382a,#171513 72%);color:#f6e8cc}
header{padding:0 4px}header h1{letter-spacing:-.055em}header button,footer button,#cancel,#levels button{background:linear-gradient(#39332e,#191716);border:1px solid #997747;box-shadow:inset 0 1px 1px #e9d5b344,0 2px 3px #08070480;color:#eed1a2}
.case{position:relative;display:flex;min-height:0;flex:1;padding:0 5.2%;border:5px ridge #af733c;border-radius:16px;background:#482c18;box-shadow:0 6px 12px #0009}
.case:before,.case:after{content:"";position:absolute;top:0;bottom:0;width:5.3%;background:url(tray.webp) center/100% 100%;pointer-events:none}.case:before{left:0}.case:after{right:0;transform:scaleX(-1)}
#board{border:4px ridge #9c622d;border-radius:7px;background:#75421f url(marquetry.webp) center/100% 100%;box-shadow:inset 0 0 13px #37160499}
.point:before{display:none}.bar{background:transparent}
.piece,.piece.black{width:min(96cqw,19.7cqh);flex-shrink:0;position:relative;border:0;box-shadow:1px 2px 3px #2b140dcc;background:transparent url(ivory.webp) center/100% 100%;text-shadow:0 0 3px #fff}.piece.black{background-image:url(ebony.webp);text-shadow:0 0 3px #000}
.chosen{outline:0}.chosen .piece:last-child{outline:2px solid #ffdc82;outline-offset:-1px}.target:after{border:1px solid #ffdf86}.recommended:after{background:#ffca54;box-shadow:0 0 0 5px #452a0d,0 0 0 7px #ffdb7d}
footer{padding:5px 9px;border:1px solid #574839;border-radius:12px;background:linear-gradient(#332e28,#191817);box-shadow:inset 0 1px #c59a5233}
footer .gold{background:linear-gradient(#ffdda1,#dda95d 55%,#c59143);border-color:#f2ce8c;color:#33200f}.gold:disabled{opacity:.52}#dice{gap:3px;font:28px/1 Georgia}
dialog{padding:0 22px 18px;overflow:hidden;border-color:#b58b56;background:linear-gradient(145deg,#362c24,#211c19);box-shadow:0 20px 80px #000a}dialog::backdrop{background:#110e0b80}.menu-art{height:50px;margin:0 -22px 14px;background:linear-gradient(0deg,#0003,transparent),url(marquetry.webp) center/100% auto;border-bottom:2px ridge #a5753f}#levels button:hover,#levels button:focus-visible{background:#69492f}#cancel{width:100%}
@media(max-height:450px){footer{padding:2px 8px}footer button{padding:5px 12px}.case{border-width:3px}.rail{font-size:10px}}
@media(max-width:520px){footer{display:grid;grid-template-columns:1fr auto auto;gap:3px 8px}footer>div:first-child{grid-column:1/-1}#tip{justify-self:start}#board{border-width:2px}.case{padding:0 2.2%;border-width:3px}.case:before,.case:after{width:2.3%}}
.point .piece{--diameter:min(91cqw,30cqh);position:absolute;width:var(--diameter);top:calc(var(--stack) * min(var(--diameter), (100cqh - var(--diameter)) / 4));left:50%;transform:translateX(-50%)}
.point.bottom .piece{top:auto;bottom:calc(var(--stack) * min(var(--diameter), (100cqh - var(--diameter)) / 4))}
.roll-panel{display:flex;align-items:center;gap:8px;flex-shrink:0}
.roll-panel small,.roll-panel strong{display:block}
#numbers{font:700 clamp(19px,3.5vh,30px)/1.1 Georgia,serif;font-variant-numeric:tabular-nums;color:#fff1cc}
#roller{font-size:11px;letter-spacing:.025em}
#dice{display:flex;gap:5px}
.die-face{display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);gap:2px;width:clamp(30px,5vh,44px);aspect-ratio:1;padding:5px;border-radius:7px;border:1px solid #fff4cf;background:linear-gradient(145deg,#fff4d8,#e4cda4);box-shadow:0 2px 2px #130e0a}
.die-face i{display:block;border-radius:50%}.die-face .pip{background:#302118}.die-face.used{background:#c7b99f;border-color:#b3a48e}
.rail strong{color:#ffe1a4;letter-spacing:.04em;font-size:13px}
#menuPrefs{display:block;margin:0 auto 7px;width:100%}#prefs{padding:20px;width:310px}
#prefs label{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:18px 0}
#prefs select{font:inherit;color:#fae3bc;background:#382e24;border:1px solid #947851;border-radius:7px;padding:6px}
#prefs .gold{width:100%}
@media(max-height:480px){dialog{max-height:96dvh;overflow-y:auto}.menu-art{height:25px}#prefs{padding:13px}}

html{background:#201a15;color-scheme:dark}
body{margin:0}
main{width:100%;height:100dvh;max-height:none;max-width:none;gap:2px;padding:max(3px,env(safe-area-inset-top)) max(4px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left))}
header{min-height:24px;padding-inline:7px}header h1{font-size:clamp(20px,3vh,30px)}
#level{color:#e5c397;border-left:1px solid #83653c;padding-left:10px}
.game{min-height:0}.rail{padding:2px 7px;font-size:12px;letter-spacing:.025em;color:#f7dcac}
.rail>span{display:flex;align-items:center;gap:5px}.rail b{font-weight:500}
.swatch{display:inline-block;width:17px;height:17px;border-radius:50%;background:url(ivory.webp) center/cover;box-shadow:0 1px 2px #000b;vertical-align:middle}.swatch.ebony{background-image:url(ebony.webp)}
.board-slot{container-type:size;position:relative;flex:1;min-width:0;min-height:0}
#board{position:absolute;inset:0}
/* Size the two side trays from the same measurement as the playable inset. */
.case{--tray:clamp(12px,min(5vw,8dvh),74px);padding-inline:var(--tray)}
.case::before,.case::after{width:var(--tray)}
body:not(.wide) .case{--tray:clamp(6px,1.8vw,16px)}
#board{grid-template-columns:repeat(6,minmax(0,1fr)) .48fr repeat(6,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr))}
#board button{grid-row:var(--row);grid-column:var(--col);min-height:0;min-width:0}
footer{display:block;border-radius:10px;padding:5px 5px 4px;min-height:0}
footer>.feedback{margin:0;display:flex;align-items:center;justify-content:space-between;gap:6px;padding:1px 5px 6px}
.feedback>div:first-child{min-width:0}
#status{font-size:clamp(15px,2.2vh,19px)}#hint{display:block;font:12px/1.25 system-ui;color:#d8c7b1}
footer nav{display:grid;grid-template-columns:1fr 1fr 1.35fr 1fr 1fr;gap:4px}
nav button{border-radius:8px;padding:4px 2px;min-height:44px;font-size:clamp(11px,2.8vw,15px);line-height:1.05;font-weight:600}
nav .gold{font-weight:750}#off.target{color:#fff;background:#855c2f}
footer #dice{gap:9px;align-items:center;padding:4px 5px}
.die-cube{--edge:clamp(27px,4.4vh,42px);position:relative;display:block;width:var(--edge);height:var(--edge);transform-style:preserve-3d;transform:rotateX(-15deg) rotateY(-20deg) rotateZ(-5deg)}
.die-cube:nth-child(2){transform:rotateX(-19deg) rotateY(-16deg) rotateZ(5deg)}
.die-cube .die-face{position:absolute;inset:0;width:100%;height:100%;padding:12%;gap:7%;border-radius:19%;background:linear-gradient(140deg,#fffced 4%,#fbe8bc 56%,#d8b785);border:1px solid #f6dfa9;box-shadow:inset 1px 1px 2px #fff9,inset -1px -2px 3px #b78c5288;backface-visibility:hidden}
.die-cube .front{transform:translateZ(calc(var(--edge) / 2))}
.die-cube .top{transform:rotateX(90deg) translateZ(calc(var(--edge) / 2));background:#fff4d8}
.die-cube .side{transform:rotateY(90deg) translateZ(calc(var(--edge) / 2));background:#bd9c6c}
.die-cube .pip{background:radial-gradient(circle at 65% 80%,#65513a,#23180e 75%);box-shadow:inset 0 1px 1px #100a06,0 1px #ffffec}
#colors{border:0;padding:0;margin:12px 0;display:flex;gap:7px}#colors legend{font-size:13px;color:#e1c79d;margin-bottom:4px}#colors label{padding:6px;border:1px solid #795c3d;border-radius:6px;display:flex;align-items:center;gap:4px;cursor:pointer}#colors input{accent-color:#cda362}
@media(max-height:480px){main{gap:0}nav button{min-height:35px}header{min-height:20px}.rail{min-height:17px;padding-block:0}.swatch{width:14px;height:14px}footer>.feedback{padding-bottom:2px}footer #dice{padding-block:2px}}
.match-info{display:flex;flex-wrap:wrap;align-items:center;column-gap:14px;row-gap:2px;padding:2px 5px 5px;border-top:1px solid #70533766}
.match-info header{display:flex;align-items:baseline;gap:6px;margin-right:auto;padding:0;min-height:0}
.match-info header h1{font:600 14px Georgia,serif;white-space:nowrap;margin:0}
.match-info #level{font:12px system-ui;color:#e5c397;padding:0;border:0}
.match-info .rail{padding:0;min-height:0;font-size:12px;white-space:nowrap}
.match-info .rail strong{font-size:12px}
.match-info .swatch{width:14px;height:14px}
#prefs #offline{display:block;color:#d8c7b1;font-size:12px;margin-bottom:6px}
@media(max-width:600px){.match-info{display:grid;grid-template-columns:auto auto;justify-content:space-between;column-gap:3px}.match-info header{grid-column:1/-1}.match-info .rail>span{gap:3px}}
body.side-menu main{display:grid;grid-template-columns:minmax(0,1fr) clamp(116px,19vw,185px);grid-template-rows:minmax(0,1fr);gap:4px}
.side-menu footer{display:flex;flex-direction:column;min-width:0;overflow-y:auto;padding:5px}
.side-menu footer>.feedback{display:flex;flex-direction:column;align-items:stretch;gap:5px;margin:0;padding:3px 1px 5px}
.side-menu .feedback:has(#dice:empty) .roll-panel{display:none}
.side-menu .roll-panel{align-self:flex-start;gap:4px;flex-wrap:wrap}
.side-menu #status{font-size:16px}.side-menu #numbers{font-size:18px}
.side-menu .match-info{display:flex;align-items:flex-start;flex-direction:column;gap:3px;padding:5px 0}
.side-menu .match-info .rail{font-size:11px;white-space:normal}
.side-menu footer nav{display:grid;grid-template-columns:1fr;grid-template-rows:repeat(5,minmax(31px,1fr));gap:3px;flex:1}
.side-menu nav button{justify-self:stretch;min-height:31px;width:100%;font-size:13px}
body:not(.side-menu) nav button{justify-self:stretch}

body.side-menu #board{background-image:url(marquetry-portrait.webp);grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(6,minmax(0,1fr)) .48fr repeat(6,minmax(0,1fr))}
body.side-menu #board button{grid-row:var(--col);grid-column:calc(3 - var(--row))}
body.side-menu .point .piece{--diameter:min(91cqh,30cqw);--offset:calc(var(--stack) * min(var(--diameter),(100cqw - var(--diameter)) / 4));top:50%;bottom:auto;left:auto;right:var(--offset);transform:translateY(-50%)}
body.side-menu .point.bottom .piece{right:auto;left:var(--offset)}
body.side-menu .bar{flex-direction:row-reverse;align-items:center}
body.side-menu .bar.bottom{flex-direction:row}
body.side-menu .bar .piece{width:min(92cqh,20cqw)}
body.side-menu .target:after{top:50%;left:50%;transform:translate(-50%,-50%)}

.side-menu footer{align-items:stretch}.side-menu footer nav{flex:0;grid-template-rows:repeat(5,minmax(36px,auto));width:100%;margin-top:auto}.side-menu nav button{padding:6px 3px}.side-menu .match-info .rail>span{flex-wrap:wrap}.side-menu .rail b,.side-menu .rail strong{white-space:nowrap}
