/* Mobile playability polish for the match-3 demo.
   Keep this file additive so the desktop portfolio layout remains intact. */

.board-cell.selected {
  outline: 3px solid rgba(255, 249, 211, 0.98);
  box-shadow:
    0 0 0 5px rgba(214, 164, 46, 0.72),
    0 12px 26px rgba(58, 42, 18, 0.26),
    inset 0 -8px 0 rgba(0, 0, 0, 0.08);
  transform: scale(1.05);
  z-index: 5;
}

.board-cell.drag-target {
  outline: 3px solid rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 0 5px rgba(71, 111, 120, 0.58),
    0 0 24px rgba(71, 111, 120, 0.46),
    inset 0 -8px 0 rgba(0, 0, 0, 0.08);
  transform: scale(1.04);
  z-index: 4;
}

.board-cell.drag-target::before {
  content: "交换";
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
  z-index: 8;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 250, 226, 0.98);
  color: #5b3d0e;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 6px 12px rgba(96, 66, 18, 0.16);
  pointer-events: none;
}

.mobile-quick-hud {
  display: none;
}

.mobile-board-help {
  display: none;
}

@media (max-width: 900px) {
  .page-shell {
    padding: 12px 10px calc(96px + env(safe-area-inset-bottom));
  }

  .hero {
    display: none;
  }

  .tabs {
    margin: 0 0 10px;
    gap: 8px;
  }

  .tab {
    flex: 1;
    padding: 10px 12px;
    font-size: 0.92rem;
  }

  .play-layout,
  .play-top-row,
  .play-bottom-row,
  .center-column,
  .right-column,
  .left-column {
    gap: 12px;
  }

  .play-top-row {
    display: flex;
    flex-direction: column;
  }

  .play-top-row .center-column {
    order: 1;
  }

  .play-top-row .left-column {
    order: 2;
  }

  .play-top-row .right-column {
    order: 3;
  }

  .play-bottom-row {
    display: flex;
    flex-direction: column;
  }

  .panel {
    padding: 14px;
    border-radius: 20px;
  }

  .board-panel {
    padding: 12px 8px 14px;
    border-radius: 24px;
  }

  .board-panel-head {
    margin-bottom: 8px;
  }

  .board-panel-head .micro-copy,
  .micro-pills,
  .board-panel > .micro-copy {
    display: none;
  }

  .board-grid {
    width: min(100%, 94vw);
    margin: 0 auto;
    gap: 5px;
  }

  .board-cell {
    border-radius: 14px;
    padding: 4px;
    box-shadow:
      inset 0 -5px 0 rgba(0, 0, 0, 0.08),
      0 5px 12px rgba(58, 42, 18, 0.12);
  }

  .board-cell.has-special,
  .board-cell.has-goal-surface,
  .board-cell.has-crate-surface {
    padding: 0;
  }

  .tile-special-surface,
  .tile-goal-surface,
  .tile-crate-surface {
    border-radius: 13px;
  }

  .goal-badge,
  .crate-badge {
    top: 4px;
    left: 4px;
    right: auto;
    width: 24px;
    height: 24px;
    border-radius: 10px;
  }

  .goal-badge {
    left: auto;
    right: 4px;
  }

  .crate-count {
    right: -4px;
    bottom: -4px;
  }

  .special-name-chip {
    left: 50%;
    bottom: 50%;
    transform: translate(-50%, 50%);
    min-width: 28px;
    max-width: calc(100% - 8px);
    padding: 3px 6px;
    font-size: 0.62rem;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
    background: rgba(26, 20, 14, 0.7);
  }

  .summary-panel {
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 16px;
  }

  .summary-panel.idle p {
    display: none;
  }

  .summary-panel strong {
    display: block;
    font-size: 0.9rem;
  }

  .summary-chips {
    gap: 6px;
    margin-top: 8px;
  }

  .summary-chip {
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .play-hud {
    position: static;
  }

  .play-hud .panel-title,
  .play-hud .stats-grid,
  .play-hud .status-banner,
  .play-hud .button-row,
  .play-hud .micro-copy {
    display: none;
  }

  .mobile-quick-hud {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(46px, 0.7fr) minmax(58px, 1fr) minmax(68px, 0.9fr) 40px 40px 40px;
    gap: 8px;
    align-items: center;
    margin: 0 0 10px;
    padding: 9px 10px;
    border: 1px solid rgba(78, 55, 27, 0.12);
    border-radius: 18px;
    background: rgba(255, 252, 245, 0.96);
    box-shadow: 0 12px 28px rgba(63, 45, 21, 0.14);
    backdrop-filter: blur(10px);
  }

  .mobile-quick-hud span {
    display: grid;
    gap: 1px;
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.1;
  }

  .mobile-quick-hud strong {
    color: var(--ink);
    font-size: 1.02rem;
  }

  .mobile-quick-hud button {
    min-width: 44px;
    height: 38px;
    border: 0;
    border-radius: 14px;
    background: rgba(182, 138, 60, 0.14);
    color: #6e5325;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
    word-break: keep-all;
  }

  .mobile-quick-hud .mobile-hud-primary {
    background: #2f2619;
    color: #fff1d7;
  }

  .mobile-board-help {
    display: block;
    margin-top: 10px;
    border-radius: 16px;
    border: 1px solid rgba(97, 70, 33, 0.1);
    background: rgba(255, 249, 238, 0.92);
    overflow: hidden;
  }

  .mobile-board-help summary {
    padding: 12px 14px;
    color: #6e5325;
    font-size: 0.88rem;
    font-weight: 900;
    list-style: none;
  }

  .mobile-board-help summary::-webkit-details-marker {
    display: none;
  }

  .mobile-board-help p {
    margin: 0;
    padding: 0 14px 14px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.65;
  }

  .mission-hero-card,
  .objective-card,
  .legend-card,
  .mechanic-strip {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .mission-hero-icon {
    min-height: 56px;
  }

  .objective-icon,
  .legend-icon-wrap,
  .mechanic-strip-icon {
    min-height: 56px;
    border-radius: 14px;
  }
}

@media (max-width: 560px) {
  .page-shell {
    padding: 8px 8px calc(88px + env(safe-area-inset-bottom));
  }

  .board-panel {
    padding: 10px 6px 12px;
  }

  .board-grid {
    width: min(100%, 96vw);
    gap: 4px;
  }

  .board-cell {
    border-radius: 12px;
  }

  .tile-special-surface,
  .tile-goal-surface,
  .tile-crate-surface {
    border-radius: 11px;
  }

  .board-cell.selected {
    transform: scale(1.04);
  }

  .board-cell.drag-target::before,
  .hint-tag {
    display: none;
  }

  .panel-title {
    margin-bottom: 10px;
  }

  .tutorial-callout {
    padding: 12px 12px 11px;
    border-radius: 16px;
  }

  .tutorial-callout.is-overlay {
    width: min(188px, calc(100% - 12px));
    --tutorial-callout-width: min(188px, calc(100% - 12px));
  }

  .tutorial-callout-top {
    gap: 8px;
    margin-bottom: 6px;
  }

  .tutorial-kicker {
    min-height: 22px;
    padding: 0 8px;
    font-size: 0.64rem;
  }

  .tutorial-callout strong {
    display: block;
    font-size: 0.92rem;
    line-height: 1.25;
  }

  .tutorial-callout p {
    font-size: 0.8rem;
    line-height: 1.42;
  }

  .tutorial-callout-close {
    width: 24px;
    height: 24px;
    font-size: 0.9rem;
  }

  .tutorial-callout-actions {
    margin-top: 8px;
  }

  .tutorial-inline-demo {
    margin-top: 8px;
    padding: 7px;
    border-radius: 12px;
  }

  .tutorial-demo-grid {
    gap: 5px;
  }

  .tutorial-demo-tile {
    min-height: 34px;
    border-radius: 11px;
  }

  .mobile-quick-hud {
    grid-template-columns: minmax(46px, 0.7fr) minmax(58px, 1fr) minmax(68px, 0.9fr) 40px 40px 40px;
    gap: 6px;
    padding: 8px;
    border-radius: 16px;
  }

  .mobile-quick-hud button {
    min-width: 0;
    height: 36px;
    padding: 0 8px;
  }
}
