/* QR Code Generator — styles */
:root {
  color-scheme: light dark;
  --bg: #f4f4f9; --panel: #ffffff; --text: #1c1c28; --muted: #5a5a6a;
  --border: #d9d9e3; --accent: #007bff; --accent-hover: #0056b3;
  --ok: #2e7d32; --err: #c0392b; --field-bg: #ffffff;
  --shadow: 0 0 10px rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] {
  --bg: #16161d; --panel: #22222c; --text: #ececf2; --muted: #a0a0b0;
  --border: #383846; --accent: #4d9bff; --accent-hover: #75b1ff;
  --ok: #66bb6a; --err: #ef7b6b; --field-bg: #2a2a36;
  --shadow: 0 0 12px rgba(0, 0, 0, 0.4);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
  background: var(--bg); color: var(--text); margin: 0; padding: 12px;
  height: 100vh; display: flex; flex-direction: column; overflow: hidden;
}
header.app {
  max-width: 1500px; width: 100%; margin: 0 auto 10px; flex: 0 0 auto; display: flex;
  align-items: center; justify-content: space-between; gap: 12px;
}
header.app h1 { font-size: 1.3rem; margin: 0; }
.layout {
  max-width: 1500px; width: 100%; margin: 0 auto; display: grid;
  grid-template-columns: 1.15fr 1fr; gap: 12px; align-items: stretch;
  flex: 1 1 auto; min-height: 0;
}
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; box-shadow: var(--shadow);
  min-height: 0; overflow-y: auto;
}
.preview { min-height: 0; }
.settings {
  display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; align-content: start;
}
.settings > fieldset:first-child { grid-column: 1 / -1; }
fieldset {
  border: 1px solid var(--border); border-radius: 10px;
  margin: 0 0 10px; padding: 8px 10px 10px;
}
legend { font-size: .8rem; color: var(--muted); padding: 0 6px; font-weight: 600; }
label { display: block; font-size: .78rem; color: var(--muted); margin-top: 6px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
select, textarea {
  width: 100%; padding: 6px; border: 1px solid var(--border);
  border-radius: 6px; margin-top: 3px; background: var(--field-bg); color: var(--text);
  font: inherit;
}
textarea { resize: vertical; min-height: 34px; }
input[type="color"] { width: 44px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--field-bg); cursor: pointer; }
input[type="file"] { margin-top: 4px; max-width: 100%; font-size: .78rem; color: var(--muted); }
input[type="range"] { width: 100%; margin-top: 6px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }
.inline { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.inline label { margin: 0; flex: 1 1 auto; white-space: nowrap; }
.inline input[type="range"] { flex: 1 1 55%; width: auto; margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label {
  margin: 0; padding: 5px 9px; border: 1px solid var(--border); border-radius: 20px;
  cursor: pointer; font-size: .8rem; color: var(--text); background: var(--field-bg);
}
.chips input:checked + label { background: var(--accent); color: #fff; border-color: var(--accent); }
.chips input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
button {
  padding: 7px 12px; background: var(--accent); color: #fff; border: none;
  border-radius: 6px; cursor: pointer; font: inherit; margin: 4px 4px 0 0;
}
button:hover { background: var(--accent-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.ghost:hover { background: var(--field-bg); }
.theme-switch {
  position: relative; flex: 0 0 auto; margin: 0; width: 58px; height: 30px; padding: 0;
  border-radius: 999px; border: 1px solid var(--border); background: var(--field-bg);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: space-between;
}
.theme-switch .ico { width: 16px; height: 16px; margin: 0 6px; fill: var(--muted); z-index: 1; transition: fill .2s; }
.theme-switch .knob {
  position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .22s ease;
}
.theme-switch[aria-checked="true"] .knob { transform: translateX(28px); }
.theme-switch:hover { background: var(--field-bg); }
.theme-switch[aria-checked="false"] .sun { fill: #fff; }
.theme-switch[aria-checked="true"] .moon { fill: #fff; }
.theme-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#status { margin-top: 8px; font-size: .82rem; color: var(--err); min-height: 16px; }
#status.ok { color: var(--ok); }
#previewCanvas {
  display: block; margin: 0 auto; max-width: 100%; max-height: 42vh; height: auto;
  border-radius: 8px; background:
    repeating-conic-gradient(#c9c9d4 0% 25%, #ffffff 0% 50%) 50% / 20px 20px;
}
.value { color: var(--text); font-weight: 600; }
.hide { display: none !important; }
.hint { font-size: .72rem; color: var(--muted); margin-top: 4px; }
.type-fields.hide { display: none; }
.header-actions { display: flex; align-items: center; gap: 8px; }
#aboutBtn { margin: 0; }
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.overlay[hidden] { display: none; }
.modal { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 20px; max-width: 420px; width: 100%; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 2px; font-size: 1.15rem; }
.app-name { margin: 0 0 14px; color: var(--muted); font-size: .9rem; }
.about-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 12px; }
.about-list dt { color: var(--muted); font-size: .8rem; }
.about-list dd { margin: 0; font-size: .9rem; }
.about-list a { color: var(--accent); text-decoration: none; }
.about-list a:hover { text-decoration: underline; }
.about-note, .about-credit { font-size: .8rem; color: var(--muted); margin: 4px 0 0; }
.modal-footer { margin-top: 16px; text-align: right; }
.modal-footer button { margin: 0; }

/* Responsive: must come AFTER base .panel/.settings rules so its overrides win */
@media (max-width: 760px) {
  body { height: auto; overflow: visible; display: block; }
  .layout { grid-template-columns: 1fr; }
  .settings { grid-template-columns: 1fr; }
  .settings > fieldset:first-child { grid-column: auto; }
  .panel { overflow: visible; }
}
