:root {
  color-scheme: light;
  --ink: #1a1614;
  --muted: #6b635c;
  --line: #e6e1da;
  --paper: #f6f5f4;
  --card: #fff;
  --ink-hover: #0f0d0c;
  --ink-soft: rgba(26, 22, 20, 0.08);
  --ok: #1f6b45;
  --ok-soft: #e8f5ee;
  --danger: #8e2f24;
  --danger-soft: #fdecec;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
}

main {
  width: min(40rem, calc(100% - 2rem));
  margin: 2.5rem auto 4rem;
  padding: 1.75rem 1.5rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(26, 22, 20, 0.06);
}

h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.subtitle {
  margin: 0 0 1.5rem;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.45;
}

.field {
  margin-bottom: 1.15rem;
}

label,
.field-label {
  display: block;
  margin: 0 0 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.textarea-wrap {
  position: relative;
}

textarea,
#captcha {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: 1rem/1.45 var(--font);
}

textarea {
  display: block;
  min-height: 9rem;
  padding: 0.8rem 0.9rem 1.8rem;
  resize: vertical;
}

textarea:focus,
#captcha:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--ink-soft);
}

.hint {
  position: absolute;
  right: 0.75rem;
  bottom: 0.5rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 5.5rem;
  padding: 1rem;
  border: 1.5px dashed #d4cdc4;
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.dropzone:hover,
.dropzone.is-over,
.dropzone:focus-within {
  border-color: var(--ink);
  background: var(--ink-soft);
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dropzone-copy {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 400;
  cursor: pointer;
}

#previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

#previews:empty {
  display: none;
}

#previews li {
  position: relative;
}

#previews img {
  display: block;
  width: 100%;
  height: 8rem;
  object-fit: cover;
  background: #eee;
  border-radius: var(--radius);
}

#previews button {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  border: 0;
  border-radius: 999px;
  background: rgba(26, 22, 20, 0.82);
  color: #fff;
  font: 600 0.75rem/1 var(--font);
  padding: 0.4rem 0.65rem;
  cursor: pointer;
}

#previews button:hover {
  background: #1a1614;
}

.captcha {
  display: grid;
  gap: 0.45rem;
}

.captcha-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  margin-bottom: 0.2rem;
}

#captcha-image {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

#captcha-refresh,
#captcha-cancel,
#submit,
#captcha-confirm {
  font-family: var(--font);
  cursor: pointer;
}

#captcha-refresh,
#captcha-cancel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 0.55rem 0.8rem;
  font-size: 0.875rem;
  font-weight: 600;
}

#captcha-refresh {
  width: 100%;
}

#captcha-refresh:hover:not(:disabled),
#captcha-cancel:hover:not(:disabled) {
  border-color: var(--ink);
  color: var(--ink);
}

#captcha {
  padding: 0.7rem 0.85rem;
}

#captcha-dialog {
  width: min(22rem, calc(100vw - 2rem));
  margin: auto;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(26, 22, 20, 0.06);
}

#captcha-dialog::backdrop {
  background: rgba(26, 22, 20, 0.45);
}

.captcha-actions {
  display: flex;
  gap: 0.6rem;
}

#captcha-cancel,
#captcha-confirm {
  flex: 1;
}

#submit,
#captcha-confirm {
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  font-weight: 650;
}

#submit {
  width: 100%;
}

#submit:hover:not(:disabled),
#captcha-confirm:hover:not(:disabled) {
  background: var(--ink-hover);
}

#submit:disabled,
#captcha-confirm:disabled,
#captcha-refresh:disabled {
  opacity: 0.45;
  cursor: default;
}

#status,
#captcha-status {
  min-height: 1.4rem;
  margin: 0.85rem 0 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

#status:not(:empty),
#captcha-status:not(:empty) {
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
}

#status.ok,
#captcha-status.ok {
  color: var(--ok);
  background: var(--ok-soft);
}

#status.err,
#captcha-status.err {
  color: var(--danger);
  background: var(--danger-soft);
}

#captcha-status {
  min-height: 0;
  margin: 0.35rem 0 0;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

textarea:focus-visible,
#captcha:focus-visible,
.file-input:focus-visible {
  outline: none;
}

@media (max-width: 420px) {
  main {
    margin-top: 1rem;
    padding: 1.25rem 1rem 1.15rem;
  }

  #captcha-refresh,
  #captcha-cancel {
    padding: 0.45rem 0.65rem;
    font-size: 0.8rem;
  }
}
