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

:root {
  --purple: #7c3aed;
  --purple-light: #a855f7;
  --ink: #1a1a2e;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 30%, #2d1b69 60%, #1a1a2e 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--ink);
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Top bar */
.topbar {
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
}
.brand { display: inline-flex; align-items: center; }
.brand-logo { height: 46px; filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.4)); }
.nav { display: flex; gap: 22px; }
.nav a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav a:hover { color: #fff; border-bottom-color: var(--purple-light); }

/* Store promo */
.promo-slot { max-width: 460px; margin: 16px auto 0; }
.promo {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.promo-head {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
  text-align: center;
}
.promo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 11px;
  padding: 10px 12px;
  margin-bottom: 9px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.promo-item:last-child { margin-bottom: 0; }
.promo-item:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4); }
.promo-thumb {
  width: 64px; height: 64px; flex-shrink: 0;
  object-fit: cover; border-radius: 8px; background: #eee;
}
.promo-text { flex: 1; min-width: 0; }
.promo-item-title {
  font-size: 14px; font-weight: 700; color: var(--ink);
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
}
.promo-item-title .arrow { color: var(--purple); flex-shrink: 0; }
.promo-item-sub { font-size: 12px; color: #777; margin-top: 2px; }
.promo-price { font-size: 13px; font-weight: 800; color: var(--purple); margin-top: 4px; }

/* Stage */
.stage {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 20px 40px;
}

/* Screens */
.screen { display: none; width: 100%; max-width: 460px; }
.screen.active { display: block; }

/* Card */
.card {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.35), 0 0 70px rgba(139, 92, 246, 0.18);
  text-align: center;
}
.card h2 { font-size: 20px; margin-bottom: 12px; }
.card p { font-size: 14px; line-height: 1.55; margin-bottom: 14px; color: #333; }
.muted { color: #888; }
.small { font-size: 12px; }
.hidden { display: none !important; }

.big-icon { font-size: 44px; margin-bottom: 12px; }
.big-icon.warn {
  width: 64px; height: 64px; line-height: 60px; margin: 0 auto 14px;
  border-radius: 50%; border: 3px solid #f59e0b; color: #f59e0b; font-weight: 800;
}

/* Buttons */
.btn {
  display: block; width: 100%;
  padding: 13px; border: none; border-radius: 11px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all 0.18s; margin-top: 10px;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: #fff; box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.btn-primary:hover { box-shadow: 0 6px 22px rgba(124, 58, 237, 0.5); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: #f1f1f5; color: #444; }
.btn-secondary:hover { background: #e6e6ec; }
.btn-text { background: none; color: #999; font-weight: 500; font-size: 13px; }
.btn-text:hover { color: #666; }
.btn-small { width: auto; padding: 9px 16px; font-size: 13px; margin: 0; }

.error { color: #ef4444; font-size: 13px; margin-top: 12px; }
.status-line { font-size: 13px; margin-top: 12px; min-height: 18px; }
.status-line.ok { color: #16a34a; }
.status-line.err { color: #ef4444; }

/* Board card */
.board-card {
  display: flex; align-items: center; gap: 16px;
  text-align: left; padding: 16px; margin-bottom: 18px;
  border: 1px solid #eee; border-radius: 14px; background: #faf8ff;
}
.board-logo { height: 56px; }
.board-name { font-size: 22px; font-weight: 800; color: var(--purple); }
.board-sub { font-size: 13px; color: #555; margin-top: 2px; }
.board-ver { font-size: 12px; color: #999; margin-top: 4px; }

.update-banner {
  background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46;
  border-radius: 10px; padding: 10px; font-size: 13px; margin-bottom: 14px; font-weight: 600;
}
.update-banner.uptodate { background: #f3f4f6; border-color: #ddd; color: #666; font-weight: 500; }

/* Config form */
.config-form { text-align: left; margin-bottom: 8px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: #444; margin-bottom: 6px; }
.field .hint { font-size: 11px; color: #999; font-weight: 400; }
.text-input, select {
  width: 100%; padding: 10px 12px; border: 2px solid #e2e2e8; border-radius: 9px;
  font-size: 14px; font-family: inherit; outline: none; transition: border-color 0.15s; background: #fff;
}
.text-input:focus, select:focus { border-color: var(--purple-light); }
.field-row { display: flex; gap: 8px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; }
.toggle-row label { margin: 0; }

/* switch */
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { display: none; }
.switch .slider {
  position: absolute; inset: 0; background: #ccc; border-radius: 24px; transition: 0.2s; cursor: pointer;
}
.switch .slider::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: 0.2s;
}
.switch input:checked + .slider { background: var(--purple); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* Advanced console */
.advanced { text-align: left; margin: 8px 0 4px; border-top: 1px solid #eee; padding-top: 12px; }
.advanced-toggle { background: none; border: none; color: var(--purple); font-weight: 600; font-size: 13px; cursor: pointer; padding: 4px 0; font-family: inherit; }
.adv-panel { margin-top: 10px; }
#adv-settings .field { margin-bottom: 12px; }
.console-block { margin-top: 14px; border-top: 1px solid #eee; padding-top: 12px; }
.console-label { font-size: 12px; font-weight: 600; color: #777; margin-bottom: 6px; }
.console-out {
  background: #1a1a2e; color: #d6d6e7; font-family: 'Consolas', monospace; font-size: 12px;
  border-radius: 8px; padding: 10px; height: 130px; overflow-y: auto; white-space: pre-wrap; margin-bottom: 8px;
}
.console-out .tx { color: #a855f7; }
.console-out .rx { color: #6ee7b7; }
.console-row { display: flex; gap: 8px; }

.row-actions { display: flex; gap: 10px; margin-top: 18px; }
.row-actions .btn { margin-top: 0; }

/* Update */
.version-row { text-align: left; margin: 8px 0 4px; }
.version-row label { display: block; font-size: 13px; font-weight: 600; color: #444; margin-bottom: 6px; }
.flash-status { padding: 18px 0; }
#update-text { font-size: 16px; font-weight: 600; }
.flash-status .ok { color: #16a34a; }
.flash-status .err { color: #ef4444; }
.progress { margin: 16px 0; }
.progress-bar { height: 9px; background: #eee; border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--purple), var(--purple-light)); transition: width 0.25s; }

/* Proactive info note (e.g. Windows driver heads-up) */
.info-note {
  text-align: left;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.5;
  color: #1e3a5f;
}
.info-note a { color: var(--purple); font-weight: 600; }

/* Help box */
.help-box {
  text-align: left; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 12px;
  padding: 16px; margin: 14px 0;
}
.help-box h3 { font-size: 15px; margin-bottom: 10px; color: #92400e; }
.help-box ol { margin: 0 0 12px 18px; font-size: 13px; line-height: 1.6; color: #5b4a1a; }
.help-box a { color: var(--purple); font-weight: 600; }
.help-box code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 12px; }

.footer { color: rgba(255,255,255,0.35); font-size: 11px; font-weight: 600; letter-spacing: 2px; padding: 16px; }
