html.meteor-controls-v107 .meteor-v107-controls-panel {
  max-height: min(68vh, 700px);
  overflow-y: auto;
  border-color: rgba(125, 249, 255, 0.3);
  background:
    linear-gradient(145deg, rgba(4, 13, 28, 0.96), rgba(7, 18, 34, 0.9)),
    repeating-linear-gradient(90deg, rgba(125, 249, 255, 0.035) 0 1px, transparent 1px 48px);
}

html.meteor-controls-v107 .menu-actions {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}

html.meteor-controls-v107 .menu {
  max-height: calc(100vh - var(--meteor-safe-top) - var(--meteor-safe-bottom) - 16px) !important;
}

html.meteor-controls-v107 .meteor-v107-sr-only {
  position: fixed;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html.meteor-controls-v107 .meteor-v107-controls-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin: 10px 0 16px;
  color: #d9e8f2;
  line-height: 1.5;
}

html.meteor-controls-v107 .meteor-v107-controls-intro p {
  margin: 0;
}

html.meteor-controls-v107 .meteor-v107-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

html.meteor-controls-v107 .meteor-v107-binding-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 11px 12px;
  border: 1px solid rgba(125, 249, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

html.meteor-controls-v107 .meteor-v107-binding-copy strong,
html.meteor-controls-v107 .meteor-v107-binding-copy span {
  display: block;
}

html.meteor-controls-v107 .meteor-v107-binding-copy strong {
  color: #f5fbff;
  font-size: 14px;
}

html.meteor-controls-v107 .meteor-v107-binding-copy span {
  margin-top: 4px;
  color: rgba(217, 232, 242, 0.72);
  font-size: 12px;
  line-height: 1.35;
}

html.meteor-controls-v107 .meteor-v107-key-button {
  min-width: 104px;
  min-height: 44px;
  padding: 8px 12px;
  border-color: rgba(125, 249, 255, 0.42);
  background: linear-gradient(180deg, rgba(18, 47, 67, 0.98), rgba(5, 19, 32, 0.98));
  color: #eafaff;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.36), 0 8px 20px rgba(0, 0, 0, 0.22);
  white-space: nowrap;
}

html.meteor-controls-v107 .meteor-v107-key-button.listening {
  border-color: #ffd166;
  color: #fff2bd;
  animation: meteorV107BindingPulse 0.8s ease-in-out infinite alternate;
}

@keyframes meteorV107BindingPulse {
  from { box-shadow: 0 0 0 rgba(255, 209, 102, 0); }
  to { box-shadow: 0 0 22px rgba(255, 209, 102, 0.28); }
}

html.meteor-controls-v107 .meteor-v107-control-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

html.meteor-controls-v107 .meteor-v107-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.04);
  color: #dcecf5;
  cursor: pointer;
}

html.meteor-controls-v107 .meteor-v107-toggle input {
  width: 20px;
  height: 20px;
  accent-color: #7df9ff;
}

html.meteor-controls-v107 .meteor-v107-controls-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(125, 249, 255, 0.14);
}

html.meteor-controls-v107 .meteor-v107-controls-status {
  flex: 1 1 260px;
  color: #7df9ff;
  font-size: 12px;
  line-height: 1.4;
}

html.meteor-controls-v107 .meteor-v107-target-status {
  padding: 8px 10px;
  border: 1px solid rgba(125, 249, 255, 0.18);
  border-radius: 11px;
  background: rgba(2, 8, 18, 0.86);
  color: #9be7ff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

html.meteor-controls-v107 .meteor-v107-target-status.manual {
  border-color: rgba(255, 209, 102, 0.5);
  color: #ffd166;
}

html.meteor-controls-v107 .meteor-v107-paused-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 3px solid #7df9ff;
  border-radius: 8px;
  background: rgba(73, 245, 255, 0.075);
  color: #dffaff;
  font-size: 13px;
}

html.meteor-controls-v107.meteor-keyboard-mode button:hover {
  transform: none;
}

html.meteor-controls-v107 [inert] {
  pointer-events: none !important;
  user-select: none !important;
}

html.meteor-touch-game,
html.meteor-touch-game body,
html.meteor-touch-game canvas {
  cursor: none !important;
}

html.meteor-touch-game .meteor-custom-cursor-reticle {
  display: none !important;
}

html.meteor-touch-game {
  overflow: hidden;
  width: 100%;
}

html.meteor-touch-game body,
html.meteor-touch-game .game-shell {
  width: 100% !important;
  height: 100dvh !important;
}

