/* T*e Simulator — "bathroom pop": mint tiles, toilet paper, chocolate outlines, jelly buttons.
   Deliberately unlike the orjib.games landing page (no flat paper, no hard black ink). */
:root {
  --choco: #4a2a10; --brown: #7b4a1e; --caramel: #b9783a;
  --gold: #ffc93c; --gold2: #ffe27a; --pink: #ff5fa2; --pink2: #ff9cc7;
  --mint: #c9f2e7; --tile: #a5e3d2; --slime: #8fd14f; --cream: #fffaf0; --sky: #9fd3ec;
  --line: 4px solid var(--choco);
  --pop: 0 6px 0 var(--choco);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --disp: "Luckiest Guy", "Fredoka", system-ui, sans-serif;
  --ui: "Fredoka", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); color: var(--choco); font-family: var(--ui); font-weight: 600; overscroll-behavior: none; }
body { touch-action: none; -webkit-user-select: none; user-select: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
button { font: inherit; color: inherit; cursor: pointer; }
kbd { font-family: var(--ui); font-weight: 700; font-size: 0.82em; border: 2px solid var(--choco); border-bottom-width: 4px; border-radius: 8px; padding: 0 6px; background: #fff; }
[hidden] { display: none !important; }
.touch .desk-only, html:not(.touch) .touch-only { display: none !important; }

/* ---------- screens + cards ---------- */
.screen { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: calc(14px + var(--safe-t)) calc(14px + var(--safe-r)) calc(14px + var(--safe-b)) calc(14px + var(--safe-l)); overflow-y: auto; }
.screen.tiles {
  background-color: rgba(201, 242, 231, 0.82);
  background-image: linear-gradient(var(--tile) 3px, transparent 3px), linear-gradient(90deg, var(--tile) 3px, transparent 3px);
  background-size: 46px 46px; backdrop-filter: blur(3px);
}
.card { position: relative; width: min(430px, 100%); text-align: center; padding: 20px 22px 18px; border: var(--line); border-radius: 30px; box-shadow: 0 10px 0 var(--choco), 0 18px 40px rgba(74, 42, 16, 0.35); }
/* the menu card is a sheet of toilet paper on a tiled wall */
.paper { background:
  radial-gradient(circle at 12px 10px, var(--tile) 3px, transparent 4px) 0 0 / 24px 20px repeat-x,
  radial-gradient(circle at 12px 10px, var(--tile) 3px, transparent 4px) 0 100% / 24px 20px repeat-x,
  var(--cream); padding-top: 26px; padding-bottom: 24px; }
.card.small { width: min(340px, 100%); }
.back { display: inline-block; font-weight: 700; font-size: 13px; color: var(--brown); text-decoration: none; background: var(--mint); border: 3px solid var(--choco); border-radius: 99px; padding: 3px 12px; }
.back:hover { background: var(--gold2); }
.back.center { margin-top: 16px; }
.card > .back:first-child { position: absolute; top: -16px; left: 18px; }

/* logo */
.logo { position: relative; margin: 8px 0 6px; line-height: 0.9; font-weight: 400; }
.logo .t1 { display: block; font-family: var(--disp); font-size: clamp(64px, 19vw, 96px); color: var(--gold); letter-spacing: 2px;
  -webkit-text-stroke: 4px var(--choco); paint-order: stroke fill; text-shadow: 0 6px 0 var(--choco); animation: wobble 2.6s ease-in-out infinite; }
.logo .star { display: inline-block; color: var(--pink); animation: spin 3s linear infinite; }
.logo .t2 { display: inline-block; margin-top: 6px; font-family: var(--disp); font-size: clamp(26px, 8vw, 38px); letter-spacing: 3px; color: var(--cream);
  background: var(--brown); border: var(--line); border-radius: 14px; padding: 6px 14px 2px; transform: rotate(-3deg); box-shadow: var(--pop); }
.fly { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--choco); top: 30%; left: 50%; }
.fly::before, .fly::after { content: ""; position: absolute; top: -5px; width: 7px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); border: 1px solid var(--choco); }
.fly::before { left: -6px; } .fly::after { left: 5px; }
.f1 { animation: buzz1 3.1s linear infinite; } .f2 { animation: buzz2 2.4s linear infinite; } .f3 { animation: buzz1 4.2s linear infinite reverse; }
@keyframes wobble { 0%, 100% { transform: rotate(-2deg) scale(1); } 50% { transform: rotate(2deg) scale(1.04, 0.97); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes buzz1 { 0% { transform: translate(-120px, -10px); } 25% { transform: translate(-30px, -60px); } 50% { transform: translate(110px, -20px); } 75% { transform: translate(40px, 30px); } 100% { transform: translate(-120px, -10px); } }
@keyframes buzz2 { 0% { transform: translate(90px, -50px); } 33% { transform: translate(-80px, 20px); } 66% { transform: translate(20px, -80px); } 100% { transform: translate(90px, -50px); } }

/* the tagline on a strip of perforated paper */
.tp { display: inline-block; margin: 14px 0 16px; padding: 6px 14px; font-size: 16px; background: #fff; border: 3px dashed var(--caramel); border-radius: 6px; transform: rotate(1.5deg); }
h2 { font-family: var(--disp); font-weight: 400; font-size: clamp(34px, 10vw, 46px); margin: 4px 0 8px; line-height: 1; color: var(--pink); -webkit-text-stroke: 3px var(--choco); paint-order: stroke fill; text-shadow: 0 4px 0 var(--choco); }

/* jelly buttons */
.jelly { display: block; width: 100%; min-height: 58px; margin-top: 10px; padding: 10px 14px 6px; font-family: var(--disp); font-size: 30px; letter-spacing: 2px; color: var(--choco);
  background: linear-gradient(var(--gold2), var(--gold)); border: var(--line); border-radius: 20px; box-shadow: var(--pop), inset 0 -6px 0 rgba(185, 120, 58, 0.35), inset 0 5px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.08s, box-shadow 0.08s; animation: breathe 1.8s ease-in-out infinite; }
.jelly:hover { filter: brightness(1.05); }
.jelly:active { transform: translateY(5px) scale(1.02, 0.95); box-shadow: 0 1px 0 var(--choco), inset 0 -4px 0 rgba(185, 120, 58, 0.35); }
.jelly.ghost { background: var(--mint); font-size: 22px; min-height: 50px; animation: none; }
.jelly.pink { background: linear-gradient(var(--pink2), var(--pink)); color: #fff; -webkit-text-stroke: 1.5px var(--choco); paint-order: stroke fill; font-size: 24px; min-height: 52px; animation: none; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03, 0.98); } }
.best { margin: 10px 0 0; min-height: 1em; font-weight: 700; color: var(--brown); }
.howto { margin-top: 12px; text-align: left; font-weight: 500; font-size: 14px; line-height: 1.45; background: var(--mint); border: 3px solid var(--choco); border-radius: 16px; padding: 4px 12px; }
.howto summary { cursor: pointer; font-weight: 700; padding: 6px 0; list-style: none; text-align: center; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: " ▾"; }
.howto[open] summary::after { content: " ▴"; }
.howto p { margin: 4px 0 6px; text-align: center; }
.howto ul { margin: 4px 0 8px; padding-left: 18px; }
.lbl { font-weight: 700; font-size: 13px; letter-spacing: 2px; margin: 0; color: var(--brown); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 10px; }
.stats div { background: #fff; border: 3px solid var(--choco); border-radius: 16px; padding: 6px 10px; text-align: left; }
.stats span { display: block; font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--caramel); }
.stats b { font-family: var(--disp); font-weight: 400; font-size: 26px; }
.newbest { display: inline-block; margin: 0 0 6px; padding: 4px 14px 0; font-family: var(--disp); font-size: 20px; color: #fff; background: var(--pink); border: 3px solid var(--choco); border-radius: 99px; transform: rotate(-4deg); animation: wobble 1s ease-in-out infinite; }

/* title placement: card beside the tae on wide screens, under it on phones */
#title, #end { background: none; }
@media (min-width: 700px) { #title, #end { justify-items: start; padding-left: max(7vw, calc(14px + var(--safe-l))); } }
@media (max-width: 699px) { #title, #end { align-items: end; } }

/* ---------- HUD ---------- */
#hud { position: fixed; top: calc(10px + var(--safe-t)); left: calc(10px + var(--safe-l)); z-index: 10; pointer-events: none; }
.scorebox { position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 14px 2px 12px; background: linear-gradient(var(--gold2), var(--gold)); border: var(--line); border-radius: 99px; box-shadow: 0 4px 0 var(--choco); }
.scorebox .lbl { font-size: 11px; color: var(--choco); }
.scorebox b { font-family: var(--disp); font-weight: 400; font-size: 30px; line-height: 1.15; }
#mult { position: absolute; right: -16px; top: -12px; font-style: normal; font-family: var(--disp); font-size: 18px; color: #fff; background: var(--pink); border: 3px solid var(--choco); border-radius: 50%; width: 38px; height: 38px; display: grid; place-items: center; padding-top: 4px; animation: wobble 0.6s infinite; }
.meta { display: inline-block; margin-top: 8px; padding: 1px 10px; background: var(--cream); border: 3px solid var(--choco); border-radius: 99px; font-weight: 700; font-size: 14px; }
#topbtns { position: fixed; top: calc(10px + var(--safe-t)); right: calc(10px + var(--safe-r)); z-index: 11; display: flex; gap: 6px; }
.chip { min-height: 38px; padding: 4px 11px; font-weight: 700; font-size: 13px; background: var(--cream); border: 3px solid var(--choco); border-radius: 99px; box-shadow: 0 4px 0 var(--choco); }
.chip:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--choco); }
#missions { position: fixed; top: calc(60px + var(--safe-t)); right: calc(10px + var(--safe-r)); z-index: 10; width: 280px; max-height: calc(100vh - 170px - var(--safe-t)); overflow-y: auto;
  background: var(--cream); border: var(--line); border-radius: 20px; box-shadow: 0 5px 0 var(--choco); padding: 6px 12px; display: none; pointer-events: none; }
body.playing.show-missions #missions { display: block; }
.touch #missions { pointer-events: auto; touch-action: pan-y; width: min(290px, calc(100vw - 20px)); }
#mlist { list-style: none; margin: 0; padding: 0; font-size: 13px; font-weight: 500; }
#mlist li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 2px dashed rgba(123, 74, 30, 0.25); }
#mlist li:last-child { border-bottom: 0; }
#mlist li i { font-style: normal; font-weight: 700; white-space: nowrap; }
#mlist li.done { opacity: 0.5; font-size: 11px; padding: 1px 0; }
#mlist li.done span { text-decoration: line-through; }
#mlist li.done i { color: var(--slime); }
#mlist li.final { font-weight: 700; color: var(--pink); }

/* event timer */
#evbar { position: fixed; left: 50%; top: calc(12px + var(--safe-t)); z-index: 10; transform: translateX(-50%); display: none; min-width: 180px; max-width: 46vw;
  padding: 4px 14px 7px; text-align: center; background: var(--pink); color: #fff; border: var(--line); border-radius: 18px; box-shadow: 0 4px 0 var(--choco); pointer-events: none; }
body.playing.event #evbar { display: block; }
#evname { display: block; font-family: var(--disp); font-size: 16px; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-text-stroke: 1px var(--choco); paint-order: stroke fill; }
#evbar i { display: block; height: 7px; background: rgba(255, 255, 255, 0.4); border-radius: 9px; overflow: hidden; border: 2px solid var(--choco); }
#evbar b { display: block; height: 100%; background: var(--gold); transform-origin: left; }

/* toasts and the WTF banner */
#toast { position: fixed; left: 50%; top: calc(26% + var(--safe-t)); z-index: 12; transform: translate(-50%, -20px) rotate(-2deg); opacity: 0; pointer-events: none; max-width: 92vw;
  padding: 8px 18px 6px; text-align: center; background: var(--slime); border: var(--line); border-radius: 18px; box-shadow: 0 5px 0 var(--choco); transition: opacity 0.2s, transform 0.25s cubic-bezier(0.3, 1.6, 0.6, 1); }
#toast.on { opacity: 1; transform: translate(-50%, 0) rotate(-2deg); }
#toast b { display: block; font-family: var(--disp); font-weight: 400; font-size: 24px; color: #fff; -webkit-text-stroke: 2px var(--choco); paint-order: stroke fill; }
#toast span { font-weight: 600; font-size: 13px; }
#wtf { position: fixed; left: 50%; top: 42%; z-index: 13; transform: translate(-50%, -50%) scale(0); opacity: 0; pointer-events: none; text-align: center; width: max-content; max-width: 94vw; }
#wtf.on { animation: wtf 2.8s cubic-bezier(0.3, 1.6, 0.5, 1) forwards; }
#wtf b { display: block; font-family: var(--disp); font-weight: 400; font-size: clamp(70px, 22vw, 140px); line-height: 0.9; color: var(--pink); -webkit-text-stroke: 6px var(--choco); paint-order: stroke fill; text-shadow: 0 8px 0 var(--choco); animation: jiggle 0.25s 4; }
#wtf strong { display: inline-block; margin-top: 8px; padding: 6px 16px 2px; font-family: var(--disp); font-weight: 400; font-size: clamp(20px, 6vw, 32px); background: var(--gold); border: var(--line); border-radius: 14px; box-shadow: var(--pop); }
#wtf span { display: block; margin-top: 10px; font-weight: 700; font-size: 15px; color: #fff; text-shadow: 0 2px 0 var(--choco), 2px 0 0 var(--choco), -2px 0 0 var(--choco), 0 -2px 0 var(--choco); }
@keyframes wtf { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2) rotate(-20deg); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.05) rotate(4deg); } 20% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); } 82% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-2deg); } 100% { opacity: 0; transform: translate(-50%, -60%) scale(0.9) rotate(0); } }
@keyframes jiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }

