/* Slime Time! Look: a bubble-gum pink shop with a lime slime drip along the top, white sticker cards with a
   navy ink line, a cream table. No purple anywhere (Nick's rule). Ink is #14324a. */
:root {
	--ink: #14324a; --pink: #ff6fa8; --pinkD: #f0478a; --lime: #b6f03c; --limeD: #7fc400; --cream: #fff7e6;
	--teal: #14b8c4; --yel: #ffd62e; --white: #ffffff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
	font-family: 'Fredoka', 'Nunito', system-ui, sans-serif; font-weight: 500; color: var(--ink);
	background: var(--pink) radial-gradient(circle at 20px 20px, rgba(255, 255, 255, .22) 5px, transparent 6px) 0 0 / 56px 56px;
	-webkit-user-select: none; user-select: none; touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; }
#app { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }

/* top bar: lime slime, dripping */
#top {
	position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 72px 8px 72px; min-height: 64px;
	background: var(--lime); border-bottom: 3px solid var(--ink);
}
#top::after {
	content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 22px; pointer-events: none; z-index: 1;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='22' viewBox='0 0 220 22'%3E%3Cpath d='M0 0 H220 V3 C210 3 208 3 204 3 C198 3 199 14 192 14 C185 14 187 3 178 3 C160 3 150 3 140 3 C132 3 134 20 125 20 C116 20 119 3 110 3 C96 3 90 3 82 3 C76 3 77 10 71 10 C65 10 66 3 60 3 C48 3 44 3 36 3 C29 3 31 17 23 17 C15 17 17 3 10 3 C6 3 3 3 0 3 Z' fill='%23b6f03c' stroke='%2314324a' stroke-width='3'/%3E%3Crect width='220' height='2.5' fill='%23b6f03c'/%3E%3C/svg%3E") repeat-x 0 -1.5px;
}
#title { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; color: var(--ink); }
#modes { display: flex; margin-left: 8px; border: 3px solid var(--ink); border-radius: 999px; background: var(--white); overflow: hidden; }
.mode { border: 0; background: transparent; min-height: 44px; padding: 0 18px; font-size: 17px; font-weight: 600; }
.mode[aria-pressed="true"] { background: var(--ink); color: var(--white); }
#starBtn {
	margin-left: auto; display: flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 16px; font-size: 22px; font-weight: 700;
	background: var(--white); border: 3px solid var(--ink); border-radius: 999px;
}
#starBtn .st { color: #ffb800; -webkit-text-stroke: 1.5px var(--ink); font-size: 24px; line-height: 1; }
#shelfBtn {
	display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 2px 16px 2px 8px; font-size: 17px; font-weight: 600;
	background: var(--white); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink);
}
#shelfBtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
#shelfBtn .jr { width: 34px; height: 42px; display: block; }
#shelfBtn svg { width: 100%; height: 100%; display: block; }

/* the one instruction for right now */
#guide {
	justify-self: center; display: flex; align-items: center; gap: 10px; margin: 30px 16px 10px; padding: 6px 18px 6px 6px; min-height: 48px;
	background: var(--white); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 4px 0 var(--ink); font-size: 20px; font-weight: 600; z-index: 2;
}
#guide .num { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--pinkD); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 21px; }
#guide b { color: var(--pinkD); }
#guide .meter { flex: none; width: 110px; height: 14px; border: 2.5px solid var(--ink); border-radius: 99px; overflow: hidden; background: #eaf3f7; }
#guide .meter i { display: block; height: 100%; background: var(--limeD); transition: width .2s; }
#guide.nudge { animation: nudge .5s; }
@keyframes nudge { 20% { transform: translateX(-8px) } 40% { transform: translateX(8px) } 60% { transform: translateX(-5px) } 80% { transform: translateX(4px) } }

#mid { display: grid; grid-template-columns: minmax(230px, 290px) minmax(0, 1fr) minmax(300px, 340px); gap: 14px; padding: 0 14px 14px; min-height: 0; }

