/* ============================================================
   N1备考中心 — Shared CSS (replaces Tailwind CDN)
   ============================================================ */

/* --- CSS Variables --- */
:root {
  --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb;
  --gray-300: #d1d5db; --gray-400: #9ca3af; --gray-500: #6b7280;
  --gray-600: #4b5563; --gray-700: #374151; --gray-800: #1f2937;
  --purple-50: #faf5ff; --purple-100: #f3e8ff; --purple-200: #e9d5ff;
  --purple-300: #d8b4fe; --purple-400: #c084fc; --purple-500: #a855f7;
  --purple-600: #9333ea; --purple-700: #7e22ce; --purple-800: #6b21a8;
  --purple-900: #581c87;
  --indigo-50: #eef2ff; --indigo-100: #e0e7ff; --indigo-200: #c7d2fe;
  --indigo-300: #a5b4fc; --indigo-400: #818cf8; --indigo-500: #6366f1;
  --indigo-600: #4f46e5; --indigo-700: #4338ca; --indigo-800: #3730a3;
  --indigo-900: #312e81;
  --green-50: #f0fdf4; --green-100: #dcfce7; --green-200: #bbf7d0;
  --green-300: #86efac; --green-400: #4ade80; --green-500: #22c55e;
  --green-600: #16a34a;
  --amber-50: #fffbeb; --amber-100: #fef3c7; --amber-200: #fde68a;
  --amber-300: #fcd34d; --amber-400: #fbbf24; --amber-500: #f59e0b;
  --amber-700: #b45309; --amber-800: #92400e;
  --blue-50: #eff6ff; --blue-100: #dbeafe; --blue-200: #bfdbfe;
  --blue-300: #93c5fd; --blue-400: #60a5fa;
  --pink-100: #fce7f3; --pink-300: #f9a8d4; --pink-600: #db2777;
  --red-400: #f87171;
  --rose-50: #fff1f2; --rose-100: #ffe4e6; --rose-400: #fb7185;
  --rose-500: #f43f5e; --rose-600: #e11d48;
  --slate-50: #f8fafc;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--slate-50);
  color: var(--gray-800);
  line-height: 1.5;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input { font: inherit; }
img, svg { display: block; max-width: 100%; }

/* --- Layout --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; min-height: 0; }
.flex-shrink-0 { flex-shrink: 0; }
.shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; } .gap-1\.5 { gap: 0.375rem; } .gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }
.min-w-0 { min-width: 0; }
.h-full { height: 100%; }
.h-screen { height: 100vh; }
.min-h-screen { min-height: 100vh; }
.w-full { width: 100%; }

/* --- Spacing --- */
.p-0\.5 { padding: 0.125rem; } .p-1 { padding: 0.25rem; } .p-1\.5 { padding: 0.375rem; }
.p-2 { padding: 0.5rem; } .p-3 { padding: 0.75rem; } .p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; } .p-6 { padding: 1.5rem; } .p-8 { padding: 2rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-1\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.pt-3 { padding-top: 0.75rem; } .pt-4 { padding-top: 1rem; }
.pb-2 { padding-bottom: 0.5rem; } .pb-3 { padding-bottom: 0.75rem; } .pb-4 { padding-bottom: 1rem; }
.m-0 { margin: 0; } .mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; } .mt-5 { margin-top: 1.25rem; } .mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; } .mt-10 { margin-top: 2.5rem; }
.mb-1 { margin-bottom: 0.25rem; } .mb-1\.5 { margin-bottom: 0.375rem; }
.mb-2 { margin-bottom: 0.5rem; } .mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; } .mb-5 { margin-bottom: 1.25rem; } .mb-6 { margin-bottom: 1.5rem; }
.mb-10 { margin-bottom: 2.5rem; }
.ml-auto { margin-left: auto; } .mr-1 { margin-right: 0.25rem; } .mr-1\.5 { margin-right: 0.375rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }

