/* WebAI Badge Studio — "Four-Ink Hardware Lab" Design System */
:root {
  --bg-obsidian: #0d0f13;
  --bg-pcb: #141820;
  --bg-card: #181d27;
  --bg-elevated: #202735;
  --border-hairline: #283142;
  --border-bright: #3b4760;

  /* Exact 4 Hardware ePaper Inks */
  --ink-black: #000000;
  --ink-white: #ffffff;
  --ink-yellow: #ffcc33;
  --ink-red: #db3727;

  /* Text Hierarchy */
  --text-primary: #f4f5f8;
  --text-secondary: #9ba5b7;
  --text-muted: #647087;

  /* Hardware Status Accents */
  --led-active: #2563eb;
  --led-emerald: #10b981;
  --led-blue: #3b82f6;

  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

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

html,
body {
  min-height: 100%;
  background-color: var(--bg-obsidian);
  background-image:
    radial-gradient(circle at 18% 20%, rgba(255, 204, 51, 0.045), transparent 36%),
    radial-gradient(circle at 82% 14%, rgba(219, 55, 39, 0.05), transparent 38%),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px, 28px 28px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  padding-bottom: 48px;
}

/* Top Telemetry Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 22px;
  background: rgba(13, 15, 19, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-hairline);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-led {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--ink-yellow);
  box-shadow: 0 0 10px var(--ink-yellow);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.brand-led.connected {
  background: var(--led-emerald);
  box-shadow: 0 0 12px var(--led-emerald);
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.03em;
  color: var(--ink-white);
}

.brand-sep {
  color: var(--ink-red);
  margin: 0 4px;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 7px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11.5px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--ink-yellow), #f5b400);
  color: #0b0d11;
  border-color: #ffd859;
  box-shadow: 0 2px 12px rgba(255, 204, 51, 0.22);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255, 204, 51, 0.35);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-bright);
}

.btn-secondary:hover {
  border-color: var(--ink-yellow);
  color: var(--ink-yellow);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border-color: var(--border-hairline);
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--border-bright);
  background: rgba(255, 255, 255, 0.06);
}

.btn-ai {
  background: rgba(219, 55, 39, 0.14);
  color: #ff9c91;
  border-color: rgba(219, 55, 39, 0.45);
}

.btn-ai.active {
  background: var(--ink-red);
  color: var(--ink-white);
  border-color: #ff7c6e;
  box-shadow: 0 0 14px rgba(219, 55, 39, 0.4);
}

.btn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.btn-dot.usb {
  background: var(--ink-yellow);
}
.btn-dot.ble {
  background: var(--led-blue);
}

/* Main Split Grid */
.workbench {
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 22px 32px;
  display: grid;
  grid-template-columns: minmax(380px, 520px) minmax(460px, 1fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .workbench {
    grid-template-columns: 1fr;
  }
}

/* Left Column: Physical PCB Stage */
.stage-column {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 1024px) {
  .stage-column {
    position: static;
  }
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-pcb);
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-hairline);
}

.stage-mode-group {
  display: flex;
  gap: 4px;
}

.pill-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  padding: 5px 10px;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.pill-btn.active {
  background: var(--bg-elevated);
  color: var(--ink-yellow);
  border-color: rgba(255, 204, 51, 0.35);
}

.loupe-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* Physical PCB Enclosure */
.pcb-stage-wrap {
  display: flex;
  justify-content: center;
}

