* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #fafcff;
  color: #0a0f1c;
  line-height: 1.4;
}

.platform-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.hero {
  text-align: center;
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: 2.8rem;
  background: linear-gradient(135deg, #1E2B5C, #2A3F7E);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}

.hero p {
  color: #4a5568;
  margin-top: 0.5rem;
  font-size: 1.2rem;
}

.badge {
  display: inline-block;
  background: #eef2ff;
  padding: 0.2rem 0.9rem;
  border-radius: 40px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #1e3a8a;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.filter-btn {
  background: white;
  border: 1px solid #dce3ec;
  padding: 0.5rem 1.3rem;
  border-radius: 40px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.filter-btn.active {
  background: #1e2b5c;
  color: white;
  border-color: #1e2b5c;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 2rem;
}

.template-card {
  background: white;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.03), 0 2px 6px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.2s;
  border: 1px solid #eef2f9;
}

.template-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 30px -12px rgba(0,0,0,0.1);
}

.preview-img {
  width: 100%;
  height: 180px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border-bottom: 1px solid #edf2f7;
  object-fit: cover;
}

.card-content {
  padding: 1.3rem 1.2rem 1.5rem;
}

.template-name {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.category-tag {
  display: inline-block;
  background: #eef2ff;
  border-radius: 20px;
  padding: 0.2rem 0.8rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #2c3e66;
  margin-bottom: 1rem;
}

.card-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1rem;
}

.btn {
  flex: 1;
  text-align: center;
  padding: 0.6rem 0;
  border-radius: 60px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: 0.2s;
  border: none;
  background: none;
  font-family: inherit;
}

.btn-preview {
  background: #f0f4fe;
  color: #1e2b5c;
  border: 1px solid #dce5f5;
}

.btn-preview:hover {
  background: #e4eafb;
}

.btn-download {
  background: #1e2b5c;
  color: white;
}

.btn-download:hover {
  background: #0f1c42;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  visibility: hidden;
  opacity: 0;
  transition: 0.2s;
}

.modal-overlay.active {
  visibility: visible;
  opacity: 1;
}

.modal-container {
  background: #fff;
  width: 90vw;
  height: 85vh;
  max-width: 1300px;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 40px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e9edf2;
  background: white;
}

.modal-header h3 {
  font-weight: 600;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.preview-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: white;
}

footer {
  text-align: center;
  margin-top: 4rem;
  color: #5b6e8c;
  font-size: 0.85rem;
  border-top: 1px solid #e2e8f0;
  padding-top: 2rem;
}

@media (max-width: 640px) {
  .platform-container {
    padding: 1rem;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .modal-container {
    width: 95vw;
    height: 80vh;
  }
}