/* --- Typography --- */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-6xl { font-size: 3.75rem; line-height: 1; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.leading-snug { line-height: 1.375; }
.leading-relaxed { line-height: 1.625; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-widest { letter-spacing: 0.1em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Colors (text) --- */
.text-white { color: var(--white, #fff); }
.text-gray-100 { color: var(--gray-100); } .text-gray-200 { color: var(--gray-200); }
.text-gray-300 { color: var(--gray-300); } .text-gray-400 { color: var(--gray-400); }
.text-gray-500 { color: var(--gray-500); } .text-gray-600 { color: var(--gray-600); }
.text-gray-800 { color: var(--gray-800); }
.text-purple-50 { color: var(--purple-50); } .text-purple-100 { color: var(--purple-100); }
.text-purple-200 { color: var(--purple-200); } .text-purple-300 { color: var(--purple-300); }
.text-purple-400 { color: var(--purple-400); } .text-purple-500 { color: var(--purple-500); }
.text-purple-600 { color: var(--purple-600); }
.text-indigo-50 { color: var(--indigo-50); } .text-indigo-100 { color: var(--indigo-100); }
.text-indigo-200 { color: var(--indigo-200); } .text-indigo-300 { color: var(--indigo-300); }
.text-indigo-400 { color: var(--indigo-400); } .text-indigo-500 { color: var(--indigo-500); }
.text-indigo-600 { color: var(--indigo-600); }
.text-green-400 { color: var(--green-400); } .text-green-500 { color: var(--green-500); }
.text-green-600 { color: var(--green-600); }
.text-amber-700 { color: var(--amber-700); } .text-amber-800 { color: var(--amber-800); }
.text-blue-100 { color: var(--blue-100); } .text-blue-200 { color: var(--blue-200); }
.text-blue-300 { color: var(--blue-300); } .text-blue-400 { color: var(--blue-400); }
.text-pink-100 { color: var(--pink-100); } .text-pink-300 { color: var(--pink-300); } .text-pink-600 { color: var(--pink-600); }
.text-red-400 { color: var(--red-400); }
.text-rose-50 { color: var(--rose-50); }

/* --- Backgrounds --- */
.bg-white { background-color: #fff; }
.bg-gray-50 { background-color: var(--gray-50); } .bg-gray-100 { background-color: var(--gray-100); }
.bg-gray-200 { background-color: var(--gray-200); }
.bg-purple-50 { background-color: var(--purple-50); } .bg-purple-100 { background-color: var(--purple-100); }
.bg-purple-200 { background-color: var(--purple-200); } .bg-purple-600 { background-color: var(--purple-600); }
.bg-purple-900 { background-color: var(--purple-900); }
.bg-indigo-50 { background-color: var(--indigo-50); } .bg-indigo-100 { background-color: var(--indigo-100); }
.bg-indigo-200 { background-color: var(--indigo-200); } .bg-indigo-600 { background-color: var(--indigo-600); }
.bg-indigo-900 { background-color: var(--indigo-900); }
.bg-green-50 { background-color: var(--green-50); } .bg-green-100 { background-color: var(--green-100); }
.bg-green-400 { background-color: var(--green-400); }
.bg-amber-50 { background-color: var(--amber-50); } .bg-amber-100 { background-color: var(--amber-100); }
.bg-blue-100 { background-color: var(--blue-100); }

/* --- Borders --- */
.border { border-width: 1px; border-style: solid; }
.border-2 { border-width: 2px; border-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-r { border-right-width: 1px; border-right-style: solid; }
.border-gray-100 { border-color: var(--gray-100); }
.border-gray-200 { border-color: var(--gray-200); }
.border-gray-300 { border-color: var(--gray-300); }
.border-transparent { border-color: transparent; }
.border-green-100 { border-color: var(--green-100); }
.border-green-400 { border-color: var(--green-400); }
.border-purple-300\/20 { border-color: rgba(216,180,254,0.2); }
.border-purple-700 { border-color: var(--purple-700); }
.border-indigo-300\/20 { border-color: rgba(165,180,252,0.2); }
.border-indigo-700 { border-color: var(--indigo-700); }
.border-amber-100 { border-color: var(--amber-100); }
.border-white\/10 { border-color: rgba(255,255,255,0.1); }
.rounded { border-radius: 0.25rem; }
.rounded-full { border-radius: 9999px; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-3xl { border-radius: 1.5rem; }
.rounded-br-full { border-bottom-right-radius: 9999px; }
.rounded-bl-full { border-bottom-left-radius: 9999px; }

/* --- Shadows --- */
.shadow-sm { box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1); }

/* --- Sizing --- */
.h-1 { height: 0.25rem; } .h-1\.5 { height: 0.375rem; } .h-2 { height: 0.5rem; }
.h-3 { height: 0.75rem; } .h-4 { height: 1rem; } .h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; } .h-7 { height: 1.75rem; } .h-8 { height: 2rem; }
.h-12 { height: 3rem; } .h-14 { height: 3.5rem; } .h-16 { height: 4rem; }
.h-32 { height: 8rem; }
.w-4 { width: 1rem; } .w-14 { width: 3.5rem; } .w-16 { width: 4rem; }
.w-28 { width: 7rem; } .w-32 { width: 8rem; } .w-48 { width: 12rem; }
.w-64 { width: 16rem; } .w-72 { width: 18rem; }
.max-w-lg { max-width: 32rem; } .max-w-3xl { max-width: 48rem; }
.aspect-\[3\/4\] { aspect-ratio: 3 / 4; }

/* --- Position --- */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; } .top-3 { top: 0.75rem; } .top-4 { top: 1rem; } .top-8 { top: 2rem; }
.right-0 { right: 0; } .right-3 { right: 0.75rem; } .right-4 { right: 1rem; }
.bottom-4 { bottom: 1rem; } .bottom-5 { bottom: 1.25rem; }
.left-1\/2 { left: 50%; }
.z-30 { z-index: 30; } .z-40 { z-index: 40; } .z-50 { z-index: 50; }

/* --- Display --- */
.block { display: block; }
.inline-block { display: inline-block; }
.grid { display: grid; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.opacity-60 { opacity: 0.6; }

/* --- Effects --- */
.transition-all { transition: all 0.3s ease; }
.transition-colors { transition: color 0.15s, background-color 0.15s, border-color 0.15s; }
.transition-transform { transition: transform 0.15s ease; }
.hover\:bg-gray-100:hover { background-color: var(--gray-100); }
.hover\:shadow-xl:hover { box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1); }
.hover\:border-indigo-200:hover { border-color: var(--indigo-200); }
.hover\:border-purple-200:hover { border-color: var(--purple-200); }
.hover\:text-purple-500:hover { color: var(--purple-500); }
.hover\:text-indigo-500:hover { color: var(--indigo-500); }
.hover\:text-indigo-600:hover { color: var(--indigo-600); }
.hover\:text-purple-800:hover { color: var(--purple-800); }
.hover\:text-indigo-800:hover { color: var(--indigo-800); }
.hover\:text-red-400:hover { color: var(--red-400); }
.active\:scale-95:active { transform: scale(0.95); }
.focus\:outline-none:focus { outline: none; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px var(--ring-color, rgba(168,85,247,0.4)); }
.focus\:ring-purple-300:focus { --ring-color: rgba(216,180,254,0.6); }
.focus\:ring-indigo-300:focus { --ring-color: rgba(165,180,252,0.6); }

/* --- Transform --- */
.-translate-x-1\/2 { transform: translateX(-50%); }
.-translate-x-full { transform: translateX(-100%); }
.translate-x-0 { transform: translateX(0); }

/* --- Gradient (replaces Tailwind gradient-to-bl) --- */
.gradient-bl-indigo { background: linear-gradient(to bottom left, var(--indigo-100), transparent); }
.gradient-bl-purple { background: linear-gradient(to bottom left, var(--purple-100), transparent); }
.gradient-card-vocab { background: linear-gradient(135deg, var(--purple-900), #3b1f7e); }
.gradient-card-grammar { background: linear-gradient(135deg, var(--indigo-900), var(--purple-900)); }

/* --- Backdrop --- */
.backdrop-blur-sm { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.bg-white\/10 { background-color: rgba(255,255,255,0.1); }

/* --- Cursors --- */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* --- Selection --- */
::selection { background-color: rgba(168,85,247,0.2); }
.grammar-page ::selection { background-color: rgba(99,102,241,0.2); }

/* --- Grid --- */
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ============================================================
   FLIP CARD (shared)
   ============================================================ */
.perspective-1000 { perspective: 1000px; }
.transform-style-3d { transform-style: preserve-3d; }
.backface-hidden { backface-visibility: hidden; }
.rotate-y-180 { transform: rotateY(180deg); }
.card-transition { transition: transform 0.5s cubic-bezier(0.4, 0.2, 0.2, 1); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar-item {
  transition: all 0.15s ease;
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  color: var(--gray-600);
}
.sidebar-item:hover { background: var(--gray-100); }
.sidebar-item.active { background: var(--indigo-100); color: var(--indigo-600); font-weight: 600; }
.vocab-sidebar .sidebar-item.active { background: var(--purple-200); color: var(--purple-600); }

/* ============================================================
   SCROLLBAR HIDE
   ============================================================ */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.2s ease-out; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeInUp 0.6s ease-out both; }
.fade-up-delay { animation: fadeInUp 0.6s ease-out 0.15s both; }
.fade-up-delay2 { animation: fadeInUp 0.6s ease-out 0.3s both; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
.slide-in { animation: slideIn 0.15s ease-out; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.float { animation: float 3s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

/* Card hover for homepage */
.card-hover { transition: all 0.3s ease; }
.card-hover:hover { transform: translateY(-8px); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 640px) {
  .sm\:p-4 { padding: 1rem; }
  .sm\:p-6 { padding: 1.5rem; }
  .sm\:p-8 { padding: 2rem; }
  .sm\:pt-4 { padding-top: 1rem; }
  .sm\:pb-3 { padding-bottom: 0.75rem; }
  .sm\:pb-4 { padding-bottom: 1rem; }
  .sm\:px-4 { padding-left: 1rem; padding-right: 1rem; }
  .sm\:gap-3 { gap: 0.75rem; }
  .sm\:text-base { font-size: 1rem; }
  .sm\:text-lg { font-size: 1.125rem; }
  .sm\:text-xl { font-size: 1.25rem; }
  .sm\:text-2xl { font-size: 1.5rem; }
  .sm\:text-3xl { font-size: 1.875rem; }
  .sm\:text-4xl { font-size: 2.25rem; }
  .sm\:text-sm { font-size: 0.875rem; }
  .sm\:text-xs { font-size: 0.75rem; }
  .sm\:text-\[1\.05rem\] { font-size: 1.05rem; }
  .sm\:text-\[0\.95rem\] { font-size: 0.95rem; }
  .sm\:mb-3 { margin-bottom: 0.75rem; }
  .sm\:mb-4 { margin-bottom: 1rem; }
  .sm\:h-14 { height: 3.5rem; }
  .sm\:w-20 { width: 5rem; }
  .sm\:h-20 { height: 5rem; }
  .sm\:top-4 { top: 1rem; }
  .sm\:right-4 { right: 1rem; }
  .sm\:bottom-5 { bottom: 1.25rem; }
  .sm\:px-4 { padding-left: 1rem; padding-right: 1rem; }
  .sm\:py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .sm\:block { display: block; }
}
@media (min-width: 768px) {
  .md\:flex { display: flex; }
  .md\:w-64 { width: 16rem; }
  .md\:w-0 { width: 0; }
  .md\:overflow-hidden { overflow: hidden; }
  .md\:relative { position: relative; }
  .md\:hidden { display: none; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:translate-x-0 { transform: translateX(0); }
}
@media (max-width: 639px) {
  .hidden { display: none; }
}

/* ============================================================
   HOME PAGE BACKGROUND
   ============================================================ */
.home-bg {
  background: linear-gradient(135deg, var(--slate-50) 0%, #f5f3ff 50%, #eef2ff 100%);
  min-height: 100vh;
}

/* ============================================================
   RUBY (grammar)
   ============================================================ */
ruby { ruby-align: center; }
rt { font-size: 0.55em; color: var(--blue-200); transform: translateY(-2px); }

/* ============================================================
   KBD
   ============================================================ */
kbd {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  background: var(--amber-100);
  border-radius: 0.25rem;
  font-size: 0.75rem;
  color: var(--amber-800);
  font-family: inherit;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--gray-800);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

/* ============================================================
   SKELETON LOADING
   ============================================================ */
.skeleton-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

/* ============================================================
   GROUP HOVER
   ============================================================ */
.group:hover .group-hover\:bg-indigo-200 { background-color: var(--indigo-200); }
.group:hover .group-hover\:bg-purple-200 { background-color: var(--purple-200); }
.group:hover .group-hover\:gap-2 { gap: 0.5rem; }

/* ============================================================
   BUTTON / UTILITY COMPOSITES
   ============================================================ */
.btn-primary-purple {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 3rem;
  background: var(--purple-600); color: #fff;
  border-radius: 1rem; font-weight: 700;
  transition: transform 0.15s;
}
.btn-primary-purple:active { transform: scale(0.95); }

.btn-primary-indigo {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 3rem;
  background: var(--indigo-600); color: #fff;
  border-radius: 1rem; font-weight: 700;
  transition: transform 0.15s;
}
.btn-primary-indigo:active { transform: scale(0.95); }

.btn-nav {
  display: flex; align-items: center; justify-content: center;
  flex: 1; height: 3rem;
  border-radius: 1rem; font-weight: 700;
  box-shadow: 0 4px 6px -1px rgba(99,102,241,0.2);
  transition: transform 0.15s;
}
.btn-nav:active { transform: scale(0.95); }
