/* Mining League UI sprites — narrow-phone layout aligned to mockup V2. */
:root {
  --ml-navy: #163a78;
  --ml-deep: #0b2a55;
  --ml-sky: #3a7ad9;
  --ml-cream: #fff7e2;
  --ml-ink: #1a3a6e;
}

body {
  background: radial-gradient(ellipse at 50% 18%, #6aa8ef, #143a6e 72%);
}

#app {
  max-width: 390px;
  background: linear-gradient(#3a7fd0 0%, #1e56a0 42%, #123a72 100%);
  border-color: #5a96e0;
  color: var(--ml-cream);
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
}

/* —— Header: [hex|УРОВЕНЬ] …… [coin|N] [settings] —— */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 4px;
  background: transparent !important;
  border-bottom: 0 !important;
  overflow: visible;
  min-height: 52px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
  margin-left: auto;
}

.hud-plate {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px 0 18px;
  background: url("../art/ui/ml_ui_panel_counter_small.png") center / 100% 100% no-repeat;
  line-height: 1;
  box-sizing: border-box;
}

.level-badge {
  display: flex;
  align-items: center;
  flex: none;
  height: 50px;
  margin: 0;
  padding: 0;
  background: none;
  min-width: 0;
  line-height: 1;
}

.level-hex-wrap {
  position: relative;
  z-index: 2;
  flex: none;
  width: 46px;
  height: 50px;
  margin-right: -18px;
}

.level-hex {
  display: block;
  width: 46px;
  height: 50px;
  filter: drop-shadow(0 2px 0 #0d2f6688);
  position: static;
  margin: 0;
  transform: none;
}

#mine-level-num {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  transform: none;
  text-align: center;
  font-size: 26px;
  font-weight: 1000;
  line-height: 1;
  color: #111 !important;
  text-shadow: 0 1px 0 #fff3b8;
  z-index: 2;
  pointer-events: none;
  letter-spacing: -1px;
}

.level-badge .hud-plate {
  min-width: 88px;
  padding: 0 14px 0 20px;
}

.level-label {
  display: block;
  width: auto;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 1px 0 #062048, 0 0 2px #062048;
  white-space: nowrap;
}

#wallet {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 50px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  gap: 0 !important;
}

#wallet .wallet-coin {
  position: relative;
  z-index: 2;
  flex: none;
  width: 42px;
  height: 42px;
  margin: 0 -16px 0 0;
  left: auto;
  top: auto;
  transform: none;
  filter: drop-shadow(0 2px 0 #0d2f6688);
}

#wallet .hud-plate {
  min-width: 72px;
  padding: 0 16px 0 18px;
  background-image: url("../art/ui/ml_ui_panel_counter_wide.png");
}

#wallet b,
#wallet #coins {
  position: static !important;
  font-size: 20px !important;
  font-weight: 1000;
  line-height: 1;
  color: #fff !important;
  text-shadow: 0 2px 0 #062048;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.3px;
}

.icon-btn {
  width: 42px !important;
  height: 42px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  flex: none;
}
.icon-btn img { width: 100%; height: 100%; display: block; object-fit: contain; }
.settings-btn { margin: 0; }

@media (max-width: 380px) {
  #wallet { min-width: 0 !important; padding: 0 !important; height: 50px !important; }
  #wallet b, #wallet #coins { font-size: 18px !important; }
}

/* —— Orders: two equal cards (sprite aspect ~1.13) —— */
#orders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: unset;
  grid-auto-columns: unset;
  align-items: stretch;
  padding: 2px 8px 0;
  gap: 8px;
}