.pcb-board {
  position: relative;
  width: 100%;
  max-width: 448px;
  background: linear-gradient(160deg, #161b24 0%, #0f131a 100%);
  border: 2px solid #2b3548;
  border-radius: 22px;
  padding: 14px 20px 16px;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.pcb-top-edge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.lanyard-slot {
  width: 38px;
  height: 9px;
  background: var(--bg-obsidian);
  border: 1px solid #354156;
  border-radius: 99px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
}

.pcb-silkscreen-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: #8b97ad;
}

.pcb-fiducial {
  color: var(--ink-yellow);
  font-size: 9px;
}

/* Perimeter NeoPixels */
.neopixel {
  position: absolute;
  width: 8px;
  height: 14px;
  border-radius: 3px;
  background: var(--led-active);
  box-shadow: 0 0 14px var(--led-active), 0 0 28px var(--led-active);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.np-tl { left: -4px; top: 18%; }
.np-ml { left: -4px; top: 50%; }
.np-bl { left: -4px; top: 82%; }
.np-tr { right: -4px; top: 18%; }
.np-mr { right: -4px; top: 50%; }
.np-br { right: -4px; top: 82%; }

/* 480x800 ePaper Bezel */
.epaper-bezel {
  position: relative;
  width: 100%;
  aspect-ratio: 480 / 800;
  background: #000000;
  border-radius: 12px;
  border: 3px solid #252e3f;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  cursor: crosshair;
}

#badgePreviewCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.epaper-refresh-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.epaper-refresh-flash.flashing {
  animation: epaperRefresh 0.65s ease-in-out;
}

@keyframes epaperRefresh {
  0% { opacity: 0; background: #000; }
  25% { opacity: 0.85; background: #fff; mix-blend-mode: difference; }
  55% { opacity: 0.65; background: #ffcc33; mix-blend-mode: hard-light; }
  100% { opacity: 0; }
}

/* Floating 8x Pixel Dither Loupe */
.pixel-loupe {
  position: absolute;
  width: 132px;
  background: rgba(13, 15, 19, 0.94);
  border: 2px solid var(--ink-yellow);
  border-radius: 10px;
  padding: 4px;
  pointer-events: none;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.8);
  z-index: 20;
}

#loupeCanvas {
  width: 120px;
  height: 120px;
  display: block;
  border-radius: 6px;
  image-rendering: pixelated;
}

.loupe-meta {
  margin-top: 3px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-yellow);
  white-space: nowrap;
}

/* Bottom Hardware Tactile Buttons */
.pcb-bottom-edge {
  margin-top: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hw-tactile-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1d2432;
  border: 1px solid #39465e;
  border-radius: 6px;
  padding: 5px 9px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.hw-tactile-btn:hover {
  border-color: var(--ink-yellow);
}

.hw-tactile-btn:active {
  transform: scale(0.96);
}

.hw-cap {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-red);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

.pcb-serial-stamp {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  text-align: center;
}

/* 4-Ink Telemetry Strip */
.ink-telemetry-card {
  background: var(--bg-pcb);
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  padding: 10px 14px;
}

.ink-bar-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.mono-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-secondary);
}

.ink-meter-bar {
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  display: flex;
  background: #000;
  border: 1px solid var(--border-bright);
}

.ink-seg {
  height: 100%;
  transition: width 0.25s ease;
}
.ink-black { background: var(--ink-black); }
.ink-white { background: var(--ink-white); }
.ink-yellow { background: var(--ink-yellow); }
.ink-red { background: var(--ink-red); }

.ink-legend {
  margin-top: 7px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 3px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.s-black { background: var(--ink-black); }
.s-white { background: var(--ink-white); }
.s-yellow { background: var(--ink-yellow); }
.s-red { background: var(--ink-red); }

/* Right Column: Studio Tabs & Cards */
.controls-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.studio-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: var(--bg-pcb);
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border-hairline);
}

@media (max-width: 680px) {
  .studio-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}

.tab-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-elevated);
  color: var(--ink-yellow);
  border-color: rgba(255, 204, 51, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.tab-badge {
  display: inline-block;
  background: var(--ink-red);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: 4px;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.tab-panel.active {
  display: flex;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--ink-white);
}

.card-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.badge-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-yellow);
  background: rgba(255, 204, 51, 0.1);
  border: 1px solid rgba(255, 204, 51, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.photo-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.webcam-drawer {
  margin-bottom: 14px;
  background: #000;
  border: 1px solid var(--border-bright);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

#webcamVideo {
  width: 100%;
  max-height: 260px;
  border-radius: 8px;
  background: #0a0c10;
}

.webcam-controls {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}

.field-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.link-btn {
  background: none;
  border: none;
  color: var(--ink-yellow);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
}

/* Preset & Mode Grids */
.preset-grid,
.dither-mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 14px;
}

@media (max-width: 680px) {
  .preset-grid,
  .dither-mode-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.preset-chip,
.mode-chip,
.fmt-chip,
.second-tpl-chip {
  background: var(--bg-pcb);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
  border-radius: 7px;
  padding: 8px 10px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.preset-chip:hover,
.mode-chip:hover,
.fmt-chip:hover,
.second-tpl-chip:hover {
  border-color: var(--border-bright);
  color: var(--text-primary);
}

.preset-chip.active,
.mode-chip.active,
.fmt-chip.active,
.second-tpl-chip.active {
  background: rgba(255, 204, 51, 0.13);
  color: var(--ink-yellow);
  border-color: var(--ink-yellow);
}

/* Sliders */
.sliders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.slider-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-pcb);
  padding: 8px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-hairline);
}

