/* V50: one readable objective, a grounded merge tray, and quieter secondary controls. */

/* The stage objective uses the same painted HUD family instead of another floating panel. */
.game-shell.phase-playing .shift-brief,
.game-shell.phase-training .shift-brief {
  position: absolute;
  top: 50px;
  left: 50%;
  z-index: 15;
  display: grid;
  width: min(360px, calc(100% - 28px));
  height: 32px;
  min-height: 0;
  box-sizing: border-box;
  aspect-ratio: 1960 / 222;
  padding: 4px 34px 5px;
  grid-template-columns: auto minmax(0, 1fr) 40px;
  grid-template-rows: minmax(15px, auto) 3px;
  gap: 1px 7px;
  border: 0;
  border-radius: 0;
  background: transparent url("../assets/meowa/ui/hud-plaque-v10.png") center / contain no-repeat;
  box-shadow: none;
  transform: translateX(-50%);
}

.game-shell.phase-playing .hud-subline,
.game-shell.phase-training .hud-subline {
  z-index: 30;
  pointer-events: none;
}

.game-shell.phase-playing .topbar,
.game-shell.phase-training .topbar {
  z-index: 40;
}

.game-shell.phase-playing .hud-subline .shift-brief .shift-act,
.game-shell.phase-training .hud-subline .shift-brief .shift-act {
  min-width: 38px;
  padding: 2px 4px;
  background: transparent;
  color: #7a3f36;
  font-size: 8px;
  line-height: 1.2;
  text-shadow: 0 1px #f8dfaa;
}

.game-shell.phase-playing .hud-subline .shift-brief .shift-copy,
.game-shell.phase-training .hud-subline .shift-brief .shift-copy {
  justify-content: center;
  gap: 8px;
  color: #3c2229;
  text-shadow: 0 1px #f9e4b4;
}

.game-shell.phase-playing .hud-subline .shift-brief .shift-copy strong,
.game-shell.phase-training .hud-subline .shift-brief .shift-copy strong {
  font-size: 11px;
  line-height: 1.2;
}
.game-shell.phase-playing .hud-subline .shift-brief .shift-copy span,
.game-shell.phase-training .hud-subline .shift-brief .shift-copy span {
  display: block;
  color: #6b3d36;
  font-size: 8px;
  line-height: 1.2;
}
.game-shell.phase-playing .hud-subline .shift-brief .shift-count,
.game-shell.phase-training .hud-subline .shift-brief .shift-count {
  color: #7c3044;
  font-size: 10px;
  line-height: 1.2;
  text-align: right;
  text-shadow: 0 1px #f9e4b4;
}
.game-shell.phase-playing .hud-subline .shift-brief .shift-track,
.game-shell.phase-training .hud-subline .shift-brief .shift-track {
  display: block;
  height: 3px;
  background: rgb(36 25 33 / 36%);
}
.shift-track span { background: #b77543; }
.shift-brief.complete .shift-act { background: transparent; color: #2f6b55; }

/* The contract draft sits in the lower visual centre instead of leaving a dead lower half. */
@media (min-width: 721px) and (min-height: 500px) {
  #contractDraftModal .contract-modal-card {
    transform: translateY(min(11vh, 86px));
  }
}

@media (min-width: 1100px) and (min-height: 500px) {
  #contractDraftModal .contract-modal-card {
    transform: translateY(min(6vh, 48px));
  }
}

/* Match the physical tray's natural proportion and keep it entirely on the wooden worktop. */
@media (min-width: 721px) and (min-height: 500px) {
  .merge-panel .board-stage {
    width: 395px;
    height: 296px;
    top: -54px;
    padding-bottom: 0;
    transform: perspective(900px) rotateX(18deg);
    transform-origin: 50% 80%;
    filter: drop-shadow(0 14px 9px rgb(12 7 8 / 36%));
  }
}

@media (min-width: 721px) and (max-width: 1024px) and (min-height: 500px) {
  .merge-panel .board-stage {
    left: -18px;
    width: 360px;
    height: 270px;
    top: -30px;
  }

  .merge-panel .board-stage .board {
    grid-template-columns: repeat(5, 52px);
    grid-template-rows: repeat(4, 52px);
  }

  .merge-panel .board-stage .cell {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    padding: 6px;
  }
}

.merge-panel .board-tray-base img {
  filter: brightness(.96) saturate(.9) sepia(.025);
}

/* Ingredient art owns the purchase button; tools stay available without stealing focus. */
.supply-medallion {
  padding: 4px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent url("../assets/meowa/ui/coin-badge.png") center / contain no-repeat !important;
  box-shadow: none;
}

.supply-art {
  width: 84%;
  height: 84%;
}

.purchase-dock .supply-tools {
  opacity: .58;
}

