/* ===========================================================
   airdrop4all · technical/industrial dark theme
   =========================================================== */

:root {
  --bg:           #0a0e14;
  --bg-elev:      #11161f;
  --bg-elev-2:    #1a212e;
  --line:         #2a3340;
  --line-strong:  #3a4658;

  --fg:           #e4e7ec;
  --fg-dim:       #8a95a5;
  --fg-faint:     #5a6577;

  --accent:       #c5f24a;   /* sharp lime */
  --accent-dim:   #8aaa30;
  --accent-ink:   #0a0e14;
  --warn:         #ff7849;
  --ok:           #4ade80;

  --mono:         'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sans:         'IBM Plex Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  --radius:       4px;
  --radius-lg:    8px;
}

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

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

/* dot-grid background */
.grid-bg {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.04) 1px, transparent 0);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 30%, transparent 80%);
}

#app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 22px 18px;
  box-shadow:
    0 0 0 1px rgba(197, 242, 74, 0.02),
    0 30px 60px -20px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
}

/* ============ Brand ============ */
.brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px dashed var(--line);
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-a { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dot-b { background: var(--fg-dim); }
.logo-text { margin-left: 2px; }
.tagline {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ============ Screens ============ */
.screen { display: none; flex-direction: column; gap: 16px; }
.screen.active { display: flex; animation: fade-in 0.3s ease; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

h1 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--fg);
}
h2 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.lede {
  color: var(--fg-dim);
  font-size: 15px;
  line-height: 1.55;
  max-width: 38ch;
}

.step-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.step-tag {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(197, 242, 74, 0.08);
  border: 1px solid rgba(197, 242, 74, 0.25);
  padding: 4px 8px;
  border-radius: var(--radius);
}
.step-tag.done-tag {
  color: var(--ok);
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.3);
}
.step-tag.err-tag {
  color: var(--warn);
  background: rgba(255, 120, 73, 0.08);
  border-color: rgba(255, 120, 73, 0.3);
}

/* ============ Buttons ============ */
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 18px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
  -webkit-appearance: none;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn-primary:hover { background: #d8ff5d; }

.btn-secondary {
  background: var(--bg-elev-2);
  color: var(--fg);
  border-color: var(--line-strong);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  font-size: 13px;
  padding: 12px 14px;
  justify-content: center;
}
.btn-ghost:hover { color: var(--fg); border-color: var(--line-strong); }

.btn-arrow { font-size: 16px; opacity: 0.7; }
.btn-primary .btn-arrow { opacity: 0.85; }

/* ============ How-to ============ */
.how-to {
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.how-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
}
.how-step .num {
  color: var(--accent);
  font-weight: 700;
}

/* ============ File input ============ */
.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 36px 20px;
  background: var(--bg-elev-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  text-align: center;
}
.file-drop:hover {
  border-color: var(--accent);
  background: rgba(197, 242, 74, 0.04);
}
.file-drop-icon {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 300;
  color: var(--accent);
  line-height: 1;
}
.file-drop-text {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--fg);
}
.file-drop-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-faint);
}

/* ============ File info card ============ */
.file-info {
  padding: 12px 14px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.file-info .file-name {
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.file-info .file-size {
  color: var(--accent);
  flex-shrink: 0;
}

/* ============ QR ============ */
.qr-frame {
  background: #fff;
  border: 1px solid var(--accent);
  padding: 16px;
  border-radius: var(--radius);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  box-shadow: 0 0 40px -10px rgba(197, 242, 74, 0.4);
}
.qr-frame::before, .qr-frame::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid var(--accent);
}
.qr-frame::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.qr-frame::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.qr-canvas {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 280px;
  width: 100%;
}
.qr-canvas canvas, .qr-canvas img {
  max-width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid #ddd;
  border-top-color: var(--accent-dim);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Scanner ============ */
.scanner {
  position: relative;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  width: 100%;
}
.scanner video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scanner-frame {
  position: absolute;
  inset: 14%;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.35);
}
.scanner-frame::before, .scanner-frame::after,
.scanner-frame > div {
  /* corner ticks */
}

/* ============ Progress ============ */
.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 0.15s ease-out;
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: progress-shine 1.4s linear infinite;
}
@keyframes progress-shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
}
#progress-pct { color: var(--accent); font-weight: 500; }

/* ============ Status line ============ */
.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
}
.pulse {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* ============ Misc ============ */
.instruction {
  font-size: 14px;
  color: var(--fg-dim);
  line-height: 1.55;
}
.instruction strong { color: var(--fg); font-weight: 600; }

.foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dot-sep { color: var(--accent-dim); }

/* ============ Small screens ============ */
@media (max-width: 380px) {
  body { padding: 12px; }
  #app { padding: 18px 16px; }
  h1 { font-size: 32px; }
  h2 { font-size: 19px; }
}

/* ============ Tall screens — keep content centered ============ */
@media (min-height: 800px) {
  body { align-items: center; }
}

/* ============ QR scan robustness ============ */
.qr-frame {
  padding: 12px;
}
.qr-canvas {
  min-height: min(82vw, 460px);
}
.qr-frame.qr-expanded {
  position: fixed;
  inset: 8px;
  z-index: 50;
  padding: 12px;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.82), 0 0 50px -8px rgba(197, 242, 74, 0.55);
}
.qr-frame.qr-expanded .qr-canvas {
  min-height: calc(100dvh - 48px);
}
.qr-frame.qr-expanded .qr-canvas canvas,
.qr-frame.qr-expanded .qr-canvas img {
  max-width: min(92vw, 92vh, 520px);
}

@media (max-width: 520px) {
  body { padding: 8px; }
  #app { padding: 16px 14px 14px; }
  .brand { margin-bottom: 16px; padding-bottom: 14px; }
  .screen { gap: 13px; }
  .qr-frame { padding: 10px; }
}
