* {
  box-sizing: border-box;
}

:root {
  --bg: #101010;
  --fg: #f5f5f5;
  --muted: #b0b0b0;
  --accent: #f5f5f5;
  --border: #2e2e2e;
  --card-bg: #181818;
  --panel-bg: #181818;
  --badge-bg: #181818;
  --divider: #2c2c2c;
  --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.2);
  --link: #ffffff;
}

[data-theme="light"] {
  --bg: #f5f5f5;
  --fg: #111111;
  --muted: #666666;
  --accent: #111111;
  --border: #d0d0d0;
  --card-bg: #ffffff;
  --panel-bg: #ffffff;
  --badge-bg: #ffffff;
  --divider: #d0d0d0;
  --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.08);
  --link: #0054a6;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: Arial, Helvetica, sans-serif;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: background 0.2s ease-out, color 0.2s ease-out;
}

main {
  width: 100%;
  max-width: 960px;
  position: relative;
}

/* Top bar: downloads + theme toggle */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 6px;
}

.top-bar-left {
  flex: 1 1 auto;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Download badge */
.download-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: default;
  box-shadow: var(--shadow-soft);
  transition: background 0.15s ease-out, border-color 0.15s ease-out,
              transform 0.12s ease-out;
}

.download-badge:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--divider);
}

[data-theme="light"] .download-badge:hover {
  background: rgba(0, 0, 0, 0.03);
}

.download-badge-icon {
  font-size: 0.85rem;
}

.download-badge-count {
  font-family: Consolas, "Courier New", monospace;
  color: var(--fg);
}

.nav-links {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}


/* Theme toggle button: icon-only */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: background 0.15s ease-out, border-color 0.15s ease-out,
              transform 0.12s ease-out, color 0.15s ease-out;
}

.theme-toggle-icon {
  font-size: 1rem;
  line-height: 1;
  font-family: "Menlo", "Consolas", monospace;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--divider);
}

[data-theme="light"] .theme-toggle:hover {
  background: rgba(0, 0, 0, 0.03);
}

h1 {
  margin: 0 0 6px;
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.03em;
}

.tagline {
  text-align: center;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 14px;
}

.header-divider {
  width: 64px;
  height: 1px;
  margin: 0 auto 18px;
  background: var(--divider);
}

.subtitle {
  margin: 0 auto 22px;
  font-size: 1rem;
  color: var(--muted);
  max-width: 900px;
  line-height: 1.45;
  text-align: center;
}

.panel-label {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 6px;
  margin-top: 28px;
  text-align: center;
}

.code-panel {
  position: relative; /* for positioning copy button */
  background: var(--panel-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  overflow-x: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.95rem;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.code-panel code {
  display: block;
  white-space: pre-wrap;
  text-align: center;
  margin: 0 auto;
}

pre {
  margin: 0;
  white-space: pre;
}

code {
  color: var(--fg);
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  margin-bottom: 16px;

  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;

  font-size: 0.85rem;
  color: var(--fg);
  text-decoration: none;

  cursor: pointer;
  transition: background 0.15s ease-out,
              border-color 0.15s ease-out,
              transform 0.12s ease-out;
}

.back-button:hover {
  transform: translateY(-1px);
  border-color: var(--divider);
  background: rgba(255,255,255,0.03);
}

[data-theme="light"] .back-button:hover {
  background: rgba(0,0,0,0.05);
}

.back-icon {
  font-family: "Menlo", "Consolas", monospace;
  font-size: 0.95rem;
  line-height: 1;
}



/* Copy button inside code panel */
.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0;
  transition: background 0.15s ease-out, border-color 0.15s ease-out,
              transform 0.12s ease-out, color 0.15s ease-out;
}

.copy-icon {
  font-family: "Menlo", "Consolas", monospace;
  line-height: 1;
}

.copy-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--divider);
  color: var(--fg);
}

[data-theme="light"] .copy-button:hover {
  background: rgba(0, 0, 0, 0.03);
}

.hint {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.hint strong {
  color: var(--fg);
  font-weight: 500;
}

a {
  color: var(--link);
  text-decoration: underline;
}

.sections {
  margin-top: 32px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section-heading {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 4px;
  text-align: center;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

/* Flow layout */
.flow-diagram {
  position: relative;
  margin-top: 24px;
  padding: 8px 0 0;
}

.flow-row-top,
.flow-row-bottom {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.flow-row-top .card,
.flow-row-bottom .card {
  max-width: 740px;
  width: 100%;
}

.flow-row-middle {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin: 8px 0 8px;
  padding-top: 18px;   /* space for connector from installer */
  padding-bottom: 18px;/* space for connector to watchdog */
}

/* Horizontal connector between 1.1 and 1.2 */
.flow-row-middle::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: var(--border);
  opacity: 0.35;
  pointer-events: none;
}

/* Vertical connector from middle row to watchdog */
.flow-row-middle::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 1px;
  height: 18px;
  background: var(--border);
  opacity: 0.35;
  pointer-events: none;
  transform: translateX(-50%);
}

.flow-row-middle .card {
  flex: 1 1 260px;
  max-width: 420px;
  position: relative;
}

/* Vertical connectors from horizontal line to each miner card */
.flow-row-middle .card::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 50%;
  width: 1px;
  height: 18px;
  background: var(--border);
  opacity: 0.35;
  pointer-events: none;
  transform: translateX(-50%);
}

.card {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}

/* Installer: vertical line down to middle row */
.card-installer {
  position: relative;
}

.card-installer::after {
  content: "";
  position: absolute;
  bottom: -18px;
  left: 50%;
  width: 1px;
  height: 18px;
  background: var(--border);
  opacity: 0.35;
  pointer-events: none;
  transform: translateX(-50%);
}

/* Watchdog: vertical line up from middle row */
.card-watchdog {
  position: relative;
}

.card-watchdog::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 50%;
  width: 1px;
  height: 18px;
  background: var(--border);
  opacity: 0.35;
  pointer-events: none;
  transform: translateX(-50%);
}

.card-title {
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.card-tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 4px;
}

.card ul {
  margin: 6px 0 0 1.1rem;
  padding: 0;
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.4;
}

.card li {
  margin: 2px 0;
}

.credits-box {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.credits-box strong {
  color: var(--fg);
}

footer {
  margin-top: 32px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

.x-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 0.85rem;
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease-out, border-color 0.15s ease-out, transform 0.12s ease-out;
}

.x-icon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
}

.x-button:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--divider);
  transform: translateY(-1px);
}

[data-theme="light"] .x-button:hover {
  background: rgba(0, 0, 0, 0.03);
}

@media (max-width: 640px) {
  body {
    padding: 16px;
    align-items: flex-start;
  }

  main {
    max-width: 100%;
  }

  h1 {
    font-size: 1.6rem;
    margin-bottom: 4px;
  }

  .tagline {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
  }

  .subtitle {
    font-size: 0.95rem;
    padding: 0 4px;
  }

  .code-panel {
    font-size: 0.9rem;
    padding: 10px 10px;
  }

  .sections {
    margin-top: 24px;
  }

  .flow-row-middle .card {
    max-width: 100%;
  }

  footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .top-bar {
    justify-content: space-between;
  }

  /* Hide connector lines on mobile for cleaner layout */
  .flow-row-middle::before,
  .flow-row-middle::after,
  .flow-row-middle .card::before,
  .card-installer::after,
  .card-watchdog::before {
    opacity: 0;
  }
}

