:root {
  --paper: #fbe8d4;
  --ink: #2e1616;
  --drip: #5f8fd0;
  --flesh: #f0c49a;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--paper); color: var(--ink);
  font-family: "Patrick Hand", "Comic Sans MS", system-ui, sans-serif;
}

#app { position: fixed; inset: 0; }
#viewport { position: absolute; inset: 0; }
#gameCanvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

/* Hand-inked card: off-white paper, wobbly black border. */
#objective, #toast, .chunk {
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 14px 6px 12px 5px / 6px 12px 5px 14px;
  box-shadow: 3px 4px 0 rgba(27, 26, 23, 0.85);
}

#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: center; padding: 12px 16px;
  pointer-events: none;
}
#objective { padding: 6px 18px 8px; text-align: center; min-width: 200px; max-width: min(440px, 64vw); transform: rotate(-1deg); }
#objTitle { font-size: 22px; line-height: 1.1; }
#objSub { font-size: 16px; color: var(--drip); line-height: 1.15; }

#canWrap {
  position: absolute; top: 14px; right: 16px; display: flex; align-items: center; gap: 6px;
  font-size: 15px; letter-spacing: 0.08em;
}
#can { display: flex; gap: 3px; }
#can i {
  width: 13px; height: 18px; display: block; border: 2px solid var(--ink);
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; transform: rotate(180deg);
  background: var(--paper);
}
#can i.full { background: var(--drip); }
@media (max-width: 520px) {
  #topbar { justify-content: flex-start; }
  #canWrap { position: fixed; top: auto; bottom: 186px; right: 22px; flex-direction: column; gap: 2px; }
  #can { flex-direction: column-reverse; }
}

#pusWrap {
  position: absolute; top: 12px; left: 16px; display: flex; align-items: center; gap: 8px;
  padding: 4px 14px 4px 8px; background: var(--paper); border: 2.5px solid var(--ink);
  border-radius: 14px 6px 12px 5px / 6px 12px 5px 14px; box-shadow: 3px 4px 0 rgba(46, 22, 22, 0.85);
  transform: rotate(1.5deg);
}
.pusDrop {
  width: 26px; height: 24px; background: #f2dc8a; border: 2.5px solid var(--ink);
  border-radius: 55% 45% 50% 50% / 60% 55% 45% 40%; box-shadow: inset -5px -5px 0 #e3bf5e;
}
.pusTxt { display: flex; flex-direction: column; line-height: 1; }
#pusCount { font-size: 24px; font-weight: 400; }
.pusTxt small { font-size: 11px; letter-spacing: 0.1em; opacity: 0.7; }
#pusWrap.bump { animation: bump 0.25s ease-out; }
@keyframes bump { 0% { scale: 1; } 40% { scale: 1.18; } 100% { scale: 1; } }
@media (max-width: 520px) {
  #pusWrap { left: auto; right: 12px; top: 10px; padding: 3px 10px 3px 6px; }
  #pusCount { font-size: 20px; }
  .pusTxt small { font-size: 9px; }
}

#worldLayer { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.bubble, .burst { position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform; }
.bubble {
  background: var(--paper); border: 2.5px solid var(--ink); padding: 3px 12px 5px;
  font-size: 19px; border-radius: 18px 14px 18px 12px / 14px 18px 12px 18px;
  box-shadow: 2px 3px 0 rgba(27, 26, 23, 0.8);
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -11px; width: 14px; height: 14px;
  background: var(--paper); border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink);
  transform: translateX(-50%) rotate(45deg) skew(10deg, 10deg);
}
.burst {
  font-family: "Rubik Wet Paint", "Patrick Hand", cursive; font-size: 34px; color: var(--flesh);
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 2px 3px 0 var(--drip);
  rotate: var(--tilt);
}

#verbPrompt {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  font-size: 20px; padding: 4px 16px; z-index: 5; pointer-events: none;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 12px 6px 12px 5px;
  opacity: 0; transition: opacity 0.15s;
}
#verbPrompt.show { opacity: 1; }
#verbPrompt::before { content: "E"; font-size: 13px; border: 2px solid var(--ink); border-radius: 5px; padding: 0 5px; margin-right: 8px; vertical-align: 2px; }

