:root {
  --color-navy: #1B2A41;
  --color-cream: #F5F0E6;
  --color-camel: #C9A66B;
  --color-black: #1A1A1A;
  --color-white: #FFFFFF;
  --color-error: #A3372B;
  --radius: 6px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-cream);
  color: var(--color-black);
  min-height: 100vh;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(27, 42, 65, 0.12);
}

.site-header .logo {
  height: 36px;
  width: auto;
}

.site-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-navy);
  margin: 0;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.mode-selector {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.mode-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-navy);
  background: transparent;
  color: var(--color-navy);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-btn.active {
  background: var(--color-navy);
  color: var(--color-cream);
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .upload-grid {
    grid-template-columns: 1fr;
  }
}

.upload-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-navy);
}

.dropzone {
  position: relative;
  border: 1.5px dashed rgba(27, 42, 65, 0.35);
  border-radius: var(--radius);
  background: var(--color-white);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-color: var(--color-camel);
  background: #FBF8F2;
  outline: none;
}

.dropzone-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  color: rgba(26, 26, 26, 0.6);
  font-size: 0.9rem;
}

.dropzone-hint .or {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dropzone-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.model-context-panel {
  margin-top: 0.75rem;
  padding: 1rem;
  border: 1px solid rgba(27, 42, 65, 0.15);
  border-radius: var(--radius);
  background: var(--color-white);
}

.model-context-panel label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-navy);
  margin-bottom: 0.4rem;
}

.model-context-panel textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem;
  border: 1px solid rgba(27, 42, 65, 0.25);
  border-radius: calc(var(--radius) - 2px);
  resize: vertical;
  box-sizing: border-box;
}

.model-context-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.model-context-status {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--color-navy);
}

.preview {
  max-width: 100%;
  max-height: 260px;
  border-radius: calc(var(--radius) - 2px);
  object-fit: contain;
}

.preview[hidden] {
  display: none;
}

.btn-secondary {
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-navy);
  background: var(--color-white);
  color: var(--color-navy);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--color-cream);
}

.actions {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
}

.btn-primary {
  padding: 0.85rem 2.5rem;
  background: var(--color-camel);
  color: var(--color-navy);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-primary:disabled {
  background: rgba(201, 166, 107, 0.4);
  cursor: not-allowed;
}

.error-banner {
  border-radius: var(--radius);
  padding: 0;
  margin: 0;
}

.error-banner:not([hidden]) {
  display: block;
  background: rgba(163, 55, 43, 0.1);
  border: 1px solid var(--color-error);
  color: var(--color-error);
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.status-panel {
  margin: 0;
}

.status-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 1rem;
}

.status-panel p {
  color: var(--color-navy);
  font-size: 0.95rem;
  margin: 0;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(27, 42, 65, 0.15);
  border-top-color: var(--color-navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.result-panel {
  margin: 0;
  text-align: center;
}

.result-panel:not([hidden]) {
  display: block;
  padding-top: 1rem;
  border-top: 1px solid rgba(27, 42, 65, 0.12);
}

.result-panel h2 {
  color: var(--color-navy);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

#result-image {
  max-width: 100%;
  max-height: 520px;
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(27, 42, 65, 0.15);
}

.site-footer {
  text-align: center;
  padding: 1.5rem;
  color: rgba(26, 26, 26, 0.5);
  font-size: 0.8rem;
}
