:root {
  --primary-color: #2c5aa0;
  --primary-dark: #1e3a8a;
  --secondary-color: #667eea;
  --accent-color: #ffa500;
  --text-color: #333;
  --text-light: #666;
  --text-lighter: #999;
  --bg-color: #f5f5f5;
  --bg-white: #fff;
  --border-color: #e0e0e0;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  font-size: 16px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: all 0.3s ease;
}

a:hover {
  text-decoration: underline;
  color: var(--primary-dark);
}

header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

nav {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

nav a {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  padding: 1rem 0.5rem;
  text-decoration: none;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.3s ease;
  font-weight: 500;
  border-bottom: 3px solid transparent;
}

nav a:hover {
  background: var(--bg-color);
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  text-decoration: none;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg) var(--spacing-sm);
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--spacing-sm);
  line-height: 1.2;
  color: #1a1a1a;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 1.8rem;
}

h3 {
  font-size: 1.3rem;
}

p {
  margin: 0 0 var(--spacing-sm);
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

button, .btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  background: var(--primary-color);
  color: var(--bg-white);
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

button:hover, .btn:hover {
  background: var(--primary-dark);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card {
  background: var(--bg-white);
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.grid {
  display: grid;
  gap: var(--spacing-md);
}

.grid-2 {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

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

.grid-4 {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

footer {
  background: #2c3e50;
  color: #ecf0f1;
  padding: var(--spacing-lg) var(--spacing-sm);
  margin-top: var(--spacing-xl);
  text-align: center;
}

footer a {
  color: #ecf0f1;
}

footer a:hover {
  color: var(--bg-white);
}

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: var(--bg-white);
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  z-index: 999;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-4px);
}

.back-to-top.visible {
  display: flex;
}

.badge {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
}

.badge-primary {
  background: #e8f4f8;
  color: var(--primary-color);
}

.badge-secondary {
  background: #f0fdf4;
  color: #15803d;
}

.badge-accent {
  background: #fef3c7;
  color: #92400e;
}

@media (max-width: 768px) {
  nav a {
    font-size: 0.85rem;
    padding: 0.8rem 0.3rem;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  main {
    padding: var(--spacing-sm);
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }
}

@media (max-width: 480px) {
  nav a {
    font-size: 0.75rem;
    padding: 0.7rem 0.2rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  footer {
    font-size: 0.9rem;
  }
}

.ui-style-0 body { --primary-color: #2563eb; }
.ui-style-1 body { --primary-color: #7c3aed; }
.ui-style-2 body { --primary-color: #dc2626; }
.ui-style-3 body { --primary-color: #ea580c; }
.ui-style-4 body { --primary-color: #ca8a04; }
.ui-style-5 body { --primary-color: #16a34a; }
.ui-style-6 body { --primary-color: #0891b2; }
.ui-style-7 body { --primary-color: #4f46e5; }
.ui-style-8 body { --primary-color: #be185d; }
.ui-style-9 body { --primary-color: #b91c1c; }
.ui-style-10 body { --primary-color: #0369a1; }
.ui-style-11 body { --primary-color: #047857; }
.ui-style-12 body { --primary-color: #7c2d12; }
.ui-style-13 body { --primary-color: #4338ca; }
.ui-style-14 body { --primary-color: #0e7490; }
.ui-style-15 body { --primary-color: #be123c; }

.layout-A .grid { gap: 1rem; }
.layout-B .grid { gap: 1.5rem; }
.layout-C .grid { gap: 2rem; }
.layout-D main { max-width: 1000px; }
.layout-E main { max-width: 1400px; }
.layout-F .card { border-radius: 4px; }
.layout-G .card { border-radius: 12px; }
