:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1f1f1f;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --border-color: #2a2a2a;
  --accent: #ffffff;
  --link-color: #82b1ff;
  --success: #2ecc71;
  --warning: #f39c12;
  --transition: 0.3s ease;
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #ebebeb;
  --text-primary: #0a0a0a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --border-color: #e0e0e0;
  --accent: #0a0a0a;
  --link-color: #1a73e8;
  --success: #27ae60;
  --warning: #e67e22;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family:
    "Outfit",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition:
    background-color var(--transition),
    color var(--transition);
  line-height: 1.6;
}

header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--transition);
}

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

h1 {
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle-btn {
  width: 48px;
  height: 26px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 13px;
  cursor: pointer;
  position: relative;
  transition: all var(--transition);
}

.theme-toggle-btn::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--text-primary);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform var(--transition);
}

[data-theme="light"] .theme-toggle-btn::after {
  transform: translateX(22px);
}

.theme-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

main {
  flex: 1;
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 2rem 0;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 1.5rem;
  padding: 0 1.5rem;
}

.nav-section h3 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.nav-section a {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.4rem 0;
  font-size: 0.875rem;
  transition: color var(--transition);
}

.nav-section a:hover {
  color: var(--text-primary);
}

.content {
  flex: 1;
  padding: 3rem 4rem;
  max-width: 900px;
}

section {
  margin-bottom: 4rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

section:last-of-type {
  border-bottom: none;
}

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

h3 {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 1.5rem 0 0.75rem;
  color: var(--text-primary);
}

h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

ol,
ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

li {
  margin-bottom: 0.5rem;
}

strong {
  color: var(--text-primary);
}

.complexity-badge {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.complexity-badge span {
  background: var(--bg-tertiary);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: "SF Mono", "Consolas", monospace;
  color: var(--text-secondary);
}

.complexity-badge .time {
  border-left: 3px solid var(--success);
}

.complexity-badge .space {
  border-left: 3px solid var(--link-color);
}

.info-box {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--link-color);
  padding: 1rem 1.25rem;
  border-radius: 0 6px 6px 0;
  margin: 1rem 0;
}

.info-box.warning {
  border-left-color: var(--warning);
}

.info-box h4 {
  margin-bottom: 0.75rem;
}

.info-box ol {
  margin-bottom: 0;
}

.pros-cons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.pros,
.cons {
  background: var(--bg-tertiary);
  padding: 1.25rem;
  border-radius: 8px;
}

.pros h4 {
  color: var(--success);
}

.cons h4 {
  color: #e74c3c;
}

.pros ul,
.cons ul {
  list-style: none;
  margin-left: 0;
  margin-bottom: 0;
}

.pros li,
.cons li {
  padding-left: 1.25rem;
  position: relative;
}

.pros li::before {
  content: "OK";
  position: absolute;
  left: 0;
  color: var(--success);
}

.cons li::before {
  content: "X";
  position: absolute;
  left: 0;
  color: #e74c3c;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.feature-card {
  background: var(--bg-tertiary);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.feature-card h4 {
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.feature-card ul {
  margin-bottom: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--bg-tertiary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.data-table td {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.data-table tr:hover td {
  background: var(--bg-tertiary);
}

footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .content {
    padding: 2rem;
  }

  .pros-cons {
    grid-template-columns: 1fr;
  }
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.doc-version-switcher {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.2rem;
}

.doc-version-switcher .version-link {
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.doc-version-switcher .version-link:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.doc-version-switcher .version-link.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  font-weight: 600;
}

code {
  font-family: "SF Mono", "Consolas", "Courier New", monospace;
  background: var(--bg-tertiary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--link-color);
}

pre {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1rem 0;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.nav-section a.active {
  color: var(--text-primary);
  font-weight: 600;
}

.api-list {
  list-style: none;
  margin-left: 0;
}

.api-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border-color);
}

.api-list li:last-child {
  border-bottom: none;
}

@media (max-width: 900px) {
  .header-content {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .header-content h1 {
    order: -1;
    width: 100%;
    text-align: center;
  }

  .doc-version-switcher {
    order: 1;
    margin: 0 auto;
  }
}

@media (max-width: 600px) {
  .doc-version-switcher .version-link {
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
  }
}

.section-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--link-color);
  z-index: 200;
  transition: width 0.15s ease-out;
  border-radius: 0 2px 2px 0;
}

pre {
  position: relative;
}

pre .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-family: "Outfit", sans-serif;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.2s,
    background 0.2s,
    border-color 0.2s;
}

pre:hover .copy-btn {
  opacity: 1;
}

pre .copy-btn:hover {
  background: var(--bg-tertiary);
}

pre .copy-btn.copied {
  border-color: var(--success);
  color: var(--success);
}

@keyframes vt-slide-out {
  to {
    transform: translateX(-8%);
    opacity: 0;
  }
}

@keyframes vt-slide-in {
  from {
    transform: translateX(8%);
    opacity: 0;
  }
}

::view-transition-old(root) {
  animation: 0.3s cubic-bezier(0.4, 0, 0.2, 1) both vt-slide-out;
}

::view-transition-new(root) {
  animation: 0.3s cubic-bezier(0.4, 0, 0.2, 1) both vt-slide-in;
}
