#ach-fab {
  display: none;
}

@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
    width: 100%;
    overscroll-behavior-x: none;
    touch-action: pan-y;
  }

  img, video {
    max-width: 100%;
    height: auto;
  }

  .start-btn {
    padding: 18px 40px !important;
    font-size: 22px !important;
  }

  /* Hero section */
  .hero-section {
    flex-direction: column !important;
    height: 100vh !important;
    min-height: 100vh;
    margin-left: -15px !important;
    margin-right: -15px !important;
    width: calc(100% + 30px) !important;
    max-width: none !important;
    border-radius: 0 !important;
  }
  .hero-section > div:first-child {
    flex: 1 !important;
    padding: 60px 20px 10px !important;
    justify-content: center !important;
  }
  .hero-section h1 {
    font-size: 32px !important;
  }
  .hero-section > div:last-child {
    flex: none !important;
    height: 35vh;
    width: 100% !important;
  }

  /* Center start button */
  .hero-section .start-btn {
    display: block;
    text-align: center;
  }

  /* Hero overlay adjustment */
  .overlay {
    background: rgba(0,0,0,0.6) !important;
  }

  /* Landing page grids */
  #how-it-works > div[style*="grid"],
  #for-whom > div[style*="grid"],
  #why-kromper > div[style*="grid"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  #how-it-works,
  #for-whom,
  #why-kromper {
    padding: 40px 5% !important;
  }

  /* Messages page */
  body[style*="overflow: hidden"] {
    overflow: auto !important;
  }
  .chats-backdrop {
    flex-direction: column !important;
    min-height: calc(100vh - 180px) !important;
  }

  /* 404 page */
  .error-code {
    font-size: 72px !important;
  }

  .styles-section {
    padding: 40px 0 !important;
  }
  .styles-title {
    font-size: 32px !important;
    margin-bottom: 25px !important;
  }
  .styles-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    padding: 0 15px !important;
  }
  .style-name {
    font-size: 12px !important;
    top: 10px !important;
    left: 10px !important;
  }

  /* Auth modals */
  #auth-modal > div,
  #register-modal > div {
    width: 90% !important;
    max-width: 350px !important;
    padding: 25px 20px !important;
  }

  /* Profile card */
  .profile-card {
    flex-direction: column !important;
    text-align: center !important;
    padding: 25px 15px !important;
    gap: 15px !important;
    margin: 10px 0 !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    width: 100% !important;
    max-width: none !important;
  }
  .profile-card h1#user-name {
    font-size: 28px !important;
  }
  .avatar-circle {
    width: 80px !important;
    height: 80px !important;
    font-size: 30px !important;
  }
  .profile-card div[style*="flex-wrap"] {
    margin: 0 -15px;
    width: auto !important;
    gap: 6px !important;
    border-radius: 0;
  }
  .profile-card .btn-sm {
    flex: 1;
    border-radius: 8px;
    font-size: 11px !important;
    padding: 12px 8px !important;
    white-space: nowrap;
  }

  /* Stats grid */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* Кнопка «Ачивки» слева сверху + раскрываемая панель */
  .profile-row {
    position: relative;
  }
  #ach-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 40;
    width: 46px;
    height: 46px;
    background: #111;
    border: 1px solid var(--tertiary, #333);
    border-radius: 50%;
    padding: 0;
    font-size: 20px;
    line-height: 1;
    color: #a2ff00;
    cursor: pointer;
  }
  #ach-fab:active {
    transform: scale(0.9);
  }
  #ach-fab.active {
    color: #8A2BE2;
    border-color: #8A2BE2;
  }
  .achievements-panel {
    position: absolute !important;
    z-index: 80 !important;
    top: 66px !important;
    left: 10px !important;
    right: auto !important;
    width: 320px !important;
    max-width: calc(100vw - 20px) !important;
    height: auto !important;
    max-height: min(480px, calc(100vh - 90px)) !important;
    overflow-y: auto !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    padding: 14px !important;
    gap: 8px !important;
    background: #0e0e0e !important;
    border: 1px solid #333 !important;
    border-radius: 14px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6) !important;
    display: none !important;
  }
  .achievements-panel.open {
    display: flex !important;
  }

  /* Фильтры: стиль, дата, «Хореографы» в одну строку; поиск и СБРОС ниже */
  #filter-default {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
  }
  #filter-default > span {
    display: none;
  }
  #filter-default #filter-style {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    max-width: 100%;
  }
  #filter-default > div {
    grid-column: 2;
    grid-row: 1;
  }
  #filter-default #btn-choreo-mode {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    padding: 10px 16px !important;
    font-size: 13px !important;
  }
  #filter-default #filter-search {
    grid-column: 1 / 3;
    grid-row: 2;
    width: 100%;
    min-width: 0;
  }
  #filter-default #filter-reset {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
    border: 1px solid #555 !important;
    border-radius: 30px;
    background: none;
    color: var(--accent);
    padding: 10px 14px;
    font-size: 11px !important;
    white-space: nowrap;
  }

  /* Dashboard buttons inside profile row */
  .profile-row .btn-dashboard {
    font-size: 11px !important;
    padding: 10px 14px !important;
    justify-content: center;
    text-align: center;
  }

  /* Filters section */
  .section[style*="background: none"] div[style*="gap: 15px"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .section[style*="background: none"] select,
  .section[style*="background: none"] input,
  #filter-search,
  #filter-date {
    width: 100% !important;
  }
  #filter-default {
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 8px !important;
  }
  #filter-default > span:first-child {
    display: none;
  }
  #filter-default select {
    width: auto !important;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px !important;
    padding: 8px 12px !important;
  }
  #filter-default > div[style*="position"] {
    flex: 1 1 auto;
  }
  #filter-default input[type="date"] {
    width: auto !important;
    font-size: 12px !important;
    padding: 8px 12px !important;
  }
  #filter-default > div[style*="position"] > button {
    font-size: 9px !important;
  }
  #filter-default > button {
    font-size: 12px !important;
    padding: 8px 14px !important;
  }
  #filter-search {
    flex: 1 1 100% !important;
    order: 1;
    margin-top: 4px;
    font-size: 12px !important;
    padding: 8px 14px !important;
  }
  #filter-choreo input {
    font-size: 12px !important;
    padding: 8px 14px !important;
    min-width: 0 !important;
  }
  #filter-choreo button {
    font-size: 12px !important;
    padding: 8px 14px !important;
  }

  /* Class cards */
  .class-card {
    padding: 20px !important;
    min-height: 220px !important;
    margin: 15px 10px !important;
    border-radius: 15px !important;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  .class-card h2 {
    font-size: 20px !important;
  }
  .card-actions {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .btn-cabinet, .btn {
    font-size: 16px !important;
    padding: 12px 20px !important;
  }
  .btn-show-more {
    width: calc(100% - 20px) !important;
    margin: 15px 10px !important;
    padding: 12px !important;
  }
  .class-details {
    font-size: 14px !important;
  }

  /* Catalog cards (app.html) */
  .class-card-catalog .class-card-overlay {
    padding: 14px !important;
  }

  /* Floating button */
  .floating-btn {
    width: 50px !important;
    height: 50px !important;
    bottom: 15px !important;
    right: 15px !important;
  }

  /* Choreographer section */
  .choreo-hero {
    flex-direction: column !important;
    text-align: center !important;
    padding: 24px !important;
    gap: 24px !important;
  }
  .choreo-hero-avatar {
    width: 140px !important;
    height: 200px !important;
  }
  .choreo-hero-info h1 {
    font-size: 32px !important;
  }
  #classes-container.grid-view {
    grid-template-columns: 1fr !important;
  }
  #choreographer-section > div {
    padding: 25px 15px !important;
    margin: 0 10px !important;
  }
  #choreographer-section h2 {
    font-size: 20px !important;
  }

  /* Apply section */
  #apply-section {
    margin: 20px 10px !important;
  }

  /* Tabs page */
  .tabs-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 0 !important;
    margin: 0 10px !important;
  }
  .tabs-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    display: flex;
    width: 97%;
    margin: 0;
  }
  .tab {
    flex: 1;
    min-width: 0 !important;
    padding: 10px 12px !important;
    font-size: 12px !important;
    white-space: nowrap;
    opacity: 0.8 !important;
    border-color: rgba(255,255,255,0.2) !important;
    background: rgba(255,255,255,0.04) !important;
    color: #fff !important;
    text-align: center;
    box-sizing: border-box;
  }
  .tab.active {
    opacity: 1 !important;
  }
  .tab-green.active {
    background: #a2ff00 !important;
    color: #000 !important;
  }
  .tab-purple.active {
    background: #8A2BE2 !important;
    color: #fff !important;
  }
  .btn-exit-back {
    width: 100% !important;
    text-align: center !important;
    margin-bottom: 5px !important;
  }

  .content-panel {
    padding: 20px !important;
    margin: 0 10px !important;
    border-radius: 0 0 10px 10px !important;
    border-color: rgba(255,255,255,0.2) !important;
    background: #1a1a1a !important;
  }

  /* Messages section visibility */
  .chats-backdrop {
    min-height: 300px !important;
    border-color: rgba(255,255,255,0.15) !important;
    background: #181818 !important;
  }
  .chats-title {
    font-size: 12px !important;
    margin-bottom: 10px !important;
  }

  /* Classes container */
  #classes-container {
    padding: 0 10px !important;
  }

  /* Create class form */
  body > div[style*="display: flex; flex-direction: column; gap: 20px"] {
    padding: 0 10px !important;
    width: 100% !important;
  }
  div[style*="grid-template-columns: 1fr 1fr; gap: 15px"] {
    grid-template-columns: 1fr !important;
  }

  /* Dashboard button */
  .btn-dashboard {
    width: auto !important;
    margin: 10px !important;
    justify-content: center !important;
  }

  /* Edit profile modal */
  #edit-profile-modal > div {
    width: 95% !important;
    padding: 20px 15px !important;
  }

  .page-container {
    padding: 0 15px !important;
  }
  .chats-backdrop {
    min-height: 300px !important;
  }
  .container {
    padding: 10px !important;
  }

  /* Touch target polish */
  button, .btn, .nav-link, .nav-user, .start-btn,
  .btn-cabinet, .chat-send-btn, .chat-back-btn,
  .nav-hamburger, .btn-nav-exit, .btn-nav-accent,
  .btn-dashboard, .btn-show-more, .floating-btn,
  .auth-btn-full, .btn-glass, .btn-sm {
    min-height: 44px;
    min-width: 44px;
  }
  .nav-hamburger span,
  .nav-hamburger::before,
  .nav-hamburger::after {
    min-height: 3px;
  }

  /* Mobile card expand */
  .class-card-catalog.expanded {
    transform: translateY(-4px);
    border-color: var(--secondary);
    box-shadow: 0 15px 40px rgba(138, 43, 226, 0.25);
  }
  .class-card-catalog.expanded .class-cover-img {
    transform: scale(1.08);
  }
  .class-card-catalog.expanded::after {
    opacity: 1;
  }
  .class-card-catalog.expanded .class-card-spacer {
    flex: 0;
  }
  .class-card-catalog.expanded .class-card-info {
    transform: scale(0.65) translateY(-10px);
    transform-origin: bottom left;
    opacity: 0.7;
  }
  .class-card-catalog.expanded .class-card-details {
    max-height: 300px;
    opacity: 1;
    margin-top: clamp(2px, 1cqi, 8px);
  }

  /* Empty classes state (cabinet) */
  #classes-container .empty-classes-msg {
    font-size: 24px !important;
    padding: 50px 15px 20px !important;
  }
  #classes-container .empty-classes-emoji {
    font-size: 52px !important;
    padding-bottom: 40px !important;
  }

  /* "Написать нам" FAB */
  #report-fab {
    bottom: 16px !important;
    left: 16px !important;
    padding: 10px 16px !important;
    font-size: 12px !important;
    border-radius: 26px !important;
  }

  /* CTA «Стать хореографом» в кабинете */
  #apply-section h3 {
    font-size: 21px !important;
  }
  #apply-section p {
    font-size: 13px !important;
  }
  #apply-section .btn-pill {
    font-size: 15px !important;
    padding: 14px 30px !important;
  }

  /* Страница заявки хореографа */
  #apply-card {
    padding: 26px 18px !important;
    margin: 0 12px !important;
  }
  #apply-card h1 {
    font-size: 23px !important;
  }

  /* Страница подписки */
  #sub-active,
  .payment-card {
    margin: 0 12px !important;
  }
  #sub-price {
    font-size: 34px !important;
  }

  /* Блок статуса подписки в кабинете */
  #subscription-status-box > div {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Гейты на страницах «Мои классы» и гайда */
  #classes-container .btn-pill {
    font-size: 14px !important;
    padding: 12px 28px !important;
  }

  /* Секция студии хореографа — кнопки в столбик на узких экранах */
  #choreographer-section div[style*="flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  #choreographer-section .btn-pill {
    width: 100% !important;
    text-align: center !important;
    margin: 0 !important;
  }

}

/* Very small screens */
@media (max-width: 480px) {
  .style-name {
    font-size: 10px !important;
    top: 8px !important;
    left: 8px !important;
  }
  .styles-grid {
    gap: 8px !important;
  }
  .hero-section h1 {
    font-size: 26px !important;
  }
  .start-btn {
    font-size: 18px !important;
    padding: 14px 30px !important;
  }
  .profile-card h1#user-name {
    font-size: 22px !important;
  }
  input, select, textarea, button {
    font-size: 16px !important;
  }
  .error-code {
    font-size: 48px !important;
  }
}

@media (max-width: 768px) {
  #classes-container.grid-view {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
}

@media (max-width: 480px) {
  #classes-container.grid-view {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .styles-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px !important;
  }
  .profile-card {
    padding: 30px !important;
    gap: 20px !important;
  }
  .profile-card h1#user-name {
    font-size: 36px !important;
  }
  .hero-section h1 {
    font-size: 42px !important;
  }

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