/* An old canvas width must not enlarge the mobile layout viewport on rotation. */
html.meteor-touch-game body > canvas {
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
}

#meteorTouchControls {
  position: fixed;
  inset: 0;
  z-index: 2800;
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  box-sizing: border-box;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

html.meteor-touch-playing #meteorTouchControls {
  display: flex;
}

#meteorTouchStick {
  width: clamp(112px, 24vw, 158px);
  height: clamp(112px, 24vw, 158px);
  margin-bottom: 8px;
  display: grid;
  place-items: center;
  pointer-events: auto;
  touch-action: none;
}

.meteor-touch-stick-ring {
  width: 100%;
  height: 100%;
  position: relative;
  display: grid;
  place-items: center;
  border: 2px solid rgba(125, 249, 255, .5);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(73, 245, 255, .13), rgba(4, 13, 28, .48) 70%);
  box-shadow: inset 0 0 25px rgba(73, 245, 255, .1), 0 5px 20px rgba(0, 0, 0, .28);
}

.meteor-touch-stick-ring::before,
.meteor-touch-stick-ring::after {
  content: '';
  position: absolute;
  background: rgba(125, 249, 255, .22);
}

.meteor-touch-stick-ring::before { width: 1px; height: 72%; }
.meteor-touch-stick-ring::after { height: 1px; width: 72%; }

.meteor-touch-stick-knob {
  position: absolute;
  width: 42%;
  height: 42%;
  border: 2px solid rgba(180, 255, 255, .78);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, rgba(73, 245, 255, .78), rgba(12, 49, 69, .86));
  box-shadow: 0 0 18px rgba(73, 245, 255, .35);
  transition: transform 45ms linear;
}

.meteor-touch-actions {
  display: grid;
  justify-items: end;
  gap: 12px;
  margin-bottom: 12px;
  pointer-events: auto;
}

.meteor-touch-actions button {
  min-width: 78px;
  min-height: 64px;
  padding: 8px;
  border: 1px solid rgba(255, 209, 102, .72);
  border-radius: 18px;
  background: rgba(18, 24, 38, .84);
  color: #fff5d5;
  font: 900 12px/1 system-ui, sans-serif;
  letter-spacing: .02em;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .3), inset 0 0 15px rgba(255, 209, 102, .12);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.meteor-touch-actions button:active {
  transform: scale(.94);
  background: rgba(96, 58, 20, .9);
}

#meteorTouchAbility { border-color: rgba(73, 245, 255, .72); color: #d9fcff; }

html.meteor-touch-game #universalAbilityHud { display: none !important; }

html.meteor-touch-game #meteorGlobalChatOverlay {
  top: var(--meteor-safe-top) !important;
  right: calc(var(--meteor-safe-right) + 52px) !important;
  bottom: auto !important;
  left: auto !important;
  width: 56px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

#meteorGlobalChatToggle,
#meteorGlobalChatPreview {
  display: none;
}

html.meteor-touch-game #meteorGlobalChatToggle,
html.meteor-in-combat #meteorGlobalChatToggle,
#meteorTouchPause {
  display: block;
  width: 56px;
  height: 44px;
  padding: 4px;
  border: 1px solid rgba(125, 249, 255, .4);
  border-radius: 8px;
  color: #eaf8ff;
  background: rgba(3, 12, 24, .85);
  font: 700 11px/1 system-ui, sans-serif;
  letter-spacing: 0;
  pointer-events: auto;
  touch-action: manipulation;
}

#meteorTouchPause {
  position: fixed;
  top: var(--meteor-safe-top);
  right: var(--meteor-safe-right);
  width: 44px;
}

html.meteor-touch-game #meteorGlobalChatOverlay:not(.meteor-chat-expanded) header > :not(#meteorGlobalChatToggle),
html.meteor-touch-game #meteorGlobalChatOverlay:not(.meteor-chat-expanded) #meteorGlobalChatMessages,
html.meteor-touch-game #meteorGlobalChatOverlay:not(.meteor-chat-expanded) .meteor-online-chat-compose {
  display: none !important;
}

/* Desktop combat: fold the chat to its button like on touch screens. */
html.meteor-in-combat #meteorGlobalChatOverlay:not(.meteor-chat-expanded) header > :not(#meteorGlobalChatToggle):not(#meteorGlobalSupportButton),
html.meteor-in-combat #meteorGlobalChatOverlay:not(.meteor-chat-expanded) #meteorGlobalChatMessages,
html.meteor-in-combat #meteorGlobalChatOverlay:not(.meteor-chat-expanded) .meteor-online-chat-compose {
  display: none !important;
}
html.meteor-in-combat #meteorGlobalChatOverlay:not(.meteor-chat-expanded) {
  width: auto !important;
  padding: 4px !important;
}

