/* Duck Diver - Game Styling (Mobile & Desktop Responsive) */

:root {
  --primary-blue: #0077b6;
  --deep-ocean: #03045e;
  --accent-gold: #ffd166;
  --coin-gold: #ffb703;
  --duck-yellow: #f6c324;
  --danger-red: #e63946;
  --safe-green: #06d6a0;
  --bg-card: rgba(13, 27, 42, 0.90);
  --border-card: rgba(144, 224, 239, 0.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #010212;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  color: #ffffff;
  touch-action: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  touch-action: none;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#game-canvas:active {
  cursor: grabbing;
}

/* ==================== HUD OVERLAYS ==================== */

#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
  padding-top: calc(12px + var(--safe-top));
  padding-bottom: 12px;
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 10;
}

.hud-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

/* Oxygen Gauge */
.oxygen-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 8px 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  width: 240px;
}

.hud-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #90e0ef;
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.oxygen-bar-bg {
  width: 100%;
  height: 12px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

#oxygen-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #48cae4, #00b4d8);
  border-radius: 8px;
  transition: width 0.12s ease-out, background 0.25s ease;
  box-shadow: 0 0 10px rgba(72, 202, 228, 0.6);
}

#oxygen-bar-fill.critical {
  background: linear-gradient(90deg, #e63946, #d90429);
  box-shadow: 0 0 14px rgba(230, 57, 70, 0.8);
  animation: pulse-critical 0.6s infinite alternate;
}

@keyframes pulse-critical {
  from { opacity: 0.7; }
  to { opacity: 1.0; }
}

/* Depth & Biome Card */
.depth-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 8px 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 150px;
}

.depth-indicator {
  display: flex;
  flex-direction: column;
}

.depth-number {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  line-height: 1.1;
}

.biome-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-gold);
  text-transform: uppercase;
}

/* Radar Pointer */
#radar-arrow {
  width: 26px;
  height: 26px;
  display: none;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffd166'><polygon points='12,2 22,22 12,17 2,22'/></svg>") no-repeat center center;
  filter: drop-shadow(0 0 6px rgba(255, 209, 102, 0.8));
  transition: transform 0.1s linear;
}

/* Bag & Coin HUD (Right Side) */
.hud-right {
  align-items: flex-end;
}

.wallet-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  font-size: 17px;
  font-weight: 800;
  color: var(--accent-gold);
}

.bag-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #e0e1dd;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bag-coins {
  color: var(--accent-gold);
  font-weight: 700;
}

/* HUD Control Buttons */
.hud-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 280px;
  margin-top: 4px;
}

.action-btn {
  background: rgba(13, 27, 42, 0.88);
  border: 1px solid var(--border-card);
  color: #fff;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.18s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  touch-action: manipulation;
}

.action-btn:hover {
  background: var(--primary-blue);
  transform: translateY(-2px);
  border-color: #caf0f8;
}

.action-btn:active {
  transform: scale(0.95);
}

.action-btn.shop-btn {
  background: linear-gradient(135deg, #e63946, #c1121f);
  border-color: #ffb3c6;
}

.action-btn.shop-btn:hover {
  background: linear-gradient(135deg, #ff4d6d, #d90429);
}

.action-btn.shop-btn.pulse {
  animation: dock-pulse 1s infinite alternate;
}

@keyframes dock-pulse {
  from { box-shadow: 0 0 6px #ffb3c6; }
  to { box-shadow: 0 0 18px #ff4d6d; transform: scale(1.05); }
}

.action-btn#music-btn {
  background: rgba(13, 27, 42, 0.92);
  border-color: rgba(72, 202, 228, 0.5);
}

.action-btn#music-btn:hover {
  background: #0077b6;
  box-shadow: 0 0 10px rgba(0, 180, 216, 0.5);
}

.action-btn#music-btn.music-off {
  opacity: 0.6;
  border-color: rgba(230, 57, 70, 0.4);
  background: rgba(20, 20, 30, 0.85);
  color: #a0aab8;
}

/* ==================== VIRTUAL JOYSTICK (LEFT SCREEN) ==================== */

#joystick-zone {
  position: absolute;
  top: 0;
  left: 0;
  width: 55%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

#joystick-base {
  position: absolute;
  width: 110px;
  height: 110px;
  margin-left: -55px;
  margin-top: -55px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 180, 216, 0.25) 0%, rgba(3, 4, 94, 0.45) 100%);
  border: 2px solid rgba(144, 224, 239, 0.55);
  box-shadow: 0 0 20px rgba(0, 180, 216, 0.4);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  display: flex;
  align-items: center;
  justify-content: center;
}

#joystick-base.active {
  opacity: 1;
  transform: scale(1);
}

