* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f5f6f8;
  color: #1f2937;
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 18px;
}

.topbar-inner {
  max-width: 660px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: #111827;
  font-weight: 700;
  font-size: 16px;
}

.brand-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #0284c7;
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}

.limit-note {
  font-size: 12px;
  color: #6b7280;
}

.container {
  flex: 1;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  transition: max-width 0.2s ease;
}

.container.is-expanded {
  max-width: 680px;
}

.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  background: #fafafa;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: #0284c7;
  background: #f0f9ff;
}

.dropzone-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

.dropzone-sub {
  font-size: 12px;
  color: #6b7280;
}

.preview-area {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

@media (max-width: 600px) {
  .preview-area {
    grid-template-columns: 1fr;
  }
}

.thumb-box {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
}

.thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
}

input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  color: #111827;
  background: #ffffff;
}

input[type="text"]:focus {
  outline: none;
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.14);
}

.wish-hint {
  margin-top: 5px;
  font-size: 11.5px;
  color: #4b5563;
  padding: 3px 8px;
  border-radius: 5px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}

.wish-hint.conforming {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
  font-weight: 500;
}

.wish-hint.nonconforming {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

button {
  appearance: none;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #1f2937;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #f3f4f6;
}

button.primary {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  font-weight: 600;
}

button.primary:hover:not(:disabled) {
  background: #0369a1;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.status-line {
  font-size: 12px;
  color: #4b5563;
  margin-top: 6px;
}

.status-line.error {
  color: #dc2626;
}

.results-card {
  margin-top: 20px;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
}

.results-preview {
  max-height: 360px;
  width: 100%;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  margin-bottom: 16px;
}

.code-row {
  margin-bottom: 10px;
}

.code-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 3px;
}

.copy-group {
  display: flex;
  gap: 6px;
}

.copy-group input,
.copy-group textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px 10px;
  color: #111827;
  resize: vertical;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 10px;
}

select {
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  background: #ffffff;
  color: #111827;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  padding-bottom: 6px;
}

.hidden {
  display: none !important;
}