.slider-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.slider-head code {
  font-family: var(--font-mono);
  color: var(--ink-yellow);
}

input[type='range'] {
  width: 100%;
  accent-color: var(--ink-yellow);
  cursor: pointer;
}

/* Text Inputs */
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (max-width: 680px) {
  .form-grid-3,
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-group > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

input[type='text'],
input[type='url'],
input[type='email'],
input[type='number'],
input[type='search'] {
  width: 100%;
  background: var(--bg-pcb);
  border: 1px solid var(--border-bright);
  border-radius: 7px;
  padding: 9px 11px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease;
}

input:focus {
  border-color: var(--ink-yellow);
}

/* QR Pills */
.qr-mode-pills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.qr-pill {
  background: var(--bg-pcb);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
  border-radius: 6px;
  padding: 5px 10px;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.qr-pill.active {
  background: var(--ink-red);
  color: var(--ink-white);
  border-color: #ff6e5e;
}

/* LED Swatches */
.led-swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.led-chip {
  background: var(--bg-pcb);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
  border-radius: 6px;
  padding: 6px 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.led-chip::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 8px var(--c);
}

.led-chip.active {
  border-color: var(--ink-white);
  color: var(--ink-white);
  background: var(--bg-elevated);
}

/* Code Inspector */
.code-inspector-box {
  margin: 14px 0;
  background: #0b0d12;
  border: 1px solid var(--border-hairline);
  border-radius: 8px;
  overflow: hidden;
}

.code-inspector-head {
  display: flex;
  justify-content: space-between;
  padding: 7px 12px;
  background: var(--bg-pcb);
  border-bottom: 1px solid var(--border-hairline);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

#bootcdeCodePreview {
  padding: 11px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #a5f3fc;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.wifi-pass-wrap {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.wifi-pass-wrap input {
  flex: 1;
}

.wifi-pass-wrap .btn {
  padding: 0 10px;
  font-size: 14px;
}

.action-bar-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Connections Network Graph & Table */
.network-graph-wrap {
  margin-bottom: 12px;
  background: #0b0e14;
  border: 1px solid var(--border-hairline);
  border-radius: 9px;
  overflow: hidden;
}

#networkGraphCanvas {
  width: 100%;
  height: 190px;
  display: block;
}

.conn-filter-row {
  margin-bottom: 10px;
}

.conn-table-wrap {
  max-height: 310px;
  overflow-y: auto;
  border: 1px solid var(--border-hairline);
  border-radius: 8px;
}

.conn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.conn-table th,
.conn-table td {
  padding: 8px 11px;
  text-align: left;
  border-bottom: 1px solid var(--border-hairline);
}

.conn-table th {
  position: sticky;
  top: 0;
  background: var(--bg-pcb);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.conn-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.conn-link {
  color: var(--ink-yellow);
  text-decoration: none;
  margin-right: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.conn-link:hover {
  text-decoration: underline;
}

/* Bottom REPL & Flash Progress Drawer */
.console-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(12, 14, 19, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-bright);
}

.console-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 20px;
  cursor: pointer;
}

.console-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-secondary);
}

.console-prompt {
  color: var(--ink-yellow);
  font-weight: 700;
}

.flash-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 420px;
}

.flash-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
}

.flash-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ink-yellow), var(--ink-red));
  transition: width 0.12s linear;
}

.flash-progress-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-yellow);
  min-width: 42px;
}

.console-body {
  border-top: 1px solid var(--border-hairline);
  padding: 10px 20px 12px;
}

.console-logs {
  height: 165px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: #07090c;
  border: 1px solid var(--border-hairline);
  border-radius: 7px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.log-line {
  margin-bottom: 3px;
  line-height: 1.4;
}
.log-time { color: var(--text-muted); margin-right: 6px; }
.log-info { color: var(--text-secondary); }
.log-cmd { color: var(--ink-yellow); }
.log-ok { color: var(--led-emerald); }
.log-warn { color: #f87171; }

.console-input-row {
  display: flex;
  gap: 8px;
}

/* LiteRT-LM & MediaPipe WebGPU AI Badge Designer Card */
.ai-designer-card {
  border-color: rgba(255, 204, 51, 0.35);
  background:
    radial-gradient(circle at 95% 8%, rgba(219, 55, 39, 0.12), transparent 45%),
    radial-gradient(circle at 8% 92%, rgba(255, 204, 51, 0.09), transparent 50%),
    var(--bg-card);
}

.ai-stack-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-black);
  background: var(--ink-yellow);
  border-radius: 99px;
  vertical-align: middle;
}

