@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

#pixq-root, #pixq-root * { box-sizing: border-box; }

#pixq-root {
  --bg: #14171a;
  --panel: #1b1f24;
  --panel-2: #20252b;
  --border: #2c3138;
  --text: #f2f1ec;
  --text-muted: #8b919a;
  --accent: #2fbf9f;
  --accent-soft: rgba(47,191,159,0.14);
  --accent-strong: #45e0bd;
  --warn: #e8a33d;
  --warn-soft: rgba(232,163,61,0.14);
  --danger: #e1614a;
  --danger-soft: rgba(225,97,74,0.14);
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  width: 100%;
  padding: 28px 16px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

@media (prefers-reduced-motion: reduce) {
  #pixq-root * { transition: none !important; animation: none !important; }
}

#pixq-root button { font-family: var(--font-body); cursor: pointer; }
#pixq-root :focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }

/* ---------- Header ---------- */
.pixq-header {
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.pixq-brand { display: flex; align-items: center; gap: 10px; }
.pixq-brand svg { display: block; }
.pixq-brand span {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}
.pixq-brand small {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 1px;
}
.pixq-header-right { display: flex; align-items: center; gap: 10px; }
.pixq-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid rgba(47,191,159,0.35);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}
.pixq-menu-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.pixq-menu-btn:hover { color: var(--text); border-color: var(--accent); }
.pixq-menu-wrap { position: relative; }
.pixq-menu-dropdown {
  position: absolute;
  right: 0; top: 40px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 170px;
  overflow: hidden;
  z-index: 20;
  box-shadow: 0 12px 28px rgba(0,0,0,0.4);
  display: none;
}
.pixq-menu-dropdown.open { display: block; }
.pixq-menu-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  padding: 10px 14px;
}
.pixq-menu-dropdown button:hover { background: var(--panel); }
.pixq-menu-dropdown button.danger { color: var(--danger); }

/* ---------- Shared layout ---------- */
.pixq-view { width: 100%; max-width: 720px; }
.pixq-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--accent-strong);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.pixq-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  margin: 0 0 6px;
}
.pixq-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 28px;
  line-height: 1.5;
}

/* ---------- Setup view ---------- */
.pixq-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.key-row {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: start;
}
.key-row-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  padding-top: 9px;
  text-align: center;
}
.key-row-fields { display: flex; flex-direction: column; gap: 6px; }
.label-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-body);
  padding: 3px 2px;
  width: 100%;
}
.label-input::placeholder { color: var(--text-muted); }
.label-input:focus { border-bottom-color: var(--border); }
.code-input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 10px;
  resize: vertical;
  min-height: 40px;
  width: 100%;
  line-height: 1.5;
}
.code-input::placeholder { color: var(--text-muted); }
.code-input:focus { border-color: var(--accent); }
.row-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  padding: 6px;
  border-radius: 6px;
}
.row-delete:hover { color: var(--danger); background: var(--danger-soft); }

.pixq-add-btn {
  width: 100%;
  background: var(--panel);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 22px;
}
.pixq-add-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-strong); }
.pixq-add-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.pixq-bulk {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  margin-bottom: 24px;
  overflow: hidden;
}
.pixq-bulk-toggle {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pixq-bulk-toggle .chev { color: var(--text-muted); transition: transform 0.15s ease; }
.pixq-bulk-toggle.open .chev { transform: rotate(180deg); }
.pixq-bulk-body { display: none; padding: 0 14px 14px; }
.pixq-bulk-body.open { display: block; }
.pixq-bulk-body p { font-size: 12px; color: var(--text-muted); margin: 0 0 8px; }
.pixq-bulk textarea {
  width: 100%;
  min-height: 90px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px;
  margin-bottom: 10px;
}
.pixq-btn-secondary {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
}
.pixq-btn-secondary:hover { border-color: var(--accent); }

.pixq-cta-bar {
  position: sticky;
  bottom: 12px;
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.pixq-cta {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: #0d1210;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  padding: 15px 30px;
  box-shadow: 0 10px 30px rgba(47,191,159,0.25);
  width: 100%;
  max-width: 400px;
}
.pixq-cta:hover:not(:disabled) { background: var(--accent-strong); }
.pixq-cta:disabled { background: var(--panel-2); color: var(--text-muted); box-shadow: none; cursor: not-allowed; }
.pixq-cta-hint { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 10px; }

/* ---------- Queue view ---------- */
.pixq-led-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 20px 18px;
  text-align: center;
  margin-bottom: 18px;
  background-image: repeating-linear-gradient(180deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 3px);
}
.pixq-led-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.pixq-led-number {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 56px;
  line-height: 1;
  color: var(--accent-strong);
  text-shadow: 0 0 18px rgba(69,224,189,0.35);
}
.pixq-led-number span { color: var(--text-muted); font-size: 28px; text-shadow: none; }

.pixq-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 14px;
}
.pixq-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  padding: 0;
  cursor: pointer;
}
.pixq-dot.confirmed { background: var(--accent); }
.pixq-dot.skipped { background: var(--warn); }
.pixq-dot.current { box-shadow: 0 0 0 3px var(--accent-soft); background: var(--accent-strong); }