html.meteor-touch-game #meteorGlobalChatPreview:not([hidden]) {
  display: block;
  position: fixed;
  top: calc(var(--meteor-safe-top) + 106px);
  left: var(--meteor-safe-left);
  width: min(300px, calc(100vw - var(--meteor-safe-left) - var(--meteor-safe-right)));
  padding: 4px 6px;
  box-sizing: border-box;
  color: #eaf8ff;
  background: rgba(2, 8, 18, .6);
  font: 11px/1.3 system-ui, sans-serif;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
}

html.meteor-touch-game #meteorGlobalChatOverlay.meteor-chat-expanded {
  top: calc(var(--meteor-safe-top) + 52px) !important;
  right: var(--meteor-safe-right) !important;
  width: min(300px, calc(100vw - var(--meteor-safe-left) - var(--meteor-safe-right))) !important;
  padding: 8px !important;
  box-sizing: border-box;
  border: 1px solid rgba(125, 249, 255, .4) !important;
  border-radius: 8px !important;
  background: rgba(3, 12, 24, .94) !important;
}

html.meteor-touch-game #meteorGlobalChatOverlay.meteor-chat-expanded header {
  flex-wrap: wrap;
  gap: 6px;
}

html.meteor-touch-game #meteorGlobalChatOverlay.meteor-chat-expanded #meteorGlobalChatPreview {
  display: none;
}

html.meteor-touch-game #meteorGlobalChatStatus {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.meteor-touch-game #meteorGlobalChatMessages {
  max-height: min(130px, 22dvh) !important;
  min-height: 20px !important;
}

html.meteor-touch-game #meteorGlobalChatOverlay input,
html.meteor-touch-game #meteorGlobalChatOverlay button {
  min-height: 44px;
}

html.meteor-touch-game #meteorTouchControls {
  padding: 0 var(--meteor-safe-right) var(--meteor-safe-bottom) var(--meteor-safe-left);
}

html.meteor-touch-game #meteorTouchStick {
  width: 108px;
  height: 108px;
  margin: 0;
}

html.meteor-touch-game .meteor-touch-actions {
  gap: 8px;
  margin: 0;
}

html.meteor-touch-game .meteor-touch-actions button {
  width: 76px;
  height: 56px;
  min-width: 0;
  min-height: 0;
  border-radius: 8px;
  letter-spacing: 0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

html.meteor-touch-game .meteor-touch-actions button[aria-disabled="true"] {
  color: #becbd2;
  border-color: rgba(190, 203, 210, .5);
}

html.meteor-touch-game.meteor-presentation-v106 .meteor-v106-top-rail {
  left: var(--meteor-safe-left);
  width: min(280px, calc(100vw - var(--meteor-safe-left) - var(--meteor-safe-right) - 116px));
  display: block;
  transform: none;
}

html.meteor-touch-game.meteor-presentation-v106 #meteorV40Vitals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 10px;
  padding: 8px !important;
  border-radius: 8px !important;
  backdrop-filter: none;
}

html.meteor-touch-game #meteorV40Vitals > :nth-child(1) { grid-area: 1 / 1; }
html.meteor-touch-game #meteorV40Vitals > :nth-child(2) { grid-area: 2 / 1; }
html.meteor-touch-game #meteorV40Vitals > :nth-child(3) { grid-area: 1 / 2; margin: 0 !important; }
html.meteor-touch-game #meteorV40Vitals > :nth-child(4) { grid-area: 2 / 2; }
html.meteor-touch-game #meteorV40Vitals .v40-title-row { font-size: 9px; gap: 4px; letter-spacing: 0; }
html.meteor-touch-game #meteorV40Vitals .v40-title-row strong { font-size: 10px; }
html.meteor-touch-game #meteorV40Vitals .v40-bar { height: 5px; margin: 0; }

html.meteor-touch-game.meteor-presentation-v106 #meteorV40Boss.active {
  position: fixed !important;
  top: calc(var(--meteor-safe-top) + 134px) !important;
  left: var(--meteor-safe-left) !important;
  width: calc(100vw - var(--meteor-safe-left) - var(--meteor-safe-right)) !important;
  box-sizing: border-box;
  padding: 7px 8px !important;
}

html.meteor-touch-game.meteor-presentation-v106 .meteor-v106-bottom-dock {
  display: block;
  left: 0;
  width: 100%;
  height: 0;
  transform: none;
}

