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

:root {
  --bg: #1c1c1e;
  --fg: #e8e6e3;
  --muted: #888;
  --border: #333;
  --accent: #e8e6e3;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Georgia', serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  padding: 2rem 2rem 0;
  text-align: center;
}

.wordmark {
  font-size: 2rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  color: var(--fg);
  text-decoration: none;
}

.wordmark::before {
  content: '~~~ ';
  color: var(--muted);
}

.wordmark::after {
  content: ' ~~~';
  color: var(--muted);
}

.tagline {
  display: block;
  font-size: 1rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.35rem;
}

.header-byline {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.header-byline a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.header-byline a:hover {
  color: var(--fg);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.5rem;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.hero {
  text-align: center;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: 2rem;
  font-weight: normal;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero p {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 460px;
  margin: 0 auto;
}

.definition-block {
  width: 100%;
  border-left: 2px solid var(--border);
  padding: 0.6rem 1.25rem;
}

.definition-word {
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg);
  margin-bottom: 0.4rem;
}

.definition-text {
  font-size: 1.05rem;
  color: var(--fg);
  line-height: 1.55;
  margin-bottom: 0.3rem;
}

.definition-sub {
  font-size: 0.95rem;
  color: var(--muted);
  font-style: italic;
}

.divider {
  width: 40px;
  height: 1px;
  background: var(--border);
  margin: 2rem auto;
}

.requirements {
  width: 100%;
  margin-bottom: 2.5rem;
}

.requirements h2 {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  color: #aaa;
  margin-bottom: 0.75rem;
}

.requirements ul {
  list-style: none;
  font-size: 0.9rem;
  color: var(--fg);
}

.requirements ul li {
  padding: 0.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.requirements ul li::before {
  content: '—';
  color: var(--muted);
  font-family: 'Courier New', monospace;
}

.email-form {
  width: 100%;
  border: 1px solid #fff;
  border-radius: 4px;
  background: #0D243A;
  padding: 2rem 1.75rem;
  text-align: center;
}

.email-form h2 {
  font-size: 1.4rem;
  font-weight: normal;
  letter-spacing: -0.01em;
  font-family: 'Georgia', serif;
  color: var(--fg);
  margin-bottom: 0.75rem;
}

.email-form > p {
  font-size: 0.88rem;
  color: #bbb;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.form-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.email-form input[type="email"] {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--border);
  background: #2c2c2e;
  color: var(--fg);
  border-radius: 2px;
  outline: none;
  transition: border-color 0.15s;
}

.email-form input[type="email"]:focus {
  border-color: var(--fg);
}

.email-form input[type="email"]::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.btn {
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  letter-spacing: 0.05em;
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  border-radius: 2px;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.btn:hover {
  opacity: 0.8;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-note {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: 'Courier New', monospace;
}

.form-error {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: #c0392b;
  display: none;
}

.form-still-thinking {
  margin-top: 2rem;
  font-size: 0.88rem;
  color: #fff;
}

.proceed {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hero-image {
  text-align: center;
  padding: 1.5rem 2rem 0;
}

.hero-image img {
  max-width: 320px;
  width: 100%;
  border-radius: 4px;
  opacity: 0.9;
}

.hero-image img.hero-icon {
  max-width: 120px;
  border-radius: 0;
  opacity: 0.35;
}

.site-footer {
  padding: 2rem;
  text-align: center;
}

.footer-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 0.75rem;
  opacity: 0.7;
}

.site-footer p {
  font-size: 0.9rem;
  color: var(--fg);
  font-family: 'Courier New', monospace;
}

.site-footer a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Hardware buy section */
.buy-hardware {
  width: 100%;
  margin-bottom: 2.5rem;
}

.buy-hardware h2 {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  color: #aaa;
  margin-bottom: 0.75rem;
}

.hardware-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hardware-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  text-decoration: none;
  color: var(--fg);
  background: #2c2c2e;
  transition: border-color 0.15s;
}

.hardware-or {
  text-align: center;
  font-size: 1rem;
  letter-spacing: 0.25em;
  font-family: 'Courier New', monospace;
  color: #e0e0e0;
  padding: 0.25rem 0;
}

.hardware-card:hover {
  border-color: var(--fg);
}

.hardware-card .card-label {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  color: #e0e0e0;
  font-weight: 700;
}

.hardware-card .card-title {
  font-size: 1.05rem;
  color: #c8c8c8;
}

.hardware-card .card-note {
  font-size: 0.88rem;
  color: #9a9a9a;
}

.hardware-card .card-cta {
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
  color: var(--fg);
  margin-top: 0.25rem;
}

/* Flash page specific */
.flash-steps {
  width: 100%;
  margin-bottom: 2.5rem;
}

.flash-steps h2 {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  color: #aaa;
  margin-bottom: 0.75rem;
}

.flash-steps ol {
  list-style: none;
  counter-reset: steps;
  font-size: 0.9rem;
}

.flash-steps ol li {
  counter-increment: steps;
  padding: 0.35rem 0;
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
}

.flash-steps ol li::before {
  content: counter(steps) '.';
  font-family: 'Courier New', monospace;
  color: var(--muted);
  min-width: 1.2rem;
}

.flash-area {
  width: 100%;
  text-align: center;
  padding: 2rem;
  border: 1px solid #fff;
  border-radius: 4px;
  background: #0D243A;
  margin-bottom: 2rem;
}

.flash-area p {
  font-size: 0.82rem;
  color: #bbb;
  margin-top: 1rem;
  font-family: 'Courier New', monospace;
}

esp-web-install-button {
  display: inline-block;
}

esp-web-install-button[install-unsupported] .unsupported-msg {
  display: block;
}

.unsupported-msg {
  display: none;
  font-size: 0.85rem;
  color: #c0392b;
  font-family: 'Courier New', monospace;
}

.faq {
  width: 100%;
}

.faq h2 {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  color: #aaa;
  margin-bottom: 0.75rem;
}

.faq details {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}

.faq details:first-of-type {
  border-top: 1px solid var(--border);
}

.faq summary {
  font-size: 0.88rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: '+';
  font-family: 'Courier New', monospace;
  color: var(--muted);
}

.faq details[open] summary::after {
  content: '−';
}

.faq details p {
  font-size: 0.85rem;
  color: var(--muted);
  padding-top: 0.5rem;
  line-height: 1.5;
}

/* Manual link row */
.manual-link-row {
  width: 100%;
  text-align: center;
  margin-bottom: 2.5rem;
}

.manual-trigger {
  background: none;
  border: none;
  color: var(--fg);
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.15s;
}

.manual-trigger:hover {
  opacity: 0.7;
}

/* Instructions modal */
.manual-modal {
  background: #1c1c1e;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0;
  width: min(520px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.manual-modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.manual-inner {
  padding: 1.75rem;
}

.manual-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
}

.manual-title {
  font-family: 'Courier New', monospace;
  font-size: 1.25rem;
  letter-spacing: 0.15em;
  color: var(--fg);
}

.manual-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color 0.15s;
}

.manual-close:hover {
  color: var(--fg);
}

.manual-section {
  margin-bottom: 1.5rem;
}

.manual-section:last-child {
  margin-bottom: 0;
}

.manual-label {
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.manual-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.manual-list li {
  font-size: 0.88rem;
  line-height: 1.5;
  padding-left: 0;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.manual-list li::before {
  content: '—';
  color: var(--border);
  font-family: 'Courier New', monospace;
  flex-shrink: 0;
}

.manual-note {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.75rem;
  line-height: 1.5;
  font-style: italic;
}

.key {
  font-family: 'Courier New', monospace;
  color: var(--fg);
  font-size: 0.85rem;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .form-row {
    flex-direction: column;
  }

  .hero h1 {
    font-size: 1.6rem;
  }
}
