:root {
  --font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --bg-color: #0b0f19;
  --text-color: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #38bdf8;
  --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #ec4899 100%);
  --card-bg: rgba(30, 41, 59, 0.4);
  --card-border: rgba(148, 163, 184, 0.1);
  --card-hover: rgba(30, 41, 59, 0.6);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme="light"] {
  --bg-color: #f8fafc;
  --text-color: #0f172a;
  --text-secondary: #64748b;
  --accent-color: #0284c7;
  --accent-gradient: linear-gradient(135deg, #0284c7 0%, #4f46e5 50%, #db2777 100%);
  --card-bg: rgba(255, 255, 255, 0.8);
  --card-border: rgba(148, 163, 184, 0.2);
  --card-hover: rgba(255, 255, 255, 0.9);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) {
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --text-secondary: #64748b;
    --accent-color: #0284c7;
    --accent-gradient: linear-gradient(135deg, #0284c7 0%, #4f46e5 50%, #db2777 100%);
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-border: rgba(148, 163, 184, 0.2);
    --card-hover: rgba(255, 255, 255, 0.9);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  }
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 2rem;
  overflow-x: hidden;
  position: relative;
}

main {
  width: 100%;
  max-width: 65rem;
}

/* Background Animated Glows */
body::before, body::after {
  content: '';
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.3;
  animation: drift 20s infinite alternate;
}

body::before {
  background: #38bdf8;
  top: -100px;
  left: -100px;
}

body::after {
  background: #ec4899;
  bottom: -100px;
  right: -100px;
  animation-delay: -10s;
}

@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(100px, 100px) scale(1.1); }
}

header {
  text-align: center;
  max-width: 800px;
  margin-bottom: 5rem;
}

h1 {
  font-size: 4rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.h1-logo-icon {
  display: inline-block;
  width: min(50vw, 20rem);
  height: min(50vw, 20rem);
  vertical-align: middle;
  margin-right: 0.5rem;
  position: relative;

  img {
    width: 100%;
    height: 100%;
  }
}

html[data-theme="light"] .h1-logo-icon {
  .logo-light {
    display: inline-block;
  }

  .logo-dark {
    display: none;
  }
}

html[data-theme="dark"] .h1-logo-icon {
  .logo-light {
    display: none;
  }

  .logo-dark {
    display: inline-block;
  }
}

html[data-theme="system"] .h1-logo-icon {
  @media (prefers-color-scheme: light) {
    .logo-light {
      display: inline-block;
    }

    .logo-dark {
      display: none;
    }
  }
  @media (prefers-color-scheme: dark) {
    .logo-light {
      display: none;
    }

    .logo-dark {
      display: inline-block;
    }
  }
}

.description {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 650px;
  margin: 0 auto;
}

section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 3rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  width: 100%;
}

section :is(p, ul, ol) {
  margin: 1rem 0;
  &:first-child {
    margin-top: 0;
  }
  &:last-child {
    margin-bottom: 0;
  }
}

section h2 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  font-weight: 700;
  color: var(--text-color);
}

.toolkit-list {
  list-style-type: none;
  padding: 0;
}

.toolkit-list li {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.li-icon {
  width: 20px;
  height: 20px;
  color: var(--accent-color);
  flex-shrink: 0;
}

section a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
}

section a:hover,
section a:focus-visible {
  text-decoration: underline;
}

.install-section {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

.install-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: monospace;
  font-size: 1rem;
  color: var(--text-color);
  width: 100%;
  position: relative;
  margin: 1rem 0;
}

[data-theme="light"] .install-box {
  background: var(--bg-color) !important;
  color: #0f172a !important;
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  color: var(--text-color);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-color);
}

.copy-success {
  position: absolute;
  top: -2.5rem;
  right: 0;
  background: var(--accent-gradient);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translateY(10px); }
  20% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 3rem 0 1.5rem;
  color: var(--text-color);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2.5rem;
  width: 100%;
}

.card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 2.5rem;
  transition: var(--transition);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.card:hover, .card:focus-visible {
  transform: translateY(-10px);
  border-color: rgba(56, 189, 248, 0.4);
  background-color: var(--card-hover);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  outline: none; /* Hide default focus ring if we provide a custom lift */
}

.card-content {
  margin-bottom: 2rem;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-icon {
  width: 32px;
  height: 32px;
  color: var(--accent-color);
}

.card-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  margin-top: auto;
}

.card:hover .card-link, .card:focus-visible .card-link {
  gap: 1rem;
  color: var(--text-color);
}

.card-link span {
  font-size: 1.25rem;
  transition: var(--transition);
}

