/* ==========================================================================
   MONKEY TYPE PRO - CORE DESIGN SYSTEM & GLOBAL STYLES
   Minimalist, ultra-responsive, high-performance CSS
   ========================================================================== */

:root {
  /* Default Theme: Serika Dark (Brightened) */
  --bg-color: #36393e;
  --bg-secondary: #2f3237;
  --bg-card: #2b2d32;
  --main-color: #f5c518;
  --main-color-dim: rgba(245, 197, 24, 0.18);
  --caret-color: #f5c518;
  --sub-color: #94979e;
  --sub-alt-color: #303338;
  --text-color: #f3f3ee;
  --error-color: #ff5263;
  --error-extra-color: #9c2738;
  --border-color: rgba(255, 255, 255, 0.12);
  --font-mono: 'Fira Code', monospace;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Serika Dark Theme */
[data-theme="serika-dark"],
[data-theme="dark"] {
  --bg-color: #36393e;
  --bg-secondary: #2f3237;
  --bg-card: #2b2d32;
  --main-color: #f5c518;
  --main-color-dim: rgba(245, 197, 24, 0.18);
  --caret-color: #f5c518;
  --sub-color: #94979e;
  --sub-alt-color: #303338;
  --text-color: #f3f3ee;
  --error-color: #ff5263;
  --error-extra-color: #9c2738;
  --border-color: rgba(255, 255, 255, 0.12);
}

/* Light Theme */
[data-theme="light"] {
  --bg-color: #f6f8fb;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --main-color: #d97706;
  --main-color-dim: rgba(217, 119, 6, 0.14);
  --caret-color: #d97706;
  --sub-color: #4f5d73;
  --sub-alt-color: #cbd5e1;
  --text-color: #0f172a;
  --error-color: #ef4444;
  --error-extra-color: #991b1b;
  --border-color: rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
}

/* Alternate Themes */
[data-theme="cyber-neon"] {
  --bg-color: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: #162032;
  --main-color: #00f0ff;
  --main-color-dim: rgba(0, 240, 255, 0.15);
  --caret-color: #00f0ff;
  --sub-color: #6b7c96;
  --sub-alt-color: #1f2937;
  --text-color: #f1f5f9;
  --error-color: #ff0055;
  --error-extra-color: #990033;
  --border-color: rgba(0, 240, 255, 0.15);
}

[data-theme="dracula"] {
  --bg-color: #282a36;
  --bg-secondary: #21222c;
  --bg-card: #1e1f29;
  --main-color: #bd93f9;
  --main-color-dim: rgba(189, 147, 249, 0.15);
  --caret-color: #50fa7b;
  --sub-color: #8a99c7;
  --sub-alt-color: #343746;
  --text-color: #f8f8f2;
  --error-color: #ff5555;
  --error-extra-color: #aa2222;
  --border-color: rgba(189, 147, 249, 0.15);
}

[data-theme="carbon"] {
  --bg-color: #161616;
  --bg-secondary: #1e1e1e;
  --bg-card: #222222;
  --main-color: #f36b21;
  --main-color-dim: rgba(243, 107, 33, 0.15);
  --caret-color: #f36b21;
  --sub-color: #888888;
  --sub-alt-color: #2a2a2a;
  --text-color: #f0f0f0;
  --error-color: #e53935;
  --error-extra-color: #8b1816;
  --border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="nord"] {
  --bg-color: #2e3440;
  --bg-secondary: #272c36;
  --bg-card: #232832;
  --main-color: #88c0d0;
  --main-color-dim: rgba(136, 192, 208, 0.15);
  --caret-color: #88c0d0;
  --sub-color: #8b9bb4;
  --sub-alt-color: #3b4252;
  --text-color: #eceff4;
  --error-color: #bf616a;
  --error-extra-color: #793b42;
  --border-color: rgba(136, 192, 208, 0.15);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
  overscroll-behavior-x: none;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main {
  width: 100%;
  max-width: 100%;
  flex: 1 0 auto;
  box-sizing: border-box;
}

a {
  color: var(--main-color);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  filter: brightness(1.2);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  box-sizing: border-box;
}

/* ==========================================================================
   HEADER & NAVBAR
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(44, 46, 49, 0.85);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

[data-theme="cyber-neon"] .site-header {
  background: rgba(11, 15, 25, 0.85);
}
[data-theme="dracula"] .site-header {
  background: rgba(40, 42, 54, 0.85);
}
[data-theme="carbon"] .site-header {
  background: rgba(22, 22, 22, 0.85);
}
[data-theme="nord"] .site-header {
  background: rgba(46, 52, 64, 0.85);
}
[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, 0.88);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-color);
}

.brand-logo svg {
  width: 28px;
  height: 28px;
  fill: var(--main-color);
  transition: transform 0.2s ease;
}

.brand-logo:hover svg {
  transform: rotate(-10deg) scale(1.1);
}

.brand-logo span.accent {
  color: var(--main-color);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-link {
  color: var(--sub-color);
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-color);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--main-color);
  border-radius: 2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--sub-color);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--main-color);
  border-color: var(--main-color);
  transform: translateY(-1px);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Theme Dropdown */
.theme-picker-wrapper {
  position: relative;
}

.theme-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  min-width: 160px;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 200;
}

.theme-dropdown.show {
  display: flex;
  animation: fadeIn 0.15s ease-out;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--sub-color);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-align: left;
}

