:root {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body,
#root {
  min-height: 100%;
}

body {
  overflow-x: hidden;
}

#root {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

* {
  min-width: 0;
}

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

button,
a,
input,
select,
textarea,
[role="button"] {
  touch-action: manipulation;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid #8a6f35;
  outline-offset: 2px;
}

[role="dialog"] {
  max-width: min(calc(100vw - 24px), 42rem);
}

[data-radix-popper-content-wrapper] {
  max-width: calc(100vw - 16px);
}

.turnover-scroll-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#root .dt-container {
  padding: 0.75rem;
  color: inherit;
}

#root .dt-container .dt-layout-row {
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

#root .dt-container .dt-layout-row:last-child {
  margin: 0.75rem 0 0;
}

#root .dt-container .dt-search input,
#root .dt-container .dt-length select {
  border: 1px solid var(--color-border, #d2d8dd);
  border-radius: 6px;
  background: var(--color-background, #fbfcfd);
  color: var(--color-foreground, #040c13);
  font-size: 0.875rem;
}

#root .dt-container .dt-search input {
  min-width: min(18rem, 100%);
  margin-left: 0.5rem;
}

#root .dt-container table.dataTable {
  width: 100% !important;
  border-collapse: collapse;
}

#root .dt-container .dt-paging .dt-paging-button {
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--color-foreground, #040c13) !important;
}

#root .dt-container .dt-paging .dt-paging-button.current {
  border-color: var(--color-border, #d2d8dd);
  background: var(--color-muted, #ecf3f8) !important;
}

@media (max-width: 700px) {
  #root main {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  #root .container {
    box-sizing: border-box;
    width: calc(100vw - 48px) !important;
    max-width: calc(100vw - 48px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #root header .container {
    width: calc(100vw - 32px) !important;
    max-width: calc(100vw - 32px) !important;
  }

  #root main.container > .grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #root .flashcard-scene,
  #root .flashcard-inner,
  #root .flashcard-face {
    width: 100% !important;
    max-width: 100% !important;
  }

  #root h1,
  #root h2,
  #root h3,
  #root p,
  #root span {
    overflow-wrap: anywhere;
  }

  #root .flashcard-face [data-slot="badge"] {
    max-width: 52%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap !important;
  }

  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  button,
  [role="button"] {
    min-height: 40px;
  }

  #root .min-h-screen {
    min-height: 100svh;
  }

  #root [class*="max-w-"] {
    max-width: 100% !important;
  }

  #root [class*="px-8"] {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  #root [class*="p-8"] {
    padding: 1rem !important;
  }

  #root [class*="gap-8"] {
    gap: 1rem !important;
  }

  #root [class*="text-3xl"] {
    font-size: 1.625rem !important;
    line-height: 2rem !important;
  }

  #root [class*="whitespace-nowrap"] {
    white-space: normal !important;
  }

  #root footer .container {
    text-align: center;
  }

  #root [class*="h-screen"] {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  #root [class*="h-screen"] [class*="p-8"] {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  #root [class*="h-screen"] [class*="max-w-md"] {
    width: calc(100vw - 32px) !important;
    max-width: calc(100vw - 32px) !important;
  }

  #root [data-loc^="client/src/pages/Login.tsx"][class*="max-w-md"],
  #root [data-loc^="client/src/pages/Register.tsx"][class*="max-w-md"],
  #root [data-loc^="client/src/pages/ForgotPassword.tsx"][class*="max-w-md"] {
    width: calc(100vw - 48px) !important;
    max-width: calc(100vw - 48px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  #root [data-loc^="client/src/pages/Login.tsx"] form,
  #root [data-loc^="client/src/pages/Register.tsx"] form,
  #root [data-loc^="client/src/pages/ForgotPassword.tsx"] form {
    width: 100%;
    max-width: 100%;
  }

  #root [data-loc^="client/src/pages/Login.tsx"] input,
  #root [data-loc^="client/src/pages/Register.tsx"] input,
  #root [data-loc^="client/src/pages/ForgotPassword.tsx"] input,
  #root [data-loc^="client/src/pages/Login.tsx"] form > button,
  #root [data-loc^="client/src/pages/Register.tsx"] form > button,
  #root [data-loc^="client/src/pages/ForgotPassword.tsx"] form > button,
  #root [data-loc^="client/src/pages/Login.tsx"] a > button,
  #root [data-loc^="client/src/pages/Register.tsx"] a > button,
  #root [data-loc^="client/src/pages/ForgotPassword.tsx"] a > button {
    box-sizing: border-box;
    width: calc(100vw - 48px) !important;
    max-width: calc(100vw - 48px) !important;
  }

  #root [class*="h-screen"] input,
  #root [class*="h-screen"] button {
    max-width: 100%;
  }

  #root form input[data-slot="input"],
  #root form button[type="submit"],
  #root a[href="/register"] > button,
  #root a[href="/login"] > button,
  #root a[href="/forgot-password"] > button {
    box-sizing: border-box;
    width: calc(100vw - 48px) !important;
    max-width: calc(100vw - 48px) !important;
  }

  [role="dialog"] {
    width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
  }
}

@media (max-width: 480px) {
  #root [class*="px-6"] {
    padding-left: 0.875rem !important;
    padding-right: 0.875rem !important;
  }

  #root [class*="py-8"] {
    padding-top: 1.25rem !important;
    padding-bottom: 1.25rem !important;
  }
}

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