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

:root {
  --bg: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-bg: #eff6ff;
  --pulse-color: rgba(37, 99, 235, 0.4);
}

.dark {
  --bg: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-bg: #172554;
  --pulse-color: rgba(59, 130, 246, 0.5);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  transition: background-color 0.3s, color 0.3s;
}

.app-container {
  display: flex;
  height: 100%;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  font-size: 1.25rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

#nav-chapters {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--primary-bg);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: center;
}

.control-select {
  flex: 1;
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 6px;
  outline: none;
  font-family: inherit;
}

.control-btn {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
}
.control-btn:hover { background-color: var(--bg-hover); }

/* Main Content */
#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mobile-header {
  display: none;
  padding: 16px 24px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 16px;
}

.content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tutorial-view {
  width: 100%;
  max-width: 900px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.tutorial-header h2 {
  font-size: 2rem;
  color: var(--text-main);
  margin-bottom: 8px;
}
.tutorial-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

/* Steps */
.step-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.step-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-number {
  background-color: var(--primary);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.step-desc {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Inline Screenshot Preview */
.screenshot-preview {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: transform 0.2s;
  background-color: var(--bg-hover);
}
.screenshot-preview:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}
.screenshot-preview img {
  width: 100%;
  display: block;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.lightbox.open { display: flex; }

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  z-index: 1001;
}

.screenshot-container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}
.screenshot-container img {
  max-width: 100%;
  max-height: 90vh;
  display: block;
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(0,0,0,0.3);
}

/* Pinpoint Markers */
.marker {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--primary);
  border: 3px solid white;
  box-shadow: 0 0 0 0 var(--pulse-color);
  animation: pulse 2s infinite;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 0.9rem;
  pointer-events: none;
  z-index: 10;
}

.marker::after {
  content: attr(data-label);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #1e293b;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  white-space: nowrap;
  margin-bottom: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.marker:hover::after, .marker.show-label::after {
  opacity: 1;
}

@keyframes pulse {
  0% { transform: translate(-50%, -50%) scale(0.95); box-shadow: 0 0 0 0 var(--pulse-color); }
  70% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 15px rgba(37,99,235, 0); }
  100% { transform: translate(-50%, -50%) scale(0.95); box-shadow: 0 0 0 0 rgba(37,99,235, 0); }
}

/* Navigation */
.tutorial-navigation {
  margin-top: 48px;
  width: 100%;
  max-width: 900px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.nav-btn {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: 0.2s;
}
.nav-btn:hover:not(:disabled) { background-color: var(--primary-hover); }
.nav-btn:disabled { background-color: var(--border); color: var(--text-muted); cursor: not-allowed; }

.step-indicator {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    z-index: 100;
    height: 100%;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-header { display: flex; }
  .content-wrapper { padding: 24px 16px; }
  .tutorial-navigation { flex-direction: column; gap: 16px; }
  .nav-btn { width: 100%; justify-content: center; }
}
