:root {
  --ink: #2b2118;
  --card: #ffffff;
  --yum: #1f9d55;
  --nope: #d64545;
  --star: #ffb400;
  --star-off: #ece3d6;
  --accent: #ff6b3d;
  --candy: #ff5fa8;
  --candy-soft: #ffe3f1;
  --card-shade: #e8ddcf;  /* stars pressed into the card */
  --shadow: 0 12px 30px rgba(70, 45, 20, .22);
  /* Bench: a bright, matte paper-like surface with a fine speckle. */
  --speckle: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .35  0 0 0 0 .25  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  color: var(--ink); background: #f6eee2;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, sans-serif;
  overscroll-behavior: none; overflow: hidden;
  -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }

#bench {
  height: 100%; display: flex; justify-content: center; align-items: center;
  background: var(--speckle), radial-gradient(120% 90% at 30% 10%, #fffdf8, #f6eee2 60%, #efe4d4);
}
#app {
  width: 100%; max-width: 480px; height: 100%;
  display: flex; flex-direction: column; position: relative;
  padding-block: max(10px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 700px) {
  #app { max-width: 640px; max-height: 1000px; font-size: 1.2rem; }
}

/* What you're doing, always on top, sitting above everything else */
#top { display: flex; flex-direction: column; align-items: center; gap: 10px; position: relative; z-index: 10; }
#title {
  margin: 0; padding: 8px 20px; border-radius: 16px;
  background: var(--ink); color: #fff; font-size: 1.25em; font-weight: 900; letter-spacing: .01em;
  box-shadow: 0 6px 0 rgba(0,0,0,.15), 0 10px 20px rgba(0,0,0,.15); transform: rotate(-1.5deg);
  transition: font-size .5s cubic-bezier(.34,1.56,.64,1), padding .5s cubic-bezier(.34,1.56,.64,1), margin .5s;
  text-align: center; text-wrap: balance;
}
#title span { color: #ffc94d; }
/* Onboarding: the name is big, then shrinks up to the top for the rest */
.onboarding #title { font-size: 2.2em; padding: 14px 26px; margin-top: 4vh; line-height: 1.05; }
.onboarding #title span { display: block; }

