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

:root {
  --bg: #10151c;
  --surface: #1a2129;
  --surface-2: #212a34;
  --line: #2b3542;
  --text: #e7ecf1;
  --muted: #7c8794;
  --cyan: #2de8b9;
  --cyan-dim: #1a574d;
  --azul: #70c9fc;
  --azul-dim: #2a4f79;
  --radius: 4px;
}

* { box-sizing: border-box; }

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

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 64px;
}

.mono { font-family: 'Space Mono', monospace; }

/* Top wordmark, styled like a device readout */
.wordmark {
  font-family: 'Space Mono', monospace;
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wordmark .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}

main {
  width: 100%;
  max-width: 480px;
}

h1 {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.25;
  margin: 0 0 6px;
}
p.lede {
  color: var(--muted);
  margin: 0 0 28px;
  font-size: 1rem;
  line-height: 1.5;
}

/* Viewfinder frame: corner brackets, echoing a camera scan reticle */
.viewfinder {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 20px;
}
.viewfinder::before,
.viewfinder::after,
.viewfinder .corner-tl,
.viewfinder .corner-br {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--cyan);
  border-style: solid;
  border-width: 0;
}
.viewfinder::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.viewfinder::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.viewfinder .corner-tl { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.viewfinder .corner-br { bottom: -1px; left: -1px; border-bottom-width: 2px; border-left-width: 2px; }

.viewfinder.accent-azul::before,
.viewfinder.accent-azul::after,
.viewfinder.accent-azul .corner-tl,
.viewfinder.accent-azul .corner-br {
  border-color: var(--azul);
}

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  margin-bottom: 16px;
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: var(--radius);
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, filter 0.15s ease;
}
button:active, .btn:active { transform: scale(0.98); }

.btn-azul { background: var(--azul); color: #1a0e05; }
.btn-azul:hover { filter: brightness(1.08); }
.btn-cyan { background: var(--cyan); color: #04202a; }
.btn-cyan:hover { filter: brightness(1.08); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--muted); }

.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

/* Landing nav cards */
.nav-grid {
  display: grid;
  gap: 14px;
}
.nav-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.nav-card:hover { background: var(--surface-2); }
.nav-card .icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-card.scan .icon { background: var(--cyan-dim); color: var(--cyan); }
.nav-card.gen .icon { background: var(--azul-dim); color: var(--azul); }
.nav-card .icon svg { width: 22px; height: 22px; }
.nav-card .label {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
}
.nav-card .sub { color: var(--muted); font-size: 13px; }
.nav-card .arrow { margin-left: auto; color: var(--muted); }

/* Scanner reader area */
#reader {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
}
#reader img { border-radius: var(--radius); }

.result-box {
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  word-break: break-word;
  color: var(--muted);
  min-height: 24px;
}
.result-box.has-value { color: var(--cyan); border-style: solid; border-color: var(--cyan-dim); }

.status-line {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* QR output */
.qr-output {
  text-align: center;
}
.qr-output img {
  max-width: 100%;
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}
.qr-caption {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 18px;
  word-break: break-word;
}

.history {
  margin-top: 24px;
}
.history h2 {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 10px;
}
.history ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.history li {
  font-family: 'Space Mono', monospace;
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-link {
  display: inline-block;
  margin-top: 24px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.back-link:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media (min-width: 900px) {
  main { max-width: 620px; }
 
  .wordmark { font-size: 1.1rem; margin-bottom: 36px; }
 
  h1 { 
    font-size: 3rem;
    font-family: ui-rounded;
    line-height: 1.35;
    margin: 0 0 12px;
  }

  p.lede { font-size: 1.15rem; margin-bottom: 34px; }
 
  .viewfinder { padding: 36px 32px; }
 
  label { font-size: 14px; }
  input[type="text"] { font-size: 1.05rem; padding: 15px 16px; }
  button, .btn { font-size: 1.05rem; padding: 15px 20px; }
 
  .nav-card { padding: 26px; gap: 20px; }
  .nav-card .icon { width: 52px; height: 52px; }
  .nav-card .icon svg { width: 26px; height: 26px; }
  .nav-card .label { font-size: 1.05rem; }
  .nav-card .sub { font-size: 0.95rem; }
 
  .result-box { font-size: 1rem; padding: 20px; }
  .status-line { font-size: 0.9rem; }
  .qr-caption { font-size: 0.95rem; }
 
  .history li { font-size: 0.9rem; }
  .back-link { font-size: 0.95rem; }
}
 
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}