/* the customer */
#who { display: flex; flex-direction: column; min-height: 0; padding-left: 50px; }
#bubble {
	position: relative; background: var(--white); border: 3px solid var(--ink); border-radius: 20px; padding: 12px 14px; font-size: 18px; line-height: 1.3;
	margin-left: -50px; box-shadow: 0 4px 0 var(--ink); min-height: 56px;
}
#bubble b { color: var(--pinkD); font-weight: 700; }
#bubble::after { content: ''; position: absolute; left: 120px; bottom: -14px; width: 22px; height: 22px; background: var(--white); border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg) skew(8deg, 8deg); }
#bubble.in { animation: pop .25s; }
@keyframes pop { from { transform: scale(.92); opacity: .4 } to { transform: none; opacity: 1 } }
#critter { flex: 1 1 0; min-height: 90px; display: flex; align-items: flex-end; justify-content: center; margin-top: 12px; }
#critter svg { height: 100%; max-height: 300px; width: auto; max-width: 100%; display: block; }
#who.walk #critter { animation: walk .5s cubic-bezier(.2, 1.3, .5, 1); }
@keyframes walk { from { transform: translateX(-130%) rotate(-8deg) } to { transform: none } }
#nameTag { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; margin-top: -3px; padding: 7px 10px; background: var(--yel); border: 3px solid var(--ink); border-radius: 14px; font-size: 16px; font-weight: 600; position: relative; }
#nameTag:empty { display: none; }
#nameTag .tn { width: 100%; text-align: center; font-size: 14px; opacity: .8; }
#nameTag .tc { display: inline-flex; align-items: center; gap: 5px; background: #fff; border: 2px solid var(--ink); border-radius: 99px; padding: 2px 10px 2px 4px; }
#nameTag .tc:last-child { padding-left: 10px; }
#nameTag .tc i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink); }
#app[data-mode="free"] #who { display: none; }
#app[data-mode="free"] #mid { grid-template-columns: minmax(0, 1fr) minmax(300px, 340px); padding-left: 76px; }

/* the table */
#stage { position: relative; min-height: 0; background: var(--cream); border: 3px solid var(--ink); border-radius: 26px; box-shadow: 0 5px 0 var(--ink); overflow: hidden;
	background-image: linear-gradient(rgba(20, 50, 74, .05) 2px, transparent 2px), linear-gradient(90deg, rgba(20, 50, 74, .05) 2px, transparent 2px); background-size: 44px 44px; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* the tray */
#tray { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.trayMake, .trayPlay { background: var(--white); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 5px 0 var(--ink); padding: 10px 12px 12px; }
.trayPlay { display: none; font-size: 18px; line-height: 1.35; }
.trayPlay p { margin: 4px 0; }
#app[data-stage="play"] .trayMake, #app[data-stage="done"] .trayMake { display: none; }
#app[data-stage="play"] .trayPlay, #app[data-stage="done"] .trayPlay { display: block; }
.th { margin: 0 0 6px; font-size: 16px; font-weight: 600; opacity: .75; }
#bottles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.bottle { border: 0; background: transparent; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 0; font-size: 14px; font-weight: 600; min-height: 44px; }
.bottle svg { width: 100%; max-width: 72px; height: auto; display: block; transform-origin: 50% 90%; }
.bottle:active svg { transform: scale(.94, .9) rotate(-6deg); }
.bottle.sq svg { animation: sq .32s; }
@keyframes sq { 30% { transform: scale(.8, 1.08) rotate(-14deg) } 70% { transform: scale(1.06, .95) } }
#addins { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.addin { border: 2.5px solid var(--ink); border-radius: 14px; background: #eafbfd; padding: 2px 0 4px; display: flex; flex-direction: column; align-items: center; font-size: 11.5px; font-weight: 600; line-height: 1.05; min-height: 62px; box-shadow: 0 3px 0 var(--ink); }
.addin canvas { width: 40px; height: 40px; display: block; }
.addin span { min-height: 24px; display: grid; place-items: center; text-align: center; padding: 0 2px; }
.addin:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.addin.sq { animation: sq .32s; }
.addin.locked { background: #eef1f4; box-shadow: none; border-style: dashed; }
.addin.locked canvas { opacity: .32; filter: grayscale(1); }
.addin.locked span { font-size: 14px; }
.addin.no { animation: nudge .4s; }
.glow { animation: glow 1s infinite; border-radius: 14px; }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 184, 0, 0), 0 3px 0 var(--ink) } 50% { box-shadow: 0 0 0 7px rgba(255, 184, 0, .85), 0 3px 0 var(--ink) } }

#actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
#actions .row { display: flex; gap: 10px; }
#actions .row .btn { flex: 1; }
.btn { min-height: 48px; padding: 6px 14px; font-size: 17px; font-weight: 600; background: var(--white); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.big { min-height: 58px; font-size: 22px; font-weight: 700; background: var(--lime); }
.btn.big.wait { background: #e3e8ec; color: rgba(20, 50, 74, .55); }
.btn.big.go { animation: go 1.4s infinite; }
@keyframes go { 50% { transform: scale(1.03) } }

.drop { position: fixed; z-index: 50; width: 26px; height: 26px; border-radius: 50% 50% 50% 4px; border: 3px solid var(--ink); pointer-events: none; transform: translate(-50%, -50%); }

/* cards on top */
.veil { position: fixed; inset: 0; z-index: 100; background: rgba(20, 50, 74, .55); display: grid; place-items: center; padding: 16px; }
.veil[hidden] { display: none; }
.card { background: var(--white); border: 3px solid var(--ink); border-radius: 26px; box-shadow: 0 7px 0 var(--ink); padding: 18px 22px 20px; width: min(520px, 100%); max-height: 100%; overflow: auto; text-align: center; animation: pop .25s; }
.card .btn { margin-top: 10px; min-width: 200px; }
.res { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 150px; }
.res.one { height: 130px; }
.resWho { height: 150px; width: 130px; }
.resWho svg { height: 100%; width: 100%; }
.resJar { height: 96px; width: 78px; animation: hop .6s .2s both; }
.res.one .resJar { height: 124px; width: 100px; }
.resJar svg { width: 100%; height: 100%; }
@keyframes hop { from { transform: translateY(-60px) scale(.6); opacity: 0 } 60% { transform: translateY(6px) } to { transform: none; opacity: 1 } }
.resSay { margin: 8px 0 2px; font-size: 21px; font-weight: 600; }
.resName { margin: 0 0 8px; font-size: 17px; font-weight: 600; color: var(--pinkD); }
.rows { list-style: none; margin: 0 auto; padding: 0; display: grid; gap: 6px; text-align: left; max-width: 430px; }
.rows li { display: flex; align-items: center; gap: 10px; font-size: 17px; line-height: 1.25; padding: 6px 12px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fffbe0; animation: rowIn .3s var(--d) both; }
.rows li.miss { background: #f1f4f6; }
.rows .st { flex: none; font-size: 30px; line-height: 1; color: #ffb800; -webkit-text-stroke: 1.5px var(--ink); }
.rows li.miss .st { color: #fff; }
@keyframes rowIn { from { transform: scale(.8); opacity: 0 } to { transform: none; opacity: 1 } }
.uT { margin: 0 0 6px; font-size: 28px; font-weight: 700; }
.uP { margin: 6px 0; font-size: 18px; line-height: 1.3; }
.uRow { display: flex; justify-content: center; gap: 18px; }
.uOne { display: grid; justify-items: center; font-size: 19px; }
.uIc { width: 110px; height: 110px; background: #eafbfd; border: 3px solid var(--ink); border-radius: 22px; margin-bottom: 6px; }
.card.shelfCard { width: min(760px, 100%); }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin: 10px 0; padding: 12px 10px; background: #ffe9c7; border: 3px solid var(--ink); border-radius: 18px; }
.jar { border: 0; background: transparent; padding: 0; display: grid; justify-items: center; font-size: 13px; font-weight: 600; line-height: 1.1; min-height: 44px; }
.jar svg { width: 72px; height: 89px; display: block; }
.jar:active svg { transform: scale(.94); }

/* her iPad on its side with Safari's bars: keep it all on one screen */
@media (max-height: 720px) and (orientation: landscape) {
	#top { min-height: 58px; padding-top: 5px; padding-bottom: 5px; }
	#title { font-size: 26px; }
	#guide { margin-top: 26px; margin-bottom: 8px; min-height: 44px; font-size: 18px; }
	#guide .num { width: 32px; height: 32px; font-size: 19px; }
	.bottle svg { max-width: 62px; }
	.addin { min-height: 58px; }
	.addin canvas { width: 34px; height: 34px; }
	.btn.big { min-height: 52px; font-size: 20px; }
	#tray { gap: 8px; }
	.trayMake { padding: 8px 10px 10px; }
	#bottles { margin-bottom: 6px; }
	#bubble { font-size: 16.5px; padding: 10px 12px; }
}

/* a small laptop window or a small tablet on its side: thinner side columns, the table keeps the middle */
@media (max-width: 1040px) and (orientation: landscape) and (min-width: 761px) {
	#mid { grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(250px, 280px); gap: 10px; }
	#app[data-mode="free"] #mid { grid-template-columns: minmax(0, 1fr) minmax(250px, 280px); }
	#bubble { font-size: 15.5px; }
	.bottle svg { max-width: 50px; }
	.addin { font-size: 10.5px; }
}

/* upright, and phones: customer on top, table, tray */
@media (orientation: portrait), (max-width: 760px) {
	#app { grid-template-rows: auto auto minmax(0, 1fr); }
	#top { flex-wrap: wrap; gap: 6px 8px; padding: 6px 64px; min-height: 56px; justify-content: center; }
	#title { font-size: 24px; width: 100%; text-align: center; }
	#modes { margin-left: 0; }
	.mode { padding: 0 12px; font-size: 15px; }
	#starBtn { margin-left: 0; min-height: 44px; font-size: 18px; padding: 0 12px; }
	#shelfBtn { min-height: 44px; padding: 0 10px 0 4px; font-size: 15px; }
	#shelfBtn .jr { width: 26px; height: 32px; }
	#guide { margin: 26px 10px 8px; font-size: 16px; min-height: 44px; padding-right: 12px; }
	#guide .num { width: 30px; height: 30px; font-size: 18px; }
	#guide .meter { width: 60px; }
	#mid, #app[data-mode="free"] #mid { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; padding: 0 10px 10px; }
	#who { flex-direction: row; align-items: center; gap: 10px; padding-left: 0; display: grid; grid-template-columns: 76px minmax(0, 1fr); grid-template-areas: 'c b' 'c t'; }
	#critter { grid-area: c; margin: 0; height: 92px; min-height: 0; flex: none; }
	#critter svg { max-height: 92px; }
	#bubble { grid-area: b; margin: 0; font-size: 15px; padding: 7px 10px; min-height: 0; box-shadow: 0 3px 0 var(--ink); }
	#bubble::after { left: -10px; bottom: auto; top: 16px; width: 16px; height: 16px; border: 0; border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg); }
	#nameTag { grid-area: t; margin: 0; padding: 3px 8px; font-size: 14px; justify-content: flex-start; border-radius: 12px; }
	#nameTag .tn { width: auto; }
	#tray { padding-left: 58px; gap: 8px; }
	.trayMake { padding: 6px 8px 8px; }
	.th { display: none; }
	#bottles { margin-bottom: 6px; }
	.bottle svg { max-width: 44px; }
	.bottle span { font-size: 12px; }
	#addins { grid-template-columns: repeat(8, minmax(46px, 1fr)); overflow-x: auto; }
	.addin { min-height: 54px; font-size: 10px; }
	.addin canvas { width: 30px; height: 30px; }
	.addin span { min-height: 20px; }
	#actions { flex-direction: row; flex-wrap: wrap; gap: 8px; }
	#actions .btn.big { flex: 1 1 100%; min-height: 50px; font-size: 19px; }
	#actions .row { flex: 1 1 100%; gap: 8px; }
	.btn { font-size: 15px; min-height: 44px; }
	.trayPlay { font-size: 15px; padding: 6px 10px; }
}
@media (orientation: portrait) and (min-width: 700px) {
	#title { width: auto; font-size: 30px; }
	#top { justify-content: flex-start; padding: 8px 72px; }
	#starBtn { margin-left: auto; }
	#who { grid-template-columns: 130px minmax(0, 1fr); }
	#critter, #critter svg { height: 150px; max-height: 150px; }
	#bubble { font-size: 19px; }
	#nameTag { font-size: 16px; }
	#guide { font-size: 20px; }
	.bottle svg { max-width: 64px; }
	.addin canvas { width: 40px; height: 40px; }
	.addin { font-size: 12px; min-height: 66px; }
	.btn { font-size: 17px; min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) { .btn.big.go, .glow { animation: none; } }

/* phones: two header rows, one row of buttons, so the table keeps most of the screen */
@media (max-width: 560px) {
	/* row 1 is the title between the two corner buttons; row 2 starts below them and keeps clear of the "?" */
	#top { padding: 4px 62px 6px 10px; justify-content: flex-start; }
	#title { font-size: 22px; line-height: 52px; flex: 0 0 calc(100% - 84px); width: auto; margin: 0 32px 0 52px; }
	/* bottles and fun stuff share one row; the fun stuff scrolls sideways */
	.trayMake { display: flex; align-items: center; gap: 8px; padding: 6px 8px; }
	#bottles { flex: none; grid-template-columns: repeat(4, 44px); gap: 2px; margin: 0; }
	#addins { flex: 1 1 0; min-width: 0; display: flex; gap: 6px; padding-bottom: 4px; }
	.addin { flex: none; width: 50px; }
	#guide { min-height: 40px; margin-bottom: 6px; }
	#shelfBtn .lbl { display: none; }
	#shelfBtn { padding: 0 8px; }
	#guide { font-size: 15px; margin-top: 24px; }
	#who { grid-template-columns: 62px minmax(0, 1fr); }
	#critter, #critter svg { height: 76px; max-height: 76px; }
	#bubble { font-size: 14px; }
	.bottle span { display: none; }
	.bottle svg { max-width: 40px; }
	#actions { flex-wrap: nowrap; }
	#actions .btn.big { flex: 2 1 0; font-size: 16px; padding: 4px 6px; min-height: 48px; }
	#actions .row { flex: 2 1 0; gap: 6px; }
	#actions .row .btn { font-size: 13px; padding: 4px; line-height: 1.1; }
	#app[data-stage="play"] #actions .row { flex: 1 1 0; }
	.trayPlay { display: none !important; }
}
