/* V53: use the whole medium-height desktop canvas and keep decisions glanceable. */

@media (min-width: 721px) and (min-height: 500px) and (max-aspect-ratio: 3 / 2) {
  .game-shell {
    width: min(100vw, calc(100dvh * 4 / 3));
    height: min(100dvh, calc(100vw * 3 / 4));
  }

  .scene-backdrop img {
    object-fit: cover;
    object-position: center;
  }

  .game-shell.phase-playing .shift-brief,
  .game-shell.phase-training .shift-brief {
    left: 50%;
    width: min(360px, calc(100% - 28px));
  }

  .game-shell.phase-playing #shiftHint,
  .game-shell.phase-training #shiftHint {
    overflow: visible;
    text-overflow: clip;
  }

  .game-shell.phase-playing .merge-panel,
  .game-shell.phase-training .merge-panel {
    top: calc(100% * 125 / 288 + 4px);
    right: 2.5%;
    bottom: 8px;
    left: 2.5%;
    grid-template-columns: 156px minmax(0, 360px) 156px;
    gap: 10px;
    justify-content: space-between;
  }

  .merge-panel .board-stage {
    left: 0;
    top: -18px;
    width: 360px;
    height: 270px;
    transform: perspective(900px) rotateX(18deg);
  }

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

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

  .merge-panel .board-stage .cell img {
    width: 40px;
    height: 40px;
  }

  .merge-panel .purchase-dock,
  .merge-panel .mutation-dock,
  .merge-panel .mutation-bar {
    width: 156px;
  }

  .purchase-dock .buy-btn {
    width: 156px;
    height: 48px;
    min-height: 48px;
    grid-template-columns: 40px minmax(0, 1fr) 18px;
  }

  .purchase-dock .supply-medallion {
    width: 38px;
    height: 38px;
  }

  .purchase-dock .supply-art {
    width: 35px;
    height: 35px;
  }

  .shop .order-rail-slot.left { left: 30%; }
  .shop .order-rail-slot.right { left: 70%; }

  .shop .order-rail-slot,
  .shop .order-rail-ticket {
    width: 200px;
  }

  .shop .order-rail-ticket {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .shop .order-rail-ticket .order-dish {
    width: 40px;
    height: 40px;
  }

  .shop .order-rail-ticket .order-line { font-size: 13px; }
  .shop .order-rail-ticket .order-level { font-size: 11px; }
  .shop .order-rail-ticket .patience { height: 7px; }

  #contractDraftModal .contract-modal-card {
    width: min(96vw, 1120px);
    padding: 24px 48px 12px;
    align-content: center;
  }

  #contractDraftModal .contract-choices {
    grid-template-columns: repeat(3, minmax(0, 198px));
    gap: clamp(12px, 1.8vw, 22px);
  }

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

  #contractDraftModal .contract-confirm {
    height: 44px;
    min-height: 44px;
    aspect-ratio: auto;
  }

  #contractDraftModal .contract-route {
    display: flex !important;
  }

  #contractDraftModal .effect-note {
    display: none;
  }

  #contractDraftModal .effect-main {
    font-size: 13px;
    line-height: 1.2;
  }

  #contractDraftModal .contract-choice .effect-label {
    font-size: 12px;
  }

  #starTideModal .star-tide-card {
    width: min(96vw, 1180px);
    padding-top: clamp(122px, 11vw, 142px);
    padding-bottom: clamp(24px, 2.4vw, 34px);
    align-content: center;
  }

  #starTideModal .event-choices {
    align-self: end;
    transform: translateY(clamp(8px, 1.2vh, 14px));
  }
}

@media (min-width: 721px) and (max-width: 780px) and (min-height: 500px) and (max-aspect-ratio: 3 / 2) {
  .game-shell.phase-playing .merge-panel,
  .game-shell.phase-training .merge-panel {
    right: 2%;
    left: 2%;
    grid-template-columns: 140px minmax(0, 320px) 140px;
    gap: 8px;
  }

  .merge-panel .board-stage {
    width: 320px;
    height: 240px;
  }

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

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

  .merge-panel .board-stage .cell img {
    width: 37px;
    height: 37px;
  }

  .merge-panel .purchase-dock,
  .merge-panel .mutation-dock,
  .merge-panel .mutation-bar,
  .purchase-dock .buy-btn {
    width: 140px;
  }

  .shop .order-rail-slot,
  .shop .order-rail-ticket {
    width: 184px;
  }

  #contractDraftModal .contract-choices {
    grid-template-columns: repeat(3, minmax(0, 188px));
    gap: 10px;
  }

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