/* style.css — "תפוס ת'קקי" · watercolor-anthroposophic look per approved design */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Rubik', sans-serif;
  color: #402d20;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- background layers ---------- */
.bg-layer {
  position: fixed; inset: 0; z-index: 0;
  transition: opacity 4s ease;
}
#stars {
  position: fixed; inset: 0; z-index: 0; opacity: 0; pointer-events: none;
  transition: opacity 4s ease;
}
#stars i {
  position: absolute; border-radius: 50%; background: #F4E9C8;
  animation: sparkle 2.6s ease-in-out infinite;
}

#app { position: fixed; inset: 0; z-index: 1; }

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center;
}

/* ---------- keyframes (from the design animation sheet) ---------- */
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes sway { 0% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } 100% { transform: rotate(-5deg); } }
@keyframes squash { 0%,100% { transform: scaleY(1) scaleX(1); } 45% { transform: scaleY(.82) scaleX(1.14); } }
@keyframes floatUp { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-45px); opacity: 0; } }
@keyframes floatFade { 0% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(-30px) scale(1.25); opacity: 0; } }
@keyframes sparkle { 0%,100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes haloPulse { 0%,100% { opacity: .4; transform: scale(1); } 50% { opacity: .85; transform: scale(1.07); } }
@keyframes shakeX { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes puffUp { 0% { transform: scale(.4); opacity: .8; } 100% { transform: scale(1.5) translateY(-24px); opacity: 0; } }
@keyframes popIn { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes heartPop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* ---------- buttons ---------- */
button { font-family: inherit; cursor: pointer; }
.btn-primary {
  border: none; color: #fff; font-family: 'Suez One', serif; font-size: 26px;
  background: radial-gradient(circle at 40% 30%, #D0754E, #C1653F 75%);
  padding: 14px 52px; border-radius: 60px;
  box-shadow: 0 10px 20px rgba(150,80,40,.35), inset 0 3px 6px rgba(255,255,255,.3);
}
.btn-primary:active { transform: scale(.96); }
.btn-big { font-size: 32px; padding: 20px 70px; }
.btn-secondary {
  border: 2px solid #a9906a; font-weight: 600; font-size: 18px; color: #6a5a40;
  background: rgba(251,247,238,.8); padding: 11px 40px; border-radius: 50px;
}
.btn-secondary:active { transform: scale(.96); }

/* ---------- start screen ---------- */
.start-screen { justify-content: center; gap: 18px; padding: 20px; }
.parent-btn {
  position: absolute; top: 22px; left: 26px; width: 52px; height: 52px;
  border-radius: 50%; background: rgba(251,247,238,.7); border: 1px solid #ddd0b4;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
}
.parent-btn svg { width: 24px; height: 24px; }
.start-title {
  font-family: 'Suez One', serif; font-size: clamp(52px, 10vw, 96px); line-height: 1;
  text-shadow: 0 3px 0 rgba(255,255,255,.4); text-align: center;
}
.start-sub { font-size: 19px; color: #6f6552; text-align: center; }
.hero-poop { width: 160px; animation: bob 3s ease-in-out infinite; }
.hero-poop svg { width: 100%; }
.quiet-link {
  color: #7d7360; font-size: 15px; text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer;
}
.static-link { margin-top: 14px; }
.who-chip {
  border: 1px solid #d8c9a4; background: rgba(251,247,238,.85);
  color: #6a5a40; font-family: 'Rubik', sans-serif; font-weight: 600;
  font-size: 15px; padding: 7px 18px; border-radius: 40px; cursor: pointer;
}
.who-chip:active { transform: scale(.96); }

/* ---------- register / players ---------- */
.register-screen, .players-screen { justify-content: center; gap: 18px; padding: 24px; }
.hero-poop.small { width: 110px; }
.reg-title { font-family: 'Suez One', serif; font-size: clamp(30px, 6vw, 46px); color: #402d20; text-align: center; }
.reg-sub { font-size: 16px; color: #6f6552; text-align: center; max-width: 440px; line-height: 1.6; }
.reg-input {
  font-family: 'Suez One', serif; font-size: 30px; text-align: center;
  color: #402d20; background: #FBF7EE;
  border: 3px solid #d8c9a4; border-radius: 20px;
  padding: 14px 24px; width: min(360px, 82vw); outline: none;
  user-select: text; -webkit-user-select: text;
}
.reg-input:focus { border-color: #C1653F; box-shadow: 0 0 0 5px rgba(193,101,63,.16); }
.players-grid {
  display: flex; flex-wrap: wrap; gap: 18px; justify-content: center;
  max-width: 720px; margin: 6px 0;
}
.player-card {
  width: 150px; min-height: 168px; border-radius: 24px;
  background: rgba(251,247,238,.9); border: 2px solid #e0d0b4;
  box-shadow: 0 10px 20px rgba(60,45,30,.12);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 16px 10px; cursor: pointer; transition: transform .15s;
}
.player-card:active { transform: scale(.95); }
.player-card.current { border-color: #7a9550; box-shadow: 0 0 0 5px rgba(122,149,80,.18), 0 10px 20px rgba(60,45,30,.12); }
.player-av { width: 76px; }
.player-av svg { width: 100%; }
.player-name { font-family: 'Suez One', serif; font-size: 22px; color: #402d20; text-align: center; word-break: break-word; }
.player-best { font-size: 13px; color: #8a7f6a; }
.add-card { border-style: dashed; justify-content: center; color: #a9906a; }
.add-plus { font-size: 56px; line-height: .8; color: #C1653F; font-family: 'Suez One', serif; }

/* ---------- game screen / HUD ---------- */
.game-screen { padding: 0; }
.hud {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 16px 20px 8px; z-index: 5;
}
.pill {
  display: flex; align-items: center; gap: 10px;
  background: rgba(251,247,238,.82); border: 1px solid #ddd0b4;
  border-radius: 40px; padding: 8px 18px;
}
.pill svg { width: 22px; height: 22px; flex: none; }
.score-pill span { font-weight: 700; font-size: 24px; min-width: 44px; text-align: center; }
.hearts-pill { gap: 7px; }
.heart { display: inline-flex; }
.heart svg { width: 26px; height: 24px; }
.heart.just-broke { animation: heartPop .5s ease; }
.heart.just-gained { animation: heartPop .6s ease; }
.float-heart {
  position: absolute; z-index: 6; pointer-events: none; width: 44px;
  animation: floatFade 1.1s ease forwards;
}
.float-heart svg { width: 100%; }
.bar-pill { flex: 1; min-width: 0; padding: 7px 16px; }
.bar-icon svg { width: 32px; height: 30px; }
.bar-track {
  flex: 1; height: 14px; border-radius: 10px; background: #E6DCC4; overflow: hidden;
}
.bar-fill {
  height: 100%; width: 0; border-radius: 10px;
  background: linear-gradient(90deg, #E8C46B, #D6A03E);
  transition: width .4s ease;
}
.bar-label { font-size: 14px; font-weight: 600; color: #6a5a40; white-space: nowrap; }

.playfield {
  position: relative; flex: 1; width: 100%; overflow: hidden;
  touch-action: none;
}
.playfield.shake { animation: shakeX .25s ease 2; }

.toilet {
  position: absolute; bottom: 6px; width: 220px; height: 160px; z-index: 3;
}
.toilet svg { width: 100%; height: 100%; overflow: visible; }
.toilet.catching { animation: squash .45s ease; transform-origin: bottom center; }
.toilet-svg .mouth-sad { display: none; }
.toilet.sad .mouth-sad { display: block; }
.toilet.sad .mouth-happy { display: none; }

.item { position: absolute; z-index: 2; pointer-events: none; }
.item .sway { width: 100%; height: 100%; animation: sway 2.4s ease-in-out infinite; }
.item svg { width: 100%; height: 100%; }
.playfield.paused .sway { animation-play-state: paused; }
.item-diva { filter: drop-shadow(0 0 16px rgba(232,196,107,.85)); }

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(85vh) rotate(340deg); opacity: 0; }
}
.confetti-fly {
  position: absolute; z-index: 7; pointer-events: none;
  border-radius: 50% 60% 55% 45%;
  animation: confettiFall 1.4s ease-in forwards;
}

/* pause */
.pause-btn {
  border: 1px solid #ddd0b4; cursor: pointer; gap: 6px;
  padding: 8px 17px; align-self: stretch;
}
.pause-btn:active { transform: scale(.94); }
.pb-bar { width: 5px; height: 20px; border-radius: 3px; background: #8a7f6a; }
.pause-card {
  background: rgba(251,247,238,.94); border: 1px solid #e0d0b4;
  border-radius: 28px; box-shadow: 0 24px 50px rgba(60,40,50,.3);
  padding: 34px 48px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  animation: popIn .25s ease;
}
.pause-title { font-family: 'Suez One', serif; font-size: 42px; color: #402d20; }

.float-text {
  position: absolute; z-index: 6; pointer-events: none;
  font-family: 'Suez One', serif; font-size: 30px; color: #C1653F;
  width: 60px; text-align: center; direction: ltr;
  animation: floatUp .9s ease forwards;
  text-shadow: 0 2px 0 rgba(255,255,255,.5);
}
.float-letter {
  position: absolute; z-index: 6; pointer-events: none;
  font-family: 'Suez One', serif; font-size: 54px; color: #402d20;
  width: 60px; text-align: center;
  animation: floatFade 1.1s ease forwards;
  text-shadow: 0 2px 0 rgba(255,255,255,.5);
}
.float-letter.word { font-size: 34px; width: 180px; }
.puff {
  position: absolute; z-index: 2; pointer-events: none;
  width: 40px; height: 30px; border-radius: 50%;
  background: rgba(200,185,150,.55);
  animation: puffUp .7s ease forwards;
}

/* ---------- overlays ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(64,45,32,.32);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 16px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* bonus question card */
.q-card {
  position: relative;
  width: min(640px, 94vw);
  background: linear-gradient(#F4EBD6, #EBDFC2);
  border-radius: 28px; border: 1px solid #d8c9a4;
  box-shadow: 0 30px 60px rgba(40,28,16,.35);
  padding: 26px 26px 30px; text-align: center;
  animation: popIn .3s ease;
}
.listen-btn {
  border: none; width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 40% 34%, #E0A94F, #C1653F 78%);
  box-shadow: 0 12px 22px rgba(150,80,40,.35), inset 0 3px 6px rgba(255,255,255,.35);
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.listen-btn:active { transform: scale(.94); }
.tri {
  width: 0; height: 0;
  border-top: 15px solid transparent; border-bottom: 15px solid transparent;
  border-right: 24px solid #fff;
}
.tri-arc {
  width: 10px; height: 24px; border-left: 4px solid #fff;
  border-radius: 0 0 0 60%; opacity: .85;
}
.q-caption { font-size: 17px; color: #8a7458; margin: 12px 0 20px; }
.q-tiles { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.q-tile {
  min-width: 130px; min-height: 140px; border-radius: 20px;
  background: #FBF7EE; border: 3px solid #d8c9a4;
  box-shadow: 0 8px 16px rgba(60,45,30,.14);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; font-size: 56px; padding: 10px 14px;
}
.q-tile:active { transform: scale(.96); }
.q-tile.right {
  background: #EFF3E4; border-color: #7a9550;
  box-shadow: 0 8px 16px rgba(90,120,60,.22), 0 0 0 6px rgba(122,149,80,.18);
}
.q-tile.wrong {
  background: #F6EBE2; border-color: #d8b49c; opacity: .85;
  animation: shakeX .25s ease 2;
}
.word-tile .w { font-family: 'Suez One', serif; font-size: 38px; color: #402d20; }
.word-tile .replay { font-size: 22px; opacity: .75; padding: 4px 10px; }
.stone-tile svg { width: 120px; height: 105px; }
.word-stone-tile svg { width: 180px; height: 86px; }
.level-pill { font-size: 15px; font-weight: 700; color: #6a5a40; gap: 6px; }
.q-float {
  position: absolute; top: 8px; left: 50%; margin-left: -30px;
  animation: floatUp .9s ease forwards;
}

/* prize overlay */
.prize-ov { gap: 10px; }
.confetti {
  position: absolute; width: 13px; height: 13px;
  border-radius: 50% 60% 55% 45%; opacity: .6;
  animation: sparkle 2.3s ease-in-out infinite;
}
.prize-halo { position: relative; width: 300px; height: 300px; }
.halo-a {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(232,196,107,.5), rgba(232,196,107,.12) 55%, transparent 72%);
  animation: haloPulse 2.6s ease-in-out infinite;
}
.halo-b {
  position: absolute; inset: 36px; border-radius: 50%;
  border: 2px solid rgba(232,196,107,.45);
  animation: haloPulse 2.6s ease-in-out infinite .5s;
}
.prize-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  animation: bob 3.2s ease-in-out infinite;
}
.prize-icon svg { width: 170px; height: 160px; }
.prize-name {
  font-family: 'Suez One', serif; font-size: 40px; color: #FBF7EE;
  text-shadow: 0 2px 10px rgba(40,28,16,.4); text-align: center;
}

/* ---------- pee-rain bonus round ---------- */
.pee-count {
  position: absolute; top: 30%; left: 0; right: 0; text-align: center; z-index: 7;
  font-family: 'Suez One', serif; font-size: clamp(90px, 22vw, 190px);
  color: #EFC94C; pointer-events: none;
  text-shadow: 0 5px 0 rgba(255,255,255,.55), 0 0 34px rgba(239,201,76,.6);
}
.pee-count.pop { animation: heartPop .4s ease; }
.pee-timer {
  position: absolute; top: 14px; left: 0; right: 0; text-align: center; z-index: 6;
  font-family: 'Suez One', serif; font-size: 34px; color: #B88A20;
  pointer-events: none; text-shadow: 0 2px 0 rgba(255,255,255,.6);
}
.pee-drop { position: absolute; z-index: 3; pointer-events: none; filter: drop-shadow(0 3px 4px rgba(120,90,20,.3)); }
.pee-drop .sway { width: 100%; height: 100%; animation: sway 1.8s ease-in-out infinite; }
.pee-drop svg { width: 100%; height: 100%; }
/* continuous pee stream — keep the toilet under it to fill the meter */
.pee-stream {
  position: absolute; top: 0; width: 30px; z-index: 3; pointer-events: none;
  border-radius: 0 0 15px 15px; opacity: .94;
  background:
    repeating-linear-gradient(180deg, rgba(255,255,255,.4) 0 7px, rgba(255,255,255,0) 7px 20px),
    linear-gradient(#FBE88C, #EFC94C);
  background-size: 100% 27px, 100% 100%;
  animation: streamFlow .45s linear infinite;
  box-shadow: 0 0 12px rgba(239,201,76,.55);
}
@keyframes streamFlow { from { background-position: 0 0, 0 0; } to { background-position: 0 27px, 0 0; } }
.pee-stream::after {
  content: ''; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%);
  width: 0; height: 0; border-left: 15px solid transparent; border-right: 15px solid transparent;
  border-top: 17px solid #EFC94C;
}
.pee-stream.collecting { filter: brightness(1.12); box-shadow: 0 0 22px rgba(239,201,76,.9); }
.pee-fill {
  position: absolute; top: 58px; left: 50%; transform: translateX(-50%);
  width: min(300px, 72%); height: 16px; border-radius: 10px;
  background: #E6DCC4; overflow: hidden; z-index: 6;
  box-shadow: 0 2px 6px rgba(0,0,0,.12), inset 0 1px 2px rgba(0,0,0,.08);
}
.pee-fill > i { display: block; height: 100%; width: 0; border-radius: 10px; background: linear-gradient(90deg, #FBE88C, #EFC94C); }
.pee-splash {
  position: absolute; z-index: 4; width: 22px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle, #FBE88C, rgba(239,201,76,0) 70%);
  pointer-events: none; animation: puffUp .5s ease forwards;
}

/* ---------- poop storm ---------- */
.butt {
  position: absolute; width: 140px; height: 110px; z-index: 4;
  transition: top .8s ease; pointer-events: none;
}
.butt svg { width: 100%; height: 100%; }
.megapoop {
  position: absolute; width: 130px; height: 120px; z-index: 4;
  transition: top .55s cubic-bezier(.5, 0, 1, 1); pointer-events: none;
}
.megapoop svg { width: 100%; height: 100%; }
.splat {
  position: absolute; inset: -14% -20% 4%; z-index: 5;
  transition: opacity .25s, transform .25s; pointer-events: none;
  transform-origin: bottom center;
}
.splat svg { width: 100%; height: 100%; }
.storm-hint {
  position: absolute; top: 16%; left: 0; right: 0; z-index: 6;
  text-align: center; font-family: 'Suez One', serif;
  font-size: clamp(20px, 3.5vw, 32px); color: #7a4229;
  text-shadow: 0 2px 0 rgba(255,255,255,.6);
  animation: bob 1.6s ease-in-out infinite; pointer-events: none;
}

/* ---------- leaderboard ---------- */
.board-screen { justify-content: center; gap: 16px; padding: 16px; }
.board-card {
  width: min(520px, 94vw);
  background: rgba(251,247,238,.92); border: 1px solid #e0d0b4;
  border-radius: 28px; box-shadow: 0 24px 50px rgba(60,40,50,.25);
  padding: 24px 30px;
  display: flex; flex-direction: column;
  animation: popIn .3s ease;
  max-height: 74vh; overflow-y: auto;
}
.board-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.board-title { font-family: 'Suez One', serif; font-size: clamp(24px, 5vw, 32px); flex: 1; }
.info-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid #a9906a;
  background: rgba(251,247,238,.9); color: #6a5a40;
  font-family: 'Suez One', serif; font-size: 18px; flex: none;
}
.board-tip {
  background: #F4EBD6; border: 1px solid #d8c9a4; border-radius: 14px;
  padding: 10px 16px; font-size: 15px; color: #6a5a40; line-height: 1.6;
  margin-bottom: 8px;
}
.board-empty { padding: 26px 0; text-align: center; color: #8a7f6a; font-size: 17px; }
.board-row {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 2px; border-bottom: 1px dashed #e0d0b4;
}
.board-row:last-child { border-bottom: none; }
.rank-badge {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 40% 30%, #c98a5e, #a9603f 80%);
  color: #fff; font-family: 'Suez One', serif; font-size: 21px;
  display: flex; align-items: center; justify-content: center;
}
.rank-badge.top { background: radial-gradient(circle at 40% 30%, #E8C46B, #C68A34 80%); }
.rank-poop { font-size: 22px; }
.board-score { font-family: 'Suez One', serif; font-size: 25px; color: #402d20; flex: 1; }
.board-date { font-size: 13px; color: #a89d86; }
.start-btn-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

/* ---------- game over ---------- */
.over-screen { justify-content: center; padding: 16px; }
.over-card {
  width: min(560px, 94vw);
  background: rgba(251,247,238,.92); border: 1px solid #e0d0b4;
  border-radius: 28px; box-shadow: 0 24px 50px rgba(60,40,50,.3);
  padding: 30px 34px; text-align: center;
  display: flex; flex-direction: column; align-items: center;
  animation: popIn .35s ease;
}
.over-poop { width: 100px; }
.over-poop svg { width: 100%; }
.over-title { font-family: 'Suez One', serif; font-size: clamp(26px, 5vw, 38px); margin-top: 8px; }
.over-stats { display: flex; gap: 36px; margin: 22px 0; align-items: center; }
.over-stats .lbl { font-size: 14px; color: #8a7f6a; margin-bottom: 4px; }
.over-stats .val { font-family: 'Suez One', serif; font-size: 48px; color: #C1653F; line-height: 1; }
.over-stats .val.muted { color: #8a7f6a; }
.over-stats .sep { width: 1px; align-self: stretch; background: #e0d0b4; }
.over-rank {
  font-weight: 700; font-size: 18px; color: #7a9550; margin-bottom: 16px;
  background: #EFF3E4; border: 1px solid #cdd9b2; border-radius: 30px;
  padding: 7px 22px;
}

/* ---------- prize shelf ---------- */
.shelf-screen { padding: 22px 26px; overflow-y: auto; }
.shelf-head {
  width: min(920px, 100%); display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 10px;
}
.shelf-head .pill span { font-weight: 700; font-size: 20px; }
.shelf-title { font-family: 'Suez One', serif; font-size: clamp(26px, 5vw, 34px); }
.shelf-row {
  width: min(920px, 100%);
  display: flex; justify-content: space-around; align-items: flex-end;
  padding: 8px 10px 0; gap: 8px;
}
.shelf-plank {
  width: min(920px, 100%); height: 15px; border-radius: 8px;
  background: linear-gradient(#B08752, #96703F);
  box-shadow: 0 5px 8px rgba(60,45,30,.25);
  margin-bottom: 14px;
}
.prize-card {
  text-align: center; padding: 6px 4px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 110px;
}
.prize-card.clickable { cursor: pointer; }
.prize-card.clickable:active { transform: scale(.96); }
.pc-icon svg { width: 76px; height: 66px; }
.pc-name { font-size: 13.5px; font-weight: 600; color: #4a4234; }
.prize-card.locked .pc-name { color: #9a8f78; }
.pc-price { font-size: 12px; color: #a89d86; }
.pc-tag {
  font-size: 12px; font-weight: 700; color: #6a5a40;
  border: 1px solid #a9906a; border-radius: 20px; padding: 2px 12px;
}
.pc-tag.on { color: #fff; background: #7a9550; border-color: #7a9550; }
.shelf-preview { width: 190px; margin: 4px 0 10px; }
.shelf-preview svg { width: 100%; }

/* small screens */
@media (max-width: 700px) {
  .bar-label { display: none; }
  .level-pill { display: none; }
  .toilet { width: 180px; height: 132px; }
  .q-tile { min-width: 104px; min-height: 116px; font-size: 44px; }
  .word-tile .w { font-size: 30px; }
}
