:root {
  --background: #f4f4f4;
  --surface: #ffffff;
  --text: #202124;
  --muted: #62666b;
  --border: #c9ccd1;
  --primary: #1f5fa9;
  --primary-hover: #174d8a;
  --error: #a12622;
  --success: #23723a;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: var(--background);
  font-family: Arial, Helvetica, sans-serif;
}

button, input, textarea { font: inherit; }

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.upload-box {
  width: min(100%, 560px);
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .07);
}

h1 {
  margin: 0 0 12px;
  font-size: 1.65rem;
  line-height: 1.2;
}

.notice {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.requirements {
  margin: 12px 0 24px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.4;
}

.metadata-fields {
  display: grid;
  gap: 8px;
  margin: 0 0 24px;
  padding: 0;
  border: 0;
}

.metadata-fields legend {
  margin-bottom: 14px;
  padding: 0;
  font-weight: 700;
}

.metadata-fields label { margin-top: 6px; font-weight: 700; }

.metadata-fields input,
.metadata-fields textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
}

.metadata-fields textarea { resize: vertical; }

.metadata-fields input:focus-visible,
.metadata-fields textarea:focus-visible {
  border-color: var(--primary);
  outline: 3px solid rgba(31, 95, 169, .2);
}

.character-count {
  justify-self: end;
  color: var(--muted);
  font-size: .8rem;
}

#image-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.drop-zone {
  min-height: 160px;
  border: 2px dashed var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.drop-zone:hover,
.drop-zone.is-dragging,
#image-input:focus-visible + .drop-zone {
  border-color: var(--primary);
  background: #f3f7fc;
  outline: none;
}

.drop-title { color: var(--primary); font-weight: 700; }
.drop-copy { color: var(--muted); font-size: .875rem; }

.file-row {
  min-height: 88px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  gap: 14px;
}

.file-row:not([hidden]) { display: flex; }
.thumb-wrap { width: 64px; height: 64px; background: var(--background); overflow: hidden; flex: 0 0 auto; }
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.file-details { min-width: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.file-details strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-details span { color: var(--muted); font-size: .8rem; }
.remove-button { width: 40px; height: 40px; border: 0; background: transparent; font-size: 1.6rem; cursor: pointer; }

.status { min-height: 20px; margin: 14px 0 8px; color: var(--muted); font-size: .875rem; line-height: 1.4; }
.status.error { color: var(--error); }
.status.success {
  margin: 20px 0 0;
  padding: 14px;
  border: 1px solid #9ac4a5;
  border-radius: 6px;
  color: var(--success);
  background: #f1f8f3;
  font-weight: 700;
}

.submit-button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.submit-button:not(:disabled):hover { background: var(--primary-hover); }
.submit-button:focus-visible { outline: 3px solid rgba(31, 95, 169, .3); outline-offset: 2px; }
.submit-button:disabled { background: #a9acb0; cursor: not-allowed; }

@media (max-width: 520px) {
  .page { padding: 12px; }
  .upload-box { padding: 22px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
