/* Trixbrix Software — playful, brick-inspired design */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700;12..96,800&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  /* Aligned with shop.trixbrix.eu: white canvas, near-black ink, red brand accent, yellow highlight */
  --paper:        #ffffff;
  --paper-tint:   #f6f6f7;
  --ink:          #111418;
  --ink-soft:     #3b4148;
  --muted:        #6b7280;
  --line:         #e5e7eb;
  --card:         #ffffff;
  --card-line:    #e5e7eb;

  --brick-red:    #e11d2a;
  --brick-red-d:  #b3121d;
  --sun:          #ffd84d;
  --sun-d:        #d6a900;
  --sky:          #1e3a8a;

  --shadow-sm: 0 1px 2px 0 rgba(17, 20, 24, 0.05);
  --shadow-md: 0 2px 6px -1px rgba(17, 20, 24, 0.08), 0 1px 3px -1px rgba(17, 20, 24, 0.06);
  --shadow-lg: 0 12px 24px -8px rgba(17, 20, 24, 0.12), 0 4px 8px -4px rgba(17, 20, 24, 0.06);

  --r-card: 12px;
  --r-pill: 999px;
}

[data-theme="dark"] {
  --paper:        #0c0d0f;
  --paper-tint:   #15171a;
  --ink:          #f1f3f5;
  --ink-soft:     #c7ccd1;
  --muted:        #8a909a;
  --line:         #23262b;
  --card:         #15171a;
  --card-line:    #2a2d33;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 2px 6px -1px rgba(0, 0, 0, 0.5), 0 1px 3px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 24px -8px rgba(0, 0, 0, 0.6), 0 4px 8px -4px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  /* very subtle stud-grid (LEGO baseplate hint) */
  background-image:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 4%, transparent) 1px, transparent 1.5px);
  background-size: 32px 32px;
  background-position: 0 0;
  min-height: 100vh;
}

main {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1.25rem 5rem;
  position: relative;
}

/* ----- typography ----- */
h1, h2, h3 {
  font-family: 'Bricolage Grotesque', serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
}
h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); margin: 0; font-weight: 800; }
h2 { font-size: 1.55rem; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.15rem; margin: 0; }

p { margin: 0.5rem 0 1rem; color: var(--ink-soft); }

a {
  color: var(--brick-red);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--brick-red) 40%, transparent);
  transition: text-decoration-color 0.15s;
}
a:hover { text-decoration-color: var(--brick-red); }

.muted { color: var(--muted); }

code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: var(--paper-tint);
  border: 1px solid var(--line);
  padding: 0.05em 0.4em;
  border-radius: 6px;
  font-size: 0.88em;
}

/* ----- top-right controls ----- */
.top-controls {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 50;
}
.lang-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.lang-switcher select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: 0.55rem 2.1rem 0.55rem 0.85rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  height: 40px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lang-switcher select:hover {
  border-color: var(--ink-soft);
  box-shadow: var(--shadow-md);
}
.lang-switcher select:focus-visible {
  outline: 2px solid var(--brick-red);
  outline-offset: 2px;
}
.lang-switcher::after {
  content: '';
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-25%);
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform-origin: center;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

/* ----- theme toggle ----- */
.theme-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  padding: 0;
  z-index: 50;
  transition: color 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
  box-shadow: var(--shadow-md);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--brick-red);
  outline-offset: 2px;
}
.theme-toggle svg { width: 20px; height: 20px; display: block; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ----- header ----- */
.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: max-content;
  margin-bottom: 2.5rem;
  text-decoration: none;
  color: inherit;
}
.site-header:hover { text-decoration: none; }
.site-header .logo-mark {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}
.site-header:hover .logo-mark { transform: rotate(-5deg) scale(1.04); }
.site-header .wordmark {
  font-family: 'Bricolage Grotesque', serif;
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.035em;
  line-height: 0.95;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.site-header .wordmark .sub {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ----- back link ----- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: 2rem;
}
.back-link:hover { color: var(--brick-red); border-bottom-color: var(--brick-red); }

/* ----- hero ----- */
.hero { margin-bottom: 3rem; position: relative; }
.hero .eyebrow {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brick-red);
  background: color-mix(in srgb, var(--brick-red) 12%, transparent);
  padding: 0.35em 0.8em;
  border-radius: var(--r-pill);
  margin-bottom: 1rem;
}
.hero p.tagline {
  font-size: 1.15rem;
  max-width: 56ch;
  margin-top: 1rem;
}
.hero-product {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
}
.hero-product .hero-image {
  width: 200px;
  height: 200px;
  background: var(--paper-tint);
  border: 1px solid var(--line);
  border-radius: 14px;
  object-fit: contain;
  padding: 0.5rem;
}
@media (max-width: 640px) {
  .hero-product { grid-template-columns: 1fr; }
  .hero-product .hero-image {
    width: 140px;
    height: 140px;
    justify-self: start;
    order: -1;
  }
}
.version-line {
  margin: 0.7rem 0 0;
  font-size: 0.95rem;
}
.version-line[hidden] { display: none; }
.version-line .chip {
  font-size: 0.78rem;
}

