/* Crush after the sentence, bottom sheet */
.word.crushed { background: rgba(255, 77, 141, .25); animation: shake .4s infinite; }
.word.rewritten { background: rgba(124, 242, 154, .16); }
@keyframes shake { 25% { transform: translateX(-2px) rotate(-2deg); } 75% { transform: translateX(2px) rotate(2deg); } }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(3, 8, 28, .6); z-index: 18; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 19; margin: 0 auto;
  width: 100%; max-width: calc(100dvh * 9 / 16);
  background: #101C55; border-top: 1px solid var(--line); border-radius: 22px 22px 0 0;
  padding: 18px 16px max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px;
  animation: slideup .22s ease-out;
}
.sheet h3 small { font: 500 14px Inter, sans-serif; color: var(--muted); }
@keyframes slideup { from { transform: translateY(100%); } }

/* Maître Crusheur = the toad */
:root { --toad: #7CF29A; }
.pill.master-pill { color: var(--toad); border-color: rgba(124, 242, 154, .55); background: rgba(124, 242, 154, .14); }
.player.master { outline: 2px solid rgba(124, 242, 154, .7); background: rgba(124, 242, 154, .14); }
.player.master .pname { color: var(--toad); }
.av-wrap { position: relative; display: inline-flex; flex: none; }
.av-wrap.master > .avatar { box-shadow: 0 0 0 2px var(--toad); }
.toad-badge {
  position: absolute; right: -5px; bottom: -5px; font-size: .55em; line-height: 1; padding: 1px 2px;
  border-radius: 50%; background: #0A1A4F; border: 1px solid var(--toad);
}
.order-item.is-master span { color: var(--toad); }
.now-playing .who.is-master { color: var(--toad); }

/* Sentence finished */
.finish {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 50%, rgba(37, 87, 232, .92), rgba(7, 18, 56, .96) 70%);
  animation: fade-in .25s ease-out; overflow: hidden; padding: 24px;
}
.finish.out, .toad-show.out { animation: fade-out .5s ease-in forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; transform: scale(1.08); } }
.finish-title {
  font: 700 34px Fredoka, sans-serif; color: var(--cruche); text-shadow: 0 5px 0 rgba(0,0,0,.3);
  margin-bottom: 22px; animation: stamp .55s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes stamp { from { transform: scale(4) rotate(-12deg); opacity: 0; } to { transform: scale(1) rotate(-3deg); opacity: 1; } }
.finish-sentence { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 340px; animation: tada .7s ease-in-out both; animation-delay: var(--land); }
.fword {
  font: 700 30px Fredoka, sans-serif; padding: 4px 12px; border-radius: 12px; background: rgba(255, 255, 255, .1);
  border-bottom: 4px solid var(--c); opacity: 0;
  animation: fly-in .6s cubic-bezier(.2, .9, .3, 1.15) forwards;
}
@keyframes fly-in { from { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.3); } to { opacity: 1; transform: none; } }
@keyframes tada { 0%, 100% { transform: none; } 30% { transform: scale(1.12) rotate(-2deg); } 55% { transform: scale(1.12) rotate(2deg); } 75% { transform: scale(1.05); } }
.finish-ring {
  position: absolute; left: 50%; top: 50%; width: 80px; height: 80px; margin: -40px 0 0 -40px; border-radius: 50%;
  border: 4px solid var(--cruche); opacity: 0; animation: ring 1s ease-out forwards;
}
.finish-ring.r2 { border-color: var(--crush); }
@keyframes ring { from { opacity: .9; transform: scale(.4); } to { opacity: 0; transform: scale(9); } }
.confetto { position: absolute; left: 50%; top: 50%; width: 10px; height: 16px; border-radius: 2px; opacity: 0; animation: burst 1.6s cubic-bezier(.1, .8, .3, 1) forwards; }
@keyframes burst { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 140px)) rotate(var(--rot)); } }

