* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 24px 16px;
  background: #f4f5f7;
  color: #1a1a1a;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}
.wrap {
  max-width: 860px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
h1 {
  font-size: 20px;
  margin: 0 0 8px;
}
.hint {
  color: #666;
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 20px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin-bottom: 12px;
}
.row label {
  font-size: 13px;
  color: #444;
}
select {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}
textarea {
  width: 100%;
  min-height: 90px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  resize: vertical;
  word-break: break-all;
}
textarea[readonly] {
  background: #f8f8f8;
  color: #666;
}

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 8px;
}
fieldset legend {
  font-size: 14px;
  font-weight: 600;
  padding: 0 0 8px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px 16px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.field input[type="text"] {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.field-help {
  margin: 5px 0 0;
  font-size: 12px;
  color: #888;
  line-height: 1.4;
}
.field-wide { grid-column: 1 / -1; }
.date-helper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.date-helper input[type="date"] {
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
}
.date-preview {
  font-size: 12px;
  color: #888;
}

details.advanced-details {
  margin: 16px 0;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px 16px;
}
details.advanced-details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #444;
}
details.advanced-details[open] summary {
  margin-bottom: 12px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin: 10px 0 8px;
  cursor: pointer;
}
button.secondary {
  margin-top: 8px;
  background: #fff;
  border: 1px solid #ccc;
  color: #333;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
button.secondary:hover:not(:disabled) { background: #f2f2f2; }
button.secondary:disabled { color: #bbb; cursor: default; }

.generate-row { margin-top: 20px; }

button#gen {
  background: #1a73e8;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
button#gen:hover { background: #1558b0; }
button#gen:disabled { background: #999; cursor: default; }
#status {
  margin-left: 12px;
  font-size: 13px;
  color: #c00;
}
.result {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  text-align: center;
}
.result img {
  max-width: 100%;
  image-rendering: pixelated;
  border: 1px solid #eee;
}
.result .meta {
  font-size: 12px;
  color: #999;
  margin: 8px 0;
}
.result a {
  display: inline-block;
  margin-top: 4px;
  color: #1a73e8;
  font-size: 13px;
  text-decoration: none;
}
.result a:hover { text-decoration: underline; }

.upload-panel { background: #f5f8ff; border: 1px solid #dbe6fb; border-radius: 8px; padding: 16px; margin: 0 0 24px; }
.upload-panel h2 { font-size: 15px; margin: 0 0 12px; }
.file-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
#boarding-pass-file { max-width: 100%; font-size: 13px; }
.upload-status { min-height: 1em; font-size: 13px; line-height: 1.5; color: #255bb6; margin: 10px 0 0; }
.upload-status[data-error="true"] { color: #b3261e; }
#barcode-choice { margin-top: 12px; font-size: 13px; }
#detected-barcode { display: block; width: 100%; margin-top: 6px; }
.footer-note { margin: 24px 0 0; color: #888; font-size: 12px; line-height: 1.6; }
.result h2 { font-size: 16px; margin: 0 0 8px; }
.full-result .field-help { margin-bottom: 12px; }
.full-result #full-preview { display: block; max-height: 850px; max-width: 100%; margin: 0 auto; object-fit: contain; }
.full-result #full-preview[hidden], .full-result #full-download[hidden] { display: none; }
.full-result #full-preview-open { display: block; }
.full-result #full-preview { image-rendering: auto; }
.full-result #full-status { color: #255bb6; font-size: 13px; }
.full-result #full-status[data-error="true"] { color: #b3261e; }
.full-result a.full-download { background: #1a73e8; color: white; padding: 10px 20px; border-radius: 8px; font-size: 14px; }
.output-panel { border: 1px solid #dbe6fb; border-radius: 8px; padding: 14px 16px; margin: 0 0 24px; }
.output-panel legend { padding: 0 6px; }
.output-options { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.output-options label { display: flex; gap: 7px; align-items: center; font-size: 14px; cursor: pointer; }
.output-panel .field-help { margin-top: 12px; }
.screenshot-panel { background: #fffaf6; border: 1px solid #ffe0cb; border-radius: 8px; padding: 18px 16px; margin: 24px 0; }
.screenshot-panel[hidden] { display: none; }
.screenshot-panel h2 { font-size: 16px; margin: 0 0 8px; }
.screenshot-help { margin-bottom: 18px; color: #6f6259; }
.screenshot-panel .field input, .screenshot-panel .field select { width: 100%; padding: 7px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; min-height: 36px; background: white; }
.screenshot-panel .advanced-details { background: white; }
@media (max-width: 480px) { .wrap { padding: 18px 14px; } body { padding: 12px 8px; } .grid { grid-template-columns: 1fr; } .date-helper { flex-wrap: wrap; } }
