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

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface-2: #21262d;
  --border:    #30363d;
  --primary:   #58a6ff;
  --success:   #3fb950;
  --warning:   #d29922;
  --danger:    #f85149;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --subtle:    #484f58;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Nav ─────────────────────────────────────────────────────────────────── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.875rem;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--text); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.page-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 2.5rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
}

.card + .card { margin-top: 1.5rem; }

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.25rem;
  border-radius: 6px;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
  font-family: inherit;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { opacity: 0.88; }

.btn-surface { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-surface:hover:not(:disabled) { border-color: var(--muted); }

.btn-success { background: var(--success); color: #000; }
.btn-success:hover:not(:disabled) { opacity: 0.88; }

.btn-lg { padding: 0.8rem 2rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Status Badge ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: rgba(63,185,80,0.15); color: var(--success); }
.badge-warning { background: rgba(210,153,34,0.15); color: var(--warning); }
.badge-muted   { background: var(--surface-2); color: var(--muted); }

/* ── NFC Tap Zone ────────────────────────────────────────────────────────── */
.nfc-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  min-height: 260px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  text-align: center;
  padding: 2.5rem;
  transition: border-color 0.2s;
}

.nfc-zone.active {
  border-color: var(--primary);
  border-style: solid;
}

.nfc-zone.detected {
  border-color: var(--success);
  border-style: solid;
}

.nfc-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  transition: background 0.2s;
}

.nfc-zone.active .nfc-icon  { background: rgba(88,166,255,0.12); animation: pulse 1.8s infinite; }
.nfc-zone.detected .nfc-icon { background: rgba(63,185,80,0.12); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88,166,255,0.3); }
  50%       { box-shadow: 0 0 0 14px rgba(88,166,255,0); }
}

.nfc-label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.nfc-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.uid-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(63,185,80,0.1);
  color: var(--success);
  border: 1px solid rgba(63,185,80,0.3);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-weight: 600;
}

/* ── Drop Zone ───────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(88,166,255,0.04);
}

.drop-zone.has-file {
  border-color: var(--success);
  border-style: solid;
}

.drop-label { color: var(--muted); font-size: 0.875rem; margin-top: 0.5rem; }
.drop-hint  { color: var(--subtle); font-size: 0.8rem; margin-top: 0.25rem; }

/* ── File info ───────────────────────────────────────────────────────────── */
.file-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.file-icon { font-size: 1.75rem; flex-shrink: 0; }

.file-meta { flex: 1; min-width: 0; }
.file-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 0.8rem; color: var(--muted); }

/* ── Progress ────────────────────────────────────────────────────────────── */
.progress-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 1rem;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s;
  width: 0%;
}

.progress-fill.indeterminate {
  width: 40%;
  animation: indeterminate 1.2s infinite ease-in-out;
}

@keyframes indeterminate {
  0%   { transform: translateX(-200%); }
  100% { transform: translateX(350%); }
}

/* ── Result Box ──────────────────────────────────────────────────────────── */
.result-box {
  background: rgba(63,185,80,0.06);
  border: 1px solid rgba(63,185,80,0.25);
  border-radius: 8px;
  padding: 1.5rem;
}

.result-box.not-found {
  background: rgba(248,81,73,0.06);
  border-color: rgba(248,81,73,0.25);
}

.result-url {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  margin-top: 0.75rem;
}

.result-url a {
  flex: 1;
  color: var(--primary);
  text-decoration: none;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
  transition: color 0.15s;
  font-family: inherit;
}
.copy-btn:hover { color: var(--text); }

/* ── Envelope / Data Table ───────────────────────────────────────────────── */
.data-section { margin-top: 2rem; }

.data-section + .data-section { margin-top: 1.5rem; }

.data-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.data-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0;
}

.data-row {
  display: contents;
}

.data-row > * {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--surface-2);
  font-size: 0.85rem;
}

.data-key {
  color: var(--muted);
  padding-right: 1.5rem;
  white-space: nowrap;
}

.data-val {
  color: var(--text);
  word-break: break-all;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.data-val.readable { font-family: inherit; }

/* ── Hero (landing) ──────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 4rem 0 3rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
}

.hero-sub {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 520px;
  margin: 0 auto 3rem;
}

.hero-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: 620px;
  margin: 0 auto;
}

@media (max-width: 520px) {
  .hero-cards { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.8rem; }
  main { padding: 2rem 1rem; }
  .data-grid { grid-template-columns: 1fr; }
  .data-key { color: var(--subtle); font-size: 0.75rem; padding-bottom: 0; border-bottom: none; }
}

.hero-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem 1.5rem;
  text-decoration: none;
  color: var(--text);
  text-align: left;
  transition: border-color 0.15s, transform 0.15s;
}

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

.hero-card-icon { font-size: 1.8rem; margin-bottom: 1rem; }
.hero-card-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.3rem; }
.hero-card-desc  { font-size: 0.82rem; color: var(--muted); }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.text-muted   { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-center  { text-align: center; }

.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.85rem; }

.hash-display {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.error-msg {
  background: rgba(248,81,73,0.08);
  border: 1px solid rgba(248,81,73,0.25);
  border-radius: 6px;
  color: var(--danger);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

.step-indicator {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.step {
  height: 3px;
  flex: 1;
  border-radius: 2px;
  background: var(--surface-2);
  transition: background 0.3s;
}

.step.done    { background: var(--success); }
.step.active  { background: var(--primary); }
