/* ===== Cultivate Docs - Dark Theme ===== */
/* Color scheme from hmk.delien.xyz */
/* Background: #0a0a0f, Accent: #00e5ff, Text: #e0e0e0 */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --bg-sidebar: #0d0d14;
  --text-primary: #e0e0e0;
  --text-secondary: #8888aa;
  --text-muted: #555577;
  --accent: #00e5ff;
  --accent-dim: rgba(0, 229, 255, 0.15);
  --accent-glow: rgba(0, 229, 255, 0.5);
  --border: #1e1e2e;
  --border-accent: #00e5ff;
  --font-sans: 'Noto Sans JP', 'Segoe UI', sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;
  --radius: 8px;
  --sidebar-width: 280px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.8;
  min-height: 100vh;
  display: flex;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ===== Links ===== */
a {
  color: var(--accent);
  text-decoration: none;
  transition: all 0.3s;
}
a:hover {
  text-shadow: 0 0 8px var(--accent-glow);
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 100;
  padding: 0;
}

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

.sidebar-header .logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
  letter-spacing: 1px;
}

.sidebar-header .logo-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.sidebar-nav {
  padding: 12px 0;
}

.sidebar-nav .nav-section {
  padding: 8px 20px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.sidebar-nav a:hover {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.sidebar-nav a.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.sidebar-nav a .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

/* ===== Main Content ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: 0;
  overflow-x: hidden;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar .page-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar .topbar-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.topbar .topbar-links a {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.topbar .topbar-links a:hover {
  color: var(--accent);
}

/* Content wrapper */
.content {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 40px 80px;
}

/* ===== Typography ===== */
h1 {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
  border-left: 4px solid var(--accent);
  padding-left: 16px;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 48px;
  margin-bottom: 12px;
  color: var(--accent);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}

li {
  margin-bottom: 6px;
}

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

code {
  font-family: var(--font-mono);
  background: var(--bg-card);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.88em;
  border: 1px solid var(--border);
}

pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  overflow-x: auto;
}

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

blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin-bottom: 20px;
  background: var(--accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
}

blockquote p {
  margin-bottom: 0;
  color: var(--text-primary);
}

/* ===== Cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(0, 229, 255, 0.08), transparent);
  opacity: 0;
  transition: 0.4s;
  pointer-events: none;
}

.card:hover::before {
  opacity: 1;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-dim);
}

.card h3 {
  margin-top: 0;
  font-size: 1.05rem;
}

.card p {
  font-size: 0.9rem;
  margin-bottom: 0;
}

.card a {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.9rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--accent);
  color: #000;
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn:hover {
  box-shadow: 0 0 15px var(--accent-glow);
  color: #000;
  text-shadow: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent-dim);
  box-shadow: 0 0 10px var(--accent-dim);
}

/* ===== Tables ===== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 100%;
}

.table-wrapper table {
  margin-bottom: 0;
}

.table-wrapper::-webkit-scrollbar {
  height: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-card);
  color: var(--accent);
  font-weight: 600;
}

th code, td code {
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(0, 229, 255, 0.03);
}

/* ===== Tags ===== */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-admin {
  background: #ff4444;
  color: #fff;
}

.tag-user {
  background: var(--accent);
  color: #000;
}

.tag-info {
  background: #4444ff;
  color: #fff;
}

.tag-wip {
  background: #ffaa00;
  color: #000;
}

/* ===== Alert boxes ===== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  border-left: 4px solid;
}

.alert-info {
  background: rgba(0, 229, 255, 0.1);
  border-color: var(--accent);
}

.alert-warning {
  background: rgba(255, 170, 0, 0.1);
  border-color: #ffaa00;
}

.alert-danger {
  background: rgba(255, 68, 68, 0.1);
  border-color: #ff4444;
}

.alert p {
  margin-bottom: 0;
}

/* ===== Feature hero ===== */
.feature-hero {
  text-align: center;
  padding: 60px 20px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.feature-hero .feature-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.feature-hero h1 {
  border-left: none;
  padding-left: 0;
  text-align: center;
}

.feature-hero p {
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== Steps / Instructions ===== */
.steps {
  counter-reset: step-counter;
  list-style: none;
  padding: 0;
}

.steps li {
  counter-increment: step-counter;
  padding: 16px 20px 16px 56px;
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.steps li::before {
  content: counter(step-counter);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.steps li strong {
  display: block;
  margin-bottom: 4px;
}

.steps li ul {
  margin-bottom: 0;
  margin-top: 8px;
  padding-left: 16px;
  color: var(--text-primary);
}

.steps li ul li {
  background: none;
  border: none;
  padding: 2px 0;
  margin-bottom: 2px;
}

.steps li ul li::before {
  display: none;
}

.steps li ul li strong {
  display: inline;
  margin-bottom: 0;
}

/* ===== Command block ===== */
.command-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.command-block .cmd-name {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 600;
}

.command-block .cmd-desc {
  color: var(--text-secondary);
  margin-top: 4px;
  font-size: 0.9rem;
}

.command-block .cmd-meta {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer a {
  color: var(--text-secondary);
}

.footer a:hover {
  color: var(--accent);
}

/* ===== Mobile menu button ===== */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 1.3rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 90;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu-overlay.show {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .content {
    padding: 20px 20px 60px;
  }

  .topbar {
    padding: 12px 20px 12px 60px;
  }

  h1 {
    font-size: 1.6rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  /* ===== Responsive Tables ===== */
  /* 2列テーブル → カード型縦リスト */
  .table-wrapper:has(thead th:first-child:nth-last-child(2)) {
    border: none;
    background: transparent;
    overflow: visible;
  }

  .table-wrapper:has(thead th:first-child:nth-last-child(2)) table {
    width: 100%;
  }

  .table-wrapper:has(thead th:first-child:nth-last-child(2)) thead {
    display: none;
  }

  .table-wrapper:has(thead th:first-child:nth-last-child(2)) tbody,
  .table-wrapper:has(thead th:first-child:nth-last-child(2)) tbody tr {
    display: block;
  }

  .table-wrapper:has(thead th:first-child:nth-last-child(2)) tbody tr {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 10px;
  }

  .table-wrapper:has(thead th:first-child:nth-last-child(2))
    tbody tr:last-child {
    margin-bottom: 0;
  }

  .table-wrapper:has(thead th:first-child:nth-last-child(2)) tbody td {
    display: block;
    padding: 4px 0;
    border-bottom: none;
  }

  .table-wrapper:has(thead th:first-child:nth-last-child(2))
    tbody td:first-child {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.8rem;
    padding-bottom: 0;
  }

  .table-wrapper:has(thead th:first-child:nth-last-child(2))
    tbody td:last-child {
    color: var(--text-secondary);
    padding-top: 0;
  }

  .table-wrapper:has(thead th:first-child:nth-last-child(2))
    tbody tr:hover td {
    background: transparent;
  }

  /* 3列以上のテーブル → 横スクロール */
  .table-wrapper:not(
    :has(thead th:first-child:nth-last-child(2))
  ):not(
    :has(thead th:first-child:nth-last-child(1))
  ) table {
    min-width: 520px;
  }
}

/* ===== Update / Changelog page ===== */
.update-version {
  text-align: center;
  margin-bottom: 32px;
}

.version-badge {
  display: inline-block;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 16px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.version-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 8px;
}

.update-card {
  display: flex;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  transition: border-color 0.3s;
}

.update-card:hover {
  border-color: var(--accent);
}

.update-card .update-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  width: 44px;
  text-align: center;
  padding-top: 2px;
}

.update-card .update-body {
  flex: 1;
  min-width: 0;
}

.update-card .update-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.update-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.update-card ul li {
  position: relative;
  padding: 4px 0 4px 20px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
}

.update-card ul li::before {
  content: '•';
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: 700;
}

.update-card ul li code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-secondary);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent);
  border: 1px solid var(--border);
}

.tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

.tag-feature {
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.tag-bug {
  background: rgba(255, 82, 82, 0.15);
  color: #ff5252;
  border: 1px solid rgba(255, 82, 82, 0.3);
}

.tag-rank {
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.tag-profile {
  background: rgba(0, 200, 117, 0.15);
  color: #00c875;
  border: 1px solid rgba(0, 200, 117, 0.3);
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 4px;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-tag.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.filter-tag.active .tag {
  background: transparent;
  border: none;
  padding: 0;
}

.update-card.hidden-by-filter {
  display: none;
}

/* ===== Update date badge ===== */
.update-date {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
}

.legend-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.legend-box strong {
  color: var(--text-primary);
  margin-right: 4px;
}

/* ===== Growth Chart ===== */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 24px 0 32px;
  position: relative;
  overflow: hidden;
}

.chart-container canvas {
  display: block;
  width: 100%;
  height: 500px !important;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 16px;
  justify-content: center;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.chart-legend-line {
  width: 24px;
  height: 3px;
  border-radius: 2px;
}

.chart-legend-line.easy { background: #4CAF50; }
.chart-legend-line.standard { background: #FF9800; }
.chart-legend-line.hard { background: #2196F3; }
.chart-legend-line.linear { background: #9C27B0; }

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.content {
  animation: fadeIn 0.4s ease;
}

/* ===== Grid background (homepage style) ===== */
body::before {
  content: '';
  position: fixed;
  width: 200%;
  height: 200%;
  background:
    linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridMove 20s linear infinite;
  z-index: -1;
  pointer-events: none;
}

@keyframes gridMove {
  to { transform: translate(-40px, -40px); }
}
