:root {
  --bg: #faf9f7;
  --ink: #161514;
  --muted: #8a857e;
  --line: #e6e2dc;
  --card: #ffffff;
  --like: #1f8a5b;
  --dislike: #c2452f;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.top {
  text-align: center;
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px;
}
.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 22px;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

main {
  max-width: 460px;
  margin: 0 auto;
  padding: 4px 16px calc(96px + env(safe-area-inset-bottom));
}

/* Bottom tabs */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  max-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--ink); }

/* Photo card */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.card img {
  display: block;
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  background: #f1eeea;
}
.meta { padding: 12px 16px 0; }
.caption { font-size: 17px; }
.by { color: var(--muted); font-size: 13px; }

.actions {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 16px;
}
.round {
  width: 68px; height: 68px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card);
  transition: transform 0.12s, border-color 0.12s, color 0.12s;
}
.round svg { width: 30px; height: 30px; }
.round:active { transform: scale(0.92); }
.round.like:hover, .round.like:active { color: var(--like); border-color: var(--like); }
.round.dislike:hover, .round.dislike:active { color: var(--dislike); border-color: var(--dislike); }

.minor {
  display: flex;
  justify-content: space-between;
  padding: 0 16px 14px;
}
.link {
  border: 0; background: none; padding: 4px 0;
  color: var(--muted); font-size: 13px; text-decoration: underline;
  text-underline-offset: 3px;
}

/* Reasons */
.why { padding: 16px; }
.why h2 { margin: 0 0 2px; font-size: 17px; font-weight: 600; }
.why h2.like { color: var(--like); }
.why h2.dislike { color: var(--dislike); }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-size: 14px;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip:disabled { opacity: 0.4; }
.row { display: flex; gap: 10px; margin-top: 16px; }

.btn {
  flex: 1;
  padding: 13px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); flex: 0 0 auto; }
.btn.danger { background: transparent; color: var(--dislike); border-color: var(--line); }
.btn:disabled { opacity: 0.45; }

/* Empty + message states */
.empty { text-align: center; padding: 56px 12px; }
.empty h1 { font-family: Georgia, serif; font-weight: 400; font-size: 24px; margin: 0 0 8px; }
.empty p { color: var(--muted); margin: 0 0 22px; }

/* Post form */
.form { display: grid; gap: 16px; }
.pick {
  display: grid; place-items: center;
  min-height: 280px;
  border: 1.5px dashed #cfc9c1;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted);
  text-align: center;
  overflow: hidden;
  cursor: pointer;
}
.pick svg { width: 36px; height: 36px; display: block; margin: 0 auto 8px; }
.pick img { width: 100%; max-height: 56vh; object-fit: contain; display: block; }
.pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card);
}
.field input[type="text"]:focus { outline: none; border-color: var(--ink); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button {
  padding: 12px 10px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card);
  text-align: left;
}
.seg button.on { border-color: var(--ink); }
.seg b { display: block; font-size: 14px; }
.seg span { font-size: 12px; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--ink); flex: none; }

/* My photos */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  position: relative;
  display: block;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f1eeea;
  aspect-ratio: 3 / 4;
  color: #fff;
  text-decoration: none;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .badge {
  position: absolute; left: 8px; bottom: 8px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(22, 21, 20, 0.72);
  font-size: 12px; font-weight: 600;
}
.tile .lock { position: absolute; right: 8px; top: 8px; width: 18px; height: 18px; filter: drop-shadow(0 0 3px rgba(0,0,0,0.6)); }

/* Results */
.results { padding: 16px; }
.score { font-family: Georgia, serif; font-size: 34px; line-height: 1.1; }
.score small { font: 14px system-ui, sans-serif; color: var(--muted); display: block; margin-top: 4px; }
.split { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line); margin: 14px 0 18px; }
.split .l { background: var(--like); }
.split .d { background: var(--dislike); }
.results h3 { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; font-weight: 600; }
.bar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 14px; margin-bottom: 10px; }
.bar .track { grid-column: 1 / -1; height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; }
.bar.like .fill { background: var(--like); }
.bar.dislike .fill { background: var(--dislike); }
.bar .n { color: var(--muted); }
.stack { display: grid; gap: 10px; margin-top: 16px; }

.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Friends */
.empty.small { padding: 28px 12px 20px; }
.empty.small p { margin-bottom: 0; }
.people { margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.person { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; }
.person + .person { border-top: 1px solid var(--line); }
.who { font-weight: 600; }
.stack .btn.ghost { flex: none; }

/* A/B compare */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--line); }
.side { position: relative; display: block; padding: 0; border: 0; background: #f1eeea; aspect-ratio: 3 / 4; overflow: hidden; }
.card .side img { width: 100%; height: 100%; max-height: none; object-fit: cover; }
.tag {
  position: absolute; left: 8px; top: 8px;
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(22, 21, 20, 0.72); color: #fff;
  font-size: 13px; font-weight: 700;
}
.actions.ab { display: grid; grid-template-columns: 1fr 1fr; gap: 0; justify-items: center; }
.actions.ab .round { font-family: Georgia, serif; font-size: 26px; }
.zoom {
  position: fixed; inset: 0; z-index: 10; padding: 0; border: 0;
  display: grid; place-items: center;
  background: rgba(22, 21, 20, 0.92);
}
.zoom img { max-width: 100%; max-height: 100dvh; object-fit: contain; }
.picks { display: grid; gap: 10px; }
.picks.two { grid-template-columns: 1fr 1fr; }
.picks.two .pick { min-height: 210px; }
.tile.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; }
.tile.two img { min-width: 0; }
.split.ab .l, .bar.a .fill { background: var(--ink); }
.split.ab .d, .bar.b .fill { background: #b3aca2; }