.theme-switcher {
  position: relative; /* Default inside flex containers (like sidebars) */
  display: flex;
  align-items: center;
  height: 40px;
  box-sizing: border-box;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 30px;
  padding: 0.25rem;
  backdrop-filter: blur(16px);
  z-index: 10;
}

body > .theme-switcher {
  position: fixed; /* Fixed to viewport on main page list view */
  top: 2rem;
  right: 2rem;
  z-index: 20;
}

.theme-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-btn:hover {
  color: var(--text-color);
}

.theme-btn.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

html[data-theme="light"] body::before {
  background: #7dd3fc;
  opacity: 0.2;
}

html[data-theme="light"] body::after {
  background: #fbcfe8;
  opacity: 0.2;
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) body::before {
    background: #7dd3fc;
    opacity: 0.2;
  }
  html:not([data-theme="dark"]) body::after {
    background: #fbcfe8;
    opacity: 0.2;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 3rem;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  body > .theme-switcher {
    position: static;
    margin: 1.5rem auto;
    width: max-content;
  }
}

/* Demo Shell Layout (Iframe Layout) */
.shell-container {
  display: flex;
  flex-direction: row;
  height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: var(--bg-color);
  color: var(--text-color);
}

.shell-main {
  flex: 1;
  height: 100%;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shell-nav-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  z-index: 10;
}

[data-theme="light"] .shell-nav-bar {
  background: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="dark"] .shell-nav-bar {
  background: rgba(255, 255, 255, 0.08) !important;
}

.shell-nav-bar button {
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  color: var(--text-color);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition);
}

.shell-nav-bar button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.shell-nav-bar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.shell-url-bar {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  display: flex;
  align-items: center;
  color: var(--text-color);
  font-family: monospace;
  font-size: 0.85rem;
}

[data-theme="light"] .shell-url-bar {
  background: #ffffff !important;
}

[data-theme="dark"] .shell-url-bar {
  background: rgba(255, 255, 255, 0.15) !important;
}

.shell-frame {
  display: flex !important;
  flex-direction: column !important;
  width: 100%;
  height: 100%;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.shell-frame iframe {
  width: 100%;
  flex: 1 !important;
  border: none;
  background: #ffffff !important;
}

.shell-sidebar {
  width: 50vw;
  max-width: 800px;
  height: 100%;
  background: var(--card-bg);
  border-left: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  padding: 2rem;
  gap: 2rem;
  overflow-y: auto;
}

.shell-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 15;
  margin-top: -1.5rem;
  margin-bottom: 1.5rem;
}

.shell-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 30px;
  padding: 0 1rem;
  height: 40px;
  box-sizing: border-box;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  backdrop-filter: blur(16px);
}

.shell-back:hover {
  color: var(--text-color);
}

.shell-explanation {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.shell-explanation h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
}

.shell-explanation p {
  color: var(--text-secondary);
  line-height: 1.6;
}

.shell-explanation a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
}

.shell-explanation a:hover,
.shell-explanation a:focus-visible {
  text-decoration: underline;
}

/* Code Blocks Styling */
pre {
  background: var(--card-bg) !important;
  border: 1px solid var(--card-border) !important;
  border-radius: 12px !important;
  padding: 1.25rem !important;
  overflow-x: auto !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
  font-size: 0.85rem !important;
  line-height: 1.5 !important;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

code {
  color: var(--text-color) !important;
}

.shell-sidebar h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
  margin-top: 1rem;
}

.shell-sidebar hr {
  border: 0;
  border-top: 1px solid var(--card-border);
  margin: 1.5rem 0;
}

.shell-footer.mobile-only {
  display: none;
}

.demo-footer, .shell-footer {
  margin-top: 5rem;
  padding: 2rem 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  opacity: 0.7;
}

.demo-footer a, .shell-footer a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
}

.demo-footer a:hover, .shell-footer a:hover {
  text-decoration: underline;
}

/* Responsive Layout for Demo Shells (Viewport < 1130px) */
@media (max-width: 1129px) {
  .shell-container {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    overflow-y: auto !important;
  }

  .shell-sidebar {
    order: 1 !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    border-left: none !important;
    border-bottom: 1px solid var(--card-border) !important;
    padding: 2rem !important;
  }

  .shell-main {
    order: 2 !important;
    width: 100% !important;
    height: 70vh !important;
    padding: 1.5rem !important;
    flex: none !important;
  }

  .shell-footer.mobile-only {
    order: 3 !important;
    display: block !important;
    margin-top: 2rem;
  }

  .desktop-only {
    display: none !important;
  }
}


