:root {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #22c55e;
  --danger: #f87171;
  --radius: 16px;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    sans-serif;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px max(24px, env(safe-area-inset-bottom));
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.top h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.sub {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.pill {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.pill-off {
  background: #334155;
  color: var(--muted);
}

.pill-on {
  background: rgba(34, 197, 94, 0.2);
  color: var(--ok);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.lbl {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

textarea,
input[type="number"] {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: #0f172a;
  color: var(--text);
  padding: 12px;
  font-size: 1rem;
  font-family: ui-monospace, Consolas, monospace;
}

textarea {
  resize: vertical;
  min-height: 72px;
}

.preview-wrap {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.label-frame {
  width: 200px;
  height: 150px;
  background: #fff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.label-frame img {
  max-width: 88%;
  max-height: 88%;
  object-fit: contain;
}

.hint {
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
  text-align: center;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

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

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

.btn-secondary {
  background: #334155;
  color: #fff;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.btn.sm {
  padding: 10px 12px;
  font-size: 0.85rem;
  margin-top: 10px;
}

.advanced summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 0.85rem;
  list-style: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.grid label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.grid .check {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  min-height: 2.5em;
  line-height: 1.4;
}

.status.err {
  color: var(--danger);
}

.status.ok {
  color: var(--ok);
}