/* brownout darkness + sewer trip */
#dark { position: fixed; inset: 0; z-index: 4; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 55%, rgba(11, 16, 40, 0) 12%, rgba(11, 16, 40, 0.75) 55%, rgba(5, 7, 18, 0.95) 100%); }
#sewer { position: fixed; inset: 0; z-index: 6; pointer-events: none; opacity: 0; background: radial-gradient(circle, #6b4a22 0%, #2a1808 70%); transition: opacity 0.25s; }
body.sewerfx #sewer { opacity: 0.92; }

/* floating words */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.ft { position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform; }
.ft.bubble { padding: 4px 11px 2px; font-family: var(--disp); font-size: 15px; letter-spacing: 0.5px; background: #fff; border: 3px solid var(--choco); border-radius: 16px; box-shadow: 0 3px 0 var(--choco); }
.ft.bubble::after { content: ""; position: absolute; left: 50%; bottom: -10px; width: 12px; height: 12px; background: #fff; border-right: 3px solid var(--choco); border-bottom: 3px solid var(--choco); transform: translateX(-50%) rotate(45deg); border-radius: 0 0 4px 0; }
.ft.bubble.think { font-family: var(--ui); font-weight: 600; font-style: italic; font-size: 14px; background: #efe4ff; border-radius: 22px; }
.ft.bubble.think::after { width: 9px; height: 9px; bottom: -14px; border: 3px solid var(--choco); border-radius: 50%; background: #efe4ff; }
.ft.pts { font-family: var(--disp); font-size: 20px; color: var(--gold); -webkit-text-stroke: 3px var(--choco); paint-order: stroke fill; text-shadow: 0 3px 0 var(--choco); }
.ft.pts.big { font-size: 34px; color: var(--pink); }
.ft.pts.dim { color: #fff; font-size: 15px; }

/* fart meter (desktop) */
#fartbar { position: fixed; left: calc(10px + var(--safe-l)); bottom: calc(12px + var(--safe-b)); z-index: 10; display: none; align-items: center; gap: 8px; padding: 6px 12px;
  background: var(--cream); border: var(--line); border-radius: 99px; box-shadow: 0 4px 0 var(--choco); font-family: var(--disp); font-size: 16px; letter-spacing: 1px; }
body.playing #fartbar { display: flex; }
.bar { position: relative; display: block; width: 120px; height: 14px; border: 3px solid var(--choco); border-radius: 99px; background: #fff; overflow: hidden; }
.fartfill { position: absolute; inset: 0; background: linear-gradient(90deg, #6fb53a, var(--slime)); transform-origin: left; display: block; }

/* touch controls */
#touchui { display: none; }
body.playing #touchui { display: block; }
#stick { position: fixed; z-index: 9; width: 116px; height: 116px; margin: -58px 0 0 -58px; border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity 0.1s;
  background: rgba(201, 242, 231, 0.35); border: 4px solid rgba(74, 42, 16, 0.6); }
#stick.on { opacity: 1; }
#knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--caramel), var(--brown)); border: var(--line); transform: translate(-50%, -50%); }
#btnJump, #btnFart { position: fixed; z-index: 10; touch-action: none; border: var(--line); box-shadow: 0 6px 0 var(--choco), inset 0 5px 0 rgba(255, 255, 255, 0.5); font-family: var(--disp); letter-spacing: 1px; }
#btnJump { right: calc(16px + var(--safe-r)); bottom: calc(22px + var(--safe-b)); width: 88px; height: 88px; border-radius: 50%; font-size: 21px; background: linear-gradient(var(--gold2), var(--gold)); }
#btnFart { right: calc(116px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); width: 78px; height: 66px; border-radius: 24px; font-size: 18px; background: #d9eec4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; opacity: 0.75; }
#btnFart.ready { opacity: 1; background: linear-gradient(#b5e48c, var(--slime)); }
#btnFart .bar { width: 52px; height: 10px; border-width: 2px; }
#btnJump:active, #btnFart:active { transform: translateY(4px) scale(1.04, 0.94); box-shadow: 0 2px 0 var(--choco); }

/* ---------- phones ---------- */
@media (max-width: 699px) {
  .card { border-radius: 26px; padding-left: 16px; padding-right: 16px; }
  #title .card, #end .card { max-height: calc(100vh - 230px); overflow-y: auto; }
  .tp { margin: 10px 0 12px; font-size: 15px; }
  .card > .back:first-child { position: static; margin-bottom: 2px; }
}
@media (max-width: 420px) {
  .chip { padding: 3px 8px; font-size: 12px; min-height: 36px; }
  .scorebox b { font-size: 24px; }
  .scorebox { padding-left: 10px; padding-right: 12px; }
  #toast b { font-size: 20px; }
}
/* landscape phones: short screens get a compact menu */
@media (max-height: 520px) {
  .screen { place-items: center start; }
  .card { width: min(360px, 100%); padding: 18px 16px 14px; max-height: calc(100vh - 24px); overflow-y: auto; }
  .logo .t1 { font-size: 54px; }
  .logo .t2 { font-size: 22px; }
  .tp { margin: 8px 0 6px; font-size: 13px; }
  .jelly { min-height: 48px; font-size: 24px; }
  .stats b { font-size: 20px; }
  .card > .back:first-child { position: static; margin-bottom: 2px; }
  #btnJump { width: 76px; height: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #wtf.on { opacity: 1; transform: translate(-50%, -50%); }
}

/* ---------- map, place banner, goals ---------- */
#minimap { position: fixed; right: calc(10px + var(--safe-r)); bottom: calc(12px + var(--safe-b)); z-index: 10; width: 170px; height: 170px; display: none;
  border: var(--line); border-radius: 18px; box-shadow: 0 5px 0 var(--choco); background: #2387c9; cursor: pointer; }
body.playing #minimap { display: block; }
#bigmap { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; align-content: center; gap: 8px; padding: 12px; background: rgba(201, 242, 231, 0.9); }
#bigmapc { width: min(92vw, 92vh - 40px); height: min(92vw, 92vh - 40px); border: var(--line); border-radius: 22px; box-shadow: 0 8px 0 var(--choco); background: #2387c9; }
#bigmap p { margin: 0; font-weight: 700; font-size: 13px; text-align: center; }
#place { position: fixed; left: 50%; bottom: calc(118px + var(--safe-b)); z-index: 12; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; text-align: center;
  background: var(--cream); border: var(--line); border-radius: 18px; box-shadow: 0 5px 0 var(--choco); padding: 6px 18px 4px; max-width: 90vw; transition: opacity 0.3s, transform 0.35s cubic-bezier(0.3, 1.6, 0.6, 1); }
#place.on { opacity: 1; transform: translate(-50%, 0); }
#place small { display: block; font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--caramel); }
#place b { display: block; font-family: var(--disp); font-weight: 400; font-size: clamp(18px, 5vw, 26px); line-height: 1.1; }
#place em { display: inline-block; margin-top: 2px; font-style: normal; font-size: 12px; font-weight: 700; color: #fff; background: var(--pink); border-radius: 99px; padding: 0 8px; }
#goals { position: fixed; left: calc(10px + var(--safe-l)); top: calc(96px + var(--safe-t)); z-index: 9; list-style: none; margin: 0; padding: 0; display: none; max-width: 300px; pointer-events: none; }
body.playing #goals { display: block; }
#goals li { margin-bottom: 5px; padding: 3px 10px; font-size: 13px; font-weight: 600; background: rgba(255, 250, 240, 0.92); border: 3px solid var(--choco); border-radius: 12px; }
#goals li.here { background: var(--gold2); }
#goals li i { font-style: normal; color: var(--caramel); font-weight: 700; }
body.playing.show-missions #goals { display: none; }
.stats { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 420px) { .stats { grid-template-columns: 1fr 1fr; } }
@media (max-width: 400px) { #mcount { display: none; } }
.viewbtn { font-size: 18px !important; min-height: 44px !important; }
@media (max-height: 520px) { .viewbtn { min-height: 38px !important; font-size: 15px !important; } }

/* ---------- activities ---------- */
#quest, #race, #wanted { position: static; text-align: center; max-width: 100%; z-index: 10; pointer-events: none; background: var(--cream); border: var(--line); border-radius: 16px; box-shadow: 0 4px 0 var(--choco); padding: 4px 12px; }
#quest small, #race small, #wanted small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 2px; color: var(--caramel); }
#quest b, #race b { display: block; font-family: var(--disp); font-weight: 400; font-size: 16px; line-height: 1.1; }
#quest span, #race span { display: block; font-size: 13px; font-weight: 600; }
#quest { background: var(--gold2); }
#race { background: #fff; }
#wanted { background: #23305e; color: #fff; animation: wobble 0.8s infinite; }
#wanted small { color: #ffd23f; }
#wanted b { font-size: 20px; color: #ffd23f; letter-spacing: 2px; }
#prompt { position: fixed; left: 50%; bottom: calc(70px + var(--safe-b)); transform: translateX(-50%); z-index: 11; pointer-events: none;
  padding: 6px 16px 4px; font-family: var(--disp); font-size: 18px; letter-spacing: 1px; color: #fff; background: var(--pink); border: var(--line); border-radius: 99px; box-shadow: 0 4px 0 var(--choco); white-space: nowrap; }
#btnAct { position: fixed; z-index: 10; right: calc(16px + var(--safe-r)); bottom: calc(124px + var(--safe-b)); min-width: 88px; max-width: 46vw; height: 54px; padding: 4px 12px 0;
  font-family: var(--disp); font-size: 15px; letter-spacing: 0.5px; color: #fff; background: linear-gradient(var(--pink2), var(--pink)); border: var(--line); border-radius: 18px;
  box-shadow: 0 5px 0 var(--choco); -webkit-text-stroke: 1px var(--choco); paint-order: stroke fill; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; touch-action: none; animation: breathe 1.2s infinite; }
#dialog { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(74, 42, 16, 0.35); }
#dialog .card { width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
#dialog h3 { margin: 4px 0 8px; font-family: var(--disp); font-weight: 400; font-size: 26px; line-height: 1.1; color: var(--brown); }
#dialog p { margin: 0 0 10px; font-size: 16px; line-height: 1.4; }
#dialog .btns .jelly { font-size: 17px; min-height: 46px; animation: none; padding: 8px 10px 4px; letter-spacing: 0.5px; }
#dialog .btns .jelly:disabled { opacity: 0.45; }
#mini { position: fixed; inset: 0; z-index: 28; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px;
  background: radial-gradient(circle at 50% 30%, #4a2a6a, #1a0f2a); }
#mini.fish { background: linear-gradient(#9fd3ec, #2387c9); }
.minibar { display: flex; gap: 10px; align-items: center; justify-content: space-between; width: min(520px, 100%); }
.minibar b { font-family: var(--disp); font-weight: 400; font-size: 22px; color: #fff; -webkit-text-stroke: 1.5px var(--choco); paint-order: stroke fill; }
#minic { border: var(--line); border-radius: 18px; box-shadow: 0 6px 0 var(--choco); background: rgba(0, 0, 0, 0.25); }
.lanes { display: flex; gap: 8px; width: min(520px, 100%); }
.lane { flex: 1; height: 64px; font-size: 24px; border: var(--line); border-radius: 16px; box-shadow: 0 4px 0 var(--choco); touch-action: none; }
.lane.l0 { background: #ff5fa2; } .lane.l1 { background: #ffc93c; } .lane.l2 { background: #8fd14f; } .lane.l3 { background: #4fb3ff; }
.lane:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--choco); }
#mini.fish .lanes, #mini.videoke #btnReel { display: none; }
#btnReel { width: min(520px, 100%); }
html:not(.touch) .lanes, html:not(.touch) #btnReel { display: none; }
.hatlbl { margin-top: 14px; }
#hats { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin-top: 6px; }
.hat { padding: 6px 4px; font-weight: 700; font-size: 12px; background: #fff; border: 3px solid var(--choco); border-radius: 12px; }
.hat.on { background: var(--gold); }
.hat:disabled { opacity: 0.4; }
/* short (landscape phone) screens: compact dialog, buttons in two columns */
@media (max-height: 520px) {
  #dialog { padding: 8px; }
  #dialog .card { width: min(620px, 100%); max-height: calc(100vh - 16px); padding: 12px 16px 14px; }
  #dialog h3 { font-size: 21px; margin: 0 0 4px; }
  #dialog p { font-size: 14px; margin: 0 0 8px; }
  #dialog .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  #dialog .btns .jelly { font-size: 13px; min-height: 38px; margin: 0; }
}
/* the top-centre stack (event bar, tanod alert, race, job): one column, never on top of the score or the buttons */
#stack { position: fixed; left: 50%; transform: translateX(-50%); top: calc(12px + var(--safe-t)); z-index: 10; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(340px, calc(100vw - 500px)); }
#stack #evbar { position: static; transform: none; max-width: 100%; min-width: 200px; }
@media (max-width: 1099px) { #stack { top: calc(62px + var(--safe-t)); width: min(340px, calc(100vw - 300px)); } }
@media (max-width: 1099px) { html:not(.touch) #stack { left: calc(330px + var(--safe-l)); transform: none; align-items: flex-start; width: min(340px, calc(100vw - 350px)); } }
@media (max-width: 699px) { #stack, html:not(.touch) #stack { top: calc(96px + var(--safe-t)); left: 50%; transform: translateX(-50%); align-items: center; width: min(340px, calc(100vw - 40px)); } }
/* arcade minigames */
#mini.arcade { background: radial-gradient(circle at 50% 30%, #2a5a7a, #101c2a); }
#mini.arcade .lanes, #mini.arcade #btnReel { display: none !important; }
#minic { touch-action: none; }
#minibtns { display: flex; gap: 8px; width: min(520px, 100%); }
#minibtns[hidden] { display: none; }
.mbtn { flex: 1; min-width: 0; height: 58px; padding: 4px 6px 0; font-family: var(--disp); font-size: 19px; line-height: 1; color: var(--brown); background: var(--gold); border: var(--line);
  border-radius: 16px; box-shadow: 0 4px 0 var(--choco); touch-action: none; user-select: none; -webkit-user-select: none; animation: none; }
.mbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--choco); }
.mbtn.jelly { font-size: 18px; min-height: 0; }
.mbtn.jelly + .mbtn.jelly { background: var(--mint, #bff0dc); }
@media (max-width: 420px) { .mbtn { font-size: 15px; height: 54px; } }
@media (max-height: 520px) { .mbtn { height: 46px; font-size: 15px; } }
@media (max-height: 520px) and (max-width: 1099px) { #stack, html:not(.touch) #stack { top: calc(54px + var(--safe-t)); left: 50%; transform: translateX(-50%); align-items: center; width: min(320px, calc(100vw - 250px)); gap: 4px; } #stack > * { padding-top: 2px; padding-bottom: 2px; } }
/* toasts sit at the bottom of the stack, so they never cover the job/race cards */
#stack #toast { position: static; display: none; transform: rotate(-2deg); opacity: 1; transition: none; max-width: min(92vw, 420px); width: max-content; }
#stack #toast.on { display: block; animation: toastin 0.3s cubic-bezier(0.3, 1.6, 0.6, 1); }
@keyframes toastin { from { opacity: 0; transform: translateY(-14px) rotate(-2deg); } to { opacity: 1; transform: rotate(-2deg); } }
@media (max-height: 520px) { #stack #toast b { font-size: 18px; } #stack #toast { padding: 4px 12px 3px; } }
/* Tae-Gacha */
#mini.gacha { background: radial-gradient(circle at 50% 35%, #7a3a8a, #1a0f2a); }
#mini.gacha .lanes, #mini.gacha #btnReel { display: none !important; }
#gachac { border: var(--line); border-radius: 18px; box-shadow: 0 6px 0 var(--choco); }
#gachac[hidden], #gachainfo[hidden] { display: none; }
#gachainfo { text-align: center; color: #fff; max-width: min(520px, 100%); }
#gachainfo em { display: inline-block; font-style: normal; font-weight: 700; font-size: 13px; letter-spacing: 2px; color: var(--choco); border: 3px solid var(--choco); border-radius: 99px; padding: 1px 12px; }
#gachainfo b { display: block; margin-top: 4px; font-family: var(--disp); font-weight: 400; font-size: clamp(20px, 6vw, 30px); line-height: 1.1; -webkit-text-stroke: 1.5px var(--choco); paint-order: stroke fill; }
#poops { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-height: 150px; overflow-y: auto; margin-bottom: 8px; }
.hat.poopchip { border-width: 3px; }
/* accounts */
.acctbtn { display: block; margin: 8px auto 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#acct { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 14px; background: rgba(74, 42, 16, 0.45); }
#acct[hidden] { display: none; }
#acct .card { width: min(400px, 100%); max-height: calc(100vh - 28px); overflow-y: auto; }
#acct h3 { margin: 2px 0 8px; font-family: var(--disp); font-weight: 400; font-size: 26px; color: var(--brown); }
#acct p { margin: 0 0 10px; font-size: 14px; line-height: 1.4; }
#acct input { display: block; width: 100%; margin: 0 0 8px; padding: 10px 14px; font: 600 16px Fredoka, sans-serif; color: var(--choco); background: #fff; border: 3px solid var(--choco); border-radius: 14px; }
#acct input:focus { outline: none; border-color: var(--pink); }
#acct .btns.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#acct .btns .jelly, #btnLogout, #btnAcctClose { font-size: 18px; min-height: 46px; animation: none; }
#btnAcctClose { margin-top: 4px; width: 100%; }
#gbtn { display: flex; justify-content: center; min-height: 44px; margin-bottom: 4px; }
#acct .or { font-size: 12px; font-weight: 700; color: var(--caramel); letter-spacing: 1px; margin-bottom: 6px; }
.acctmsg { min-height: 1em; font-weight: 700; color: #c0392b; }
.acctsync { font-weight: 700; color: #2a8a4a; }
#acct .acctfine { font-size: 11px; color: var(--caramel); margin-bottom: 8px; }
@media (max-height: 520px) { #acct h3 { font-size: 20px; } #acct p { font-size: 12px; margin-bottom: 6px; } #acct input { padding: 6px 12px; } }
.noacct .acctbtn { display: none !important; }
.spawnbtn { display: block; margin: 8px auto 0; }
.boardbtn { display: block; margin: 8px auto 0; }
.noacct .boardbtn { display: none !important; }
#dialog p { white-space: pre-line; }
/* fart frenzy: unlimited farts for a while */
#fartbar.frenzy .fartfill, #btnFart.frenzy .fartfill { background: linear-gradient(90deg, #ff5fa2, #ffc93c, #8fd14f, #4fb3ff, #b57bff) !important; animation: frenzy 0.6s linear infinite; }
#btnFart.frenzy { opacity: 1; background: linear-gradient(#ffe27a, #ffc93c); }
#fartbar.frenzy::after, #btnFart.frenzy::after { content: attr(data-free); position: absolute; left: 50%; top: -14px; transform: translateX(-50%); padding: 0 8px; font: 700 12px Fredoka, sans-serif; color: #fff; background: var(--pink); border: 2px solid var(--choco); border-radius: 99px; white-space: nowrap; }
@keyframes frenzy { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }
#quest { position: relative; }
#btnQuitJob { pointer-events: auto; margin-top: 4px; padding: 2px 10px; font: 700 11px Fredoka, sans-serif; color: #fff; background: var(--pink); border: 2px solid var(--choco); border-radius: 99px; cursor: pointer; }
