* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d1f35;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: #f4f8ff;
  touch-action: none;
  overscroll-behavior: none;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  cursor: crosshair;
  touch-action: none;
}

.hidden {
  display: none !important;
}

.glass {
  background: rgba(11, 23, 40, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
  contain: layout style;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 30%, rgba(12, 26, 46, 0.18), rgba(7, 15, 28, 0.62));
  z-index: 30;
}

.start-panel,
.map-panel,
.quests-modal-panel,
.pause-panel,
.gameover-panel {
  max-height: 92dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Start Screen */
.start-panel {
  width: min(980px, 100%);
  border-radius: 22px;
  padding: 28px 30px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: #7ee8ff;
  background: rgba(126, 232, 255, 0.14);
  border: 1px solid rgba(126, 232, 255, 0.3);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.05;
}

h1 .accent {
  color: #ffd35c;
}

.subtitle {
  margin-top: 8px;
  color: rgba(235, 244, 255, 0.85);
  font-size: 14.5px;
  max-width: 720px;
}

.bird-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}

@media (max-width: 860px) {
  .bird-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.bird-card {
  border-radius: 16px;
  padding: 15px 15px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bird-card:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.34);
}

.bird-card.selected {
  background: rgba(88, 196, 255, 0.16);
  border-color: #ffd35c;
  box-shadow: 0 0 0 1px rgba(255, 211, 92, 0.45), 0 10px 24px rgba(0, 0, 0, 0.35);
}

.bird-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bird-swatch {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.bird-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.15;
}

.bird-sub {
  font-size: 11.5px;
  color: #8ce7ff;
  margin-top: 2px;
}

.bird-desc {
  font-size: 12.2px;
  line-height: 1.38;
  color: rgba(235, 244, 255, 0.8);
  min-height: 48px;
}

.bird-stats {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: auto;
}

.bstat-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
}

.bstat-track {
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.bstat-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #5be3ff, #ffd35c);
}

.start-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 6px;
}

.controls-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12.5px;
  color: rgba(235, 244, 255, 0.86);
  flex: 1;
}

.controls-preview b {
  color: #ffd35c;
  font-weight: 700;
}