#verbs { position: absolute; right: 16px; bottom: 24px; display: none; flex-direction: column; gap: 10px; z-index: 5; }
.verb {
  font: inherit; font-size: 20px; width: 104px; padding: 8px 0; color: var(--ink); touch-action: none;
  border: 2.5px solid var(--ink); border-radius: 14px 6px 12px 5px / 6px 12px 5px 14px;
  box-shadow: 3px 4px 0 rgba(27, 26, 23, 0.85); display: flex; flex-direction: column; align-items: center; line-height: 1;
}
.verb .keycap { font-size: 11px; opacity: 0.55; margin-bottom: 2px; }
.verb.slap { background: var(--flesh); }
.verb.grab { background: var(--paper); }
.verb.water { background: #a9c6ee; }
.verb:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }


#endCard {
  position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center;
  background: rgba(238, 180, 151, 0.8); opacity: 0; pointer-events: none; transition: opacity 0.6s;
}
#endCard[hidden] { display: none; }
#endCard.show { opacity: 1; pointer-events: auto; }
.endInner { text-align: center; }
.endInner h2 {
  font-family: "Rubik Wet Paint", "Patrick Hand", cursive; font-weight: 400; margin: 0;
  font-size: clamp(40px, 10vw, 72px); color: var(--flesh);
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 3px 4px 0 var(--drip);
}
.endInner p { font-size: 24px; margin: 4px 0 18px; }

#toast {
  position: absolute; bottom: 78px; left: 50%; transform: translate(-50%, -8px) rotate(1deg);
  padding: 6px 18px; font-size: 20px; z-index: 6; max-width: min(640px, 90vw); text-align: center;
  opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0) rotate(1deg); }


#startOverlay {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: safe center; justify-content: center;
  background: #eeb497 radial-gradient(ellipse at 50% 35%, #f6d2b4 0%, #eeb497 55%, #e3a08a 100%);
  transition: opacity 0.5s; padding: 16px; overflow-y: auto;
}
#startOverlay.hidden { opacity: 0; pointer-events: none; }
#startCard { max-width: 860px; width: 100%; text-align: center; }
#startCard .lineup { max-width: 560px; margin-left: auto; margin-right: auto; }
#startCard h1 {
  margin: 4px 0 0; font-family: "Rubik Wet Paint", "Patrick Hand", cursive; font-weight: 400;
  font-size: clamp(38px, min(10vw, 9vh), 70px); line-height: 1; color: #f5e3a1;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  text-shadow: 3px 4px 0 var(--drip);
}
#startCard p { font-size: 20px; margin: 8px 0; }
.lineup { display: flex; justify-content: center; align-items: flex-end; gap: 4px; height: clamp(70px, 15vh, 130px); }
.lineup img { height: 100%; width: auto; max-width: 20%; object-fit: contain; animation: sway 3s ease-in-out infinite; transform-origin: 50% 100%; }
.lineup img:nth-child(2) { height: 85%; animation-delay: -0.6s; }
.lineup img:nth-child(3) { height: 100%; animation-delay: -1.2s; }
.lineup img:nth-child(4) { height: 80%; animation-delay: -1.8s; }
.lineup img:nth-child(5) { height: 90%; animation-delay: -2.4s; }
@keyframes sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }

.chunk {
  font: inherit; font-size: 24px; padding: 8px 30px; cursor: pointer; color: var(--ink);
  background: var(--flesh); transition: transform 0.1s;
}
.chunk:hover:not(:disabled) { transform: rotate(-2deg) scale(1.04); }
.chunk:disabled { background: var(--paper); cursor: wait; }
#startCard .fine { font-size: 14px; opacity: 0.55; margin-top: 18px; }
#startCard .fine.credit { opacity: 0.8; margin-top: 14px; }
#startCard .fine.credit + .fine { margin-top: 2px; }

