html {
  min-width: 320px;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  max-width: 100%;
  overflow-x: clip;
}

img,
video,
canvas,
iframe,
svg {
  max-width: 100%;
}

input,
select,
textarea,
button {
  max-width: 100%;
}

@media (max-width: 900px) {
  .page-wrap,
  .container,
  .main-container,
  .content-wrap {
    width: 100%;
    max-width: 100%;
  }

  .table-responsive,
  .table-scroll,
  .table-wrap,
  .table-container,
  .exam-table-wrap,
  .data-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-inner {
    width: 100%;
    max-width: 100%;
  }

  .page-header,
  .section {
    padding-left: clamp(1rem, 4vw, 2rem);
    padding-right: clamp(1rem, 4vw, 2rem);
  }

  .cards-grid,
  .three-col,
  .features-grid,
  .news-grid,
  .tips-grid,
  .exam-grid,
  .content-grid,
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  }

  .table-header,
  .section-header,
  .page-actions,
  .form-actions,
  .toolbar,
  .filter-row {
    flex-wrap: wrap;
  }

  .modal,
  .dialog,
  .popup {
    max-width: calc(100vw - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow: auto;
  }
}

@media (max-width: 600px) {
  .nav-inner {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .nav-logo {
    min-width: 0;
    max-width: calc(100% - 56px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.05rem;
  }

  .page-header {
    border-radius: 0 0 14px 14px;
    padding-top: 1.5rem;
    padding-bottom: 1.25rem;
  }

  .section {
    padding-top: 1.5rem;
    padding-bottom: 1.75rem;
  }

  .section-title {
    font-size: 1.15rem;
    gap: 0.5rem;
  }

  .three-col,
  .features-grid,
  .news-grid,
  .tips-grid,
  .exam-grid,
  .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cards-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .search-bar {
    max-width: 100%;
  }

  .search-bar input {
    min-width: 0;
    padding-left: 1rem;
    padding-right: 0.5rem;
    font-size: 16px;
  }

  .search-bar button {
    flex: 0 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .menu-item,
  .sub-menu-item,
  .paper-item {
    min-width: 0;
  }

  .form-grid,
  .grid,
  .settings-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .full {
    grid-column: auto !important;
  }

  .modal,
  .dialog,
  .popup {
    width: 100%;
    max-width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
    border-radius: 12px;
  }

  .m-head,
  .m-body,
  .m-crumb {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .m-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
  }

  button,
  .btn,
  .btn-view,
  .btn-dl {
    min-height: 40px;
  }

  iframe {
    min-height: 50vh;
  }
}

@media (max-width: 360px) {
  .cards-grid,
  .stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

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