/* ════════════════════════════════════════════════════════════════════
   TypeArena — Mobile UI v4 PRO
   Полный редизайн всех страниц для мобильных
   ════════════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  /* ─────── MODES PAGE ─────── */
  #page-modes {
    padding: 0 !important;
  }

  .modes-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
  }

  .modes-header {
    padding: 16px 12px;
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.15), rgba(88, 166, 255, 0.05));
    border-bottom: 2px solid var(--border);
    text-align: center;
  }

  .modes-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
  }

  .modes-header p {
    margin: 4px 0 0 0;
    font-size: 0.8rem;
    color: var(--text2);
  }

  /* Режимы фильтр */
  .modes-filter {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
  }

  .filter-btn {
    padding: 6px 12px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text2);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
  }

  .filter-btn:active,
  .filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
  }

  /* Карточки режимов */
  .mode-card-large {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
    margin: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
  }

  .mcl-header {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 12px;
    align-items: start;
  }

  .mcl-icon {
    width: 64px;
    height: 64px;
    font-size: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg2);
    border-radius: 12px;
    border: 2px solid var(--border);
  }

  .mcl-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .mcl-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.3px;
  }

  .mcl-tag {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .mcl-desc {
    font-size: 0.85rem;
    color: var(--text2);
    line-height: 1.5;
    margin: 8px 0;
  }

  .mcl-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .stat-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 8px;
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
  }

  .mcl-footer {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  .btn-play-mode {
    flex: 1;
    padding: 10px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
  }

  .btn-play-mode:active {
    background: rgba(88, 166, 255, 0.8);
    transform: scale(0.98);
  }

  .btn-info-mode {
    padding: 10px 12px;
    background: var(--bg2);
    color: var(--text2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
  }

  .btn-info-mode:active {
    border-color: var(--accent);
    color: var(--accent);
  }

  /* Контейнер режимов */
  .modes-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
  }

  .mode-card-large {
    padding: 12px;
    margin: 0;
    background: var(--bg2);
    border: none;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s;
  }

  .mode-card-large:active {
    background: rgba(88, 166, 255, 0.08);
  }

  .mode-card-large:last-child {
    border-bottom: none;
  }

  /* ─────── SHOP PAGE ─────── */
  #page-shop {
    padding: 0 !important;
  }

  .shop-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .shop-header {
    padding: 12px;
    background: linear-gradient(135deg, rgba(220, 180, 60, 0.2), rgba(220, 180, 60, 0.05));
    border-radius: 12px;
    text-align: center;
    border: 2px solid rgba(220, 180, 60, 0.3);
  }

  .shop-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: #ffd700;
    letter-spacing: -0.5px;
  }

  .shop-header p {
    margin: 4px 0 0 0;
    font-size: 0.8rem;
    color: var(--text2);
  }

  .shop-wallet {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    justify-content: center;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 700;
  }

  .wallet-coins {
    color: #ffd700;
  }

  .wallet-gems {
    color: #ff6b9d;
  }

  /* Категории магазина */
  .shop-categories {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .cat-btn {
    padding: 8px 14px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text2);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
  }

  .cat-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
  }

  /* Товары */
  .shop-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .shop-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
  }

  .shop-item:active {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.1);
  }

  .si-icon {
    font-size: 2rem;
    line-height: 1;
  }

  .si-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
  }

  .si-price {
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffd700;
  }

  .si-desc {
    font-size: 0.65rem;
    color: var(--text2);
  }

  .btn-buy {
    padding: 6px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
  }

  .btn-buy:active {
    background: rgba(88, 166, 255, 0.8);
  }

  /* ─────── FRIENDS PAGE ─────── */
  #page-friends {
    padding: 0 !important;
  }

  .friends-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .friends-header {
    padding: 12px;
    background: linear-gradient(135deg, rgba(150, 100, 200, 0.15), rgba(150, 100, 200, 0.05));
    border-radius: 12px;
    text-align: center;
    border: 2px solid rgba(150, 100, 200, 0.3);
  }

  .friends-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: #c9a2ff;
    letter-spacing: -0.5px;
  }

  .friends-tabs {
    display: flex;
    gap: 8px;
  }

  .tab-btn {
    flex: 1;
    padding: 8px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text2);
    cursor: pointer;
    transition: all 0.2s;
  }

  .tab-btn.active {
    background: rgba(150, 100, 200, 0.2);
    border-color: #c9a2ff;
    color: #c9a2ff;
  }

  .friends-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .friend-item {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  .fi-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
  }

  .fi-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .fi-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
  }

  .fi-status {
    font-size: 0.7rem;
    color: var(--text2);
  }

  .fi-action {
    padding: 6px 10px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
  }

  .fi-action:active {
    background: rgba(88, 166, 255, 0.8);
  }

  .empty-state {
    padding: 32px 16px;
    text-align: center;
    color: var(--text2);
  }

  .empty-state-icon {
    font-size: 3rem;
    margin-bottom: 8px;
  }

  .empty-state-text {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  /* ─────── HOME PAGE IMPROVEMENTS ─────── */
  #page-home {
    padding: 8px !important;
  }

  .home-layout {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .home-hero {
    padding: 12px;
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.1), rgba(88, 166, 255, 0.05));
    border: 2px solid rgba(88, 166, 255, 0.2);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .hero-title {
    font-size: 1.3rem !important;
    font-weight: 900;
    line-height: 1.2;
    color: var(--text);
    letter-spacing: -0.5px;
  }

  .hero-subtitle {
    font-size: 0.8rem !important;
    color: var(--text2);
    line-height: 1.4;
  }

  .quick-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 8px;
  }

  .qs-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px;
    background: var(--bg2);
    border-radius: 8px;
    text-align: center;
  }

  .qs-val {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--accent);
  }

  .qs-lbl {
    font-size: 0.6rem;
    color: var(--text2);
    font-weight: 600;
  }

  .section-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
  }

  .section-title {
    padding: 8px 8px 4px;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
  }

  /* ─────── SMALL SCREENS ─────── */
  @media (max-width: 480px) {
    .modes-header h2 {
      font-size: 1.2rem;
    }

    .shop-header h2 {
      font-size: 1.2rem;
    }

    .friends-header h2 {
      font-size: 1.2rem;
    }

    .mode-card-large {
      padding: 10px;
    }

    .mcl-icon {
      width: 56px;
      height: 56px;
      font-size: 2rem;
    }

    .mcl-name {
      font-size: 1rem;
    }

    .mcl-desc {
      font-size: 0.8rem;
    }

    .quick-stats {
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
    }

    .qs-val {
      font-size: 1rem;
    }

    .shop-items {
      grid-template-columns: 1fr;
    }
  }

  /* ─────── TRANSITIONS ─────── */
  body[data-graphics="low"] .mode-card-large:active,
  body[data-graphics="low"] .shop-item:active,
  body[data-graphics="low"] .friend-item:active {
    transition: none;
  }

  body[data-graphics="medium"] .mode-card-large:active,
  body[data-graphics="medium"] .shop-item:active,
  body[data-graphics="medium"] .friend-item:active {
    transition: all 0.2s ease;
  }

  body[data-graphics="high"] .mode-card-large:active,
  body[data-graphics="high"] .shop-item:active,
  body[data-graphics="high"] .friend-item:active {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
}
