/* ── Tablet (≤1100px) ─────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .game-area {
    grid-template-columns: 240px 1fr 260px;
    gap: 12px;
    padding: 12px;
  }
}

/* ── Small desktop / large tablet (≤900px) ──────────────────────────────── */

@media (max-width: 900px) {
  .game-area {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .panel-left {
    grid-column: 1;
    grid-row: 2;
    position: static;
    max-height: 260px;
  }

  .grass-col {
    grid-column: 1;
    grid-row: 1;
  }

  .panel-right-col {
    grid-column: 1;
    grid-row: 3;
    position: static;
    max-height: none;
  }

  .grass-card {
    min-height: 480px;
  }

  .notifications-stack {
    max-width: 240px;
  }
}

/* ── Mobile (≤680px) ────────────────────────────────────────────────────── */

@media (max-width: 680px) {
  /* Top bar */
  .top-bar {
    padding: 24px 12px;
  }

  .top-bar-brand {
    font-size: 12px;
  }

  .stat-pill {
    padding: 4px 12px;
    min-width: 60px;
  }

  .stat-pill-value {
    font-size: 18px;
  }

  .stat-pill-label {
    font-size: 9px;
  }

  /* Coast overlay */
  .coast-overlay {
    padding: 0 16px 80px;
  }

  .coast-text-block {
    padding: 22px 24px;
  }

  .coast-heading {
    font-size: clamp(20px, 5vw, 28px);
  }

  .coast-choice {
    padding: 20px 18px;
  }

  /* Game area becomes single column with bottom nav */
  .game-area {
    padding: 10px;
    padding-bottom: 70px;
  }

  /* Hide side panels by default on mobile — shown via drawer */
  .panel-left,
  .panel-right-col {
    display: none;
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    max-height: 55vh;
    border-radius: var(--radius) var(--radius) 0 0;
    z-index: 150;
    overflow-y: auto;
    background: var(--bg-2);
    border: 1px solid var(--line-strong);
    border-bottom: none;
  }

  .panel-left.mobile-active,
  .panel-right-col.mobile-active {
    display: block;
    animation: slideUpPanel .28s ease;
  }

  @keyframes slideUpPanel {
    from { transform: translateY(20px); opacity: .7; }
    to { transform: translateY(0); opacity: 1; }
  }

  /* Grass card */
  .grass-card {
    min-height: 440px;
  }

  .touch-zone {
    width: min(260px, 68%);
    bottom: 90px;
  }

  .touch-hand {
    width: 100px;
    height: 100px;
    font-size: 56px;
  }

  /* Diagnosis area — less padding */
  .diagnosis-area {
    bottom: 10px;
    left: 10px;
    right: 10px;
    font-size: 12px;
    padding: 12px;
  }

  /* Notifications — compact */
  .notifications-stack {
    top: 60px;
    right: 8px;
    max-width: 220px;
  }

  .notif-toast {
    min-width: 180px;
    padding: 10px 12px;
  }

  .notif-source { font-size: 10px; }
  .notif-message { font-size: 12px; }

  /* Achievements */
  .achievements-stack {
    bottom: 70px;
    left: 8px;
    max-width: 220px;
  }

  .ach-toast { padding: 10px 12px; }
  .ach-toast strong { font-size: 12px; }
  .ach-desc { font-size: 11px; }

  /* Mobile bottom bar — show */
  .mobile-bottom-bar {
    display: flex;
    align-items: stretch;
  }

  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    background: none;
    border: none;
    color: var(--soft);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: color .18s ease, background .18s ease;
    min-height: 60px;
    letter-spacing: .02em;
  }

  .mobile-tab:hover {
    background: rgba(255,255,255,.05);
    color: var(--muted);
  }

  .mobile-tab.active {
    color: var(--green);
  }

  /* Milestone banner */
  .milestone-banner {
    font-size: 12px;
    padding: 10px 16px;
  }

  /* Feedback pop */
  .feedback-pop {
    bottom: 80px;
    font-size: 12px;
    max-width: 240px;
  }

  /* Intro card */
  .intro-card {
    padding: 32px 22px 28px;
  }

  .intro-title {
    font-size: clamp(30px, 8vw, 42px);
  }

  .intro-subtitle {
    font-size: 14px;
  }

  .category-btn {
    font-size: 12px;
    padding: 9px 13px;
  }

  /* Stats screen */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .cert-actions {
    flex-direction: column;
  }

  /* Coast screen */
  .coast-buttons {
    flex-direction: column;
  }

  /* Panel overlays */
  .panel-card {
    padding: 24px 18px;
    width: 100%;
  }

  .sound-buttons {
    gap: 8px;
  }

  .btn-large {
    min-height: 50px;
    font-size: 15px;
  }
}

/* ── Very small (≤360px) ────────────────────────────────────────────────── */

@media (max-width: 360px) {
  .grass-card { min-height: 380px; }
  .touch-hand { width: 88px; height: 88px; font-size: 48px; }
  .intro-title { font-size: 28px; }
  .category-options { gap: 6px; }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

.reduced-motion *,
.reduced-motion *::before,
.reduced-motion *::after {
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}

/* ── High contrast tweaks ────────────────────────────────────────────────── */

@media (prefers-contrast: high) {
  .metric-item,
  .notif-toast,
  .upgrade-item,
  .action-btn {
    border-color: rgba(255,255,255,.3);
  }

  .metric-value.good { color: #7fff8b; }
  .metric-value.bad { color: #ff8080; }
}