.ai-model-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.ai-model-select {
  flex: 1;
  min-width: 240px;
  background: var(--bg-obsidian);
  color: var(--text-primary);
  border: 1px solid var(--border-bright);
  border-radius: 7px;
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.ai-progress-wrap:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}

.ai-progress-bar {
  flex: 1;
  height: 7px;
  background: var(--bg-obsidian);
  border: 1px solid var(--border-hairline);
  border-radius: 99px;
  overflow: hidden;
}

.ai-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ink-yellow), var(--ink-red));
  transition: width 0.15s ease;
}

.ai-progress-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-yellow);
  white-space: nowrap;
}

.ai-vibe-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.ai-vibe-chip {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
  border-radius: 99px;
  padding: 5px 10px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.ai-vibe-chip:hover,
.ai-vibe-chip.active {
  color: var(--text-primary);
  border-color: var(--ink-yellow);
  background: rgba(255, 204, 51, 0.14);
}

.ai-prompt-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.ai-prompt-input {
  flex: 1;
  background: var(--bg-obsidian);
  color: var(--text-primary);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: var(--font-sans);
  font-size: 12.5px;
}

.ai-prompt-input:focus {
  outline: none;
  border-color: var(--ink-yellow);
}

.btn-ai-generate {
  background: linear-gradient(135deg, var(--ink-yellow), #f59e0b);
  color: #000000;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12.5px;
  padding: 9px 15px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(255, 204, 51, 0.22);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-ai-generate:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 204, 51, 0.35);
}

.btn-ai-generate:disabled {
  opacity: 0.6;
  cursor: wait;
}

.ai-visual-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-hairline);
}

.ai-sub-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ai-mini-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ai-theme-pill,
.ai-backdrop-pill {
  background: var(--bg-obsidian);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
  border-radius: 6px;
  padding: 4px 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.ai-theme-pill:hover,
.ai-backdrop-pill:hover {
  border-color: var(--border-bright);
  color: var(--text-primary);
}

.ai-theme-pill.active,
.ai-backdrop-pill.active {
  background: rgba(219, 55, 39, 0.2);
  border-color: var(--ink-yellow);
  color: var(--ink-yellow);
  font-weight: 700;
}

.ai-reasoning-box:not([hidden]) {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.42);
  border-left: 3px solid var(--ink-yellow);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.ai-reasoning-label {
  color: var(--ink-yellow);
  font-weight: 700;
  margin-right: 6px;
}

.ai-ink-pill {
  background: var(--bg-obsidian);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
  border-radius: 6px;
  padding: 4px 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.ai-ink-pill[data-aiink='yellow'].active {
  border-color: var(--ink-yellow);
  color: var(--ink-yellow);
  font-weight: 700;
}

.ai-ink-pill[data-aiink='red'].active {
  border-color: var(--ink-red);
  color: var(--ink-red);
  font-weight: 700;
}

.ai-ink-pill[data-aiink='white'].active {
  border-color: #ffffff;
  color: #ffffff;
  font-weight: 700;
}

.ai-customize-row:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px dashed var(--border-hairline);
  border-radius: 8px;
}

.ai-customize-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 8px;
}

/* Drag-to-pan cursor over photo box */
.epaper-bezel.panning {
  cursor: grabbing;
}

.epaper-bezel.pan-ready {
  cursor: grab;
}

/* NeoPixel WS2812B chase animation (opt-in pulse class) */
.neopixel {
  transition: box-shadow 0.12s ease, background-color 0.12s ease;
}

.neopixel.chase {
  animation: neopixel-chase 0.72s ease-out;
  animation-fill-mode: none;
}

@keyframes neopixel-chase {
  0% {
    background-color: var(--led-active);
    box-shadow: 0 0 14px 3px var(--led-active);
    transform: scale(1.5);
  }
  100% {
    box-shadow: none;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .neopixel.chase {
    animation: none;
  }
}
