:root {
  --ink: #202124;
  --muted: #65717d;
  --paper: #fffaf0;
  --panel: #ffffff;
  --line: #d8d2c3;
  --green: #1f8a5b;
  --red: #b53b34;
  --yellow: #f4c542;
  --blue: #2f6fad;
  --orange: #df7a2a;
  --shadow: 0 18px 45px rgba(31, 39, 46, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(135deg, rgba(47, 111, 173, 0.16), transparent 36%),
    linear-gradient(315deg, rgba(223, 122, 42, 0.18), transparent 42%),
    var(--paper);
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: var(--blue);
  cursor: pointer;
  min-height: 44px;
  padding: 0 18px;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(32, 33, 36, 0.16);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

select,
input,
textarea {
  min-height: 34px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  padding: 0 34px 0 12px;
}

textarea {
  min-height: 104px;
  padding: 10px 12px;
  resize: vertical;
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0;
}

.game-panel,
.mini-board,
.result-card {
  border: 1px solid rgba(216, 210, 195, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow);
}

.game-panel {
  min-width: 0;
  padding: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  background: #ffffff;
  padding: 0 12px;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.admin-link:hover {
  box-shadow: 0 10px 22px rgba(32, 33, 36, 0.12);
  transform: translateY(-1px);
}

.eyebrow {
  margin: 0;
  color: var(--orange);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2.5vw, 2.25rem);
  line-height: 1;
}

.round-meter {
  min-width: 122px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: right;
}

.meter-track {
  height: 6px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e1d1;
}

.meter-fill {
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 220ms ease;
}

.controls {
  display: grid;
  grid-template-columns: minmax(145px, 1fr) minmax(145px, 1fr) minmax(128px, 0.75fr) minmax(86px, 0.5fr) 48px;
  gap: 8px;
  margin-top: 10px;
}

.balloon-controls {
  grid-template-columns: minmax(145px, 1fr) minmax(145px, 1fr) minmax(128px, 0.75fr) 48px;
}

.controls label {
  display: grid;
  gap: 3px;
}

.controls span,
.stat-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 0 12px;
}

.toggle-row span {
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 800;
  text-transform: none;
}

.toggle-input {
  flex: 0 0 auto;
  width: 20px;
  min-height: 20px;
  border: 0;
  background: transparent;
  margin: 0;
  padding: 0;
  accent-color: var(--green);
  cursor: pointer;
}

.icon-button {
  align-self: end;
  width: 40px;
  min-height: 34px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 10px 0;
}

.scoreboard.timer-off {
  grid-template-columns: repeat(3, 1fr);
}

.scoreboard div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  padding: 7px 10px;
}

.scoreboard strong {
  display: block;
  margin-top: 2px;
  font-size: 1.05rem;
}

.fold-panel {
  margin: 0;
}

.fold-panel > summary {
  display: none;
}

.question-card {
  position: relative;
  overflow: hidden;
  min-height: 176px;
  border-radius: 8px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.18), transparent 44%),
    linear-gradient(120deg, #1f8a5b, #2f6fad 58%, #df7a2a);
  padding: 18px;
}

.question-card.success-pulse {
  animation: successPulse 520ms ease;
}

.question-card.fail-shake {
  animation: failShake 420ms ease;
}

.feedback-face {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: clamp(150px, 24vw, 260px);
  height: clamp(150px, 24vw, 260px);
  border: 7px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 28px 70px rgba(32, 33, 36, 0.32);
  color: #ffffff;
  font-size: clamp(5rem, 17vw, 11rem);
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 8px 20px rgba(32, 33, 36, 0.26);
  transform: translate(-50%, -50%) scale(0.35) rotate(-12deg);
}

.feedback-face.show {
  opacity: 1;
}

.feedback-face.happy {
  background: rgba(31, 138, 91, 0.78);
  animation: faceHappy 900ms cubic-bezier(0.2, 1.45, 0.32, 1) both;
}

.feedback-face.sad {
  background: rgba(181, 59, 52, 0.82);
  animation: faceSad 850ms cubic-bezier(0.2, 1.1, 0.3, 1) both;
}

.feedback-face.fade-out {
  transition: opacity 2000ms ease;
}

.lives-scene {
  --tilt: 0deg;
  position: absolute;
  right: 12px;
  bottom: 8px;
  z-index: 2;
  width: 220px;
  height: 86px;
  pointer-events: none;
}

.lives-hole {
  position: absolute;
  left: 4px;
  bottom: 0;
  width: 48px;
  height: 14px;
  border-radius: 999px;
  background: rgba(32, 33, 36, 0.58);
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.34);
  opacity: 0;
  transform: scaleX(0.65);
  transition: opacity 220ms ease, transform 220ms ease;
}

.lives-scene.lost .lives-hole {
  opacity: 1;
  transform: scaleX(1);
}

.seesaw {
  position: absolute;
  inset: 0;
}

.seesaw-plank {
  position: absolute;
  left: 20px;
  right: 18px;
  bottom: 30px;
  height: 9px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  background: #f4c542;
  box-shadow: 0 8px 18px rgba(32, 33, 36, 0.2);
  transform: rotate(var(--tilt));
  transform-origin: center;
  transition: transform 420ms cubic-bezier(0.2, 1.2, 0.28, 1);
}

