:root {
  --pink: #ec4899;
  --pink-dark: #be185d;
  --pink-text: #be185d;
  --bg: #fdf2f8;
  --card: #ffffff;
  --text: #1f1a1d;
  --muted: #6b5f66;
  --line: #f0d3e2;
  --danger: #b91c1c;
  --ok: #15803d;
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171216;
    --card: #221b20;
    --text: #f5eef2;
    --muted: #b8a9b2;
    --line: #3e2f39;
    --pink-text: #f9a8d4;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.noscript { padding: 16px; text-align: center; }

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.brand {
  margin: 0;
  background: var(--pink);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 999px;
}

.tagline { margin: 0; color: var(--muted); max-width: 520px; }

.lang { display: flex; gap: 8px; }

.chip {
  font: inherit;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.h2 { margin: 0; font-size: 20px; }
.h3 { margin: 8px 0 4px; font-size: 16px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.tabs {
  display: flex;
  gap: 6px;
  background: var(--bg);
  padding: 4px;
  border-radius: 999px;
}

.tab {
  flex: 1;
  font: inherit;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.dropzone {
  border: 2px dashed var(--pink);
  border-radius: var(--radius);
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s;
}

.dropzone.over { background: rgba(236, 72, 153, 0.08); }

.drop-title { margin: 0; font-weight: 600; }

.btn {
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.btn:hover { border-color: var(--pink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
}

.btn-primary:hover {
  background: var(--pink-dark);
  border-color: var(--pink-dark);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--pink-text);
}

.btn-small { padding: 6px 12px; font-size: 14px; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
.chip:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
}

.queue {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.q-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
}

.q-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  object-fit: cover;
}

.q-body { min-width: 0; }

.q-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.q-status {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.q-item.done .q-status { color: var(--ok); }
.q-item.failed .q-status { color: var(--danger); }

.bar {
  height: 6px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}

.bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--pink);
  transition: width 0.2s;
}

.alert {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #7c2d12;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
}

.alert ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }

@media (prefers-color-scheme: dark) {
  .alert {
    background: #2d2116;
    border-color: #7c4a1d;
    color: #fed7aa;
  }
}

.preview { display: flex; justify-content: center; }

.qr-canvas,
.grid-card canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background-color: #fff;
  background-image: repeating-conic-gradient(#e5e7eb 0% 25%, #fff 0% 50%);
  background-size: 20px 20px;
}

.preview .qr-canvas { max-width: 340px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.grid-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.grid-name {
  margin: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-card .btn { align-self: center; }

dialog {
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  padding: 24px;
  width: min(440px, calc(100vw - 32px));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.45); }

.settings { display: flex; flex-direction: column; gap: 16px; }

.fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fieldset legend { font-weight: 600; padding: 0; margin-bottom: 6px; }

.options { display: flex; flex-wrap: wrap; gap: 8px; }

.option { position: relative; }

.option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option span {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
}

.option input:checked + span {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
}

.option input:focus-visible + span {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
}

.option input:disabled + span { opacity: 0.45; cursor: not-allowed; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.check input { width: 18px; height: 18px; accent-color: var(--pink); }
.check input:disabled + span { opacity: 0.45; }

.steps,
.list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.star {
  font-size: 34px;
  line-height: 1;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--line);
  padding: 2px;
}

.star.on { color: #f59e0b; }

.field-label {
  font-size: 14px;
  font-weight: 600;
  display: block;
  margin: 12px 0 6px;
}

textarea {
  width: 100%;
  min-height: 90px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px;
  font: inherit;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}

.thanks { color: var(--ok); font-weight: 600; text-align: center; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--card);
  padding: 12px 18px;
  border-radius: 12px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 100;
  font-size: 14px;
}

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding-bottom: 16px;
}
