:root{font:800 16px/1.14 "Trebuchet MS",Arial,sans-serif;color:#fff2c6}
*{box-sizing:border-box}html,body{height:100%;width:100%;margin:0;overflow:hidden;background:#111b30}
button,a{font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}button:focus-visible,a:focus-visible,#board:focus-visible{outline:3px solid #fff1ad;outline-offset:3px}
[hidden]{display:none!important}#experience{position:relative;isolation:isolate;overflow:hidden;width:100%;height:100%;background:#1a2040;user-select:none;-webkit-user-select:none;touch-action:manipulation}
#backdrop {
  --ledge: 11%;
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 5% 36%, #345263 0%, transparent 45%),
    linear-gradient(122deg, #243649 8%, #28384c 51%, #282c40 100%);
}
#backdrop::before {
  content: "";
  position: absolute;
  left: -10cqw;
  bottom: calc(var(--ledge) + 4%);
  width: 22cqw;
  height: 71%;
  border: clamp(3px, .65cqw, 9px) solid #203541;
  border-radius: 57% 57% 3px 3px / 25% 25% 3px 3px;
  background:
    linear-gradient(57deg, transparent 48.8%, #304853 49% 50.4%, transparent 50.6%),
    linear-gradient(122deg, transparent 41%, #304853 41.2% 42.4%, transparent 42.6%),
    conic-gradient(from 8deg at 70% 43%, #355865 0deg 104deg, #3e5869 104deg 184deg, #41666a 184deg 258deg, #425870 258deg 360deg);
  box-shadow: 0 0 0 2px #5263684d, 6px 5px 0 #2133424d;
}
#backdrop::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: var(--ledge);
  border-top: 2px solid #7c6552;
  background: linear-gradient(176deg, #655045 0%, #57453f 42%, #443a38 100%);
  box-shadow: 0 -4px 12px #18253228;
}
@container playable (max-aspect-ratio: 1/1) {
  #backdrop { --ledge: 14%; }
  #backdrop::before {
    left: -20cqw;
    width: 37cqw;
    height: 57%;
    bottom: calc(var(--ledge) + 9%);
  }
}
header{position:absolute;inset:0 0 auto;z-index:5;pointer-events:none;background:linear-gradient(#12172f66,transparent)}header button,header a,header .playable-formats{pointer-events:auto}
.wordmark{filter:drop-shadow(0 2px 2px #141021)}.wordmark small,.wordmark b{font-family:Georgia,"Times New Roman",serif;paint-order:stroke fill;-webkit-text-stroke:2.5px #33243b;text-shadow:0 3px #342339}
.wordmark small{letter-spacing:.13em;color:#ffda83}.wordmark b{letter-spacing:-.06em;color:#fff7d3}
#play{position:absolute;inset:13% 0 2%;display:flex;align-items:center;justify-content:center;gap:clamp(20px,4.1cqw,80px)}
.frame{--length:min(51cqw,76cqh);flex:none;width:var(--length);height:var(--length);position:relative;padding:clamp(10px,1.85cqh,22px);border:2px solid #372832;border-radius:5.3%;background:linear-gradient(130deg,#fff0ac,#f3c066 8%,#b56e38 24%,#6d4032 50%,#ffc767 72%,#825134 96%);box-shadow:inset 0 0 0 2px #f3ce87,inset 0 0 0 5px #8a5a38,0 5px 0 #372a35,0 12px 22px #090c2375}
.stud{position:absolute;width:clamp(4px,1cqh,9px);aspect-ratio:1;transform:rotate(45deg);background:#fff3ad;border:1px solid #88522d;z-index:2}.a,.b{top:1.5%}.c,.d{bottom:1.5%}.a,.c{left:1.5%}.b,.d{right:1.5%}
#board{position:relative;width:100%;height:100%;border-radius:2%;isolation:isolate;background:#0b263c;box-shadow:0 0 0 2px #4d3131;touch-action:none}
#wells,#tiles,#marks,#bursts{position:absolute;inset:0;overflow:hidden;border-radius:inherit;pointer-events:none}
#wells{display:grid;grid-template:repeat(6,1fr)/repeat(6,1fr);background:#345063;transition:opacity .6s}
.well{background:linear-gradient(140deg,#153d4e,#0e2a40 75%);border:1px solid #1b4554;box-shadow:inset 0 2px 4px #06182c90;border-radius:7%}.well:nth-child(4n+1){background:linear-gradient(140deg,#184455,#102e43)}
.pane,.mark,.beam{position:absolute;left:0;top:0;pointer-events:none}
.pane,.mark{width:16.6666667%;height:16.6666667%;transform:translate(calc(var(--x)*100%),calc(var(--y)*100%));}
.pane{background:var(--glass) center/96% 96% no-repeat;filter:drop-shadow(0 1px 1px #041a29);will-change:transform}
.pane.cut{animation:cut .47s both ease-out;animation-delay:var(--lag,0s)}
@keyframes cut{0%{opacity:1}26%{filter:brightness(1.9) saturate(.45)}65%{opacity:.95;scale:.92}100%{opacity:0;filter:brightness(2)}}
.pane.mosaic{transition:transform .70s cubic-bezier(.18,.77,.25,1),filter .6s;background-size:99% 99%}
#board.assembled #wells{opacity:.11}#board.assembled{background:radial-gradient(ellipse,#174f59,#15273b 68%)}
#board.lit #tiles{filter:drop-shadow(0 0 13px #ffdd78) saturate(1.3) brightness(1.37)}
.mark{padding:2px}.mark::before{content:"";display:block;width:100%;height:100%;border-radius:12%;border:2px dashed #ffdf8b;background:#ffd67524;box-shadow:inset 0 0 10px #ffde7645}
.mark.valid::before{background:#7ff8bd65;border:2px solid #b7ffce}.mark.invalid::before{background:#ff76694f;border:2px solid #ffa295}.mark.soft::before{opacity:.75}
.beam{height:16.666667%;width:100%;top:calc(var(--row)*16.666667%);background:linear-gradient(0deg,transparent,#ffe89188 34%,#fffedb 49%,#ffdb7aa8 58%,transparent);mix-blend-mode:screen;animation:sweep .56s ease-out both}
@keyframes sweep{0%{clip-path:inset(0 100% 0 0);opacity:0}45%{clip-path:inset(0);opacity:.96}100%{clip-path:inset(0);opacity:0}}
#ignite{position:absolute;z-index:4;left:50%;top:50%;width:30%;aspect-ratio:1;transform:translate(-50%,-50%);padding:0;border:0;border-radius:50%;background:radial-gradient(#fee49b67,transparent 72%);filter:drop-shadow(0 2px 2px #24273b)}
#ignite img{width:100%;height:100%;object-fit:contain;pointer-events:none}
#board.lit #ignite{filter:drop-shadow(0 0 14px #fff099);transform:translate(-50%,-50%) scale(1.15)}
#flash{position:absolute;z-index:3;inset:0;pointer-events:none;background:radial-gradient(circle at center,#fff5ae 0%,#ffdb791f 58%,transparent 75%);animation:light 1s ease-out both}
@keyframes light{0%{opacity:0;scale:.35}27%{opacity:.95}100%{opacity:0;scale:1.3}}
.bench{width:min(31cqw,340px);max-width:90%;display:flex;flex-direction:column;align-items:center;text-align:center;gap:clamp(9px,2cqh,22px)}
.counter{display:inline-flex;align-items:center;gap:.52em;background:#162e3bed;box-shadow:inset 0 0 0 1px #356362,0 2px 0 #241c31;border:1.5px solid #dca864;border-radius:22px;color:#ffdd91;padding:.30em .88em;font:900 clamp(12px,2.25cqh,20px)/1 Arial,sans-serif}.counter span{letter-spacing:.09em;text-transform:uppercase}.counter b{font-size:1.26em;font-variant-numeric:tabular-nums;color:#fff2bf}
h1{margin:0;font:bold clamp(22px,min(4.6cqw,6.6cqh),52px)/1.03 Georgia,serif;color:#fff2cf;letter-spacing:-.035em;text-wrap:balance;paint-order:stroke fill;-webkit-text-stroke:3px #2c2334;text-shadow:0 3px 1px #291e32,0 5px 14px #100c25}
.rack{display:flex;gap:8px;align-items:center;justify-content:center;width:100%;padding:clamp(8px,1.65cqh,16px);border-radius:19px;border:2px solid #deb277;background:linear-gradient(140deg,#214c53,#183642);box-shadow:inset 0 0 0 3px #37605e,0 4px 0 #3a2a31,0 6px 14px #0e17265c}
.piece{--cell:clamp(14px,min(3.7cqw,5.2cqh),43px);flex:1;position:relative;display:grid;place-items:center;min-width:0;height:calc(var(--cell)*3.25);padding:3px;border:1px solid #766953;border-radius:12px;background:linear-gradient(145deg,#173643,#172a40);box-shadow:inset 0 2px 5px #101c3099;touch-action:none}
.piece.selected{border-color:#ffe48a;box-shadow:0 0 0 1px #ffe48a,inset 0 0 12px #e5bb533b}.piece.used{border-style:dashed;opacity:.45}.piece.used>.shape{opacity:0}.piece.used::after{content:"✓";position:absolute;inset:0;display:grid;place-items:center;font-size:1.8em;color:#94eed3}.piece.dragging .shape{opacity:.20}
.shape,#ghost{display:grid;grid-template:repeat(var(--rows),var(--cell))/repeat(var(--cols),var(--cell));width:max-content;height:max-content;pointer-events:none}
.block{grid-column:var(--col);grid-row:var(--row);background:var(--glass) center/98% 98% no-repeat}
#ghost{position:absolute;z-index:7;pointer-events:none;filter:drop-shadow(0 5px 3px #15182c99);opacity:.91}
#hand{position:absolute;z-index:6;pointer-events:none;width:clamp(32px,min(10cqw,10cqh),66px);transform-origin:5% 5%;filter:drop-shadow(0 2px 2px #271c2c88);animation:teach 2.15s ease-in-out infinite}
@keyframes teach{0%,100%{opacity:0;transform:none}12%{opacity:1;transform:scale(.94)}28%{transform:scale(.86)}70%,82%{opacity:1;transform:translate(var(--dx),var(--dy)) scale(.88)}94%{opacity:0;transform:translate(var(--dx),var(--dy)) scale(1)}}
#fx,#end{position:absolute;inset:0}#fx{z-index:7;pointer-events:none;overflow:hidden}
#end{z-index:9;display:flex;justify-content:center;align-items:flex-end;padding:0 12px max(4cqh,env(safe-area-inset-bottom));background:linear-gradient(transparent 48%,#111832b0)}
.reward{position:relative;display:flex;align-items:center;gap:clamp(9px,2.3cqw,26px);padding:clamp(11px,2.4cqh,23px) clamp(15px,2.7cqw,28px);background:linear-gradient(120deg,#20484e,#163544 75%);border:2px solid #ecc185;box-shadow:inset 0 0 0 3px #3b5e5c,0 4px 0 #352b31;border-radius:17px;max-width:94cqw}
.reward img{width:clamp(45px,min(10cqw,14cqh),85px)}.reward h2{font:bold clamp(24px,min(7cqw,7cqh),48px)/1 Georgia,serif;letter-spacing:-.04em;margin:0;color:#ffdd8a}.reward p{margin:.38em 0 0;font-size:clamp(13px,2.6cqh,20px)}
.actions{display:flex;gap:7px;flex-wrap:wrap;justify-content:center}.actions button{white-space:nowrap;font-size:clamp(14px,2.8cqh,20px);padding:.60em .95em}.replay{display:inline-block}
header[inert] nav,header[inert] .cta{visibility:hidden}
@container playable (max-aspect-ratio:1/1){
 #play{inset:14% 0 2%;flex-direction:column;gap:clamp(12px,2.7cqh,23px)}
 .frame{--length:min(88cqw,55cqh)}
 .bench{width:min(87cqw,445px);gap:clamp(5px,1.05cqh,14px)}
 .counter{font-size:clamp(10px,2.7cqw,14px)}h1{font-size:clamp(19px,min(6.6cqw,4.35cqh),40px)}
 .rack{width:min(68cqw,31cqh);padding:5px 7px;gap:5px;border-radius:13px}
 .piece{--cell:clamp(13px,min(4.15cqw,2.75cqh),26px);height:calc(var(--cell)*3.15);border-radius:8px}
 .reward{display:grid;grid-template-columns:auto 1fr}.actions{grid-column:1/-1}
}
@container playable (max-height:375px) and (orientation:landscape){#play{inset:15% 0 2%}.frame{--length:min(51cqw,76cqh)}.bench{gap:6px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition:none!important}#hand{animation:none!important}}
