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

:root {
  --green: #16a34a;
  --red: #dc2626;
  --blue: #2563eb;
  --gray: #6b7280;
  --bg: #f9fafb;
  --card: #ffffff;
  --text: #111827;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

header {
  background: var(--blue);
  color: white;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 1.1rem;
}

header button {
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
  gap: 1.25rem;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; text-align: center; }
h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; }

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--gray);
}

input[type=text], input[type=password], input[type=number] {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  margin-bottom: 1rem;
  outline: none;
  transition: border-color 0.15s;
}

input:focus { border-color: var(--blue); }

button.btn {
  width: 100%;
  padding: 0.875rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}
button.btn:active { opacity: 0.8; }
button.btn-primary { background: var(--blue); color: white; }
button.btn-secondary { background: #e5e7eb; color: var(--text); }
button.btn-danger { background: var(--red); color: white; }
button.btn-green { background: var(--green); color: white; }

#result {
  width: 100%;
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  display: none;
}
#result.valid   { background: #dcfce7; color: var(--green); display: block; }
#result.invalid { background: #fee2e2; color: var(--red);   display: block; }

#reader {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.95rem;
}
.stat-row:last-child { border-bottom: none; }
.stat-val { font-weight: 700; font-size: 1.1rem; }

.hidden { display: none !important; }

.sub { font-size: 0.85rem; color: var(--gray); margin-top: 0.25rem; font-weight: 400; }

.mt { margin-top: 0.75rem; }
