@font-face{font-family:Fraunces;src:url("fonts/fraunces.ttf") format("truetype");font-weight:100 900;font-display:swap}
@font-face{font-family:DM;src:url("fonts/dm-sans.ttf") format("truetype");font-weight:100 1000;font-display:swap}
:root{color-scheme:light;--paper:#fff5d9;--ink:#123e34;--pine:#154a3e;--red:#9e2f38;--gold:#d4a556;--serif:Fraunces,Georgia,serif;--sans:DM,"Trebuchet MS",sans-serif}
*{box-sizing:border-box}
body{margin:0;min-height:100vh;font:1rem/1.4 var(--sans);color:var(--ink);background-color:#f8e8be;background-image:radial-gradient(ellipse at 52% 26%,#fff4d7 6%,#fff2d2b8 48%,#e9c78a44 100%),repeating-linear-gradient(90deg,#d4a9751c 0 2px,transparent 2px 14px),repeating-linear-gradient(0deg,#9e772007 0 1px,transparent 1px 4px)}
button,a{touch-action:manipulation}
button{font:inherit;color:inherit;cursor:pointer}
button:disabled{cursor:default}
button:focus-visible,a:focus-visible{outline:3px solid #b02b4d;outline-offset:3px}
.topbar{background:#113e34;color:#fff4d3;border-bottom:2px solid #d8af69}
.bar-inner{display:flex;align-items:center;justify-content:space-between;gap:.6rem;max-width:1056px;margin:auto;min-height:52px;padding:0 24px}
.arcade-link{display:inline-flex;align-items:center;gap:9px;color:inherit;text-decoration:none;font:800 1.16rem var(--serif)}
.arcade-mark{display:grid;place-items:center;width:26px;height:26px;font:1.3rem/1 Georgia,serif;color:#f5cc69;border:1px solid #dfbd78;border-radius:50%}
.top-actions{display:flex;gap:8px}.top-actions button{display:flex;align-items:center;gap:6px;min-height:44px;background:none;border:0;color:#fff3d3;padding:0 9px;font-weight:650;font-size:.9rem}.top-actions button:hover,.arcade-link:hover{color:#ffd182}
.question-mark{border:1.5px solid currentColor;font:800 .74rem/1 var(--sans);border-radius:50%;display:grid;place-items:center;width:16px;height:16px}
.music-note{font-size:1.22rem;color:#f1c97e}
.awning{height:17px;background:repeating-linear-gradient(90deg,#8e3036 0 29px,#ae4144 30px 50px,#f1d6a0 51px 80px,#fff1cd 81px 101px);border-bottom:2px solid #995f38;box-shadow:0 3px 5px #72422225}
.counter{width:min(100% - 56px,974px);margin:clamp(22px,4vh,42px) auto 0;display:grid;grid-template-columns:minmax(255px,.78fr) minmax(0,1.2fr);grid-template-areas:"sign game" "chapter game" "order game";grid-template-rows:auto auto 1fr;gap:20px clamp(38px,5.5vw,82px);align-items:start}
.shop-sign{grid-area:sign;text-align:center}
.place,.level-label,.chapter-label,.bag-label,.stat span,.ticket-line{font-weight:800;text-transform:uppercase;letter-spacing:.13em;font-size:.75rem}
.place{display:flex;align-items:center;justify-content:center;gap:12px;margin:0 0 8px;color:#754931}
.place span{color:#a83e3e;font-size:.8rem}
h1{margin:0;font-family:var(--serif);font-weight:900;line-height:.88;color:#943139;letter-spacing:-.075em;transform:rotate(-2deg);text-shadow:0 2px #fff6d8,0 4px #d5a65f}
h1 small,h1 span{display:block}h1 small{font:italic 720 clamp(1.65rem,3.2vw,2.6rem)/.99 var(--serif);letter-spacing:-.065em;color:#194737;text-shadow:none;margin-bottom:2px}
h1 span{font-size:clamp(4.4rem,7.4vw,6rem);padding:0 0 9px}
.chapter-card{grid-area:chapter;position:relative;margin:0;padding:6px 6px 0;background:#fff6dc;border:1px solid #a4804d;box-shadow:2px 4px 0 #76503320;transform:rotate(-1deg)}
.chapter-card img{display:block;width:100%;height:clamp(132px,19vh,192px);object-fit:cover;border:1px solid #79582d}
.chapter-card figcaption{padding:9px 7px 10px;display:flex;flex-direction:column;align-items:center;text-align:center}
.chapter-label{letter-spacing:.16em;color:#8d3a35;font-size:.69rem}
.chapter-card strong{font:710 clamp(1.04rem,2vw,1.32rem)/1.24 var(--serif);margin-top:2px}
.order{grid-area:order;position:relative;margin:0 5px 5px;padding:17px 18px 20px;color:#4b3323;background:repeating-linear-gradient(90deg,#fae1c75c 0 10px,#fff3d65c 10px 20px),#fff2d6;border:1px solid #c39768;box-shadow:1px 4px 0 #7d542622}
.order:after{content:"";position:absolute;bottom:-5px;left:-1px;right:-1px;height:6px;background:linear-gradient(135deg,#e7c49a 25%,transparent 25%) -5px 0/10px 10px,linear-gradient(225deg,#e7c49a 25%,transparent 25%) -5px 0/10px 10px}
.order-top{display:flex;justify-content:space-between;align-items:center;gap:6px;border-bottom:1px dashed #aa8160;padding-bottom:7px}
.order h2{font:750 1.52rem/1.1 var(--serif);letter-spacing:-.04em;margin:0;color:#84303a}
.bag-label{font-size:.68rem;letter-spacing:.085em;white-space:nowrap}.ticket-line{display:flex;align-items:center;justify-content:space-between;gap:8px;letter-spacing:.1em;color:#745338;font-size:.67rem;margin:9px 0 6px}
#order-queue{display:flex;gap:3px}.bag-marker{width:6px;height:6px;border:1px solid #906a4b;border-radius:50%}.bag-marker.current{background:#a73a43;border-color:#a73a43}.bag-marker.packed{background:#326554}
#needs{display:grid;gap:3px}.need{display:grid;grid-template-columns:34px 1fr auto;align-items:center;gap:9px;min-height:31px;font-weight:700}.need .sweet{width:32px;height:32px}.need-count{font-variant-numeric:tabular-nums;letter-spacing:.025em;color:#6b3c27}.filled .need-count{color:#29633d}.filled .need-count:before{content:'✓ ';font-size:.9em}
.game{grid-area:game;min-width:0}
.game-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin:0 3px 10px}
.level-label{color:#8a3c37;margin:0 0 1px}.game-head h2{font:775 clamp(1.35rem,2.6vw,1.95rem)/1.1 var(--serif);letter-spacing:-.045em;margin:0}
.levels-button,.counter-tools button{display:inline-flex;align-items:center;justify-content:center;gap:7px;border:1px solid #a78955;border-radius:6px;padding:6px 13px;min-height:40px;color:#174337;background:#fff4d6;font-size:.9rem;font-weight:750}
.levels-button:hover,.counter-tools button:hover{background:#fffaf0;border-color:#734922}
.grid-icon{width:13px;height:13px;background:linear-gradient(currentColor 0 0) 0 0/5px 5px,linear-gradient(currentColor 0 0) 100% 0/5px 5px,linear-gradient(currentColor 0 0) 0 100%/5px 5px,linear-gradient(currentColor 0 0) 100% 100%/5px 5px;background-repeat:no-repeat}
.tray{padding:0 15px;background:linear-gradient(106deg,#215748,#184735 58%,#153f31);border:3px solid #664227;border-radius:18px;box-shadow:inset 0 0 0 2px #e0b875,inset 0 0 0 5px #29604d,0 4px 0 #7b5130,0 7px 0 #c39e64,0 12px 18px -8px #4c2f2890}
.score-strip{display:grid;grid-template-columns:repeat(3,1fr);color:#fff3d7;text-align:center;padding:10px 0 9px}.stat{display:flex;align-items:center;justify-content:center;flex-direction:column;min-width:0;border-right:1px solid #c2985266}.stat:last-child{border:0}.stat span{font-size:.67rem;color:#f2d69e;letter-spacing:.14em}.stat strong{font:760 1.72rem/1.03 var(--serif);font-variant-numeric:tabular-nums}
#board{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));grid-template-rows:repeat(7,minmax(0,1fr));width:100%;aspect-ratio:1;border:2px solid #aa8252;border-radius:8px;overflow:hidden;background:#483a28;box-shadow:0 0 0 2px #112f26,0 2px 4px #0d251b;touch-action:none;isolation:isolate;user-select:none;-webkit-user-select:none}
.tile{border:0;border-right:1px solid #d6c29465;border-bottom:1px solid #d6c29465;border-radius:0;padding:0;min-width:0;min-height:0;display:grid;place-items:center;position:relative;background:linear-gradient(140deg,#f7e6bb,#edd4a2);touch-action:none;-webkit-tap-highlight-color:transparent}
.tile:nth-child(even){background:linear-gradient(140deg,#ddc394,#d8bd8e)}
.tile:after{position:absolute;inset:3px;content:"";pointer-events:none;border-radius:6px}
.tile.selected,.tile.hinted{z-index:1;background:#f8e69c}.tile.selected:after,.tile:focus-visible:after{box-shadow:inset 0 0 0 3px #8c293a}.tile.hinted:after{border:3px dashed #226145}
.tile:focus-visible{outline:0;z-index:2}.tile.matching{background:#fff0a8;z-index:3}
.sweet{display:inline-block;pointer-events:none;aspect-ratio:1;background-image:url("art/sweets.webp");background-size:600% 100%;background-repeat:no-repeat}.tile .sweet{width:88%;filter:drop-shadow(0 2px 1px #4e351c74);will-change:auto}
.s0{background-position:0 0}.s1{background-position:20% 0}.s2{background-position:40% 0}.s3{background-position:60% 0}.s4{background-position:80% 0}.s5{background-position:100% 0}
.tray-bottom{display:flex;align-items:center;justify-content:center;gap:8px;height:20px;font:12px Georgia,serif;color:#e7bd75}.tray-bottom i{width:29px;height:1px;background:#c09c5c}
.counter-tools{display:flex;justify-content:center;gap:9px;margin-top:14px}.counter-tools button{min-height:40px;min-width:100px}.counter-tools button>span{font:1.27rem/1 Georgia,serif;color:#96353a}
#message{margin:6px 0 0;text-align:center;font-size:.91rem;min-height:1.4em;color:#594633}
.credits{display:flex;justify-content:center;align-items:center;gap:10px;margin:22px 0 16px;font-size:.82rem;color:#875e38}.credits a{color:#5b4932;text-underline-offset:3px}.credits span{font-size:.7rem}
.sr-only{position:absolute;width:1px;height:1px;padding:0;border:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
#game-dialog{border:2px solid #31644c;border-radius:14px;background:#fff4d8;color:#204839;width:min(450px,calc(100vw - 26px));max-height:85dvh;padding:0;box-shadow:0 5px 0 #b7884b,0 18px 60px #1b201a70;overscroll-behavior:contain}
#game-dialog::backdrop{background:#102d25b3}
#dialog-content{padding:27px 24px 24px;position:relative}.dialog-title{font:760 2.1rem/1.05 var(--serif);letter-spacing:-.055em;margin:0 24px 8px 0;color:#8e3239}.dialog-copy{margin:0 0 15px}.dialog-close{position:absolute;top:9px;right:9px;width:39px;height:39px;font-size:1.7rem;line-height:1;background:transparent;border:0}.dialog-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:18px}.action-primary,.action-secondary{min-height:45px;padding:8px 17px;border-radius:6px;font-weight:750;border:1px solid #946a3f}.action-primary{background:#174a3c;color:#fff5d8}.action-secondary{background:#f6e5bd}.level-chapter{font:710 1.11rem/1.15 var(--serif);margin:16px 0 7px}.level-list{display:grid;grid-template-columns:repeat(5,1fr);gap:6px}.level-choice{min-height:44px;background:#f5e0b4;border:1px solid #a78049;border-radius:6px;font-weight:800;color:#3e4336}.level-choice:disabled{opacity:.54}.level-choice.completed,.level-choice[aria-current=true]{color:#fff5da;background:#225742}.help-steps{padding-left:23px}.help-steps li{margin:9px 0}.result-score{font:740 1.55rem var(--serif);color:#8f3338}
@media(hover:hover){.tile:hover:after{background:#fff8df36;border:1px solid #ae8257}.tile:hover .sweet{filter:drop-shadow(0 3px 2px #4e351ca0) brightness(1.04)}}
@media(min-width:850px) and (min-height:850px){.counter{margin-top:44px}.chapter-card img{height:190px}.order{padding:20px 24px 24px}}
@media(max-width:730px){
  .counter{width:min(100% - 22px,490px);margin:11px auto 0;grid-template-columns:minmax(0,1fr) minmax(90px,.48fr);grid-template-areas:"sign chapter" "order order" "game game";grid-template-rows:auto;gap:10px}
  .bar-inner{padding:0 12px;min-height:44px}.arcade-link{font-size:1.02rem;gap:6px}.arcade-mark{width:22px;height:22px;font-size:1rem}.top-actions{gap:2px}.top-actions button{font-size:.8rem;padding:0 5px}
  .awning{height:10px}.shop-sign{align-self:center;text-align:left;padding:2px 0 4px 4px}.place{justify-content:flex-start;font-size:.61rem;gap:5px;margin:0 0 4px}.place span:last-child{display:none}
  h1{transform:none;line-height:.89;text-shadow:0 1px #fff4ce,0 2px #d3a05c}h1 small{font-size:1.38rem;line-height:.97}h1 span{font-size:clamp(2.55rem,10.5vw,3.45rem);padding:0}
  .chapter-card{transform:none;padding:3px;align-self:stretch}.chapter-card img{height:58px;min-height:0;object-position:50% 46%}.chapter-card figcaption{padding:3px 1px 0}.chapter-card strong{display:none}.chapter-label{font-size:.55rem;letter-spacing:.08em}
  .order{margin:0;padding:7px 10px 8px;display:grid;grid-template-columns:auto 1fr;column-gap:10px;row-gap:2px;align-items:center}.order-top{border:0;padding:0;align-self:start;flex-direction:column;align-items:flex-start;gap:0}.order h2{font-size:1.14rem}.bag-label{font-size:.6rem}.ticket-line{display:none}#needs{display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;gap:3px 9px}.need{display:grid;grid-template-columns:24px auto;grid-template-rows:auto auto;gap:0 4px;min-height:25px;font-size:.7rem;line-height:1.13}.need .sweet{grid-row:1/3;width:24px;height:24px}.need-name{font-size:.67rem}.need-count{font-size:.79rem}
  .game-head{margin:3px 2px 6px}.game-head h2{font-size:1.22rem}.level-label{font-size:.64rem}.levels-button{min-height:40px;padding:6px 10px}
  .tray{border-width:2px;border-radius:12px;padding:0 8px}.score-strip{padding:6px 0 5px}.stat span{font-size:.59rem}.stat strong{font-size:1.35rem}.tray-bottom{height:11px;font-size:9px}
  .counter-tools{margin-top:10px}.counter-tools button{min-height:42px}.credits{margin:12px 0}.game #message{font-size:.82rem;margin:4px 0 0}
}
@media(min-width:731px) and (max-height:700px){.counter{max-width:850px;margin-top:14px;gap:15px 52px}.chapter-card img{height:127px}.order{padding:11px 14px 13px}.place{margin-bottom:4px}h1 span{font-size:4.5rem}.score-strip{padding:7px 0}.credits{margin-top:12px}}
@media(max-width:360px){.bar-inner{padding:0 6px}.arcade-mark{display:none}.top-actions button{padding:0 3px}.counter{width:calc(100% - 12px)}.need-name{font-size:.64rem}.order{padding:6px}.counter-tools{gap:6px}}
@media(max-height:540px) and (orientation:landscape) and (min-width:580px){.bar-inner{min-height:35px}.top-actions button{min-height:35px}.awning{height:7px}.counter{display:grid;width:min(100% - 28px,850px);max-width:calc(100dvh * 1.74);grid-template-columns:minmax(0,.73fr) minmax(0,1fr);grid-template-areas:"sign game" "chapter game" "order game";gap:8px 25px;margin-top:9px}.shop-sign{text-align:center}.place{justify-content:center}.shop-sign h1 small{font-size:1.1rem}.shop-sign h1 span{font-size:2.45rem}.chapter-card{align-self:auto}.chapter-card img{height:70px}.chapter-card figcaption{padding:3px}.order{display:block;padding:5px 10px}.order-top{flex-direction:row;align-items:center}.order h2{font-size:1.1rem}.ticket-line{display:none}#needs{display:grid;justify-content:stretch}.need{font-size:.77rem;min-height:22px;grid-template-columns:22px 1fr auto;grid-template-rows:auto}.need .sweet{width:22px;height:22px;grid-row:auto}.game-head{margin-bottom:4px}.game-head h2{font-size:1.1rem}.game-head button{min-height:34px}.score-strip{padding:3px}.stat strong{font-size:1.05rem}.stat span{font-size:.58rem}.tray{padding:0 6px;border-width:2px}.tray-bottom{height:8px}.counter-tools{margin-top:6px}.counter-tools button{min-height:34px}.credits{margin:7px 0}}
.level-chapter h3 {
  display:flex; align-items:center; gap:10px;
  margin:15px 0 8px; font:720 1.1rem/1.2 var(--serif);
}
.chapter-thumb {width:56px;height:36px;object-fit:cover;border:2px solid #fff7dc;outline:1px solid #ad8855}
.level-choice[aria-current="step"] {outline:2px solid var(--red);outline-offset:1px}
#game-dialog[data-kind="won"] #dialog-content {text-align:center;background:radial-gradient(ellipse at 50% 20%,#fffdf0 10%,transparent 60%)}
#game-dialog[data-kind="won"] #dialog-content:before {
  content:"";display:block;height:134px;margin:0 auto 10px;
  background:url("art/packed-bag.webp") center / contain no-repeat;
}
#game-dialog[data-kind="won"] .dialog-title {margin-right:0}
#game-dialog[data-kind="won"] .dialog-actions {justify-content:center}
.cascade-reward {
  pointer-events:none;position:absolute;left:50%;top:18%;translate:-50% 0;
  padding:.1em .35em;border-radius:1em;background:#912e3c;color:#fff7da;
  font:800 clamp(1rem,2.2vw,1.5rem)/1.05 var(--serif);
  box-shadow:0 0 0 2px #ffe6ab,0 2px 6px #46271677;z-index:5;
}
.tile:has(.cascade-reward) {z-index:6}
.tile.matching:after {
  background:radial-gradient(circle at 18% 25%,#fff7ce 0 4%,transparent 5%),
  radial-gradient(circle at 82% 74%,#fff 0 3%,transparent 4%),
  radial-gradient(ellipse at 50% 50%,transparent 48%,#ffeba56e 80%);
  box-shadow:inset 0 0 9px #faeab2;z-index:2;
}
@media(max-width:730px) {
  .chapter-card strong {display:block;font:650 .64rem/1.12 var(--sans);margin:1px 0}
  .chapter-card .chapter-label {display:none}
}
@media(max-height:540px) and (orientation:landscape) and (min-width:580px) {
  .game {width:min(100%,calc(100svh - 99px));justify-self:center}
  .game-head {min-height:32px}.score-strip{padding:2px 0}
  .shop-sign .place{font-size:.62rem}
}
@media(max-height:540px) and (orientation:landscape) and (min-width:580px) {
  .counter {max-width:calc(100svh * 2.12)}
  .game {width:100%}
  .tray {
    display:grid;grid-template-columns:minmax(46px,1fr) minmax(0,calc(100svh - 111px));
    align-items:stretch;gap:5px;padding:5px 6px;border-radius:10px;
  }
  .score-strip {grid-template-columns:1fr;align-content:center;gap:8px}
  .stat {padding:5px 0;border:0}.tray-bottom{display:none}
}
@media(max-width:370px) and (max-height:650px) and (orientation:portrait) {
  .shop-sign h1 small {font-size:1.03rem}.shop-sign h1 span{font-size:2.22rem}
  .chapter-card img {height:38px}.counter{gap:6px;margin-top:7px}
  .bar-inner{min-height:38px}.top-actions button{min-height:38px}
  .game-head h2{font-size:1.08rem}.levels-button{min-height:34px}
  .score-strip{padding:3px 0}.tray-bottom{height:8px}
}