@media (max-height: 500px) {
  #startOverlay { padding: 8px 16px; }
  .lineup { height: 44px; }
  #startCard h1 { font-size: 30px; }
  #startCard p { margin: 2px 0; font-size: 15px; }
  .intro { margin: 4px 0 6px; gap: 10px; }
  .panel { font-size: 13px; padding: 4px 10px 6px; line-height: 1.25; }
  .panel h2 { font-size: 11px; margin-bottom: 2px; }
  #startCard .panel p.tip { font-size: 13px; margin-top: 3px; }
  #startCard .panel p.tip.dim { font-size: 12px; }
  .goals li { margin: 1px 0; }
  #pressStart { font-size: 20px; padding: 4px 24px; }
  #startCard .fine { margin-top: 8px; }
}
.intro { display: flex; gap: 14px; margin: 10px 0 14px; text-align: left; align-items: stretch; }
.panel {
  flex: 1; padding: 8px 14px 10px; background: rgba(253, 241, 226, 0.75);
  border: 2px solid var(--ink); border-radius: 14px 8px 16px 9px; font-size: 16px; line-height: 1.3;
}
.panel h2 { margin: 0 0 4px; font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.7; font-weight: 400; }
#startCard .panel p.tip { font-size: 16px; margin: 6px 0 0; }
#startCard .panel p.tip.dim { font-size: 14px; opacity: 0.75; }
.keys { display: grid; grid-template-columns: repeat(3, auto); gap: 4px 12px; justify-content: start; }
.keys span { white-space: nowrap; }
kbd {
  display: inline-block; min-width: 1.4em; padding: 0 5px; margin-right: 3px; font: inherit; font-size: 14px; text-align: center;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; box-shadow: 1px 2px 0 var(--ink);
}
.goals { list-style: none; margin: 0; padding: 0; }
.goals li { margin: 4px 0; padding-left: 20px; position: relative; }
.goals li::before { content: ""; position: absolute; left: 1px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #f5e3a1; border: 2px solid var(--ink); }
.menuIcon { display: inline-flex; flex-direction: column; gap: 2px; vertical-align: middle; padding: 3px 4px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); }
.menuIcon i { display: block; width: 10px; height: 2px; background: var(--ink); }
@media (max-width: 760px) {
  .intro { flex-direction: column; gap: 8px; margin: 6px 0 10px; }
  .panel { font-size: 14px; padding: 6px 10px 8px; }
  .panel h2 { font-size: 12px; }
  #startCard .panel p.tip { font-size: 14px; margin-top: 4px; }
  #startCard .panel p.tip.dim { font-size: 13px; }
  .goals li { margin: 2px 0; }
}

.musicBtn {
  position: relative; width: 40px; height: 40px; padding: 0; cursor: pointer; pointer-events: auto;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 50%;
  box-shadow: 2px 3px 0 rgba(46, 22, 22, 0.85);
}
.musicBtn[hidden] { display: none; }
.musicBtn::before { content: "\266B"; font-size: 22px; line-height: 34px; color: var(--ink); }
.musicBtn.off::before { opacity: 0.35; }
.musicBtn.off::after {
  content: ""; position: absolute; left: 6px; right: 6px; top: 50%; height: 3px;
  background: var(--ink); transform: rotate(-40deg); border-radius: 2px;
}
#musicGame { position: absolute; top: 60px; right: 16px; }
#musicMenu { position: absolute; top: 16px; right: 16px; }
@media (max-width: 520px) {
  #musicGame { top: 62px; right: 12px; }
}

#enterGate {
  position: fixed; inset: 0; z-index: 20; border: 0; padding: 0; width: 100%; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: #eeb497 radial-gradient(ellipse at 50% 40%, #f6d2b4 0%, #eeb497 55%, #e3a08a 100%);
  font: inherit; color: var(--ink); transition: opacity 0.45s;
}
#enterGate[hidden] { display: none; }
#enterGate.gone { opacity: 0; pointer-events: none; }
.gatePimple {
  width: 92px; height: 70px; border: 4px solid var(--ink); border-radius: 50% 50% 46% 46% / 64% 64% 36% 36%;
  background: radial-gradient(circle at 50% 38%, #f5e3a1 0 26%, #ee9a92 27% 100%);
  box-shadow: 0 10px 0 -3px #d9636a, 0 10px 0 1px var(--ink);
  animation: throb 1.4s ease-in-out infinite;
}
.gateTxt { font-size: 28px; letter-spacing: 0.04em; }
@keyframes throb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12, 1.08); } }

