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

:root {
  --bg: #121417;
  --surface: #1B1E24;
  --surface-2: #232730;
  --accent: #FFB627;
  --confirm: #37D67A;
  --danger: #FF6B4A;
  --text: #F4F5F0;
  --text-dim: #8A8F99;
  --border: #2E323B;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  height: 100%;
}

body {
  display: flex;
  justify-content: center;
  padding: clamp(12px, 3vw, 28px);
  padding-top: max(clamp(12px, 3vw, 28px), env(safe-area-inset-top));
  padding-bottom: max(clamp(12px, 3vw, 28px), env(safe-area-inset-bottom));
  min-height: 100vh;
}

button {
  font-family: inherit;
  cursor: pointer;
}

button:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.hidden { display: none !important; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.speaking-dot { color: var(--confirm); animation: pulse 1s ease-in-out infinite; }

/* ---------- setup screen ---------- */

#setup-screen {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 4vh;
  padding-bottom: 4vh;
}

.eyebrow {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

h1 {
  font-family: 'Archivo Black', sans-serif;
  font-size: clamp(28px, 6vw, 40px);
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
}

.subtitle { color: var(--text-dim); font-size: 15px; line-height: 1.5; margin: 0; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.dropzone.drag-over { border-color: var(--accent); background: #1F1A0F; }
.dropzone-icon { font-size: 32px; margin-bottom: 4px; }
.dropzone-title { font-size: 16px; font-weight: 700; }
.dropzone-hint { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.link-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  text-decoration: underline;
  align-self: flex-start;
  padding: 0;
}

.error-box {
  background: #2A1616;
  border: 1px solid #5A2020;
  color: var(--danger);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
}

textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  padding: 16px;
  line-height: 1.6;
  resize: vertical;
}

.preview-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
}
.preview-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-family: 'IBM Plex Mono', monospace;
}
.preview-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px dashed var(--border);
  font-size: 14px;
}
.preview-row:first-child { border-top: none; }
.preview-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-code { color: var(--text-dim); font-family: 'IBM Plex Mono', monospace; }
.preview-qty { color: var(--accent); font-weight: 700; min-width: 42px; text-align: right; }
.preview-debug {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
}

.warning-box {
  background: #2A2016;
  border: 1px solid #5A4420;
  color: var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
}

.primary-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 14px;
  padding: 18px 24px;
  font-size: 18px;
  font-weight: 800;
  min-height: 64px;
}
.primary-btn:disabled { opacity: 0.5; pointer-events: none; }

.footer-link {
  align-self: center;
  color: var(--text-dim);
  font-size: 12px;
  text-decoration: none;
  margin-top: 4px;
}
.footer-link:hover { color: var(--accent); }

/* ---------- picking screen ---------- */

#picking-screen {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.top-bar { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 10px;
  width: 44px;
  height: 44px;
  font-size: 16px;
}
.progress-track {
  flex: 1;
  height: 8px;
  background: var(--surface);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.item-counter {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-align: center;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px 24px;
  min-height: 38vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.card-tab {
  position: absolute;
  top: 18px;
  left: 24px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: 6px;
}
.card-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-top: 24px;
  margin-bottom: 10px;
}
.card-name {
  font-size: clamp(26px, 6.5vw, 38px);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
  word-break: break-word;
}
.card-divider { border-top: 1px dashed var(--border); margin: 4px 0 22px; }
.card-meta-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.code-chip { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; }
.code-chip-label { font-size: 11px; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 4px; }
.code-chip-value { font-family: 'IBM Plex Mono', monospace; font-size: 20px; font-weight: 600; }
.qty-block { text-align: right; }
.qty-number { font-family: 'Archivo Black', sans-serif; font-size: clamp(48px, 12vw, 72px); color: var(--accent); line-height: 1; }
.qty-label { font-size: 12px; letter-spacing: 0.1em; color: var(--text-dim); margin-top: 4px; }

.controls-secondary { display: flex; gap: 10px; }
.secondary-btn {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  padding: 0 16px;
  font-size: 16px;
  font-weight: 600;
  min-height: 60px;
}
.secondary-btn:disabled { opacity: 0.35; pointer-events: none; }
.controls { display: flex; gap: 10px; }
.next-btn {
  flex: 1;
  background: var(--confirm);
  color: #0C1A11;
  border: none;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 800;
  min-height: 68px;
}

/* ---------- done screen ---------- */

#done-screen {
  margin: auto;
  text-align: center;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.done-check {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #1B2E22;
  color: var(--confirm);
  font-size: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.done-title { font-family: 'Archivo Black', sans-serif; font-size: 26px; margin: 0; }
.done-subtitle { color: var(--text-dim); margin-bottom: 16px; }
