:root {
  --ink-dark: #0c2238;
  --navy-top: #1a3e60;
  --navy-bot: #0e243a;
  --navy-border: #31608b;
  --ice-bg: #e7f1fa;
  --ice-bg-bot: #d4e4f2;
  --card-white: #ffffff;
  --card-border: #bfd4e7;
  --card-lip: #a5bfd6;
  --text-dark: #102840;
  --text-muted: #52708c;
  --gold-light: #ffdf68;
  --gold-mid: #f5a616;
  --gold-edge: #915200;
  --emerald-light: #44e687;
  --emerald-mid: #1bb35b;
  --emerald-edge: #0c6832;
  --red-light: #ff7661;
  --red-mid: #df382a;
  --red-edge: #8a1b12;
  --teal-accent: #13b897;
  --cyan-ice: #44cdfc;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0b1b2b;
  color: #ffffff;
  font-family: "Rubik", "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tabular { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

.g-ico { width: 22px; height: 22px; display: block; flex-shrink: 0; }
.g-ico-sm { width: 17px; height: 17px; display: block; flex-shrink: 0; }
.g-ico-xs { width: 13px; height: 13px; display: block; flex-shrink: 0; }

.game-viewport {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
}

body.tg-webapp .game-viewport {
  height: var(--tg-viewport-stable-height, 100dvh);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#gameCanvas:active { cursor: grabbing; }

/* ================================
   1. Diegetic 3D World Map Pins
   ================================ */
.world-markers-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  touch-action: none;
  z-index: 6;
  overflow: hidden;
}

.world-badge {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  touch-action: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 7px;
  border-radius: 12px;
  border: 2px solid #22547c;
  background: linear-gradient(180deg, #ffffff 0%, #e7f2fc 100%);
  color: #0f2942;
  font-family: "Rubik", sans-serif;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 3px 0 #153957, 0 6px 14px rgba(5, 16, 28, 0.35);
  transition: transform 0.1s ease;
}

.world-badge::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #153957;
}

.world-badge:active { transform: translate(-50%, -95%) scale(0.93); }

.pin-ico {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.world-badge.locked {
  background: linear-gradient(180deg, #ffeb99 0%, #f5b324 100%);
  border-color: #7d4700;
  color: #361c00;
  box-shadow: 0 3px 0 #663800, 0 6px 14px rgba(5, 16, 28, 0.38);
}

.world-badge.locked::after { border-top-color: #663800; }

.world-badge.frozen {
  background: linear-gradient(180deg, #e1faff 0%, #86deff 100%);
  border-color: #0d5d8a;
  color: #06304b;
  box-shadow: 0 3px 0 #094569, 0 6px 16px rgba(45, 200, 255, 0.45);
  animation: frozenPulse 1.4s ease-in-out infinite;
}

.world-badge.frozen::after { border-top-color: #094569; }

.world-badge.building {
  background: linear-gradient(180deg, #1d4469 0%, #102a43 100%);
  border-color: #4683b5;
  color: #ffffff;
  text-shadow: 0 1px 0 #07131f;
  box-shadow: 0 3px 0 #071522, 0 6px 14px rgba(0, 0, 0, 0.38);
}

.world-badge.building::after { border-top-color: #071522; }

.world-badge.ready-pulse {
  border-color: #f7c238;
  animation: pinBob 1.2s ease-in-out infinite;
}

.world-badge.barge {
  background: linear-gradient(180deg, #ffda57 0%, #dc8a0f 100%);
  border-color: #6b3b00;
  color: #2b1400;
  text-shadow: 0 1px 0 rgba(255, 240, 180, 0.7);
  box-shadow: 0 3px 0 #5c3300, 0 0 18px rgba(255, 208, 64, 0.6);
  animation: pinBob 1.1s ease-in-out infinite;
}
.world-badge.barge::after { border-top-color: #6b3b00; }

.world-badge.captain {
  background: linear-gradient(180deg, #f7b828 0%, #c96c10 100%);
  border-color: #4f2500;
  color: #ffffff;
  text-shadow: 0 1px 0 #3a1a00;
}
.world-badge.captain::after { border-top-color: #4f2500; }

.world-badge.captain.boss {
  background: linear-gradient(180deg, #1b3b5c 0%, #0d2036 100%);
  border-color: #ffd147;
  color: #ffe375;
  box-shadow: 0 3px 0 #593b00, 0 0 16px rgba(62, 242, 212, 0.55);
}
.world-badge.captain.boss::after { border-top-color: #ffd147; }

.world-badge.plot-empty {
  padding: 3px 7px;
  font-size: 10px;
  gap: 4px;
  background: rgba(11, 24, 42, 0.86);
  border-width: 1.5px;
  border-style: dashed;
  color: #e2f1ff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.world-badge.plot-empty .pin-ico {
  width: 12px;
  height: 12px;
}
.world-badge.z-center { border-color: #f5b942; }
.world-badge.z-center::after { border-top-color: #f5b942; }
.world-badge.z-house { border-color: #d4945a; }
.world-badge.z-house::after { border-top-color: #d4945a; }
.world-badge.z-craft { border-color: #fb923c; }
.world-badge.z-craft::after { border-top-color: #fb923c; }
.world-badge.z-cold { border-color: #38bdf8; }
.world-badge.z-cold::after { border-top-color: #38bdf8; }
.world-badge.z-port { border-color: #2dd4bf; }
.world-badge.z-port::after { border-top-color: #2dd4bf; }
.world-badge.hq {
  background: linear-gradient(180deg, #52360c 0%, #2b1a04 100%);
  border-color: #ffd147;
  color: #ffe89e;
  box-shadow: 0 3px 0 #472d00, 0 4px 12px rgba(0, 0, 0, 0.5);
}
.world-badge.hq::after { border-top-color: #ffd147; }

.world-badge.zone-chop {
  background: linear-gradient(180deg, #215732 0%, #10321d 100%);
  border-color: #ffd24a;
  color: #fff2b2;
  box-shadow: 0 3px 0 #0a2012, 0 4px 12px rgba(0, 0, 0, 0.45);
}
.world-badge.zone-chop::after { border-top-color: #ffd24a; }
.world-badge.zone-clearing {
  background: linear-gradient(180deg, #9b4b12 0%, #5c2706 100%);
  border-color: #ffca52;
  color: #fff6cf;
  box-shadow: 0 3px 0 #381502, 0 4px 14px rgba(255, 168, 40, 0.52);
}
.world-badge.zone-clearing::after { border-top-color: #ffca52; }
.unit-clear-bar { width: 100%; height: 6px; border-radius: 999px; background: #cde0f2; overflow: hidden; margin-top: 3px; }

#worldMarkersLayer.zoom-overview .world-badge {
  padding: 2px 5px;
  font-size: 9px;
  gap: 3px;
  border-width: 1.5px;
  opacity: 0.90;
}
#worldMarkersLayer.zoom-overview .world-badge.zone-chop,
#worldMarkersLayer.zoom-overview .world-badge.plot-empty {
  padding: 3px 7px;
  font-size: 9.5px;
  opacity: 1;
}
#worldMarkersLayer.zoom-overview .world-badge .pin-ico {
  width: 11px;
  height: 11px;
}
#worldMarkersLayer.zoom-overview .world-badge::after {
  bottom: -5px;
  border-left-width: 4px;
  border-right-width: 4px;
  border-top-width: 5px;
}

@keyframes pinBob {
  0%, 100% { transform: translate(-50%, -100%); }
  50% { transform: translate(-50%, calc(-100% - 5px)); }
}

@keyframes frozenPulse {
  0%, 100% { transform: translate(-50%, -100%) scale(1); }
  50% { transform: translate(-50%, -100%) scale(1.06); }
}

/* ================================
   2. Floating Numbers & Flying Coins
   ================================ */
.floating-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  overflow: hidden;
}

.float-pop {
  position: absolute;
  font-family: "Rubik", sans-serif;
  font-size: 17px;
  font-weight: 900;
  color: #ffffff;
  text-shadow:
    -1.5px -1.5px 0 #0c2238,
     1.5px -1.5px 0 #0c2238,
    -1.5px  1.5px 0 #0c2238,
     1.5px  1.5px 0 #0c2238,
     0 3px 6px rgba(0, 0, 0, 0.7);
  animation: floatUp 0.88s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

.float-pop.crit {
  font-size: 22px;
  color: #ffe055;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translate(-50%, 0) scale(0.8); }
  25% { opacity: 1; transform: translate(-50%, -18px) scale(1.18); }
  100% { opacity: 0; transform: translate(-50%, -62px) scale(1.0); }
}

.fly-token {
  position: fixed;
  width: 24px;
  height: 24px;
  z-index: 90;
  pointer-events: none;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.45));
  transition: transform 0.56s cubic-bezier(0.22, 0.85, 0.38, 1), opacity 0.56s ease;
}

.hud-bump {
  animation: hudBump 0.28s cubic-bezier(0.3, 1.5, 0.5, 1);
}

@keyframes hudBump {
  0% { transform: scale(1); }
  45% { transform: scale(1.24); color: #ffe366; }
  100% { transform: scale(1); }
}

/* ================================
   3. Top HUD: Captain + Currencies
   ================================ */
.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: max(8px, env(safe-area-inset-top, 8px)) 10px 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.hud-row {
  width: 100%;
  max-width: 920px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.captain-hud-card {
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 5px;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--navy-top), var(--navy-bot));
  border: 2px solid var(--navy-border);
  box-shadow: 0 3px 0 #07131f, 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease;
}
.captain-hud-card:active { transform: translateY(2px); }

.captain-role-tag {
  display: inline-flex;
  align-self: flex-start;
  padding: 1.5px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: #234d73;
  border: 1px solid #457eb0;
  color: #ffe28a;
}

.captain-role-tag.boss {
  background: linear-gradient(180deg, #ffe066, #eb9816);
  border-color: #6b3b00;
  color: #2b1500;
  box-shadow: 0 0 10px rgba(255, 214, 70, 0.45);
}

.captain-avatar-frame {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 2px solid #f5b324;
  background: #173b5c;
  overflow: visible;
  flex-shrink: 0;
  box-shadow: 0 2px 0 #6b3f00;
}

.captain-hud-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.level-star-badge {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.level-star-badge svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.level-star-badge span {
  position: relative;
  z-index: 2;
  font-size: 10.5px;
  font-weight: 900;
  color: #3a1f00;
  margin-top: 1px;
}

.captain-hud-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 96px;
}

.rate-line {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1.5px 0 #07131f;
}

.rate-line span {
  font-size: 10.5px;
  color: #9dc3e2;
  font-weight: 700;
}

.energy-mini-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mini-energy-track {
  width: 58px;
  height: 7px !important;
  border: 1px solid #091826;
}

.energy-mini-num {
  font-size: 9.5px;
  font-weight: 800;
  color: #cbe7ff;
  text-shadow: 0 1px 0 #07131f;
}

.res-cluster {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.res-capsule {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 6px;
  min-height: 40px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--navy-top), var(--navy-bot));
  border: 2px solid var(--navy-border);
  box-shadow: 0 3px 0 #07131f, inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 6px 14px rgba(0, 0, 0, 0.3);
}

.res-ico {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
}

.res-val-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  padding-right: 2px;
}

.res-val {
  font-size: 13px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1.5px 0 #07131f;
  white-space: nowrap;
}

.res-usdt .res-val { color: #69ffae; }
.res-roe .res-val { color: #ffe066; }

.res-lbl {
  font-size: 9px;
  font-weight: 700;
  color: #90b6d6;
  letter-spacing: 0.03em;
}

.res-plus-btn {
  width: 22px;
  height: 24px;
  border-radius: 8px;
  border: 1.5px solid #0c6230;
  background: linear-gradient(180deg, #52f094, #1fb85f);
  color: #ffffff;
  font-family: "Rubik", sans-serif;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-shadow: 0 1px 0 #0b5127;
  box-shadow: 0 2px 0 #0b5127;
}

.res-plus-btn:active { transform: translateY(1.5px); box-shadow: none; }

.event-banner {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #1bb89c, #117b82);
  border: 2px solid #094952;
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  text-shadow: 0 1.5px 0 #063038;
  box-shadow: 0 3px 0 #06353b, 0 6px 18px rgba(17, 178, 154, 0.4);
}

.event-timer {
  background: rgba(7, 22, 37, 0.55);
  padding: 2px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* ================================
   4. Left Edge Quest + Crate & Right Tools
   ================================ */
.left-widgets {
  position: absolute;
  left: 10px;
  top: 68px;
  z-index: 19;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.quest-pill, .crate-widget-btn {
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: #ffffff;
  font-family: "Rubik", sans-serif;
  transition: transform 0.1s ease;
}

.quest-pill:active, .crate-widget-btn:active { transform: translateY(2px); }

.quest-pill {
  max-width: 198px;
  padding: 6px 10px 6px 8px;
  border-radius: 14px;
  background: linear-gradient(180deg, #1b4166, #102942);
  border: 2px solid #356794;
  box-shadow: 0 3px 0 #071522, 0 6px 14px rgba(0, 0, 0, 0.32);
}

.quest-pill.quest-ready {
  border-color: #f7c034;
  background: linear-gradient(180deg, #27517a, #143350);
  box-shadow: 0 3px 0 #8a5000, 0 0 16px rgba(255, 200, 60, 0.45);
}

.quest-ico-wrap {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: rgba(8, 22, 36, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quest-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.quest-kicker { font-size: 8.5px; font-weight: 800; color: #ffda63; letter-spacing: 0.06em; }
.quest-meta strong { font-size: 11px; font-weight: 800; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 0 #07131f; }
.quest-prog-row { display: flex; align-items: center; gap: 6px; font-size: 9.5px; font-weight: 800; color: #b7d7f2; }
.quest-track { flex: 1; height: 6px !important; border: 1px solid #091826; }

.crate-widget-btn {
  padding: 5px 10px 5px 7px;
  border-radius: 14px;
  background: linear-gradient(180deg, #1b4166, #102942);
  border: 2px solid #2fb0d9;
  box-shadow: 0 3px 0 #071522, 0 6px 14px rgba(0, 0, 0, 0.32);
}

.crate-widget-btn.ready-glow {
  border-color: #3ce695;
  box-shadow: 0 3px 0 #0b5a34, 0 0 14px rgba(48, 232, 145, 0.38);
}

.barge-widget-btn {
  border-color: #f3b533;
}
.barge-widget-btn.barge-docked {
  background: linear-gradient(180deg, #2a5d8f, #133152);
  border-color: #ffde59;
  box-shadow: 0 3px 0 #7a4b00, 0 0 18px rgba(255, 218, 72, 0.58);
  animation: widgetPulse 1.3s ease-in-out infinite;
}

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

.crate-ico { width: 24px; height: 24px; flex-shrink: 0; }
.crate-meta { display: flex; flex-direction: column; line-height: 1.08; }
.crate-title { font-size: 8.5px; font-weight: 800; color: #8be2ff; letter-spacing: 0.04em; }
.crate-val { font-size: 12.5px; font-weight: 900; color: #ffde59; text-shadow: 0 1.5px 0 #07131f; }

.side-tools {
  position: absolute;
  right: 10px;
  top: 68px;
  z-index: 19;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-fab {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #356794;
  background: linear-gradient(180deg, #214e78, #112b45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 0 #071522, inset 0 2px 0 rgba(255, 255, 255, 0.22), 0 6px 12px rgba(0, 0, 0, 0.32);
  transition: transform 0.08s ease;
}

.tool-fab:active { transform: translateY(2px); box-shadow: 0 1px 0 #071522; }
.tool-aurora { border-color: #2ce0bf; background: linear-gradient(180deg, #1b6b7a, #103754); }
.tool-ice { border-color: #66d8ff; background: linear-gradient(180deg, #205c88, #123352); }

/* ================================
   5. Bottom Inspector + Game Dock
   ================================ */
.bottom-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 0 10px max(10px, env(safe-area-inset-bottom, 10px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.selected-pond-bar {
  pointer-events: auto;
  width: min(500px, 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #e4eff9);
  border: 2.5px solid #2b648f;
  color: var(--text-dark);
  box-shadow: 0 4px 0 #173d5c, 0 10px 24px rgba(4, 15, 28, 0.45);
}

.sel-pond-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sel-pond-info strong { font-size: 13px; font-weight: 800; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-pond-info span { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.sel-pond-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.bottom-nav {
  pointer-events: auto;
  width: min(500px, 100%);
  height: 62px;
  padding: 0 6px;
  border-radius: 20px;
  background: linear-gradient(180deg, #1b4166 0%, #0e253b 100%);
  border: 2px solid #356794;
  border-bottom: 3px solid #071522;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  box-shadow: 0 5px 0 #07131f, inset 0 2px 0 rgba(255, 255, 255, 0.16), 0 12px 26px rgba(0, 0, 0, 0.48);
}

.nav-btn {
  border: none;
  background: transparent;
  color: #9dc2e2;
  font-family: "Rubik", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  font-weight: 800;
  text-shadow: 0 1.5px 0 #07131f;
  cursor: pointer;
  border-radius: 14px;
  transition: color 0.14s ease, background 0.14s ease;
}

.nav-ico-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.nav-svg {
  width: 26px;
  height: 26px;
  display: block;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
}

.nav-btn.active {
  color: #ffde63;
  background: radial-gradient(circle at 50% 45%, rgba(255, 215, 75, 0.16), transparent 72%);
}

.nav-btn.active .nav-ico-wrap {
  transform: translateY(-5px) scale(1.14);
}

.nav-dot {
  position: absolute;
  top: -2px;
  right: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b30;
  border: 2px solid #0c2238;
  display: none;
  box-shadow: 0 0 8px rgba(255, 59, 48, 0.7);
}

.nav-dot.visible { display: block; animation: dotPulse 1.4s ease-in-out infinite; }
@keyframes dotPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.22); } }

/* ================================
   6. Arctic Ice Parchment Sheets
   ================================ */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 18, 30, 0.56);
  backdrop-filter: blur(3px);
  z-index: 35;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-panel {
  width: min(540px, 100%);
  max-height: 80vh;
  background: linear-gradient(180deg, var(--ice-bg), var(--ice-bg-bot));
  border: 2.5px solid #2b618c;
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -10px 32px rgba(3, 12, 22, 0.55);
}

.sheet-header {
  padding: 8px 14px 10px;
  background: linear-gradient(180deg, #1b4369 0%, #0e263d 100%);
  border-bottom: 3px solid #f0a71c;
  flex-shrink: 0;
}

.sheet-handle {
  width: 44px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  margin: 0 auto 7px;
}

.sheet-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.sheet-title-row h2 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 2px 0 #07131f;
}

.sheet-scroll {
  flex: 1;
  overflow-y: auto;
  touch-action: pan-y;
  padding: 12px 12px max(24px, env(safe-area-inset-bottom, 24px));
  color: var(--text-dark);
}

.sheet-section { display: flex; flex-direction: column; gap: 10px; }

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(11, 31, 51, 0.28);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill { height: 100%; border-radius: 999px; transition: width 0.25s ease; }
.energy-fill { background: linear-gradient(90deg, #27d9fc, #57f7d4); }
.teal-fill { background: linear-gradient(90deg, #1fc79f, #49e0ff); }
.gold-fill { background: linear-gradient(90deg, #f59714, #ffe163); }

/* Crisp Beveled White Frost Cards inside Sheets */
.game-card {
  background: var(--card-white);
  border: 2px solid var(--card-border);
  border-radius: 16px;
  padding: 12px;
  color: var(--text-dark);
  box-shadow: 0 4px 0 var(--card-lip);
}

.game-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-dark);
}

/* Tactile 3D Glossy Game Buttons */
.btn-primary, .btn-secondary, .btn-ton, .btn-caviar-red, .btn-gold {
  font-family: "Rubik", sans-serif;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

.btn-primary:active, .btn-secondary:active, .btn-ton:active, .btn-caviar-red:active, .btn-gold:active {
  transform: translateY(3px);
}

.btn-primary:disabled, .btn-caviar-red:disabled, .btn-gold:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(180deg, var(--emerald-light) 0%, var(--emerald-mid) 100%);
  border: 2px solid var(--emerald-edge);
  color: #ffffff;
  text-shadow: 0 1.5px 0 #0a5429;
  box-shadow: 0 4px 0 var(--emerald-edge), inset 0 2px 0 rgba(255, 255, 255, 0.42);
  padding: 9px 14px;
  font-size: 13px;
}
.btn-primary:active { box-shadow: 0 1px 0 var(--emerald-edge); }

.btn-gold {
  width: 100%;
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold-mid) 100%);
  border: 2px solid var(--gold-edge);
  color: #361b00;
  box-shadow: 0 4px 0 var(--gold-edge), inset 0 2px 0 rgba(255, 255, 255, 0.5);
  padding: 9px 14px;
  font-size: 13px;
}
.btn-gold:active { box-shadow: 0 1px 0 var(--gold-edge); }

.btn-caviar-red {
  width: 100%;
  background: linear-gradient(180deg, var(--red-light) 0%, var(--red-mid) 100%);
  border: 2px solid var(--red-edge);
  color: #ffffff;
  text-shadow: 0 1.5px 0 #6e120b;
  box-shadow: 0 4px 0 var(--red-edge), inset 0 2px 0 rgba(255, 255, 255, 0.35);
  padding: 9px 14px;
  font-size: 13px;
}
.btn-caviar-red:active { box-shadow: 0 1px 0 var(--red-edge); }

.btn-ton {
  background: linear-gradient(180deg, #34bfff 0%, #0080d6 100%);
  border: 2px solid #004e85;
  color: #ffffff;
  text-shadow: 0 1.5px 0 #004373;
  box-shadow: 0 4px 0 #004e85, inset 0 2px 0 rgba(255, 255, 255, 0.38);
  padding: 8px 12px;
  font-size: 12px;
}
.btn-ton:active { box-shadow: 0 1px 0 #004e85; }

.btn-secondary {
  background: linear-gradient(180deg, #ffffff 0%, #dce8f4 100%);
  border: 2px solid #96b5d1;
  color: var(--text-dark);
  box-shadow: 0 3px 0 #82a3c2;
  padding: 9px 14px;
  font-size: 13px;
}
.btn-secondary:active { box-shadow: 0 1px 0 #82a3c2; }

.btn-sm { padding: 7px 11px; font-size: 12px; }
.btn-xs { padding: 5px 9px; font-size: 11px; border-radius: 9px; width: auto; flex-shrink: 0; white-space: nowrap; }
.btn-full { width: 100%; margin-top: 10px; }

.icon-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #7d150e;
  background: linear-gradient(180deg, #ff7a66, #dc3326);
  color: #ffffff;
  font-family: "Rubik", sans-serif;
  font-size: 15px;
  font-weight: 900;
  text-shadow: 0 1px 0 #66100a;
  box-shadow: 0 3px 0 #7d150e;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 5;
}
.icon-close-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #7d150e; }

.subtab-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: #c6daec;
  border: 2px solid #9cb8d4;
  padding: 4px;
  border-radius: 14px;
}

.subtab-bar-4 {
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.subtab-bar-4 .subtab-btn {
  font-size: 11px;
  padding: 8px 3px;
}

.tier-chip {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 900;
  background: #17466e;
  color: #ffe37a;
  vertical-align: middle;
}

.tier-stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.tier-step-pill {
  padding: 7px 4px;
  border-radius: 11px;
  border: 2px solid #b5cce0;
  background: #eaf3fb;
  color: #486884;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
}

.tier-step-pill.done {
  border-color: #1eb360;
  background: #e1faec;
  color: #0b592d;
}

.tier-step-pill.active {
  border-color: #eb9d18;
  background: linear-gradient(180deg, #fff5cf, #ffe08a);
  color: #4f2c00;
  box-shadow: 0 2px 0 #c98612;
}

.cold-temp-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  background: #0d3a59;
  color: #6ceaff;
  border: 1.5px solid #30b2d9;
  white-space: nowrap;
}

.crate-pack-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.crate-pack-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.card-icon.ice-glow {
  background: linear-gradient(180deg, #d7f5ff, #9fe3fb);
  border-color: #2c98bf;
}

.barge-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.captain-hero-card {
  border-color: #e69d18;
  background: linear-gradient(180deg, #fffcf2 0%, #f5ebd1 100%);
}

.subtab-btn {
  border: none;
  background: transparent;
  color: #365673;
  font-family: "Rubik", sans-serif;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 10px;
  cursor: pointer;
}

.subtab-btn.active {
  background: #ffffff;
  color: var(--text-dark);
  box-shadow: 0 2px 0 #95b1cc;
}

.card-list { display: flex; flex-direction: column; gap: 10px; }
.shop-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.shop-item-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.shop-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #e5eff8;
  border: 2px solid #c1d5e8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.shop-info h4 { margin: 0 0 2px; font-size: 13px; color: var(--text-dark); font-weight: 800; }
.shop-info p { margin: 0; font-size: 11px; color: var(--text-muted); font-weight: 600; }
.shop-gain { color: #0e8b70; font-weight: 800; font-size: 11px; display: block; margin-top: 2px; }

.section-header-card {
  background: linear-gradient(135deg, #21496e, #122d47);
  border: 2px solid #3c709e;
  border-radius: 16px;
  padding: 12px;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  box-shadow: 0 4px 0 #0b1c2e;
}
.section-header-card h3 { margin: 0 0 4px; font-size: 15px; color: #fff; }
.section-header-card p { margin: 0; font-size: 11.5px; color: #bfd9f0; }
.quota-badge { background: rgba(7, 20, 34, 0.55); border: 1.5px solid #356794; border-radius: 12px; padding: 6px 10px; text-align: center; flex-shrink: 0; }
.quota-badge span { display: block; font-size: 9.5px; color: #b7d7f2; font-weight: 700; }
.quota-badge strong { font-size: 14px; color: #ffda57; }

.stock-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.stock-pill { background: #ffffff; border: 2px solid var(--card-border); border-radius: 12px; padding: 6px 4px; text-align: center; color: var(--text-dark); box-shadow: 0 3px 0 var(--card-lip); }
.stock-pill strong { display: block; font-size: 13px; margin-top: 2px; font-weight: 900; }
.stock-pill span { font-size: 9.5px; color: var(--text-muted); font-weight: 700; }

.workshop-card .card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.red-glow { background: #ffe5e2; border: 2px solid #ff9d91; }
.gold-glow { background: #fff4d4; border: 2px solid #f7c752; }
.card-meta h3 { margin: 0 0 3px; font-size: 13.5px; color: var(--text-dark); }
.card-meta p { margin: 0; font-size: 11px; color: var(--text-muted); }

.oyster-card { text-align: center; background: linear-gradient(180deg, #ffffff, #f2edff); border-color: #c7bbf2; }
.oyster-shell-btn { width: 100%; background: #ffffff; border: 2px dashed #8a73e8; border-radius: 14px; padding: 12px; color: var(--text-dark); font-family: "Rubik", sans-serif; font-weight: 800; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.shell-emoji { font-size: 30px; display: flex; align-items: center; justify-content: center; }
.shell-svg { width: 38px; height: 38px; display: block; }
.oyster-drop-result { margin-top: 8px; font-size: 11px; color: var(--text-muted); font-weight: 600; }

.contract-head, .contract-foot, .card-header-inline { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.contract-desc, .small-muted { margin: 0 0 8px; font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.contract-foot { margin-top: 8px; font-size: 12px; font-weight: 800; color: var(--text-dark); }
.badge-teal, .badge-gold, .badge-aurora { font-size: 10.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.badge-teal { background: #d4f7ef; color: #096b56; border: 1.5px solid #5fd9be; }
.badge-gold { background: #fff0c2; color: #7a4600; border: 1.5px solid #f5bd38; }
.badge-aurora { background: #eae3ff; color: #4728a3; border: 1.5px solid #b49eff; }

/* Sapphire TON Vault Card */
.wallet-connect-card {
  background: linear-gradient(180deg, #1a4066 0%, #0f2740 100%);
  border-color: #356996;
  color: #ffffff;
  box-shadow: 0 4px 0 #071522;
}
.wallet-connect-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.wallet-label { font-size: 11px; color: #9bc3e6; font-weight: 700; }
.wallet-addr { font-size: 13.5px; font-weight: 900; margin-top: 2px; color: #ffffff; }
.trust-row { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.16); font-size: 11.5px; display: flex; justify-content: space-between; color: #cce3f7; }
.trust-good { color: #0e8b70; font-weight: 800; }
.wallet-connect-card .trust-good { color: #5bf2b1; }

.balances-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.balance-box { background: #ffffff; border: 2px solid var(--card-border); border-radius: 16px; padding: 10px; box-shadow: 0 4px 0 var(--card-lip); color: var(--text-dark); }
.balance-box span { font-size: 11px; color: var(--text-muted); font-weight: 700; display: block; }
.balance-box strong { font-size: 16.5px; font-weight: 900; display: block; margin: 4px 0 2px; color: var(--text-dark); }
.balance-box small { font-size: 10px; font-weight: 800; color: #0e8b70; }
.withdraw-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; margin-bottom: 6px; color: var(--text-dark); }
.legal-note { margin: 8px 0 0; font-size: 10.5px; color: var(--text-muted); font-weight: 600; }
.pool-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.pool-stats-row div { background: #e8f2fb; border: 1.5px solid #c3d8eb; border-radius: 10px; padding: 6px; text-align: center; }
.pool-stats-row span { display: block; font-size: 10px; color: var(--text-muted); font-weight: 700; }
.pool-stats-row strong { font-size: 12.5px; color: var(--text-dark); font-weight: 900; }
.source-bar { display: flex; height: 22px; border-radius: 8px; overflow: hidden; font-size: 10px; font-weight: 800; border: 1.5px solid #2b5478; }
.source-bar div { display: flex; align-items: center; justify-content: center; }
.src-ads { background: #1fd19f; color: #052920; }
.src-cpa { background: #7b61ff; color: #fff; }
.src-stars { background: #ffc233; color: #361c00; }

.tx-list, .tasks-list, .friends-list, .leaderboard-list { display: flex; flex-direction: column; gap: 7px; }
.tx-row, .task-row, .friend-row, .lb-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; background: #eef5fc; border: 1.5px solid #cddfed; border-radius: 12px; font-size: 12px; color: var(--text-dark); }
.lb-row.me { border: 2px solid #16b895; background: #dcfaf3; font-weight: 800; }

.checkin-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.checkin-day { border: 2px solid #bfd4e7; background: #f2f7fc; color: var(--text-dark); font-family: "Rubik", sans-serif; border-radius: 10px; padding: 6px 2px; text-align: center; font-size: 10px; font-weight: 800; cursor: pointer; box-shadow: 0 2px 0 #a8c0d6; }
.checkin-day.claimed { background: #d6f9ef; border-color: #16b895; color: #095c48; box-shadow: none; }
.checkin-day.available { border-color: #c27800; background: linear-gradient(180deg, #ffe787, #f5b324); color: #361c00; box-shadow: 0 3px 0 #8c5200; }

.ref-link-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; background: #e8f1fa; border: 1.5px solid #b8cfe3; border-radius: 10px; padding: 6px 8px; margin-bottom: 8px; }
.ref-link-row code { font-size: 10.5px; color: #124a78; font-weight: 800; overflow: hidden; text-overflow: ellipsis; }

/* ================================
   7. Toasts & Modals
   ================================ */
.toast-container { position: fixed; top: 78px; left: 50%; transform: translateX(-50%); width: min(380px, 90vw); z-index: 185; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: linear-gradient(180deg, #1b4166, #0f2740); border: 2px solid #ffce47; border-radius: 14px; padding: 8px 14px; font-size: 12px; font-weight: 800; color: #fff; text-align: center; text-shadow: 0 1px 0 #07131f; box-shadow: 0 4px 0 #071522, 0 8px 22px rgba(0, 0, 0, 0.45); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(5, 14, 24, 0.62); backdrop-filter: blur(3px); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 14px; }
.modal-sheet { width: min(420px, 100%); background: linear-gradient(180deg, var(--ice-bg), var(--ice-bg-bot)); border: 2.5px solid #2b618c; border-radius: 22px; overflow: hidden; max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 8px 0 #0a1f33, 0 18px 40px rgba(0, 0, 0, 0.55); }
.modal-head { position: sticky; top: 0; z-index: 4; flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 15px; background: linear-gradient(180deg, #1b4369 0%, #0e263d 100%); border-bottom: 3px solid #f0a71c; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 900; color: #fff; text-shadow: 0 1.5px 0 #07131f; }
.modal-body { padding: 14px 16px 18px; overflow-y: auto; touch-action: pan-y; color: var(--text-dark); }
.demo-btn-stack { display: flex; flex-direction: column; gap: 8px; }
.toggle-label { display: flex; justify-content: space-between; align-items: center; padding: 8px 6px; font-size: 13px; font-weight: 700; color: var(--text-dark); cursor: pointer; }

.wallet-providers { display: flex; flex-direction: column; gap: 8px; }
.provider-btn { padding: 12px; border-radius: 12px; border: 2px solid #9cb8d4; background: #ffffff; color: var(--text-dark); font-family: "Rubik", sans-serif; font-weight: 800; font-size: 14px; text-align: left; cursor: pointer; box-shadow: 0 3px 0 #8eaac4; }
.provider-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #8eaac4; }
.withdraw-summary { background: #ffffff; border: 2px solid var(--card-border); border-radius: 12px; padding: 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.withdraw-summary div { display: flex; justify-content: space-between; }
.input-label { display: block; font-size: 11.5px; color: var(--text-muted); font-weight: 700; margin-bottom: 4px; }
.tma-input { width: 100%; background: #ffffff; border: 2px solid #96b5d1; border-radius: 12px; padding: 10px 12px; color: var(--text-dark); font-family: "Rubik", sans-serif; font-size: 15px; font-weight: 800; }
.center { text-align: center; }
.ad-countdown { width: 64px; height: 64px; margin: 12px auto; border-radius: 999px; border: 4px solid #1bb35b; background: #ffffff; color: var(--text-dark); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 900; }

.gallery-dialog { width: min(860px, 95vw); max-height: 88vh; overflow-y: auto; touch-action: pan-y; background: #0e2438; border: 2.5px solid #3c709e; border-radius: 22px; color: #ffffff; }
.gallery-dialog .modal-head { margin-bottom: 0; }
.gallery-palette { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px 0; margin-bottom: 14px; }
.swatch { padding: 6px 10px; border-radius: 10px; font-size: 11px; font-weight: 800; border: 1.5px solid rgba(255, 255, 255, 0.25); }
.gallery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 0 16px 18px; }
.art-card { margin: 0; background: rgba(0, 0, 0, 0.32); border: 1.5px solid #356794; border-radius: 14px; overflow: hidden; }
.art-card img { width: 100%; height: 220px; object-fit: cover; display: block; }
.art-card figcaption { padding: 8px 10px; font-size: 11.5px; color: #b7d7f2; }

/* ================================
   8. Game Loading Splash Screen
   ================================ */
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  background: radial-gradient(circle at 50% 25%, #2e72a4 0%, #102f4d 58%, #071625 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.45s ease;
}

.loading-overlay.fade-out { opacity: 0; pointer-events: none; }

.loading-card {
  width: min(350px, 100%);
  background: linear-gradient(180deg, #1b4166, #0e253b);
  border: 3px solid #f2b029;
  border-radius: 24px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 8px 0 #704300, 0 20px 44px rgba(0, 0, 0, 0.6);
}

.splash-emblem {
  width: 84px;
  height: 84px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 3.5px solid #ffda57;
  background: #1a4d78;
  overflow: hidden;
  box-shadow: 0 4px 0 #7a4700, 0 8px 20px rgba(0, 0, 0, 0.45);
}

.splash-avatar { width: 100%; height: 100%; object-fit: cover; display: block; }

.game-logo {
  margin: 0;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #ffe36e;
  text-shadow:
    -2px -2px 0 #07131f,
     2px -2px 0 #07131f,
    -2px  2px 0 #07131f,
     2px  2px 0 #07131f,
     0 4px 0 #7c4500;
}

.splash-subtitle {
  margin: 4px 0 12px;
  font-size: 13px;
  font-weight: 800;
  color: #8ce4ff;
  text-shadow: 0 1.5px 0 #07131f;
}

.splash-status {
  margin: 0 0 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: #cde3f5;
}

.loading-track {
  height: 11px !important;
  border: 2px solid #07131f;
}

/* ================================
   9. Responsive Portrait Phone Rules
   ================================ */
@media (max-width: 640px) {
  .hud-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .res-cluster { order: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .res-capsule { padding: 3px 5px; min-height: 36px; border-radius: 12px; gap: 4px; }
  .res-ico { width: 20px; height: 20px; }
  .res-val { font-size: 11.5px; }
  .res-plus-btn { width: 19px; height: 21px; font-size: 13px; }
  .captain-hud-card { order: 2; align-self: flex-start; padding: 3px 8px 3px 4px; }
  .captain-avatar-frame { width: 34px; height: 34px; }
  .left-widgets { top: 108px; }
  .side-tools { top: 108px; gap: 6px; }
  .tool-fab { width: 38px; height: 38px; }
  .quest-pill { max-width: 174px; }
  .gallery-grid { grid-template-columns: 1fr; }
}

/* ================================
   10. 16:9 Landscape Viewport Layout
   ================================ */
@media (min-aspect-ratio: 11/10) and (min-width: 780px) {
  .hud-top { padding: 8px 14px 0; }
  .hud-row { max-width: 1320px; }
  .left-widgets { top: 76px; left: 14px; gap: 6px; }
  .side-tools { top: 76px; right: 14px; gap: 6px; }
  .tool-fab { width: 38px; height: 38px; }
  .bottom-overlay { padding: 0 14px 8px; gap: 6px; }
  .bottom-nav { width: min(460px, 60vw); height: 54px; }
  .nav-svg { width: 23px; height: 23px; }
  .world-badge { font-size: 10.5px; padding: 3px 8px; }
}


/* ================================
   11. v50 Multi-Platform, 5-Provider Auth, Landscape Lock & Unlimited Fleet
   ================================ */
.landscape-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: radial-gradient(circle at 50% 30%, #1c537e 0%, #091b2c 85%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}
.landscape-card {
  max-width: 340px;
  background: linear-gradient(180deg, #163757, #0b1f33);
  border: 2.5px solid #44cdfc;
  border-radius: 22px;
  padding: 24px 20px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
}
.landscape-card h2 { margin: 10px 0 8px; font-size: 18px; color: #ffe36e; }
.landscape-card p { margin: 0 0 16px; font-size: 12.5px; color: #cbe4f8; line-height: 1.45; }
.rotate-phone-ico {
  font-size: 46px;
  display: inline-block;
  animation: rotatePhoneHint 1.8s ease-in-out infinite;
}
@keyframes rotatePhoneHint {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-90deg) scale(1.08); }
}

.pwa-banner {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 65;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  background: linear-gradient(180deg, rgba(24, 61, 96, 0.96), rgba(13, 36, 58, 0.96));
  border: 2px solid #f5b327;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  max-width: min(370px, 84vw);
}
.pwa-ico { width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid #ffd45a; flex-shrink: 0; }
.pwa-text { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 10.5px; color: #dbeeff; line-height: 1.2; }
.pwa-text strong { color: #ffe36e; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1120px) {
  .pwa-banner { top: 56px; }
  .pwa-text span { display: none; }
}

.hud-left-group { display: flex; align-items: center; gap: 7px; flex-wrap: nowrap; min-width: 0; }
.captain-hud-card { position: relative; min-height: 46px; }
.captain-top-line { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.captain-bot-line { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.xp-inline-txt { font-size: 9.5px; font-weight: 800; color: #9de8ff; white-space: nowrap; }
.xp-flush-bar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 3.5px;
  border-radius: 99px;
  background: rgba(6, 18, 30, 0.85);
  overflow: hidden;
  pointer-events: none;
}
.xp-flush-bar .progress-fill { height: 100%; border-radius: 99px; }

.account-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  max-width: 126px;
  border-radius: 13px;
  border: 2px solid #3c77a8;
  background: linear-gradient(180deg, #1b4369 0%, #0d2339 100%);
  color: #e8f5ff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 3px 0 #071422;
}
.account-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-pill:active { transform: translateY(1px); }
.sync-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: #36e88b; box-shadow: 0 0 6px #36e88b; }
.sync-dot.offline { background: #ffb830; box-shadow: 0 0 6px #ffb830; }

.stock-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.card-meta, .withdraw-summary div, .task-row div, .tx-row div { min-width: 0; overflow-wrap: anywhere; }

/* Mandatory Auth Gate Overlay (blocks game until signed in) */
.auth-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 160;
  background: radial-gradient(circle at 50% 25%, rgba(25, 76, 120, 0.96) 0%, rgba(8, 22, 36, 0.98) 78%);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-gate-card {
  width: min(460px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--ice-bg), var(--ice-bg-bot));
  border: 3px solid #f2b029;
  border-radius: 22px;
  padding: 16px 18px 18px;
  color: var(--text-dark);
  box-shadow: 0 8px 0 #704300, 0 24px 54px rgba(0, 0, 0, 0.65);
}
.auth-gate-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.gate-logo-img { width: 52px; height: 52px; border-radius: 14px; border: 2px solid #f2b029; flex-shrink: 0; }
.auth-gate-head h2 { margin: 0 0 2px; font-size: 20px; font-weight: 900; color: #0e243a; }
.auth-gate-head p { margin: 0; font-size: 11.5px; color: var(--text-muted); font-weight: 600; line-height: 1.3; }
.gate-mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #c6daec; padding: 4px; border-radius: 12px; }
.gate-error { margin-top: 8px; padding: 7px 10px; border-radius: 10px; background: #ffe4e0; border: 1.5px solid #df382a; color: #8a1b12; font-size: 11.5px; font-weight: 800; }
.gate-divider { display: flex; align-items: center; gap: 10px; margin: 12px 0 9px; font-size: 11px; font-weight: 800; color: var(--text-muted); }
.gate-divider::before, .gate-divider::after { content: ""; flex: 1; height: 1.5px; background: #c0d4e6; }

/* Non-Blocking Floating Unit Inspector Dock (map stays 100% visible!) */
.unit-inspector {
  pointer-events: auto;
  width: min(500px, calc(100vw - 24px));
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(229, 240, 251, 0.97));
  border: 2.5px solid #2b648f;
  border-radius: 18px;
  padding: 9px 12px 10px;
  color: var(--text-dark);
  box-shadow: 0 5px 0 #153957, 0 12px 30px rgba(4, 15, 28, 0.42);
}
.unit-insp-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.unit-insp-id { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.unit-insp-ico { width: 34px; height: 34px; border-radius: 10px; background: #e1effb; border: 1.5px solid #8eb5d9; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.unit-insp-title-wrap { display: flex; flex-direction: column; min-width: 0; }
.unit-insp-title-wrap strong { font-size: 13.5px; font-weight: 900; color: #0e243a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-insp-title-wrap span { font-size: 11px; font-weight: 700; color: #436687; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-insp-stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0; }
.unit-stat-chip { font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: 8px; background: #eaf3fb; border: 1px solid #c3d9ed; color: #163b5c; }
.unit-insp-actions { display: flex; gap: 7px; }
.unit-insp-actions > button { flex: 1; }

/* Right-Side Drawer Sheet on Landscape (so map stays visible!) */
@media (min-width: 740px) {
  .sheet-backdrop {
    justify-content: flex-end;
    align-items: stretch;
    background: rgba(5, 14, 24, 0.22);
    backdrop-filter: none;
    padding: 10px 10px 10px 0;
  }
  .sheet-panel {
    width: min(425px, 44vw);
    max-height: 100%;
    height: 100%;
    border-radius: 22px;
    border-bottom: 2.5px solid #2b618c;
  }
  .sheet-handle { display: none; }
}
.crate-sub { font-size: 9.5px; font-weight: 700; color: #ffe48f; display: block; line-height: 1.1; }
.stock-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.hot-demand-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(245, 166, 22, 0.18), rgba(25, 196, 157, 0.14));
  border: 1.5px solid rgba(245, 166, 22, 0.45);
  font-size: 11.5px;
  font-weight: 800;
  color: #102840;
  margin-bottom: 8px;
}

.fleet-hero-card { border-color: #d9971d !important; background: linear-gradient(180deg, #fffdf5, #eef5fc) !important; }
.fleet-kpi-grid { margin-bottom: 8px; }
.preset-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.preset-chip {
  flex: 1 1 calc(33% - 6px);
  min-width: 115px;
  padding: 7px 8px;
  border-radius: 11px;
  border: 1.8px solid #b5cee4;
  background: #ffffff;
  color: #102840;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
  transition: transform 0.1s ease;
}
.preset-chip:active { transform: scale(0.97); }
.preset-chip strong { display: block; font-size: 12px; color: #0b6e41; }

.inline-form-row { display: flex; gap: 6px; align-items: center; }
.inline-form-row .tma-input { flex: 1; margin: 0; min-width: 0; }

.curr-toggle { display: inline-flex; background: #d5e4f2; border-radius: 10px; padding: 2px; gap: 2px; }
.curr-btn {
  border: 0;
  background: transparent;
  color: #365777;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.curr-btn.active { background: #1bb35b; color: #ffffff; }

.modal-sheet .modal-body { overflow-y: auto; max-height: 70vh; }
.modal-sheet-wide { width: min(490px, 95vw); }
.identities-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 10px; }
.idn-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: #dff7eb;
  color: #0b683b;
  border: 1.5px solid #82d9ad;
}
.idn-chip.unlinked { background: #e9f1f8; color: #5b758e; border-color: #c5d6e6; }
.auth-section-title { font-size: 11.5px; font-weight: 800; color: #193e61; margin-bottom: 6px; }
.auth-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.auth-form-grid .tma-input { margin: 0; }
.auth-btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.auth-btn-row button { flex: 1; }
.auth-providers-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.provider-oauth-btn {
  border: 2px solid #0e243a;
  border-radius: 12px;
  padding: 9px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  color: #ffffff;
  text-align: center;
}
.btn-apple { background: #14181f; }
.btn-google { background: #2b6be6; }
.btn-tg { background: #1b95d6; }
.btn-ton-w3 { background: #0088cc; }
.btn-evm-w3 { background: #d6761b; grid-column: span 2; }

.dev-jump-row { display: flex; gap: 6px; }
.dev-jump-row > * { flex: 1; }
.lock-tag { font-size: 11px; color: #b54524; font-weight: 800; }

/* Mobile Landscape compactness (when phone rotates sideways e.g. 844x390!) */
@media (max-height: 460px) and (orientation: landscape) {
  .hud-top { padding: 4px 10px 0; }
  .pwa-banner { top: 50px; padding: 4px 8px; }
  .captain-hud-card { padding: 3px 7px 3px 4px; gap: 6px; min-height: 38px; }
  .captain-avatar-frame { width: 30px; height: 30px; }
  .xp-inline-txt { display: none; }
  .left-widgets { top: 56px; left: 10px; gap: 4px; }
  .quest-pill, .crate-widget-btn { padding: 4px 7px; font-size: 10px; }
  .side-tools { top: 56px; right: 10px; gap: 4px; }
  .tool-fab { width: 32px; height: 32px; }
  .bottom-overlay { padding: 0 10px 4px; gap: 4px; }
  .unit-inspector { padding: 6px 10px; }
  .unit-insp-stats { display: none; }
  .bottom-nav { height: 46px; }
  .sheet-panel { max-height: 100%; }
}