.seesaw-pivot {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 0;
  border-left: 17px solid transparent;
  border-right: 17px solid transparent;
  border-bottom: 32px solid rgba(255, 255, 255, 0.76);
  transform: translateX(-50%);
}

.seesaw-character {
  position: absolute;
  left: 18px;
  bottom: 8px;
  width: 32px;
  height: 42px;
  transform-origin: center bottom;
  transition: transform 420ms ease;
}

.character-head {
  position: absolute;
  left: 8px;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fffaf0;
  box-shadow: inset 0 -2px 0 rgba(32, 33, 36, 0.16);
}

.character-body {
  position: absolute;
  left: 4px;
  top: 18px;
  width: 24px;
  height: 22px;
  border-radius: 8px 8px 5px 5px;
  background: #2f6fad;
  box-shadow: inset 0 -3px 0 rgba(32, 33, 36, 0.16);
}

.life-blocks {
  position: absolute;
  right: 2px;
  bottom: -10px;
  z-index: 3;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 3px;
  min-width: 42px;
  height: 62px;
}

.life-block {
  width: 36px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.68);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.36), transparent 42%),
    #555b61;
  box-shadow: 0 5px 0 rgba(32, 33, 36, 0.32);
  animation: blockDrop 280ms ease both;
}

.life-block:nth-child(2) {
  width: 40px;
  height: 13px;
  animation-delay: 45ms;
}

.life-block:nth-child(3) {
  width: 34px;
  height: 13px;
  animation-delay: 90ms;
}

.life-block:nth-child(4) {
  width: 39px;
  height: 13px;
  animation-delay: 135ms;
}

.life-block:nth-child(5) {
  width: 35px;
  height: 13px;
  animation-delay: 180ms;
}

.lives-scene.lost .seesaw-character {
  animation: characterFall 760ms ease-in both;
}

.card-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  pointer-events: none;
}

.card-pattern span {
  position: absolute;
  width: 90px;
  height: 90px;
  border: 8px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
}

.card-pattern span:nth-child(1) {
  top: 24px;
  right: 34px;
}

.card-pattern span:nth-child(2) {
  right: 135px;
  bottom: -30px;
}

.card-pattern span:nth-child(3) {
  top: 108px;
  left: -24px;
}

.card-pattern span:nth-child(4) {
  width: 42px;
  height: 42px;
  right: 46px;
  bottom: 38px;
}

.prompt-type,
.hint-text {
  position: relative;
  z-index: 3;
  max-width: 680px;
}

.prompt-type {
  display: none;
}

.question-card h2 {
  position: relative;
  z-index: 3;
  margin: 0 0 12px;
  font-size: clamp(2.4rem, 7vw, 5.6rem);
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.question-sentence {
  position: relative;
  z-index: 3;
  max-width: 680px;
  margin: -2px 0 10px;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 900;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.road-sign .question-sentence,
.range-sign .question-sentence {
  margin: 4px 0 5px;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1.08rem, 2.2vw, 1.42rem);
  line-height: 1.18;
}

.hint-text {
  min-height: 0;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 700;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.answer-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  border: 2px solid transparent;
  color: var(--ink);
  background: #ffffff;
  box-shadow: none;
  text-align: left;
}

.answer-button .choice-key {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--blue);
  font-size: 0.9rem;
}

.answer-button .choice-text {
  flex: 1;
  min-width: 0;
  font-size: 1.05rem;
  font-weight: 800;
  overflow-wrap: break-word;
}

.answer-button.correct {
  border-color: var(--green);
  background: #ecf8f0;
  animation: answerPop 360ms ease;
}

.answer-button.wrong {
  border-color: var(--red);
  background: #fff0ef;
  animation: answerShake 360ms ease;
}

