/* ═══════════════════════════════════════
   RESPONSIVE — MOBILE FIRST
═══════════════════════════════════════ */
@media (hover: none) {
  .lcard:hover,
  .wcard:hover,
  .pcard:hover,
  .home-tile:hover,
  .gcard:hover,
  .opt:hover,
  .bkey:hover,
  .lmodal-say:hover,
  .btn:hover,
  .btn-back:hover,
  .lmodal-close:hover,
  .sb-bank-chip:hover,
  .cat-pill:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    background: inherit;
    border-color: var(--border);
  }

  .cat-pill.active {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
  }

  .lcard:active {
    transform: scale(0.93);
  }

  .wcard:active {
    transform: scale(0.93);
  }

  .opt:active {
    transform: scale(0.92);
  }

  .bkey:active:not(:disabled) {
    transform: scale(0.9);
  }

  .home-tile:active {
    transform: scale(0.96);
  }

  .gcard:active {
    transform: scale(0.95);
  }

  .lmodal-say:active {
    transform: scale(0.95);
  }

  .sb-bank-chip:active {
    transform: scale(0.92) !important;
  }
}

@media (max-width: 480px) {
  :root {
    --nav-h: 90px;
    --top-h: 8px;
  }

  .app {
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  }

  .section {
    padding: 0 12px;
  }

  .header {
    padding: 9px 14px;
  }

  .avatar {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .header-name {
    font-size: 11px;
  }

  .header-title {
    font-size: 16px;
  }

  .stars-chip {
    padding: 6px 11px;
    font-size: 13px;
  }

  .progress-chip {
    display: none;
  }

  .bottom-nav {
    height: 58px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
  }

  .nav-icon {
    width: 36px;
    height: 26px;
  }

  .nav-label {
    font-size: 10px;
  }

  .nav-item {
    padding: 4px 2px;
    min-width: 44px;
    min-height: 50px;
  }

  .hero-glass-card {
    padding: 20px 18px;
    margin: 12px 0 14px;
    border-radius: 26px;
  }

  .hero-name {
    font-size: clamp(36px, 12vw, 52px);
  }

  .hero-tagline {
    font-size: 13px;
    margin-bottom: 16px;
  }

  .stats-row {
    gap: 8px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 12px 8px;
    border-radius: 14px;
  }

  .stat-num {
    font-size: clamp(22px, 7vw, 30px);
  }

  .stat-label {
    font-size: 10px;
  }

  .home-grid {
    gap: 10px;
    margin-bottom: 14px;
  }

  .home-tile {
    min-height: 125px;
    padding: 16px 12px 14px;
    border-radius: 20px;
  }

  .tile-icon {
    font-size: 34px;
    top: 13px;
    right: 13px;
  }

  .tile-title {
    font-size: 17px;
  }

  .tile-sub {
    font-size: 10px;
  }

  .sec-head {
    padding: 14px 0 10px;
  }

  .sec-title {
    font-size: 22px;
  }

  .alph-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
  }

  .lcard {
    padding: 10px 5px 8px;
    border-radius: 12px;
  }

  .l-big {
    font-size: 25px;
  }

  .l-sm {
    font-size: 16px;
  }

  .l-emoji {
    font-size: 18px;
    margin: 3px 0;
  }

  .l-word,
  .l-heb {
    font-size: 9px;
  }

  .cat-scroll {
    gap: 7px;
    padding-bottom: 9px;
    margin-bottom: 12px;
  }

  .cat-pill {
    padding: 7px 13px;
    font-size: 12px;
  }

  .words-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
  }

  .wcard {
    padding: 16px 10px 13px;
    border-radius: 16px;
  }

  .w-emoji {
    font-size: 38px;
    margin-bottom: 7px;
  }

  .w-en {
    font-size: 15px;
  }

  .phrases-list {
    gap: 7px;
  }

  .pcard {
    padding: 12px 12px;
    gap: 10px;
    border-radius: 14px;
  }

  .p-emoji {
    font-size: 26px;
  }

  .games-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .gcard {
    border-radius: 18px;
    min-height: 160px;
  }

  .g-emoji {
    font-size: 44px;
  }

  .arena {
    padding: 15px 12px;
    border-radius: 20px;
  }

  .arena-top {
    margin-bottom: 12px;
  }

  .arena-q {
    font-size: clamp(58px, 16vw, 78px);
  }

  .arena-prompt {
    font-size: clamp(15px, 4vw, 19px);
  }

  .arena-heb {
    font-size: 12px;
    margin-bottom: 14px;
  }

  .opts-grid {
    gap: 8px;
    max-width: 100%;
  }

  .opt {
    padding: 13px 6px;
    border-radius: 14px;
    font-size: clamp(20px, 7vw, 30px);
  }

  .opt.word-opt {
    font-size: clamp(12px, 3.5vw, 15px);
    padding: 12px 7px;
  }

  .spell-slots {
    gap: 6px;
    margin: 12px auto;
  }

  .slot {
    width: clamp(38px, 11vw, 50px);
    height: clamp(46px, 12vw, 58px);
    font-size: clamp(18px, 6vw, 26px);
    border-radius: 10px;
  }

  .bank {
    gap: 7px;
    max-width: 100%;
    margin: 0 auto 12px;
  }

  .bkey {
    width: clamp(44px, 12vw, 52px);
    height: clamp(44px, 12vw, 52px);
    font-size: clamp(17px, 5vw, 22px);
    border-radius: 10px;
  }

  .mem-grid {
    gap: 6px;
    max-width: 100%;
  }

  .mback {
    font-size: clamp(19px, 6vw, 26px);
  }

  .btn {
    padding: 10px 18px;
    font-size: 14px;
  }

  .btn-back {
    padding: 8px 13px;
    font-size: 12px;
  }

  .toast {
    font-size: 12px;
    padding: 9px 16px;
    max-width: 88vw;
    white-space: normal;
    text-align: center;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px);
  }

  .song-launch-btn {
    padding: 12px 14px;
    gap: 11px;
    border-radius: 14px;
  }

  .slb-title {
    font-size: 14px;
  }

  .sb-slots {
    min-height: 50px;
    padding: 10px 8px;
  }

  .sb-chip {
    font-size: 13px;
    padding: 7px 12px;
  }

  .sb-bank-chip {
    font-size: 12px;
    padding: 8px 13px;
    min-height: 42px;
  }
}