.btn-primary {
  border: none;
  border-radius: 14px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 800;
  color: #102033;
  background: linear-gradient(135deg, #ffe072, #ffb43b);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 185, 64, 0.35);
  transition: transform 0.14s ease, filter 0.14s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.btn-primary:active {
  transform: translateY(0);
}

/* HUD */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#hud button,
#hud .minimap-wrap {
  pointer-events: auto;
}

/* Compass */
.compass-wrap {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(440px, 56vw);
  height: 36px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.compass-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.compass-pip {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.compass-cardinal {
  color: rgba(255, 255, 255, 0.9);
}

.compass-feather {
  color: #ffd35c;
  font-size: 13px;
}

.compass-ring {
  color: #6df0ff;
  font-size: 12px;
}

.compass-perch {
  color: #84ff9e;
  font-size: 12px;
}

.compass-center-mark {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(255, 211, 92, 0.85);
}

/* Top Right Actions */
.top-actions {
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.bird-switcher,
.action-buttons {
  display: flex;
  gap: 5px;
  padding: 5px;
  border-radius: 12px;
}

.bird-pill,
.action-buttons button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #eef6ff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.bird-pill:hover,
.action-buttons button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.bird-pill.active {
  background: rgba(255, 211, 92, 0.25);
  border-color: #ffd35c;
  color: #ffe799;
}

/* Toast Notifications */
.toast-box {
  position: fixed;
  top: 102px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 15;
}

.toast {
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  background: rgba(12, 24, 42, 0.86);
  border: 1px solid rgba(255, 211, 92, 0.55);
  color: #ffe99e;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: toastIn 0.25s ease-out;
}

.toast.ring {
  border-color: rgba(109, 240, 255, 0.65);
  color: #a8f8ff;
}

.toast.perch {
  border-color: rgba(124, 255, 160, 0.65);
  color: #b7ffca;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Context Flight Prompt */
.flight-prompt {
  position: fixed;
  bottom: 102px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #eef6ff;
  white-space: nowrap;
}

/* Minimap */
.minimap-wrap {
  position: fixed;
  bottom: 16px;
  left: 16px;
  border-radius: 16px;
  padding: 6px;
  cursor: pointer;
}

#minimap-canvas {
  display: block;
  border-radius: 12px;
  width: 170px;
  height: 170px;
}

.minimap-label {
  position: absolute;
  bottom: 11px;
  right: 13px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(10, 18, 32, 0.72);
  padding: 2px 7px;
  border-radius: 6px;
  color: #d6ecff;
}

/* Telemetry */
.telemetry-wrap {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 16px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  min-width: 72px;
}

.stat-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(214, 232, 255, 0.68);
}

.stat-value {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-value small {
  font-size: 11px;
  color: rgba(214, 232, 255, 0.72);
}

.stamina-col {
  width: 192px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stamina-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: rgba(235, 244, 255, 0.85);
}

.stamina-bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.stamina-fill {
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #52d6ff, #8bffa3);
  transition: width 0.08s linear;
}

.collect-col {
  display: flex;
  gap: 12px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

/* Controls Help */
.controls-help {
  position: fixed;
  bottom: 16px;
  right: 16px;
  border-radius: 14px;
  padding: 10px 13px;
  width: 248px;
  font-size: 11.8px;
}

.help-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  margin-bottom: 6px;
  color: #8ee8ff;
}

.help-head button {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 11px;
  cursor: pointer;
}

.help-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: rgba(235, 244, 255, 0.84);
}

.help-body b {
  color: #ffd35c;
}

/* Full Map Modal */
.map-panel {
  width: min(920px, 100%);
  border-radius: 22px;
  padding: 22px 24px;
}

.map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.map-header h2 {
  font-size: 22px;
}

.map-header p {
  font-size: 13px;
  color: rgba(220, 235, 255, 0.78);
  margin-top: 2px;
}

.btn-close {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.map-content {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

#fullmap-canvas {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  max-width: 100%;
  height: auto;
  cursor: pointer;
}

.map-sidebar {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.legend-block h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8ee8ff;
  margin-bottom: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 5px;
  color: rgba(240, 248, 255, 0.9);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-player {
  background: #ffffff;
  box-shadow: 0 0 6px #fff;
}

.dot-remote {
  background: #5be3ff;
  border: 1.5px solid #fff;
}

.dot-perch-on {
  background: #59ff88;
}

.dot-perch-off {
  background: #9da8b8;
}

.dot-feather {
  background: #ffd35c;
}

.dot-heart {
  background: #ff4778;
  box-shadow: 0 0 6px #ff4778;
}

.dot-food {
  background: #ff9a3c;
}

.dot-water {
  background: #52e5ff;
  box-shadow: 0 0 5px #52e5ff;
}

.dot-hawk {
  background: #ff3b4e;
  border: 1px solid #ffd49c;
}

.dot-ring {
  background: #5be3ff;
}

.dot-thermal {
  background: rgba(155, 242, 255, 0.45);
  border: 1.5px solid #9bf2ff;
}

.dot-storm {
  background: #8f2eff;
  border: 1.5px solid #ff577f;
}

.perch-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.perch-btn {
  text-align: left;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.07);
  color: #eef6ff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.perch-btn.unlocked:hover {
  background: rgba(89, 255, 136, 0.18);
  border-color: #59ff88;
}

.perch-btn.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .controls-help {
    display: none;
  }

  .telemetry-wrap {
    gap: 10px;
    padding: 8px 12px;
  }

  .stamina-col {
    width: 110px;
  }

  #minimap-canvas {
    width: 120px;
    height: 120px;
  }
}

/* Damage Vignette */
.damage-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  opacity: 0;
  background: radial-gradient(circle at center, rgba(255, 30, 50, 0) 45%, rgba(230, 20, 45, 0.72) 100%);
  transition: opacity 0.08s linear;
}

/* Top-Left Health Hearts & Live Quests */
.status-left {
  position: fixed;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 268px;
}

.health-panel {
  border-radius: 14px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hearts-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.heart-icon {
  font-size: 18px;
  line-height: 1;
  transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.heart-icon.empty {
  opacity: 0.26;
  filter: grayscale(1);
  transform: scale(0.86);
}

.heart-icon.low-pulse {
  animation: heartPulse 0.85s infinite ease-in-out;
}

@keyframes heartPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.18);
  }
}