.ticket-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 420px;
  margin: 0 auto 22px;
  overflow: visible;
}
.ticket-top { padding: 20px 22px 18px; text-align: center; }
.ticket-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  margin: 0 0 2px;
}
.ticket-sub { font-size: 12px; color: var(--text-muted); }

.ticket-divider { position: relative; height: 0; border-top: 2px dashed var(--border); margin: 0 18px; }
.ticket-divider::before, .ticket-divider::after {
  content: ''; position: absolute; top: -9px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--bg);
}
.ticket-divider::before { left: -27px; }
.ticket-divider::after { right: -27px; }

.ticket-body { padding: 22px; display: flex; flex-direction: column; align-items: center; }
.qr-frame {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.qr-frame svg { width: 100%; height: 100%; display: block; }
.qr-fallback {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #b3392c;
  text-align: center;
  line-height: 1.5;
}

.code-box {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
  max-height: 70px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.copy-btn {
  background: var(--accent-soft);
  border: 1px solid rgba(47,191,159,0.35);
  color: var(--accent-strong);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  width: 100%;
}
.copy-btn:hover { background: rgba(47,191,159,0.22); }
.copy-btn.copied { background: var(--accent); color: #0d1210; border-color: var(--accent); }

.pixq-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
}
.pixq-actions .full { grid-column: 1 / -1; }
.act-back {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 12px;
  padding: 13px;
  font-size: 13px;
  font-weight: 500;
}
.act-back:hover { color: var(--text); border-color: var(--text-muted); }
.act-skip {
  background: var(--warn-soft);
  border: 1px solid rgba(232,163,61,0.4);
  color: var(--warn);
  border-radius: 12px;
  padding: 13px;
  font-size: 13px;
  font-weight: 500;
}
.act-skip:hover { background: rgba(232,163,61,0.24); }
.act-confirm {
  background: var(--accent);
  border: none;
  color: #0d1210;
  border-radius: 12px;
  padding: 15px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(47,191,159,0.25);
}
.act-confirm:hover { background: var(--accent-strong); }
.act-back:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------- Done view ---------- */
.done-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 460px;
  margin: 0 auto;
  padding: 32px 26px;
  text-align: center;
}
.done-card .pixq-eyebrow { justify-content: center; display: flex; }
.done-stat {
  font-family: var(--font-mono);
  font-size: 40px;
  color: var(--accent-strong);
  margin: 6px 0 4px;
}
.done-stat span { color: var(--text-muted); font-size: 20px; }
.done-breakdown { font-size: 13px; color: var(--text-muted); margin-bottom: 22px; }
.done-breakdown b { color: var(--text); }
.skipped-list {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}
.skipped-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; font-size: 12px; border-bottom: 1px solid var(--border);
}
.skipped-row:last-child { border-bottom: none; }
.skipped-row span:first-child { color: var(--text); }
.skipped-row span:last-child { color: var(--text-muted); font-family: var(--font-mono); }
.done-actions { display: flex; flex-direction: column; gap: 10px; }

.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 14px;
}

/* ---------- Home / Queue selector view ---------- */
.home-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 18px;
  text-align: center;
}
.home-card-icon {
  width: 48px; height: 48px;
  background: var(--accent-soft);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.home-card-icon svg { color: var(--accent-strong); }

.queue-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.queue-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.15s;
}
.queue-card:hover { border-color: var(--accent); }
.queue-card-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.queue-card-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-card-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.queue-card-right { display: flex; gap: 6px; align-items: center; margin-left: 12px; }
.queue-card-status {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.queue-card-status.setup { background: var(--accent-soft); color: var(--accent-strong); }
.queue-card-status.queue { background: var(--warn-soft); color: var(--warn); }
.queue-card-status.done { background: rgba(47,191,159,0.25); color: var(--accent-strong); }
.queue-del-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  width: 30px; height: 30px;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.queue-del-btn:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

.pixq-new-queue-input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  width: 100%;
  margin-bottom: 12px;
}
.pixq-new-queue-input::placeholder { color: var(--text-muted); }
.pixq-new-queue-input:focus { border-color: var(--accent); outline: none; }

/* ---------- Back nav ---------- */
.pixq-back-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 18px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.pixq-back-nav:hover { color: var(--text); }
.pixq-back-nav svg { width: 16px; height: 16px; }

@media (max-width: 480px) {
  .pixq-led-number { font-size: 44px; }
  .qr-frame { width: 180px; height: 180px; }
  .pixq-title { font-size: 23px; }
}
