/* Light mode (default) */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-dim: #f1f3f5;
  --border: #dfe3e8;
  --text: #1a1f2b;
  --text-secondary: #3b4252;
  --text-muted: #6e7a8a;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --error: #ef4444;
  --input-bg: #f1f3f5;
}

/* Dark mode */
html.dark {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-dim: #1a1a1a;
  --border: #262626;
  --text: #fafafa;
  --text-secondary: #d4d4d8;
  --text-muted: #a1a1aa;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --error: #ef4444;
  --input-bg: #0a0a0a;
}

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

.site-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

input:focus {
  border-color: var(--accent);
}

button {
  width: 100%;
  padding: 0.75rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: background 0.2s;
}

button:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.error-msg {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  display: none;
}

.error-msg.visible { display: block; }

/* Video player */
.video-container {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

video {
  width: 100%;
  display: block;
}

.video-title {
  margin-top: 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.video-title__sub {
  font-size: 0.85em;
  font-weight: 400;
  color: var(--text-muted);
}

.video-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.video-link {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.video-link a {
  color: var(--accent);
  text-decoration: none;
}

.video-link a:hover {
  text-decoration: underline;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.site-header__logo {
  height: 36px;
  width: 36px;
  border-radius: 8px;
}

.site-header__title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--text);
}

.site-header__subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-header__actions a {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.site-header__actions a:hover {
  color: var(--text);
  background: var(--surface-dim);
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--surface-dim);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  color: var(--text-muted);
  padding: 0;
  margin: 0;
}

.theme-toggle:hover {
  background: var(--border);
  color: var(--text);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* Sidebar Navigation */
.site-nav {
  position: fixed;
  top: 64px;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 90;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s ease, width 0.25s ease;
  overflow-y: auto;
}

.site-nav.open {
  transform: translateX(0);
}

.site-nav.collapsed {
  width: 56px;
}

.site-nav__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.site-nav__title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.site-nav.collapsed .site-nav__title {
  display: none;
}

.site-nav__controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  margin: 0;
  transition: all 0.15s;
}

.nav-ctrl-btn:hover {
  background: var(--surface-dim);
  color: var(--text);
}

.nav-ctrl-btn svg {
  width: 16px;
  height: 16px;
}

.site-nav__section {
  padding: 0.5rem 0;
}

.site-nav__section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.5rem 1rem 0.35rem;
}

.site-nav.collapsed .site-nav__section-label {
  display: none;
}

.site-nav__link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
}

.site-nav__link:hover {
  background: var(--surface-dim);
  color: var(--text);
}

.site-nav__link.active {
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.site-nav__link-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  font-size: 0.9rem;
}

.site-nav__link-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-nav.collapsed .site-nav__link-text {
  display: none;
}

.site-nav.collapsed .site-nav__link {
  justify-content: center;
  padding: 0.6rem;
}

/* Overlay behind sidebar on mobile */
.site-nav-overlay {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 89;
}

.site-nav-overlay.visible {
  display: block;
}

/* Hamburger button in header */
.nav-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--surface-dim);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  margin: 0;
  transition: all 0.15s;
}

.nav-toggle-btn:hover {
  background: var(--border);
  color: var(--text);
}

.nav-toggle-btn svg {
  width: 18px;
  height: 18px;
}

/* Body shift when sidebar open on desktop */
@media (min-width: 769px) {
  body.nav-open .site-main {
    margin-left: 260px;
    transition: margin-left 0.25s ease;
  }

  body.nav-open.nav-collapsed .site-main {
    margin-left: 56px;
  }

  body .site-main {
    transition: margin-left 0.25s ease;
  }
}

@media (max-width: 768px) {
  .site-nav {
    top: 56px;
    width: 280px;
  }

  .site-nav.collapsed {
    width: 280px;
  }

  .site-nav.collapsed .site-nav__title,
  .site-nav.collapsed .site-nav__section-label,
  .site-nav.collapsed .site-nav__link-text {
    display: block;
  }

  .site-nav.collapsed .site-nav__link {
    justify-content: flex-start;
    padding: 0.5rem 1rem;
  }

  .site-nav-overlay.visible {
    top: 56px;
  }
}

/* Footer */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--surface);
  flex-shrink: 0;
}

.site-footer__left,
.site-footer__center,
.site-footer__right {
  flex: 1;
}

.site-footer__left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-footer__logo {
  height: 16px;
  width: 16px;
  border-radius: 3px;
  opacity: 0.6;
}

.site-footer__center {
  text-align: center;
}

.site-footer__right {
  text-align: right;
}

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

.site-footer__right a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .site-header {
    padding: 0 1rem;
    height: 56px;
  }

  .site-header__subtitle {
    display: none;
  }

  .site-header__actions a {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
  }

  .container {
    padding: 1.25rem 1rem;
  }

  .card {
    padding: 1.5rem;
  }

  h1 {
    font-size: 1.25rem;
  }

  .video-title {
    font-size: 1.1rem;
  }

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

  .site-footer__right {
    text-align: center;
  }
}

/* Guide cards */
.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.guide-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.1);
}

.guide-card__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.guide-card__desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.guide-card__tag {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* Guide content */
.guide-content {
  line-height: 1.7;
  color: var(--text-secondary);
}

.guide-content h1 { font-size: 1.5rem; margin: 2rem 0 0.5rem; color: var(--text); }
.guide-content h2 { font-size: 1.25rem; margin: 2rem 0 0.75rem; color: var(--text); padding-top: 1rem; border-top: 1px solid var(--border); }
.guide-content h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; color: var(--text); }
.guide-content p { margin: 0.75rem 0; }
.guide-content ul, .guide-content ol { margin: 0.75rem 0; padding-left: 1.5rem; }
.guide-content li { margin: 0.35rem 0; }
.guide-content code { background: var(--surface-dim); padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.9em; }
.guide-content pre { background: var(--surface-dim); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; overflow-x: auto; margin: 1rem 0; }
.guide-content pre code { background: none; padding: 0; }
.guide-content blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; margin: 1rem 0; color: var(--text-muted); }
.guide-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; }
.guide-content th, .guide-content td { padding: 0.5rem 0.75rem; border: 1px solid var(--border); text-align: left; }
.guide-content th { background: var(--surface-dim); font-weight: 600; color: var(--text); }
.guide-content a { color: var(--accent); text-decoration: none; }
.guide-content a:hover { text-decoration: underline; }
.guide-content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

@media (max-width: 768px) {
  .guide-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .site-header__logo {
    height: 28px;
    width: 28px;
  }

  .site-header__title {
    font-size: 0.9rem;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
  }

  .card {
    padding: 1.25rem;
  }
}
