:root {
  --ink: #111;
  --muted: #666;
  --line: #e5e5e5;
  --line-strong: #d0d0d0;
  --bg: #fff;
  --bg-soft: #fafafa;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

* { box-sizing: border-box; margin: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  justify-content: center;
  padding: 3rem 1.5rem;
  min-height: 100vh;
}

.container {
  max-width: 560px;
  width: 100%;
}

/* Header */
header {
  margin-bottom: 2rem;
}

.logo {
  height: 22px;
  width: auto;
  display: block;
  margin-bottom: .75rem;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 .2rem;
}

.subtitle {
  color: var(--muted);
  font-size: .85rem;
  margin: 0;
}

/* Cards */
.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.flash-card {
  border-color: var(--ink);
}

h2 {
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: .65rem;
  letter-spacing: -.01em;
}

h3 {
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: .4rem;
}

/* Forms */
label {
  display: block;
  margin-bottom: .25rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
}

select {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  font-size: .85rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}

select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}

select:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* Board info badges */
.board-info {
  display: flex;
  gap: .4rem;
  margin-top: .5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--muted);
  border: 1px solid var(--line);
}

/* Radio group */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--ink);
  cursor: pointer;
  font-weight: 400;
}

.radio-group input[type="radio"] {
  width: auto;
  margin: 0;
}

.radio-group .hint {
  font-size: .72rem;
  color: var(--muted);
}

/* Buttons */
.flash-btn {
  padding: .55rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
  transition: background .15s, border-color .15s;
}

.flash-btn:hover {
  background: var(--bg-soft);
  border-color: var(--line-strong);
}

.flash-btn.primary {
  background: #111;
  border-color: #111;
  color: #fff;
}

.flash-btn.primary:hover {
  background: #333;
  border-color: #333;
}

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

/* ESP Web Tools button */
esp-web-install-button { display: block; }

esp-web-install-button button {
  padding: .55rem 1rem;
  border: 1px solid #111;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
  background: #111;
  color: #fff;
  transition: background .15s;
}

esp-web-install-button button:hover {
  background: #333;
}

/* DFU instructions */
#dfu-instructions ol {
  padding-left: 1.2rem;
  font-size: .85rem;
  line-height: 1.7;
  color: var(--muted);
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-top: .65rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--ink);
  border-radius: 3px;
  transition: width .2s ease;
}

.progress-text {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .3rem;
  text-align: right;
}

/* Log */
#log-output {
  background: #111;
  color: #ccc;
  font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace;
  font-size: .75rem;
  padding: .65rem;
  border-radius: var(--radius-xs);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

/* Warning */
.warning {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: .55rem .75rem;
  border-radius: var(--radius-xs);
  font-size: .82rem;
}

/* Footer */
footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

footer p {
  font-size: .72rem;
  color: var(--muted);
  line-height: 1.5;
}

footer a {
  color: var(--ink);
}

/* Responsive */
@media (max-width: 500px) {
  body { padding: 1.5rem .75rem; }
  .card { padding: 1rem; }
}
