/* Mobile-first styles. Designed for 360-414px phones; scales up with min-width. */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #16202b;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0b7a5b;
  --brand-ink: #ffffff;
  --accent: #0d5c46;
  --warn: #b45309;
  --shadow: 0 1px 3px rgba(16, 32, 43, 0.08), 0 6px 20px rgba(16, 32, 43, 0.06);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1620;
    --card: #17212e;
    --ink: #e8eef4;
    --muted: #93a2b4;
    --line: #263243;
    --brand: #12b083;
    --accent: #0f8f6c;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ---------- auth pages ---------- */
.auth-bg { display: grid; min-height: 100dvh; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.auth label { display: block; font-weight: 600; margin: 16px 0 6px; }
.auth input {
  width: 100%; padding: 13px 14px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
}
.error { color: #b91c1c; font-weight: 600; }
button, .btn {
  display: inline-block; text-align: center; cursor: pointer;
  font-size: 16px; font-weight: 600; min-height: 48px; padding: 12px 18px;
  border-radius: 10px; border: 1px solid transparent; text-decoration: none;
}
.auth button { width: 100%; margin-top: 18px; background: var(--brand); color: var(--brand-ink); border: 0; }
.btn--primary { background: var(--brand); color: var(--brand-ink); border: 0; }
.btn--outline { background: transparent; color: var(--accent); border: 1px solid var(--brand); }
.btn--ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }

/* ---------- headers ---------- */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding: 16px; gap: 12px; }
.eyebrow { text-transform: uppercase; letter-spacing: .04em; font-size: .72rem; color: var(--muted); margin: 0 0 2px; }
.logout { font-size: .9rem; white-space: nowrap; }
.intro { margin: 18px 0; }
.deadline { font-weight: 600; margin: 6px 0; }
.deadline.closed { color: var(--warn); }
.pick-status { margin: 6px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pick-status p, .pick-status form { margin: 0; }

/* ---------- overview grid ---------- */
.opt-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 16px 0 32px; }
@media (min-width: 620px) { .opt-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .opt-grid { grid-template-columns: 1fr 1fr 1fr; } }

.opt-card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  color: inherit; text-decoration: none; transition: transform .08s ease;
}
.opt-card:active { transform: scale(.99); }
.opt-card.picked { outline: 2px solid var(--brand); outline-offset: -2px; }
.opt-card__img { position: relative; aspect-ratio: 16 / 10; background: var(--line); }
.opt-card__img img { width: 100%; height: 100%; object-fit: cover; }
.pick-flag {
  position: absolute; top: 10px; left: 10px; background: var(--brand); color: #fff;
  font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.opt-card__body { padding: 14px; }
.opt-card__body h2 { font-size: 1.1rem; }
.area { color: var(--muted); margin: 2px 0 10px; font-size: .92rem; }

/* ---------- chips ---------- */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 10px 0; }
.chips li {
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; font-size: .82rem; max-width: 100%;
}

/* ---------- share badge ---------- */
.share-badge {
  display: inline-flex; align-items: baseline; gap: 5px;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent);
  color: var(--accent); border-radius: 10px; padding: 6px 10px; margin-top: 8px;
}
.share-badge strong { font-size: 1.25rem; }
.share-badge small { color: var(--muted); font-size: .72rem; }

/* ---------- compare table ---------- */
.compare { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.compare > summary { cursor: pointer; padding: 14px 16px; font-weight: 600; }
.compare__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.compare table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: .9rem; }
.compare th, .compare td { text-align: left; padding: 10px 12px; border-top: 1px solid var(--line); white-space: nowrap; }
.compare .num { text-align: right; }

/* ---------- detail ---------- */
.detail-top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 16px;
}
.detail-top .back { font-size: 1.4rem; text-decoration: none; line-height: 1; padding: 6px 8px; }
.detail-top h1 { font-size: 1.05rem; flex: 1; margin: 0; }
.detail-top .share-badge { margin: 0; }
.detail { padding-bottom: 96px; }
.detail .area { margin: 12px 0 0; }
.cost-callout {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 16px 0; box-shadow: var(--shadow);
}
.cost-callout .share-badge strong { font-size: 1.5rem; }

.proscons { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 16px 0; }
@media (min-width: 620px) { .proscons { grid-template-columns: 1fr 1fr; } }
.proscons > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.proscons ul { margin: 0; padding-left: 18px; }
.pros h2 { color: var(--accent); }
.cons h2 { color: var(--warn); }

/* ---------- units ---------- */
.units { margin: 20px 0; }
.unit {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); margin: 14px 0;
}
.unit__body { padding: 14px; }
.unit__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rating { font-weight: 600; }
.cancel { font-size: .9rem; color: var(--muted); margin: 10px 0; }
.cancel.strict { color: var(--warn); font-weight: 600; }
.unit__links { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- galleries ---------- */
.gallery {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery .slide { flex: 0 0 100%; scroll-snap-align: center; }
.gallery--hero .slide { aspect-ratio: 16 / 10; }
.gallery--mini .slide { aspect-ratio: 3 / 2; }
.gallery .slide img { width: 100%; height: 100%; object-fit: cover; }
.gallery--hero { border-radius: var(--radius); overflow: hidden; }
.gallery-dots { display: flex; justify-content: center; gap: 6px; margin: 8px 0; }
.gallery-dots button { width: 8px; height: 8px; min-height: 0; padding: 0; border-radius: 999px; background: var(--line); border: 0; }
.gallery-dots button[aria-current="true"] { background: var(--brand); }

/* ---------- vote bar ---------- */
.votebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex; justify-content: center;
}
.votebar .btn--primary { width: 100%; max-width: 520px; }
.votebar .btn--primary.is-picked { background: var(--accent); }
.votebar.closed span, .votebar.viewing span { color: var(--muted); font-weight: 600; }

/* ---------- admin ---------- */
.admin { padding-bottom: 40px; }
.admin .card { margin: 16px 0; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.admin-actions form { margin: 0; }
table.mini { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.mini th, table.mini td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); }
table.mini .num { text-align: right; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .85rem; }
.linkbox { width: 100%; min-width: 260px; padding: 6px 8px; font-size: .8rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.ok { color: var(--brand); font-weight: 600; }
.admin label { display: block; font-weight: 600; margin: 12px 0 6px; font-size: .9rem; }
.admin input:not([type="checkbox"]), .admin select {
  width: 100%; padding: 10px 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
}
.admin label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.admin .actions-cell { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.admin .actions-cell form { margin: 0; }
.roster-form { display: grid; gap: 10px; max-width: 420px; }
.roster-form button { margin-top: 4px; }

/* ---------- lightbox (JS) ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.92); }
.lightbox__strip {
  position: absolute; inset: 0; display: flex;
  overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.lightbox__strip::-webkit-scrollbar { display: none; }
.lightbox__slide {
  flex: 0 0 100%; scroll-snap-align: center;
  display: grid; place-items: center; padding: 20px;
}
.lightbox__slide img { max-width: 100%; max-height: 90vh; object-fit: contain; }
.lightbox button {
  background: rgba(255,255,255,.15); color: #fff; border: 0;
  border-radius: 999px; width: 44px; height: 44px; padding: 0; line-height: 1;
}
.lightbox__close { position: absolute; top: 14px; right: 14px; font-size: 20px; z-index: 1; }
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 30px; z-index: 1;
}
.lightbox__prev { left: 12px; }
.lightbox__next { right: 12px; }
@media (max-width: 560px) { .lightbox__nav { display: none; } }