.answer-button.locked {
  pointer-events: none;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.actions button:nth-child(1) {
  color: var(--ink);
  background: var(--yellow);
}

.actions button:nth-child(2) {
  margin-left: auto;
  background: var(--green);
}

.feedback-row {
  min-height: 24px;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.feedback-row p {
  margin-bottom: 0;
}

.sentence-text {
  display: none;
  margin-top: 6px;
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: #ecf8f0;
  color: #185f40;
  padding: 8px 10px;
  font-size: 0.98rem;
  line-height: 1.35;
}

.sentence-text.show {
  display: block;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.mini-board {
  padding: 18px;
}

.mini-board h2 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.mini-board ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.word-bank,
.missed-list,
.result-review,
.level-times {
  display: grid;
  gap: 8px;
}

.word-bank {
  max-height: 270px;
  overflow: auto;
  padding-right: 2px;
}

.word-pill,
.missed-item,
.level-time-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  padding: 10px 11px;
}

.level-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.word-pill strong,
.missed-item strong,
.level-time-row strong {
  display: block;
}

.word-pill span,
.missed-item span,
.level-time-row span,
.empty-state {
  color: var(--muted);
  font-size: 0.92rem;
}

.word-pill small,
.missed-item small {
  display: block;
  margin-top: 5px;
  color: #185f40;
  font-size: 0.86rem;
  line-height: 1.35;
}

.word-pill.pending small {
  display: none;
}

.word-pill.pending span {
  font-style: italic;
}

.empty-state {
  margin-bottom: 0;
}

.result-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(32, 33, 36, 0.58);
}

.result-modal[hidden] {
  display: none;
}

.result-card {
  position: relative;
  z-index: 1001;
  width: min(560px, 100%);
  padding: 24px;
}

.result-card h2 {
  margin-bottom: 8px;
  font-size: 2rem;
}

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.result-actions button {
  width: 100%;
  margin-top: 0;
  background: var(--green);
}

.result-actions button.secondary {
  color: var(--ink);
  background: #fbfaf6;
  border: 1px solid var(--line);
}

.admin-page {
  min-height: 100vh;
}

.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.admin-stats div,
.admin-card {
  border: 1px solid rgba(216, 210, 195, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.admin-stats div {
  padding: 12px 14px;
}

.admin-stats span,
.admin-form label span,
.list-toolbar label span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-stats strong {
  display: block;
  font-size: 1.35rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.admin-card {
  padding: 16px;
}

.admin-form {
  display: grid;
  gap: 12px;
}

.form-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.form-title-row h2,
.form-title-row p {
  margin-bottom: 4px;
}

.form-title-row p {
  color: var(--muted);
}

.admin-actions,
.admin-footer-actions,
.list-toolbar {
  display: flex;
  gap: 10px;
}

.admin-actions button {
  flex: 1;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #ffffff;
}

.danger-button {
  background: var(--red);
}

.admin-message {
  min-height: 21px;
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.admin-message[data-type="success"] {
  color: var(--green);
}

.admin-message[data-type="error"] {
  color: var(--red);
}

.admin-list-card {
  min-width: 0;
}

.list-toolbar {
  margin-bottom: 12px;
}

.list-toolbar label {
  flex: 1;
}

.admin-word-list {
  display: grid;
  gap: 7px;
  max-height: 62vh;
  overflow: auto;
  padding-right: 4px;
}

.admin-word-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfaf6;
  box-shadow: none;
  text-align: left;
}

.admin-word-row.selected {
  border-color: var(--blue);
  background: #eef5fc;
}

.admin-word-row.potential-duplicate {
  border-color: var(--orange);
  background: #fff7e8;
}

.admin-word-main,
.admin-word-meta {
  min-width: 0;
}

.admin-word-main strong,
.admin-word-main span,
.admin-word-meta span,
.admin-word-meta em {
  display: block;
}

.admin-word-main span,
.admin-word-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-word-main span {
  overflow-wrap: anywhere;
}

.admin-word-meta {
  text-align: right;
}

.admin-word-meta em {
  color: var(--orange);
  font-style: normal;
  font-weight: 800;
}

.admin-footer-actions {
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.admin-footer-actions p {
  margin-bottom: 0;
}

.admin-masterlist-card {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.masterlist-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.masterlist-tools {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 12px;
}

.masterlist-tool {
  display: grid;
  align-content: space-between;
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  padding: 14px;
}

.masterlist-tool h3 {
  margin: 0 0 5px;
  font-size: 1rem;
}

.masterlist-tool p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.masterlist-tool button {
  justify-self: start;
  min-width: 168px;
}

.masterlist-upload {
  grid-template-columns: minmax(0, 1fr) minmax(210px, 0.9fr) auto;
  align-items: end;
}

.file-upload-control {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.file-upload-control > span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.file-upload-control input[type="file"] {
  min-height: 44px;
  padding: 7px;
  color: var(--muted);
  background: #ffffff;
}

.file-upload-control input[type="file"]::file-selector-button {
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  color: #ffffff;
  background: var(--blue);
  padding: 0 12px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.gate-arena {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 460px;
  border-radius: 8px;
  color: #ffffff;
  background:
    radial-gradient(120px 60px at 85% 8%, rgba(255, 255, 255, 0.5), transparent 70%),
    linear-gradient(180deg, #5da3da 0%, #a9d6ef 26%, #d7ecc9 34%, #d7ecc9 34%);
  padding: 16px;
}

.road-sign {
  align-self: center;
  z-index: 3;
  max-width: 620px;
  text-align: center;
  border-radius: 8px;
  background: rgba(32, 33, 36, 0.82);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
  padding: 12px 22px;
}

.road-sign.success-pulse {
  animation: successPulse 520ms ease;
}

.road-sign.fail-shake {
  animation: failShake 420ms ease;
}

.road-sign .prompt-type {
  margin-bottom: 4px;
  color: var(--yellow);
  font-weight: 800;
  text-transform: uppercase;
}

.road-sign h2 {
  margin: 2px 0;
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  line-height: 1;
  overflow-wrap: anywhere;
}


.life-bar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  gap: 4px;
}

.gate-life-block {
  width: 14px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 3px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent 45%),
    var(--red);
  box-shadow: 0 4px 0 rgba(32, 33, 36, 0.3);
  transition: opacity 200ms ease, background 200ms ease, transform 200ms ease;
}

.life-meter {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  width: 96px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  background: rgba(32, 33, 36, 0.35);
  box-shadow: 0 4px 10px rgba(32, 33, 36, 0.3);
  overflow: hidden;
}

.life-meter-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 200ms ease, background 200ms ease;
}

.gate-life-block.lost {
  background: rgba(85, 91, 97, 0.55);
  box-shadow: none;
  opacity: 0.5;
  transform: scaleY(0.7);
}

.gate-life-block.half {
  background:
    linear-gradient(90deg, var(--red) 0 50%, rgba(85, 91, 97, 0.55) 50% 100%),
    var(--red);
}

.lane-field {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 300px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(180deg, #5b6570 0%, #444c54 100%);
  box-shadow: inset 0 0 44px rgba(0, 0, 0, 0.35);
  outline: none;
  touch-action: none;
}

.lane-dividers {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.lane-divider {
  position: absolute;
  top: 132px;
  bottom: 0;
  width: 2px;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0 18px, transparent 18px 36px);
}

.gate-track {
  position: absolute;
  top: -140px;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  height: 132px;
}

.gantry-beam {
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  height: 10px;
  z-index: 1;
  border-radius: 4px;
  background: linear-gradient(180deg, #c3c9cf, #7c848c);
  box-shadow: 0 4px 10px rgba(32, 33, 36, 0.32);
}

.gantry-post {
  position: absolute;
  top: 0;
  width: 9px;
  height: 220px;
  z-index: 1;
  border-radius: 3px;
  background: linear-gradient(180deg, #d2d7dc, #83898f);
  box-shadow: inset -2px 0 0 rgba(32, 33, 36, 0.18);
}

.gantry-post-left {
  left: 1%;
}

.gantry-post-right {
  right: 1%;
}

.highway-sign {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  border: 0;
  background: transparent;
  color: #ffffff;
  padding: 18px 0 0;
}

.sign-strut {
  width: 4px;
  height: 10px;
  margin-bottom: 2px;
  background: #8b939c;
}

.sign-board {
  position: relative;
  width: 84%;
  border-radius: 6px;
  border: 3px solid #ffffff;
  background: linear-gradient(180deg, #1f8a5b, #176b46);
  box-shadow: 0 8px 16px rgba(32, 33, 36, 0.3);
  padding: 8px 6px;
  transition: background 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.sign-label {
  display: block;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 2px rgba(32, 33, 36, 0.35);
}

.highway-sign.active-lane:not(.locked) .sign-board {
  background: linear-gradient(180deg, #2aa876, #1f8a5b);
  border-color: var(--yellow);
  box-shadow: 0 0 14px 3px rgba(244, 197, 66, 0.75), 0 8px 16px rgba(32, 33, 36, 0.3);
}

.highway-sign.correct .sign-board {
  background: linear-gradient(180deg, var(--yellow), #d9a520);
  border-color: #ffffff;
  animation: signGlow 620ms ease;
}

.highway-sign.correct .sign-label {
  color: var(--ink);
  text-shadow: none;
}

.highway-sign.wrong .sign-board {
  background: linear-gradient(180deg, var(--red), #8a2b26);
  animation: answerShake 360ms ease;
}

.highway-sign.locked {
  pointer-events: none;
}

.gate-blast {
  position: absolute;
  z-index: 4;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  pointer-events: none;
  animation: blastPiece 560ms ease-out forwards;
}

.balloon-confetti {
  z-index: 8;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.55);
  animation-duration: 1020ms;
}

.game-car {
  position: absolute;
  left: 50%;
  bottom: 8px;
  z-index: 2;
  width: 28px;
  height: 44px;
  transform: translate(-50%, 0) rotate(0deg);
  transition: opacity 200ms ease;
}

.car-body {
  position: absolute;
  inset: 0;
  border-radius: 11px 11px 6px 6px;
  background: linear-gradient(180deg, #ff6b5e, #c62828 75%);
  box-shadow: 0 8px 16px rgba(32, 33, 36, 0.4), inset 0 -5px 0 rgba(0, 0, 0, 0.16);
}

.car-windshield {
  position: absolute;
  top: 9px;
  left: 50%;
  width: 16px;
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(170, 214, 255, 0.68));
  transform: translateX(-50%);
}

.car-wheel {
  position: absolute;
  width: 6px;
  height: 13px;
  border-radius: 2px;
  background: #202124;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.car-wheel-left-front {
  left: -3px;
  top: 5px;
}

.car-wheel-right-front {
  right: -3px;
  top: 5px;
}

.car-wheel-left-rear {
  left: -3px;
  bottom: 5px;
}

.car-wheel-right-rear {
  right: -3px;
  bottom: 5px;
}

.game-car.zoom {
  animation: carZoom 420ms ease;
}

.game-car.exploding {
  animation: carCrash 340ms ease forwards;
}

@keyframes signGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(244, 197, 66, 0.6), 0 10px 20px rgba(32, 33, 36, 0.35);
    transform: scale(1);
  }
  40% {
    box-shadow: 0 0 0 8px rgba(244, 197, 66, 0.28), 0 10px 20px rgba(32, 33, 36, 0.35);
    transform: scale(1.06);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(244, 197, 66, 0), 0 10px 20px rgba(32, 33, 36, 0.35);
    transform: scale(1);
  }
}

@keyframes blastPiece {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform:
      translate(calc(-50% + var(--blast-x, 0px)), calc(-50% + var(--blast-y, 0px)))
      scale(0.3) rotate(var(--blast-r, 90deg));
  }
}

@keyframes carZoom {
  0% {
    transform: translate(-50%, 0) scale(1);
  }
  40% {
    transform: translate(-50%, 0) scale(1.22) translateY(-6px);
  }
  100% {
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes carCrash {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1) rotate(0deg);
  }
  35% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.15) rotate(-14deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.15) rotate(140deg);
  }
}

@media (max-width: 920px) {
  .game-shell {
    grid-template-columns: 1fr;
  }

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

  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .game-shell {
    width: min(100% - 18px, 1180px);
    padding: 6px 0;
  }

  .game-panel {
    padding: 10px;
  }

  .topbar {
    align-items: center;
  }

  .topbar-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .round-meter {
    width: 100%;
    text-align: left;
  }

  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
  }

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

  .scoreboard {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .scoreboard.timer-off {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .scoreboard div {
    padding: 6px 4px;
    text-align: center;
  }

  .scoreboard .stat-label {
    font-size: 0.58rem;
  }

  .scoreboard strong {
    font-size: 1rem;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .icon-button {
    width: 100%;
    grid-column: span 2;
  }

  .question-card {
    min-height: 152px;
    padding: 14px;
  }

  .feedback-face {
    width: clamp(112px, 40vw, 180px);
    height: clamp(112px, 40vw, 180px);
    border-width: 5px;
    font-size: clamp(3.6rem, 26vw, 7.5rem);
  }

  .lives-scene {
    right: 8px;
    bottom: 6px;
    width: 148px;
    height: 58px;
    opacity: 0.86;
  }

  .seesaw-plank {
    left: 12px;
    right: 10px;
    bottom: 21px;
    height: 7px;
  }

  .seesaw-pivot {
    border-left-width: 12px;
    border-right-width: 12px;
    border-bottom-width: 23px;
  }

  .seesaw-character {
    left: 10px;
    bottom: 6px;
    transform: scale(0.74);
  }

  .life-blocks {
    right: 1px;
    bottom: -8px;
    gap: 2px;
    min-width: 50px;
    transform: scale(0.72);
    transform-origin: right bottom;
  }

  .lives-hole {
    width: 38px;
    height: 11px;
  }

  .actions button,
  .actions button:nth-child(3) {
    width: 100%;
    margin-left: 0;
  }

  .admin-shell {
    width: min(100% - 18px, 1180px);
    padding: 10px 0;
  }

  .admin-topbar,
  .admin-footer-actions,
  .list-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .admin-card {
    padding: 12px;
  }

  .masterlist-tools,
  .masterlist-upload {
    grid-template-columns: 1fr;
  }

  .masterlist-tool button {
    justify-self: stretch;
    width: 100%;
  }

  .admin-word-list {
    max-height: none;
  }

  .admin-word-row {
    grid-template-columns: 1fr;
  }

  .admin-word-meta {
    text-align: left;
  }
}

@media (orientation: portrait) and (max-width: 720px) {
  .gate-arena {
    min-height: 64vh;
  }
}

@keyframes successPulse {
  0% {
    box-shadow: 0 0 0 rgba(31, 138, 91, 0);
    transform: scale(1);
  }
  45% {
    box-shadow: 0 0 0 9px rgba(31, 138, 91, 0.22);
    transform: scale(1.01);
  }
  100% {
    box-shadow: 0 0 0 rgba(31, 138, 91, 0);
    transform: scale(1);
  }
}

@keyframes failShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(7px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(3px);
  }
}

@keyframes answerPop {
  0% {
    transform: scale(1);
  }
  55% {
    transform: scale(1.035);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes answerShake {
  0%,
  100% {
    transform: translateX(0);
  }
  28% {
    transform: translateX(-5px);
  }
  58% {
    transform: translateX(4px);
  }
}

@keyframes blockDrop {
  0% {
    opacity: 0;
    transform: translateY(-16px) scale(0.84);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes characterFall {
  0% {
    transform: translate(0, 0) rotate(0);
  }
  45% {
    transform: translate(-22px, 12px) rotate(-16deg);
  }
  100% {
    transform: translate(-48px, 44px) rotate(-48deg);
    opacity: 0.12;
  }
}

@keyframes faceHappy {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.22) rotate(-24deg);
  }
  42% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.24) rotate(10deg);
  }
  64% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.92) rotate(-5deg);
  }
  82% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0);
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .game-shell {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 6px 0;
  }

  .side-panel {
    display: none;
  }

  .game-panel {
    position: relative;
    padding: 8px 10px;
  }

  .topbar {
    gap: 8px;
  }

  .topbar-actions {
    display: none;
  }

  .eyebrow {
    display: none;
  }

  .topbar h1 {
    font-size: 1.05rem;
  }

  .fold-panel {
    margin-top: 4px;
  }

  #topPanel.fold-panel {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 30;
    margin-top: 0;
    width: auto;
  }

  #topPanel.fold-panel[open] {
    width: min(320px, 92vw);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--line);
    box-shadow: 0 16px 34px rgba(32, 33, 36, 0.3);
    padding: 6px;
  }

  #topPanel.fold-panel[open] > summary {
    margin-bottom: 6px;
  }

  #topPanel.fold-panel > summary {
    padding: 5px 8px;
    font-size: 0.66rem;
    white-space: nowrap;
  }

  .fold-panel > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfaf6;
    padding: 5px 10px;
    color: var(--ink);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    list-style: none;
    user-select: none;
  }

  .fold-panel > summary::-webkit-details-marker {
    display: none;
  }

  .fold-panel > summary::after {
    content: "\25be";
    transition: transform 160ms ease;
  }

  .fold-panel[open] > summary::after {
    transform: rotate(180deg);
  }

  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 0;
  }

  .controls select,
  .controls input {
    min-height: 26px;
    padding: 0 20px 0 6px;
    font-size: 0.76rem;
  }

  .toggle-row {
    min-height: 26px;
    padding: 0 6px;
  }

  .icon-button {
    width: 100%;
    grid-column: span 2;
    min-height: 26px;
  }

  .scoreboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 6px 0 0;
    gap: 4px;
  }

  .scoreboard div {
    padding: 3px 6px;
  }

  .scoreboard .stat-label {
    font-size: 0.55rem;
  }

  .scoreboard strong {
    margin-top: 0;
    font-size: 0.85rem;
  }

  .gate-arena {
    flex-direction: row;
    align-items: stretch;
    min-height: 0;
    height: 64vh;
    margin-top: 6px;
    padding: 8px;
    gap: 8px;
  }

  .lane-field {
    min-height: 0;
    flex: 1;
  }

  .feedback-face {
    width: clamp(90px, 22vh, 150px);
    height: clamp(90px, 22vh, 150px);
    font-size: clamp(2.6rem, 12vh, 5rem);
    border-width: 4px;
  }

  .road-sign {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 0 0 auto;
    width: clamp(110px, 24vw, 190px);
    max-width: none;
    padding: 8px 10px;
  }

  .road-sign .prompt-type {
    margin-bottom: 2px;
    font-size: 0.62rem;
  }

  .road-sign h2 {
    margin: 0;
    font-size: clamp(1rem, 4.4vh, 1.7rem);
  }

  .road-sign .hint-text {
    display: none;
  }
  .actions {
    margin-top: 4px;
  }

  .actions button {
    min-height: 34px;
  }

  .feedback-row {
    min-height: 0;
    margin-top: 4px;
  }

  .sentence-text {
    display: none !important;
  }
}

