/* games-d: the five arcade activities: Lane Dash, Word Moles, Word Beat, Word Bubbles and Frog Hop (see styles.css for the shared tokens and components). */

/* Shared: the layout (ArcadeLayout), the prompt card, the feedback line and text fitted to a box. */

/* The board's room: inset on a phone, the whole main area on a desktop. */
.fill.arcade-board { inset: 8px 16px 0; }
.arcade-prompt { padding: 12px 14px; border-radius: 22px; }
.arcade-label { margin-bottom: 2px; }
.arcade-word { line-height: 1.2; overflow-wrap: anywhere; }
.arcade-soft { color: var(--ink-soft); }
.arcade-speaker { border: 0; padding: 0; }
.arcade-pop { animation: arcadePop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }

/* Under the board on a phone: a fixed height, so a longer line never moves the board. */
.arcade-feedback { padding: 4px 16px 8px; }
.arcade-feedback-line { height: 66px; text-align: center; }
.arcade-say {
  max-width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  font-weight: 800;
  line-height: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.arcade-say-lead { font-weight: 900; }
.arcade-say-idle { color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.arcade-say-right {
  padding: 6px 14px;
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(30, 27, 75, 0.12);
  animation: arcadePop 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
.arcade-say-right .arcade-say-lead { color: #15803D; }
.arcade-say-wrong {
  padding: 6px 14px;
  border-radius: 16px;
  background: #FFE4E9;
  color: #9F1239;
  animation: arcadeShake 0.4s ease both;
}

/* FitText: the text shrinks until it fits; below its smallest size, long words break. */
.fit { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; line-height: 1.12; }
.fit > span { overflow-wrap: normal; word-break: normal; }
.fit.fit-break > span { overflow-wrap: anywhere; }

/* Stars bursting out from a point (a bonked mole, the frog home); --a is each one's direction. */
.arcade-star {
  position: absolute;
  left: 0;
  top: 0;
  line-height: 0;
  animation: arcadeStar 0.7s ease-out both;
}
@keyframes arcadeStar {
  from { transform: translate(-50%, -50%) rotate(var(--a)) translateY(0) scale(0.4); opacity: 1; }
  to { transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(-1 * var(--reach, 46px))) scale(1); opacity: 0; }
}
@keyframes arcadePop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.06); opacity: 1; }
  100% { transform: none; }
}
@keyframes arcadeShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

/* Lane Dash. Sizes scale with --dk (a desktop's bigger road). */

