*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
  --primary: #4361ee;
  --primary-dark: #3a56d4;
  --secondary: #4cc9f0;
  --light: #f8f9fa;
  --dark: #212529;
  --gray: #6c757d;
  --success: #7209b7;
  --border-radius: 16px;
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  --transition: all 0.3s ease;
}

body {
  background-color: #f5f7fb;
  color: var(--dark);
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Main App */
.app-container {
  min-height: 100vh;
}

.header {
  background: white;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px 0;
  position: relative;
}

.app-logo {
  height: 35px;
}

.main-content {
  padding: 30px 0;
}

.page-title {
  font-size: 32px;
  margin-bottom: 8px;
  color: #5a5d63;
  font-weight: 700;
}

.page-subtitle {
  color: #4a5568;
  margin-bottom: 30px;
  font-size: 16px;
}

.roleplay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.roleplay-card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.roleplay-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.roleplay-card.locked {
  opacity: 0.8;
  cursor: not-allowed;
}

.roleplay-card.locked:hover {
  transform: none;
}

.locked-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 600;
  z-index: 2;
  backdrop-filter: blur(2px);
}

.locked-overlay i {
  margin-right: 8px;
}

.card-image {
  height: 160px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 42px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.card-content {
  padding: 24px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 18px;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--dark);
  min-height: 24px;
}

.card-description {
  color: var(--gray);
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
  flex-grow: 1;
  min-height: 40px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--gray);
  margin-top: auto;
}

.difficulty {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.5px;
  background: #4361ee;
  color: white;
  margin-right: 8px;
}

/* ============================================ */
/* ORIGINAL FILTER CONTAINER - WORKING AND CENTERED */
/* ============================================ */

.filter-container {
  margin-bottom: 30px;
  display: flex;
  justify-content: center;
}

.filter-toggle {
  display: flex;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 16px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  gap: 2px;
  justify-content: center; /* Center buttons horizontally */
  align-items: center; /* Center buttons vertically */
  width: fit-content; /* Container only as wide as buttons */
  max-width: 100%; /* Don't exceed container width */
  margin: 0 auto 40px auto; /* Center and add space below */
}

.filter-btn {
  padding: 12px 24px;
  border: none;
  background: transparent;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #6b7280;
  position: relative;
  overflow: hidden;
  min-width: 100px;
  white-space: nowrap; /* Prevent text wrapping */
  flex-shrink: 0; /* Prevent buttons from shrinking */
}

.filter-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.5s;
}

.filter-btn:hover::before {
  left: 100%;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.6);
  color: #4361ee;
  transform: translateY(-1px);
}

.filter-btn.active {
  background: linear-gradient(135deg, #4361ee 0%, #3a56d4 100%);
  color: white;
  box-shadow: 
    0 4px 15px rgba(67, 97, 238, 0.3),
    0 2px 4px rgba(67, 97, 238, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.filter-btn.active:hover {
  background: linear-gradient(135deg, #3a56d4 0%, #2f4bc2 100%);
  transform: translateY(-2px);
  box-shadow: 
    0 6px 20px rgba(67, 97, 238, 0.4),
    0 3px 6px rgba(67, 97, 238, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .filter-toggle {
    padding: 4px;
    border-radius: 14px;
    width: auto;
    margin-bottom: 35px;
  }
  
  .filter-btn {
    padding: 10px 16px;
    font-size: 13px;
    min-width: 80px;
    border-radius: 10px;
  }
}

@media (max-width: 480px) {
  .filter-btn {
    padding: 8px 12px;
    font-size: 12px;
    min-width: 70px;
  }
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: white;
  border-radius: var(--border-radius);
  width: 95%;
  height: 90%;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--dark);
}

.close-modal {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--gray);
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}

.close-modal:hover {
  background: #e9ecef;
  color: var(--dark);
}

.modal-body {
  flex: 1;
  padding: 0;
  overflow: hidden;
  min-height: 500px;
}

.iframe-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.iframe-container iframe {
  width: 100%;
  height: 70vh;
  min-height: 550px;
  border: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

#iframeContainer iframe {
  width: 100%;
  height: 70vh;
  min-height: 550px;
  border-radius: 8px;
}

.payment-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.payment-content {
  background: white;
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 450px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.payment-icon {
  font-size: 56px;
  background: linear-gradient(135deg, #4361ee, #4cc9f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
}

.payment-title {
  font-size: 24px;
  margin-bottom: 16px;
  font-weight: 700;
  color: var(--dark);
}

.payment-text {
  color: var(--gray);
  margin-bottom: 30px;
  line-height: 1.6;
  font-size: 15px;
}

.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  padding: 15px 20px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  width: 100%;
  letter-spacing: 0.5px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

.btn-secondary {
  background: var(--gray);
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-success {
  background: var(--success);
}

.btn-success:hover {
  background: #5a08a3;
}

/* Free and Premium tags */
.free-tag {
  color: #dc2626;
  font-weight: 600;
  font-size: 11px;
}

.premium-tag {
  color: #7c3aed;
  font-weight: 600;
  font-size: 11px;
}

.accent-tag {
  background: #e9ecef;
  color: #6c757d;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 8px;
}

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  .roleplay-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
  }
  
  .page-title {
    font-size: 28px;
  }
}

@media (max-width: 576px) {
  .roleplay-grid {
    grid-template-columns: 1fr;
  }
  
  .payment-content {
    padding: 30px 25px;
    margin: 20px;
  }
}

/* Type tags */
.type-tag {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 8px;
}

.roleplay-tag {
  background: #e3f2fd;
  color: #1976d2;
}

.pronounce-tag {
  background: #f3e5f5;
  color: #7b1fa2;
}

.listen-tag {
  background: #e8f5e9;
  color: #2e7d32;
}

/* Premium unlocked styles */
.premium-unlocked-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #333;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
}

.premium-unlocked-tag {
  color: #FFA500;
  font-weight: 600;
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 3px;
}