.purchase-dock .supply-tools:hover,
.purchase-dock .supply-tools:focus-within {
  opacity: .9;
}

.game-shell.phase-playing .contract-chip,
.game-shell.phase-training .contract-chip {
  opacity: .52;
  filter: saturate(.7) brightness(.88);
}

.game-shell.phase-playing .contract-chip:hover,
.game-shell.phase-playing .contract-chip:focus-visible,
.game-shell.phase-training .contract-chip:hover,
.game-shell.phase-training .contract-chip:focus-visible {
  opacity: .86;
  filter: saturate(.9) brightness(.96);
}

.shop .order-rail-ticket {
  filter: brightness(1.03) saturate(.9) drop-shadow(0 5px 5px rgb(13 8 12 / 48%));
}

@media (max-width: 720px) and (orientation: portrait) {
  .game-shell.phase-playing .shift-brief,
  .game-shell.phase-training .shift-brief {
    top: 42px;
    width: min(300px, calc(100% - 16px));
    height: 29px;
    padding: 3px 28px 4px;
    grid-template-columns: 32px minmax(0, 1fr) 34px;
    grid-template-rows: minmax(14px, auto) 3px;
    gap: 1px 5px;
  }

  .game-shell.phase-playing .hud-subline .shift-brief .shift-act,
  .game-shell.phase-training .hud-subline .shift-brief .shift-act { min-width: 34px; padding: 2px; font-size: 7px; }
  .game-shell.phase-playing .hud-subline .shift-brief .shift-copy,
  .game-shell.phase-training .hud-subline .shift-brief .shift-copy { gap: 4px; }
  .game-shell.phase-playing .hud-subline .shift-brief .shift-copy strong,
  .game-shell.phase-training .hud-subline .shift-brief .shift-copy strong { font-size: 10px; }
  .game-shell.phase-playing .hud-subline .shift-brief .shift-copy span,
  .game-shell.phase-training .hud-subline .shift-brief .shift-copy span { display: block; font-size: 8px; }
  .game-shell.phase-playing .hud-subline .shift-brief .shift-count,
  .game-shell.phase-training .hud-subline .shift-brief .shift-count { font-size: 10px; }
  .shift-track { height: 4px; }

  .merge-panel .board-stage {
    width: 360px;
    height: 360px;
    top: -14px;
  }

  .purchase-dock .buy-btn .supply-copy b { font-size: 10px; }
  .purchase-dock .buy-btn .supply-copy span { font-size: 9px; }
  .purchase-dock .supply-tools { opacity: .48; }
  .game-shell.phase-playing .contract-chip,
  .game-shell.phase-training .contract-chip { opacity: .46; }
}

@media (max-height: 430px) and (orientation: landscape) {
  #contractDraftModal .contract-choices {
    align-items: center;
    justify-items: center;
    gap: 8px;
    overflow: hidden;
  }

  #contractDraftModal .contract-choice {
    width: 180px;
    max-width: 180px;
  }

  .game-shell.phase-playing .shift-brief,
  .game-shell.phase-training .shift-brief {
    top: -3px;
    width: 310px;
    height: 29px;
    padding: 3px 28px 4px;
    grid-template-columns: 32px minmax(0, 1fr) 34px;
    grid-template-rows: minmax(14px, auto) 3px;
    gap: 1px 4px;
  }

  .game-shell.phase-playing .hud-subline .shift-brief .shift-act,
  .game-shell.phase-training .hud-subline .shift-brief .shift-act { min-width: 30px; padding: 1px; font-size: 7px; }
  .game-shell.phase-playing .hud-subline .shift-brief .shift-copy,
  .game-shell.phase-training .hud-subline .shift-brief .shift-copy { gap: 4px; }
  .game-shell.phase-playing .hud-subline .shift-brief .shift-copy strong,
  .game-shell.phase-training .hud-subline .shift-brief .shift-copy strong { font-size: 10px; }
  .game-shell.phase-playing .hud-subline .shift-brief .shift-copy span,
  .game-shell.phase-training .hud-subline .shift-brief .shift-copy span { display: block; font-size: 8px; }
  .game-shell.phase-playing .hud-subline .shift-brief .shift-count,
  .game-shell.phase-training .hud-subline .shift-brief .shift-count { font-size: 10px; }
  .shift-track { height: 3px; }

  .merge-panel .board-stage {
    width: 280px;
    height: 210px;
    top: -10px;
    padding-bottom: 0;
    transform: perspective(780px) rotateX(5deg);
  }

  .purchase-dock .supply-tools { opacity: .46; }
  .game-shell.phase-playing .contract-chip,
  .game-shell.phase-training .contract-chip { opacity: .44; }
}

@media (prefers-reduced-motion: reduce) {
  .purchase-dock .supply-tools,
  .contract-chip { transition: none; }
}
