:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  background: #f2f2f7;
  color: #1d1d1f;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  background: radial-gradient(circle at 15% 5%, rgb(255 255 255 / 92%), transparent 34%), linear-gradient(160deg, #f5f5f7 0%, #e9edf4 100%);
}

main { min-height: 100svh; padding: 12px; }

form {
  width: 100%;
  max-width: 680px;
  margin: 18px auto;
  padding: 20px;
  display: grid;
  gap: 14px;
  border: 1px solid rgb(255 255 255 / 80%);
  border-radius: 26px;
  background: rgb(255 255 255 / 72%);
  box-shadow: 0 24px 60px rgb(45 55 72 / 12%), inset 0 1px 0 rgb(255 255 255 / 90%);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

h1 {
  margin: 2px 0 8px;
  color: #1d1d1f;
  font-size: clamp(28px, 8vw, 36px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.03em;
}

.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-heading h1 { margin-bottom: 8px; }
.portal-link {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(60 60 67 / 13%);
  border-radius: 50%;
  color: #3a3a3c;
  background: rgb(255 255 255 / 76%);
  box-shadow: 0 5px 14px rgb(45 55 72 / 8%);
  transition: color .18s, transform .18s, background .18s;
}
.portal-link:hover { color: #007aff; transform: translateY(-1px); background: #fff; }
.portal-link svg { width: 21px; height: 21px; }

.pair-description {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgb(60 60 67 / 16%);
  border-radius: 14px;
  outline: none;
  color: #1d1d1f;
  background: rgb(255 255 255 / 82%);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 3%);
  transition: border-color .18s, box-shadow .18s, background .18s;
}

.pair-description:focus { border-color: #007aff; background: #fff; box-shadow: 0 0 0 4px rgb(0 122 255 / 14%); }
.pair-description::placeholder { color: #8e8e93; }
.pair-description { margin-bottom: 10px; }
.pair-list { display: grid; gap: 12px; }

.pair-card {
  padding: 12px;
  border: 1px solid rgb(60 60 67 / 13%);
  border-radius: 18px;
  background: rgb(255 255 255 / 50%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 80%);
}

.pair-heading { min-height: 28px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.pair-title { color: #6e6e73; font-size: 12px; font-weight: 650; }

.remove-pair {
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 0;
  border-radius: 50%;
  color: #8e8e93;
  background: rgb(118 118 128 / 10%);
}

.remove-pair svg { width: 15px; height: 15px; }
.remove-pair:hover { color: #d70015; background: rgb(215 0 21 / 9%); }
.remove-pair[hidden] { display: none; }

.image-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.image-input {
  min-width: 0;
  min-height: 94px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  border: 1px solid rgb(60 60 67 / 16%);
  border-radius: 14px;
  color: #007aff;
  background: rgb(255 255 255 / 76%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 80%);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}

.image-input:hover, .image-input.is-dragging { border-color: #007aff; transform: translateY(-1px); box-shadow: 0 7px 18px rgb(0 122 255 / 10%); }
.image-input:focus-within { border-color: #007aff; box-shadow: 0 0 0 4px rgb(0 122 255 / 14%); }

.image-input input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.image-input-title { min-width: 0; color: #3a3a3c; font-size: 13px; font-weight: 600; line-height: 1.25; }

.image-preview {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid rgb(60 60 67 / 10%);
  border-radius: 11px;
  background: #f5f5f7;
}

.upload-icon { width: 28px; height: 28px; padding: 6px; overflow: visible; border-radius: 50%; background: rgb(0 122 255 / 10%); }
.image-preview img { width: 100%; height: 100%; display: none; object-fit: cover; }
.image-input.has-file .upload-icon { display: none; }
.image-input.has-file .image-preview img { display: block; }

.add-pair {
  width: 46px;
  height: 46px;
  margin: 0 auto;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 1px solid rgb(0 122 255 / 22%);
  border-radius: 50%;
  color: #007aff;
  background: rgb(255 255 255 / 76%);
  box-shadow: 0 5px 14px rgb(45 55 72 / 8%);
  transition: transform .18s, background .18s, opacity .18s;
}

.add-pair svg { width: 22px; height: 22px; }
.add-pair:hover { transform: translateY(-1px); background: #fff; }
.add-pair:disabled { cursor: default; opacity: .4; transform: none; }

button[type="submit"] {
  width: 100%;
  min-height: 50px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(180deg, #1685ff 0%, #0071e3 100%);
  box-shadow: 0 8px 18px rgb(0 113 227 / 22%), inset 0 1px 0 rgb(255 255 255 / 24%);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  transition: transform .18s, opacity .18s, filter .18s;
}

button[type="submit"]:hover { transform: translateY(-1px); filter: brightness(1.04); }
button[type="submit"]:active { transform: scale(.99); filter: brightness(.97); }
button[type="submit"]:disabled { cursor: default; opacity: .55; transform: none; filter: none; }

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

@media (max-width: 390px) {
  .image-input { min-height: 86px; padding: 8px; }
  .image-preview { width: 48px; height: 48px; flex-basis: 48px; }
  .image-input-title { font-size: 12px; }
}

@media (min-width: 700px) {
  main { padding: 32px; }
  form { margin: 24px auto; padding: 30px; gap: 16px; }
  .pair-card { padding: 14px; }
  .image-inputs { gap: 14px; }
  button[type="submit"] { width: 116px; margin-left: auto; }
}

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