/* Immersive mobile layout for Verb Drop. Desktop keeps the original composition. */
.game-settings-toggle {
  display: none;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] {
  --game-night: #061226;
  --game-panel: rgba(10, 29, 58, 0.92);
  --game-panel-soft: rgba(18, 47, 84, 0.78);
  --game-cyan: #47e6ff;
  --game-blue: #2d7dff;
  --game-lime: #8df5b5;
  --game-gold: #ffd66b;
  --game-line: rgba(112, 220, 255, 0.28);
  color-scheme: dark;
  background:
    radial-gradient(circle at 50% 20%, rgba(40, 126, 255, 0.3), transparent 38%),
    radial-gradient(circle at 12% 76%, rgba(25, 226, 201, 0.17), transparent 36%),
    linear-gradient(180deg, #071a35 0%, #050d1d 100%);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.24;
  background-image:
    linear-gradient(rgba(89, 197, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(89, 197, 255, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .prototype-shell {
  width: 100%;
  height: calc(var(--ivt-viewport-height, 100dvh) - 65px - 5.75rem - env(safe-area-inset-bottom, 0px));
  min-height: 0;
  margin: 0;
  padding: 0.45rem;
  overflow: hidden;
  place-items: stretch;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .game {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0.48rem;
  border: 1px solid rgba(93, 213, 255, 0.34);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(19, 49, 88, 0.95), rgba(5, 16, 35, 0.98)),
    var(--game-night);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.42rem;
  overflow: hidden;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .game::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% -18%, rgba(69, 224, 255, 0.26), transparent 38%),
    linear-gradient(115deg, transparent 0 48%, rgba(255, 255, 255, 0.035) 49% 51%, transparent 52% 100%);
}

/* Top HUD */
html[data-ivt-device="mobile"] body[data-page="falling-game"] .game > .side-panel:not(.right) {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "brand brand pause restart"
    "score record lives reward";
  gap: 0.34rem;
  overflow: visible;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .brand {
  grid-area: brand;
  min-width: 0;
  padding: 0.2rem 0.38rem;
  border: 0;
  border-left: 3px solid var(--game-cyan);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .brand small {
  display: block;
  color: #7feaff;
  font: 800 0.5rem/1 "Trebuchet MS", sans-serif;
  letter-spacing: 0.14em;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .brand h1 {
  margin: 0.14rem 0 0;
  overflow: hidden;
  color: #fff;
  font: 900 clamp(0.9rem, 4.2vw, 1.16rem)/1 "Trebuchet MS", sans-serif;
  letter-spacing: -0.035em;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .game > .side-panel:not(.right) .stat-pair {
  display: contents;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] #score { grid-area: score; }
html[data-ivt-device="mobile"] body[data-page="falling-game"] #record { grid-area: record; }
html[data-ivt-device="mobile"] body[data-page="falling-game"] #lives { grid-area: lives; }
html[data-ivt-device="mobile"] body[data-page="falling-game"] #reward { grid-area: reward; }
html[data-ivt-device="mobile"] body[data-page="falling-game"] #pause { grid-area: pause; }
html[data-ivt-device="mobile"] body[data-page="falling-game"] #restart { grid-area: restart; }

html[data-ivt-device="mobile"] body[data-page="falling-game"] .stat-card {
  min-width: 0;
  min-height: 40px;
  padding: 0.34rem 0.22rem;
  border: 1px solid rgba(116, 211, 255, 0.22);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(26, 61, 105, 0.86), rgba(10, 28, 54, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 7px 16px rgba(0, 0, 0, 0.18);
  color: #fff;
  text-align: center;
  gap: 0.12rem;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .stat-card::before {
  color: #80b7d9;
  font: 800 0.46rem/1 "Trebuchet MS", sans-serif;
  letter-spacing: 0.06em;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .stat-card strong {
  overflow: hidden;
  color: #fff;
  font: 900 clamp(0.55rem, 2.65vw, 0.7rem)/1.08 "Trebuchet MS", sans-serif;
  overflow-wrap: anywhere;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] #score {
  border-color: rgba(71, 230, 255, 0.44);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] #score strong {
  color: var(--game-cyan);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] #lives {
  border-color: rgba(255, 111, 132, 0.42);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] #lives strong {
  color: #ff9cab;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] #reward strong {
  color: var(--game-gold);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] button.control {
  align-self: stretch;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 0.35rem 0.18rem;
  border: 1px solid rgba(105, 222, 255, 0.46);
  border-radius: 11px;
  background: linear-gradient(180deg, #1b65c6, #124386);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 7px 16px rgba(0, 0, 0, 0.22);
  color: #fff;
  font: 900 clamp(0.55rem, 2.6vw, 0.69rem)/1.08 "Trebuchet MS", sans-serif;
  overflow-wrap: anywhere;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] button.control:active {
  transform: translateY(1px) scale(0.98);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] #restart {
  border-color: rgba(255, 214, 107, 0.46);
  background: linear-gradient(180deg, #725a21, #453510);
  color: #fff0b9;
}

/* Main game arena */
html[data-ivt-device="mobile"] body[data-page="falling-game"] .game-stage {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.34rem;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .question {
  position: relative;
  min-height: 48px;
  padding: 0.68rem 0.72rem;
  border: 1px solid rgba(111, 224, 255, 0.38);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(20, 54, 96, 0.96), rgba(9, 28, 57, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 9px 18px rgba(0, 0, 0, 0.22);
  color: #fff;
  font: 800 clamp(0.82rem, 3.7vw, 1rem)/1.25 Georgia, serif;
  text-align: center;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .question small {
  display: block;
  margin-bottom: 0.2rem;
  color: #7edcf4;
  font: 800 0.58rem/1.15 "Trebuchet MS", sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .blank {
  color: var(--game-gold);
  border-bottom-color: rgba(255, 214, 107, 0.82);
  text-shadow: 0 0 10px rgba(255, 214, 107, 0.42);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .arena {
  position: relative;
  min-height: 0;
  border: 1px solid rgba(76, 218, 255, 0.46);
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(4, 20, 43, 0.42), rgba(3, 13, 29, 0.92)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(74, 195, 255, 0.09) 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(74, 195, 255, 0.07) 32px),
    radial-gradient(circle at 50% 5%, #174c86, #07182f 64%, #040b18);
  box-shadow:
    inset 0 0 34px rgba(38, 166, 255, 0.16),
    0 0 0 1px rgba(7, 16, 34, 0.72),
    0 14px 28px rgba(0, 0, 0, 0.26);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .arena::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.26;
  background: linear-gradient(180deg, transparent 0 48%, rgba(102, 231, 255, 0.2) 50%, transparent 52% 100%);
  background-size: 100% 14px;
  animation: gameScan 4.8s linear infinite;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .arena::after {
  content: attr(data-zone-label);
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  min-height: 39px;
  padding: 0.78rem 0.5rem 0.48rem;
  border-top: 1px solid rgba(141, 245, 181, 0.72);
  background: linear-gradient(180deg, rgba(37, 185, 132, 0.03), rgba(37, 185, 132, 0.23));
  box-shadow: 0 -12px 24px rgba(52, 225, 166, 0.08);
  color: var(--game-lime);
  font: 900 0.55rem/1 "Trebuchet MS", sans-serif;
  letter-spacing: 0.16em;
  text-align: center;
  text-shadow: 0 0 10px rgba(141, 245, 181, 0.48);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .choice {
  --choice-half: min(75px, calc(47% / var(--choice-columns)));
  z-index: 3;
  width: min(150px, calc(94% / var(--choice-columns)));
  min-height: 46px;
  padding: 0.48rem 0.26rem;
  border: 1px solid rgba(126, 228, 255, 0.92);
  border-radius: 13px;
  background: linear-gradient(160deg, #edfaff 0%, #bfe9ff 48%, #81c6f5 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -4px 9px rgba(21, 91, 155, 0.2),
    0 0 0 1px rgba(20, 70, 118, 0.75),
    0 0 18px rgba(70, 213, 255, 0.28),
    0 9px 14px rgba(0, 0, 0, 0.3);
  color: #061c39;
  font: 900 clamp(0.62rem, 3vw, 0.82rem)/1.05 "Trebuchet MS", sans-serif;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .choice:nth-child(4n + 2) {
  border-color: rgba(255, 217, 114, 0.95);
  background: linear-gradient(160deg, #fff8d8 0%, #ffe39a 52%, #eeba54 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -4px 9px rgba(148, 89, 6, 0.18), 0 0 0 1px #795519, 0 0 18px rgba(255, 207, 87, 0.24), 0 9px 14px rgba(0, 0, 0, 0.3);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .choice:nth-child(4n + 3) {
  border-color: rgba(163, 247, 194, 0.95);
  background: linear-gradient(160deg, #effff5 0%, #bdf1cf 52%, #79ce9d 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -4px 9px rgba(24, 108, 67, 0.18), 0 0 0 1px #256843, 0 0 18px rgba(87, 239, 156, 0.2), 0 9px 14px rgba(0, 0, 0, 0.3);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .choice:active {
  filter: brightness(1.08);
  transform: scale(0.97);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .feedback {
  min-height: 34px;
  padding: 0.48rem 0.64rem;
  border: 1px solid rgba(87, 190, 232, 0.18);
  border-radius: 11px;
  background: rgba(4, 18, 39, 0.82);
  color: #9bc2d8;
  font: 700 clamp(0.58rem, 2.8vw, 0.69rem)/1.2 "Trebuchet MS", sans-serif;
  text-align: center;
}

/* Bottom command console */
html[data-ivt-device="mobile"] body[data-page="falling-game"] .side-panel.right {
  grid-column: 1;
  grid-row: 3;
  min-width: 0;
  min-height: 0;
  padding: 0.42rem;
  border: 1px solid rgba(96, 207, 255, 0.24);
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(17, 45, 82, 0.94), rgba(7, 23, 46, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 8px 20px rgba(0, 0, 0, 0.24);
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(86px, 0.85fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0.42rem;
  overflow: hidden;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .start-settings {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0.32rem;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .setting-group {
  min-width: 0;
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr);
  align-items: center;
  gap: 0.3rem;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .setting-label {
  color: #7db0cd;
  font: 800 0.5rem/1.08 "Trebuchet MS", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .setting-buttons {
  min-width: 0;
  gap: 0.24rem;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .setting-button,
html[data-ivt-device="mobile"] body[data-page="falling-game"] .setting-buttons.level-buttons .setting-button {
  min-width: 0;
  min-height: 38px;
  padding: 0.22rem 0.1rem;
  border: 1px solid rgba(121, 197, 233, 0.35);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(31, 70, 119, 0.94), rgba(14, 42, 78, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #bfd6e4;
  font: 900 clamp(0.48rem, 2.35vw, 0.59rem)/1.05 "Trebuchet MS", sans-serif;
  white-space: normal;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .setting-button[aria-pressed="true"] {
  border-color: var(--game-cyan);
  background: linear-gradient(180deg, #16649f, #0d4278);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 12px rgba(71, 230, 255, 0.25);
  color: #fff;
  transform: none;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .speed-setting {
  min-width: 0;
  min-height: 0;
  padding: 0.38rem 0.42rem;
  border: 1px solid rgba(255, 214, 107, 0.28);
  border-radius: 11px;
  background: rgba(5, 18, 39, 0.62);
  box-shadow: none;
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: center;
  gap: 0.18rem;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .speed-setting label {
  color: #f4d77f;
  font: 800 0.5rem/1.05 "Trebuchet MS", sans-serif;
  letter-spacing: 0.05em;
  text-align: center;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .speed-setting input {
  height: 22px;
  margin: 0;
  accent-color: var(--game-gold);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .speed-setting output {
  color: #fff0b8;
  font: 900 0.55rem/1.05 "Trebuchet MS", sans-serif;
  white-space: normal;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .speed-ticks {
  color: #8ca5b5;
  font-size: 0.48rem;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .review {
  inset: 0.42rem;
  z-index: 5;
  padding: 0.9rem;
  border: 1px solid rgba(106, 221, 255, 0.42);
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(14, 39, 73, 0.99), rgba(5, 18, 38, 0.99));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.46);
  color: #d9eaf4;
  font: 700 0.76rem/1.42 "Trebuchet MS", sans-serif;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .review h2 {
  color: var(--game-cyan);
  font: 900 1.18rem/1.05 Georgia, serif;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .review article {
  border-top-color: rgba(112, 204, 242, 0.22);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .review-translation {
  border-left-color: var(--game-gold);
  background: rgba(113, 83, 20, 0.32);
  color: #ffeab0;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .site-footer {
  background: #061226;
  color: #d9eaf4;
}

@keyframes gameScan {
  to { background-position: 0 56px; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-ivt-device="mobile"] body[data-page="falling-game"] .arena::before {
    animation: none;
  }
}

/* Compact portrait phones keep a usable playfield without hiding any controls. */
@media (orientation: portrait) and (max-height: 700px) {
  html[data-ivt-device="mobile"] body[data-page="falling-game"] .prototype-shell {
    padding: 0.28rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .game {
    padding: 0.32rem;
    gap: 0.28rem;
    border-radius: 18px;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .game > .side-panel:not(.right) {
    gap: 0.22rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .brand small {
    display: none;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .stat-card {
    min-height: 34px;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] button.control {
    min-height: 38px;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .question {
    min-height: 40px;
    padding-block: 0.46rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .feedback {
    min-height: 28px;
    padding-block: 0.32rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .side-panel.right {
    padding: 0.28rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .setting-button,
  html[data-ivt-device="mobile"] body[data-page="falling-game"] .setting-buttons.level-buttons .setting-button {
    min-height: 38px;
  }
}

/* In landscape the command console moves to the sides so the arena keeps its height. */
@media (orientation: landscape) and (max-height: 520px) {
  html[data-ivt-device="mobile"] body[data-page="falling-game"] .prototype-shell {
    height: calc(var(--ivt-viewport-height, 100dvh) - 61px - 4.25rem - env(safe-area-inset-bottom, 0px));
    padding: 0.3rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .game {
    padding: 0.34rem;
    border-radius: 17px;
    grid-template-columns: minmax(132px, 0.72fr) minmax(300px, 1.85fr) minmax(170px, 0.95fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 0.34rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .game > .side-panel:not(.right) {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "brand brand"
      "score record"
      "lives reward"
      "pause restart";
    align-content: start;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .brand {
    min-height: 28px;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .brand small {
    display: none;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .brand h1 {
    font-size: 0.78rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .stat-card {
    min-height: 34px;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] button.control {
    min-height: 38px;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .game-stage {
    grid-column: 2;
    grid-row: 1;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .question {
    min-height: 36px;
    padding: 0.42rem 0.54rem;
    font-size: 0.78rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .question small {
    display: none;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .feedback {
    min-height: 27px;
    padding: 0.3rem 0.5rem;
    font-size: 0.56rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .side-panel.right {
    grid-column: 3;
    grid-row: 1;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .setting-group {
    grid-template-columns: 2.6rem minmax(0, 1fr);
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .setting-button,
  html[data-ivt-device="mobile"] body[data-page="falling-game"] .setting-buttons.level-buttons .setting-button {
    min-height: 30px;
    font-size: 0.45rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .speed-setting {
    padding: 0.24rem 0.32rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .speed-ticks {
    display: none;
  }
}

/* One synchronized train: answer blocks first, sentence block immediately below. */
body[data-page="falling-game"] .game-stage {
  position: relative;
  grid-template-rows: minmax(0, 1fr) auto;
}

body[data-page="falling-game"] .question {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

body[data-page="falling-game"] .arena {
  grid-row: 1;
}

body[data-page="falling-game"] .feedback {
  grid-row: 2;
}

body[data-page="falling-game"] .falling-set {
  position: absolute;
  z-index: 4;
  right: 0.55rem;
  left: 0.55rem;
  display: grid;
  gap: 0.5rem;
  transform: translateY(0);
  will-change: transform;
}

body[data-page="falling-game"] .falling-set.is-falling {
  animation: fallingSet var(--duration) linear forwards;
}

body[data-page="falling-game"] .falling-choice-grid {
  min-width: 0;
  padding: 0.2rem;
  display: grid;
  grid-template-columns: repeat(var(--falling-columns), minmax(0, 1fr));
  gap: 0.45rem;
}

body[data-page="falling-game"] .falling-choice-grid.layout-5 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

body[data-page="falling-game"] .falling-choice-grid.layout-5 .choice {
  grid-column: span 2;
}

body[data-page="falling-game"] .falling-choice-grid.layout-5 .choice:nth-child(4) {
  grid-column: 2 / span 2;
}

body[data-page="falling-game"] .falling-choice-grid.layout-5 .choice:nth-child(5) {
  grid-column: 4 / span 2;
}

body[data-page="falling-game"] .falling-set .choice {
  position: relative;
  top: auto !important;
  left: auto !important;
  width: 100% !important;
  max-width: none;
  min-width: 0;
  animation: none;
}

body[data-page="falling-game"] .falling-divider {
  width: calc(100% - 1rem);
  height: 2px;
  justify-self: center;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(73, 184, 225, 0.68) 18%, rgba(73, 184, 225, 0.68) 82%, transparent);
  box-shadow: 0 0 10px rgba(73, 184, 225, 0.22);
}

body[data-page="falling-game"] .falling-sentence {
  width: min(92%, 760px);
  justify-self: center;
  padding: 0.62rem 0.78rem;
  border: 2px solid rgba(44, 101, 180, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 10px 24px rgba(23, 55, 83, 0.22);
  color: #102a43;
  font: 800 clamp(0.78rem, 1.7vw, 1.05rem)/1.22 Georgia, serif;
  text-align: center;
  pointer-events: none;
}

body[data-page="falling-game"] .falling-sentence small {
  display: block;
  margin-bottom: 0.16rem;
  color: #31617c;
  font: 800 0.58rem/1.1 "Trebuchet MS", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body[data-page="falling-game"] .falling-sentence .blank {
  padding-inline: 0.38rem;
}

body[data-page="falling-game"] .arena.is-paused .falling-set {
  animation-play-state: paused;
}

@keyframes fallingSet {
  to { transform: translateY(var(--fall-distance)); }
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .falling-set {
  right: 0.3rem;
  left: 0.3rem;
  gap: 0.42rem;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .falling-choice-grid {
  gap: 0.34rem;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .falling-set .choice {
  min-height: 46px;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .falling-sentence {
  width: 96%;
  padding: 0.52rem 0.56rem;
  border: 1px solid rgba(106, 224, 255, 0.7);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(24, 62, 106, 0.96), rgba(8, 29, 59, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 8px 18px rgba(0, 0, 0, 0.28), 0 0 16px rgba(71, 230, 255, 0.12);
  color: #f2fbff;
  font-size: clamp(0.68rem, 3vw, 0.84rem);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .falling-sentence small {
  color: #71ddf6;
  font-size: 0.5rem;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .falling-sentence .blank {
  color: var(--game-gold);
  border-bottom-color: rgba(255, 214, 107, 0.82);
  text-shadow: 0 0 10px rgba(255, 214, 107, 0.42);
}

@media (orientation: landscape) and (max-height: 520px) {
  html[data-ivt-device="mobile"] body[data-page="falling-game"] .falling-set {
    gap: 0.28rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .falling-set .choice {
    min-height: 42px;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .falling-sentence {
    padding-block: 0.34rem;
    font-size: 0.66rem;
  }
}

/* V2: the arena owns the screen; settings live in a temporary command drawer. */
html[data-ivt-device="mobile"] body[data-page="falling-game"] .game {
  grid-template-rows: auto minmax(0, 1fr);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .game-stage {
  position: relative;
  grid-row: 2;
  grid-template-rows: minmax(0, 1fr) auto;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .arena {
  grid-row: 1;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .feedback {
  grid-row: 2;
  padding-right: 6.9rem;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .game-settings-toggle {
  position: absolute;
  z-index: 12;
  right: 0.26rem;
  bottom: 0.24rem;
  display: block;
  width: 6.25rem;
  min-height: 38px;
  padding: 0.3rem 0.36rem;
  border: 1px solid rgba(255, 214, 107, 0.66);
  border-radius: 9px;
  background: linear-gradient(180deg, #76591c, #3f2f0b);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 5px 12px rgba(0, 0, 0, 0.3);
  color: #fff0b9;
  font: 900 0.58rem/1.08 "Trebuchet MS", sans-serif;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .game-settings-toggle[aria-expanded="true"] {
  border-color: var(--game-cyan);
  background: linear-gradient(180deg, #176ca9, #0a3f70);
  color: #e7fbff;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .side-panel.right {
  position: absolute;
  z-index: 11;
  right: 0.48rem;
  bottom: 2.92rem;
  left: 0.48rem;
  grid-column: auto;
  grid-row: auto;
  max-height: calc(100% - 8rem);
  transform: translateY(calc(100% + 4rem));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 180ms ease, opacity 150ms ease, visibility 0s linear 180ms;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .game.settings-open .side-panel.right {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .game.settings-open .arena {
  filter: saturate(0.72) brightness(0.75);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .choice:nth-of-type(4n + 2) {
  border-color: rgba(255, 217, 114, 0.95);
  background: linear-gradient(160deg, #fff8d8 0%, #ffe39a 52%, #eeba54 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -4px 9px rgba(148, 89, 6, 0.18), 0 0 0 1px #795519, 0 0 18px rgba(255, 207, 87, 0.24), 0 9px 14px rgba(0, 0, 0, 0.3);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .choice:nth-of-type(4n + 3) {
  border-color: rgba(163, 247, 194, 0.95);
  background: linear-gradient(160deg, #effff5 0%, #bdf1cf 52%, #79ce9d 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -4px 9px rgba(24, 108, 67, 0.18), 0 0 0 1px #256843, 0 0 18px rgba(87, 239, 156, 0.2), 0 9px 14px rgba(0, 0, 0, 0.3);
}

@media (orientation: landscape) and (max-height: 520px) {
  html[data-ivt-device="mobile"] body[data-page="falling-game"] .game {
    grid-template-columns: minmax(132px, 0.58fr) minmax(0, 2.42fr);
    grid-template-rows: minmax(0, 1fr);
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .game-stage {
    grid-column: 2;
    grid-row: 1;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .feedback {
    padding-right: 6.6rem;
  }

  html[data-ivt-device="mobile"] body[data-page="falling-game"] .side-panel.right {
    right: 0.36rem;
    bottom: 2.68rem;
    left: auto;
    width: min(340px, calc(100% - 9.2rem));
    max-height: calc(100% - 3.2rem);
  }

}

/* Full-width answer grids and an auto-hiding navigation dock. */
.game-dock-handle {
  display: none;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .falling-set .choice {
  width: 100% !important;
  max-width: none;
  padding-inline: 0.45rem;
  font-size: clamp(0.68rem, 3.25vw, 0.88rem);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .ivt-app-dock {
  transition: transform 220ms ease, opacity 170ms ease, visibility 0s linear 0s;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"].game-dock-collapsed .ivt-app-dock {
  transform: translateY(calc(100% + 1.25rem));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 220ms ease, opacity 170ms ease, visibility 0s linear 220ms;
}

html[data-ivt-device="mobile"] body[data-page="falling-game"].game-dock-collapsed .game-dock-handle {
  position: fixed;
  z-index: 49;
  right: 50%;
  bottom: calc(0.32rem + env(safe-area-inset-bottom, 0px));
  display: grid;
  width: clamp(96px, 33.333vw, 150px);
  min-height: 27px;
  padding: 0;
  transform: translateX(50%);
  place-items: center;
  border: 1px solid rgba(91, 214, 255, 0.5);
  border-radius: 18px 18px 8px 8px;
  background: linear-gradient(180deg, rgba(19, 65, 108, 0.98), rgba(7, 28, 57, 0.98));
  box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--game-cyan);
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .game-dock-handle span {
  width: 12px;
  height: 12px;
  transform: translateY(3px) rotate(45deg);
  border-top: 3px solid currentColor;
  border-left: 3px solid currentColor;
  border-radius: 2px 0 0;
  filter: drop-shadow(0 0 6px rgba(71, 230, 255, 0.42));
}

html[data-ivt-device="mobile"] body[data-page="falling-game"].game-dock-collapsed .prototype-shell {
  height: calc(var(--ivt-viewport-height, 100dvh) - 65px - 2.5rem - env(safe-area-inset-bottom, 0px));
}

html[data-ivt-device="mobile"] body[data-page="falling-game"] .site-footer {
  display: none;
}

@media (orientation: landscape) and (max-height: 520px) {
  html[data-ivt-device="mobile"] body[data-page="falling-game"].game-dock-collapsed .prototype-shell {
    height: calc(var(--ivt-viewport-height, 100dvh) - 61px - 2.15rem - env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-ivt-device="mobile"] body[data-page="falling-game"] .ivt-app-dock {
    transition: none;
  }
}
