/* QR Creator — same base as Unix Timestamp Converter */
:root {
  --bg: #0f0f12;
  --surface: #18181c;
  --border: #2a2a30;
  --text: #e4e4e7;
  --text-muted: #a1a1aa;
  --accent: #22c55e;
  --accent-hover: #4ade80;
  --error: #f87171;
  --radius: 12px;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --font-display: "DS-Digital", var(--font-mono);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.two-col {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .two-col {
    grid-template-columns: 1fr 1fr;
  }
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header .title {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 480px) {
  .header .title {
    font-size: 1.5rem;
  }
}

.tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  transition: border-color 0.15s ease;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
}

.input::placeholder {
  color: var(--text-muted);
}

.label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.error {
  color: var(--error);
  font-size: 0.875rem;
  margin: 0 0 0.5rem;
}

.hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.logo-file-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
  width: 100%;
}

/* Hidden file input: out of flow so it doesn't affect button alignment */
.logo-input-wrap {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.logo-input-wrap input[type="file"] {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.logo-choose-btn {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.logo-choose-btn:hover {
  background: var(--accent-hover);
}

.logo-filename {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1rem;
}

.fieldset .label {
  margin-bottom: 0.5rem;
}

.style-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.style-option {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  color: var(--text);
  cursor: pointer;
}

.style-option input {
  accent-color: var(--accent);
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
}

.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.color-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.color-group .label {
  margin-bottom: 0;
  width: 100%;
}

.input-color {
  width: 2.5rem;
  height: 2.5rem;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
}

.input-color::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.input-color::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.color-hex {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  transform: scale(0.99);
}

#btn-generate {
  margin-top: 2.125rem;
}

/* QR preview — fixed size, matches download layout (512×512: QR square + 24px caption) */
.qr-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr-preview-card .qr-frame {
  background: var(--qr-frame-bg, var(--bg));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 280px;
  height: 280px;
  max-width: 100%;
  overflow: hidden;
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.qr-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 280px;
  height: 256px;
  padding: 0;
  box-sizing: border-box;
  flex-shrink: 0;
}

.qr-inner {
  width: 240px;
  height: 240px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-placeholder {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
}

.qr-frame:not(.has-qr) .qr-caption {
  background: var(--bg);
  color: var(--text-muted);
}

.qr-container canvas,
.qr-container svg {
  width: 240px;
  height: 240px;
  display: block;
  object-fit: contain;
  animation: qr-appear 0.35s ease;
}

@keyframes qr-appear {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Small border on each pixel for PIXELS and HYBRID */
.qr-container[data-qr-style="square"] svg path,
.qr-container[data-qr-style="square"] svg rect,
.qr-container[data-qr-style="classy"] svg path,
.qr-container[data-qr-style="classy"] svg rect {
  stroke: var(--qr-dot-border, #ffffff);
  stroke-width: 0.35;
  vector-effect: non-scaling-stroke;
}

.qr-caption {
  width: 100%;
  height: 24px;
  min-height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 10px;
  font-weight: 400;
  color: var(--qr-frame-fg, var(--text));
  background: var(--qr-frame-bg, var(--surface));
  letter-spacing: 0.01em;
  flex-shrink: 0;
  transition: background 0.3s ease, color 0.3s ease;
}

.qr-frame.has-qr .qr-caption {
  animation: qr-appear 0.35s ease 0.1s both;
}

.preview-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.125rem;
  width: 100%;
  margin-top: 1.5rem;
}

.preview-actions .btn-primary {
  margin-top: 0;
  width: 100%;
}

.preview-actions .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.preview-actions .btn-primary:disabled:hover {
  background: var(--accent);
}

.footer {
  text-align: center;
  padding-top: 2rem;
  margin-top: 0.5rem;
}

.credit {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-muted);
}