/* Dinners / Treats: one sliding switch. The pill turns to candy on its way over. */
.switch {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; width: min(280px, 100%);
  background: var(--card-shade); border-radius: 999px; padding: 4px; touch-action: none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.12);
}
.switch[hidden] { display: none; }
.pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px;
  background: var(--card); box-shadow: 0 2px 6px rgba(0,0,0,.18); overflow: hidden;
  transition: transform .5s cubic-bezier(.34,1.56,.64,1);
}
.pill::after {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .45s;
  background: repeating-linear-gradient(-45deg, var(--candy) 0 10px, #ff8cc4 10px 20px);
}
.switch.to-treats .pill { transform: translateX(100%); }
.switch.to-treats .pill::after { opacity: 1; }
.tab {
  position: relative; z-index: 1; border: 0; background: none; padding: 9px 0; border-radius: 999px;
  font-weight: 900; font-size: 1.05em; transition: color .3s;
}
.tab.on { color: var(--ink); }
.switch.to-treats .tab.treats { color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.switch:not(.to-treats) .tab.treats { color: var(--candy); }

#confetti { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

#stage { position: relative; z-index: 1; flex: 1; margin: 16px 4px 38px; min-height: 0; }

/* Card stack */
.card {
  position: absolute; inset: 0;
  background: var(--card); border-radius: 28px; box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column;
  touch-action: none; will-change: transform;
}
.card.top { z-index: 3; }
.card.desserts { background: #fffafd; box-shadow: 0 0 0 6px var(--candy), var(--shadow); }

.photo { position: relative; flex: 1; min-height: 120px; background: #f3e6d6 center/cover no-repeat; cursor: pointer; }
.photo .ph {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 5rem; background: linear-gradient(135deg, #ffe2b8, #ffc4a3);
}
.desserts .photo .ph { background: linear-gradient(135deg, #ffd6ec, #ffc0de); }
.photo.playing::after {
  content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 6px var(--accent);
  animation: glow 1s ease-in-out infinite alternate;
}
@keyframes glow { from { opacity: .4; } to { opacity: 1; } }

.body { flex: none; padding: 20px 20px 26px; display: flex; flex-direction: column; }
.name { margin: 0; font-size: 2.1em; line-height: 1.05; font-weight: 900; letter-spacing: -.01em; cursor: pointer; }
.desc { margin: 16px 0 0; font-size: 1.1em; line-height: 1.4; opacity: .85; min-height: calc(1.4em * 3); }

/* Stars are pressed into the card, part of its surface */
.stars { display: flex; justify-content: center; gap: 6px; margin-top: 14px; touch-action: none; }
.star {
  border: 0; background: none; padding: 2px; font-size: 3rem; line-height: 1; color: var(--card-shade);
  text-shadow: 0 1.5px 0 rgba(255,255,255,.95), 0 -1px 0 rgba(90,60,30,.22);
}
.star.on { color: var(--star); text-shadow: 0 1.5px 0 rgba(255,255,255,.7), 0 -1px 0 rgba(150,90,0,.45); }
@media (min-width: 700px) { .star { font-size: 3.8rem; } }

/* YUM / NOPE stamps */
.stamp {
  position: absolute; top: 18px; right: 14px; z-index: 2;
  font-weight: 900; font-size: 2.2em; letter-spacing: .06em; padding: 2px 14px;
  border: 5px solid currentColor; border-radius: 12px; background: rgba(255,255,255,.88);
  transform: rotate(14deg) scale(0); opacity: 0;
}
.stamp.yum { color: var(--yum); }
.stamp.nope { color: var(--nope); }
.stamp.show { opacity: 1; }

/* Other kids' stickers: bold, stamp-style, stacked on the photo */
.stickers {
  position: absolute; left: 12px; bottom: 12px; z-index: 2;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
}
.sticker {
  font-weight: 900; font-size: 1.35em; letter-spacing: .02em; line-height: 1.1;
  padding: 6px 14px; border-radius: 12px; background: rgba(255,255,255,.95);
  border: 4px solid var(--kid, var(--accent)); color: var(--kid, var(--accent)); box-shadow: 0 4px 10px rgba(0,0,0,.2);
  display: inline-flex; align-items: center; gap: 6px;
}
.sticker b { font-size: 1.15em; line-height: 1; }
.sticker:nth-child(2) { margin-left: 10px; }
.sticker:nth-child(3) { margin-left: 4px; }
.sticker:nth-child(4) { margin-left: 12px; }

/* Who's playing, at the bottom */
#who {
  align-self: center; position: relative; z-index: 1; margin-top: 4px; font-weight: 900; font-size: 1.1em; padding: 6px 18px; border-radius: 999px;
  background: var(--card); box-shadow: 0 3px 8px rgba(0,0,0,.1);
}
.hint { position: absolute; left: 0; right: 0; bottom: -30px; text-align: center; font-weight: 800; opacity: .55; font-size: .9em; }

/* Welcome, loading and done screens */
.screen {
  position: absolute; inset: 0; background: var(--card); border-radius: 28px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 28px; gap: 14px; transform: rotate(-1deg);
}
.screen h2 { margin: 0; font-size: 2.1em; line-height: 1.1; font-weight: 900; }
.screen p { margin: 0; font-size: 1.15em; line-height: 1.4; opacity: .85; }
.big { border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 900; font-size: 1.3em; padding: 14px 30px; box-shadow: 0 5px 0 #c94a22; }
.big:active { transform: translateY(3px); box-shadow: 0 2px 0 #c94a22; }
.big.candy { background: repeating-linear-gradient(-45deg, var(--candy) 0 12px, #ff8cc4 12px 24px); box-shadow: 0 5px 0 #b8296c; }
.plain { border: 0; background: none; font-weight: 800; text-decoration: underline; opacity: .7; }
.chef { font-size: 4.5rem; transform: rotate(-8deg); }
.bar { width: 80%; height: 14px; background: #f1e6d8; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* Twins' lighter mode: same look, calmer springs (set in motion.js), one less card behind */
.light .card.behind2 { display: none; }

/* Motion levers panel (preview only) */
#tune { position: fixed; right: max(12px, env(safe-area-inset-right, 0px)); bottom: max(12px, env(safe-area-inset-bottom, 0px)); z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#tune-open { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-size: 1.4rem; box-shadow: 0 4px 12px rgba(0,0,0,.25); order: 2; }
#tune-box { order: 1; width: min(300px, calc(100vw - 32px)); max-height: 70vh; overflow: auto; background: #fff; color: var(--ink); border-radius: 18px; padding: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: grid; gap: 6px; font-size: 15px; }
#tune-box[hidden] { display: none; }
.tune-head { display: flex; justify-content: space-between; align-items: center; }
.tune-head button { border: 0; background: none; font-size: 1.5rem; line-height: 1; }
.tune-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.tune-presets button, #tune-try, #tune-copy { border: 2px solid var(--ink); background: #fff; border-radius: 999px; padding: 5px 12px; font-weight: 800; }
#tune-try { background: var(--accent); color: #fff; border-color: var(--accent); margin-top: 6px; }
#tune label { display: flex; justify-content: space-between; font-weight: 700; margin-top: 4px; }
#tune input[type=range] { width: 100%; accent-color: var(--accent); }
#tune output { font-variant-numeric: tabular-nums; opacity: .7; }
#tune pre { margin: 0; font-size: 11px; white-space: pre-wrap; word-break: break-all; opacity: .6; user-select: text; -webkit-user-select: text; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
