:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #2b2b2b;
  --muted: #8a8a8a;
  --accent: #e8743b;
  --accent-ink: #ffffff;
  --line: #ece7df;
  --yes: #e23b6d;
  --no: #9aa0a6;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 14px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0 14px;
  gap: 10px;
}
.brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.foot {
  margin-top: auto;
  padding: 22px 0 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

h1 { font-size: clamp(23px, 5vw, 34px); margin: 0 0 8px; }
h2 { margin: 0; font-size: clamp(19px, 4vw, 24px); }
.lead { font-size: 17px; margin: 6px 0; }
.muted { color: var(--muted); }
.err { color: var(--yes); font-weight: 600; }
code {
  background: #f1ece4;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
  word-break: break-all;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 22px;
  box-shadow: var(--shadow);
}
.center { text-align: center; }

/* Buttons */
.btnrow {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}
.btnrow.sub { margin-top: 10px; }
button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
button.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 600;
}
button.small { padding: 9px 16px; font-size: 14px; }
button.big { padding: 15px 28px; font-size: 18px; }
button.link {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  padding: 8px;
  font-size: 15px;
}

/* Landing page */
.landing { text-align: center; padding-top: 8vh; }
.cards { margin-top: 26px; display: grid; gap: 14px; }
.projectcard {
  display: grid;
  gap: 4px;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  max-width: 360px;
  margin: 0 auto;
  width: 100%;
  transition: transform 0.06s, border-color 0.15s;
}
.projectcard:hover { border-color: var(--accent); }
.projectcard:active { transform: scale(0.99); }
.pc-emoji { font-size: 40px; }
.pc-title { font-size: 20px; font-weight: 700; }
.pc-desc { color: var(--muted); }
.pc-go { color: var(--accent); font-weight: 600; margin-top: 6px; }

/* Password gate */
.gate .lock { font-size: 44px; margin-bottom: 6px; }
.gateform { display: flex; flex-direction: column; gap: 12px; margin: 18px auto 0; max-width: 320px; }
.gateform input {
  font-size: 18px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  text-align: center;
  width: 100%;
}
.gateform input:focus { outline: none; border-color: var(--accent); }

/* Stage / single image */
.stage { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.counter { color: var(--muted); margin: 2px 0; font-size: 15px; }
.progress {
  width: 100%;
  max-width: 520px;
  height: 10px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
}
.progress .bar { height: 100%; background: var(--accent); transition: width 0.25s; }

.bigimg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  padding: 6px;
}
.bigimg img {
  max-width: 100%;
  max-height: 58vh;
  width: auto;
  object-fit: contain;
}
.bigimg.result img { max-height: 50vh; }

/* Like-phase choice buttons */
.choice {
  border: none;
  border-radius: 999px;
  padding: 15px 26px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  min-width: 130px;
}
.choice.yes { background: var(--yes); }
.choice.no { background: var(--no); }

/* Flip button */
.flip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.flip.on { border-color: var(--accent); color: var(--accent); background: #fff4ee; }

/* Knockout: two images head to head */
.versus {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  align-items: start;
}
.vs-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  padding: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
}
.vs-imgwrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #faf7f2;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
}
.vs-imgwrap img { width: 100%; max-height: 44vh; object-fit: contain; }
.vs-tools { display: flex; justify-content: center; }
.vs-choose {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px;
  font-weight: 700;
  font-size: 16px;
  width: 100%;
}
.vs-choose:active { transform: scale(0.99); }

/* Browse grid */
.pagehead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.thumb {
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Result */
.result-orient { font-size: 17px; margin: 4px 0; }

/* Lightbox */
.lb {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.lb img { max-width: 92vw; max-height: 78vh; object-fit: contain; border-radius: 8px; }
.lb-close {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 40px;
  background: none;
  border: none;
  color: #fff;
  padding: 0 14px;
}
.lb-nav.prev { left: 4px; }
.lb-nav.next { right: 4px; }
.lb-bar {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #fff;
}
.lb-cap { opacity: 0.85; font-size: 14px; }

/* Larger screens: a bit more breathing room between the two duel images */
@media (min-width: 700px) {
  .versus { grid-template-columns: 1fr 1fr; gap: 26px; max-width: 820px; margin: 0 auto; }
  .vs-imgwrap img { max-height: 52vh; }
}
