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

:root {
  --primary:      #30a9de;
  --primary-dark: #2496c8;
  --accent:       #ffd700;
  --footer-bg:    #607d8b;
  --bg:           #f1f1f1;
  --surface:      #ffffff;
  --text:         #333333;
  --text-muted:   #888888;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────── */
.site-header {
  background: var(--primary);
  padding: 14px 24px;
  flex-shrink: 0;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.site-header h1 {
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
}
.site-header p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  margin-top: 3px;
}
.site-header p a { color: inherit; text-decoration: none; }
.site-header p a:hover { text-decoration: underline; }

/* Hamburger — mobile only */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  flex-shrink: 0;
}

/* ── Tab bar ─────────────────────────────────── */
.tab-bar {
  background: var(--primary-dark);
  display: flex;
  padding: 0 12px;
  flex-shrink: 0;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255, 255, 255, 0.6);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 11px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tab-btn:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
}
.tab-btn.active {
  color: #ffffff;
  border-bottom-color: var(--accent);
}
a.tab-btn {
  text-decoration: none;
}

/* ── Main area ───────────────────────────────── */
.site-main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Scrollable content panels ───────────────── */
.content-panel {
  flex: 1;
  overflow-y: auto;
  padding: 36px 24px 60px;
}
.content-inner {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* ── Section cards ───────────────────────────── */
.home-section {
  background: var(--surface);
  border-radius: 10px;
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.home-section h2 {
  color: var(--primary);
  font-size: 18px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e8e8e8;
}
.home-section p {
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 10px;
}
.home-section p:last-child { margin-bottom: 0; }

/* Stat row */
.stat-row {
  display: flex;
  gap: 16px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.stat-card {
  flex: 1;
  min-width: 110px;
  background: var(--bg);
  border-radius: 8px;
  padding: 16px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Sub-navigation (within a tab) ──────────── */
.sub-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.sub-btn {
  background: var(--surface);
  border: 1px solid #d0d0d0;
  border-radius: 20px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sub-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.sub-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.sub-panel { display: none; }
.sub-panel.active { display: block; }

/* ── Code blocks ─────────────────────────────── */
.home-section pre {
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
}
.home-section pre code.hljs {
  border-radius: 8px;
  font-family: "Courier New", Consolas, Monaco, monospace;
  font-size: 13px;
  line-height: 1.6;
}
/* Inline code only — not inside <pre> */
.home-section :not(pre) > code {
  background: #f0f0f0;
  color: #c0392b;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Courier New", Consolas, Monaco, monospace;
  font-size: 0.92em;
}
.home-section ul, .home-section ol {
  margin: 10px 0 10px 24px;
}
.home-section li {
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.7;
}
.cmd-table-wrap {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: 6px;
}
.home-section .cmd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.home-section .cmd-table td {
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  vertical-align: top;
  word-break: break-word;
}
.home-section .cmd-table td:first-child {
  width: 38%;
}
.home-section .cmd-table td:last-child {
  width: 62%;
}
.home-section .cmd-table code {
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── Software grid ───────────────────────────── */
.software-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.software-grid a {
  display: block;
  padding: 9px 14px;
  background: var(--bg);
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  color: var(--primary);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.software-grid a:hover {
  background: #e4f4fb;
  border-color: var(--primary);
}
.software-grid .sw-ver {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}
details.sw-detail {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
details.sw-detail summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 13px;
  margin-bottom: 6px;
}
details.sw-detail p {
  font-size: 13px !important;
  line-height: 1.6 !important;
  word-break: break-word;
}

/* ── Chart containers ────────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 420px;
}
.chart-wrap-sm { height: 280px; max-width: 320px; }
.chart-wrap-lg { height: 560px; }
.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Screenshots ─────────────────────────────── */
.screenshot {
  display: block;
  max-width: 100%;
  width: auto;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  margin: 16px 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Placeholder */
.placeholder-block {
  background: var(--surface);
  border: 2px dashed #c5e6f5;
  border-radius: 10px;
  padding: 52px 32px;
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.placeholder-block h2 {
  font-size: 16px;
  color: var(--primary);
  margin-bottom: 8px;
}

/* ── Footer ──────────────────────────────────── */
.site-footer {
  background: var(--footer-bg);
  color: rgba(255, 255, 255, 0.8);
  padding: 10px 24px;
  font-size: 13px;
  flex-shrink: 0;
  text-align: center;
}
.site-footer a { color: rgba(255, 255, 255, 0.8); text-decoration: none; }
.site-footer a:hover { color: #fff; }

/* ── Mobile ──────────────────────────────────── */
@media (max-width: 768px) {
  .menu-toggle { display: block; }

  .tab-bar {
    display: none;
    flex-direction: column;
    padding: 4px 0;
  }
  .tab-bar.open { display: flex; }

  .tab-btn {
    text-align: left;
    padding: 14px 24px;
    border-bottom: none;
    border-left: 3px solid transparent;
    font-size: 15px;
  }
  .tab-btn.active {
    border-left-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
  }

  .home-section {
    padding: 20px 18px;
  }
  .stat-num { font-size: 22px; }
}
