:root {
  --purple-deep: #4A1D6A;
  --purple-rich: #6B21A8;
  --gold: #F59E0B;
  --gold-light: #FCD34D;
  --cream: #FEF3C7;
  --cream-dark: #FDE68A;
  --bg-light: #FDF8F0;
  --bg-dark: #1A0A2E;
  --text-light: #2D1B4E;
  --text-dark: #F5E6D3;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  transition: background-color 0.4s ease, color 0.4s ease;
  min-height: 100vh;
  overflow-x: hidden;
}

body.light {
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--cream) 50%, #FEE2E2 100%);
  color: var(--text-light);
}

body.dark {
  background: linear-gradient(135deg, var(--bg-dark) 0%, #2D1B4E 50%, #1F1147 100%);
  color: var(--text-dark);
}

.app {
  min-height: 100vh;
  position: relative;
}

.background-decoration {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(107, 33, 168, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(245, 158, 11, 0.1) 0%, transparent 40%);
  z-index: 0;
}

.header {
  padding: 2.5rem 1.5rem 1.5rem;
  text-align: center;
  position: relative;
  z-index: 10;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
}

.title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple-rich) 0%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.dark .title {
  background: linear-gradient(135deg, var(--gold-light) 0%, #FCA5A5 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.8;
  font-weight: 400;
  margin-bottom: 1.5rem;
}

.header-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.control-btn {
  padding: 0.6rem 1.2rem;
  border: 2px solid var(--purple-rich);
  border-radius: 50px;
  background: transparent;
  color: inherit;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-btn:hover {
  background: var(--purple-rich);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(107, 33, 168, 0.3);
}

.dark .control-btn {
  border-color: var(--gold);
}

.dark .control-btn:hover {
  background: var(--gold);
  color: var(--bg-dark);
}

.control-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.info-panel {
  max-width: 700px;
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
  animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.info-content {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(107, 33, 168, 0.2);
}

.dark .info-content {
  background: rgba(45, 27, 78, 0.9);
  border-color: rgba(245, 158, 11, 0.3);
}

.info-content h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
  color: var(--purple-rich);
}

.dark .info-content h3 {
  color: var(--gold);
}

.info-content p {
  line-height: 1.7;
  font-size: 0.95rem;
}

.info-note {
  margin-top: 0.75rem;
  font-style: italic;
  opacity: 0.8;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  padding: 1rem 1.5rem 3rem;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  z-index: 5;
}

.cards-grid.shuffling .card {
  animation: shuffle 0.3s ease-out;
}

@keyframes shuffle {
  0% { transform: scale(0.9) rotate(-5deg); opacity: 0.5; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@media (max-width: 1100px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 800px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1rem;
  }
}

@media (max-width: 500px) {
  .cards-grid {
    grid-template-columns: 1fr;
    max-width: 350px;
  }
}

.card {
  background: linear-gradient(145deg, rgba(255,255,255,0.95) 0%, rgba(254,243,199,0.9) 100%);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(107, 33, 168, 0.15);
}

.dark .card {
  background: linear-gradient(145deg, rgba(45, 27, 78, 0.95) 0%, rgba(26, 10, 46, 0.9) 100%);
  border-color: rgba(245, 158, 11, 0.2);
}

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

.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 
    0 20px 40px rgba(107, 33, 168, 0.2),
    0 0 0 2px var(--gold),
    inset 0 0 30px rgba(245, 158, 11, 0.1);
}

.dark .card:hover {
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.4),
    0 0 0 2px var(--gold),
    inset 0 0 30px rgba(245, 158, 11, 0.15);
}

.card.copied {
  animation: pulse 0.3s ease-out;
}

@keyframes pulse {
  50% { transform: scale(1.05); }
}

.card-inner {
  position: relative;
  padding: 1.25rem;
}

.card-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(45deg, var(--card-color) 0px, var(--card-color) 2px, transparent 2px, transparent 10px);
  transition: opacity 0.3s ease;
}

.card-content {
  position: relative;
  z-index: 2;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.flag {
  font-size: 2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.speak-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--purple-rich), var(--purple-deep));
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.speak-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(107, 33, 168, 0.4);
}

.dark .speak-btn {
  background: linear-gradient(135deg, var(--gold), #D97706);
}

.word {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--purple-deep);
  line-height: 1.3;
  word-break: break-word;
}

.dark .word {
  color: var(--gold-light);
}

.word.rtl {
  direction: rtl;
  text-align: right;
}

.language {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 0.25rem;
}

.dark .language {
  color: #FCA5A5;
}

.pronunciation {
  font-size: 0.8rem;
  opacity: 0.7;
  font-style: italic;
  margin-bottom: 0.5rem;
}

.copy-hint {
  font-size: 0.7rem;
  opacity: 0.5;
  text-align: center;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(107, 33, 168, 0.1);
  transition: opacity 0.2s;
}

.card:hover .copy-hint {
  opacity: 0.8;
}

.card.copied .copy-hint {
  color: #10B981;
  opacity: 1;
  font-weight: 600;
}

.footer {
  text-align: center;
  padding: 2rem 1.5rem 3rem;
  position: relative;
  z-index: 10;
}

.tagline {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-style: italic;
  margin-bottom: 1rem;
  opacity: 0.8;
}

.footer-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.share-btn {
  padding: 0.5rem 1rem;
  border: 1px solid currentColor;
  border-radius: 50px;
  background: transparent;
  color: inherit;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.share-btn:hover {
  background: var(--purple-rich);
  color: white;
  border-color: var(--purple-rich);
}

.dark .share-btn:hover {
  background: var(--gold);
  color: var(--bg-dark);
  border-color: var(--gold);
}

.berrry-link {
  color: inherit;
  text-decoration: none;
  font-size: 0.85rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.berrry-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Shimmer effect on cards */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
  z-index: 1;
}

.card:hover::before {
  left: 100%;
}