#belly { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; }
.bellyLbl { font-size: 10px; letter-spacing: 0.1em; opacity: 0.7; white-space: nowrap; }
.bellyTrack {
  flex: 1; min-width: 70px; height: 12px; border: 2px solid var(--ink); border-radius: 8px;
  background: #f6e3cf; overflow: hidden;
}
#bellyFill { display: block; height: 100%; width: 0; background: #f1c56c; border-right: 2px solid var(--ink); transition: width 0.35s ease-out; }
#bellyTxt { min-width: 34px; text-align: right; }
#pockets { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; }
.pocketTrack {
  flex: 1; min-width: 70px; height: 12px; border: 2px solid var(--ink); border-radius: 8px; position: relative;
  background: #f6e3cf; overflow: hidden;
}
/* one tick per pocket slot */
.pocketTrack::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(100% / var(--slots, 12) - 1px), rgba(46, 22, 22, 0.35) 0 calc(100% / var(--slots, 12)));
}
#pocketFill { display: block; height: 100%; width: 0; background: #d9b27a; transition: width 0.25s ease-out, background 0.25s; }
#pockets[data-level="mid"] #pocketFill { background: #e9a35f; }
#pockets[data-level="high"] #pocketFill { background: #e0715a; }
#pockets.full #pocketFill { background: #c8364a; }
#pocketTxt { min-width: 34px; text-align: right; }
#pockets.full #pocketTxt { color: #c8364a; font-weight: bold; }
#pockets.full .pocketTrack { animation: fullPulse 0.9s ease-in-out infinite; }
@keyframes fullPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(200, 54, 74, 0); } 50% { box-shadow: 0 0 0 3px rgba(200, 54, 74, 0.55); } }
#pockets.bump #pocketTxt { animation: bump 0.2s ease-out; display: inline-block; }
.bubble.sign { background: #f5e3a1; font-size: 21px; }

/* No text selection, long-press menus or tap flashes anywhere in the game. */
html, body, button, #app * {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
html { touch-action: manipulation; }
#gameCanvas { touch-action: none; }

.forTouch { display: none; }
html.touch .forDesk { display: none; }
html.touch .forTouch { display: flex; }

/* ---------- Mobile UI ---------- */
html.touch #verbs { display: flex; flex-direction: row; gap: 10px; right: 12px; bottom: 14px; }
html.touch #verbs .grab { display: none; }
html.touch .verb {
  width: 58px; height: 58px; border-radius: 50%; padding: 0; justify-content: center; font-size: 13px;
}
html.touch .verb .keycap { display: none; }
html.touch #verbPrompt {
  left: 12px; right: auto; bottom: 18px; transform: none; pointer-events: auto; cursor: pointer;
  font-size: 18px; padding: 9px 16px; background: var(--flesh);
  box-shadow: 3px 4px 0 rgba(46, 22, 22, 0.85); border-radius: 16px 8px 14px 7px;
}
html.touch #verbPrompt::before { display: none; }
html.touch #verbPrompt:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }

html.touch #topbar { justify-content: flex-start; padding: 8px 10px; }
html.touch #objective { min-width: 0; max-width: 58vw; padding: 4px 10px 6px; transform: none; }
html.touch #objTitle { font-size: 16px; }
html.touch #objSub { font-size: 12px; }
html.touch #belly { margin-top: 2px; font-size: 11px; }
html.touch .bellyLbl { font-size: 8px; letter-spacing: 0.06em; }
html.touch .bellyTrack { min-width: 50px; height: 10px; }
html.touch #pockets { margin-top: 2px; font-size: 11px; }
html.touch .pocketTrack { min-width: 50px; height: 10px; }

