* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

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

table {
  display: block;
  width: 100%;
  overflow-x: auto;
  white-space: nowrap;
}

pre,
code {
  white-space: pre-wrap;
  word-break: break-word;
}

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

body {
  word-break: break-word;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.flex {
  min-width: 0;
}

.truncate,
.line-clamp-2,
.line-clamp-3 {
  min-width: 0;
}

.fixed.inset-0 {
  max-width: 100vw;
}

.overflow-hidden {
  min-width: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.3;
}

p,
span,
li,
a,
button,
input,
textarea {
  line-height: 1.5;
}

.rounded-lg {
  border-radius: 0.75rem;
}

.rounded-xl {
  border-radius: 0.875rem;
}

.shadow,
.shadow-sm {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.hover\:shadow-md:hover {
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
}

header#topHeader .w-full.px-8 {
  max-width: 1366px;
  margin: 0 auto;
}

main,
section {
  min-width: 0;
}

@media (max-width: 1024px) {
  body {
    font-size: 15px;
  }

  .max-w-7xl,
  .max-w-6xl,
  .max-w-5xl,
  .max-w-4xl,
  .max-w-3xl,
  .max-w-2xl,
  .max-w-xl,
  .container {
    max-width: 100% !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .w-96,
  .w-\[420px\],
  .w-80,
  .w-72,
  .w-64 {
    width: 100% !important;
  }

  .h-screen,
  .min-h-screen {
    min-height: 100dvh !important;
  }

  .sticky.top-0 {
    top: 0 !important;
  }

  .px-6,
  .px-7,
  .px-8,
  .px-10,
  .lg\:px-8,
  .lg\:px-10 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .py-6,
  .py-7,
  .py-8 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }

  .text-3xl {
    font-size: 1.5rem !important;
    line-height: 2rem !important;
  }

  .text-2xl {
    font-size: 1.25rem !important;
    line-height: 1.75rem !important;
  }

  .text-xl {
    font-size: 1.125rem !important;
    line-height: 1.625rem !important;
  }

  header.h-20,
  header.h-16 {
    height: auto !important;
    min-height: 3.5rem !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }

  main.grid-cols-12 {
    grid-template-columns: 1fr !important;
    grid-auto-rows: minmax(220px, auto) !important;
    height: auto !important;
    overflow: visible !important;
  }

  .col-span-12,
  .col-span-11,
  .col-span-10,
  .col-span-9,
  .col-span-8,
  .col-span-7,
  .col-span-6,
  .col-span-5,
  .col-span-4,
  .col-span-3,
  .col-span-2,
  .col-span-1 {
    grid-column: span 1 / span 1 !important;
  }

  .row-span-12,
  .row-span-11,
  .row-span-10,
  .row-span-9,
  .row-span-8,
  .row-span-7,
  .row-span-6,
  .row-span-5,
  .row-span-4,
  .row-span-3,
  .row-span-2,
  .row-span-1 {
    grid-row: auto !important;
  }

  .max-w-\[75\%\],
  .max-w-\[70\%\] {
    max-width: 90% !important;
  }

  .text-5xl,
  .text-4xl {
    font-size: 1.875rem !important;
    line-height: 2.25rem !important;
  }

  .glass-panel {
    border-radius: 0.875rem !important;
    padding: 0.875rem !important;
  }

  #topHeader .header-tools > a,
  #topHeader .header-tools > span {
    font-size: 13px !important;
  }

  #topHeader .mobile-quick-nav {
    scrollbar-width: none;
  }

  #topHeader .mobile-quick-nav::-webkit-scrollbar {
    display: none;
  }

  #task-list > div {
    border-radius: 0.75rem !important;
  }

  #app .admin-content,
  #app-center .max-w-6xl {
    width: 100% !important;
  }

  #app-center .grid.lg\:grid-cols-3 {
    grid-template-columns: 1fr 1fr !important;
  }

  #app-center .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-3 {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .grid-cols-4,
  .grid-cols-3,
  .grid-cols-2,
  .grid-cols-12,
  .md\:grid-cols-2,
  .md\:grid-cols-3,
  .md\:grid-cols-4,
  .lg\:grid-cols-2,
  .lg\:grid-cols-3,
  .lg\:grid-cols-4,
  .xl\:grid-cols-2,
  .xl\:grid-cols-3,
  .xl\:grid-cols-4 {
    grid-template-columns: 1fr !important;
  }

  .fixed.right-6,
  .fixed.right-8 {
    right: 0.75rem !important;
  }

  .fixed.left-6,
  .fixed.left-8 {
    left: 0.75rem !important;
  }

  .left-1\/2 {
    left: 50% !important;
  }

  .top-20,
  .top-24 {
    top: 4.25rem !important;
  }

  .p-8 {
    padding: 1rem !important;
  }

  .p-6,
  .p-7 {
    padding: 0.875rem !important;
  }

  .px-8 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .gap-8,
  .gap-7,
  .gap-6 {
    gap: 0.875rem !important;
  }

  .space-y-8 > :not([hidden]) ~ :not([hidden]),
  .space-y-7 > :not([hidden]) ~ :not([hidden]),
  .space-y-6 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0.875rem !important;
  }

  .rounded-3xl {
    border-radius: 1rem !important;
  }

  .rounded-2xl {
    border-radius: 0.875rem !important;
  }

  .text-sm {
    font-size: 0.8125rem !important;
  }

  .text-base {
    font-size: 0.9375rem !important;
  }

  .text-lg {
    font-size: 1rem !important;
    line-height: 1.5rem !important;
  }

  .text-xl {
    font-size: 1.0625rem !important;
    line-height: 1.6rem !important;
  }

  .text-2xl {
    font-size: 1.25rem !important;
    line-height: 1.75rem !important;
  }

  #aiAssistantDialog {
    right: 0.5rem !important;
    left: 0.5rem !important;
    width: auto !important;
    max-width: none !important;
    bottom: 4.5rem !important;
  }

  #search-modal-content {
    width: calc(100vw - 1rem) !important;
    max-width: none !important;
    margin: 0 0.5rem !important;
  }

  #global-menu-dropdown,
  #unified-search-container,
  #search-results {
    max-width: calc(100vw - 1rem) !important;
  }

  #aiuse-frame,
  iframe[src*="aiuse"] {
    width: 100% !important;
    min-width: 0 !important;
  }

  header#topHeader .w-full.px-8 {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  #topHeader .mobile-quick-nav a {
    min-height: 34px;
  }

  #global-search-results a {
    padding: 0.75rem !important;
  }

  #global-search-results .text-base {
    font-size: 0.9375rem !important;
  }

  #app .admin-content header h2,
  #task-modal-title {
    font-size: 1rem !important;
  }

  #app .admin-content .min-w-full,
  #app .overflow-x-auto .min-w-full {
    min-width: 640px !important;
  }

  #task-modal > div,
  #article-modal > div {
    width: calc(100vw - 1rem) !important;
    max-width: none !important;
    margin: 0 0.5rem !important;
    max-height: 92vh !important;
  }

  #app-center .profile-cover-header {
    margin-bottom: 7rem !important;
  }

  #app-center .profile-avatar-wrap {
    bottom: -3rem !important;
    left: 0.75rem !important;
  }

  #app-center .profile-action-group {
    gap: 0.5rem !important;
  }

  #app-center .grid.lg\:grid-cols-3,
  #app-center .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-3 {
    grid-template-columns: 1fr !important;
  }

  #app-center .text-3xl {
    font-size: 1.375rem !important;
    line-height: 1.8rem !important;
  }

  main.grid-cols-12 > .glass-panel {
    min-height: 220px !important;
  }

  #chart-visit-trend,
  #chart-user-distribution,
  #chart-school-rank,
  #chart-ai-usage {
    min-height: 220px !important;
  }

  #chart-school-rank + div,
  #chart-user-distribution + div {
    margin-top: 0.75rem !important;
  }

  .audit-top-actions button,
  .audit-top-actions .text-sm {
    min-height: 36px !important;
  }

  .audit-modal-footer button {
    min-width: 88px !important;
  }
}

@media (max-width: 375px) {
  body {
    font-size: 13px;
  }

  #search-modal-content,
  #task-modal > div,
  #article-modal > div,
  #aiAssistantDialog {
    width: calc(100vw - 0.5rem) !important;
    margin: 0 0.25rem !important;
  }

  #topHeader .mobile-quick-nav a {
    padding-left: 0.625rem !important;
    padding-right: 0.625rem !important;
    font-size: 11px !important;
  }

  .p-4,
  .p-5 {
    padding: 0.75rem !important;
  }

  .px-4,
  .px-5 {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  .py-4,
  .py-5 {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
}

@media (min-width: 1280px) and (max-width: 1366px) {
  .max-w-7xl,
  .max-w-6xl,
  .max-w-5xl,
  .container {
    max-width: 1240px !important;
  }

  header#topHeader .w-full.px-8 {
    max-width: 1320px;
  }

  main.grid-cols-12 {
    gap: 0.875rem !important;
  }

  .glass-panel {
    border-radius: 0.875rem !important;
  }
}
