/* upload.css — the phone page. One column, big targets, 16px inputs so iOS
 * never zooms, and nothing that needs a hover. Shares the tokens and the dark
 * ground from styles.css.
 */

/* Several blocks below are display:flex, which would beat the hidden attribute's
 * UA display:none; this keeps hidden meaning hidden. */
.upload-page [hidden] { display: none !important; }

body.upload-page {
  display: block;
  min-height: 100%;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.up-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
}
.up-head h1 { flex: 1; font-size: 18px; text-align: center; }
.up-back, .up-key-btn {
  min-width: 60px;
  padding: 8px 4px;
  background: transparent;
  border: 0;
  color: var(--ink-dim);
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}
.up-key-btn { text-align: right; }

.up-main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.up-notice, .up-msg {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.45;
}
.up-notice { background: #3a2a10; border: 1px solid #5a4318; color: #f0d9a8; }
.up-msg { background: var(--bg-raised); border: 1px solid var(--line); color: var(--ink); }
.up-msg.bad { border-color: #7a2e2e; color: #ffb4b4; }

.up-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.up-card label, .up-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
}
.up-hint { margin: 0; font-size: 12.5px; color: var(--ink-faint); }

.up-step { display: flex; flex-direction: column; gap: 10px; }

.upload-page input[type="search"],
.upload-page input[type="password"],
.upload-page input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}
.upload-page input:focus { outline: none; border-color: var(--accent); }

.up-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.up-btn.primary { background: var(--shot); color: #2a1c00; border-color: transparent; }
.up-btn.big { width: 100%; min-height: 58px; font-size: 18px; }
.up-btn.small { padding: 9px 14px; font-size: 14px; }
.up-btn.ghost { background: transparent; color: var(--ink-dim); }
.up-btn:disabled, .up-btn[aria-disabled="true"] { opacity: 0.4; cursor: default; pointer-events: none; }
.up-btn:active:not(:disabled) { filter: brightness(1.1); }

.up-row { display: flex; gap: 10px; flex-wrap: wrap; }
.up-row .up-btn { flex: 1; }

/* picked photos */
.up-previews {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.up-previews:empty { display: none; }
.up-previews li {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-sunken);
}
.up-previews img { width: 100%; height: 100%; object-fit: cover; display: block; }
.up-previews .badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--ink);
}
.up-previews li.ready .badge { background: var(--shot); color: #2a1c00; }
.up-previews li.error .badge { background: #7a2e2e; color: #ffb4b4; }

.up-x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

/* species */
.up-chosen {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--shot);
  border-radius: var(--radius);
  background: var(--shot-soft);
}
.up-chosen img { width: 60px; height: 45px; object-fit: cover; border-radius: 6px; background: var(--bg-sunken); }
.up-chosen strong { display: block; font-size: 17px; }
.up-chosen em { font-size: 13.5px; color: var(--ink-dim); }
.up-chosen .up-x { position: static; margin-left: auto; flex: none; }

.up-results {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raised);
}
.up-results li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 8px 12px;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
}
.up-results li:first-child { border-top: 0; }
.up-results li:active { background: var(--bg-sunken); }
.up-results img { width: 60px; height: 45px; object-fit: cover; border-radius: 6px; background: var(--bg-sunken); flex: none; }
.up-results .nm { display: block; font-size: 16px; }
.up-results em { font-size: 13px; color: var(--ink-dim); }
.up-results .where { margin-left: auto; font-size: 11px; color: var(--ink-faint); text-align: right; max-width: 32%; }
.up-results .none { color: var(--ink-faint); font-size: 14px; cursor: default; }

.up-recent { display: flex; gap: 8px; flex-wrap: wrap; }
.up-recent:empty { display: none; }
.up-recent button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink-dim);
  font-size: 14px;
  cursor: pointer;
}
.up-recent img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--bg-sunken); }

/* upload progress */
.up-progress { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.up-progress:empty { display: none; }
.up-progress li { display: grid; grid-template-columns: 46px 1fr; gap: 10px; align-items: center; }
.up-progress img { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; }
.up-progress .bar { height: 7px; border-radius: 99px; background: var(--bg-sunken); border: 1px solid var(--line); overflow: hidden; }
.up-progress .bar span { display: block; height: 100%; width: 0; background: var(--shot); transition: width 0.15s linear; }
.up-progress .st { font-size: 12.5px; color: var(--ink-faint); margin-top: 4px; }
.up-progress li.done .st { color: var(--shot); }
.up-progress li.error .st { color: #ffb4b4; }

.up-done {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--shot);
  background: var(--shot-soft);
}
.up-done p { margin: 0; font-size: 17px; font-weight: 600; }

@media (min-width: 600px) {
  .up-previews { grid-template-columns: repeat(4, 1fr); }
}

/* where */
.up-note { margin: 0; font-size: 13px; line-height: 1.45; color: var(--ink-faint); }
.up-note.ok { color: var(--ink-dim); }
.up-note.warn { color: #f0d9a8; }
.up-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.up-inline .up-btn { flex: none; }