.theme-option:hover,
.theme-option.active {
  color: var(--text-color);
  background: var(--bg-card);
}

.theme-preview-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Mobile Menu Toggle */
.mobile-toggle {
  display: none;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  margin-top: auto;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 3rem 0 1.5rem;
  font-size: 0.9rem;
  width: 100%;
  position: relative;
  z-index: 10;
  box-sizing: border-box;
  display: block;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-col h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.footer-col p {
  color: var(--sub-color);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-col ul a {
  color: var(--sub-color);
  font-size: 0.88rem;
}

.footer-col ul a:hover {
  color: var(--main-color);
  padding-left: 4px;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  color: var(--sub-color);
  font-size: 0.82rem;
}

.footer-badges {
  display: flex;
  gap: 0.5rem;
}

.badge {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--sub-color);
}

/* ==========================================================================
   ANIMATIONS & KEYFRAMES
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* ==========================================================================
   PERFORMANCE & SEO OPTIMIZATIONS
   ========================================================================== */
.site-footer {
  content-visibility: visible;
  opacity: 1;
  visibility: visible;
}

button, a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ==========================================================================
   RESPONSIVE DESIGN (ALL SCREENS: 320px to 4K)
   ========================================================================== */
@media (max-width: 992px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 1.25rem;
  }

  .nav-container {
    height: 60px;
  }

  .brand-logo {
    font-size: 1.25rem;
    gap: 0.5rem;
  }

  .brand-logo svg {
    width: 24px;
    height: 24px;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 1rem 1.25rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    z-index: 1000;
  }

  .nav-links.show {
    display: flex;
    animation: fadeIn 0.2s ease-out;
  }

  .nav-link {
    padding: 0.7rem 0.85rem;
    font-size: 1rem;
    width: 100%;
    border-radius: var(--radius-sm);
  }

  .nav-link:hover, 
  .nav-link.active {
    background: var(--bg-card);
  }

  .nav-link.active::after {
    display: none;
  }

  .mobile-toggle {
    display: inline-flex;
  }

  .theme-dropdown {
    max-width: min(220px, calc(100vw - 2rem));
    right: 0;
  }
}

@media (max-width: 580px) {
  .container {
    padding: 0 1rem;
  }

  .brand-logo {
    font-size: 1.15rem;
  }

  .brand-logo svg {
    width: 22px;
    height: 22px;
  }

  .nav-actions {
    gap: 0.5rem;
  }

  .btn-icon {
    width: 34px;
    height: 34px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .site-footer {
    padding: 2.5rem 0 1.25rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .footer-badges {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

@media (max-width: 360px) {
  .brand-logo span {
    font-size: 1.05rem;
  }
}