#joystick-knob {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #48cae4, #0077b6);
  border: 2px solid #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.6);
  pointer-events: none;
  transform: translate(0px, 0px);
}

/* ==================== MOBILE ACTION BUTTONS (RIGHT SCREEN) ==================== */

#mobile-actions {
  position: absolute;
  bottom: calc(24px + var(--safe-bottom));
  right: calc(20px + var(--safe-right));
  display: none; /* revealed via media query on touch / mobile */
  flex-direction: column;
  gap: 14px;
  align-items: center;
  z-index: 25;
  pointer-events: auto;
}

.touch-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  background: rgba(13, 27, 42, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.touch-btn .btn-icon {
  font-size: 24px;
  line-height: 1;
}

.touch-btn .btn-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.touch-btn.dive-btn {
  background: linear-gradient(135deg, rgba(0, 119, 182, 0.9), rgba(2, 62, 138, 0.9));
  border-color: #90e0ef;
}

.touch-btn.dive-btn:active, .touch-btn.dive-btn.pressed {
  background: linear-gradient(135deg, #00b4d8, #0077b6);
  transform: scale(0.92);
  box-shadow: 0 0 16px rgba(0, 180, 216, 0.8);
}

.touch-btn.quack-btn {
  background: linear-gradient(135deg, rgba(246, 195, 36, 0.9), rgba(230, 90, 0, 0.9));
  border-color: #ffd166;
}

.touch-btn.quack-btn:active, .touch-btn.quack-btn.pressed {
  background: linear-gradient(135deg, #ffd166, #ff8800);
  transform: scale(0.92);
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.8);
}

/* ==================== TOAST BANNER ==================== */

.game-toast {
  position: absolute;
  top: calc(75px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  z-index: 50;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  max-width: 90vw;
  text-align: center;
}

.game-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.game-toast.success {
  border-color: var(--safe-green);
  color: #90f1d0;
}

.game-toast.danger {
  border-color: var(--danger-red);
  color: #ff858d;
}

.game-toast.gold {
  border-color: var(--accent-gold);
  color: #ffe89e;
}

/* ==================== CONTROLS HINT (BOTTOM DESKTOP) ==================== */

#controls-hint {
  position: absolute;
  bottom: calc(12px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(1, 3, 14, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 5px 16px;
  border-radius: 20px;
  font-size: 11px;
  color: #a8dadc;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
}

/* ==================== START / AUDIO UNLOCK SCREEN ==================== */

.start-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #023e8a 0%, #010212 90%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  padding: 20px;
  transition: opacity 0.3s ease, visibility 0.3s;
}

.start-backdrop.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-card {
  background: rgba(13, 27, 42, 0.95);
  border: 2px solid var(--border-card);
  border-radius: 24px;
  padding: 28px 24px;
  text-align: center;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.start-logo {
  font-size: 54px;
  margin-bottom: 8px;
  animation: float-duck 2s ease-in-out infinite alternate;
}

.start-card h1 {
  font-size: 32px;
  font-weight: 900;
  color: var(--accent-gold);
  letter-spacing: 1px;
  text-shadow: 0 2px 10px rgba(255, 209, 102, 0.5);
  margin-bottom: 4px;
}

.start-subtitle {
  font-size: 14px;
  font-weight: 700;
  color: #90e0ef;
  margin-bottom: 14px;
}

.start-desc {
  font-size: 13px;
  line-height: 1.5;
  color: #caf0f8;
  margin-bottom: 22px;
}

.start-play-btn {
  background: linear-gradient(135deg, #00b4d8, #0077b6);
  border: none;
  border-radius: 30px;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  padding: 16px 36px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 180, 216, 0.5);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  width: 100%;
  max-width: 280px;
  touch-action: manipulation;
}

.start-play-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 30px rgba(72, 202, 228, 0.7);
}

.start-play-btn:active {
  transform: scale(0.96);
}

.start-tips {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: #b0c4de;
}

/* ==================== MODALS ==================== */

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: #0d1b2a;
  border: 2px solid var(--border-card);
  border-radius: 20px;
  width: 90%;
  max-width: 820px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  background: #1b263b;
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 20px;
  color: var(--accent-gold);
}

.modal-header .subtitle {
  font-size: 12px;
  color: #90e0ef;
}

.close-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.close-btn:hover, .close-btn:active {
  background: var(--danger-red);
}

.modal-tabs {
  display: flex;
  background: #14213d;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.modal-tab {
  flex: 1;
  padding: 14px 18px;
  background: transparent;
  border: none;
  color: #a8dadc;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  touch-action: manipulation;
}

.modal-tab.active {
  background: #0d1b2a;
  color: var(--accent-gold);
  border-bottom: 3px solid var(--accent-gold);
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

/* Upgrades Shop Grid */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.shop-card {
  background: #1b263b;
  border: 1px solid rgba(144, 224, 239, 0.2);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shop-card.maxed {
  border-color: var(--safe-green);
  opacity: 0.85;
}

.shop-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shop-icon {
  font-size: 24px;
}

.shop-title-wrap {
  display: flex;
  flex-direction: column;
}

.shop-title {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.shop-lvl {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-gold);
}

.shop-desc {
  font-size: 11px;
  color: #b0c4de;
  line-height: 1.35;
  flex: 1;
}

.shop-stat {
  font-size: 11px;
  font-weight: 700;
  color: #06d6a0;
  background: rgba(6, 214, 160, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  width: fit-content;
}

.buy-btn {
  width: 100%;
  padding: 11px;
  min-height: 44px;
  border-radius: 10px;
  border: none;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  background: #415a77;
  color: #ffffff;
  touch-action: manipulation;
}

.buy-btn.affordable {
  background: linear-gradient(135deg, #00b4d8, #0077b6);
  box-shadow: 0 4px 14px rgba(0, 180, 216, 0.35);
}

.buy-btn.affordable:active {
  transform: scale(0.97);
}

.buy-btn:disabled {
  background: #2b3a4a;
  color: #6c757d;
  cursor: not-allowed;
  box-shadow: none;
}

/* Wardrobe Grid */
.wardrobe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.wardrobe-card {
  background: #1b263b;
  border: 1px solid rgba(144, 224, 239, 0.2);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.wardrobe-card.equipped {
  border-color: var(--accent-gold);
  background: #22334d;
}

.wardrobe-icon {
  font-size: 32px;
}

.wardrobe-name {
  font-weight: 800;
  font-size: 13px;
}

.wardrobe-status {
  font-size: 11px;
  color: var(--accent-gold);
  font-weight: 600;
}

.wardrobe-btn {
  width: 100%;
  padding: 10px;
  min-height: 44px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  background: #0077b6;
  color: #fff;
  touch-action: manipulation;
}

.wardrobe-btn:disabled {
  background: #2b3a4a;
  color: #6c757d;
  cursor: not-allowed;
}

/* Sea Shanties Grid */
.shanty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.shanty-card {
  background: #1b263b;
  border: 1px solid rgba(144, 224, 239, 0.2);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: all 0.2s ease;
}

.shanty-card.active-shanty {
  border-color: #52b788;
  background: #142838;
  box-shadow: 0 4px 18px rgba(82, 183, 136, 0.25);
}

.shanty-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shanty-icon {
  font-size: 28px;
  line-height: 1;
}

.shanty-title-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.shanty-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.shanty-style {
  font-size: 11px;
  color: #90e0ef;
  font-weight: 600;
}

.shanty-desc {
  font-size: 12px;
  color: #b0c4de;
  line-height: 1.4;
  flex: 1;
}

.shanty-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--accent-gold);
  font-weight: 700;
  background: rgba(0, 0, 0, 0.25);
  padding: 5px 8px;
  border-radius: 6px;
}

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

.shanty-btn {
  flex: 1;
  padding: 10px;
  min-height: 42px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  background: #0077b6;
  color: #fff;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.shanty-btn.buy-shanty-btn {
  background: linear-gradient(135deg, #00b4d8, #0077b6);
  box-shadow: 0 3px 12px rgba(0, 180, 216, 0.3);
}

.shanty-btn.buy-shanty-btn:disabled {
  background: #2b3a4a;
  color: #6c757d;
  box-shadow: none;
  cursor: not-allowed;
}

.shanty-btn.equip-shanty-btn {
  background: #2b7a78;
}

.shanty-btn.equipped {
  background: #1b4332;
  color: #95d5b2;
  border: 1px solid #40916c;
  cursor: default;
}

.shanty-preview-btn {
  width: 44px;
  padding: 0;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.shanty-preview-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.shanty-preview-btn.previewing {
  background: #e63946;
  border-color: #e63946;
  color: #fff;
  animation: pulsePreview 1.2s infinite ease-in-out;
}

@keyframes pulsePreview {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.shanty-playing-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #52b788;
  font-size: 11px;
  font-weight: 800;
}

.equalizer-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.equalizer-bar {
  width: 3px;
  background-color: #52b788;
  animation: bounceBar 0.8s infinite ease-in-out alternate;
}

.equalizer-bar:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.equalizer-bar:nth-child(2) { height: 12px; animation-delay: 0.3s; }
.equalizer-bar:nth-child(3) { height: 8px; animation-delay: 0.2s; }

@keyframes bounceBar {
  0% { height: 3px; }
  100% { height: 12px; }
}

/* Museum Grid */
.museum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.museum-card {
  background: #1b263b;
  border: 1px solid rgba(144, 224, 239, 0.2);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  gap: 10px;
}

.museum-card.locked {
  opacity: 0.55;
  background: #121c29;
}

.museum-canvas-wrap {
  width: 54px;
  height: 54px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.museum-canvas-wrap.locked-icon {
  font-size: 22px;
}

.museum-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.relic-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.rarity-tag {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  width: fit-content;
}

.rarity-common .rarity-tag { background: #6c757d; }
.rarity-uncommon .rarity-tag { background: #2a9d8f; }
.rarity-rare .rarity-tag { background: #0077b6; }
.rarity-epic .rarity-tag { background: #7209b7; }
.rarity-legendary .rarity-tag { background: #f77f00; }

.relic-depth, .relic-value {
  font-size: 11px;
  color: #90e0ef;
  font-weight: 600;
}

.relic-desc {
  font-size: 11px;
  color: #b0c4de;
  line-height: 1.3;
  margin-top: 3px;
}

/* Victory Modal */
.victory-card {
  text-align: center;
  padding: 20px;
}

.victory-card h1 {
  color: var(--accent-gold);
  font-size: 26px;
  margin-bottom: 10px;
}

.victory-duck-icon {
  font-size: 64px;
  margin: 12px 0;
  animation: float-duck 2s ease-in-out infinite alternate;
}

@keyframes float-duck {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.victory-card p {
  font-size: 14px;
  line-height: 1.5;
  color: #caf0f8;
  margin-bottom: 18px;
}

.hidden {
  display: none !important;
}

/* ==================== RESPONSIVE MEDIA QUERIES (MOBILE / TABLET) ==================== */

/* Touch screens & mobile viewports */
@media (pointer: coarse), (max-width: 860px) {
  #mobile-actions {
    display: flex;
  }
  .desktop-only {
    display: none !important;
  }
  #controls-hint {
    display: none;
  }
}

/* Phone screens (portrait & small landscape) */
@media (max-width: 640px) {
  #hud {
    padding-top: calc(8px + var(--safe-top));
    padding-left: calc(8px + var(--safe-left));
    padding-right: calc(8px + var(--safe-right));
  }

  .oxygen-card {
    width: 155px;
    padding: 6px 10px;
  }

  .hud-label {
    font-size: 10px;
  }

  .depth-card {
    min-width: 120px;
    padding: 6px 10px;
  }

  .depth-number {
    font-size: 17px;
  }

  .biome-tag {
    font-size: 9px;
  }

  .wallet-card {
    font-size: 14px;
    padding: 6px 10px;
  }

  .bag-card {
    font-size: 11px;
    padding: 5px 8px;
  }

  .hud-buttons {
    max-width: 175px;
    gap: 4px;
  }

  .action-btn {
    padding: 5px 8px;
    font-size: 10.5px;
    min-height: 32px;
  }

  .touch-btn {
    width: 60px;
    height: 60px;
  }

  .touch-btn .btn-icon {
    font-size: 20px;
  }

  .modal-content {
    width: 95%;
    max-height: 90vh;
    border-radius: 16px;
  }

  .modal-header h2 {
    font-size: 17px;
  }

  .shop-grid, .museum-grid {
    grid-template-columns: 1fr;
  }
}

/* Landscape on phones (short viewport) */
@media (max-height: 500px) {
  #hud {
    padding-top: calc(4px + var(--safe-top));
    padding-bottom: 4px;
  }

  .hud-group {
    gap: 4px;
  }

  .oxygen-card, .depth-card, .wallet-card, .bag-card {
    padding: 4px 8px;
  }

  .depth-number {
    font-size: 15px;
  }

  #mobile-actions {
    bottom: calc(12px + var(--safe-bottom));
    right: calc(14px + var(--safe-right));
    flex-direction: row;
    gap: 10px;
  }

  .touch-btn {
    width: 52px;
    height: 52px;
  }

  .touch-btn .btn-icon {
    font-size: 18px;
  }

  .touch-btn .btn-label {
    font-size: 8px;
  }

  .modal-content {
    max-height: 94vh;
  }
}

/* Victory modal continue button */
.victory-continue-btn {
  padding: 14px 32px;
  font-size: 16px;
}

/* House credit line on the start card */
.start-credit {
  margin: 16px 0 0;
  font-size: 10px;
  line-height: 1.6;
  color: #7f96b0;
}

.start-credit a {
  color: #9fc0dc;
  text-decoration: none;
}

.start-credit a:hover {
  text-decoration: underline;
}
