.game-root,
.game-root * {
  box-sizing: border-box;
}

.game-root {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #f3eadc;
  color: #172033;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.fly-game-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #f3eadc;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.fly-game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
}

.fly-hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  width: min(58vw, 560px);
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.fly-word-panel,
.fly-score {
  border: 2px solid rgba(255, 255, 255, 0.84);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 30px rgba(24, 43, 67, 0.16);
  backdrop-filter: blur(10px);
}

.fly-word-panel {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px 10px;
  padding: 6px 10px;
}

.fly-current-image {
  position: absolute;
  left: 9vw;
  top: 50%;
  z-index: 3;
  width: clamp(112px, 13vw, 150px);
  height: clamp(112px, 13vw, 150px);
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(24, 43, 67, 0.18);
  object-fit: contain;
  padding: 7px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.fly-current-image[hidden] {
  display: none;
}

.fly-kicker {
  margin: 0;
  color: #28715f;
  font-size: clamp(9px, 0.86vw, 11px);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fly-word {
  margin: 0;
  color: #172033;
  font-size: clamp(22px, 2.6vw, 36px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.fly-status {
  display: none;
}

.fly-score {
  min-width: 68px;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 10px;
  color: #172033;
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.fly-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 51, 0.4);
  backdrop-filter: blur(5px);
}

.fly-overlay[hidden] {
  display: none;
}

.fly-card {
  width: min(100%, 520px);
  border: 3px solid #ffffff;
  border-radius: 8px;
  padding: clamp(24px, 4vw, 42px);
  background: #ffffff;
  text-align: center;
  box-shadow: 0 24px 60px rgba(21, 32, 48, 0.28);
}

.fly-card h2 {
  margin: 0;
  color: #172033;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

.fly-card p {
  margin: 14px auto 0;
  max-width: 420px;
  color: #526173;
  font-size: clamp(15px, 1.9vw, 18px);
  font-weight: 700;
  line-height: 1.45;
}

.fly-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.fly-button,
.fly-link {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: #245fd0;
  color: #ffffff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(36, 95, 208, 0.24);
  cursor: pointer;
}

.fly-link {
  background: #ff745c;
  box-shadow: 0 12px 24px rgba(255, 116, 92, 0.22);
}

.fly-error {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #f3eadc;
  color: #9f2e24;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 640px) {
  .fly-hud {
    top: max(62px, calc(env(safe-area-inset-top) + 62px));
    width: calc(100vw - 16px);
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .fly-word-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
    padding: 8px 10px;
  }

  .fly-current-image {
    left: 11vw;
    top: max(180px, calc(env(safe-area-inset-top) + 180px));
    width: clamp(96px, 28vw, 124px);
    height: clamp(96px, 28vw, 124px);
    border-radius: 18px;
    transform: translateX(-50%);
  }

  .fly-word {
    font-size: clamp(21px, 7vw, 30px);
  }

  .fly-score {
    min-width: 60px;
    padding: 6px;
  }

  .fly-status {
    font-size: 11px;
  }
}

@media (max-height: 560px) {
  .fly-hud {
    top: max(8px, env(safe-area-inset-top));
    width: min(54vw, 500px);
  }

  .fly-word {
    font-size: clamp(20px, 6vh, 30px);
  }
}
