* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 1rem;
  background: #f5f5f5;
}

.container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  background: #fff;
  padding: 1.5rem;
  border-radius: 0;
  box-shadow: none;
}

h1 {
  margin-top: 0;
  font-size: 2.5rem;
  font-weight: normal;
  font-family: 'Jersey 10', monospace;
}

h2 {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.form .field {
  margin-bottom: 1rem;
}

.form .field-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.btn {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.btn-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.btn-secondary {
  background: #e2e8f0;
  color: #1e293b;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.status {
  margin-left: 0.5rem;
  font-size: 0.9rem;
  color: #64748b;
}

.field-hint,
.field-dollar-rate .field-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: #64748b;
}

.field-dollar-rate input {
  max-width: 8rem;
}

.models-container {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fafc;
}

.models-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.models-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.models-list label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: normal;
  cursor: pointer;
  padding: 0.25rem 0;
}

.models-list input[type="checkbox"] {
  width: auto;
}

.model-star {
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.extract-error-msg {
  color: #dc2626;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.extract-original-label {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.extract-original-content {
  margin: 0;
  padding: 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 0.85rem;
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.btn-copy-inline {
  margin-left: 0.5rem;
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
}

.btn-copy-inline:hover {
  background: #cbd5e1;
}

.extract-path-wrap {
  margin-top: 0.5rem;
}

.extract-path-wrap input {
  width: 100%;
  max-width: 320px;
}

.radio-option,
.checkbox-option {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: normal;
  cursor: pointer;
}

.radio-label {
  margin-bottom: 0;
}

.proxy-section {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fafc;
}

.proxy-section-title {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.proxy-row {
  margin-bottom: 0.5rem;
}

.proxy-row:last-child {
  margin-bottom: 0;
}

.field-inline {
  flex: 1;
  min-width: 0;
}

.field-inline label {
  margin-bottom: 0.2rem;
}

.field-inline select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

.results-container {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-card {
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fafc;
}

.result-card.error {
  border-color: #fca5a5;
  background: #fef2f2;
}

.result-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.result-meta {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.result-content {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
}

.result-content.empty {
  color: #94a3b8;
  font-style: italic;
}

.result-comments {
  margin-top: 0.5rem;
}

.result-comments-title,
.result-add-comment-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  color: #334155;
}

.result-comments-list {
  margin: 0 0 0.75rem 0;
  padding-left: 1.25rem;
}

.result-comment-item {
  margin-bottom: 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-add-comment {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e2e8f0;
}

.result-add-comment-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
}

.result-plaque {
  margin: 0.5rem 0;
  padding: 0.5rem 0.75rem;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #92400e;
}

.result-content-raw {
  margin-top: 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  max-height: 300px;
  overflow-y: auto;
}

.result-content-wrap {
  margin-top: 0.25rem;
}

.result-content-wrap .result-content {
  margin-bottom: 0.5rem;
}

.result-images-wrap {
  margin-top: 0.5rem;
}

.result-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin-top: 0.5rem;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.result-image:first-child {
  margin-top: 0;
}

.badge-free {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  background: #dcfce7;
  color: #166534;
  border-radius: 4px;
  margin-left: 0.5rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.5rem;
}

.results-table {
  width: 100%;
  min-width: 400px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.results-table th,
.results-table td {
  border: 1px solid #e2e8f0;
  padding: 0.75rem;
  vertical-align: top;
  text-align: left;
}

.results-table th {
  background: #f1f5f9;
  font-weight: 600;
  white-space: nowrap;
}

.results-table tr:nth-child(even) td {
  background: #f8fafc;
}

.results-table .cell-model {
  position: sticky;
  left: 0;
  background: #f1f5f9;
  z-index: 1;
  min-width: 180px;
}

.results-table tr:nth-child(even) .cell-model {
  background: #e2e8f0;
}

.result-cell {
  min-width: 220px;
  max-width: 420px;
  max-height: 320px;
  overflow: auto;
}

.result-cell-status {
  color: #64748b;
  font-style: italic;
}

.result-cell-status.waiting {
  color: #94a3b8;
}

.result-cell-status.sending {
  color: #2563eb;
}

.result-cell-success .result-cell-status {
  color: #166534;
  font-style: normal;
  font-weight: 500;
}

.result-cell-error {
  border-color: #fca5a5;
  background: #fef2f2;
}

.result-cell-error .result-cell-status {
  color: #dc2626;
  font-style: normal;
  font-weight: 500;
}

.result-cell-content {
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 0.35rem;
  font-size: 0.85rem;
}

.prompts-list .field {
  margin-bottom: 0.75rem;
}

.prompts-list .field label {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.btn-add-prompt {
  margin-top: 0.5rem;
}
