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

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface2: #1a1a28;
  --border: #2a2a3a;
  --text: #e8e8f0;
  --text2: #8888a0;
  --primary: #4f7cff;
  --primary-glow: rgba(79, 124, 255, 0.3);
  --accent: #ff6b35;
  --accent2: #ffd700;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-weight: 800;
  font-size: 1.4rem;
}

.logo-402 {
  color: var(--accent);
  font-family: 'Courier New', monospace;
}

.logo-pizza {
  color: var(--text);
  letter-spacing: 2px;
}

.header-right { display: flex; gap: 8px; }

.protocol-badge, .network-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.protocol-badge {
  background: rgba(79, 124, 255, 0.15);
  color: var(--primary);
  border: 1px solid rgba(79, 124, 255, 0.3);
}

.network-badge {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Steps */
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 24px 0;
  flex-wrap: wrap;
}

.step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text2);
  font-weight: 500;
  transition: color 0.3s;
}

.step.active { color: var(--primary); }
.step.done { color: var(--green); }

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.step.active .step-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.step.done .step-num {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.step-line {
  width: 30px;
  height: 1px;
  background: var(--border);
  margin: 0 8px;
}

/* Panels */
.panel { display: none; padding: 30px 0; animation: fadeIn 0.4s ease; }
.panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero */
.hero { text-align: center; margin-bottom: 40px; }

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 1.05rem;
  color: var(--text2);
  max-width: 600px;
  margin: 0 auto;
}

/* How it works flow */
.how-it-works {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 40px;
  flex-wrap: wrap;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.flow-step {
  text-align: center;
  padding: 12px 16px;
}

.flow-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  margin: 0 auto 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-family: 'Courier New', monospace;
}

.flow-step:nth-child(1) .flow-icon { color: var(--text); }
.flow-step:nth-child(3) .flow-icon { color: var(--accent); background: rgba(255, 107, 53, 0.15); border-color: rgba(255, 107, 53, 0.3); }
.flow-step:nth-child(5) .flow-icon { color: var(--accent2); background: rgba(255, 215, 0, 0.15); border-color: rgba(255, 215, 0, 0.3); }
.flow-step:nth-child(7) .flow-icon { color: var(--green); background: rgba(34, 197, 94, 0.15); border-color: rgba(34, 197, 94, 0.3); }

.flow-label { font-size: 0.8rem; font-weight: 600; margin-bottom: 4px; }
.flow-step code { font-size: 0.65rem; color: var(--text2); }

.flow-arrow { color: var(--text2); font-size: 1.2rem; }

/* Input */
.input-group { max-width: 600px; margin: 0 auto; }
.input-group label { font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; display: block; }

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

.input-row input {
  flex: 1;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-row input:focus { border-color: var(--primary); }
.input-row input::placeholder { color: var(--text2); }

.hint { font-size: 0.8rem; color: var(--text2); margin-top: 8px; }

/* Buttons */
.btn-primary {
  padding: 12px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary:hover { background: #3d6ae8; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; }

.btn-glow {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  box-shadow: 0 0 20px var(--primary-glow);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 20px var(--primary-glow); }
  50% { box-shadow: 0 0 30px var(--primary-glow), 0 0 60px rgba(79, 124, 255, 0.15); }
}

.btn-secondary {
  padding: 12px 24px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* Loading */
.loading { text-align: center; padding: 40px; }
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Stores */
.stores-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.store-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.store-card:hover { border-color: var(--primary); transform: translateY(-2px); }

.store-card h3 { font-size: 1rem; margin-bottom: 4px; }
.store-card .store-addr { font-size: 0.85rem; color: var(--text2); margin-bottom: 8px; }
.store-card .store-meta { display: flex; gap: 12px; font-size: 0.8rem; color: var(--text2); }
.store-card .store-meta span { display: flex; align-items: center; gap: 4px; }
.store-open { color: var(--green) !important; font-weight: 600; }
.store-closed { color: var(--red) !important; font-weight: 600; }

.section-desc { color: var(--text2); margin-bottom: 20px; }

/* Menu */
.menu-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }

.category-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

.cat-tab {
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text2);
}

.cat-tab:hover { border-color: var(--text2); }
.cat-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.menu-grid { display: grid; gap: 12px; }

.menu-item {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.2s;
}

.menu-item:hover { border-color: var(--text2); }

.menu-item-info h4 { font-size: 0.9rem; margin-bottom: 2px; }
.menu-item-info p { font-size: 0.8rem; color: var(--text2); }
.menu-item-info .item-size { font-size: 0.75rem; color: var(--primary); margin-top: 2px; }

.menu-item-right { display: flex; align-items: center; gap: 12px; }
.menu-item-price { font-weight: 700; font-size: 0.95rem; color: var(--accent2); white-space: nowrap; }

.btn-add {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-add:hover { background: var(--primary); color: #fff; }

/* Cart */
.cart-section {
  position: sticky;
  top: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.cart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cart-header h3 { font-size: 1rem; }

.cart-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-items { flex: 1; overflow-y: auto; margin-bottom: 16px; min-height: 60px; }
.cart-empty { color: var(--text2); font-size: 0.85rem; text-align: center; padding: 20px 0; }

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.cart-item-name { flex: 1; }
.cart-item-price { font-weight: 600; margin: 0 12px; }

.btn-remove {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
}

.cart-footer { border-top: 1px solid var(--border); padding-top: 16px; }

.cart-total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 6px;
}

.cart-total.usdc { color: var(--green); font-size: 0.9rem; margin-bottom: 16px; }

/* Terminal */
.payment-flow { display: grid; grid-template-columns: 1fr 340px; gap: 24px; }

.terminal {
  background: #0d1117;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.terminal-bar {
  background: #161b22;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.green { background: var(--green); }
.terminal-title { margin-left: 10px; font-size: 0.8rem; color: var(--text2); }

.terminal-body {
  padding: 16px;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.8;
  max-height: 400px;
  overflow-y: auto;
}

.term-line { margin-bottom: 2px; }
.term-prompt { color: var(--green); margin-right: 8px; }
.term-info { color: var(--primary); }
.term-warn { color: var(--accent); }
.term-success { color: var(--green); }
.term-error { color: var(--red); }
.term-dim { color: var(--text2); }

/* Payment Summary */
.payment-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.payment-summary h3 { font-size: 1rem; margin-bottom: 16px; }
.payment-summary hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

.payment-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.payment-row.total {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--green);
  margin: 16px 0;
}

#payment-items { max-height: 200px; overflow-y: auto; }

.pay-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 4px 0;
  color: var(--text2);
}

/* Confirmation */
.confirmation { text-align: center; max-width: 600px; margin: 0 auto; }

.check-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.15);
  border: 2px solid var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--green);
  margin: 0 auto 20px;
  animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.order-id {
  font-family: 'Courier New', monospace;
  color: var(--primary);
  font-size: 1.1rem;
  margin-bottom: 20px;
}