html.touch #pusWrap { left: auto; right: 10px; top: 8px; padding: 2px 8px 2px 5px; transform: none; gap: 5px; }
html.touch .pusDrop { width: 18px; height: 17px; }
html.touch #pusCount { font-size: 17px; }
html.touch .pusTxt small { font-size: 8px; }
html.touch #canWrap {
  position: absolute; top: 50px; right: 10px; bottom: auto; flex-direction: row; gap: 4px; font-size: 10px;
}
html.touch #can { flex-direction: row; gap: 2px; }
html.touch #can i { width: 10px; height: 14px; border-width: 1.5px; }
html.touch #musicGame { top: 74px; right: 10px; width: 32px; height: 32px; }
html.touch #musicGame::before { font-size: 17px; line-height: 27px; }
html.touch #toast { top: auto; bottom: 110px; font-size: 16px; max-width: 86vw; white-space: normal; text-align: center; }

.floatText {
  position: absolute; left: 0; top: 0; font-size: 22px; font-weight: 700; white-space: nowrap;
  -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; pointer-events: none;
}
#banner {
  position: absolute; left: 50%; top: 132px; z-index: 9; transform: translate(-50%, -40px) scale(0.9); opacity: 0;
  display: flex; flex-direction: column; align-items: center; min-width: 220px; padding: 8px 22px 10px;
  background: #f5e3a1; border: 2.5px solid var(--ink); border-radius: 16px;
  box-shadow: 3px 4px 0 rgba(46, 22, 22, 0.85); transition: transform 0.35s cubic-bezier(.2, 1.4, .4, 1), opacity 0.25s;
  pointer-events: none;
}
#banner.show { transform: translate(-50%, 0) scale(1); opacity: 1; }
.bKick { font-size: 11px; letter-spacing: 0.14em; opacity: 0.7; }
.bTitle { font-family: "Rubik Wet Paint", "Patrick Hand", cursive; font-size: 24px; line-height: 1.1; text-align: center; }
.bSub { font-size: 14px; }
html.touch #banner { top: 104px; min-width: 0; width: 82vw; }

/* ---------- Pause button ---------- */
#pauseBtn {
  position: absolute; top: 60px; right: 64px; width: 40px; height: 40px; padding: 9px 8px; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between; pointer-events: auto;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 50%;
  box-shadow: 2px 3px 0 rgba(46, 22, 22, 0.85);
}
#pauseBtn i { display: block; height: 3px; border-radius: 2px; background: var(--ink); }
#pauseBtn.new::after {
  content: ""; position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border-radius: 50%;
  background: #c8364a; border: 2px solid var(--ink); animation: throb 1.2s ease-in-out infinite;
}
/* Something new in the menu (or a tip pointing at it): the button pulses. */
#pauseBtn.new, #pauseBtn.nudge { animation: menuPulse 1.6s ease-in-out infinite; }
@keyframes menuPulse {
  0%, 100% { transform: scale(1); box-shadow: 2px 3px 0 rgba(46, 22, 22, 0.85), 0 0 0 0 rgba(241, 197, 108, 0); }
  50% { transform: scale(1.14); box-shadow: 2px 3px 0 rgba(46, 22, 22, 0.85), 0 0 0 7px rgba(241, 197, 108, 0.75); }
}
.newDot {
  display: inline-block; width: 10px; height: 10px; margin: 0 0 0 6px; vertical-align: 2px; border-radius: 50%;
  background: #c8364a; border: 1.5px solid var(--ink); animation: throb 1.2s ease-in-out infinite;
}