/* ----- guided flow panel (single-step UI) ----- */
.flow-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  text-align: center;
}
.flow-visual { margin: 0 auto 1.25rem; }
.flow-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  background: color-mix(in srgb, var(--brick-red) 8%, var(--card));
  color: var(--brick-red);
}
.flow-icon[data-tone="warn"] {
  background: color-mix(in srgb, var(--sun) 22%, var(--card));
  color: color-mix(in srgb, var(--sun-d) 80%, var(--ink));
}
.flow-icon[data-tone="error"] {
  background: color-mix(in srgb, var(--brick-red) 14%, var(--card));
  color: var(--brick-red);
}
.flow-icon[data-tone="ok"] {
  background: color-mix(in srgb, #1f9d55 14%, var(--card));
  color: #1f9d55;
}
.flow-version-display {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  font-family: 'Bricolage Grotesque', serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.flow-version-display .version-num {
  font-size: 2.2rem;
  line-height: 1;
}
.flow-version-display .version-arrow {
  font-size: 1.5rem;
  color: var(--muted);
  font-weight: 500;
}
.flow-version-display.update .from { color: var(--muted); }
.flow-version-display.update .to   { color: var(--brick-red); }
.flow-version-display.ok .check {
  font-size: 1.8rem;
  color: #1f9d55;
}

.flow-title {
  font-family: 'Bricolage Grotesque', serif;
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.65rem;
  color: var(--ink);
}
.flow-description {
  margin: 0 auto 1.5rem;
  max-width: 52ch;
  color: var(--ink-soft);
  font-size: 1rem;
}
.flow-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 0.5rem;
}
.flow-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 0.85rem;
}
.flow-tip {
  margin: 1.5rem auto 0;
  max-width: 50ch;
  padding: 0.7rem 0.95rem;
  background: var(--paper-tint);
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.link-as-button {
  text-decoration: none;
}
[hidden] { display: none !important; }
.flow-panel[data-state="empty"] .flow-icon { background: color-mix(in srgb, var(--brick-red) 8%, var(--card)); }
.flow-panel[data-state="detecting"] .flow-icon {
  animation: flow-spin 1.6s linear infinite;
}
@keyframes flow-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .flow-panel[data-state="detecting"] .flow-icon { animation: none; }
}
.detect-col {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}
.detect-col .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.detect-col .value {
  font-family: 'Bricolage Grotesque', serif;
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
}
.detect-col .sub {
  font-size: 0.85rem;
  color: var(--muted);
}
.detect-arrow {
  font-size: 1.4rem;
  color: var(--muted);
  user-select: none;
}
.detect-status {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0 0 1rem;
  padding: 0.7rem 0.95rem;
  border-radius: 8px;
  background: var(--paper-tint);
}
.detect-status[data-tone="ok"]      { background: color-mix(in srgb, #1f9d55 12%, var(--card)); color: var(--ink); }
.detect-status[data-tone="info"]    { background: color-mix(in srgb, var(--brick-red) 8%, var(--card)); color: var(--ink); }
.detect-status[data-tone="warn"]    { background: color-mix(in srgb, var(--sun) 22%, var(--card)); color: var(--ink); }
.detect-status[data-tone="error"]   { background: color-mix(in srgb, var(--brick-red) 14%, var(--card)); color: var(--ink); }
.detect-status code {
  font-size: 0.86em;
  background: var(--card);
}

.btn-secondary {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 0.92rem;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-secondary:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
}
.btn-secondary:disabled {
  opacity: 0.6;
  cursor: progress;
}
.btn-secondary:focus-visible {
  outline: 2px solid var(--brick-red);
  outline-offset: 2px;
}

.shop-link {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
}
.shop-link a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1.5px solid color-mix(in srgb, var(--ink-soft) 35%, transparent);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}
.shop-link a:hover {
  color: var(--brick-red);
  border-bottom-color: var(--brick-red);
}

/* ----- device cards (landing) ----- */
.devices {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 1.2rem 1.4rem;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.card:hover {
  border-color: var(--ink-soft);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.card-image {
  flex-shrink: 0;
  width: 110px;
  height: 110px;
  border-radius: 10px;
  background: var(--paper-tint);
  object-fit: contain;
  padding: 0.35rem;
}
.card-body { flex: 1; min-width: 0; }
.card h3 {
  font-size: 1.25rem;
  margin: 0 0 0.35rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.card h3::after {
  content: '→';
  margin-left: auto;
  color: var(--brick-red);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  transition: transform 0.15s;
}
.card:hover h3::after { transform: translateX(4px); }
@media (max-width: 480px) {
  .card { gap: 1rem; padding: 1rem 1.1rem; }
  .card-image { width: 80px; height: 80px; }
}
.card .desc {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.97rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--paper-tint);
  color: var(--muted);
  padding: 0.4em 0.7em 0.3em;
  line-height: 1;
  border-radius: var(--r-pill);
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
}
.card .chip-row { margin-top: 0.85rem; }
.chip-version {
  background: color-mix(in srgb, var(--brick-red) 12%, transparent);
  color: var(--brick-red);
  gap: 0.4em;
}
.chip-version .v { font-weight: 800; }
.chip .sep { opacity: 0.5; }

/* ----- panels (device page) ----- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 1.6rem 1.7rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}
.panel.install-blocked .install-row { opacity: 0.35; pointer-events: none; filter: saturate(0.4); position: relative; }
.panel.install-blocked .install-row::after {
  content: '';
  position: absolute;
  inset: 0;
  cursor: not-allowed;
}
.panel h2 { margin-top: 0; }
.panel > p:last-child { margin-bottom: 0; }

/* numbered steps with brick-style numbers */
.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 1rem 0 1.5rem;
  display: grid;
  gap: 0.75rem;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.6rem;
  min-height: 1.85rem;
  color: var(--ink-soft);
  line-height: 1.55;
  padding-top: 0.1rem;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.steps li strong { color: var(--ink); }
.steps li em { font-style: normal; font-weight: 600; color: var(--ink); }

.step-hint {
  margin: 0.25rem 0 0;
  padding: 0.7rem 0.95rem;
  background: var(--paper-tint);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.step-hint strong { color: var(--ink); font-weight: 600; }
.step-hint code {
  font-size: 0.85em;
  background: var(--card);
}

/* ----- install row + custom button ----- */
.install-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  align-items: center;
  margin: 1.25rem 0 0.25rem;
}

.btn-install {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.005em;
  background: var(--brick-red);
  color: #fff;
  border: 1px solid var(--brick-red-d);
  border-radius: 10px;
  padding: 0.75rem 1.4rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  line-height: 1;
}
.btn-install:hover {
  background: var(--brick-red-d);
  box-shadow: var(--shadow-md);
}
.btn-install:focus-visible {
  outline: 2px solid var(--brick-red);
  outline-offset: 2px;
}

/* erase-first variant (when checkbox flips state) */
.btn-install.is-erase {
  background: #111418;
  border-color: #000;
  color: #fff;
}
.btn-install.is-erase:hover { background: #000; }

/* ----- factory-reset checkbox (LEGO-y switch) ----- */
.erase-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.97rem;
  color: var(--ink-soft);
  font-weight: 500;
}
.erase-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.erase-toggle .box {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
  position: relative;
}
.erase-toggle .box::after {
  content: '';
  width: 11px;
  height: 6px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) translate(2px, -1px) scale(0);
  transform-origin: center;
  transition: transform 0.15s ease-out;
}
.erase-toggle:hover .box { border-color: var(--ink-soft); }
.erase-toggle input:checked + .box {
  background: var(--ink);
  border-color: var(--ink);
}
.erase-toggle input:checked + .box::after {
  transform: rotate(-45deg) translate(2px, -1px) scale(1);
}
.erase-toggle input:focus-visible + .box {
  outline: 2px solid var(--brick-red);
  outline-offset: 2px;
}

/* warning that appears when erase is checked */
.erase-warning {
  background: color-mix(in srgb, var(--sun) 22%, var(--card));
  border: 1px solid color-mix(in srgb, var(--sun-d) 40%, transparent);
  border-left: 3px solid var(--sun-d);
  border-radius: 10px;
  color: var(--ink);
  padding: 0.85rem 1.1rem;
  margin-top: 1.25rem;
  font-size: 0.94rem;
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}
.erase-warning .icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}
.erase-warning strong { font-weight: 600; color: var(--ink); }
.erase-warning[hidden] { display: none; }

/* ----- browser banner ----- */
.banner {
  background: color-mix(in srgb, var(--sun) 22%, var(--card));
  border: 1px solid color-mix(in srgb, var(--sun-d) 40%, transparent);
  border-left: 3px solid var(--sun-d);
  border-radius: 10px;
  padding: 0.95rem 1.2rem;
  margin-bottom: 2rem;
  color: var(--ink);
}
.banner h3 { font-size: 1rem; margin: 0 0 0.2rem; font-family: 'Bricolage Grotesque', serif; color: var(--ink); }
.banner p { margin: 0; color: var(--ink-soft); font-size: 0.94rem; }
.banner[hidden] { display: none !important; }

/* ----- version history ----- */
.versions { margin-top: 0.75rem; display: grid; gap: 0.85rem; }
.version {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow-sm);
}
.version header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}
.version header h3 {
  font-size: 1.1rem;
  font-family: 'Bricolage Grotesque', serif;
}
.version header .when {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--muted);
}
.version-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--brick-red) 12%, transparent);
  color: var(--brick-red);
  padding: 0.25em 0.7em;
  border-radius: var(--r-pill);
}
.changelog { font-size: 0.96rem; color: var(--ink-soft); }
.changelog p:first-child { margin-top: 0; }
.changelog p:last-child { margin-bottom: 0; }
.changelog ul { padding-left: 1.25rem; margin: 0.5rem 0; }
.changelog li { margin: 0.2rem 0; }
.changelog h2, .changelog h3 { font-size: 1rem; margin: 0.6rem 0 0.25rem; color: var(--ink); }

