@font-face {
  font-family: 'Fredoka';
  src: url('../fonts/Fredoka.ttf') format('truetype');
  font-weight: 300 700;
  font-display: block;
}

:root {
  --ink: #4a3a55;
  --bg: #ffe7c2;
  --paper: #fffaf1;
  --pink: #ff7eb6;
  --pink-d: #e8589a;
  --pink-l: #ffe1ef;
  --yellow: #ffd35c;
  --teal: #43c6ac;
  --green: #63c974;
  --wood: #e2a56d;
  --wood-d: #bf7d47;
  --mat: #64bb86;
  --sh: 0 4px 0 rgba(74, 58, 85, .28);
  --sh-press: 0 1px 0 rgba(74, 58, 85, .28);
  /* A soft light along the top of buttons. */
  --lift: inset 0 3px 0 rgba(255, 255, 255, .4);
  --lettering: 0 2px 0 rgba(74, 58, 85, .35);
  --top: 58px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  font-weight: 600;
  color: var(--ink);
  background: radial-gradient(circle, rgba(255, 255, 255, .55) 3px, transparent 3.5px) 0 0 / 30px 30px, var(--bg);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
svg { display: block; overflow: visible; }
h1, h2, h3 { font-weight: 700; }

#app { position: relative; height: 100%; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- top bar */
#topbar { flex: none; height: var(--top); display: flex; align-items: center; gap: 6px; padding: 8px 8px 4px; }
#wallet { flex: 1; min-width: 0; display: flex; gap: 5px; }
.pill {
  flex: 1 1 auto; min-width: 0; height: 42px; display: flex; align-items: center; gap: 2px; padding: 0 8px 0 3px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; box-shadow: var(--sh);
  font-size: 19px; font-weight: 700;
}
.pill svg { width: 30px; height: 30px; flex: none; }
.pill b { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.bump { animation: bump .35s; }
.icon-btn { flex: none; width: 44px; height: 44px; padding: 3px; border-radius: 50%; border: 3px solid var(--ink); background: var(--paper); box-shadow: var(--sh); }
/* Back to the island, from anywhere. The island itself is the menu, so it isn't needed there; settings live on the island instead. */
.icon-btn.home-btn { width: 50px; height: 50px; padding: 2px; background: #c9f0ff; box-shadow: var(--lift), var(--sh); }
body[data-screen="explore"] .home-btn, body:not([data-screen="explore"]) #btnSettings { display: none; }

#screen { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.scr { height: 100%; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- buttons & cards */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px; padding: 8px 18px;
  border: 3px solid var(--ink); border-radius: 18px; background: #fff; box-shadow: var(--lift), var(--sh);
  font-size: 20px; font-weight: 700; transition: transform .08s;
}
.btn:active:not([disabled]) { transform: translateY(3px); box-shadow: var(--lift), var(--sh-press); }
.btn[disabled] { opacity: .5; }
.btn svg { width: 34px; height: 34px; }
.btn.pink { background: var(--pink); color: #fff; text-shadow: var(--lettering); }
.btn.big { font-size: 24px; min-height: 60px; }
.btn.huge { font-size: 30px; min-height: 74px; padding: 10px 36px; border-radius: 26px; }

.card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; text-align: center;
  border: 3px solid var(--ink); border-radius: 18px; background: #fff; box-shadow: var(--sh);
}
.card:active { transform: translateY(2px); box-shadow: var(--sh-press); }
.card > svg, .card-art, .card-art svg { width: 72px; height: 72px; }
.card span { font-size: 14px; line-height: 1.1; }
.grid {
  flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); grid-auto-rows: max-content;
  gap: 10px; padding: 8px 10px 18px; align-content: start;
}
.tabs { flex: none; display: flex; gap: 6px; padding: 8px 10px 4px; }
.tab-btn {
  flex: none; width: 68px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 2px;
  border: 3px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: var(--sh); font-size: 12.5px;
}
.tab-btn svg { width: 40px; height: 40px; }
.tab-btn.on { background: var(--yellow); }
.tab-btn.wide { flex: 1; width: auto; font-size: 15px; }
.tab-btn.wide svg { width: 34px; height: 34px; }
.ghost { opacity: .3; filter: grayscale(1); }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.row .btn { flex: 1; min-width: 110px; }
.empty-note { grid-column: 1 / -1; background: #fff; border: 3px dashed rgba(74, 58, 85, .45); border-radius: 18px; padding: 16px; text-align: center; font-size: 18px; }

.price { display: inline-flex; align-items: center; gap: 2px; padding: 1px 9px 1px 2px; background: #fff7d6; border: 2px solid var(--ink); border-radius: 999px; font-size: 16px; }
.price svg { width: 24px; height: 24px; }
.chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 10px 2px 3px; background: #fff; border: 3px solid var(--ink); border-radius: 999px; font-size: 19px; }
.chip svg { width: 28px; height: 28px; }

.ings { display: flex; align-items: center; justify-content: center; gap: 2px; flex-wrap: wrap; }
.ings i, .tip i { font-style: normal; font-size: 14px; opacity: .6; }
.ing { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ing svg { width: 100%; height: 100%; }
.ing.q { border: 2px dashed rgba(74, 58, 85, .45); border-radius: 50%; font-size: 16px; width: 26px; height: 26px; }
.ing.locked { opacity: .45; }
.ing { position: relative; }
.ing .where { position: absolute; right: -7px; bottom: -6px; width: 17px; height: 17px; padding: 1px; background: #fff; border: 1.5px solid var(--ink); border-radius: 50%; }
.ing .where svg { width: 100%; height: 100%; }

/* ---------------------------------------------------------------- craft table */
.table-top { flex: none; height: 134px; display: flex; gap: 6px; padding: 6px 10px 0; }
.me-mini { flex: none; width: 82px; padding: 0; border: 0; background: none; }
.me-mini svg { width: 100%; height: 100%; }
.order { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; position: relative; }
.cust { flex: none; width: 56px; height: 56px; animation: bob 2.4s ease-in-out infinite; }
.cust svg { width: 100%; height: 100%; }
.bubble { flex: 1; min-width: 0; position: relative; padding: 5px 8px 6px; background: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: var(--sh); }
.bubble::before { content: ''; position: absolute; left: -13px; top: 24px; border: 7px solid transparent; border-right: 9px solid var(--ink); }
.bubble-text { font-size: 13px; opacity: .75; padding-right: 22px; }
.bubble-main { display: flex; align-items: center; gap: 6px; font-size: 17px; line-height: 1.05; }
.req { flex: none; width: 46px; height: 46px; }
.req svg { width: 100%; height: 100%; }
.req.mystery svg { filter: brightness(0) opacity(.35); }
.bubble .ings { justify-content: flex-start; margin-top: 2px; }
.bubble .ing { width: 26px; height: 26px; }
.bubble .ing.q { width: 22px; height: 22px; font-size: 13px; }
.go-sew { display: inline-flex; align-items: center; gap: 2px; margin-top: 3px; padding: 1px 10px 1px 2px; border: 2px solid var(--ink); border-radius: 999px; background: #d9fff6; font-size: 14px; }
.go-sew svg { width: 24px; height: 24px; }
.skip { position: absolute; right: -6px; top: -2px; width: 34px; height: 34px; padding: 2px; border-radius: 50%; border: 3px solid var(--ink); background: var(--paper); }

.mat {
  flex: none; position: relative; margin: 8px 10px 0; padding: 14px 12px 12px;
  border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 7px 0 var(--wood-d);
  background:
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(255, 255, 255, .2) 22px 24px),
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255, 255, 255, .2) 22px 24px),
    var(--mat);
}
.slots { display: flex; align-items: center; justify-content: center; gap: 4px; }
.slot { width: 84px; height: 84px; flex: none; display: flex; align-items: center; justify-content: center; padding: 8px; border-radius: 50%; }
.slot.empty { border: 3px dashed rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .15); }
.slot.full { border: 3px solid var(--ink); background: #fff; box-shadow: var(--sh); transition: transform .35s ease-in, opacity .35s; }
.slot.full svg { width: 100%; height: 100%; }
.slot.pop { animation: popin .35s cubic-bezier(.3, 1.6, .6, 1); }
.plus { color: #fff; font-size: 28px; text-shadow: var(--lettering); }
.pots { display: flex; justify-content: center; gap: 4px; margin-top: 10px; }
.pot { width: 44px; height: 44px; flex: 0 1 44px; min-width: 30px; padding: 1px; border: 0; background: none; border-radius: 50%; transition: transform .15s; }
.pot svg { width: 100%; height: 100%; }
.pot.on { background: #fff; box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--yellow); transform: translateY(-2px) scale(1.12); }
.pot.more { padding: 5px; background: #fff3c4; border: 3px dashed rgba(74, 58, 85, .5); }
.craft-btn { display: flex; width: 100%; margin-top: 12px; background: var(--yellow); font-size: 25px; }
.craft-btn[disabled] { font-size: 19px; opacity: .8; background: #fff3cf; }
.mat.crafting .slot.full { animation: shake .22s infinite; }
.mat.merge .slot.full { animation: none; transform: scale(.1) rotate(200deg); opacity: 0; }
.poof {
  position: absolute; left: 50%; top: 56px; width: 150px; height: 150px; margin: -75px 0 0 -75px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fff 0 25%, rgba(255, 255, 255, .7) 45%, rgba(255, 216, 77, .5) 60%, transparent 70%);
  animation: poof .5s ease-out forwards;
}
.mat-msg { position: absolute; left: 6px; right: 6px; top: 100%; margin-top: 12px; z-index: 5; opacity: 0; pointer-events: none; transition: opacity .2s; }
.mat-msg.show { opacity: 1; pointer-events: auto; }
.miss { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: var(--sh); font-size: 17px; animation: popin .3s; }
.miss > svg { flex: none; width: 58px; height: 58px; animation: wobble 1s infinite; }
.tip { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 15px; }

.tray {
  flex: 1; min-height: 0; overflow-y: auto; padding: 12px 10px 18px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); grid-auto-rows: max-content; gap: 8px; align-content: start;
  background: linear-gradient(var(--wood), #d9975d); border-top: 3px solid var(--ink);
}
.tray-tabs { flex: none; display: flex; gap: 6px; margin-top: 12px; padding: 0 12px; position: relative; z-index: 1; }
.tray-tab { display: flex; align-items: center; gap: 4px; padding: 3px 14px 3px 5px; border: 3px solid var(--ink); border-bottom: 0; border-radius: 16px 16px 0 0; background: #e3b47f; font-size: 16px; }
.tray-tab svg { width: 30px; height: 30px; }
.tray-tab.on { background: var(--wood); padding-bottom: 6px; margin-bottom: -3px; }
.bit { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 98px; padding: 6px 3px 5px; border: 3px solid var(--ink); border-radius: 18px; background: var(--paper); box-shadow: var(--sh); }
.bit svg { width: 58px; height: 58px; }
.bit span { font-size: 13px; line-height: 1.05; text-align: center; }
.bit.on { background: var(--pink-l); transform: translateY(2px); box-shadow: var(--sh-press); outline: 3px solid var(--pink); outline-offset: -8px; }
.bit.more { background: #fff3c4; }
.bit.more svg { width: 46px; height: 46px; margin: 4px 0 6px; }
.bit.out { background: #dcf7c8; }
.bit.empty { opacity: .5; filter: grayscale(.7); }
.bit.nudge { animation: nudge .6s 2; }
.count { position: absolute; right: 4px; top: 4px; min-width: 26px; height: 26px; padding: 0 6px; display: flex; align-items: center; justify-content: center; background: var(--pink); color: #fff; border: 2.5px solid var(--ink); border-radius: 999px; font-size: 15px; font-style: normal; line-height: 1; }
.bit.empty .count { background: #b9b1c2; }
.slot.empty i { font-size: 30px; font-style: normal; font-weight: 700; color: rgba(255, 255, 255, .85); }
.pot-name { position: absolute; left: 0; right: 0; top: 34px; z-index: 4; text-align: center; font-size: 34px; font-weight: 700; opacity: 0; pointer-events: none;
  text-shadow: 0 3px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink); }
.pot-name.show { animation: potname 1.4s ease-out forwards; }
.lvl { position: absolute; left: 3px; top: 3px; display: flex; pointer-events: none; }
.lvl svg { width: 15px; height: 15px; }
.mix-hint { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 6px; border: 3px dashed var(--ink); border-radius: 18px; background: rgba(255, 255, 255, .55); font-size: 28px; }
.mix-hint span { width: 62px; height: 62px; flex: none; }
.mix-hint svg { width: 100%; height: 100%; }
.mix-hint .q svg { filter: brightness(0) opacity(.3); }
.level-stars { display: flex; justify-content: center; gap: 2px; margin: -6px 0 2px; position: relative; }
.level-stars svg { width: 30px; height: 30px; animation: popin .4s both; }
.level-stars svg:nth-child(2) { animation-delay: .15s; }
.level-stars svg:nth-child(3) { animation-delay: .3s; }

/* How the things on the mat go together, said before Craft is pressed. */
.mat-says {
  position: absolute; left: 50%; top: -15px; z-index: 3; display: flex; align-items: center; gap: 4px; padding: 1px 12px 1px 3px; transform: translateX(-50%);
  background: #fff; border: 3px solid var(--ink); border-radius: 999px; box-shadow: var(--sh); font-size: 15px; white-space: nowrap; animation: popin .3s;
}
.mat-says svg { width: 24px; height: 24px; }
.mat-says.ready { background: #e3fff0; }
.mat-says.more { background: #fff7d6; }
.mat-says.no { background: #ffe3e3; color: #b8323a; }
.says-tag { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; padding: 0 8px; border: 2.5px solid var(--ink); border-radius: 999px; font-size: 13px; font-style: normal; font-weight: 700; }
.says-tag.new { background: var(--pink); color: #fff; animation: wiggle 1s infinite; }
.says-tag.made { padding-left: 1px; background: #fff; }
.mat-says .says-tag svg { width: 22px; height: 22px; }
.slot.full { position: relative; }
.slot.bad { border-color: #e04848; background: #fff0f0; animation: wobble .6s; }
.bad-x, .nogo-x { position: absolute; right: -8px; top: -8px; width: 28px; height: 28px; pointer-events: none; }
.bad-x svg, .nogo-x svg { width: 100%; height: 100%; }
.slot.empty.want { border-color: #fff; background: rgba(255, 255, 255, .35); animation: pulse 1s ease-in-out infinite; }
.craft-btn.go { background: var(--green); color: #fff; text-shadow: var(--lettering); animation: pulse 1.2s ease-in-out infinite; }
.bit.nogo { opacity: .5; }
.bit.nogo > svg { filter: grayscale(.85); }
.bit .nogo-x { right: auto; left: 2px; top: 2px; width: 22px; height: 22px; }
.mode-btn { margin-left: auto; align-self: center; display: flex; align-items: center; gap: 4px; padding: 2px 12px 2px 4px; border: 3px solid var(--ink); border-radius: 999px; background: #efe4ff; box-shadow: var(--sh); font-size: 15px; }
.mode-btn svg { width: 28px; height: 28px; }
.mode-btn.back { background: #fff3c4; }
.mine-btn { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 2px 12px 2px 3px; border: 2.5px solid var(--ink); border-radius: 999px; background: #efe4ff; font-size: 15px; }
.mine-btn svg { width: 26px; height: 26px; }
.spare { position: relative; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; margin-top: 8px; font-size: 15px; }
.spare .ing { width: 30px; height: 30px; }

/* ---------------------------------------------------------------- sewing */
.sew-top { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px 0; }
.machine-wrap { flex: 1.25; min-width: 0; }
.machine-wrap svg { width: 100%; height: auto; }
.machine.stab .needle { animation: stab .16s; }
.preview { flex: 1; min-width: 0; padding: 8px 6px; text-align: center; background: #fff; border: 3px solid var(--ink); border-radius: 20px; box-shadow: var(--sh); }
.preview-art { height: 104px; }
.preview-art svg { width: 100%; height: 100%; }
.preview-name { font-size: 15px; line-height: 1.1; margin-top: 4px; }
.have { font-size: 12.5px; opacity: .7; margin-top: 2px; }
.have.new { opacity: 1; color: var(--pink-d); }
.pickers { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 0; transition: opacity .2s; }
.pick-row { margin: 4px 0; }
.pick-label { padding: 0 12px 2px; font-size: 15px; }
.pick-list { display: flex; gap: 8px; overflow-x: auto; padding: 4px 10px 9px; scrollbar-width: none; }
.pick-list::-webkit-scrollbar { display: none; }
.chip-btn { flex: none; width: 78px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 2px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: var(--sh); }
.chip-btn > svg { width: 54px; height: 54px; }
.chip-btn span { display: flex; align-items: center; min-height: 18px; font-size: 12px; line-height: 1.05; }
.chip-btn span svg { width: 20px; height: 20px; }
.chip-btn.on { background: var(--pink-l); outline: 3px solid var(--pink); outline-offset: -8px; }
.chip-btn.locked { opacity: .55; filter: grayscale(.8); }
.chip-btn { position: relative; }
.chip-btn .count { right: 1px; top: 1px; min-width: 22px; height: 22px; font-size: 13px; }
.chip-btn.out { background: #dcf7c8; }
.preview-art.ghost svg { opacity: .35; }
.sew-go { flex: none; display: flex; justify-content: center; padding: 6px 10px 12px; }
.sew-btn { width: 100%; background: var(--teal); color: #fff; text-shadow: var(--lettering); }
.is-sewing .pickers { opacity: .35; pointer-events: none; }
.pedal-wrap { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pedal-wrap .count-pop { left: 50%; top: -34px; }
.stitch-dots { display: flex; gap: 8px; }
.stitch-dots i { width: 24px; height: 24px; background: #fff; border: 3px solid var(--ink); border-radius: 50%; transition: background .15s, transform .15s; }
.stitch-dots i.on { background: var(--pink); transform: scale(1.15); }
.pedal { width: 170px; height: 74px; border: 3px solid var(--ink); border-radius: 22px 22px 32px 32px; background: #7d5ce0; color: #fff; font-size: 28px; font-weight: 700; box-shadow: 0 8px 0 var(--ink); }
.pedal:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--ink); }
.pedal-hint { font-size: 15px; opacity: .75; }

/* ---------------------------------------------------------------- dress up */
.stage { flex: none; height: 40%; min-height: 190px; display: flex; justify-content: center; align-items: flex-end; padding-top: 4px; background: radial-gradient(ellipse 36% 8% at 50% 93%, rgba(74, 58, 85, .2), transparent); }
.stage svg { height: 100%; width: auto; }
.stage.jump svg { animation: jump .55s; }
.slot-tabs { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 6px 10px 8px; scrollbar-width: none; }
.slot-tabs::-webkit-scrollbar { display: none; }
.wcard.on { background: #e3fff0; outline: 3px solid var(--green); outline-offset: -8px; }
.wcard, .scard .card-art { position: relative; }
.scard .count.pack { right: -10px; top: -6px; background: var(--teal); }
.wcard > svg { width: 72px; height: 72px; }
.me-grid { display: block; }
.me-sec h3 { margin: 4px 4px 6px; font-size: 18px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; padding: 2px 4px 10px; }
.swatch { width: 50px; height: 50px; border-radius: 50%; border: 3px solid var(--ink); box-shadow: var(--sh); }
.swatch.on { outline: 4px solid var(--pink); outline-offset: 2px; }
.hairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; padding: 0 4px 10px; }
.hair-btn { padding: 4px; border: 3px solid var(--ink); border-radius: 18px; background: #fff; box-shadow: var(--sh); }
.hair-btn svg { width: 100%; height: 66px; }
.hair-btn.on { background: var(--pink-l); }

/* ---------------------------------------------------------------- shop & book */
.scard.owned { background: #f1f1f1; }
.scard.owned .card-art { opacity: .55; }
.scard.poor .price { opacity: .6; }
.got { font-style: normal; font-size: 15px; color: #2e9d57; }
.progress { flex: none; padding: 4px 12px 2px; font-size: 17px; }
.bar { height: 16px; margin-top: 3px; overflow: hidden; background: #fff; border: 3px solid var(--ink); border-radius: 999px; }
.bar i { display: block; height: 100%; background: var(--teal); }
.bcard.mystery .card-art svg { filter: brightness(0) opacity(.3); }
.bcard { position: relative; }
.tint-badge { position: absolute; right: 4px; top: 4px; width: 26px; height: 26px; }
.tint-badge svg { width: 100%; height: 100%; }
.cdots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.cdots i { width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: 50%; }
.hint-btn { display: inline-flex; align-items: center; gap: 2px; padding: 1px 4px; border: 2px solid var(--ink); border-radius: 999px; background: #fffbe6; }
.hint-btn > svg { width: 24px; height: 24px; }
.hint-btn .price { border: 0; background: none; padding: 0 4px 0 0; font-size: 14px; }
.hint-btn .price svg { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- pop-ups */
#overlay { position: fixed; inset: 0; z-index: 65; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(74, 58, 85, .5); }
#overlay.show { display: flex; animation: fade .2s; }
.modal {
  position: relative; width: 100%; max-width: 420px; max-height: 100%; overflow-x: hidden; overflow-y: auto; padding: 18px 16px; text-align: center;
  background: var(--paper); border: 4px solid var(--ink); border-radius: 28px; box-shadow: 0 8px 0 rgba(74, 58, 85, .35);
  animation: popin .35s cubic-bezier(.3, 1.5, .6, 1);
}
.modal h2 { margin: 2px 0 10px; font-size: 26px; line-height: 1.1; }
.modal p { font-size: 18px; margin: 6px 0; }
.result { position: relative; }
.rays {
  position: absolute; left: 50%; top: 84px; width: 340px; height: 340px; margin: -170px 0 0 -170px; overflow: hidden; border-radius: 50%; pointer-events: none;
}
/* Only the inside turns: a turning box pokes past the pop-up's edge and brings up a scroll bar. */
.rays::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-conic-gradient(rgba(255, 211, 92, .4) 0 12deg, transparent 12deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 35%, transparent 70%); mask: radial-gradient(circle, #000 35%, transparent 70%);
  animation: spin 14s linear infinite;
}
.result-art { position: relative; width: 160px; height: 160px; margin: 0 auto; animation: popin .5s .1s both cubic-bezier(.3, 1.6, .6, 1); }
.result-art svg { width: 100%; height: 100%; }
.result-sub { position: relative; font-size: 17px; opacity: .8; margin-top: 4px; }
.result h2, .result .chips, .result .row { position: relative; }
.new-badge { position: absolute; z-index: 2; top: 0; right: 0; padding: 2px 10px; background: var(--pink); color: #fff; border: 3px solid var(--ink); border-radius: 12px; font-size: 19px; animation: wiggle 1s infinite; }
.order-done { position: relative; display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 6px 10px; text-align: left; background: #e3fff0; border: 3px solid var(--ink); border-radius: 18px; }
.order-done > svg { flex: none; width: 54px; height: 54px; }
.order-done .chips { justify-content: flex-start; margin-top: 3px; }
.buy-art { width: 130px; height: 130px; margin: 0 auto; }
.buy-art svg { width: 100%; height: 100%; }
.settings-modal .toggles { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; }
.toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; background: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: var(--sh); font-size: 22px; }
.toggle > svg { width: 44px; height: 44px; }
.toggle span { flex: 1; text-align: left; }
.toggle .switch { position: relative; width: 60px; height: 34px; flex: none; background: #d9d2e2; border: 3px solid var(--ink); border-radius: 999px; transition: background .2s; }
.toggle .switch::after { content: ''; position: absolute; left: 2px; top: 2px; width: 24px; height: 24px; background: #fff; border: 2px solid var(--ink); border-radius: 50%; transition: left .2s; }
.toggle.on .switch { background: var(--green); }
.toggle.on .switch::after { left: 28px; }
.grown-ups { margin-bottom: 12px; padding: 10px 12px; text-align: left; background: #fff7d6; border: 3px dashed var(--ink); border-radius: 16px; }
.grown-ups p { font-size: 15px; }
.grown-ups .ver { font-size: 13px; opacity: .6; }
.policy-link { margin: 2px 0 6px; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-size: 15px; font-weight: 700; text-decoration: underline; }
.policy-modal { max-width: 560px; padding: 10px; }
.policy-frame { display: block; width: 100%; height: 64vh; margin-bottom: 10px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; }
.buy-price { display: flex; justify-content: center; margin: 8px 0; }
.buy-price .price { font-size: 22px; padding: 3px 14px 3px 4px; border-width: 3px; }
.buy-price .price svg { width: 32px; height: 32px; }
.need { color: var(--pink-d); }

/* ---------------------------------------------------------------- title screen */
#title { position: fixed; inset: 0; z-index: 60; display: none; overflow: hidden; background: var(--bg); }
/* Soft sun rays turning slowly behind everything, with the usual polka dots over them. */
#title::before { content: ''; position: absolute; left: 50%; top: 42%; width: 260vmax; height: 260vmax; margin: -130vmax 0 0 -130vmax;
  background: repeating-conic-gradient(#ffe2b5 0deg, #fff3dc 9deg, #ffe2b5 18deg); animation: spin 120s linear infinite; }
#title::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .6) 3px, transparent 3.5px) 0 0 / 30px 30px; }
#title > * { z-index: 1; }
#title.show { display: flex; }
#title.hide { animation: fade .45s reverse forwards; }
.title-inner { position: relative; margin: auto; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px; }
.logo { margin: 0; font-size: 60px; line-height: 1; color: var(--pink); -webkit-text-stroke: 3px var(--ink); text-shadow: 0 5px 0 var(--ink); transform: rotate(-3deg); white-space: nowrap; }
.logo span { color: var(--yellow); }
.sub { padding: 2px 18px; font-size: 24px; color: #fff; background: var(--teal); border: 3px solid var(--ink); border-radius: 999px; box-shadow: var(--sh); transform: rotate(2deg); }
.title-char { height: min(38vh, 300px); margin: 8px 0 14px; animation: bob 2.6s ease-in-out infinite; }
.title-char svg { height: 100%; width: auto; }
.floaters { position: absolute; inset: 0; pointer-events: none; }
.floater { position: absolute; width: 62px; height: 62px; animation: float 5s ease-in-out infinite; }
.floater svg { width: 100%; height: 100%; }
.f0 { left: 5%; top: 6%; }
.f1 { right: 7%; top: 9%; animation-delay: -1.2s; }
.f2 { left: 8%; top: 42%; animation-delay: -2.4s; }
.f3 { right: 5%; top: 40%; animation-delay: -3.1s; }
.f4 { left: 12%; bottom: 10%; animation-delay: -0.6s; }
.f5 { right: 12%; bottom: 13%; animation-delay: -1.8s; }
.f6 { left: 40%; top: 2%; animation-delay: -2.9s; }
.f7 { left: 44%; bottom: 3%; animation-delay: -4s; }

/* ---------------------------------------------------------------- effects */
#fx { position: fixed; inset: 0; z-index: 70; overflow: hidden; pointer-events: none; }
.flyer { position: absolute; left: 0; top: 0; width: 32px; height: 32px; will-change: transform; }
.flyer svg { width: 100%; height: 100%; }
.confetti { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; animation: fall 2s ease-in forwards; }
.toast { position: absolute; left: 50%; bottom: 100px; max-width: 90%; padding: 10px 18px; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 999px; font-size: 18px; text-align: center; transition: opacity .3s; animation: fade .2s; }
.toast.out { opacity: 0; }

/* ---------------------------------------------------------------- explore */
.world { flex: 1; min-height: 0; position: relative; overflow: hidden; background: #a8e27a; touch-action: none; }
.world-layer { position: absolute; left: 0; top: 0; will-change: transform; transition: opacity .25s; }
.world-layer > svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.world.entering { animation: enterhouse .32s ease-in forwards; }
.world.whoosh .world-layer { opacity: 0; }
.world-chips { position: absolute; left: 8px; top: 8px; display: flex; gap: 6px; }
.finds-chip, .bag-chip { display: flex; align-items: center; gap: 4px; padding: 3px 12px 3px 4px; background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; box-shadow: var(--sh); font-size: 18px; }
.finds-chip { pointer-events: none; }
.finds-chip svg, .bag-chip svg { width: 30px; height: 30px; }
.bag-chip.bump { animation: bump .3s; }
.map-btn, .book-btn { position: absolute; right: 8px; top: 8px; width: 58px; height: 58px; padding: 5px; border: 3px solid var(--ink); border-radius: 18px; background: var(--paper); box-shadow: var(--sh); }
.book-btn { top: 76px; }
.map-btn svg, .book-btn svg { width: 100%; height: 100%; }
.zone-banner { position: absolute; left: 50%; top: 72px; display: flex; align-items: center; gap: 8px; padding: 6px 20px 6px 8px; transform: translateX(-50%); background: #fff; border: 3px solid var(--ink); border-radius: 999px; box-shadow: var(--sh); font-size: 24px; white-space: nowrap; opacity: 0; pointer-events: none; }
.zone-banner svg { width: 40px; height: 40px; }
.zone-banner.show { animation: banner 2.2s ease-out forwards; }
.pick-n { fill: #fff; font-size: 13px; font-weight: 700; text-anchor: middle; }
.count-pop {
  position: absolute; z-index: 5; width: 64px; height: 64px; margin: -32px 0 0 -32px; display: flex; align-items: center; justify-content: center;
  background: var(--yellow); border: 4px solid var(--ink); border-radius: 50%; font-size: 36px; font-weight: 700; pointer-events: none; animation: countpop .8s ease-out forwards;
}
.pickup .bob { animation: bob 1.8s ease-in-out infinite; }
.pickup .halo { transform-box: fill-box; transform-origin: center; animation: halo 1.4s ease-in-out infinite; }
.pickup.got .bob { transform-box: fill-box; transform-origin: center; animation: gotit .45s ease-in forwards; }
.walker { transform-box: fill-box; transform-origin: 50% 100%; }
.walker.walking { animation: waddle .36s ease-in-out infinite; }
.walker .flipper { transform-box: fill-box; transform-origin: center; }
.walker.left .flipper { transform: scaleX(-1); }
.tapmark { transform-box: fill-box; transform-origin: center; animation: tapmark .6s ease-out forwards; }
.steermark { opacity: .7; }
.pop-icon { position: absolute; left: 50%; top: 40%; width: 120px; height: 120px; margin: -60px; pointer-events: none; animation: popicon 1.6s ease-out forwards; }
.pop-icon svg { width: 100%; height: 100%; }
/* Fun things: bubbles, the apple tree, fishing, swimming. */
#fun .bob { animation: bob 1.8s ease-in-out infinite; }
.apple-tree.shake { transform-box: fill-box; transform-origin: 50% 100%; animation: treeshake .3s ease-in-out 3; }
.leaf-fall { transform-box: fill-box; transform-origin: center; opacity: 0; animation: leaffall .9s ease-in forwards; }
.float { animation: bob 1.6s ease-in-out infinite; }
.float.bite { animation: dip .35s ease-in-out infinite; }
.float.reel { opacity: 0; transition: opacity .25s; }
.float .ripple, .walker .ripple { transform-box: fill-box; transform-origin: center; animation: ripple 1.6s ease-out infinite; }
.walker.swim { animation: swimbob 1.4s ease-in-out infinite; }
.walker.swim.diving { animation: dive 1.1s ease-in-out forwards; }
/* The big things: drawbridge, hens and eggs, zoo animals, and splashes, sparkles and beams. */
.drawbridge { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .7s cubic-bezier(.5, 0, .5, 1.3); }
.drawbridge.open { transform: scaleY(-.42); }
.peek { animation: peek .5s ease-out both; }
.hens.flapping .hen { transform-box: fill-box; transform-origin: 50% 100%; animation: henhop .25s ease-in-out 6; }
.egg { transform-box: fill-box; transform-origin: 50% 100%; animation: eggpop .4s ease-out both; }
.zoo-live .giraffe-neck, .zoo-live .trunk, .zoo-live .monkey { transform-box: fill-box; }
.zoo-live .giraffe-neck { transform-origin: 23% 100%; }
.zoo-live .trunk { transform-origin: 30% 0; }
.zoo-live .monkey { transform-origin: 40% 0; animation: swing 3s ease-in-out infinite; }
.zoo-live.feeding .giraffe-neck { animation: nod .45s ease-in-out .25s 2; }
.zoo-live.feeding .trunk { animation: trunkup 1.1s ease-in-out 1.05s both; }
.zoo-live.feeding .monkey { animation: swing .4s ease-in-out 1.85s 3; }
.drop { animation: drop .8s ease-out both; }
.rise { transform-box: fill-box; transform-origin: center; animation: rise 1.2s ease-out both; }
.toss { animation: toss .65s ease-in both; }
.jets { transform-box: fill-box; transform-origin: 50% 100%; animation: jets 1.4s ease-out .65s both; }
.beam { transform-box: fill-box; transform-origin: 0 50%; animation: sweep 1.6s ease-in-out infinite; }
.dolphin { transform-box: fill-box; transform-origin: center; animation: dolphin 1.6s ease-in-out .3s both; }
.mist { animation: mist 2s ease-in-out .4s both; }
.fun-btn {
  position: absolute; left: 50%; bottom: 16px; display: flex; align-items: center; gap: 8px; padding: 5px 22px 5px 8px; transform: translateX(-50%);
  background: var(--yellow); border: 4px solid var(--ink); border-radius: 999px; box-shadow: var(--sh); font-size: 24px; font-weight: 700; white-space: nowrap;
}
.fun-btn svg { width: 44px; height: 44px; }
.fun-btn[hidden] { display: none; }
.fun-btn[disabled] { opacity: .6; }
.fun-btn.go { background: var(--pink); color: #fff; animation: funpulse .5s ease-in-out infinite; }
.fun-on .toast { bottom: 170px; }
.say-pop {
  position: absolute; z-index: 5; padding: 6px 14px; background: #fff; border: 3px solid var(--ink); border-radius: 18px; font-size: 22px; font-weight: 700;
  white-space: nowrap; pointer-events: none; animation: saypop 1.2s ease-out forwards;
}
.map-modal { max-width: 440px; padding: 12px; }
.map-svg { width: 100%; height: auto; max-height: 66vh; display: block; margin-bottom: 10px; background: #a8e27a; border: 3px solid var(--ink); border-radius: 18px; }
.map-name { fill: var(--ink); font-size: 64px; font-weight: 700; text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: 14px; stroke-linejoin: round; }
.map-me { fill: var(--pink); stroke: var(--ink); stroke-width: 8px; }
.bag-head { display: flex; align-items: center; justify-content: center; gap: 8px; }
.bag-head svg { width: 46px; height: 46px; }
.bag-head h2 { margin: 0; }
.bag-box h3 { margin: 12px 0 4px; font-size: 18px; text-align: left; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; margin-bottom: 8px; }
.pack-card { display: flex; flex-direction: column; align-items: center; padding: 4px 2px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; }
.pack-card > svg { width: 48px; height: 48px; }
.pack-card b { font-size: 22px; line-height: 1; }
.pack-card .zones { display: flex; gap: 1px; margin-top: 2px; }
.pack-card .zones svg { width: 16px; height: 16px; }
.pack-card.empty { opacity: .45; }

/* ---------------------------------------------------------------- house */
.room-tabs .tab-btn.wide { font-size: 14px; }
.room-wrap { flex: 1; min-height: 0; display: flex; align-items: flex-start; justify-content: center; padding: 4px 10px 10px; }
.room { position: relative; flex: none; overflow: hidden; background: #fff1cf; border: 3px solid var(--ink); border-radius: 22px; box-shadow: var(--sh); }
.room-svg { width: 100%; height: 100%; }
.room-btn { position: absolute; right: 8px; top: 8px; width: 50px; height: 50px; padding: 4px; border: 3px solid var(--ink); border-radius: 50%; background: var(--paper); box-shadow: var(--sh); }
.room-btn svg { width: 100%; height: 100%; }
.spot { cursor: pointer; }
.spot.pop .thing { transform-box: fill-box; transform-origin: 50% 100%; animation: popin .4s cubic-bezier(.3, 1.6, .6, 1); }
.pets { position: absolute; inset: 0; pointer-events: none; }
.pet-walk { position: absolute; padding: 0; border: 0; background: none; pointer-events: auto; will-change: transform; animation: petwalk 14s ease-in-out infinite; }
.pet-hop { display: block; width: 100%; height: 100%; transform-origin: 50% 100%; will-change: transform; animation: pethop .45s ease-in-out infinite alternate; }
.pet-hop svg { width: 100%; height: 100%; }
.pet-walk.happy .pet-hop { animation: petjump .5s ease-out; }
.picker-modal { max-width: 460px; }
.picker h2 { margin-bottom: 6px; }
.picker-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.picker-tabs .tab-btn { flex: 1; width: auto; min-width: 0; }
.picker-tabs .tab-btn svg { width: 34px; height: 34px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); grid-auto-rows: max-content; gap: 8px; max-height: 46vh; overflow-y: auto; padding: 4px 2px 8px; }
.pcard { position: relative; padding: 6px 4px; }
.pcard > svg { width: 56px; height: 56px; }
.pcard span { font-size: 13px; }
.pcard.on { background: #e3fff0; outline: 3px solid var(--green); outline-offset: -8px; }
.pcard.out { opacity: .45; filter: grayscale(.6); }
.styles h3 { margin: 8px 0 4px; font-size: 18px; text-align: left; }
.swatch-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 10px; }
.swatch-btn { position: relative; padding: 0; border: 0; background: none; border-radius: 16px; }
.swatch-btn svg { width: 100%; height: auto; }
.swatch-btn.on { outline: 4px solid var(--pink); outline-offset: 2px; }
.swatch-btn.locked > svg { opacity: .5; filter: grayscale(.5); }
.swatch-btn .lock { position: absolute; right: -4px; bottom: -4px; width: 30px; height: 30px; padding: 2px; background: #fff; border: 2.5px solid var(--ink); border-radius: 50%; }
.swatch-btn .lock svg { width: 100%; height: 100%; }
.furn { cursor: pointer; }
.furn.pop { transform-box: fill-box; transform-origin: 50% 100%; animation: wobble .5s ease-out; }
.fcard-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.fcard { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 4px 6px; background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: var(--sh); font-size: 14px; line-height: 1.1; }
.fcard svg { width: 100%; height: 62px; overflow: hidden; pointer-events: none; }
.makeover-modal { max-width: 440px; }
.makeover h2 { margin-bottom: 6px; }
.makeover h3 { margin: 8px 0 2px; font-size: 18px; text-align: left; }
.make-view { height: 150px; background: #fff; border: 3px solid var(--ink); border-radius: 18px; overflow: hidden; }
.make-view svg { width: 100%; height: 100%; overflow: hidden; pointer-events: none; }
.makeover .pots { flex-wrap: wrap; margin-top: 4px; }
.makeover .pot { width: 38px; height: 38px; flex-basis: 38px; }
.makeover .pick-list { padding: 4px 2px 9px; }
.makeover .make-cost { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 0 4px; font-size: 16px; }
.make-cost svg { width: 26px; height: 26px; }

/* ---------------------------------------------------------------- currencies, trophies, players */
.cur-modal { max-width: 360px; }
.cur-big { width: 96px; height: 96px; margin: 0 auto 4px; }
.cur-big svg { width: 100%; height: 100%; }
.cur-card p { font-size: 20px; }
.cur-have { display: inline-flex; align-items: center; gap: 4px; margin: 6px 0 12px; font-size: 26px; }
.cur-have svg { width: 34px; height: 34px; }
.trophy-banner {
  position: absolute; left: 50%; top: 70px; z-index: 2; width: min(92%, 420px); display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  transform: translateX(-50%); background: #fff7d6; border: 4px solid var(--ink); border-radius: 22px; box-shadow: 0 6px 0 rgba(74, 58, 85, .3);
  animation: trophyin .45s cubic-bezier(.3, 1.5, .6, 1); transition: opacity .35s, transform .35s;
}
.trophy-banner.out { opacity: 0; transform: translate(-50%, -30px); }
.trophy-art { flex: none; width: 76px; height: 76px; }
.trophy-art svg { width: 100%; height: 100%; }
.trophy-words { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.trophy-words small { font-size: 14px; font-weight: 700; color: var(--pink-d); text-transform: uppercase; letter-spacing: .04em; }
.trophy-words b { font-size: 19px; }
.trophy-words span { font-size: 15px; }
.trophy-banner .chip { flex: none; }
.tcard { position: relative; padding: 6px 4px 8px; }
.tcard .card-art, .tcard .card-art svg { width: 64px; height: 64px; }
.tcard.mystery .card-art svg { filter: grayscale(1) opacity(.35); }
.t-need { font-size: 16px; }
.tcard .bar { width: 80%; height: 10px; border-width: 2px; }
.progress b svg { display: inline-block; width: 26px; height: 26px; margin-right: 4px; vertical-align: -6px; }
.gate-modal { max-width: 360px; }
.gate p { font-size: 20px; }
.gate p b { font-size: 26px; color: var(--pink-d); }
.gate-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0 16px; }
.btn.gate-num { min-width: 0; padding: 10px 0; font-size: 30px; }
.title-who { display: flex; justify-content: center; gap: 8px; margin: -6px 0 12px; }
.player-face { width: 62px; height: 62px; padding: 3px; background: #fff; border: 3px solid var(--ink); border-radius: 50%; box-shadow: var(--sh); transition: transform .15s; }
.player-face svg { width: 100%; height: 100%; }
.player-face.on { background: var(--yellow); outline: 4px solid var(--pink); outline-offset: 2px; transform: scale(1.1); }
.player-face.add { padding: 12px; border-style: dashed; background: rgba(255, 255, 255, .7); }
.player-modal { max-width: 420px; }
.np-face { width: 120px; height: 120px; margin: 0 auto 6px; }
.np-face svg { width: 100%; height: 100%; }
.new-player .swatches { justify-content: center; }
.new-player .swatch { width: 40px; height: 40px; }
.new-player .hairs { grid-template-columns: repeat(4, 1fr); padding: 2px 0 10px; }
.new-player .hair-btn svg { height: 48px; }
.new-player .row .btn svg { width: 40px; height: 40px; }
/* Small phones: the whole picker, yes button included, without scrolling. */
@media (max-height: 620px), (max-width: 340px) {
  .np-face { width: 84px; height: 84px; }
  .new-player .swatches { gap: 8px; padding-bottom: 8px; }
  .new-player .swatch { width: 32px; height: 32px; }
  .new-player .hair-btn svg { height: 40px; }
}
.gu-players { margin: 8px 0; }
.gu-players > b { display: block; margin-bottom: 4px; font-size: 16px; }
.gu-player { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.gu-face { flex: none; width: 44px; height: 44px; border-radius: 50%; }
.gu-face svg { width: 100%; height: 100%; }
.gu-player.cur .gu-face { outline: 3px solid var(--pink); }
.btn.gu-btn { flex: 1; min-width: 0; min-height: 0; gap: 4px; padding: 4px 8px; font-size: 14px; }
.btn.gu-btn svg { width: 22px; height: 22px; }
@media (max-height: 620px) { .make-view { height: 112px; } }
.pet-big { width: 170px; height: 200px; margin: 0 auto; }
.pet-big svg { width: 100%; height: 100%; }
.pet-rooms { margin-top: 12px; }
.pet-rooms > b { font-size: 16px; }
.pet-rooms .row { margin-top: 6px; }
.row .btn.room-pick { min-width: 0; min-height: 0; flex-direction: column; gap: 0; padding: 4px 6px; font-size: 14px; }
.room-pick svg { width: 30px; height: 30px; }
.room-pick.on { background: var(--yellow); }
.char .eyes, .pet .eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.6s infinite; }

/* Dress Up: you, or one of your pets. */
.wardrobe-scr { position: relative; }
.who { position: absolute; left: 8px; top: 6px; z-index: 2; display: flex; flex-direction: column; gap: 6px; max-height: calc(40% - 10px); overflow-y: auto; scrollbar-width: none; padding: 2px 2px 6px; }
.who::-webkit-scrollbar { display: none; }
.who-btn { flex: none; width: 50px; height: 50px; padding: 2px; border: 3px solid var(--ink); border-radius: 50%; background: #fff; box-shadow: var(--sh); }
.who-btn svg { width: 100%; height: 100%; }
.who-btn.on { background: var(--yellow); }
.shop-tabs .tab-btn.wide { font-size: 13.5px; }
.shop-tabs .tab-btn.wide svg { width: 30px; height: 30px; }

/* ---------------------------------------------------------------- creative mode */
.create-top { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px 2px; }
.create-count { flex: 1; font-size: 22px; }
.create-count span { font-size: 16px; opacity: .6; }
.create-top .btn { min-height: 46px; padding: 4px 14px 4px 8px; font-size: 18px; }
.create-top .btn svg { width: 30px; height: 30px; }
.glue-btn.dim { opacity: .6; }
.board-wrap { flex: 1; min-height: 120px; display: flex; align-items: center; justify-content: center; padding: 4px 10px 2px; }
.board {
  position: relative; flex: none; overflow: hidden; touch-action: none; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 6px 0 var(--wood-d);
  background:
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(255, 255, 255, .2) 22px 24px),
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255, 255, 255, .2) 22px 24px),
    var(--mat);
}
.piece { position: absolute; touch-action: none; }
.piece > svg { width: 100%; height: 100%; pointer-events: none; }
.piece.on { outline: 3px dashed #fff; outline-offset: 2px; border-radius: 12px; }
.piece.pop > svg { animation: popin .35s cubic-bezier(.3, 1.6, .6, 1); }
.board-hint { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; color: #fff; text-align: center; font-size: 18px; text-shadow: var(--lettering); pointer-events: none; }
.board-hint svg { width: 60px; height: 60px; animation: tapup 1s ease-in-out infinite; }
.tools { flex: none; display: flex; justify-content: center; gap: 4px; padding: 8px 8px 0; }
.tool { flex: 0 1 44px; min-width: 0; height: 44px; padding: 3px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; box-shadow: var(--sh); }
.tool svg { width: 100%; height: 100%; }
.tool[disabled] { opacity: .35; box-shadow: none; }
.create-scr .tray-tabs { margin-top: 8px; }
.tray.create-tray { flex: none; height: 26%; min-height: 108px; }
.glue-art { width: 180px; height: 180px; margin: 0 auto; }
.glue-art svg { width: 100%; height: 100%; }
.glue-name { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; }
.glue-name h2 { margin: 0; }
.glue-name .icon-btn { flex: none; }

/* ---------------------------------------------------------------- tutorial hand */
.coach { position: absolute; left: 0; top: 0; width: 64px; height: 64px; opacity: 0; pointer-events: none; transition: transform .35s cubic-bezier(.3, 1.3, .6, 1), opacity .2s; }
.coach.show { opacity: 1; }
.coach .hand { width: 64px; height: 64px; filter: drop-shadow(0 3px 0 rgba(74, 58, 85, .35)); animation: tapup 1s ease-in-out infinite; }
.coach .hand svg { width: 100%; height: 100%; }
.coach.down .hand { animation-name: tapdown; }
.coach.down .hand svg { transform: rotate(180deg); }
.coach .pic { position: absolute; left: 34px; top: -60px; width: 62px; height: 62px; padding: 7px; background: #fff; border: 3px solid var(--ink); border-radius: 50%; box-shadow: var(--sh); animation: bob 1.6s ease-in-out infinite; }
.coach .pic svg { width: 100%; height: 100%; }
.coach.flip .pic { left: -44px; }
.coach.down .pic { left: -14px; top: -66px; }
.coach-ring { position: absolute; left: 0; top: 0; border: 4px solid var(--yellow); border-radius: 20px; opacity: 0; pointer-events: none;
  box-shadow: 0 0 0 4px rgba(255, 216, 77, .35), 0 0 18px rgba(255, 216, 77, .8); transition: opacity .2s; animation: ringpulse 1.2s ease-in-out infinite; }
.coach-ring.show { opacity: 1; }

@keyframes pulse { 50% { transform: scale(1.06); } }
@keyframes petwalk { 0%, 8% { transform: translateX(0); } 42%, 58% { transform: translateX(calc(var(--dx) * var(--k, 1) * 1px)); } 92%, 100% { transform: translateX(0); } }
@keyframes pethop { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-4px) rotate(2deg); } }
@keyframes petjump { 40% { transform: translateY(-28px) scale(1.06); } 70% { transform: translateY(0) scale(1.06, .94); } }

@keyframes popin { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes bump { 50% { transform: scale(1.18); } }
@keyframes shake { 25% { transform: translate(-3px, 1px) rotate(-7deg); } 75% { transform: translate(3px, -1px) rotate(7deg); } }
@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-14px) rotate(8deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wiggle { 0%, 100% { transform: rotate(8deg); } 50% { transform: rotate(-4deg) scale(1.08); } }
@keyframes wobble { 30% { transform: scale(1.12, .9); } 60% { transform: scale(.92, 1.08); } }
@keyframes jump { 30% { transform: translateY(-26px) rotate(-4deg); } 55% { transform: translateY(0) scale(1.04, .96); } 75% { transform: translateY(-8px); } }
@keyframes stab { 50% { transform: translateY(9px); } }
@keyframes poof { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes fall { to { transform: translate(var(--drift), 110vh) rotate(var(--spin)); } }
@keyframes fade { from { opacity: 0; } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes halo { 50% { transform: scale(1.25); opacity: .35; } }
@keyframes enterhouse { to { opacity: 0; transform: scale(1.08); } }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -12px) scale(.8); } 12%, 80% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -8px); } }
@keyframes countpop { 0% { transform: scale(.3); opacity: 0; } 25% { transform: scale(1.15); opacity: 1; } 70% { transform: scale(1); opacity: 1; } 100% { transform: translateY(-30px) scale(.9); opacity: 0; } }
@keyframes nudge { 25% { transform: translateY(-6px) rotate(-3deg); } 75% { transform: translateY(-6px) rotate(3deg); } }
@keyframes potname { 0% { opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: scale(1.1); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; } }
@keyframes gotit { to { transform: translateY(-40px) scale(1.6); opacity: 0; } }
@keyframes waddle { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-3px); } }
@keyframes tapmark { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
@keyframes popicon { 0% { transform: scale(.2); opacity: 0; } 20% { transform: scale(1.1); opacity: 1; } 80% { transform: scale(1); opacity: 1; } 100% { transform: translateY(-40px) scale(.8); opacity: 0; } }
@keyframes tapup { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(5px, 12px); } }
@keyframes tapdown { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-5px, -12px); } }
@keyframes ringpulse { 50% { box-shadow: 0 0 0 8px rgba(255, 216, 77, .2), 0 0 26px rgba(255, 216, 77, .95); } }
@keyframes trophyin { from { opacity: 0; transform: translate(-50%, -40px) scale(.7); } }
@keyframes treeshake { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes leaffall { 0% { transform: translateY(-8px); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(70px) rotate(160deg); opacity: 0; } }
@keyframes dip { 50% { transform: translateY(5px); } }
@keyframes ripple { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.4); opacity: 0; } }
@keyframes swimbob { 50% { transform: translateY(3px) rotate(2deg); } }
@keyframes dive { 30% { transform: translateY(-8px); opacity: 1; } 55%, 80% { transform: translateY(26px) scale(.9); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes funpulse { 50% { transform: translateX(-50%) scale(1.12); } }
@keyframes saypop { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.6); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 80% { opacity: 1; transform: translate(-50%, -6px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -20px); } }
@keyframes peek { from { transform: translateY(16px); opacity: 0; } }
@keyframes henhop { 50% { transform: translateY(-5px) rotate(-6deg); } }
@keyframes eggpop { 0% { transform: scale(.2); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes nod { 50% { transform: rotate(16deg); } }
@keyframes trunkup { 30%, 75% { transform: rotate(-110deg); } }
@keyframes swing { 25% { transform: rotate(14deg); } 75% { transform: rotate(-14deg); } }
@keyframes drop { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
@keyframes rise { 0% { transform: translateY(10px) scale(.4); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(-36px) scale(1); opacity: 0; } }
@keyframes toss { 50% { transform: translate(calc(var(--dx) * .5), calc(var(--dy) * .5 - 50px)); } 100% { transform: translate(var(--dx), var(--dy)) scale(.6); opacity: 0; } }
@keyframes jets { 0% { transform: scaleY(.3); opacity: 0; } 20%, 70% { opacity: 1; } 70% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }
@keyframes sweep { 50% { transform: scaleX(-1); } }
@keyframes dolphin { 0% { transform: translate(-40px, 24px) rotate(-35deg); opacity: 0; } 15%, 85% { opacity: 1; } 50% { transform: translate(0, -34px) rotate(0); } 100% { transform: translate(40px, 24px) rotate(35deg); opacity: 0; } }
@keyframes mist { 0% { opacity: 0; } 25%, 75% { opacity: .9; } 100% { opacity: 0; } }

/* ---------------------------------------------------------------- small and large screens */
/* Phones: smaller coin pictures so four two- and three-digit amounts fit. */
@media (max-width: 440px) {
  #wallet { gap: 4px; }
  .pill { padding: 0 5px 0 2px; font-size: 17px; }
  .pill svg { width: 24px; height: 24px; }
}
@media (max-width: 380px) {
  .icon-btn { width: 38px; height: 38px; }
  .icon-btn.home-btn { width: 42px; height: 42px; }
}
@media (max-width: 340px) {
  #topbar { gap: 4px; padding-left: 5px; padding-right: 5px; }
  #wallet { gap: 3px; }
  .pill { gap: 1px; padding: 0 4px 0 1px; font-size: 14px; }
  .pill svg { width: 20px; height: 20px; }
  .icon-btn { width: 34px; height: 34px; }
  .icon-btn.home-btn { width: 36px; height: 36px; }
  /* Five kinds of thing across a pop-up: the pictures say it. */
  .picker-tabs { gap: 4px; }
  .picker-tabs .tab-btn span { display: none; }
}
/* Short screens (small phones, tablets on their side): keep two rows of bits and all three sewing rows in view. */
@media (max-height: 820px) {
  :root { --top: 52px; }
  .pill { height: 38px; }
  .table-top { height: 92px; padding-top: 4px; }
  .me-mini { width: 58px; }
  .cust { width: 46px; height: 46px; }
  .bubble { padding: 3px 8px 4px; }
  .bubble-main { font-size: 16px; }
  .req { width: 38px; height: 38px; }
  .mat { padding: 8px 10px; }
  .slot { width: 62px; height: 62px; padding: 6px; }
  .slot.empty i { font-size: 24px; }
  .pots { margin-top: 6px; }
  .pot { width: 40px; height: 40px; flex-basis: 40px; }
  .craft-btn { min-height: 44px; margin-top: 6px; font-size: 22px; }
  .pot-name { top: 16px; }
  .tray-tabs { margin-top: 6px; }
  .tray-tab { padding: 1px 12px 1px 4px; font-size: 15px; }
  .tray-tab svg { width: 26px; height: 26px; }
  .tray { padding-top: 8px; }
  .bit { min-height: 84px; padding: 4px 3px; }
  .bit svg { width: 48px; height: 48px; }
  .machine-wrap svg { max-height: 108px; }
  .preview { padding: 4px; }
  .preview-art { height: 70px; }
  .pick-label { font-size: 14px; }
  .pick-list { padding-bottom: 6px; }
  .chip-btn { width: 66px; padding: 2px; }
  .chip-btn > svg { width: 42px; height: 42px; }
  .sew-go { padding: 4px 10px 8px; }
  .btn.big { min-height: 52px; }
  .stage { height: 34%; min-height: 150px; }
  .who { max-height: calc(34% - 10px); }
  .who-btn { width: 44px; height: 44px; }
  .mat-says { top: -13px; font-size: 14px; }
  .mat-says svg { width: 20px; height: 20px; }
  .create-top { padding-top: 4px; }
  .create-top .btn { min-height: 40px; font-size: 16px; }
  .create-top .btn svg { width: 26px; height: 26px; }
  .tools { padding-top: 6px; }
  .tool { height: 40px; }
  .create-scr .tray-tabs { margin-top: 6px; }
}
@media (min-width: 600px) and (min-height: 821px) {
  :root { --top: 68px; }
  .pill { height: 50px; font-size: 24px; }
  .pill svg { width: 38px; height: 38px; }
  .icon-btn { width: 52px; height: 52px; }
  .icon-btn.home-btn { width: 58px; height: 58px; }
  .table-top { height: 170px; }
  .me-mini { width: 104px; }
  .cust { width: 76px; height: 76px; }
  .bubble-main { font-size: 21px; }
  .req { width: 60px; height: 60px; }
  .slot { width: 110px; height: 110px; }
  .grid, .tray { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .bit { min-height: 118px; }
  .bit svg { width: 74px; height: 74px; }
  .bit span, .card span { font-size: 16px; }
  .card > svg, .card-art, .card-art svg { width: 90px; height: 90px; }
  .preview-art { height: 150px; }
  .chip-btn { width: 96px; }
  .chip-btn > svg { width: 68px; height: 68px; }
}

/* Demo mode: a quiet button at the foot of the title screen. */
.demo-btn { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2;
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; min-height: 40px; font: inherit; font-size: 15px; font-weight: 600;
  color: var(--ink); background: rgba(255, 255, 255, .7); border: 2px solid var(--ink); border-radius: 999px; cursor: pointer; }
.demo-btn svg { width: 20px; height: 20px; }
.demo-btn:active { transform: translateX(-50%) scale(.96); }

/* ---------------------------------------------------------------- widescreen (a PC or TV in landscape)
   Phones and tablets never match this. The game spreads across the screen: pictures on the left,
   the things you pick from on the right. */
@media (min-width: 1000px) and (min-aspect-ratio: 5/4) {
  #app { max-width: none; }
  #topbar { width: 100%; max-width: 1480px; margin: 0 auto; padding: 10px 28px 6px; gap: 12px; }
  #wallet { justify-content: center; gap: 12px; }
  .pill { flex: 0 1 230px; }
  .scr:not(.explore-scr) { width: 100%; max-width: 1480px; margin: 0 auto; padding: 0 28px; }

  /* Craft table: customer and mat on the left, the bits on the right. */
  .table-scr { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: auto auto 1fr; column-gap: 32px; }
  .table-scr .table-top { grid-column: 1; grid-row: 1; }
  .table-scr .mat { grid-column: 1; grid-row: 2; margin: 18px 0 0; }
  .table-scr .tray-tabs, .create-scr .tray-tabs { grid-column: 2; grid-row: 1; align-self: end; margin-top: 8px; }
  .table-scr .tray, .create-scr .tray { grid-column: 2; grid-row: 2 / 4; height: auto; margin-bottom: 18px; border: 3px solid var(--ink); border-radius: 0 22px 22px 22px; }

  /* Creative mode: the board on the left, the bits on the right. */
  .create-scr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr auto; column-gap: 32px; }
  .create-scr .create-top { grid-column: 1; grid-row: 1; padding-left: 0; padding-right: 0; }
  .create-scr .board-wrap { grid-column: 1; grid-row: 2; min-height: 0; }
  .create-scr .tools { grid-column: 1; grid-row: 3; padding-bottom: 18px; }
  .tool { flex-basis: 52px; height: 52px; }
  .create-scr { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }

  /* The craft table's mat grows to suit the bigger screen. */
  .table-scr .table-top { height: 190px; padding: 12px 0 0; }
  .table-scr .me-mini { width: 120px; }
  .table-scr .cust { width: 84px; height: 84px; }
  .table-scr .slot { width: 128px; height: 128px; padding: 12px; }
  .table-scr .slot.empty i { font-size: 38px; }
  .table-scr .pot { width: 54px; height: 54px; flex-basis: 54px; }
  .table-scr .craft-btn { min-height: 64px; font-size: 28px; }

  /* Sewing: the machine and what it makes on the left, the choices on the right. */
  .sew-scr { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: 1fr auto; column-gap: 32px; }
  .sew-top { grid-column: 1; grid-row: 1 / 3; flex-direction: column; justify-content: center; gap: 18px; padding: 0 0 18px; }
  .machine-wrap { flex: none; width: 100%; max-width: 560px; }
  .machine-wrap svg { max-height: 40vh; }
  .preview { flex: none; width: 100%; max-width: 440px; }
  .preview-art { height: min(150px, 16vh); }
  .pickers { grid-column: 2; grid-row: 1; align-self: center; max-height: 100%; padding-top: 8px; }
  .pick-list { flex-wrap: wrap; overflow: visible; }
  .sew-go { grid-column: 2; grid-row: 2; padding: 6px 10px 18px; }

  /* Dress up: you, large, on the left; the clothes on the right. */
  .wardrobe-scr { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); grid-template-rows: auto 1fr; column-gap: 32px; }
  .wardrobe-scr .stage { grid-column: 1; grid-row: 1 / 3; height: auto; min-height: 0; padding: 12px 0 24px; align-items: center; background-position: 0 -4%; }
  .wardrobe-scr .stage svg { height: 100%; max-height: 78vh; }
  .wardrobe-scr .stage { padding-left: 72px; }
  .wardrobe-scr .who { left: 28px; top: 8px; max-height: calc(100% - 20px); }
  .wardrobe-scr .slot-tabs { grid-column: 2; grid-row: 1; padding-top: 10px; }
  .wardrobe-scr .wgrid { grid-column: 2; grid-row: 2; }

  .grid, .tray { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .tabs { padding-left: 0; padding-right: 0; }
  .house-scr .room-wrap { padding-bottom: 18px; }
}