/* Toad arrival */
.toad-show {
  position: fixed; inset: 0; z-index: 31; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: radial-gradient(circle at 50% 60%, rgba(18, 120, 80, .95), rgba(4, 30, 40, .97) 72%);
  animation: fade-in .2s ease-out; overflow: hidden;
}
.toad-bubble {
  position: absolute; bottom: -40px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .08); animation: rise 2.6s ease-in infinite;
}
.toad-pond { position: absolute; left: 50%; top: 56%; width: 0; height: 0; }
.toad-ripple {
  position: absolute; width: 120px; height: 44px; margin: -22px 0 0 -60px; border-radius: 50%;
  border: 3px solid rgba(124, 242, 154, .7); opacity: 0; animation: ripple 1.2s ease-out .55s infinite;
}
.toad-ripple.r2 { animation-delay: .9s; }
@keyframes ripple { from { opacity: .9; transform: scale(.3); } to { opacity: 0; transform: scale(3.4); } }
.toad-stage { position: relative; width: 220px; height: 220px; display: grid; place-items: center; }
.toad-body { font-size: 150px; line-height: 1; filter: drop-shadow(0 14px 0 rgba(0, 0, 0, .25)); animation: leap 1.1s cubic-bezier(.3, .7, .4, 1) both, croak .5s ease-in-out 1.1s 3; }
@keyframes leap {
  0% { transform: translateY(520px) scale(.5, 1.3); opacity: 0; }
  55% { transform: translateY(-70px) scale(.9, 1.1); opacity: 1; }
  75% { transform: translateY(0) scale(1.25, .78); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes croak { 50% { transform: scale(1.12, .92); } }
.toad-crown { position: absolute; top: -26px; font-size: 64px; z-index: 2; animation: crown-drop .6s cubic-bezier(.3, 1.6, .5, 1) 1s both; }
@keyframes crown-drop { from { transform: translateY(-260px) rotate(-40deg); opacity: 0; } to { transform: rotate(-8deg); opacity: 1; } }
.toad-speech {
  position: absolute; right: -34px; top: 8px; z-index: 3; padding: 8px 14px; border-radius: 18px 18px 18px 4px;
  background: #fff; color: #0A1A4F; font: 700 22px Fredoka, sans-serif; transform-origin: 0 100%;
  animation: stamp .35s cubic-bezier(.2, 1.6, .4, 1) 1.2s both;
}
.toad-fly { position: absolute; font-style: normal; font-size: 22px; opacity: 0; animation: fly-around 1.8s ease-in-out 1.2s forwards; left: calc(50% + var(--i) * 6px); top: 40%; }
@keyframes fly-around {
  0% { opacity: 0; transform: translate(0, 0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc((var(--i) - 2.5) * 56px), calc(-90px - var(--i) * 12px)) rotate(calc(var(--i) * 70deg)); }
}
.toad-name { font: 700 44px Fredoka, sans-serif; color: var(--toad); text-shadow: 0 5px 0 rgba(0, 0, 0, .3); margin-top: 10px; animation: stamp .5s cubic-bezier(.2, 1.6, .4, 1) 1.3s both; }
.toad-title { font: 500 20px Fredoka, sans-serif; color: #D6FFE3; animation: fade-in .5s ease-out 1.5s both; }
.toad-title b { color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .confetto, .finish-ring, .toad-bubble, .toad-ripple, .toad-fly { display: none; }
  .toad-body, .toad-crown, .fword { animation-duration: .01s; animation-delay: 0s; }
}

.legal { margin: 4px 0 0; }
.legal a { color: var(--muted); text-decoration: underline; }

.leave-btn { padding: 0; width: 34px; height: 34px; border-radius: 50%; font-size: 15px; background: var(--card-strong); color: var(--muted); box-shadow: none; border: 1px solid var(--line); flex: none; }

.word.accuse-target { outline: 2px dashed var(--crush); animation: pulse 1s ease-in-out infinite; cursor: pointer; }

/* Journal dropdown */
.logbox { font-size: 13px; color: var(--muted); }
.logbox summary { cursor: pointer; list-style: none; display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font: 600 13px Fredoka, sans-serif; }
.logbox summary::-webkit-details-marker { display: none; }
.logbox[open] summary { color: var(--text); }
.logbox .feed { margin-top: 8px; max-height: 40dvh; overflow-y: auto; padding: 4px 2px; }

/* Purse and coins */
.phone { padding-bottom: 92px; }
.purse-btn {
  position: fixed; bottom: max(18px, env(safe-area-inset-bottom)); right: calc(50vw - min(50vw, 28.125dvh) + 16px);
  width: 60px; height: 60px; padding: 0; border-radius: 50%; font-size: 30px; z-index: 15;
  background: radial-gradient(circle at 30% 30%, #FFE08A, #C9A84C); box-shadow: 0 5px 0 rgba(0,0,0,.3), 0 0 0 3px rgba(255,255,255,.2);
  animation: purse-wiggle 5s ease-in-out infinite;
}
@keyframes purse-wiggle { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(-10deg); } 96% { transform: rotate(10deg); } }
.purse-count {
  position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; border-radius: 999px; background: var(--crush); color: #fff;
  font: 700 13px Fredoka, sans-serif; display: grid; place-items: center; padding: 0 5px; box-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.purse-sheet { z-index: 25; }
.sheet-backdrop { z-index: 24; }
.coins { display: flex; gap: 8px; justify-content: space-between; }
.coin-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.coin-col b { font: 700 15px Fredoka, sans-serif; }
.coin-col small { font: 500 11px/1.25 Inter, sans-serif; color: var(--muted); min-height: 42px; }
.coin-stack { display: flex; flex-direction: column; gap: 10px; align-items: center; min-height: 150px; }
.coin-slot { perspective: 500px; width: 64px; height: 64px; padding: 0; background: none; box-shadow: none; border-radius: 50%; display: grid; place-items: center; animation: coin-float 2.6s ease-in-out infinite; }
.coin-slot:nth-child(2) { animation-delay: -.8s; } .coin-slot:nth-child(3) { animation-delay: -1.6s; }
@keyframes coin-float { 50% { transform: translateY(-5px); } }
.coin { position: relative; width: 58px; height: 58px; transform-style: preserve-3d; animation: coin-spin 3.6s linear infinite; }
@keyframes coin-spin { to { transform: rotateY(360deg); } }
.coin-face {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; font-size: 28px; backface-visibility: hidden;
  background: radial-gradient(circle at 32% 28%, var(--shine), var(--base) 60%, var(--edge));
  border: 3px solid var(--edge); box-shadow: inset 0 0 0 3px rgba(255,255,255,.25);
}
.coin-face.back { transform: rotateY(180deg); }
.coin-slot.cruche { --shine: #FFF0B3; --base: #FFC93C; --edge: #B8860B; }
.coin-slot.crush { --shine: #FFC2DA; --base: #FF4D8D; --edge: #A0123F; }
.coin-slot.veto { --shine: #E3D4FF; --base: #B794F6; --edge: #5B3AA8; }
.coin-slot.ready .coin-face { box-shadow: inset 0 0 0 3px rgba(255,255,255,.35), 0 0 18px var(--base); }
.coin-slot.ready:active { transform: scale(.92); }
.coin-slot.locked { filter: grayscale(.85) brightness(.65); }
.coin-slot.locked .coin { animation-duration: 10s; }
.coin-slot.used { animation: none; }
.coin-empty { width: 50px; height: 50px; border-radius: 50%; border: 2px dashed var(--line); }
@media (prefers-reduced-motion: reduce) { .coin, .coin-slot, .purse-btn { animation: none; } }
