@font-face { font-family: 'Caprasimo'; src: url('fonts/caprasimo-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Patrick Hand'; src: url('fonts/patrick-hand-latin-400-normal.woff2') format('woff2'); font-display: swap; }
:root {
  --ink: #2a1710; --fridge: #e3a92f; --fridge2: #f0bd4a; --fridge3: #c98f1f; --note: #ffe873; --pink: #ffb9c6; --blue: #a9ddf0; --paper: #fff8e6; --tomato: #d9472b; --green: #5e8f2a;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--fridge); color: var(--ink); overflow: hidden; font-family: 'Patrick Hand', 'Comic Sans MS', system-ui, sans-serif; font-size: 18px; line-height: 1.25; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:focus-visible, canvas:focus-visible { outline: 3px solid #123fbf; outline-offset: 2px; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

/* In-game strip */
#hud { position: fixed; z-index: 3; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 6px; padding: calc(4px + var(--safe-t)) calc(58px + var(--safe-r)) 4px calc(6px + var(--safe-l)); pointer-events: none; height: calc(52px + var(--safe-t)); background: var(--ink); color: #fff3cf; }
#hud > * { pointer-events: auto; }
.icon { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--fridge2); color: var(--ink); border: 2px solid #120a07; }
.icon svg { width: 24px; height: 24px; fill: currentColor; }
.icon:active { transform: translateY(1px); }
#btnRetry { background: var(--note); }
#btnMute { position: fixed; z-index: 6; right: calc(6px + var(--safe-r)); top: calc(4px + var(--safe-t)); }
#btnMute .off { display: none; }
#btnMute.muted .on { display: none; }
#btnMute.muted .off { display: block; }
#hudMid { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.05; padding-left: 4px; }
#hudHole { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hudPar { font-size: 15px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hudCash { font-family: 'Caprasimo', serif; font-size: 15px; color: #ffb9c6; white-space: nowrap; }
#hudCash.pop { animation: pop .3s; }
#hudScore { font-family: 'Caprasimo', serif; font-size: 30px; min-width: 38px; text-align: center; color: var(--note); line-height: 1; }
#hudScore.pop { animation: pop .22s; }
@keyframes pop { 40% { transform: scale(1.4); } }

/* Hole title: says what is odd about this hole, never blocks the first shot */
#banner { position: fixed; z-index: 2; top: calc(62px + var(--safe-t)); left: 50%; width: min(92vw, 460px); transform: translate(-50%, -8px) rotate(-1deg); background: var(--note); border: 2px solid var(--ink); box-shadow: 3px 4px 0 rgba(42,23,16,.45); padding: 7px 14px 9px; pointer-events: none; opacity: 0; transition: opacity .2s, transform .2s; }
#banner.on { opacity: 1; transform: translate(-50%, 0) rotate(-1deg); }
#banner b { display: block; font-weight: 400; font-size: 15px; }
#banner strong { display: block; font-family: 'Caprasimo', serif; font-weight: 400; font-size: 23px; line-height: 1.1; }
#banner span { display: block; font-size: 18px; line-height: 1.15; margin-top: 2px; }

#turn { position: fixed; z-index: 2; bottom: calc(10px + var(--safe-b)); left: 50%; transform: translateX(-50%); padding: 5px 16px; font-size: 20px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); white-space: nowrap; pointer-events: none; box-shadow: 2px 3px 0 rgba(42,23,16,.5); }
#turn i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); margin-right: 7px; vertical-align: -1px; }
#hint { position: fixed; z-index: 2; bottom: calc(14px + var(--safe-b)); left: 50%; transform: translateX(-50%) rotate(1deg); width: max-content; max-width: 90vw; text-align: center; background: var(--paper); border: 2px solid var(--ink); padding: 6px 14px; font-size: 20px; box-shadow: 3px 4px 0 rgba(42,23,16,.45); pointer-events: none; }
#hint small { display: block; font-size: 15px; opacity: .8; }

/* The fridge: every menu lives on its door */
#menu { position: fixed; inset: 0; z-index: 4; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: calc(10px + var(--safe-t)) calc(22px + var(--safe-r)) calc(10px + var(--safe-b)) calc(34px + var(--safe-l));
  background: linear-gradient(90deg, var(--fridge3) 0, var(--fridge2) 7%, var(--fridge) 30%, var(--fridge) 72%, var(--fridge3) 100%); }
.handle { position: fixed; left: 8px; top: 18%; bottom: 40%; width: 13px; border-radius: 8px; background: linear-gradient(90deg, #efeadf, #fff, #a9a59b); border: 2px solid var(--ink); }
.m-left, .m-right { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 10px; flex: none; }
#logo { display: flex; flex-direction: column; align-items: flex-start; gap: 0; font-family: 'Caprasimo', serif; font-weight: 400; }
#logo .w { display: flex; flex-wrap: nowrap; gap: 3px; }
#logo .gap { width: .3em; font-size: clamp(36px, 13vw, 62px); }
#logo .l { display: inline-grid; place-items: center; width: .98em; height: 1.1em; font-size: clamp(36px, 13vw, 62px); line-height: 1; color: var(--c); -webkit-text-stroke: 1.6px var(--ink); paint-order: stroke fill; text-shadow: 2px 3px 0 rgba(42,23,16,.45); transform: rotate(var(--r)) translateY(var(--y)); }
#noteHome { transform: rotate(-1.2deg); }
.paper { background: var(--paper); padding: 10px 14px; border: 2px solid var(--ink); box-shadow: 3px 4px 0 rgba(42,23,16,.4); background-image: repeating-linear-gradient(transparent 0 24px, rgba(63,127,196,.22) 24px 25px); }
#noteText { font-size: 20px; line-height: 25px; }
#noteSign { text-align: right; font-size: 20px; line-height: 25px; }
.btn { display: flex; flex-direction: column; position: relative; text-align: left; border: 2px solid var(--ink); box-shadow: 3px 4px 0 rgba(42,23,16,.5); padding: 8px 14px; transition: transform .08s, box-shadow .08s; }
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translate(2px, 3px) !important; box-shadow: 1px 1px 0 rgba(42,23,16,.5); }
.btn .t { font-family: 'Caprasimo', serif; font-size: 23px; line-height: 1.15; }
.btn .s { font-size: 17px; line-height: 1.15; }
.big { min-height: 62px; padding-right: 38px; }
#btnPlay { transform: rotate(-.7deg); } #btnDaily { transform: rotate(.6deg); } #btnParty { transform: rotate(-.4deg); }
.small { flex: 1; align-items: center; justify-content: center; flex-direction: row; gap: 7px; min-height: 46px; font-size: 19px; text-align: center; padding: 6px 8px; }
.small canvas { width: 24px; height: 24px; }
.n-yellow { background: var(--note); } .n-pink { background: var(--pink); } .n-blue { background: var(--blue); } .n-white { background: var(--paper); } .n-tomato { background: var(--tomato); color: #fff8e6; }
.pin { position: absolute; right: 11px; top: 9px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink); box-shadow: inset -3px -3px 0 rgba(0,0,0,.2), 1px 2px 0 rgba(42,23,16,.5); }
.p-red { background: #e0482c; } .p-blue { background: #2b6fd1; } .p-green { background: #3aa655; }
.m-row { display: flex; gap: 10px; }
#stats { font-size: 18px; text-align: center; line-height: 1.2; }
#stats span { white-space: nowrap; margin: 0 6px; }
#byline { font-size: 15px; text-align: center; line-height: 1.15; opacity: .9; }

/* Notes pinned over the game */
#panel { position: fixed; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: calc(10px + var(--safe-t)) 12px calc(10px + var(--safe-b)); background: rgba(42,23,16,.5); overflow-y: auto; }
#panel.sheet { background: none; align-items: flex-end; pointer-events: none; }
#panel.sheet .card { pointer-events: auto; }
#panel.solid { background: var(--fridge); }
.card { width: 100%; max-width: 440px; max-height: 100%; overflow-y: auto; background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 5px 6px 0 rgba(42,23,16,.55); padding: 13px 16px 12px; display: flex; flex-direction: column; gap: 9px; margin: auto; }
#panel.sheet .card { margin: 0 auto; transform: rotate(-.5deg); max-width: 460px; }
#panel.wide .card { max-width: 620px; }
#pTitle { font-family: 'Caprasimo', serif; font-weight: 400; font-size: 26px; line-height: 1.1; }
#pBody { display: flex; flex-direction: column; gap: 7px; font-size: 19px; }
#pBody .muted { opacity: .8; font-size: 17px; }
#pBody .warn { background: var(--note); border: 2px dashed var(--ink); padding: 5px 9px; font-size: 17px; }
#pBtns { display: flex; flex-wrap: wrap; gap: 8px; }
#pBtns .btn { flex: 1 1 42%; align-items: center; justify-content: center; text-align: center; min-height: 46px; padding: 7px 10px; font-size: 20px; }
#pBtns .btn.primary { flex-basis: 100%; font-family: 'Caprasimo', serif; font-size: 22px; background: var(--note); }
#pBtns .btn.ghost { background: transparent; box-shadow: none; border-style: dashed; }
#pToast { min-height: 0; font-size: 16px; text-align: center; }
#pToast:empty { display: none; }
#pBody textarea { width: 100%; height: 84px; font: inherit; font-size: 16px; user-select: text; -webkit-user-select: text; }
.starline { display: flex; align-items: center; gap: 4px; }
.starline svg { width: 34px; height: 34px; }
.starline .res { margin-left: 8px; font-size: 21px; line-height: 1.05; }
.star-on path { fill: #f4bf1d; } .star-off path { fill: rgba(42,23,16,.13); }
.star-on, .star-off { stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.star-pop { animation: starpop .34s backwards; }
@keyframes starpop { 0% { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.25); } }
.newball { background: var(--blue); border: 2px solid var(--ink); padding: 3px 9px; font-size: 17px; }
.bill { width: 100%; border-collapse: collapse; font-size: 20px; }
.bill td { padding: 3px 0; border-bottom: 1.5px dashed rgba(42,23,16,.4); }
.bill td:last-child { text-align: right; font-family: 'Caprasimo', serif; }
.verdict { font-family: 'Caprasimo', serif; font-size: 22px; line-height: 1.15; color: var(--tomato); transform: rotate(-1.2deg); padding: 2px 0; }
.squares { display: flex; gap: 4px; flex-wrap: wrap; }
.squares i { width: 22px; height: 22px; display: grid; place-items: center; border: 2px solid var(--ink); font-style: normal; font-size: 14px; line-height: 1; }
.sq-u { background: #6fc276; } .sq-p { background: #f4d65a; } .sq-o { background: #ee8f6a; } .sq-x { background: #b4a79a; }
.scores { width: 100%; border-collapse: collapse; font-size: 18px; }
.scores th, .scores td { padding: 3px 4px; text-align: center; border-bottom: 1.5px dashed rgba(42,23,16,.35); font-weight: 400; }
.scores th:first-child, .scores td:first-child { text-align: left; }
.scores .dot { display: inline-block; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--ink); margin-right: 5px; vertical-align: -1px; }
.scores .lead { font-family: 'Caprasimo', serif; }
.choice { display: flex; gap: 8px; }
.choice button { flex: 1; min-height: 46px; border: 2px solid var(--ink); background: var(--paper); font-size: 20px; padding: 4px 6px; line-height: 1.1; }
.choice button[aria-pressed="true"] { background: var(--note); box-shadow: inset 0 0 0 2px var(--ink); }
.rooms { display: flex; flex-direction: column; gap: 8px; }
.room h3 { font-weight: 400; font-size: 18px; margin-bottom: 3px; }
.tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.tile { width: 58px; min-height: 58px; border: 2px solid var(--ink); background: var(--note); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; padding: 3px; }
.tile b { font-family: 'Caprasimo', serif; font-weight: 400; font-size: 21px; }
.tile span { font-size: 13px; letter-spacing: -.5px; margin-top: 2px; color: #7b4d00; }
.tile[disabled] { background: rgba(42,23,16,.12); cursor: not-allowed; opacity: .7; }
.ballgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 7px; }
.ballc { border: 2px solid var(--ink); background: #fff; padding: 5px 3px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 15px; line-height: 1.05; text-align: center; min-height: 92px; }
.ballc canvas { width: 40px; height: 40px; }
.ballc[aria-pressed="true"] { background: var(--note); box-shadow: inset 0 0 0 2px var(--ink); }
.ballc[disabled] { background: rgba(42,23,16,.09); cursor: not-allowed; }
.ballc small { font-size: 14px; opacity: .85; }
.cardlist { max-height: calc(100vh - 170px); max-height: calc(100dvh - 170px); overflow-y: auto; padding-right: 3px; }
#keysHint { font-size: 15px; opacity: .8; }

@media (orientation: landscape) and (max-height: 560px) {
  #menu { flex-direction: row; align-items: center; gap: 22px; padding-top: calc(6px + var(--safe-t)); padding-bottom: calc(6px + var(--safe-b)); }
  .m-left { max-width: 42%; flex: 0 1 42%; gap: 7px; }
  .m-right { max-width: 54%; flex: 0 1 54%; gap: 6px; }
  #logo .l, #logo .gap { font-size: clamp(24px, 5.2vw, 40px); }
  #noteText, #noteSign { font-size: 17px; line-height: 21px; }
  .paper { padding: 6px 10px; background-image: none; }
  .big { min-height: 48px; padding: 4px 34px 4px 12px; }
  .btn .t { font-size: 20px; } .btn .s { font-size: 15px; }
  .small { min-height: 40px; font-size: 17px; }
  #stats { font-size: 15px; } #byline { font-size: 13px; }
  .card { padding: 8px 12px; gap: 6px; }
  #panel.sheet { align-items: center; justify-content: flex-end; }
  #panel.sheet .card { margin: 0; max-width: 340px; }
  #pTitle { font-size: 22px; }
  #banner { top: calc(58px + var(--safe-t)); width: min(60vw, 420px); padding: 4px 12px 6px; }
  #banner strong { font-size: 20px; } #banner span { font-size: 16px; }
}
@media (min-width: 900px) and (min-height: 561px) {
  #menu { flex-direction: row; gap: 56px; }
  .m-left { max-width: 460px; flex: 0 1 460px; }
  .m-right { max-width: 400px; flex: 0 1 400px; }
  #logo .l, #logo .gap { font-size: 76px; }
  .handle { width: 18px; left: 18px; }
}
@media (max-height: 640px) and (orientation: portrait) {
  #menu { justify-content: flex-start; gap: 8px; }
  .m-left, .m-right { gap: 6px; }
  #logo .l, #logo .gap { font-size: 32px; }
  #noteText, #noteSign { font-size: 16px; line-height: 19px; }
  .paper { padding: 4px 10px; background-image: none; }
  .big { min-height: 48px; padding: 4px 34px 4px 12px; }
  .btn .t { font-size: 19px; } .btn .s { font-size: 14px; }
  #stats { font-size: 14px; } #byline { font-size: 12px; }
  .small { min-height: 44px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
