:root {
    --bg: #1e1e2f;
    --card-bg: #2b2b3d;
    --text: #fff;
    --accent: #ff6b35;
    --accent-hover: #e2551d;
    --border-radius: 8px;
    --field-bg: #1a1a2a;
    --field-bg-inactive: #272736;
}

body {
    margin: 0;
    padding: 2rem;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--bg);
    color: var(--text);
}

h1 {
    margin-bottom: 1rem;
    text-align: center;
}

.container {
    max-width: 60vw;
    margin: auto;
}

@media only screen and (max-width: 600px) {
    .container {
        max-width: 98vw;
    }
}

.card {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-top: 1rem;
}

label {
    display: block;
    margin-bottom: 0.75rem;
}

input[type="number"] {
    padding: 0.4em;
    margin-left: 0.5em;
    width: 100px;
    background: var(--field-bg);
    border: 1px solid #444;
    color: var(--text);
    border-radius: 4px;
}

input.editing {
    background-color: var(--field-bg-inactive);
    color: #aaa;
    pointer-events: none;
    opacity: 0.6;
}


.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.result {
    margin-top: 1rem;
    font-weight: bold;
}

button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.5em 1em;
    border-radius: var(--border-radius);
    cursor: pointer;
    margin-top: 1rem;
    transition: background 0.2s;
}

button:hover {
    background: var(--accent-hover);
}

.row {
    display: grid;
    gap: 0.75rem;
}

.hidden {
    display: none;
}

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

textarea {
  background: var(--field-bg);
  color: var(--text);
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  width: 100%;
  resize: vertical;
  min-height: 110px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

input[type="text"],
select {
  background: var(--field-bg);
  color: var(--text);
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  width: 100%;
  height: 2.2rem;      /* compact */
  min-height: 2.2rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.controls button {
    margin-top: 0;
}

.controls button.active {
    outline: 2px solid #fff2;
    box-shadow: 0 0 0 2px #000 inset;
    filter: brightness(1.06);
}

/* --- Buttons: dull by default, orange when active --- */
.controls .conv-btn {
    background: #6b6b7a;
    /* duller base */
    color: #fff;
    border: none;
    padding: 0.5em 1em;
    border-radius: var(--border-radius);
    cursor: pointer;
    margin-top: 0;
    transition: filter 0.15s, background 0.15s, transform 0.05s;
    filter: brightness(0.95);
}

.controls .conv-btn:hover {
    filter: brightness(1.05);
}

.controls .conv-btn.active {
    background: var(--accent);
    filter: none;
    outline: 2px solid #fff2;
    box-shadow: 0 0 0 2px #000 inset;
}

.options select {
    min-height: 0;
    height: 2.2rem;
    padding: 0.25rem 0.5rem;
}

.options {
    display: grid;
    gap: 0.75rem;
}

.options .inline {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.muted {
    opacity: 0.8;
    font-size: 0.9rem;
}

#opt-delim {
  width: 50%;
  max-width: 200px;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #00000033;
    border: 1px solid #ffffff22;
    font-size: 0.8rem;
    margin-left: 0.4rem;
}

.inline-help {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* --- Make the preview column sticky --- */
.sticky {
  position: sticky;
  top: 1rem;
  align-self: start;
}

/* --- Fix overly-tall inputs (keep textarea tall, others compact) --- */
textarea {
  min-height: 110px;
}
input[type="text"] {
  min-height: 2.2rem;   /* was 110px due to a shared rule */
  height: 2.2rem;
  padding: 0.25rem 0.5rem;
}
.options select {
  min-height: 2.2rem;   /* already set, reinforce */
  height: 2.2rem;
}

/* --- Scaled preview: canvas/svg fills container but keeps full internal resolution for downloads --- */
.qr-viewport {
  width: 100%;
  max-width: 520px;           /* tweak as you like */
  padding: 0.75rem;
  border-radius: var(--border-radius);
  background: #00000011;
}
.qr-viewport canvas,
.qr-viewport svg {
  width: 100%;                /* scale down visually */
  height: auto;
  display: block;
  image-rendering: pixelated; /* crisp look when scaled */
}

/* Optional: keep two-column layout from collapsing weirdly */
@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