@media (max-width: 360px) {
  .alph-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

  .home-tile {
    min-height: 80px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .tile-icon {
    position: static;
    font-size: 34px;
  }

  .mem-grid {
    gap: 5px;
  }

  .slot {
    width: clamp(34px, 10vw, 44px);
    height: clamp(42px, 11vw, 52px);
  }

  .bkey {
    width: clamp(40px, 11vw, 48px);
    height: clamp(40px, 11vw, 48px);
    font-size: 15px;
  }
}

@media (min-width: 481px) and (max-width: 767px) {
  .alph-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .words-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  :root {
    --nav-h: 80px;
    --top-h: 8px;
  }

  .section {
    padding: 0 28px;
  }

  .alph-grid {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 12px;
  }

  .words-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
  }

  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
  }

  .home-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-row {
    grid-template-columns: repeat(4, 1fr);
  }

  .challenges-section {
    margin: 0 0 16px;
  }

  .wotd-card {
    margin: 0 0 16px;
  }

  .lp-card {
    padding: 16px 20px;
  }

  .lp-icon {
    width: 56px;
    height: 56px;
    font-size: 28px;
  }

  .port-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .port-badges-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .story-choices {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .story-choice {
    flex: 1;
    min-width: 140px;
  }
}

/* ── DESKTOP: phone-frame layout ── */
@media (min-width: 900px) {
  body {
    background: linear-gradient(135deg, #1a0a3c 0%, #2d1b6e 40%, #4936e8 100%);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100vh;
  }

  /* Decorative bokeh circles behind the frame */
  body::before, body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
  }
  body::before {
    width: 500px; height: 500px;
    background: rgba(108,79,246,0.4);
    top: -100px; left: -100px;
  }
  body::after {
    width: 400px; height: 400px;
    background: rgba(245,198,66,0.15);
    bottom: -80px; right: -80px;
  }

  #ptrIndicator { display: none; }

  .grain { display: none; }

  .aurora { display: none; }

  .app {
    width: 430px;
    min-width: 430px;
    max-width: 430px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    background: #f5f4fb;
    box-shadow:
      0 0 0 1px rgba(255,255,255,0.1),
      0 40px 100px rgba(0,0,0,0.6),
      0 8px 24px rgba(0,0,0,0.32);
    border-radius: 44px;
    overflow: hidden;
    margin-top: 24px;
    margin-bottom: 24px;
  }

  .top-sticky {
    width: calc(430px - 32px);
    max-width: calc(430px - 32px);
    left: 50%;
    transform: translateX(-50%);
  }

  .bottom-nav {
    width: 370px;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(24px + 14px + env(safe-area-inset-bottom));
  }

  .mascot-container {
    right: calc(50% - 430px / 2 + 12px);
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --nav-h: 60px;
    --top-h: 8px;
  }

  .home-hero {
    padding: 4px 0 0;
  }

  .home-hero .fox-hero-img {
    display: none;
  }

  .hero-name {
    font-size: 28px;
    margin-bottom: 0;
  }

  .hero-tagline {
    font-size: 12px;
    margin-bottom: 10px;
  }

  .stats-row {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
  }

  .stat-card {
    padding: 10px 8px;
  }

  .stat-num {
    font-size: 22px;
  }

  .alph-grid {
    grid-template-columns: repeat(7, 1fr);
  }

  .arena-q {
    font-size: 46px;
  }

  .bottom-nav {
    height: 52px;
  }

  .nav-label {
    display: none;
  }

  .nav-icon {
    height: 34px;
  }

  .lmodal {
    max-height: 95vh;
    overflow-y: auto;
  }

  .lmodal-big {
    font-size: 58px;
  }

  .lmodal-small {
    font-size: 36px;
  }
}

@media (max-width: 600px) {
  .lmodal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .lmodal {
    width: 100%;
    border-radius: 26px 26px 0 0;
    padding: 6px 20px 26px;
    padding-bottom: max(26px, env(safe-area-inset-bottom));
    transform: translateY(100%);
    max-width: 100%;
  }

  .lmodal-overlay.open .lmodal {
    transform: translateY(0);
  }

  .lmodal::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border-strong);
    margin: 0 auto 14px;
  }

  .lmodal-big {
    font-size: clamp(68px, 18vw, 96px);
  }

  .lmodal-small {
    font-size: clamp(40px, 10vw, 58px);
  }

  .lmodal-emoji {
    font-size: clamp(42px, 10vw, 54px);
  }

  .lmodal-en {
    font-size: clamp(18px, 5.5vw, 26px);
  }

  .lmodal-sound {
    font-size: clamp(15px, 4vw, 19px);
    padding: 6px 13px;
  }

  .lmodal-sentence {
    font-size: 12px;
    margin-bottom: 16px;
  }

  .lmodal-say,
  .lmodal-close {
    min-height: 48px;
  }
}