html.meteor-touch-game.meteor-presentation-v106 .meteor-v106-ability-slot,
html.meteor-touch-game.meteor-presentation-v106 #menuButton {
  display: none !important;
}

html.meteor-touch-game.meteor-presentation-v106 .meteor-v106-run-stats {
  position: fixed;
  top: calc(var(--meteor-safe-top) + 48px);
  left: var(--meteor-safe-left);
  display: flex;
  gap: 6px;
  flex-direction: row;
  align-items: center;
  max-width: calc(100vw - var(--meteor-safe-left) - var(--meteor-safe-right) - 58px);
}

html.meteor-touch-game.meteor-presentation-v106 .meteor-v106-run-stats #scoreDisplay,
html.meteor-touch-game.meteor-presentation-v106 .meteor-v106-run-stats #coinDisplay {
  padding: 3px 4px;
  border: 0;
  border-radius: 4px;
  font-size: 10px;
  line-height: 12px;
  min-width: 0;
  white-space: nowrap;
}

html.meteor-touch-game.meteor-presentation-v106 .meteor-v106-run-stats #scoreDisplay { flex-shrink: 0; }

html.meteor-touch-game.meteor-presentation-v106 #meteorV40Carrier {
  position: fixed !important;
  top: calc(var(--meteor-safe-top) + 50px) !important;
  right: var(--meteor-safe-right) !important;
  width: 46px !important;
  height: 46px !important;
}

html.meteor-touch-game.meteor-presentation-v106 #meteorV40CarrierInner { width: 34px; height: 34px; }
html.meteor-touch-game.meteor-presentation-v106 #meteorV40CarrierInner strong { font-size: 9px; }
html.meteor-touch-game.meteor-presentation-v106 #meteorV40CarrierInner span { font-size: 6px; }

html.meteor-touch-game.meteor-presentation-v106 #meteorV40Heat.meteor-v106-heat {
  top: calc(var(--meteor-safe-top) + 72px);
  left: var(--meteor-safe-left);
  width: min(260px, calc(100vw - var(--meteor-safe-left) - var(--meteor-safe-right) - 60px));
  padding: 5px 7px;
  box-sizing: border-box;
  transform: none;
  border-radius: 6px;
}

html.meteor-touch-game.meteor-presentation-v106 .meteor-v106-heat-label {
  font-size: 9px;
  letter-spacing: 0;
  gap: 6px;
  margin-bottom: 4px;
}

html.meteor-touch-game .meteor-v106-heat-label span:first-child {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

html.meteor-touch-game .meteor-v106-heat-label span:last-child { white-space: nowrap; }

@media (orientation: landscape) {
  html.meteor-touch-game #meteorTouchStick { width: 104px; height: 104px; }
  html.meteor-touch-game #meteorGlobalChatPreview:not([hidden]) { top: calc(var(--meteor-safe-top) + 74px); }
  html.meteor-touch-game.meteor-presentation-v106 #meteorV40Carrier {
    top: var(--meteor-safe-top) !important;
    right: calc(var(--meteor-safe-right) + 116px) !important;
  }
  html.meteor-touch-game.meteor-presentation-v106 #meteorV40Heat.meteor-v106-heat {
    top: var(--meteor-safe-top);
    left: calc(var(--meteor-safe-left) + 292px);
    width: min(230px, calc(100vw - var(--meteor-safe-left) - var(--meteor-safe-right) - 470px));
  }
  html.meteor-touch-game.meteor-presentation-v106 #meteorV40Boss.active {
    top: calc(var(--meteor-safe-top) + 48px) !important;
    left: calc(var(--meteor-safe-left) + 310px) !important;
    width: min(250px, calc(100vw - var(--meteor-safe-left) - var(--meteor-safe-right) - 310px)) !important;
  }
}

@media (max-width: 760px) {
  html.meteor-controls-v107 .meteor-v107-controls-grid,
  html.meteor-controls-v107 .meteor-v107-control-options {
    grid-template-columns: 1fr;
  }

  html.meteor-controls-v107 .meteor-v107-controls-intro {
    grid-template-columns: 1fr;
  }
}

@media (orientation: portrait) and (max-width: 760px) {
  #meteorTouchControls { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  #meteorTouchStick { width: clamp(104px, 29vw, 138px); height: clamp(104px, 29vw, 138px); }
  .meteor-touch-actions { gap: 8px; }
  .meteor-touch-actions button { min-width: 70px; min-height: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  html.meteor-controls-v107 .meteor-v107-key-button.listening {
    animation: none;
  }
}