/* ---------- Tutorial tips ---------- */
#tip {
  position: absolute; top: 116px; right: 14px; width: min(300px, 62vw); /* inside #topbar's layer */
  padding: 7px 30px 9px 12px; font-size: 16px; line-height: 1.25; text-align: left; pointer-events: auto;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 14px 8px 14px 10px;
  box-shadow: 3px 4px 0 rgba(46, 22, 22, 0.85);
  transform: translateY(-8px); opacity: 0; transition: transform 0.3s cubic-bezier(.2, 1.4, .4, 1), opacity 0.25s;
}
#tip.show { transform: translateY(0); opacity: 1; }
#tip.show.ducked { opacity: 0; pointer-events: none; } /* a banner is up */
#tip[hidden] { display: block; visibility: hidden; }
#tip .tipKick { display: block; font-size: 11px; letter-spacing: 0.14em; opacity: 0.65; }
#tipClose {
  position: absolute; top: 3px; right: 5px; width: 22px; height: 22px; padding: 0; font: inherit; font-size: 18px; line-height: 1;
  background: none; border: none; cursor: pointer; color: var(--ink);
}
/* Points up at the menu button. */
#tip.menu::before {
  content: ""; position: absolute; top: -13px; right: 62px; width: 0; height: 0;
  border: 7px solid transparent; border-bottom: 7px solid var(--ink); border-top: 0; transform: scaleX(1.3);
  animation: tipPoint 1s ease-in-out infinite;
}
@keyframes tipPoint { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
html.touch #tip { top: 114px; right: 8px; font-size: 14px; width: min(260px, 66vw); }
html.touch #tip.menu::before { right: 50px; }
html.touch #pauseBtn { top: 74px; right: 48px; width: 32px; height: 32px; padding: 7px 6px; }

/* ---------- Menus ---------- */
#menu, #pageView {
  position: fixed; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center;
  background: rgba(46, 22, 22, 0.45); padding: 14px;
}
#menu[hidden], #pageView[hidden] { display: none; }
.menuCard, .pageCardBig {
  position: relative; width: min(760px, 100%); max-height: 100%; display: flex; flex-direction: column;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 18px 8px 16px 7px / 8px 16px 7px 18px;
  box-shadow: 4px 6px 0 rgba(46, 22, 22, 0.85); overflow: hidden;
}
.menuHead { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 4px; }
#menuTitle { font-family: "Rubik Wet Paint", "Patrick Hand", cursive; font-size: 28px; color: var(--ink); }
#menuClose, #pageClose {
  font: inherit; font-size: 30px; line-height: 1; width: 40px; height: 40px; cursor: pointer;
  background: var(--flesh); border: 2.5px solid var(--ink); border-radius: 50%;
}
#pageClose { position: absolute; top: 10px; right: 10px; z-index: 1; }
.menuTabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 8px; }
.menuTabs button {
  font: inherit; font-size: 15px; padding: 4px 12px; cursor: pointer; color: var(--ink);
  background: transparent; border: 2px solid var(--ink); border-radius: 12px;
}
.menuTabs button.on { background: #f5e3a1; }
/* Phones: one row of tabs that scrolls sideways if it has to. */
@media (max-width: 480px) {
  .menuTabs { flex: none; flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding: 4px 10px 8px; scrollbar-width: none; }
  .menuTabs::-webkit-scrollbar { display: none; }
  .menuTabs button { font-size: 13px; padding: 3px 8px; white-space: nowrap; flex: none; }
  .menuTabs .newDot { width: 8px; height: 8px; margin-left: 4px; }
}
.purse { display: flex; align-items: center; gap: 6px; font-size: 20px; }
.menuBody { overflow-y: auto; padding: 4px 14px 16px; -webkit-overflow-scrolling: touch; }
.menuHint { margin: 2px 0 10px; font-size: 15px; opacity: 0.75; }
.chunk.small { font-size: 16px; padding: 5px 14px; white-space: nowrap; }
.chunk small { display: block; font-size: 13px; opacity: 0.7; }

.pauseList { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.pauseList .chunk { width: 100%; font-size: 21px; }
.pauseList .linkBtn { align-self: center; margin-top: 4px; }
/* The row a tip is pointing at. */
.pauseList .chunk.guide { position: relative; background: #f5e3a1; animation: guidePulse 1.4s ease-in-out infinite; }
.pauseList .chunk.guide::after {
  content: "\25C0"; position: absolute; right: 16px; top: 50%; translate: 0 -50%;
  font-size: 22px; color: var(--ink); animation: guidePoint 0.9s ease-in-out infinite;
}
@keyframes guidePulse { 0%, 100% { box-shadow: 3px 4px 0 rgba(46, 22, 22, 0.85), 0 0 0 0 rgba(241, 197, 108, 0); } 50% { box-shadow: 3px 4px 0 rgba(46, 22, 22, 0.85), 0 0 0 6px rgba(241, 197, 108, 0.8); } }
@keyframes guidePoint { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(6px); } }

/* ---------- New player ---------- */
#startCard #returning { font-size: 15px; margin: 10px 0 0; opacity: 0.8; }
.linkBtn {
  font: inherit; font-size: 15px; color: var(--ink); background: none; border: none; padding: 2px 4px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; opacity: 0.85;
}
.linkBtn:hover { opacity: 1; color: #c8364a; }
#confirm {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(46, 22, 22, 0.55);
}
#confirm[hidden] { display: none; }
.confirmCard {
  max-width: 380px; width: 100%; padding: 14px 18px 16px; text-align: center; background: var(--paper);
  border: 2.5px solid var(--ink); border-radius: 18px 10px 16px 12px; box-shadow: 4px 5px 0 rgba(46, 22, 22, 0.85);
}
.confirmCard h2 { margin: 0 0 6px; font-family: "Rubik Wet Paint", "Patrick Hand", cursive; font-weight: 400; font-size: 30px; }
.confirmCard p { font-size: 17px; margin: 0 0 14px; }
.confirmBtns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.confirmBtns .chunk { font-size: 19px; padding: 6px 18px; }
.chunk.danger { background: #e9a39a; }

.pageGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.pageCard {
  font: inherit; color: var(--ink); cursor: default; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 6px; background: #fbe8d4; border: 2px solid var(--ink); border-radius: 12px 6px 12px 6px;
}
.pageCard.got { cursor: pointer; background: #fdf1e2; }
.pageCard.got:hover { transform: rotate(-1.5deg); }
.pageCard img { height: 78px; width: 100%; object-fit: contain; }
.pageCard.locked img { filter: brightness(0); opacity: 0.25; }
.pName { font-size: 16px; }
.pWant { font-size: 12px; line-height: 1.15; text-align: center; opacity: 0.8; }
.pWant b { color: #c8364a; }

.pageCardBig { width: min(560px, 100%); padding: 16px; overflow-y: auto; align-items: center; }
#pageImg { max-width: 100%; max-height: 58vh; border: 2px solid var(--ink); border-radius: 6px; background: #fff; }
#pageName { font-family: "Rubik Wet Paint", "Patrick Hand", cursive; font-weight: 400; font-size: 30px; margin: 8px 0 2px; }
#pageNote { font-size: 18px; margin: 4px 0; white-space: pre-line; text-align: center; }
#pageWant { font-size: 14px; opacity: 0.7; margin: 4px 0 0; }

.achList { display: flex; flex-direction: column; gap: 8px; }
.ach { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border: 2px solid var(--ink); border-radius: 12px; opacity: 0.75; }
.ach.got { opacity: 1; background: #f5e3a1; }
.achMark { flex: none; width: 28px; height: 28px; border: 2px solid var(--ink); border-radius: 50%; text-align: center; line-height: 24px; font-size: 18px; background: var(--paper); }
.achTxt { display: flex; flex-direction: column; flex: 1; }
.achTxt b { font-weight: 400; font-size: 18px; }
.achTxt small { font-size: 13px; opacity: 0.8; }
.achBar { display: block; height: 7px; margin-top: 3px; border: 1.5px solid var(--ink); border-radius: 5px; overflow: hidden; }
.achBar i { display: block; height: 100%; background: #f1c56c; }

.curioGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.curio { display: flex; flex-direction: column; align-items: center; padding: 8px; border: 2px dashed var(--ink); border-radius: 12px; font-size: 14px; text-align: center; }
.curio img { width: 70px; height: 70px; filter: brightness(0); opacity: 0.2; }
.curio.got { border-style: solid; background: #fdf1e2; }
.curio.got img { filter: none; opacity: 1; }

.cardWrap { display: flex; justify-content: center; margin-bottom: 12px; }
#cardPreview { width: min(100%, 340px); height: auto; border: 2px solid var(--ink); border-radius: 8px; }
#shareBtn { display: block; margin: 0 auto; }

.shopList { display: flex; flex-direction: column; gap: 8px; }
.shopItem { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 2px solid var(--ink); border-radius: 12px; }
.shopItem > span { display: flex; flex-direction: column; }
.shopItem b { font-weight: 400; font-size: 19px; }
.shopItem small { font-size: 13px; opacity: 0.8; }
.shopItem .chunk:disabled { opacity: 0.45; cursor: not-allowed; }
.owned { font-size: 15px; opacity: 0.6; padding: 0 8px; }
