:root {
  --bg: #0b0d10;
  --panel: #14181d;
  --line: #262c34;
  --text: #e8ecf1;
  --dim: #8b96a5;
  --accent: #6ee7a8;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.view { max-width: 640px; margin: 0 auto; padding-top: calc(16px + env(safe-area-inset-top)); }

header { text-align: center; margin: 24px 0 28px; }
h1 { margin: 0; font-size: 30px; letter-spacing: -0.02em; }
.tagline { margin: 6px 0 0; color: var(--dim); }

.actions { display: flex; flex-direction: column; gap: 10px; }

.button {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #06231a;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button.secondary { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.button:active { transform: translateY(1px); }

.link {
  background: none;
  border: 0;
  color: var(--dim);
  font-size: 15px;
  padding: 8px 0;
  cursor: pointer;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }

textarea {
  width: 100%;
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.settings {
  margin-top: 24px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.settings label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--dim);
  font-size: 15px;
}
select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.note { color: var(--text); font-size: 14px; margin: 12px 0 0; }
.note.dim { color: var(--dim); }
#rate-note { color: var(--dim); font-size: 13px; margin: 4px 0 0; }

.how { margin-top: 24px; color: var(--dim); font-size: 14px; }
.how summary { cursor: pointer; padding: 8px 0; }
.how p { margin: 10px 0; }
.how strong, .how em { color: var(--text); }

.bar { display: flex; align-items: center; justify-content: space-between; }
.counter { color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; }

#qr-canvas {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 12px auto;
  border-radius: 8px;
  background: #fff;
  image-rendering: pixelated;
}

.camera-wrap {
  position: relative;
  margin: 12px 0;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4 / 3;
}
#camera { width: 100%; height: 100%; object-fit: cover; display: block; }
.reticle {
  position: absolute;
  inset: 12%;
  border: 2px dashed rgba(110, 231, 168, 0.5);
  border-radius: 12px;
  pointer-events: none;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--panel);
  overflow: hidden;
}
#rx-progress {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.15s linear;
}

#rx-result { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.preview {
  max-width: 100%;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
}
img.preview { padding: 0; object-fit: contain; }
