/* Shared mobile controls; home layout rules are scoped to .b2c-home. */
@media (max-width: 992px) {
  .header-inner { min-height: 68px; padding: 6px 16px; gap: 12px; }
  .header-inner .logo { min-width: 0; }
  .header-inner .logo-img { width: auto; max-width: 180px; height: 52px; }
  .header-right { gap: 0; }
  .header-right .cs-dropdown-wrap { display: none; }
  .mobile-menu-toggle, .mobile-drawer-close { min-width: 44px; min-height: 44px; }
  .mobile-menu-toggle i { display: none; }
  .mobile-menu-toggle::before {
    content: "";
    display: block;
    width: 22px;
    height: 2px;
    margin: auto;
    background: currentColor;
    box-shadow: 0 -7px currentColor, 0 7px currentColor;
  }
  .mobile-menu-toggle:focus-visible, .mobile-nav-item:focus-visible {
    outline: 3px solid #FF6B00;
    outline-offset: 2px;
  }
  .mobile-drawer-overlay { width: 100%; height: 100dvh; }
  .mobile-drawer-panel {
    width: min(360px, 100%);
    right: -100%;
    height: 100dvh;
    overscroll-behavior-y: contain;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mobile-drawer-header { flex-shrink: 0; padding: 12px 16px; }
  .mobile-drawer-content { padding: 16px; }
  .mobile-nav-item { min-height: 44px; }

  .sticky-bottom-bar {
    gap: 8px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .sticky-bottom-bar .sticky-text { display: none; }
  .sticky-bottom-bar > div:last-child {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 640px;
    margin: auto;
  }
  .sticky-bottom-bar .btn-main {
    min-width: 0;
    min-height: 48px;
    padding: 10px 6px !important;
    font-size: 14px !important;
    line-height: 1.4;
    border-radius: 12px;
  }
  .site-footer { padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important; }

  /* Let dialogs scroll within the available viewport, including landscape. */
  .modal-overlay, .promo-modal-overlay {
    height: 100dvh;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .modal-overlay .modal-box, .promo-modal-box {
    width: 100%;
    max-height: 100%;
    max-height: calc(100dvh - 24px - env(safe-area-inset-bottom, 0px)) !important;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
    padding: 52px 20px 24px !important;
    border-radius: 20px;
  }
  .modal-box .modal-close, .promo-close-btn {
    width: 44px;
    height: 44px;
    top: 6px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
  }
  .modal-box .modal-title { white-space: normal; font-size: 1.25rem; }
  .modal-box input, .modal-box select, .modal-box textarea {
    min-width: 0;
    min-height: 44px;
    font-size: 16px !important;
  }
  body:has(.modal-overlay.open, .promo-modal-overlay.active) { overflow: hidden; }
  .modal-box input[type="checkbox"], .modal-box input[type="radio"] { min-height: 20px; }
  .form-row-2col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .input-with-btn { min-width: 0; }
  .input-with-btn .form-input { flex: 1; min-width: 0; }
  .btn-id-check { padding: 0 12px; min-height: 44px; }
  .input-phone-3col { grid-template-columns: 76px repeat(2, minmax(0, 1fr)); }
  .input-phone-3col .form-input { padding-inline: 6px; }
  .input-email-group { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .input-email-group select { grid-column: 1 / -1; }
  .modal-signup-tab-btn { min-height: 48px; }
  .time-filter-btn, .time-chip, .date-chip { min-height: 44px; }
  .terms-scroll-body { min-height: 80px; }

  .b2c-home .hero-content, .b2c-home .hero-media,
  .b2c-home .step-cards-list, .b2c-home .step-display-container { min-width: 0; }
  .b2c-home .routine-flow-container { margin-inline: auto; }
  .b2c-home .chat-tutor-msg, .b2c-home .chat-highlight-card .phrase-text {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.6;
  }
  .b2c-home .tutor-avatar, .b2c-home .btn-play-sim { flex-shrink: 0; }
  .b2c-home .tutor-info { min-width: 0; }
  .b2c-home .tutor-info p { overflow-wrap: anywhere; }
  .b2c-home .audio-player-sim { flex-wrap: wrap; border-radius: 16px; }
  .b2c-home .correction-badge { align-items: flex-start; }
  .b2c-home .cycle-card:hover { transform: none !important; }
  .b2c-home .step-display-container {
    display: grid;
    min-height: 0;
    perspective: none;
  }
  .b2c-home .display-screen {
    position: relative;
    grid-area: 1 / 1;
    height: auto;
    padding: 24px 20px;
    transform: none !important;
    visibility: hidden;
    opacity: 0;
    overflow-wrap: anywhere;
  }
  .b2c-home .display-screen.active { visibility: visible; opacity: 1; }
  .b2c-home .reviews-coverflow-container { perspective: none; min-height: 0; }
  .b2c-home .reviews-coverflow-track { display: grid; height: auto; }
  .b2c-home .coverflow-card {
    position: relative;
    grid-area: 1 / 1;
    width: 100%;
    max-width: 420px;
    margin: auto;
    padding: 24px 20px;
    display: flex;
    transform: none !important;
    visibility: hidden;
    pointer-events: none;
  }
  .b2c-home .coverflow-card.active-center { visibility: visible; pointer-events: auto; }
  .b2c-home .deck-nav-content h4, .b2c-home .deck-nav-content p {
    white-space: normal !important;
    overflow: visible !important;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 768px) {
  /* Dense account tables become readable rows at phone widths. */
  .page-wrapper .table-container:has(> .mobile-card-table) {
    overflow: visible;
    width: 100%;
  }
  .page-wrapper .table-container > .mobile-card-table {
    display: block;
    width: 100%;
    min-width: 0;
    border: 0;
  }
  .page-wrapper .mobile-card-table thead { display: none; }
  .page-wrapper .mobile-card-table tbody {
    display: grid;
    gap: 12px;
  }
  .page-wrapper .mobile-card-table tbody tr {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    background: #fff;
  }
  .page-wrapper .mobile-card-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    min-width: 0;
    padding: 11px 14px;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
    border-bottom: 1px solid #F1F5F9;
  }
  .page-wrapper .mobile-card-table tbody td:last-child { border-bottom: 0; }
  .page-wrapper .mobile-card-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 36%;
    color: #64748B;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: left;
  }
  .page-wrapper .mobile-card-table tbody td > * { min-width: 0; }
  .page-wrapper .mobile-card-table tbody td.cert-course {
    display: grid;
    grid-template-columns: 36% minmax(0, 1fr);
    text-align: right !important;
  }
  .page-wrapper .mobile-card-table tbody td.cert-course::before { grid-row: 1 / span 2; }
  .page-wrapper .mobile-card-table .mobile-table-empty {
    display: block;
    padding: 28px 16px;
    text-align: center;
  }
  .page-wrapper .mobile-card-table .mobile-table-empty::before { content: none; }
  .page-wrapper .mobile-card-table button { min-height: 44px; }

  /* Avoid double side padding from the section and its inner container. */
  .b2c-home .section-inner { padding-inline: 0; }
  .b2c-home .hero-section { gap: 28px; padding-top: 28px !important; }
  .b2c-home .hero-title { font-size: clamp(1.7rem, 7.4vw, 2.25rem) !important; }
  .b2c-home .hero-section .btn-main,
  .b2c-home .final-cta-section .btn-main {
    height: auto !important;
    min-height: 56px;
    font-size: 1rem !important;
    padding: 14px 12px !important;
  }
  .b2c-home .cta-subtext { justify-content: center; line-height: 1.6; }
  .b2c-home .hero-card-preview { padding: 20px 16px !important; }
  .b2c-home .live-chat-box { padding: 14px 12px; }
  .b2c-home .tutor-header { gap: 12px; }
  .b2c-home .tutor-info h4 { font-size: 1rem; }
  .b2c-home .cycle-section, .b2c-home .reviews-section,
  .b2c-home .faq-section, .b2c-home .b2b-partners-section,
  .b2c-home .global-why-section { padding: 48px 16px; }
  .b2c-home .mechanism-bridge-section { padding-inline: 16px; }
  .b2c-home .shutter-card { display: grid; aspect-ratio: auto; }
  .b2c-home .shutter-cover, .b2c-home .shutter-xray-reveal {
    position: relative;
    inset: auto;
    grid-area: 1 / 1;
    padding: 20px 16px;
    gap: 16px;
    min-width: 0;
  }
  .b2c-home .cover-title, .b2c-home .xray-main-title { white-space: normal; }
  .b2c-home .cover-speekee-wrap, .b2c-home .xray-speekee-stage { height: 230px; }
  .b2c-home .cover-speekee-img, .b2c-home .xray-speekee-img {
    height: 225px;
    max-width: 100%;
  }
  .b2c-home .section-header { margin-bottom: 28px; }
  .b2c-home .section-title { font-size: clamp(1.5rem, 6.4vw, 1.8rem) !important; }
  .b2c-home .section-title, .b2c-home .final-cta-title { overflow-wrap: anywhere; word-break: keep-all; }
  .b2c-home .section-title { text-wrap: balance; }
  .b2c-home .review-trust-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px 12px;
    width: 100%;
    max-width: 420px;
    padding: 16px;
    border-radius: 18px;
    font-size: 0.82rem;
  }
  .b2c-home .review-trust-summary .divider { display: none; }
  .b2c-home .review-trust-summary .rating-num { white-space: nowrap; }
  .b2c-home .review-trust-summary .verified-text { grid-column: 1 / -1; justify-content: center; }
  .b2c-home .cycle-card { padding: 20px 16px; }
  .b2c-home .faq-question { padding: 18px 16px; gap: 12px; font-size: 1rem; }
  .b2c-home .faq-icon { flex-shrink: 0; }
  .b2c-home .faq-answer { padding: 0 16px 18px; }
  .b2c-home .final-cta-section { padding: 48px 16px; }
  .b2c-home .final-cta-title { font-size: 1.8rem; line-height: 1.4; }
  .b2c-home .final-cta-sub { font-size: 1rem; }
  .b2c-home .b2b-trust-stats-row { gap: 10px; margin-top: 24px; }
  .b2c-home .b2b-stat-pill { font-size: 0.8rem; padding: 10px 14px; }
  .footer-cert-row { flex-wrap: wrap; }
  .footer-company-info { overflow-wrap: anywhere; }
}

/* Tablet: keep related choices visible together instead of stretching one card per row. */
@media (min-width: 760px) and (max-width: 992px) {
  .b2c-home .shutter-panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 760px;
    gap: 16px;
  }
  .b2c-home .shutter-card { min-width: 0; max-width: none; }

  .b2c-home .zeropass-cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
  .b2c-home .zeropass-benefit-card { min-width: 0; padding: 22px 16px; }
  .b2c-home .benefit-price-bottom { align-items: stretch; flex-direction: column; gap: 8px; }
  .b2c-home .benefit-free-pill { justify-content: center; }

  .b2c-home .call-mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    max-width: 900px !important;
    gap: 16px !important;
  }
  .b2c-home .call-mode-card { min-width: 0; }
}