.conf-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 30px;
  text-align: left;
}

.conf-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.9rem;
}

.conf-row .label { color: var(--text2); }

/* Tracker */
.tracker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 30px 0;
  flex-wrap: wrap;
}

.track-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.track-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border);
  transition: all 0.5s;
}

.track-stage.active .track-dot {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.track-stage span { font-size: 0.75rem; color: var(--text2); }
.track-stage.active span { color: var(--green); font-weight: 600; }

.track-line {
  width: 40px;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  margin-bottom: 24px;
  transition: background 0.5s;
}

.track-line.active { background: var(--green); }

/* Tx details */
.tx-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  text-align: left;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
}

.tx-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  gap: 12px;
}

.tx-label { color: var(--text2); white-space: nowrap; }
.tx-value { color: var(--green); word-break: break-all; text-align: right; }

/* Wallet */
.wallet-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  transition: all 0.2s;
  font-family: 'Courier New', monospace;
}

.wallet-btn:hover { background: rgba(79, 124, 255, 0.15); }
.wallet-btn.connected {
  background: rgba(34, 197, 94, 0.15);
  border-color: var(--green);
  color: var(--green);
  cursor: default;
}

.wallet-status {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--green);
}

.wallet-status.connected::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 4px;
  vertical-align: middle;
}

/* Live badge */
.live-badge {
  font-size: 0.65rem;
  color: var(--green);
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Error message */
.error-msg {
  color: var(--red);
  padding: 20px;
  text-align: center;
}

/* Item code */
.item-code {
  font-size: 0.7rem;
  color: var(--text2);
  font-family: 'Courier New', monospace;
  margin-top: 2px;
}

/* Category count */
.cat-count {
  font-size: 0.7rem;
  opacity: 0.6;
  margin-left: 2px;
}

/* Customer fields */
.customer-fields {
  margin: 16px 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.customer-fields h4 {
  font-size: 0.85rem;
  margin-bottom: 10px;
  color: var(--text2);
}

.customer-fields input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  margin-bottom: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.customer-fields input:focus { border-color: var(--primary); }
.customer-fields input::placeholder { color: var(--text2); }

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

.field-row input { flex: 1; }

/* Footer */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  font-size: 0.8rem;
  color: var(--text2);
}

footer a { color: var(--primary); text-decoration: none; }
footer a:hover { text-decoration: underline; }
.sep { margin: 0 8px; }
footer code { font-size: 0.75rem; color: var(--accent); }

/* Responsive */
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .how-it-works { flex-direction: column; gap: 4px; }
  .flow-arrow { transform: rotate(90deg); }
  .input-row { flex-direction: column; }
  .menu-layout { grid-template-columns: 1fr; }
  .cart-section { position: static; }
  .payment-flow { grid-template-columns: 1fr; }
  .steps { gap: 4px; }
  .step-line { width: 15px; margin: 0 4px; }
  footer { flex-direction: column; gap: 8px; text-align: center; }
}
