:root {
  color-scheme: light dark;
  --bg: #f7f7f3;
  --panel: #ffffff;
  --text: #1d2522;
  --muted: #66716c;
  --line: #d9ded8;
  --accent: #007c89;
  --accent-strong: #005f69;
  --danger: #a43b31;
  --shadow: 0 18px 50px rgba(28, 43, 37, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(0, 124, 137, 0.08), transparent 38%),
    linear-gradient(315deg, rgba(177, 81, 58, 0.08), transparent 34%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

.app {
  width: min(920px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 16px;
  display: grid;
  place-items: center;
}

.panel {
  width: 100%;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: var(--shadow);
}

.header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 5px;
  font-size: 13px;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1;
  letter-spacing: 0;
}

.status {
  min-width: 112px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  white-space: nowrap;
}

.status.ok {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.status.error {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
}

.controls {
  display: grid;
  grid-template-columns: 1fr 150px 110px 110px;
  gap: 14px;
  align-items: end;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  font-size: 13px;
  color: var(--muted);
}

.field-wide {
  grid-column: span 4;
}

.qr-drop {
  grid-column: span 4;
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
  outline: none;
}

.qr-drop strong,
.qr-drop span {
  display: block;
}

.qr-drop strong {
  margin-bottom: 4px;
  font-size: 15px;
}

.qr-drop span {
  color: var(--muted);
  font-size: 13px;
}

.qr-drop.dragging,
.qr-drop:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.actions {
  grid-column: span 4;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}

button {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button.secondary {
  color: var(--accent-strong);
  background: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.result {
  margin-top: 30px;
}

.code {
  min-height: 92px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, ui-monospace, monospace;
  font-size: clamp(42px, 10vw, 72px);
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.meter {
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
}

.meter-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 160ms linear;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 14px;
}

.account {
  min-height: 20px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.help {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.help summary {
  cursor: pointer;
  color: var(--accent-strong);
}

.help-body {
  color: var(--muted);
  line-height: 1.6;
}

pre {
  overflow-x: auto;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--text) 5%, var(--panel));
}

code {
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, ui-monospace, monospace;
}

@media (max-width: 720px) {
  .app {
    padding: 16px;
    align-items: start;
  }

  .panel {
    padding: 20px;
  }

  .header {
    display: grid;
  }

  .status {
    justify-self: start;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .field-wide,
  .qr-drop,
  .actions {
    grid-column: auto;
  }

  .qr-drop {
    display: grid;
  }

  .actions button {
    flex: 1 1 180px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111715;
    --panel: #18201d;
    --text: #edf2ef;
    --muted: #a8b3ae;
    --line: #34423d;
    --accent: #2bb3a3;
    --accent-strong: #73d7cc;
    --danger: #ff8d7e;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
  }
}