.order {
  border: 0 !important;
  border-radius: 0 !important;
  padding: 12px 10px 8px;
  color: #163a78;
  background: url("../art/ui/ml_home_panel_order_narrow.png") center / 100% 100% no-repeat;
  box-shadow: none !important;
  min-height: 0;
  height: auto;
  aspect-ratio: 439 / 389;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.order:only-child {
  grid-column: 1;
  max-width: none;
  justify-self: stretch;
  width: auto;
}

.order h3 {
  font-size: 12px;
  font-weight: 900;
  color: #163a78;
  text-align: center;
  margin: 0 0 2px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: none;
}

.order-chain {
  display: none;
}

.order-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.requirements {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.ingredient {
  width: 40px;
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.order .requirements:has(.ingredient:nth-child(3)) {
  gap: 4px;
}

.order .requirements:has(.ingredient:nth-child(3)) .ingredient {
  width: 32px;
}

.ingredient img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 1px #0a275844);
}

.ingredient b {
  position: absolute;
  top: -2px;
  right: -4px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: url("../art/ui/ml_ui_badge_count_cyan.png") center / 100% 100% no-repeat;
  color: #fff;
  font-size: 10px;
  font-weight: 1000;
  line-height: 18px;
  text-align: center;
  box-shadow: none;
}

.order .requirements:has(.ingredient:nth-child(3)) .ingredient b {
  width: 15px;
  height: 15px;
  font-size: 8px;
  line-height: 15px;
  right: -3px;
}

.ingredient small {
  position: static;
  display: block;
  font-size: 11px;
  font-weight: 900;
  color: #d32f2f;
  line-height: 1.1;
}

.ingredient.complete small { color: #2f8f4a; }

.ingredient.complete:after {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  margin: 0 auto;
  background: url("../art/ui/ml_ui_icon_check_green.png") center / contain no-repeat;
}

.order .reward { display: none; }

.submit {
  margin-top: auto;
  flex: none;
  align-self: stretch;
  min-height: 30px;
  height: 30px;
  border: 0 !important;
  border-radius: 0 !important;
  background: url("../art/ui/ml_ui_button_wide_gray_disabled.png") center / 100% 100% no-repeat;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 1;
  text-shadow: 0 1px 0 #2a3a4a;
}

.submit img { width: 16px; height: 16px; }

.submit.ready {
  background-image: url("../art/ui/ml_ui_button_wide_green_normal.png");
  color: #fff;
  text-shadow: 0 1px 0 #1d5d3d;
}

.submit.ready:active {
  background-image: url("../art/ui/ml_ui_button_wide_green_pressed.png");
}

.submit:disabled {
  opacity: 1;
  filter: none;
}

/* —— Mine progress —— */
.mine-progress {
  padding: 6px 10px 6px;
  color: #fff;
  font-size: 11px;
  flex: none;
}

.mine-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
  gap: 8px;
}

.mine-progress #mine-name {
  color: #fff;
  font-weight: 700;
  text-shadow: 0 1px 0 #0a2758;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mine-progress b,
.mine-progress #quota {
  color: #ffe27a !important;
  font-size: 12px !important;
  font-weight: 900;
  text-shadow: 0 1px 0 #0a2758;
  flex: none;
}

.track {
  height: 18px;
  border: 0 !important;
  border-radius: 0 !important;
  background: url("../art/ui/ml_ui_bar_track_mine.png") center / 100% 100% no-repeat;
  box-shadow: none !important;
  overflow: hidden;
  position: relative;
}

.track i,
.track #mine-fill {
  display: block;
  height: 100%;
  border-radius: 0;
  background: url("../art/ui/ml_ui_bar_fill_mine_gold.png") center / 100% 100% no-repeat;
  background-color: transparent;
  box-shadow: none;
  max-width: 100%;
}

/* —— Arena —— */
#arena {
  background: transparent;
  min-height: 0;
  flex: 1 1 auto;
}

.cave {
  background:
    linear-gradient(#1d4f9600 0%, #1d4f9618 40%, #123a72cc 100%),
    url("../art/cave.webp") center / cover;
  opacity: .45;
}

.activities {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  padding: 0;
  gap: 0;
  pointer-events: none;
  grid-template-columns: unset;
}

.activities[hidden] { display: none !important; }

.activities button {
  pointer-events: auto;
  width: 58px;
  min-height: 64px;
  padding: 2px 1px 1px;
  border: 0;
  border-radius: 0;
  background: url("../art/ui/ml_ui_button_activity_blue.png") center / 100% 100% no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
  color: #fff8e4;
  box-shadow: none;
}

.activities button > span:nth-child(2),
.activity-caption {
  font-size: 9px;
  font-weight: 900;
  text-shadow: 0 1px 0 #0d2f66;
  margin: 0;
}

.activities small { display: none; }

.activity-art {
  width: 34px;
  height: 34px;
  object-fit: contain;
  margin-top: 2px;
}

.count-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 0;
  background: url("../art/ui/ml_ui_badge_count_cyan.png") center / 100% 100% no-repeat;
  color: #12356a !important;
  font-size: 10px !important;
  line-height: 20px;
  text-align: center;
  box-shadow: none;
}