.dash-road {
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: calc(26px * var(--dk));
  background: linear-gradient(#7DD3FC, #38BDF8);
  box-shadow: inset 0 0 0 calc(4px * var(--dk)) #0EA5E9;
  cursor: pointer;
  touch-action: none;
}
.dash-strip { position: absolute; top: 0; bottom: 0; left: calc(12px * var(--dk)); right: calc(12px * var(--dk)); background: rgba(12, 74, 110, 0.18); }
.dash-line {
  position: absolute;
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.95) 50%, rgba(255, 255, 255, 0) 50%);
  background-repeat: repeat-y;
  will-change: transform;
  pointer-events: none;
}
.dash-lanes { position: absolute; inset: 0; display: flex; }
.dash-lane { flex: 1 1 0; transition: background 0.15s; }
.dash-gate { position: absolute; left: 0; top: 0; display: flex; will-change: transform; pointer-events: none; }
.dash-sign-slot { display: flex; justify-content: center; }
.dash-sign {
  box-sizing: border-box;
  padding: calc(5px * var(--dk)) calc(6px * var(--dk));
  border-radius: calc(16px * var(--dk));
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 calc(5px * var(--dk)) 0 #7DD3FC, 0 calc(8px * var(--dk)) calc(16px * var(--dk)) rgba(3, 105, 161, 0.18);
  transition: background 0.15s, color 0.15s;
}
.dash-sign-right { background: #22C55E; color: #fff; box-shadow: 0 calc(5px * var(--dk)) 0 #15803D; animation: dashFlash 0.3s ease-in-out 3; }
.dash-sign-wrong { background: #F43F5E; color: #fff; box-shadow: 0 calc(5px * var(--dk)) 0 #BE123C; }
@keyframes dashFlash { 50% { filter: brightness(1.2); transform: scale(1.06); } }
.dash-runner { position: absolute; left: 0; transition: transform 0.16s ease-out; pointer-events: none; }
.dash-bob { animation: dashBob 0.32s ease-in-out infinite alternate; }
@keyframes dashBob { from { transform: translateY(0); } to { transform: translateY(calc(-5px * var(--dk))); } }
.dash-crash { animation: arcadeShake 0.4s ease both; }
.dash-plus {
  position: absolute;
  left: -50%;
  right: -50%;
  text-align: center;
  font-weight: 900;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 2px 0 #075985, 0 0 8px rgba(7, 89, 133, 0.45);
  white-space: nowrap;
  animation: dashRise 0.8s ease-out both;
}
@keyframes dashRise {
  0% { transform: translateY(0) scale(0.8); opacity: 1; }
  100% { transform: translateY(calc(-46px * var(--dk))) scale(1.15); opacity: 0; }
}

/* Word Moles. Sizes scale with --mk (a hole's size against the phone's). */

.moles-time { height: 8px; border-radius: 4px; overflow: hidden; align-self: center; }
.moles-time-fill { width: 100%; height: 100%; border-radius: 4px; transform-origin: left center; }
.moles-ears { gap: 6px; flex-shrink: 0; border: 0; background: transparent; padding: 4px 0; font: inherit; font-size: 12px; font-weight: 800; color: #3F6212; cursor: pointer; }
.moles-ears-track { position: relative; flex: none; width: 30px; height: 18px; border-radius: 9px; background: #CBD5E1; transition: background 0.2s; }
.moles-ears.on .moles-ears-track { background: #65A30D; }
.moles-ears-knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.moles-ears.on .moles-ears-knob { transform: translateX(12px); }

.moles-field {
  display: grid;
  flex-shrink: 0;
  box-sizing: border-box;
  border-radius: 26px;
  background: linear-gradient(#A3E635, #84CC16);
  box-shadow: inset 0 -6px 0 #65A30D;
  touch-action: none;
}
.moles-shake-A { animation: molesShakeA 0.4s ease both; }
.moles-shake-B { animation: molesShakeB 0.4s ease both; }
@keyframes molesShakeA { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes molesShakeB { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.moles-cell { position: relative; cursor: pointer; }
.moles-unit { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); pointer-events: none; }
/* The hole: a dirt rim, the dark pit in it, and the rim's front half drawn again over the mole. */
.moles-rim, .moles-lip {
  position: absolute;
  left: 50%;
  bottom: calc(2px * var(--mk));
  width: calc(110px * var(--mk));
  height: calc(38px * var(--mk));
  margin-left: calc(-55px * var(--mk));
  box-sizing: border-box;
  border-radius: 50%;
}
.moles-rim { background: #A16207; box-shadow: inset 0 calc(3px * var(--mk)) 0 #CA8A04; }
.moles-lip {
  border: solid #A16207;
  border-width: calc(6px * var(--mk)) calc(8px * var(--mk));
  clip-path: inset(50% 0 0 0);
}
.moles-pit {
  position: absolute;
  left: 50%;
  bottom: calc(8px * var(--mk));
  width: calc(94px * var(--mk));
  height: calc(26px * var(--mk));
  margin-left: calc(-47px * var(--mk));
  border-radius: 50%;
  background: #3E2716;
  box-shadow: inset 0 calc(6px * var(--mk)) 0 #24160B;
}
/* Clips the mole at the pit's middle only, so its sign may rise above the cell. */
.moles-clip { position: absolute; left: -40%; right: -40%; bottom: calc(21px * var(--mk)); height: 400%; overflow: hidden; }
.moles-mole { position: absolute; left: 50%; bottom: 0; display: flex; flex-direction: column; align-items: center; will-change: transform; }
.moles-sign {
  box-sizing: border-box;
  width: calc(104px * var(--mk));
  height: calc(42px * var(--mk));
  padding: calc(3px * var(--mk)) calc(5px * var(--mk));
  border-radius: calc(10px * var(--mk));
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 calc(3px * var(--mk)) 0 #A3E635;
}
.moles-stick { width: calc(4px * var(--mk)); height: calc(7px * var(--mk)); background: #A16207; }
.moles-face { line-height: 0; transform-origin: 50% 100%; }
.moles-laugh { animation: molesWiggle 0.16s ease-in-out infinite alternate; }
.moles-dizzy { animation: molesSquash 0.35s ease-out both; }
@keyframes molesWiggle { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
@keyframes molesSquash { 0% { transform: scale(1.12, 0.78); } 60% { transform: scale(0.95, 1.05); } 100% { transform: none; } }
.moles-burst { position: absolute; left: 50%; bottom: calc(66px * var(--mk)); width: 0; height: 0; z-index: 3; }

/* Word Beat. Sizes scale with --bk (a desktop's taller lanes). */

.beat-slots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.beat-slot {
  min-width: 40px;
  height: 38px;
  padding: 0 10px;
  box-sizing: border-box;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
}
.beat-slot-done { background: #22C55E; color: #fff; box-shadow: 0 3px 0 #15803D; animation: arcadePop 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
.beat-slot-next { background: #fff; color: var(--ring); box-shadow: inset 0 0 0 3px var(--ring); }
.beat-slot-empty { background: #F5F3FF; box-shadow: inset 0 0 0 2px var(--line); }
.beat-field {
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: calc(26px * var(--bk));
  background: linear-gradient(#4C1D95, #7C3AED);
  cursor: pointer;
  touch-action: none;
}
.beat-lanes { position: absolute; inset: 0; display: flex; }
.beat-lane { position: relative; flex: 1 1 0; background: linear-gradient(to bottom, var(--lane-faint), var(--lane-soft)); border-right: 2px solid rgba(255, 255, 255, 0.12); }
.beat-lane:last-child { border-right: 0; }
.beat-flash { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 25%, var(--lane-strong)); animation: beatFade 0.3s ease-out both; pointer-events: none; }
@keyframes beatFade { from { opacity: 1; } to { opacity: 0; } }
.beat-line {
  position: absolute;
  left: 0;
  right: 0;
  height: calc(20px * var(--bk));
  margin-top: calc(-10px * var(--bk));
  box-sizing: border-box;
  background: rgba(253, 224, 71, 0.22);
  border-top: calc(3px * var(--bk)) solid #FDE047;
  border-bottom: calc(3px * var(--bk)) solid #FDE047;
  box-shadow: 0 0 calc(18px * var(--bk)) rgba(253, 224, 71, 0.55);
  pointer-events: none;
}
.beat-note {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  padding: 0 calc(6px * var(--bk));
  border-radius: calc(14px * var(--bk));
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 calc(4px * var(--bk)) 0 rgba(0, 0, 0, 0.25);
  will-change: transform, opacity;
  pointer-events: none;
  z-index: 1;
}
.beat-note-hit { background: #22C55E; color: #fff; }
.beat-note-wrong { background: #F43F5E; color: #fff; }
/* Over the notes that fall on past the line. */
.beat-pads { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; box-sizing: border-box; pointer-events: none; }
.beat-pad { position: relative; flex: 1 1 0; overflow: hidden; border-radius: calc(16px * var(--bk)); box-shadow: 0 calc(5px * var(--bk)) 0 rgba(0, 0, 0, 0.3); }
.beat-pad-hit { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.65); animation: beatFade 0.25s ease-out both; }
.beat-pad .keycap { margin-top: 0; position: relative; }
.beat-judge {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-weight: 900;
  white-space: nowrap;
  text-shadow: 0 2px 0 #4C1D95;
  pointer-events: none;
  z-index: 3;
  animation: beatRise 0.9s ease-out both;
}
.beat-judge-perfect { color: #FDE047; }
.beat-judge-good { color: #86EFAC; }
.beat-judge-off { color: #E9D5FF; }
.beat-judge-wrong { color: #FDA4AF; }
.beat-judge-missed { color: #CBD5E1; }
@keyframes beatRise {
  0% { transform: translateY(0) scale(0.8); opacity: 1; }
  100% { transform: translateY(calc(-40px * var(--bk))) scale(1.15); opacity: 0; }
}

/* Word Bubbles */

.bubbles-board { border-radius: 26px; background: linear-gradient(#E0E7FF, #F5F7FF); box-shadow: inset 0 0 0 3px #C7D2FE; overflow: hidden; touch-action: none; }
/* A glossy bubble in --bubble, darker (--bubble-ledge) towards its edge. */
.bubble {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.95) 0 8%, rgba(255, 255, 255, 0) 24%),
    radial-gradient(circle at 50% 42%, var(--bubble) 58%, var(--bubble-ledge) 108%);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.1), 0 2px 0 rgba(30, 27, 75, 0.16);
}
.bubbles-word { color: var(--ink); font-weight: 900; transition: transform 0.25s ease-out; }
.bubbles-word.live { cursor: pointer; }
.bubbles-text { line-height: 1.05; }
.bubbles-pop, .bubbles-shot { pointer-events: none; }
.bubbles-shot { z-index: 2; }
.bubbles-line { position: absolute; border-top: 3px dashed #FDA4AF; pointer-events: none; }
.bubbles-cannon { position: absolute; border-radius: 14px 14px 8px 8px; pointer-events: none; }
.bubbles-card { position: absolute; box-sizing: border-box; padding: 8px 10px; border-radius: 16px; display: flex; flex-direction: column; }
.bubbles-meaning { flex: 1 1 0; min-height: 0; font-weight: 800; color: var(--ink); }
.bubbles-side { position: absolute; text-align: center; padding: 0 4px; }
.bubbles-rows { font-size: 12px; font-weight: 800; line-height: 15px; }

/* Frog Hop. Sizes scale with --fk (a desktop's bigger river). */

.frog-side { align-items: center; gap: 6px; }
.frog-crossings { padding: 2px 8px; border-radius: 999px; color: #fff; font-size: 11px; font-weight: 800; white-space: nowrap; }
.frog-river { position: relative; flex-shrink: 0; overflow: hidden; border-radius: calc(26px * var(--fk)); background: #38BDF8; touch-action: none; }
.frog-bank { position: absolute; left: 0; right: 0; background: #86EFAC; }
.frog-far { top: 0; box-shadow: inset 0 calc(-6px * var(--fk)) 0 #4ADE80; }
.frog-start { bottom: 0; box-shadow: inset 0 calc(6px * var(--fk)) 0 #4ADE80; }
.frog-water { position: absolute; left: 0; right: 0; }
.frog-water-a { background-color: #0EA5E9; }
.frog-water-b { background-color: #38BDF8; }
/* Soft ripples on the water. */
.frog-water {
  background-image:
    radial-gradient(ellipse calc(16px * var(--fk)) calc(2.5px * var(--fk)) at 30% 30%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)),
    radial-gradient(ellipse calc(12px * var(--fk)) calc(2px * var(--fk)) at 75% 75%, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
  background-size: calc(110px * var(--fk)) calc(46px * var(--fk));
}
.frog-log {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  padding: 0 calc(var(--lh) * 0.5);
  border-radius: 999px;
  background: #A16207;
  box-shadow: inset 0 calc(-6px * var(--fk)) 0 #854D0E, 0 calc(3px * var(--fk)) 0 rgba(0, 0, 0, 0.18);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  will-change: transform;
  transition: opacity 0.2s, box-shadow 0.2s;
}
/* The log's cut ends: rings of wood. */
.frog-log::before, .frog-log::after {
  content: "";
  position: absolute;
  top: 22%;
  height: 50%;
  aspect-ratio: 0.72;
  border-radius: 50%;
  background: radial-gradient(closest-side, #E9B872 0 28%, #B7791F 30% 44%, #E9B872 46% 70%, #B7791F 72% 100%);
}
.frog-log::before { left: calc(var(--lh) * 0.1); }
.frog-log::after { right: calc(var(--lh) * 0.1); }
.frog-log-on { box-shadow: inset 0 calc(-6px * var(--fk)) 0 #854D0E, 0 0 0 calc(3px * var(--fk)) #FDE047, 0 0 calc(16px * var(--fk)) rgba(253, 224, 71, 0.85); }
.frog-log-dim { filter: saturate(0.5) brightness(0.93); }
.frog-sink { animation: frogSink 0.9s ease-in both; }
@keyframes frogSink { to { opacity: 0.2; filter: brightness(0.6); scale: 0.92; } }
.frog-log-text { position: relative; z-index: 1; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); line-height: 1.1; }
.frog-frog { position: absolute; left: 0; top: 0; z-index: 3; line-height: 0; will-change: transform; pointer-events: none; }
.frog-cheer { animation: frogCheer 0.45s ease-in-out infinite alternate; }
@keyframes frogCheer { from { transform: translateY(0); } to { transform: translateY(-12%); } }
.frog-stars { position: absolute; left: 50%; top: 35%; width: 0; height: 0; }
.frog-splash { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 3; }
.frog-ring {
  position: absolute;
  left: calc(var(--size) / -2);
  top: calc(var(--size) / -2);
  width: var(--size);
  height: var(--size);
  box-sizing: border-box;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, 0.9);
  animation: frogRing 0.7s ease-out both;
}
.frog-ring-late { animation-delay: 0.15s; }
@keyframes frogRing { 0% { transform: scale(0.2, 0.1); opacity: 1; } 100% { transform: scale(1.4, 0.7); opacity: 0; } }

/* Big screens and mice. */
@media (hover: hover) {
  .dash-lane:hover { background: rgba(255, 255, 255, 0.1); }
  .moles-cell:hover .moles-rim { filter: brightness(1.08); }
  .bubbles-word.live:hover { filter: brightness(1.05); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(67, 56, 202, 0.45); }
  .frog-log-on:hover { filter: brightness(1.12); }
}
@media (min-width: 900px) {
  .fill.arcade-board { inset: 4px 0 0; }
  .arcade .gs-bottom { padding-top: 4px; }
  .arcade-feedback { padding: 0 16px; }
  .arcade-feedback-line { height: auto; min-height: 72px; }
  .arcade-say { font-size: 16px; line-height: 22px; -webkit-line-clamp: 5; }
  .arcade-say-idle { font-size: 15px; line-height: 21px; }
}