@keyframes faceSad {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.24) rotate(18deg);
  }
  34% {
    opacity: 1;
    transform: translate(-56%, -50%) scale(1.16) rotate(-10deg);
  }
  52% {
    opacity: 1;
    transform: translate(-44%, -50%) scale(1.06) rotate(8deg);
  }
  70% {
    opacity: 1;
    transform: translate(-53%, -50%) scale(1.02) rotate(-4deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0);
  }
}

.range-arena {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 460px;
  border-radius: 8px;
  color: #ffffff;
  background:
    radial-gradient(140px 70px at 12% 10%, rgba(255, 255, 255, 0.35), transparent 70%),
    linear-gradient(180deg, #274b63 0%, #3c6e8f 30%, #6a9a6b 46%, #4c7a4d 100%);
  padding: 16px;
}

.range-sign {
  align-self: center;
  z-index: 3;
  max-width: 620px;
  text-align: center;
  border-radius: 8px;
  background: rgba(32, 33, 36, 0.82);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
  padding: 12px 22px;
}

.range-sign.success-pulse {
  animation: successPulse 520ms ease;
}

.range-sign.fail-shake {
  animation: failShake 420ms ease;
}

.range-sign .prompt-type {
  margin-bottom: 4px;
  color: var(--yellow);
  font-weight: 800;
  text-transform: uppercase;
}

.range-sign h2 {
  margin: 2px 0;
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.range-field {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 280px;
  overflow: hidden;
  border-radius: 8px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 34px),
    linear-gradient(180deg, #5a8f60 0%, #3f6a45 100%);
  box-shadow: inset 0 0 44px rgba(0, 0, 0, 0.3);
  touch-action: manipulation;
}

@media (hover: hover) and (pointer: fine) {
  .range-field {
    cursor: none;
  }
}

.target-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.shoot-target {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(118px, 21vw, 180px);
  border: 0;
  background: transparent;
  padding: 0;
  transform: translate(-50%, -50%);
  transition: filter 160ms ease;
}

.shoot-target:hover:not(.locked) .target-board {
  box-shadow: 0 0 14px 3px rgba(244, 197, 66, 0.75), 0 8px 16px rgba(32, 33, 36, 0.3);
}

.shoot-target:hover:not(:disabled) {
  transform: translate(-50%, -50%);
}

.target-key {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-bottom: 2px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(32, 33, 36, 0.68);
  font-size: 0.68rem;
  font-weight: 800;
}

.target-post {
  width: 4px;
  height: 10px;
  background: #8b6b4a;
}

.target-board {
  position: relative;
  width: 100%;
  border-radius: 6px;
  border: 3px solid #ffffff;
  background: linear-gradient(180deg, #b53b34, #8a2b26);
  box-shadow: 0 8px 16px rgba(32, 33, 36, 0.3);
  padding: 10px 10px 10px 30px;
  transition: background 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.target-ring {
  position: absolute;
  top: 50%;
  left: 8px;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  transform: translateY(-50%);
  background:
    radial-gradient(circle at center, #b53b34 0 22%, #ffffff 22% 42%, #f4c542 42% 62%, #ffffff 62% 82%, #b53b34 82% 100%);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.target-label {
  display: block;
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 2px rgba(32, 33, 36, 0.35);
}

.shoot-target.correct .target-board {
  background: linear-gradient(180deg, var(--yellow), #d9a520);
  border-color: #ffffff;
  animation: signGlow 620ms ease;
}

.shoot-target.correct .target-label {
  color: var(--ink);
  text-shadow: none;
}

.shoot-target.wrong .target-board {
  background: linear-gradient(180deg, var(--red), #8a2b26);
  animation: answerShake 360ms ease;
}

.shoot-target.wrong:not(.correct) {
  opacity: 0.55;
  filter: grayscale(0.35);
}

.shoot-target.locked {
  pointer-events: none;
}

.crosshair {
  position: absolute;
  z-index: 5;
  width: 46px;
  height: 46px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 120ms ease;
}

.crosshair.show {
  opacity: 1;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
}

.crosshair::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
}

.crosshair::after {
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  transform: translateY(-50%);
}

.crosshair-ring {
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(244, 197, 66, 0.9);
  border-radius: 999px;
}

@media (pointer: coarse) {
  .crosshair {
    display: none;
  }
}

.range-gun {
  position: absolute;
  left: 50%;
  bottom: -6px;
  z-index: 3;
  width: 30px;
  height: 52px;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(var(--aim, 0deg));
  transition: transform 120ms ease-out;
  pointer-events: none;
}

.gun-barrel {
  position: absolute;
  left: 50%;
  top: 0;
  width: 8px;
  height: 30px;
  border-radius: 3px;
  background: linear-gradient(180deg, #3a3f45, #1c1f22);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%);
}

.gun-body {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #4a3120, #2c1c12);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%);
}

.muzzle-flash {
  position: absolute;
  left: 50%;
  top: -4px;
  width: 0;
  height: 0;
  border-radius: 999px;
  background: radial-gradient(circle, #ffffff, var(--yellow) 45%, transparent 72%);
  transform: translate(-50%, -50%);
  opacity: 0;
}

.range-gun.firing .gun-barrel {
  animation: gunRecoil 180ms ease-out;
}

.range-gun.firing .muzzle-flash {
  animation: muzzleFlash 180ms ease-out;
}

@keyframes gunRecoil {
  0% {
    transform: translateX(-50%) translateY(0);
  }
  30% {
    transform: translateX(-50%) translateY(6px);
  }
  100% {
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes muzzleFlash {
  0% {
    width: 0;
    height: 0;
    opacity: 0;
  }
  35% {
    width: 34px;
    height: 34px;
    opacity: 1;
  }
  100% {
    width: 4px;
    height: 4px;
    opacity: 0;
  }
}

.shot-mark {
  position: absolute;
  z-index: 4;
  width: 18px;
  height: 18px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: shotMark 460ms ease-out forwards;
}

.shot-mark::before,
.shot-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 2px solid rgba(244, 197, 66, 0.95);
}

.shot-mark::after {
  inset: 5px;
  border-color: rgba(255, 255, 255, 0.9);
}

.shot-mark.miss::before,
.shot-mark.miss::after {
  border-color: rgba(181, 59, 52, 0.85);
}

@keyframes shotMark {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.4);
  }
  40% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.4);
  }
}

@media (max-width: 720px) {
  .range-arena {
    min-height: 380px;
    padding: 10px;
  }

  .range-field {
    min-height: 260px;
  }

  .shoot-target {
    width: clamp(68px, 24vw, 96px);
  }

  .target-label {
    font-size: 0.74rem;
  }

  .range-sign {
    padding: 8px 14px;
  }
}

@media (orientation: portrait) and (max-width: 720px) {
  .range-arena {
    min-height: 64vh;
  }
}

.deflate-track {
  position: relative;
  z-index: 3;
  height: 7px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.deflate-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--green);
}

@keyframes deflateShrink {
  0% {
    width: 100%;
    background: var(--green);
  }
  60% {
    background: var(--yellow);
  }
  100% {
    width: 0%;
    background: var(--red);
  }
}

.balloon-grid {
  position: relative;
  display: block;
  min-height: 390px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #8fc7ec 0%, #cfeefe 58%, #75a862 58%, #4d7e45 100%);
  box-shadow: inset 0 0 44px rgba(47, 111, 173, 0.22);
  touch-action: none;
  user-select: none;
}

.spike-target {
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 2;
  width: 118px;
  height: 198px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.spike-head {
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: 0;
  height: 0;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-bottom: 158px solid #d7dce0;
  filter: drop-shadow(0 14px 18px rgba(32, 33, 36, 0.35));
  transform: translateX(-50%);
}

.spike-head::after {
  content: "";
  position: absolute;
  left: -10px;
  top: 24px;
  width: 12px;
  height: 112px;
  background: rgba(255, 255, 255, 0.55);
  transform: skewX(-14deg);
}

.spike-base {
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 112px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(180deg, #6d747b, #3d444b);
  box-shadow: 0 14px 22px rgba(32, 33, 36, 0.34);
  transform: translateX(-50%);
}

.balloon-button {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: clamp(104px, 18%, 150px);
  min-height: 132px;
  border: 0;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
  padding: 0;
  text-align: center;
  touch-action: none;
  transform: translate(-50%, -50%);
  transition: left 200ms ease, top 200ms ease, filter 160ms ease, opacity 180ms ease;
}

.balloon-button:hover:not(:disabled),
.balloon-button:focus-visible {
  box-shadow: none;
  transform: translate(-50%, -50%) translateY(-2px);
}

.balloon-button.dragging {
  z-index: 6;
  cursor: grabbing;
  filter: drop-shadow(0 18px 22px rgba(32, 33, 36, 0.32));
  transition: filter 120ms ease;
}

.balloon-button.returning {
  transition: left 220ms ease, top 220ms ease, filter 160ms ease;
}

.balloon-icon {
  position: relative;
  flex: 0 0 auto;
  width: 92px;
  height: 108px;
  border-radius: 50% 50% 48% 48% / 58% 58% 42% 42%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), transparent 45%),
    var(--balloon-color, var(--blue));
  box-shadow: 0 12px 18px rgba(32, 33, 36, 0.28);
  animation: balloonBob 2.4s ease-in-out infinite;
  animation-delay: var(--bob-delay, 0s);
}

.balloon-shine {
  position: absolute;
  top: 16px;
  left: 20px;
  width: 18px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  transform: rotate(-18deg);
}

.balloon-knot {
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 10px solid var(--balloon-color, var(--blue));
  transform: translateX(-50%);
}

.balloon-label {
  position: absolute;
  left: 50%;
  top: 45%;
  z-index: 2;
  display: grid;
  gap: 3px;
  width: 82%;
  color: #ffffff;
  font-weight: 800;
  line-height: 1.08;
  overflow-wrap: break-word;
  text-shadow: 0 2px 4px rgba(32, 33, 36, 0.42);
  transform: translate(-50%, -50%);
}

.balloon-button.correct {
  filter: drop-shadow(0 0 14px rgba(31, 138, 91, 0.8));
}

.balloon-button.popped {
  animation: balloonPop 420ms ease forwards;
}

.balloon-button.wrong {
  filter: drop-shadow(0 0 16px rgba(181, 59, 52, 0.9));
}

.balloon-button.locked {
  pointer-events: none;
}

.balloon-button.locked .balloon-icon {
  animation-play-state: paused;
}

.fireball-burst,
.fireball-spark {
  position: absolute;
  z-index: 7;
  pointer-events: none;
}

.fireball-burst {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: radial-gradient(circle, #ffffff 0 12%, #f4c542 13% 34%, #df7a2a 35% 58%, #b53b34 59% 76%, transparent 77% 100%);
  transform: translate(-50%, -50%);
  animation: fireballBurst 680ms ease-out forwards;
}

.fireball-spark {
  width: 12px;
  height: 12px;
  border-radius: 999px 999px 999px 0;
  background: linear-gradient(135deg, #ffffff, #f4c542 32%, #df7a2a 66%, #b53b34);
  transform: translate(-50%, -50%) rotate(45deg);
  animation: fireballSpark 660ms ease-out forwards;
}

@keyframes balloonBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes balloonPop {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  45% {
    transform: translate(-50%, -50%) scale(1.18);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
}

@keyframes fireballBurst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.35);
  }
  46% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(3.6);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(4.8);
  }
}

@keyframes fireballSpark {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.5) rotate(45deg);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--spark-x)), calc(-50% + var(--spark-y))) scale(0.2) rotate(var(--spark-r));
  }
}

@media (max-width: 720px) {
  .balloon-grid {
    min-height: 360px;
  }

  .spike-target {
    width: 92px;
    height: 158px;
  }

  .spike-head {
    border-left-width: 31px;
    border-right-width: 31px;
    border-bottom-width: 126px;
  }

  .spike-base {
    width: 88px;
    height: 24px;
  }

  .balloon-button {
    width: clamp(86px, 28%, 112px);
    min-height: 112px;
  }

  .balloon-icon {
    width: 74px;
    height: 88px;
  }

  .balloon-label {
    font-size: 0.76rem;
  }
}
