/* QR generátor: barvy a písmo stejné jako hlavní web tomaskremel.cz */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-hover: #f4f4f5;
  --border: #e4e4e7;
  --text: #18181b;
  --muted: #71717a;
  --focus: #2563eb;
  --error: #b91c1c;
  --radius: 14px;
  color-scheme: light;
}

/* Tmavý režim: podle systému (pokud si návštěvník ručně nezvolil světlý) nebo ručně tlačítkem */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090b;
    --surface: #18181b;
    --surface-hover: #27272a;
    --border: #27272a;
    --text: #fafafa;
    --muted: #a1a1aa;
    --focus: #60a5fa;
    --error: #f87171;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #09090b;
  --surface: #18181b;
  --surface-hover: #27272a;
  --border: #27272a;
  --text: #fafafa;
  --muted: #a1a1aa;
  --focus: #60a5fa;
  --error: #f87171;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 40px 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (hover: hover) {
  .theme-toggle:hover { background: var(--surface-hover); }
}

/* Ve světlém motivu ukazuje měsíc (přepni na tmavý), v tmavém slunce */
.icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* Na úzkém displeji nechá nadpis místo pro tlačítko motivu */
@media (max-width: 479px) {
  .top { padding: 0 44px; }
}

.top { width: 100%; max-width: 880px; text-align: center; }
.top h1 { margin: 0; font-size: 1.6rem; font-weight: 650; letter-spacing: -0.01em; }
.lead { margin: 6px auto 0; max-width: 520px; color: var(--muted); font-size: 0.95rem; }

.layout {
  width: 100%;
  max-width: 880px;
  margin-top: 28px;
  display: grid;
  gap: 16px;
}

@media (min-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .preview { position: sticky; top: 24px; }
}

.card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* Výběr typu: řada „pilulek“ (rádiová tlačítka) */
.types {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.types label { position: relative; }
.types input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.types span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.types input:checked + span { background: var(--text); border-color: var(--text); color: var(--bg); }
.types input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (hover: hover) {
  .types input:not(:checked):hover + span { background: var(--surface-hover); }
}

.panel { display: grid; gap: 14px; }
.panel[hidden] { display: none; }

.row { display: grid; gap: 14px; }
@media (min-width: 480px) {
  .row { grid-template-columns: 1fr 1fr; align-items: end; }
}

.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 0.85rem; font-weight: 500; color: var(--muted); }

input[type="text"], input[type="email"], input[type="tel"], textarea, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}
textarea { resize: vertical; min-height: 88px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.field.color input {
  width: 100%;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 0.95rem;
  cursor: pointer;
}
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--text); }

.hint { margin: 0; color: var(--muted); font-size: 0.85rem; }
.error { margin: 14px 0 0; color: var(--error); font-size: 0.9rem; font-weight: 500; }
.warn { margin: 12px 0 0; color: var(--error); font-size: 0.85rem; }

.more { margin-top: 4px; }
.more summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: "›"; display: inline-block; font-size: 1.1rem; transition: transform 0.15s ease; }
.more[open] summary::before { transform: rotate(90deg); }
.more > .row, .more > .field, .more > .check { margin-top: 8px; }
.settings { margin-top: 18px; padding-top: 6px; border-top: 1px solid var(--border); }

/* Náhled */
.qr {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-hover);
  overflow: hidden;
}
.qr svg { display: block; width: 100%; height: 100%; }
.empty { margin: 0; padding: 24px; color: var(--muted); font-size: 0.9rem; text-align: center; }

.buttons { margin-top: 16px; display: grid; gap: 8px; }

.btn {
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.btn.primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:not(:disabled):active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (hover: hover) {
  .btn:not(.primary):not(:disabled):hover { background: var(--surface-hover); }
}

.status { min-height: 1.5em; margin: 8px 0 0; color: var(--muted); font-size: 0.85rem; text-align: center; }

.payload pre {
  margin: 4px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-hover);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.foot {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}
.foot a { color: inherit; text-underline-offset: 3px; }
.foot a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@media (max-width: 479px) {
  .foot { flex-direction: column; gap: 2px; }
  .foot span[aria-hidden] { display: none; }
}
