/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a1a1a1; }

/* Kanji character styling */
.kanji-char {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  line-height: 1;
}

body {
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Card hover effects */
.card-hover { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

/* Gradient backgrounds */
.gradient-primary { background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%); }
.gradient-secondary { background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%); }
.gradient-accent { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.gradient-japan { background: linear-gradient(135deg, #dc2626 0%, #f59e0b 50%, #10b981 100%); }

/* Animation classes */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fadeIn { animation: fadeIn 0.5s ease-out forwards; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}
.animate-slideIn { animation: slideIn 0.5s ease-out forwards; }

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
  50% { box-shadow: 0 0 0 10px rgba(220,38,38,0); }
}
.animate-pulse-glow { animation: pulse-glow 2s infinite; }

/* Position badge colors */
.position-hen { background-color: #dbeafe; color: #1e40af; }
.position-tsukuri { background-color: #fce7f3; color: #9d174d; }
.position-kanmuri { background-color: #e0e7ff; color: #3730a3; }
.position-ashi { background-color: #d1fae5; color: #065f46; }
.position-naka { background-color: #fef3c7; color: #92400e; }
.position-kamae { background-color: #ede9fe; color: #5b21b6; }
.position-other { background-color: #f3f4f6; color: #374151; }

/* Flashcard flip animation */
.flip-card { perspective: 1000px; }
.flip-card-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform 0.6s; transform-style: preserve-3d;
}
.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }
.flip-card-front, .flip-card-back {
  position: absolute; width: 100%; height: 100%;
  backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center;
}
.flip-card-back { transform: rotateY(180deg); }

/* Utility classes */
.text-primary { color: #dc2626; }
.text-primary-dark { color: #991b1b; }
.text-secondary { color: #7c3aed; }
.text-accent { color: #f59e0b; }
.bg-primary { background-color: #dc2626; }
.hover\:bg-primary-dark:hover { background-color: #991b1b; }
.border-primary { border-color: #dc2626; }
.hover\:border-primary:hover { border-color: #dc2626; }
.hover\:text-primary-dark:hover { color: #991b1b; }

/* Stagger animation delays */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }

/* Button styles */
.btn-primary {
  background-color: #dc2626; color: white;
  padding: 0.75rem 1.5rem; border-radius: 0.75rem;
  font-weight: 500; transition: all 0.3s;
}
.btn-primary:hover { background-color: #991b1b; }

.btn-secondary {
  background-color: #7c3aed; color: white;
  padding: 0.75rem 1.5rem; border-radius: 0.75rem;
  font-weight: 500; transition: all 0.3s;
}
.btn-secondary:hover { background-color: #5b21b6; }

/* ============ RESPONSIVE ============ */

/* Disable hover lift on touch/small screens */
@media (max-width: 640px) {
  .card-hover:hover { transform: none; }
}

/* Scale down giant kanji characters on small screens */
@media (max-width: 480px) {
  .text-9xl { font-size: 5rem !important; line-height: 1; }
  .text-8xl { font-size: 4rem !important; line-height: 1; }
  .text-7xl { font-size: 3.5rem !important; line-height: 1; }
}

@media (max-width: 360px) {
  .text-9xl { font-size: 4rem !important; line-height: 1; }
  .text-8xl { font-size: 3.5rem !important; line-height: 1; }
  .text-7xl { font-size: 3rem !important; line-height: 1; }
}

/* Flashcard responsive height */
@media (max-width: 640px) {
  .flip-card { height: 220px !important; }
  .flip-card-front, .flip-card-back { padding: 1rem !important; }
  .flip-card-front .text-9xl,
  .flip-card-back .text-3xl { font-size: 4rem !important; }
  .flip-card-front .text-7xl { font-size: 3.5rem !important; }
}

/* Quiz options responsive */
@media (max-width: 480px) {
  .quiz-option { padding: 0.75rem !important; }
  .quiz-option .text-5xl { font-size: 2.5rem !important; }
  .quiz-option p { font-size: 0.75rem !important; }
  .quiz-option .text-sm { font-size: 0.7rem !important; }
}

@media (max-width: 360px) {
  .quiz-option .text-5xl { font-size: 2rem !important; }
}

/* Responsive padding for quiz/flashcard containers on small screens */
@media (max-width: 480px) {
  #learn-content .p-12,
  #learn-content .sm\:p-8 { padding: 1rem !important; }
}

/* Ensure body doesn't overflow horizontally */
html, body { overflow-x: hidden; }