@media (max-width: 992px) and (hover: none) {
  /* Touch browsers may retain :hover after a tap; the second tap must close. */
  .b2c-home .shutter-card:not(.active) .shutter-cover {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 360px) {
  .time-filter-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row-2col { grid-template-columns: minmax(0, 1fr); }
  .modal-overlay .modal-box { padding-inline: 16px !important; }
  .sticky-bottom-bar { padding-inline: 10px; }
  .sticky-bottom-bar .btn-main { font-size: 13px !important; }
  .b2c-home .deck-nav-item { flex-wrap: wrap; }
  .b2c-home .deck-nav-badge { margin-left: 28px !important; }
}

@media (max-width: 768px) {
  /* Keep adjacent page numbers and previous/next controls on one line. */
  body .pagination.pagination {
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
  }
  body .pagination.pagination > li { display: none; }
  body .pagination.pagination > li:first-child,
  body .pagination.pagination > li:last-child,
  body .pagination.pagination > li.active,
  body .pagination.pagination > li:not(:first-child):has(+ li.active),
  body .pagination.pagination > li.active + li:not(:last-child) { display: block; }
  body .pagination.pagination li a,
  body .pagination.pagination li span {
    min-width: 44px;
    height: 44px;
    box-sizing: border-box;
  }
  body .pagination.pagination li a > span {
    display: inline;
    min-width: 0;
    width: auto;
    height: auto;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }

  .pagination-container {
    flex-wrap: nowrap !important;
    gap: 6px !important;
  }
  .pagination-container > .page-btn { display: none; }
  .pagination-container > .page-nav-btn:first-child,
  .pagination-container > .page-nav-btn:last-child,
  .pagination-container > .page-btn.active,
  .pagination-container > .page-btn:not(.page-nav-btn):has(+ .page-btn.active),
  .pagination-container > .page-btn.active + .page-btn:not(.page-nav-btn) { display: inline-flex; }
  .pagination-container > .page-btn {
    min-width: 44px !important;
    height: 44px !important;
    box-sizing: border-box;
    padding: 0 8px;
  }
  .pagination-container > .page-nav-btn {
    width: 44px;
    padding: 0;
    font-size: 0;
  }
  .pagination-container > .page-nav-btn i { font-size: 14px; }
}

@media (max-width: 360px) {
  body .pagination.pagination > li:not(:first-child):not(:last-child):not(.active) {
    display: none;
  }
}

@media (max-width: 768px) {
  .footer-cert-badges {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    max-width: 100%;
  }
  .footer-cert-row { flex-wrap: nowrap; gap: 8px; min-width: 0; }
  .footer-cert-badges > div:last-child { flex: 0 0 auto; }
}

@media (max-width: 360px) {
  .footer-kibo-logo {
    width: 90px;
    height: 24px;
    background-size: 126px 126px;
    background-position: center -40.5px;
  }
  .footer-kibo-name { font-size: 11px; }
  .footer-education-badge { gap: 3px; font-size: 11px; }
  .footer-education-logo {
    width: 32px;
    height: 34px;
    background-size: 48px 48px;
    background-position: -8px 0;
  }
  .footer-voucher-link img { height: 34px !important; }
}
