/* EcoZen RPG - Official Wiki Stylesheet */
:root {
  --bg-main: #080c14;
  --bg-sidebar: #0d1322;
  --bg-card: #111827;
  --bg-card-hover: #172238;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(16, 185, 129, 0.5);
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-glow: rgba(16, 185, 129, 0.2);
  --gold: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.25);
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --header-height: 64px;
  --sidebar-width: 320px;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

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

a:hover {
  color: #34d399;
}

/* NAVBAR HEADER */
.wiki-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(13, 19, 34, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-toggle-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.brand-text {
  background: linear-gradient(135deg, #ffffff 40%, #a7f3d0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.wiki-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-center {
  flex: 1;
  max-width: 500px;
  margin: 0 1.5rem;
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.85rem;
  transition: all 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: #111827;
}

.search-icon {
  color: var(--text-muted);
  margin-right: 0.5rem;
  font-size: 0.95rem;
}

.search-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  width: 100%;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-kbd {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* SEARCH DROPDOWN */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  max-height: 420px;
  overflow-y: auto;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  z-index: 200;
  display: none;
}

.search-results.open {
  display: block;
}

.search-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-item:hover {
  background: var(--bg-card-hover);
}

.search-item-cat {
  font-size: 0.75rem;
  color: var(--primary);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.search-item-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.search-item-snippet {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lang-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.play-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.play-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  color: #fff;
}

/* LAYOUT CONTAINER */
.wiki-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
  max-width: 1600px;
  margin: 0 auto;
}

/* SIDEBAR ACCORDION */
.wiki-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
  padding: 1.25rem 0.85rem;
}

.wiki-sidebar::-webkit-scrollbar {
  width: 6px;
}
.wiki-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.category-group {
  margin-bottom: 0.65rem;
}

.category-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.category-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.category-header.active-cat {
  color: var(--primary);
}

.category-title-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.cat-chevron {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.category-group.expanded .cat-chevron {
  transform: rotate(90deg);
}

.article-list {
  display: none;
  list-style: none;
  padding: 0.3rem 0 0.3rem 1.6rem;
}

.category-group.expanded .article-list {
  display: block;
}

.article-link {
  display: block;
  padding: 0.4rem 0.65rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.15rem;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
}

.article-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.article-link.active {
  color: var(--primary);
  font-weight: 600;
  background: rgba(16, 185, 129, 0.08);
  border-left-color: var(--primary);
}

/* MAIN CONTENT AREA */
.wiki-main {
  flex: 1;
  padding: 2.5rem 3.5rem;
  max-width: 1080px;
  overflow-x: hidden;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.breadcrumbs span.separator {
  color: rgba(255, 255, 255, 0.2);
}

.breadcrumbs a {
  color: var(--text-secondary);
}
.breadcrumbs a:hover {
  color: var(--primary);
}

.article-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
}

.article-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--primary);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-weight: 600;
  margin-bottom: 0.85rem;
}

.article-title {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.85rem;
  background: linear-gradient(135deg, #ffffff 40%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.article-lead {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* CONTENT ELEMENTS */
.article-content {
  font-size: 1rem;
  color: #e5e7eb;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  color: #ffffff;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.85rem;
  letter-spacing: -0.015em;
}

.article-content h2 {
  font-size: 1.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.5rem;
}

.article-content h3 {
  font-size: 1.25rem;
}

.article-content p {
  margin-bottom: 1.2rem;
}

.article-content ul,
.article-content ol {
  margin-left: 1.4rem;
  margin-bottom: 1.4rem;
}

.article-content li {
  margin-bottom: 0.45rem;
}

.wiki-hero {
  background: radial-gradient(circle at top, rgba(16, 185, 129, 0.12) 0%, rgba(13, 19, 34, 0) 70%);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  text-align: center;
}

.wiki-hero h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.wiki-hero .subtitle {
  color: var(--primary);
  font-weight: 600;
  font-size: 1rem;
}

/* CALLOUTS */
.callout {
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  margin: 1.5rem 0;
  border-left: 4px solid;
}

.callout-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.callout-info {
  background: rgba(59, 130, 246, 0.08);
  border-left-color: #3b82f6;
  color: #bfdbfe;
}
.callout-info .callout-title { color: #60a5fa; }

.callout-warning {
  background: rgba(245, 158, 11, 0.08);
  border-left-color: #f59e0b;
  color: #fde68a;
}
.callout-warning .callout-title { color: #fbbf24; }

.callout-success {
  background: rgba(16, 185, 129, 0.08);
  border-left-color: #10b981;
  color: #a7f3d0;
}
.callout-success .callout-title { color: #34d399; }

/* TABLES */
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.wiki-table th,
.wiki-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.wiki-table th {
  background: #162033;
  color: #f3f4f6;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wiki-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* CARDS & GRIDS */
.steps-grid,
.skills-category-grid,
.tiers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.step-card,
.skill-cat-card,
.tier-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.step-card:hover,
.skill-cat-card:hover,
.tier-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #000;
  font-weight: 800;
  border-radius: 50%;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.tier-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 16px var(--primary-glow);
}

.tier-card.royal {
  border-color: var(--gold);
  box-shadow: 0 0 16px var(--gold-glow);
}

.code-block {
  background: #0b0f19;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  color: #38bdf8;
  margin: 1rem 0;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.faq-item h4 {
  color: #ffffff;
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.wiki-btn {
  display: inline-flex;
  align-items: center;
  background: var(--primary);
  color: #000000;
  font-weight: 700;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  margin: 0.5rem 0;
  transition: all 0.2s ease;
}

.wiki-btn:hover {
  background: #34d399;
  color: #000000;
}

/* FOOTER ARTICLE NAVIGATION */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.nav-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
}

.nav-card:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.nav-card.next {
  text-align: right;
  align-items: flex-end;
}

.nav-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.nav-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* BACK TO TOP */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
  opacity: 0;
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
  .wiki-main {
    padding: 2rem 2rem;
  }
}

@media (max-width: 768px) {
  .mobile-toggle-btn {
    display: block;
  }

  .header-center {
    display: none;
  }

  .wiki-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 290px;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.7);
  }

  .wiki-sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 140;
  }

  .sidebar-backdrop.open {
    display: block;
  }

  .wiki-main {
    padding: 1.5rem 1rem;
  }

  .article-title {
    font-size: 1.8rem;
  }

  .article-nav {
    flex-direction: column;
  }

  .nav-card.next {
    text-align: left;
    align-items: flex-start;
  }
}
