:root {
  --bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #b91c1c;
  --primary-dark: #991b1b;
  --primary-soft: #fef2f2;
  --yt: #ff0000;
  --yt-dark: #cc0000;
  --yt-soft: #fef2f2;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.page {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 8px 10px 14px;
}

.hero {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.hero-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 8px;
}

.hero-text {
  min-width: 0;
}

.hero h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  color: #111827;
}

.hero p {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.35;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.tab svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.tab:hover {
  border-color: #fca5a5;
  color: var(--primary);
}

.tab.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.tab.is-active svg {
  stroke: #fff;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  margin-bottom: 8px;
}

.search-wrap {
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

#searchTutorial {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px 7px 30px;
  font: inherit;
  font-size: 0.8125rem;
  color: inherit;
  background: #fff;
}

#searchTutorial:focus {
  outline: none;
  border-color: #fca5a5;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

.btn-tool {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.btn-tool:hover {
  border-color: #fca5a5;
  color: var(--primary);
}

.section-block.is-hidden {
  display: none;
}

.section-block + .section-block {
  margin-top: 10px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-label svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.tutorial {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 6px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tutorial:hover {
  border-color: #d1d5db;
}

.tutorial[open] {
  border-color: #fecaca;
  box-shadow: 0 2px 8px rgba(185, 28, 28, 0.06);
}

.tutorial.is-hidden {
  display: none;
}

.tutorial > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  user-select: none;
}

.tutorial > summary::-webkit-details-marker {
  display: none;
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.summary-chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 0.2s;
}

.tutorial[open] .summary-chevron {
  transform: rotate(90deg);
  color: var(--primary);
}

.summary-title {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  color: #111827;
}

.summary-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.badge-meta {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-soft);
  padding: 3px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.btn-yt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--yt);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

.btn-yt svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-yt:hover {
  background: var(--yt-dark);
}

.btn-yt:active {
  transform: scale(0.97);
}

.tutorial-body {
  padding: 0 10px 10px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #374151;
}

.tutorial-body p,
.tutorial-body li {
  margin: 8px 0 0;
  font-size: inherit;
  line-height: inherit;
}

.tutorial-body p:first-child,
.tutorial-body ol:first-child,
.tutorial-body ul:first-child {
  margin-top: 8px;
}

.tutorial-body ol,
.tutorial-body ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.tutorial-body li {
  margin-top: 4px;
}

.tutorial-body a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.tutorial-body a:hover {
  text-decoration: underline;
}

.tutorial-body .subheading {
  margin-top: 10px;
  font-size: inherit;
  font-weight: 700;
  color: #111827;
}

.tutorial-body .block-label {
  margin-top: 10px;
  margin-bottom: 2px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.tutorial-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.tutorial-body a.btn-yt-full,
.tutorial-body a.btn-yt-full:hover,
.tutorial-body a.btn-yt-full:focus,
.tutorial-body a.btn-yt-full:active,
.tutorial-body a.btn-yt-full:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--yt);
  color: #ffffff;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
}

.tutorial-body a.btn-yt-full:hover,
.tutorial-body a.btn-yt-full:focus {
  background: var(--yt-dark);
  color: #ffffff;
}

.tutorial-body a.btn-yt-full svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: #ffffff;
  color: #ffffff;
}

.empty-state {
  display: none;
  text-align: center;
  padding: 20px 12px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.empty-state.is-visible {
  display: block;
}

.empty-state svg {
  width: 32px;
  height: 32px;
  margin-bottom: 6px;
  opacity: 0.5;
}

@media (max-width: 640px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .summary-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  .btn-yt .yt-short {
    display: none;
  }
}

@media (max-height: 700px) {
  .page {
    padding: 6px 8px 10px;
  }

  .tutorial > summary {
    padding: 6px 8px;
  }

  .tutorial-body {
    padding: 0 8px 8px;
  }
}
