body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    STHeiti, "Microsoft Yahei", Tahoma, Simsun, sans-serif;
  background-color: #f7f8fa;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.page-view {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.login-bg-decoration {
  background:
    radial-gradient(circle at 15% 50%, rgba(22, 93, 255, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(22, 93, 255, 0.06), transparent 25%);
}

.pb-safe {
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

.theme-choice.active {
  background: #ffffff;
  color: #165dff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.theme-auto-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
}

.share-filter.active {
  border-color: #165dff;
  background: #165dff;
  color: #ffffff;
}

.detail-file-icon {
  aspect-ratio: 1 / 1;
}

.detail-file-symbol,
.detail-action-button i,
.detail-meta-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transform: none;
}

.detail-file-symbol {
  width: 1em;
  height: 1em;
}

.dropzone.dragging {
  border-color: #165dff;
  background: rgba(22, 93, 255, 0.04);
}

.share-table {
  table-layout: fixed;
}

.share-title-text {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.share-title-desktop {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-title-mobile {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.auth-invalid .control-wrap {
  border-color: #f53f3f;
  background: #fff8f6;
}

.toast-region {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  display: flex;
  width: min(360px, calc(100vw - 32px));
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #e5e6eb;
  border-radius: 12px;
  background: #ffffff;
  color: #1d2129;
  box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1);
  font-size: 14px;
  line-height: 1.45;
  pointer-events: auto;
  animation: toastIn 0.18s ease;
}

.toast.success {
  border-color: rgba(0, 180, 42, 0.18);
}

.toast.error {
  border-color: rgba(245, 63, 63, 0.22);
}

.toast.warning {
  border-color: rgba(255, 125, 0, 0.25);
}

.toast i {
  margin-top: 2px;
}

.toast.success i {
  color: #00b42a;
}

.toast.error i {
  color: #f53f3f;
}

.toast.warning i {
  color: #ff7d00;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.action-menu {
  position: relative;
}

.action-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  display: none;
  min-width: 132px;
  overflow: hidden;
  border: 1px solid #f0f1f5;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1);
}

.action-menu.open .action-menu-panel {
  display: block;
}

.file-preview audio {
  accent-color: #165dff;
  color-scheme: light;
  outline: none;
}

.preview-tool-button {
  display: inline-flex;
  cursor: pointer;
  min-width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  background: #ffffff;
  color: #4e5969;
  font-size: 0.78rem;
  font-weight: 600;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.preview-tool-button:hover {
  border-color: #165dff;
  background: #eef3ff;
  color: #165dff;
}

.image-preview-stage {
  max-height: 68vh;
  min-height: 260px;
  overflow: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(45deg, rgba(134, 144, 156, 0.12) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(134, 144, 156, 0.12) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(134, 144, 156, 0.12) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(134, 144, 156, 0.12) 75%);
  background-color: #f7f8fa;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.image-preview-canvas {
  display: grid;
  width: max-content;
  height: max-content;
  min-width: 100%;
  min-height: 260px;
  padding: 0.75rem;
  box-sizing: border-box;
  place-items: center;
}

.image-preview-stage.is-zoomed {
  cursor: grab;
  touch-action: none;
}

.image-preview-stage.is-panning {
  cursor: grabbing;
  user-select: none;
}

.preview-image {
  transition: width 0.16s ease;
  will-change: width;
}

.markdown-preview {
  line-height: 1.75;
}

.markdown-preview > * + * {
  margin-top: 0.85rem;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4 {
  color: #1d2129;
  font-weight: 700;
  line-height: 1.35;
}

.markdown-preview h1 {
  font-size: 1.5rem;
}

.markdown-preview h2 {
  font-size: 1.25rem;
}

.markdown-preview h3 {
  font-size: 1.1rem;
}

.markdown-preview a {
  color: #165dff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.markdown-preview ul,
.markdown-preview ol {
  padding-left: 1.4rem;
}

.markdown-preview ul {
  list-style: disc;
}

.markdown-preview ol {
  list-style: decimal;
}

.markdown-preview blockquote {
  border-left: 3px solid #165dff;
  padding-left: 1rem;
  color: #4e5969;
}

.markdown-preview code {
  border-radius: 6px;
  background: #eef3ff;
  padding: 0.12rem 0.32rem;
  color: #165dff;
  font-size: 0.9em;
}

.markdown-preview pre {
  overflow: auto;
  border-radius: 10px;
  background: #111827;
  padding: 1rem;
  color: #f8fafc;
}

.markdown-preview pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.markdown-preview table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 10px;
}

.markdown-preview th,
.markdown-preview td {
  border: 1px solid #e5e6eb;
  padding: 0.6rem 0.75rem;
  text-align: left;
}

.markdown-preview th {
  background: #f7f8fa;
}

.skeleton-line {
  position: relative;
  overflow: hidden;
  background: #f2f3f5;
}

.skeleton-line::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: skeleton 1.3s infinite;
}

@keyframes skeleton {
  100% {
    transform: translateX(100%);
  }
}

body[data-theme="dark"] {
  background: #10131a;
  color: #f7f8fa;
}

body[data-theme="dark"] .page-view,
body[data-theme="dark"] .bg-bg {
  background-color: #10131a;
}

body[data-theme="dark"] .bg-white,
body[data-theme="dark"] .bg-card {
  background-color: #171b24;
}

body[data-theme="dark"] .bg-gray-50,
body[data-theme="dark"] .bg-gray-100,
body[data-theme="dark"] .bg-gray-200,
body[data-theme="dark"] .bg-blue-50,
body[data-theme="dark"] .bg-blue-50\/40,
body[data-theme="dark"] .bg-blue-50\/50,
body[data-theme="dark"] .bg-green-50,
body[data-theme="dark"] .bg-red-50,
body[data-theme="dark"] .bg-indigo-50,
body[data-theme="dark"] .bg-orange-50,
body[data-theme="dark"] .bg-cyan-50,
body[data-theme="dark"] .bg-purple-100,
body[data-theme="dark"] .bg-gray-50\/50,
body[data-theme="dark"] .bg-gray-50\/80 {
  background-color: #202735;
}

body[data-theme="dark"] .bg-successBg {
  background-color: rgba(0, 180, 42, 0.16);
}

body[data-theme="dark"] .bg-errorBg {
  background-color: rgba(245, 63, 63, 0.16);
}

body[data-theme="dark"] .text-textMain {
  color: #f7f8fa;
}

body[data-theme="dark"] .text-textSub {
  color: #9aa4b2;
}

body[data-theme="dark"] .text-gray-300,
body[data-theme="dark"] .text-gray-400,
body[data-theme="dark"] .text-gray-500 {
  color: #8a95a8;
}

body[data-theme="dark"] .border-border,
body[data-theme="dark"] .border-gray-100,
body[data-theme="dark"] .border-gray-200,
body[data-theme="dark"] .border-gray-50,
body[data-theme="dark"] .border-blue-100,
body[data-theme="dark"] .border-blue-200,
body[data-theme="dark"] .border-red-100,
body[data-theme="dark"] .border-red-200,
body[data-theme="dark"] .border-green-500 {
  border-color: #2b3240;
}

body[data-theme="dark"] input,
body[data-theme="dark"] textarea,
body[data-theme="dark"] select {
  background-color: transparent;
  color: #f7f8fa;
}

body[data-theme="dark"] option {
  background-color: #171b24;
  color: #f7f8fa;
}

body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder {
  color: #707b8f;
}

body[data-theme="dark"] .theme-choice.active {
  background: #273041;
  color: #7aa2ff;
}

body[data-theme="dark"] .share-filter.active {
  border-color: #165dff;
  background: #165dff;
  color: #ffffff;
}

body[data-theme="dark"] .hover\:bg-gray-50:hover,
body[data-theme="dark"] .hover\:bg-gray-100:hover,
body[data-theme="dark"] .active\:bg-gray-100:active,
body[data-theme="dark"] .active\:bg-gray-200:active {
  background-color: #252d3c;
}

body[data-theme="dark"] .hover\:bg-blue-50:hover,
body[data-theme="dark"] .hover\:bg-green-50:hover,
body[data-theme="dark"] .hover\:bg-red-50:hover {
  background-color: #252d3c;
}

body[data-theme="dark"] tr.hover\:bg-gray-50:hover {
  background-color: #1d2430;
}

body[data-theme="dark"] .shadow-soft,
body[data-theme="dark"] .shadow-card,
body[data-theme="dark"] .shadow-dropdown,
body[data-theme="dark"] .shadow-sm,
body[data-theme="dark"] .shadow-md {
  box-shadow: none;
}

body[data-theme="dark"] .toast,
body[data-theme="dark"] .action-menu-panel {
  border-color: #2b3240;
  background: #171b24;
  color: #f7f8fa;
}

body[data-theme="dark"] .markdown-preview h1,
body[data-theme="dark"] .markdown-preview h2,
body[data-theme="dark"] .markdown-preview h3,
body[data-theme="dark"] .markdown-preview h4 {
  color: #f7f8fa;
}

body[data-theme="dark"] .markdown-preview blockquote {
  color: #9aa4b2;
}

body[data-theme="dark"] .markdown-preview code {
  background: #202735;
  color: #7aa2ff;
}

body[data-theme="dark"] .markdown-preview pre {
  background: #0d1117;
}

body[data-theme="dark"] .markdown-preview th,
body[data-theme="dark"] .markdown-preview td {
  border-color: #2b3240;
}

body[data-theme="dark"] .markdown-preview th {
  background: #202735;
}

body[data-theme="dark"] .file-preview audio {
  accent-color: #7aa2ff;
  color-scheme: dark;
}

body[data-theme="dark"] .preview-tool-button {
  border-color: #2b3240;
  background: #171b24;
  color: #d6dde8;
}

body[data-theme="dark"] .preview-tool-button:hover {
  border-color: #7aa2ff;
  background: #202735;
  color: #7aa2ff;
}

body[data-theme="dark"] .image-preview-stage {
  background:
    linear-gradient(45deg, rgba(154, 164, 178, 0.12) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(154, 164, 178, 0.12) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(154, 164, 178, 0.12) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(154, 164, 178, 0.12) 75%);
  background-color: #111722;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

@media (max-width: 767px) {
  .file-preview {
    padding: 0.75rem;
  }

  .image-preview-head {
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .image-preview-title {
    width: 100%;
  }

  .image-preview-controls {
    width: 100%;
    justify-content: space-between;
  }

  .preview-tool-button {
    min-width: 36px;
    height: 36px;
  }

  .image-preview-stage {
    max-height: 56vh;
    min-height: 220px;
  }

  .image-preview-canvas {
    min-height: 220px;
    padding: 0.5rem;
  }

  .toast-region {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
  }
}

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