/* ----- footer ----- */
footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 2px dashed var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  align-items: center;
  justify-content: space-between;
}
footer p { margin: 0; color: var(--muted); }
footer a { color: var(--ink-soft); }

/* ----- esp-web-tools fallback (in case our slot button isn't used) ----- */
esp-web-install-button {
  --esp-tools-button-color: var(--brick-red);
  --esp-tools-button-text-color: #fff;
  --esp-tools-button-border-radius: 12px;
}

/* ----- mobile ----- */
@media (max-width: 520px) {
  main { padding: 1.25rem 1rem 4rem; }
  h1 { font-size: 2rem; }
  .panel, .card { padding: 1.2rem 1.25rem; }
  .install-row { gap: 0.85rem 1rem; }
  .btn-install { width: 100%; justify-content: center; }

  /* Top controls: shrink so they don't overlap the wordmark on small screens. */
  .top-controls { top: 0.6rem; right: 0.6rem; gap: 0.35rem; }
  .lang-switcher select {
    padding: 0.4rem 1.4rem 0.4rem 0.55rem;
    font-size: 0.78rem;
    height: 36px;
    max-width: 5.5rem;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }
  .lang-switcher::after { right: 0.55rem; }
  .theme-toggle { width: 36px; height: 36px; border-radius: 9px; }
  .theme-toggle svg { width: 18px; height: 18px; }

  /* Header: smaller logo and wordmark so the controls don't crowd it. */
  .site-header { gap: 0.7rem; margin-bottom: 1.75rem; }
  .site-header .logo-mark { width: 50px; height: 50px; border-radius: 12px; }
  .site-header .wordmark { font-size: 1.4rem; gap: 0.2rem; }
  .site-header .wordmark .sub { font-size: 0.62rem; letter-spacing: 0.18em; }

  /* Hero image stacks above the title on narrow screens. */
  .hero-product { gap: 1rem; }
  .hero-product .hero-image { width: 130px; height: 130px; }

  /* Flow panel: tighten padding. */
  .flow-panel { padding: 1.5rem 1.1rem; }
  .flow-version-display .version-num { font-size: 1.8rem; }
  .flow-actions { width: 100%; flex-direction: column; }
  .flow-actions > * { width: 100%; }
}

/* ----- reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
