:root {
  color-scheme: light dark;
  --bg: light-dark(#f4f4f2, #121212);
  --bg-dots: light-dark(#d9d9d5, #242424);
  --surface: light-dark(#ffffff, #1b1b1b);
  --surface-alt: light-dark(#fafaf9, #161616);
  --border: light-dark(#e3e3e0, #2e2e2e);
  --border-strong: light-dark(#111111, #f4f4f2);
  --text: light-dark(#111111, #f4f4f2);
  --text-inverse: light-dark(#ffffff, #111111);
  --muted: light-dark(#6b6b68, #9a9a96);
  --danger: light-dark(#c0392b, #e07060);
  --focus: light-dark(#111111, #f4f4f2);
  --shadow-soft: light-dark(rgb(17 17 17 / 0.05), rgb(0 0 0 / 0.4));
  --shadow-deep: light-dark(rgb(17 17 17 / 0.08), rgb(0 0 0 / 0.5));
  --shadow-lift-soft: light-dark(rgb(17 17 17 / 0.06), rgb(0 0 0 / 0.45));
  --shadow-lift-deep: light-dark(rgb(17 17 17 / 0.12), rgb(0 0 0 / 0.6));
  --shadow: 0 1px 2px var(--shadow-soft), 0 8px 24px var(--shadow-deep);
  --shadow-lift: 0 2px 4px var(--shadow-lift-soft), 0 14px 34px var(--shadow-lift-deep);
}

:root[data-theme='light'] {
  color-scheme: light;
}

:root[data-theme='dark'] {
  color-scheme: dark;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  font-family: system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--text);
}

.shell {
  width: min(100%, 25rem);
  animation: shell-in 0.45s ease-out both;
}

@keyframes shell-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shell {
    animation: none;
  }
}

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--muted);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
}

.theme-toggle .icon-sun,
:root[data-theme='dark'] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme='dark'] .theme-toggle .icon-sun {
  display: block;
}

.brand {
  margin-bottom: 1.4rem;
  text-align: center;
}

.logo {
  display: inline-flex;
  align-items: stretch;
  margin: 0;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.logo-sama {
  display: inline-flex;
  align-items: center;
  padding: 0.18em 0.38em;
  background: var(--text);
  color: var(--text-inverse);
  border-radius: 0.14em;
}

.logo-kod {
  display: inline-flex;
  align-items: center;
  padding: 0.18em 0.05em 0.18em 0.14em;
  color: var(--text);
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.subtitle {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.panel {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.input {
  width: 100%;
  height: 2.85rem;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

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

.input:hover {
  border-color: var(--muted);
}

.input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
  background: var(--surface);
}

.hint {
  min-height: 1.2rem;
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  word-break: break-all;
}

.hint.is-error {
  color: var(--danger);
}

.preview-frame {
  display: flex;
  justify-content: center;
  margin: 1.2rem 0 1rem;
  padding: 1.1rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
  transition: border-color 0.2s ease;
}

.preview-frame:hover {
  border-color: var(--muted);
}

#qr-canvas {
  width: min(100%, 15rem);
  height: auto;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 1px 6px rgb(17 17 17 / 0.1);
}

.specs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 0 1.15rem;
  padding: 0;
  list-style: none;
}

.specs li {
  padding: 0.22rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-alt);
  font-size: 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.btn {
  height: 2.85rem;
  border-radius: 10px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease, transform 0.1s ease;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn:not(:disabled):active {
  transform: translateY(1px);
}

.btn-primary {
  border: 1px solid var(--border-strong);
  background: var(--text);
  color: var(--text-inverse);
}

.btn-primary:not(:disabled):hover {
  box-shadow: var(--shadow-lift);
}

.btn-secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-secondary:not(:disabled):hover {
  border-color: var(--muted);
  background: var(--surface-alt);
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