.score-pill {
  font-size: 13px;
  font-weight: 700;
  color: #ffe285;
  background: rgba(255, 211, 92, 0.14);
  border: 1px solid rgba(255, 211, 92, 0.28);
  padding: 3px 9px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.needs-panel {
  border-radius: 12px;
  padding: 6px 10px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.need-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.need-ico {
  font-size: 13px;
  line-height: 1;
}

.need-track {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.need-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.15s linear;
}

.need-fill.hunger {
  background: linear-gradient(90deg, #ff7b3a, #ffd35c);
}

.need-fill.thirst {
  background: linear-gradient(90deg, #2fb8ff, #80f4ff);
}

.need-fill.low {
  background: linear-gradient(90deg, #ff3a52, #ff8f59);
  animation: needBlink 0.7s infinite alternate;
}

@keyframes needBlink {
  from {
    opacity: 0.68;
  }

  to {
    opacity: 1;
  }
}

.quests-panel {
  border-radius: 14px;
  padding: 9px 12px;
  pointer-events: auto;
}

.quests-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #8ee8ff;
  margin-bottom: 7px;
}

.quests-head button {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.quests-live-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quest-mini {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 9px;
  padding: 6px 8px;
}

.quest-mini-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.8px;
  font-weight: 700;
  color: #f4f8ff;
}

.quest-mini-desc {
  font-size: 11px;
  color: rgba(220, 236, 255, 0.78);
  margin-top: 2px;
}

.quest-bar {
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  margin-top: 5px;
  overflow: hidden;
}

.quest-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #5be3ff, #ffd35c);
}

/* Quests Modal */
.quests-modal-panel {
  width: min(720px, 100%);
  border-radius: 22px;
  padding: 22px 24px;
}

.quests-full-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 720px) {
  .quests-full-list {
    grid-template-columns: 1fr;
  }
}

.quest-card {
  border-radius: 14px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.quest-card.done {
  background: rgba(89, 255, 136, 0.12);
  border-color: rgba(89, 255, 136, 0.45);
}

.quest-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.quest-card-desc {
  font-size: 12.5px;
  color: rgba(230, 242, 255, 0.84);
  margin-bottom: 8px;
}

.quest-card-reward {
  font-size: 11.5px;
  color: #ffd35c;
  font-weight: 600;
}

/* Toast extra variants */
.toast.damage {
  border-color: rgba(255, 75, 95, 0.8);
  color: #ffb8c0;
}

.toast.heal {
  border-color: rgba(255, 105, 155, 0.75);
  color: #ffc8dc;
}

.toast.quest {
  border-color: rgba(110, 255, 165, 0.85);
  color: #c4ffd9;
}

.toast.combat {
  border-color: rgba(255, 128, 75, 0.9);
  color: #ffd7ba;
}

/* Game Over Screen */
.gameover-panel {
  width: min(460px, 100%);
  border-radius: 22px;
  padding: 28px 30px;
  text-align: center;
}

.death-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #ff8e9e;
  background: rgba(255, 65, 88, 0.18);
  border: 1px solid rgba(255, 85, 105, 0.4);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.gameover-panel h2 {
  font-size: 32px;
  margin-bottom: 6px;
}

.death-reason {
  color: #ffb8c2;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 18px;
}

.death-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.dstat-box {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px;
  font-size: 12px;
  color: rgba(225, 240, 255, 0.78);
}

.dstat-box b {
  display: block;
  font-size: 19px;
  color: #fff;
  margin-top: 2px;
}

.death-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-secondary {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 14px;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 700;
  color: #eef6ff;
  background: rgba(255, 255, 255, 0.10);
  cursor: pointer;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Pause Screen */
.pause-panel {
  width: min(460px, 100%);
  border-radius: 22px;
  padding: 28px 30px;
  text-align: center;
}

.pause-panel h2 {
  font-size: 30px;
  margin-bottom: 6px;
}

.pause-summary {
  color: rgba(225, 240, 255, 0.84);
  font-size: 14px;
  margin-bottom: 20px;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pause-sub-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.pause-sub-actions .btn-secondary {
  padding: 11px 12px;
  font-size: 14px;
}

/* Mobile Touch Controls */
.touch-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}

.touch-stick-zone {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(14px, env(safe-area-inset-bottom));
  width: 138px;
  height: 138px;
  pointer-events: auto;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.touch-stick-base {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: rgba(12, 24, 42, 0.62);
  border: 2px solid rgba(255, 255, 255, 0.24);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.touch-stick-knob {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, #88dcff);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transform: translate(0px, 0px);
  transition: transform 0.04s linear;
}

.touch-actions {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  width: 186px;
  height: 146px;
  pointer-events: none;
}

.touch-btn {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  background: rgba(12, 24, 42, 0.74);
  color: #f4f8ff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  pointer-events: auto;
  touch-action: none;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.08s ease, background 0.08s ease;
}

.touch-btn span {
  font-size: 9.5px;
  font-weight: 700;
  margin-top: 2px;
  opacity: 0.92;
}

.touch-btn.active,
.touch-btn:active {
  transform: scale(0.92);
  background: rgba(91, 227, 255, 0.38);
  border-color: #9bf2ff;
}

.touch-flap {
  right: 2px;
  bottom: 4px;
  width: 74px;
  height: 74px;
  background: linear-gradient(135deg, rgba(255, 218, 96, 0.85), rgba(255, 168, 52, 0.85));
  color: #102033;
  border-color: rgba(255, 236, 155, 0.9);
  font-size: 22px;
}

.touch-flap.active,
.touch-flap:active {
  background: linear-gradient(135deg, #ffe98a, #ffc457);
}

.touch-boost {
  right: 84px;
  bottom: 10px;
  width: 58px;
  height: 58px;
}

.touch-brake {
  right: 6px;
  bottom: 84px;
  width: 56px;
  height: 56px;
}

.touch-chirp {
  right: 72px;
  bottom: 78px;
  width: 50px;
  height: 50px;
  font-size: 15px;
}

.touch-attack {
  right: 130px;
  bottom: 72px;
  width: 52px;
  height: 52px;
  font-size: 16px;
  background: linear-gradient(135deg, rgba(255, 92, 74, 0.72), rgba(210, 42, 62, 0.72));
  border-color: rgba(255, 178, 158, 0.75);
}

.touch-attack.active,
.touch-attack:active {
  background: linear-gradient(135deg, #ff7a68, #e63b4f);
  border-color: #ffd2c9;
}

/* Mobile & Touch Responsive Layout */
body.touch-mode #controls-help {
  display: none;
}

body.touch-mode .minimap-wrap {
  top: 102px;
  left: max(12px, env(safe-area-inset-left));
  bottom: auto;
  padding: 4px;
  border-radius: 12px;
}

body.touch-mode #minimap-canvas {
  width: 88px;
  height: 88px;
  border-radius: 9px;
}

body.touch-mode .minimap-label {
  display: none;
}

body.touch-mode .quests-panel {
  position: fixed;
  top: 102px;
  left: calc(max(12px, env(safe-area-inset-left)) + 104px);
  width: 175px;
  padding: 6px 9px;
}

@media (max-width: 960px),
(pointer: coarse) {
  .overlay {
    padding: 10px;
  }

  .start-panel {
    padding: 16px 16px;
    border-radius: 18px;
  }

  .bird-grid {
    gap: 10px;
    margin: 12px 0;
  }

  .bird-desc {
    min-height: 0;
    font-size: 11.5px;
  }

  .controls-preview {
    display: none;
  }

  .btn-primary {
    width: 100%;
    padding: 12px 18px;
    font-size: 15px;
  }

  .status-left {
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
    width: auto;
  }

  .health-panel {
    padding: 6px 10px;
    gap: 8px;
  }

  .heart-icon {
    font-size: 15px;
  }

  .top-actions {
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    gap: 5px;
    max-width: 58vw;
  }

  .bird-switcher,
  .action-buttons {
    flex-wrap: wrap;
    justify-content: flex-end;
    padding: 4px;
    gap: 4px;
  }

  .bird-pill,
  .action-buttons button {
    padding: 5px 7px;
    font-size: 11px;
  }

  .toast-box {
    top: 96px;
  }

  .toast {
    font-size: 12px;
    padding: 6px 12px;
  }

  .telemetry-wrap {
    bottom: max(10px, env(safe-area-inset-bottom));
    padding: 6px 10px;
    gap: 10px;
    border-radius: 12px;
  }

  .stat-pill {
    min-width: 52px;
  }

  .stat-value {
    font-size: 15px;
  }

  .stamina-col {
    width: 104px;
  }

  .stamina-head {
    font-size: 10px;
  }

  #hud-bird-name {
    display: none;
  }

  .collect-col {
    gap: 7px;
    padding-left: 7px;
    font-size: 11.5px;
  }
}

@media (max-width: 740px) {
  .compass-wrap {
    display: none;
  }

  body.touch-mode .quests-live-list {
    display: none;
  }

  body.touch-mode .quests-panel {
    top: 198px;
    left: max(8px, env(safe-area-inset-left));
    width: auto;
    padding: 5px 9px;
  }

  body.touch-mode .quests-head {
    margin-bottom: 0;
  }

  body.touch-mode .telemetry-wrap {
    bottom: 162px;
    max-width: calc(100vw - 16px);
  }

  .flight-prompt {
    bottom: 214px;
    font-size: 11.5px;
    padding: 6px 12px;
  }
}

@media (max-width: 560px) {
  .bird-switcher {
    display: none;
  }

  .top-actions {
    max-width: 49vw;
  }

  .health-panel {
    padding: 5px 8px;
    gap: 6px;
  }

  .heart-icon {
    font-size: 13.5px;
  }

  .score-pill {
    font-size: 11.5px;
    padding: 2px 7px;
  }

  .telemetry-wrap {
    gap: 10px;
    padding: 6px 10px;
  }

  .stat-pill {
    min-width: auto;
  }

  .stat-label {
    font-size: 9px;
  }

  .stat-value {
    font-size: 13.5px;
  }

  .stamina-col {
    width: 72px;
  }

  .toast-box {
    top: 220px;
  }
}

@media (max-height: 500px) {
  body.touch-mode .health-panel {
    padding: 4px 8px;
    gap: 6px;
  }

  body.touch-mode .needs-panel {
    padding: 4px 8px;
  }

  body.touch-mode .quests-live-list {
    display: none;
  }

  body.touch-mode .quests-panel {
    width: auto;
    top: 86px;
    left: calc(max(8px, env(safe-area-inset-left)) + 80px);
    padding: 4px 8px;
  }

  body.touch-mode .quests-head {
    margin-bottom: 0;
  }

  body.touch-mode .minimap-wrap {
    top: 86px;
    left: max(8px, env(safe-area-inset-left));
  }

  body.touch-mode #minimap-canvas {
    width: 68px;
    height: 68px;
  }

  .compass-wrap {
    display: none;
  }

  .flight-prompt {
    bottom: 72px;
    font-size: 11.5px;
  }
}

/* Portrait Orientation Blocker on Mobile / Touch Devices */
.rotate-overlay {
  z-index: 60;
  background: rgba(7, 15, 28, 0.94);
  backdrop-filter: blur(10px);
}

.rotate-panel {
  width: min(390px, 100%);
  border-radius: 22px;
  padding: 26px 22px;
  text-align: center;
}

.rotate-phone {
  display: inline-block;
  font-size: 54px;
  margin-bottom: 12px;
  animation: rotateHint 1.8s ease-in-out infinite;
}

@keyframes rotateHint {

  0%,
  15% {
    transform: rotate(0deg);
  }

  50%,
  75% {
    transform: rotate(-90deg);
  }

  100% {
    transform: rotate(0deg);
  }
}

.rotate-panel h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.rotate-panel p {
  font-size: 14px;
  line-height: 1.45;
  color: rgba(226, 239, 255, 0.85);
  margin-bottom: 18px;
}

@media (pointer: coarse) and (orientation: portrait) {
  #rotate-overlay {
    display: flex !important;
  }
}

body.portrait-blocked #rotate-overlay {
  display: flex !important;
}

/* Multiplayer Lobby, Nameplates, Chat & Players Modal */
.mp-lobby {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.mp-fields {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.mp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: rgba(220, 238, 255, 0.8);
}

.mp-field input,
.mp-modal-controls input,
.chat-input-wrap input {
  background: rgba(8, 18, 32, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #f4f8ff;
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.mp-field input:focus,
.mp-modal-controls input:focus,
.chat-input-wrap input:focus {
  border-color: #5be3ff;
}

.btn-mp {
  background: rgba(91, 227, 255, 0.18);
  border: 1px solid rgba(91, 227, 255, 0.45);
  color: #c2f6ff;
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.btn-mp:hover {
  background: rgba(91, 227, 255, 0.3);
}

.mp-status-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
}

.mp-status-badge.online {
  background: rgba(89, 255, 136, 0.18);
  border: 1px solid rgba(89, 255, 136, 0.45);
  color: #a9ffc3;
}

.mp-status-badge.connecting {
  background: rgba(255, 211, 92, 0.18);
  border: 1px solid rgba(255, 211, 92, 0.45);
  color: #ffe69a;
}

.mp-status-badge.offline {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(220, 232, 248, 0.72);
}

/* 3D Projected Nameplates */
.nameplates-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 6;
}

.nameplate {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(10, 20, 36, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.nameplate.hawk {
  background: rgba(48, 12, 18, 0.78);
  border-color: rgba(255, 110, 96, 0.72);
  color: #ffb9ad;
  font-size: 11px;
}

/* Live Chat */
.chat-container {
  position: fixed;
  left: 16px;
  bottom: 204px;
  width: min(320px, 78vw);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 14;
}

.chat-feed {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-msg {
  background: rgba(10, 20, 36, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 12px;
  color: #eef6ff;
  width: fit-content;
  max-width: 100%;
  word-break: break-word;
}

.chat-msg b {
  color: #7ee8ff;
}

.chat-input-wrap {
  pointer-events: auto;
}

.chat-input-wrap input {
  width: 100%;
  background: rgba(10, 20, 36, 0.85);
}

/* Players Modal */
.mp-modal-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.mp-modal-controls input {
  flex: 1;
  min-width: 140px;
}

.mp-modal-controls .btn-secondary {
  padding: 8px 14px;
  font-size: 13px;
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 13.5px;
}

.player-row.me {
  border-color: #ffd35c;
  background: rgba(255, 211, 92, 0.12);
}

@media (max-width: 900px) {
  .chat-container {
    bottom: 220px;
    width: 240px;
  }
}