.wordfall-tab-btn {
  position: relative;
  overflow: hidden;
  border-color: #7f72ff;
  color: #5146bd;
  font-weight: 800;
}

.wordfall-tab-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 15%, rgba(255, 255, 255, 0.8) 48%, transparent 80%);
  transform: translateX(-130%);
  animation: wordfall-tab-shine 5s ease-in-out infinite;
  pointer-events: none;
}

.wordfall-tab-btn.active {
  border-color: #7468ef;
  background: linear-gradient(135deg, #8175ff, #5146bd);
}

.wordfall-panel {
  --wf-violet: #8f83ff;
  --wf-blue: #52c9ff;
  --wf-gold: #ffd66b;
  overflow: hidden;
}

.wordfall-panel-head {
  align-items: center;
  color: #fff;
  margin: -18px -18px 18px;
  padding: 20px 22px;
  background:
    radial-gradient(circle at 82% 15%, rgba(82, 201, 255, 0.42), transparent 34%),
    linear-gradient(135deg, #171447, #42358e 58%, #1a4c7c);
}

.wordfall-panel-head h2 {
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  letter-spacing: 0.04em;
}

.wordfall-panel-head > p {
  margin: 0;
  color: #dfe8ff;
}

.wordfall-kicker {
  margin: 0 0 4px;
  color: #8fe4ff;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.wordfall-setting-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, 0.8fr);
  gap: 14px;
}

.wordfall-setting-card,
.wordfall-exclusion-card {
  border: 1px solid #dcd9ff;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff, #f8f7ff);
  box-shadow: 0 10px 24px rgba(58, 48, 132, 0.08);
}

.wordfall-setting-card {
  padding: 16px;
}

.wordfall-choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 9px;
}

.wordfall-choice-row button {
  border-color: #d7d2ff;
  line-height: 1.15;
  transition: transform 180ms ease, color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.wordfall-choice-row button:hover {
  transform: translateY(-2px);
  border-color: #9186ff;
}

.wordfall-choice-row button.active {
  color: #fff;
  border-color: #6f62e7;
  background: linear-gradient(135deg, #8d81ff, #5b4dcd);
  box-shadow: 0 8px 18px rgba(82, 68, 196, 0.24);
}

.wordfall-choice-row small {
  opacity: 0.78;
  font-size: 0.75rem;
}

.wordfall-selection-summary > strong {
  display: block;
  margin-top: 7px;
  color: #3e348d;
  font-size: 1.7rem;
}

.wordfall-score-rate {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: 11px;
  color: #494170;
  background: #efedff;
  font-weight: 800;
}

.wordfall-score-rate span:last-child {
  color: #5c4dd2;
}

.wordfall-score-rate.is-penalty span:last-child {
  color: #c44b58;
}

.wordfall-exclusion-card {
  margin-top: 14px;
  padding: 16px;
}

.wordfall-exclusion-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.wordfall-exclusion-head h3,
.wordfall-missed-wrap h3 {
  margin: 0 0 5px;
}

.wordfall-exclusion-head .hint {
  margin: 0;
}

.wordfall-exclusion-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-shrink: 0;
}

.wordfall-exclusion-actions button {
  min-height: 40px;
  padding: 8px 11px;
}

.wordfall-card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 310px;
  margin-top: 10px;
  padding: 3px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.wordfall-card-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #e2e0f7;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, border-color 160ms ease, background 160ms ease;
}

.wordfall-card-option:hover {
  transform: translateY(-1px);
  border-color: #aaa2f3;
}

.wordfall-card-option.is-excluded {
  opacity: 0.62;
  border-style: dashed;
  background: #f1f1f6;
}

.wordfall-card-option input {
  width: 19px;
  height: 19px;
  accent-color: #6c5ce7;
}

.wordfall-card-copy {
  min-width: 0;
}

.wordfall-card-copy strong,
.wordfall-card-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wordfall-card-copy strong {
  color: #273958;
  font-size: 0.93rem;
}

.wordfall-card-copy span {
  margin-top: 3px;
  color: #626d86;
  font-size: 0.82rem;
}

.wordfall-length-badge {
  padding: 4px 7px;
  border-radius: 999px;
  color: #706a88;
  background: #efedf8;
  font-size: 0.74rem;
  white-space: nowrap;
}

.wordfall-length-badge.is-long {
  color: #9a4d1e;
  background: #fff0df;
}

.wordfall-start-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.wordfall-audio-btn {
  min-width: 96px;
}

.wordfall-start-btn {
  min-width: min(320px, 68vw);
  color: #17143f;
  border: 0;
  background: linear-gradient(135deg, #ffe184, #ffb84f);
  box-shadow: 0 10px 24px rgba(221, 144, 28, 0.25);
  font-weight: 900;
  letter-spacing: 0.03em;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.wordfall-start-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 14px 28px rgba(221, 144, 28, 0.32);
}

.wordfall-game {
  overflow: hidden;
  border: 1px solid #423b83;
  border-radius: 18px;
  color: #fff;
  background: #0a0b27;
  box-shadow: 0 18px 38px rgba(20, 18, 73, 0.24);
}

.wordfall-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: #34305f;
}

.wordfall-hud > div {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  padding: 10px 8px;
  background: linear-gradient(180deg, #211d4d, #17143d);
}

.wordfall-hud strong {
  color: #fff;
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wordfall-hud-label {
  color: #9eaeef;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.11em;
}

#wordfall-lives {
  color: #ff7696;
  letter-spacing: 0.08em;
}

.wordfall-stage {
  position: relative;
  height: clamp(290px, 46vh, 500px);
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 110%, rgba(86, 82, 192, 0.32), transparent 45%),
    radial-gradient(circle at 15% 20%, rgba(45, 136, 219, 0.23), transparent 25%),
    linear-gradient(180deg, #090a26 0%, #17134c 68%, #39235b 100%);
}

.wordfall-stars,
.wordfall-stars::before,
.wordfall-stars::after {
  position: absolute;
  inset: 0;
  content: "";
  background-image:
    radial-gradient(circle, rgba(255,255,255,.9) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(113,205,255,.75) 0 1px, transparent 1.5px);
  background-position: 18px 28px, 76px 92px;
  background-size: 115px 125px, 173px 160px;
  animation: wordfall-stars-drift 18s linear infinite;
  opacity: 0.68;
}

.wordfall-stars::before {
  transform: scale(1.3) rotate(12deg);
  opacity: 0.42;
  animation-duration: 29s;
}

.wordfall-stars::after {
  transform: scale(0.8) rotate(-9deg);
  opacity: 0.5;
  animation-duration: 12s;
}

.wordfall-meteor {
  position: absolute;
  z-index: 5;
  top: 26px;
  left: 50%;
  width: min(580px, calc(100% - 32px));
  will-change: transform;
}

.wordfall-meteor-core {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 88px;
  padding: 16px 24px;
  border: 2px solid rgba(171, 218, 255, 0.78);
  border-radius: 46% 54% 51% 49% / 58% 45% 55% 42%;
  color: #fff;
  background:
    radial-gradient(circle at 32% 30%, rgba(255,255,255,.32) 0 3%, transparent 4%),
    radial-gradient(circle at 68% 64%, rgba(15,24,79,.34) 0 7%, transparent 8%),
    linear-gradient(145deg, #5679d7, #5b3fa8 68%, #31265d);
  box-shadow:
    0 0 28px rgba(101, 177, 255, 0.56),
    inset -12px -14px 22px rgba(24, 15, 69, 0.38),
    inset 8px 8px 16px rgba(255,255,255,.13);
  animation: wordfall-meteor-float 2.4s ease-in-out infinite alternate;
}

.wordfall-meteor-core span {
  position: relative;
  z-index: 2;
  text-align: center;
  font-size: clamp(1.05rem, 3vw, 1.7rem);
  font-weight: 900;
  line-height: 1.38;
  text-shadow: 0 2px 12px rgba(0,0,0,.45);
}

.wordfall-meteor-tail {
  position: absolute;
  left: 50%;
  bottom: 62%;
  width: 120px;
  height: 220px;
  transform: translateX(-50%);
  transform-origin: bottom;
  clip-path: polygon(44% 100%, 56% 100%, 100% 0, 58% 38%, 50% 4%, 40% 42%, 0 0);
  background: linear-gradient(0deg, rgba(113, 207, 255, 0.72), rgba(139, 108, 255, 0.26) 46%, transparent);
  filter: blur(6px);
  opacity: 0.78;
  animation: wordfall-tail-pulse 800ms ease-in-out infinite alternate;
}

.wordfall-meteor.is-danger .wordfall-meteor-core {
  border-color: #ffb266;
  box-shadow: 0 0 34px rgba(255, 108, 65, 0.72), inset -12px -14px 22px rgba(67, 20, 25, 0.42);
  background: linear-gradient(145deg, #c8686d, #7c315e 68%, #44223e);
}

.wordfall-meteor.is-exploding .wordfall-meteor-core {
  animation: wordfall-meteor-burst 520ms cubic-bezier(.16,.84,.44,1) forwards;
}

.wordfall-stage.is-impact {
  animation: wordfall-impact 420ms cubic-bezier(.36,.07,.19,.97);
}

.wordfall-ground {
  position: absolute;
  z-index: 4;
  right: -5%;
  bottom: -29px;
  left: -5%;
  height: 78px;
  border-top: 3px solid rgba(255, 198, 114, 0.8);
  border-radius: 50% 50% 0 0;
  background: linear-gradient(180deg, #5c3a63, #211636 65%);
  box-shadow: 0 -8px 28px rgba(255, 157, 84, 0.3);
}

.wordfall-ground span {
  position: absolute;
  width: 4px;
  height: 24px;
  bottom: 48px;
  border-radius: 3px;
  background: #ffd997;
  box-shadow: 0 0 10px #ffae6e;
}

.wordfall-ground span:nth-child(1) { left: 12%; height: 17px; }
.wordfall-ground span:nth-child(2) { left: 31%; height: 28px; }
.wordfall-ground span:nth-child(3) { left: 54%; height: 20px; }
.wordfall-ground span:nth-child(4) { left: 72%; height: 31px; }
.wordfall-ground span:nth-child(5) { left: 90%; height: 15px; }

.wordfall-particles {
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
}

.wordfall-particle {
  position: absolute;
  left: 50%;
  top: var(--particle-y, 42%);
  width: var(--particle-size, 8px);
  height: var(--particle-size, 8px);
  border-radius: 50%;
  background: var(--particle-color, #9ce8ff);
  box-shadow: 0 0 12px var(--particle-color, #9ce8ff);
  animation: wordfall-particle-fly 620ms ease-out forwards;
}

.wordfall-points-pop {
  position: absolute;
  z-index: 9;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  color: #ffe281;
  font-size: clamp(1.4rem, 5vw, 2.5rem);
  font-weight: 1000;
  text-shadow: 0 0 18px rgba(255, 198, 78, .75), 0 3px 0 rgba(104, 55, 0, .5);
  opacity: 0;
  pointer-events: none;
}

.wordfall-points-pop.is-showing {
  animation: wordfall-points 700ms cubic-bezier(.18,.82,.24,1) forwards;
}

.wordfall-countdown {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(6, 7, 28, 0.64);
  font-size: clamp(4.5rem, 17vw, 9rem);
  font-weight: 1000;
  text-shadow: 0 0 32px #736dff, 0 0 70px rgba(69, 197, 255, .55);
  backdrop-filter: blur(3px);
}

.wordfall-countdown.hidden,
.wordfall-pause-overlay.hidden {
  display: none;
}

.wordfall-countdown.is-go {
  color: #ffe17d;
  font-size: clamp(3.8rem, 14vw, 7rem);
  text-shadow: 0 0 30px #f3a52e, 0 0 70px rgba(255, 211, 92, .58);
}

.wordfall-countdown.is-popping {
  animation: wordfall-count-pop 720ms cubic-bezier(.16,.88,.3,1) both;
}

.wordfall-pause-overlay {
  position: absolute;
  z-index: 21;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  background: rgba(7, 8, 32, 0.84);
  backdrop-filter: blur(6px);
}

.wordfall-pause-overlay p {
  margin: 0;
  color: #fff;
  font-size: clamp(2.5rem, 8vw, 4.4rem);
  font-weight: 1000;
  letter-spacing: 0.12em;
}

.wordfall-answer-zone {
  padding: 14px 18px 16px;
  background: linear-gradient(180deg, #16133d, #0d0c27);
}

.wordfall-time-line {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  margin-bottom: 9px;
}

.wordfall-time-line > span {
  color: #c7d5ff;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.wordfall-time-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #2a2855;
}

#wordfall-time-bar {
  width: 100%;
  height: 100%;
  transform-origin: left;
  background: linear-gradient(90deg, #ff6d8f, #ffd86b 45%, #62e3c3);
  box-shadow: 0 0 12px rgba(93, 224, 194, .55);
}

.wordfall-answer-zone .label {
  color: #b9c6f2;
}

.wordfall-answer {
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  border: 2px solid #5f5b9c;
  border-radius: 12px;
  color: #fff;
  background: rgba(255,255,255,.08);
  outline: none;
  font: inherit;
  font-size: clamp(1rem, 2.8vw, 1.3rem);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.wordfall-answer:focus {
  border-color: #78d9ff;
  background: rgba(255,255,255,.12);
  box-shadow: 0 0 0 4px rgba(80, 199, 255, .14), 0 0 24px rgba(80, 199, 255, .18);
}

.wordfall-answer.is-wrong {
  border-color: #ff6d88;
  animation: wordfall-answer-shake 260ms ease;
}

.wordfall-live-answer {
  min-height: 24px;
  margin-top: 7px;
  color: #e6eaff;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  overflow-wrap: anywhere;
}

.wordfall-live-answer .is-match { color: #76ebba; }
.wordfall-live-answer .is-miss { color: #ff7894; text-decoration: underline wavy; }
.wordfall-live-answer .is-rest { color: #596289; }

.wordfall-feedback {
  min-height: 25px;
  margin-top: 4px;
  text-align: center;
  font-weight: 900;
}

.wordfall-feedback.is-correct { color: #76ebba; }
.wordfall-feedback.is-wrong { color: #ff8098; }

.wordfall-game-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.wordfall-game-actions button {
  min-height: 38px;
  padding: 7px 11px;
  color: #dce3ff;
  border-color: #4a4778;
  background: rgba(255,255,255,.05);
}

.wordfall-result {
  padding: 28px 18px;
  border: 1px solid #d8d4ff;
  border-radius: 18px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(136, 122, 255, .18), transparent 37%),
    linear-gradient(145deg, #fff, #f6f4ff);
  animation: wordfall-result-enter 520ms cubic-bezier(.16,.84,.28,1) both;
}

.wordfall-result-label {
  margin: 0;
  color: #7166bd;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.wordfall-final-score {
  margin: 2px 0 18px;
  color: #33297d;
  font-size: clamp(3rem, 10vw, 5.6rem);
  font-weight: 1000;
  line-height: 1;
  text-shadow: 0 5px 0 #e0dcff;
}

.wordfall-result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  max-width: 760px;
  margin: 0 auto;
}

.wordfall-result-grid > div {
  padding: 12px 8px;
  border: 1px solid #dfdcf6;
  border-radius: 12px;
  background: rgba(255,255,255,.78);
}

.wordfall-result-grid span,
.wordfall-result-grid strong {
  display: block;
}

.wordfall-result-grid span {
  color: #75718a;
  font-size: 0.78rem;
}

.wordfall-result-grid strong {
  margin-top: 4px;
  color: #3f347f;
  font-size: 1.16rem;
}

.wordfall-missed-wrap {
  max-width: 800px;
  margin: 20px auto 0;
  padding: 15px;
  border-radius: 13px;
  text-align: left;
  background: #fff3f5;
}

.wordfall-result-actions {
  justify-content: center;
  margin-top: 20px;
}

@keyframes wordfall-tab-shine {
  0%, 68% { transform: translateX(-130%); }
  84%, 100% { transform: translateX(130%); }
}

@keyframes wordfall-stars-drift {
  from { background-position: 18px 28px, 76px 92px; }
  to { background-position: 18px 153px, 76px 252px; }
}

@keyframes wordfall-meteor-float {
  from { rotate: -1.2deg; scale: 0.99; }
  to { rotate: 1.2deg; scale: 1.01; }
}

@keyframes wordfall-tail-pulse {
  from { opacity: .48; scale: .92 0.92; }
  to { opacity: .84; scale: 1.08 1.06; }
}

@keyframes wordfall-meteor-burst {
  0% { opacity: 1; scale: 1; filter: brightness(1); }
  36% { opacity: 1; scale: 1.14; filter: brightness(2.4); }
  100% { opacity: 0; scale: .2; filter: brightness(3); }
}

@keyframes wordfall-particle-fly {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0; transform: translate(calc(-50% + var(--particle-x)), calc(-50% + var(--particle-dy))) scale(.2); }
}

@keyframes wordfall-points {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(.5); }
  24% { opacity: 1; transform: translate(-50%, -50%) scale(1.18); }
  70% { opacity: 1; transform: translate(-50%, -72%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -105%) scale(.88); }
}

@keyframes wordfall-count-pop {
  0% { opacity: 0; transform: scale(.35); filter: blur(8px); }
  24% { opacity: 1; transform: scale(1.12); filter: blur(0); }
  66% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.42); filter: blur(3px); }
}

@keyframes wordfall-impact {
  0%, 100% { transform: translate(0, 0); filter: brightness(1); }
  18% { transform: translate(-8px, 3px); filter: brightness(1.7); }
  36% { transform: translate(7px, -2px); }
  55% { transform: translate(-5px, 2px); }
  72% { transform: translate(3px, -1px); }
}

@keyframes wordfall-answer-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

@keyframes wordfall-result-enter {
  from { opacity: 0; transform: translateY(18px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
  .wordfall-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .wordfall-setting-grid,
  .wordfall-card-list {
    grid-template-columns: 1fr;
  }

  .wordfall-card-list {
    max-height: 350px;
  }

  .wordfall-exclusion-head {
    flex-direction: column;
  }

  .wordfall-exclusion-actions {
    flex-wrap: wrap;
  }

  .wordfall-stage {
    height: clamp(270px, 39vh, 390px);
  }

  .wordfall-meteor-core {
    min-height: 78px;
    padding: 13px 17px;
  }

  .wordfall-hud-label {
    display: none;
  }

  .wordfall-hud > div {
    gap: 3px;
    padding-inline: 5px;
  }

  .wordfall-result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .wordfall-choice-row {
    gap: 5px;
  }

  .wordfall-choice-row button {
    padding-inline: 6px;
  }

  .wordfall-start-row {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .wordfall-start-btn {
    min-width: 0;
  }

  .wordfall-answer-zone {
    padding-inline: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wordfall-tab-btn::after,
  .wordfall-stars,
  .wordfall-stars::before,
  .wordfall-stars::after,
  .wordfall-meteor-core,
  .wordfall-meteor-tail,
  .wordfall-particle,
  .wordfall-points-pop.is-showing,
  .wordfall-countdown.is-popping,
  .wordfall-stage.is-impact,
  .wordfall-answer.is-wrong,
  .wordfall-result {
    animation: none !important;
  }
}