#target-info {
  padding: 2px 24px 0;
  z-index: 4;
}

.target-tag {
  font-size: 8px;
  letter-spacing: 1.2px;
  color: #c5dcff;
  margin-bottom: 2px;
}

h1 {
  font-size: 18px;
  color: #fff4d4;
  text-shadow: 0 2px 0 #12356a, 0 4px 10px #02142888;
  line-height: 1.1;
}

#target-value {
  height: 18px;
  font-size: 12px;
  color: #ffe27a;
}

#target-value:empty { height: 4px; }

.health {
  height: 16px;
  max-width: 240px;
  border: 0;
  border-radius: 0;
  background: url("../art/ui/ml_ui_bar_track_thin.png") center / 100% 100% no-repeat;
  overflow: hidden;
}

.health i {
  border-radius: 0;
  background: url("../art/ui/ml_ui_bar_fill_green.png") center / 100% 100% no-repeat;
}

.health.monster-health { border: 0; }

.health.monster-health #hp {
  background: url("../art/ui/ml_ui_bar_fill_hp_red.png") center / 100% 100% no-repeat;
}

.health.monster-health #hp-trail { background: #ffb0a088; }

.health b {
  line-height: 14px;
  font-size: 10px;
  text-shadow: 0 1px 0 #12356a;
}

#battle {
  min-height: 180px;
  max-height: none;
  flex: 1 1 auto;
}

#target {
  width: 48%;
  height: 78%;
  top: 46%;
}

/* Mockup: no nameplates on battle heroes */
#battle .hero-name { display: none; }
#battle .hero canvas {
  height: 100%;
  top: 0;
}
#battle .hero small {
  bottom: 2%;
  opacity: .55;
}

/* Capacity = chest + counter, pinned under target */
.capacity {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  z-index: 6;
  width: 118px;
  height: 72px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  filter: drop-shadow(0 4px 6px #02142866);
}

.capacity-chest {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 88px;
  height: 52px;
  object-fit: contain;
  z-index: 0;
}

.capacity-bar {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 28px;
  display: grid;
  place-items: center;
}

.capacity-bar > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.capacity-bar b {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: #fff8e4;
  text-shadow: 0 2px 0 #12356a;
}

#start {
  bottom: 78px;
  width: 180px;
  min-height: 38px;
  font-size: 14px;
  z-index: 7;
}

#status {
  color: #c9dcff;
  min-height: 0;
  padding: 0 8px 2px;
  font-size: 9px;
}

/* —— Bottom navigation —— */
footer.main-nav,
footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px 10px max(8px, env(safe-area-inset-bottom));
  border-top: 0;
  background: transparent;
  flex: none;
}

.nav-btn {
  position: relative;
  min-height: 52px;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 8px 8px;
  color: #fff8e4;
  font-weight: 900;
  font-size: 14px;
  overflow: visible;
}

.nav-btn .nav-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.nav-btn .nav-icon {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 2px 0 #0d2f6688);
}

.nav-btn > span {
  position: relative;
  z-index: 1;
  text-align: left;
  text-shadow: 0 2px 0 #0d2f66;
}

.nav-btn small {
  display: none;
}

.nav-btn.ready {
  filter: drop-shadow(0 0 8px #ffe27a88);
}

#upgrade-dot {
  top: 0;
  right: 6px;
  z-index: 2;
}

/* —— Shared buttons —— */
button.gold,
.gold {
  border: 0;
  border-radius: 0;
  color: #5a3a12;
  text-shadow: 0 1px 0 #ffe9a8;
  background: url("../art/ui/ml_ui_button_wide_gold_normal.png") center / 100% 100% no-repeat;
  box-shadow: none;
}

button.gold:active:not(:disabled),
.gold:active:not(:disabled) {
  background-image: url("../art/ui/ml_ui_button_wide_gold_pressed.png");
  filter: none;
  transform: translateY(2px);
}

#start:active {
  transform: translateX(-50%) translateY(2px);
}

