/* Final responsive layer. Keep this stylesheet last so every feature follows one mobile system. */
html { max-width: 100%; overflow-x: hidden; }
body { max-width: 100%; overflow-x: hidden; }
img, svg, video, canvas { max-width: 100%; }
button, input, select, textarea { max-width: 100%; }

@media (max-width: 820px) {
  header {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    height: auto;
    min-height: 0;
    gap: 8px 10px;
    padding: 9px 12px 10px;
  }
  header .brand { min-width: 0; }
  header .brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  header .account-area { position: absolute; top: 9px; right: 12px; width: auto; min-width: 0; margin: 0; gap: 5px; justify-content: flex-end; }
  header .general-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    order: initial;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  header .general-nav::-webkit-scrollbar,
  header .personal-nav::-webkit-scrollbar { display: none; }
  header .general-nav .nav-tab { min-height: 36px; display: flex; align-items: center; }
  header .personal-nav {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: none;
    justify-content: stretch;
    overflow-x: auto;
    padding: 5px max(5px,env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(5px,env(safe-area-inset-left));
    border-width: 1px 0 0;
    border-radius: 0;
    background: rgba(8,7,20,.98);
    box-shadow: 0 -7px 20px rgba(0,0,0,.34);
  }
  header .personal-nav .account-tab {
    flex: 1 0 auto;
    min-width: 76px;
    min-height: 39px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 9px;
    font-size: 11px;
    text-align: center;
  }
  header .header-account-menu { flex: 0 0 auto; }
  header .account-dropdown { position: fixed; top: 62px; right: 12px; left: 12px; max-height: calc(100dvh - 85px); overflow-y: auto; }
  header .nav-dropdown-menu { position: fixed; top: 108px; right: 12px; left: 12px; max-height: calc(100dvh - 140px); overflow-y: auto; }

  main { width: 100%; max-width: 100%; min-width: 0; padding: 24px 14px calc(86px + env(safe-area-inset-bottom)); }
  main > *, .card, .form, section, article { min-width: 0; }
  .section-head, .profile-form-heading, .subscriber-admin-heading, .booking-panel-heading,
  .availability-heading, .reviews-heading, .followed-profiles-heading {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }
  .section-head { margin: 26px 0 14px; }
  .section-head h1 { margin-top: 0; }
  .grid, .split, .how-steps, .pricing-options, .recap-grid { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .btn, button { min-height: 42px; }
  .form input:not([type="checkbox"]):not([type="radio"]),
  .form select, .form textarea, input[type="search"] { width: 100%; min-width: 0; font-size: 16px; }
  .profile-actions, .admin-actions, .achievement-picker-actions { display: flex; flex-wrap: wrap; }
  .profile-actions > *, .admin-actions > * { flex: 1 1 150px; }

  .hero { min-height: 500px; padding: 42px 24px; border-radius: 16px; background-position: 58% center; }
  .hero h1 { font-size: clamp(34px,10vw,46px); }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions .btn { width: 100%; text-align: center; }

  .find-guide-page { width: 100%; margin: -24px 0 0; padding-inline: 0; transform: none; }
  .find-guide-hero { min-height: 360px; padding: 46px 20px; border-radius: 14px 14px 0 0; }
  .find-guide-hero h1 { font-size: clamp(34px,10vw,54px); }
  .game-search { padding: 16px; }
  .search-filter-grid { grid-template-columns: 1fr; }
  .search-guides-button, .guide-name-search > button { width: 100%; }
  .guide-results .grid { grid-template-columns: 1fr; }
  .guide-results-heading { align-items: flex-start; flex-direction: column; }
  .find-guide-page .guide-card { width: 100%; max-width: 380px; justify-self: center; }

  .profile-page, .profile-form, .account-settings { width: 100%; max-width: 100%; }
  .profile-cover { min-height: 190px; aspect-ratio: auto; background-size: cover; }
  .profile-identity {
    display: grid;
    grid-template-columns: 118px minmax(0,1fr);
    align-items: end;
    gap: 10px;
    margin-top: -50px;
    padding: 9px 12px 11px;
  }
  .profile-photo { width: 118px; height: 142px; margin-top: -78px; flex-basis: 118px; font-size: 42px; }
  .profile-name { min-width: 0; }
  .profile-name h1 { overflow-wrap: anywhere; font-size: clamp(23px,7vw,29px); line-height: 1.05; }
  .profile-tagline { font-size: 13px; }
  .profile-header-link { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .profile-achievement-editor, .public-profile-actions { grid-column: 1 / -1; width: 100%; margin: 0; padding: 6px 0 0; }
  .profile-achievement-editor .achievement-slots, .public-profile-actions { justify-content: flex-start; }
  .achievement-slot { width: 54px; height: 54px; font-size: 24px; }
  .public-profile-actions { align-items: stretch; flex-direction: row; flex-wrap: wrap; }
  .public-profile-actions > .achievement-slots { width: 100%; transform: none; }
  .public-profile-actions .btn, .public-profile-actions button { flex: 1 1 130px; white-space: nowrap; }
  .cover-controls { right: 7px; bottom: 7px; max-width: calc(100% - 14px); flex-wrap: wrap; justify-content: flex-end; }
  .cover-controls .media-edit { min-height: 30px; padding: 4px 7px; }
  .banner-choice-grid { grid-template-columns: 1fr 1fr; }
  .public-guide-layout { grid-template-columns: 1fr; }
  .public-profile .profile-body > .card, .guide-reviews { width: 100%; max-width: 100%; }
  .public-profile .review { grid-template-columns: 38px minmax(0,1fr); padding: 11px; }
  .review-avatar { width: 38px; height: 38px; }
  .blocked-profile-row { align-items: flex-start; flex-direction: column; }
  .blocked-profile-row button { width: 100%; }

  .onboarding-steps { grid-template-columns: 1fr; }
  .onboarding-step { min-height: 0; }
  .availability-row { grid-template-columns: 1fr 1fr; }
  .availability-row label { grid-column: 1 / -1; }
  .availability-row input[type="time"] { width: 100%; min-width: 0; }
  .platform-options { grid-template-columns: 1fr 1fr; }

  .booking-page { width: 100%; }
  .booking-guide-summary { align-items: center; flex-direction: column; text-align: center; }
  .booking-guide-avatar { flex-basis: 94px; width: 94px; height: 94px; }
  .booking-fields { grid-template-columns: 1fr; }
  .booking-panel, .booking-review-section { padding: 16px; }

  .messages-page { width: 100%; }
  .messages-layout { display: block; min-height: 0; overflow: visible; }
  .conversation-list { max-height: 290px; overflow-y: auto; border-right: 0; border-bottom: 1px solid rgba(164,114,215,.3); }
  .message-thread { min-height: 440px; }
  .message-thread-heading { align-items: flex-start; flex-wrap: wrap; }
  .message-history { max-height: 48vh; padding: 14px; }
  .message-bubble { max-width: 90%; }
  .message-composer { padding: 12px; }
  .message-report-form { margin: 0 10px 12px; padding: 12px; }
  .report-form-heading { grid-template-columns: auto minmax(0,1fr) auto; }

  .admin-page { width: 100%; }
  .admin-tabs, .archive-tabs { display: flex; max-width: 100%; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .admin-tabs button, .archive-tabs button { flex: 0 0 auto; white-space: nowrap; }
  .admin-record-heading { display: block; }
  .admin-record-heading .status { display: inline-flex; margin-top: 7px; }
  .subscriber-table-wrap { width: 100%; overflow-x: auto; }
  .subscriber-admin table { min-width: 620px; }

  .sessions-page, .journey-page { width: 100%; padding: 18px 0 65px; }
  .journey-heading, .journey-hero, .sessions-group, .journey-panel { padding: 16px; }
  .journey-map { grid-template-columns: 1fr; padding: 15px; }
  .session-card { grid-template-columns: 48px minmax(0,1fr); }
  .session-card > strong { grid-column: 2; }
  .gaming-connection-form, .journey-details, .notification-settings fieldset { grid-template-columns: 1fr; }

  footer { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
}

@media (max-width: 430px) {
  header .brand-icon { width: 38px; height: 38px; }
  header .brand-name { font-size: 18px; }
  header .header-profile-identity { max-width: 48px; }
  header .general-nav .nav-tab { padding: 6px 8px; font-size: 11px; }
  main { padding-inline: 10px; }
  .profile-cover { min-height: 170px; }
  .profile-identity { grid-template-columns: 92px minmax(0,1fr); margin-top: -42px; padding-inline: 9px; }
  .profile-photo { width: 92px; height: 112px; margin-top: -61px; flex-basis: 92px; font-size: 34px; }
  .live-guide-badge { width: 27px; height: 27px; margin-left: 4px; vertical-align: -6px; }
  .profile-name h1 { font-size: 22px; }
  .profile-role-tags { gap: 3px; }
  .profile-role-tag { padding: 2px 5px; font-size: 9px; }
  .banner-choice-grid, .platform-options { grid-template-columns: 1fr; }
  .availability-row { grid-template-columns: 1fr; }
  .availability-row label, .availability-row input[type="time"] { grid-column: 1; }
  .guide-results .guide-card { max-width: 100%; }
  .message-bubble { max-width: 96%; }
}

@media (max-width: 350px) {
  header .brand-name { display: none; }
}

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