button.gold:disabled,
.gold:disabled {
  background-image: url("../art/ui/ml_ui_button_wide_gray_disabled.png");
  color: #d9d0bc;
  text-shadow: none;
  opacity: 1;
  filter: none;
}

button.teal,
.teal {
  border: 0;
  border-radius: 0;
  color: #fff8e4;
  text-shadow: 0 1px 0 #0d3d66;
  background: url("../art/ui/ml_ui_button_wide_blue_normal.png") center / 100% 100% no-repeat;
  box-shadow: none;
}

button.teal:active:not(:disabled),
.teal:active:not(:disabled) {
  background-image: url("../art/ui/ml_ui_button_wide_blue_pressed.png");
  filter: none;
}

/* —— Modals —— */
#overlay {
  background: #06224ccc;
  backdrop-filter: blur(2px);
}

.modal {
  border: 0;
  border-radius: 0;
  background: url("../art/ui/ml_ui_panel_dialog_wide.png") center / 100% 100% no-repeat;
  background-color: #eef5ffee;
  color: var(--ml-ink);
  box-shadow: 0 18px 40px #02142888;
  padding: 22px 18px 18px;
}

.modal h2 { color: #163a78; }
.eyebrow { color: #3a7ad9; }
.sub { color: #3d5f8f; }
.notice { color: #3d5f8f; }

.close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: transparent;
  font-size: 0;
}

.inventory-sheet {
  background: url("../art/ui/ml_ui_panel_bottom_drawer.png") center top / 100% 100% no-repeat;
  background-color: #d9ebff;
  border-radius: 0;
  color: var(--ml-ink);
}

.inventory-sheet h2 { color: #163a78; }

.board { gap: 4px; }

.cell {
  border: 0;
  border-radius: 0;
  background: url("../art/ui/ml_inventory_slot_empty.png") center / 100% 100% no-repeat;
  padding: 4px;
}

.cell:not(:empty) {
  background-image: url("../art/ui/ml_inventory_frame_normal.png");
}

.cell.needed {
  background-image: url("../art/ui/ml_inventory_frame_order.png");
  box-shadow: none;
}

.cell.needed:after { display: none; }

.cell.match {
  background-image: url("../art/ui/ml_inventory_frame_pair.png");
  box-shadow: none;
}

.cell.selected {
  background-image: url("../art/ui/ml_inventory_frame_selected.png");
  box-shadow: none;
}

.cell b {
  background: #1f5db5;
  border-color: #9ec7ff;
  color: #fff8e4;
}

.board-footer { color: #3d5f8f; }
.inv-capacity {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  font-size: 13px;
  color: #fff8e4;
  background: url("../art/ui/ml_ui_badge_count_cyan.png") center / 100% 100% no-repeat;
  vertical-align: middle;
}
.close img { width: 100%; height: 100%; display: block; }
.mine-up button img,
.gold img,
.wide img,
.submit img { width: 18px; height: 18px; vertical-align: middle; }
.effect-icon img { width: 36px; height: 36px; object-fit: contain; }

.trash {
  border: 0;
  background: url("../art/ui/ml_ui_button_wide_gray_disabled.png") center / 100% 100% no-repeat;
  color: #fff;
}

.mine-up {
  border: 0;
  border-radius: 0;
  background: url("../art/ui/ml_ui_card_statistics_row.png") center / 100% 100% no-repeat;
  color: #163a78;
}

.mine-up small { color: #3d5f8f; }

.stats-grid .stat {
  border: 0;
  border-radius: 0;
  background: url("../art/ui/ml_ui_card_stat.png") center / 100% 100% no-repeat;
  color: #163a78;
}

.stats-grid .stat small { color: #3d5f8f; }

.choice {
  border: 0;
  border-radius: 0;
  background: url("../art/ui/ml_ui_card_boost.png") center / 100% 100% no-repeat;
  box-shadow: none;
  color: #163a78;
}

.choice.rarity-1,
.choice.rarity-2,
.choice.rarity-3 {
  --rarity: transparent;
}

.choice .rarity { color: #3a7ad9; }
.choice .amount { color: #c47a12; }
.choice .who { color: #3d5f8f; }

.choice button {
  border: 0;
  background: url("../art/ui/ml_ui_button_wide_blue_normal.png") center / 100% 100% no-repeat;
  color: #fff8e4;
}

.team-card {
  border: 0;
  border-radius: 0;
  background: url("../art/ui/ml_ui_card_portrait.png") center / 100% 100% no-repeat;
  color: #163a78;
  padding: 10px 6px;
}

.team-card small { color: #3d5f8f; }

.hero-large {
  background: url("../art/ui/ml_ui_panel_portrait_large.png") center / contain no-repeat;
  padding: 10px;
}

.slot-window {
  border: 0;
  background: url("../art/ui/ml_ui_panel_dialog_wide.png") center / 100% 100% no-repeat;
  box-shadow: none;
}

.resource-line { color: #3d5f8f; }
.resource-line b { color: #c47a12; }
.mini-result { color: #163a78; }
.mini-result strong { color: #c47a12; }
.upgrade-log { color: #3d5f8f; }

.timing {
  height: 28px;
  border: 0;
  border-radius: 0;
  background: url("../art/ui/ml_fishing_gauge_track.png") center / 100% 100% no-repeat;
  margin-top: 16px;
}

.timing-zone {
  background: url("../art/ui/ml_fishing_gauge_success_zone.png") center / 100% 100% no-repeat;
  border: 0;
}

.timing-pointer {
  width: 18px;
  height: 32px;
  top: -4px;
  border: 0;
  border-radius: 0;
  background: url("../art/ui/ml_fishing_gauge_cursor.png") center / contain no-repeat;
  box-shadow: none;
}

.fish-progress {
  height: 10px;
  border-radius: 0;
  background: url("../art/ui/ml_ui_bar_track_thin.png") center / 100% 100% no-repeat;
}

.fish-progress i {
  background: url("../art/ui/ml_ui_bar_fill_green.png") left center / auto 100% no-repeat;
}

.settings-grid button {
  border: 0;
  border-radius: 0;
  background: url("../art/ui/ml_ui_button_wide_blue_normal.png") center / 100% 100% no-repeat;
  color: #fff8e4;
  min-height: 44px;
}

.settings-grid button.danger {
  background-image: url("../art/ui/ml_ui_button_wide_orange_normal.png");
  color: #fff8e4;
}

.settings-grid a.gold {
  background: url("../art/ui/ml_ui_button_wide_gold_normal.png") center / 100% 100% no-repeat;
  color: #5a3a12;
}

#toast {
  background: #0d2f66f0;
  border: 1px solid #7eb0ff;
  color: #fff4d4;
  bottom: 120px;
}

#loader {
  background: linear-gradient(#2f6fc0, #143a6e);
}

.logo { color: #ffe27a; text-shadow: 0 2px #12356a; }
.logo span { color: #fff8e4; }

.effect-icon {
  background: url("../art/ui/ml_ui_badge_hex_blue.png") center / contain no-repeat;
}

@media (max-height: 700px) {
  .order { padding: 8px 8px 6px; }
  .order h3 { font-size: 11px; }
  .ingredient { width: 34px; }
  .order .requirements:has(.ingredient:nth-child(3)) .ingredient { width: 28px; }
  .submit { height: 26px; min-height: 26px; font-size: 12px; }
  .track { height: 15px; }
  .mine-progress { padding-top: 4px; padding-bottom: 4px; }
  #battle { min-height: 150px; }
  .capacity { height: 64px; width: 100px; }
  .capacity-chest { width: 76px; height: 44px; }
  #start { bottom: 68px; width: 160px; min-height: 34px; font-size: 13px; }
  .nav-btn { min-height: 46px; font-size: 13px; }
  h1 { font-size: 16px; }
}

@media (max-width: 360px) {
  .level-hex-wrap { width: 40px; height: 44px; margin-right: -14px; }
  .level-hex { width: 40px; height: 44px; }
  #mine-level-num { font-size: 22px; }
  .level-label { font-size: 10px; letter-spacing: .6px; }
  .level-badge .hud-plate { min-width: 76px; }
  #wallet .wallet-coin { width: 36px; height: 36px; margin-right: -12px; }
  #wallet .hud-plate { min-width: 56px; }
  .icon-btn { width: 36px !important; height: 36px !important; }
  .nav-btn .nav-icon { width: 26px; height: 26px; }
  .order h3 { font-size: 9px; }
}
