/* RateMyFace beta — mobile-first, no frameworks. */
:root {
  --bg: #aed6f1;
  --card: #ffffff;
  --ink: #221d1a;
  --muted: #8a7f78;
  --line: #ece5e0;
  --accent: #ff3d8a;
  --accent-dark: #d62674;
  --accent-soft: #ffe0ec;
  --gold: #d97706;
  --green: #15803d;
  --blue: #1d4ed8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(34, 29, 26, .06), 0 8px 24px rgba(34, 29, 26, .07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink);
  line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent-dark); }
img { max-width: 100%; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .9rem; background: rgba(255,255,255,.96);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .45rem; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.15rem; }
.brand-face { font-size: 1.4rem; }
.brand-logo { height: 2.1rem; width: auto; display: block; }
.brand-name { color: #5db7e8; }
.brand-name .wm-o { color: #ff3d8a; font-style: normal; }
.nav { margin-left: auto; display: flex; align-items: center; gap: .55rem; font-size: .92rem; flex-wrap: wrap; justify-content: flex-end; }
.nav a { color: var(--ink); text-decoration: none; padding: .3rem .45rem; border-radius: 8px; }
.nav a.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
.nav-user { font-weight: 700; color: var(--muted); }
.linklike { background: none; border: 0; color: var(--accent-dark); font: inherit; cursor: pointer; padding: .3rem .45rem; }
.linklike:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; row-gap: .3rem; padding: .55rem .7rem; }
  .brand { font-size: 1.05rem; }
  .nav {
    flex: 1 1 100%; margin-left: 0;
    flex-wrap: nowrap; justify-content: flex-start;
    overflow-x: auto; overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    gap: .15rem; font-size: .88rem;
    -webkit-mask-image: linear-gradient(to right, #000 96%, transparent);
    mask-image: linear-gradient(to right, #000 96%, transparent);
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav > span:not([hidden]) { display: contents; }
  .nav a, .nav .linklike { white-space: nowrap; flex: 0 0 auto; padding: .35rem .5rem; }
}

/* ---------- layout ---------- */
.view { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 1rem .9rem 3rem; }
.view-wide { max-width: 920px; }
.footer { border-top: 1px solid var(--line); background: #fff; }
.footer-inner { max-width: 920px; margin: 0 auto; padding: 1rem .9rem 2rem; font-size: .82rem; color: var(--muted); }
.footer-links a { color: var(--muted); }

/* ---------- cards & buttons ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
.card h2, .card h3 { margin: 0 0 .6rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: .6rem; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt { margin-top: 1rem; }

.btn {
  display: inline-block; border: 0; cursor: pointer; text-decoration: none;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 1rem;
  padding: .7rem 1.4rem; border-radius: 999px; text-align: center;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-small { font-size: .85rem; padding: .45rem .9rem; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f6f2ef; }
.btn-danger { background: #b91c1c; }
.btn-danger:hover { background: #991b1b; }

/* ---------- forms ---------- */
.field { margin-bottom: .85rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; padding: .65rem .8rem;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.form-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: .6rem .8rem; border-radius: 10px; margin-bottom: .8rem; font-size: .92rem; }
.form-ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; padding: .6rem .8rem; border-radius: 10px; margin-bottom: .8rem; font-size: .92rem; }

/* ---------- vote flow ---------- */
.vote-stage { text-align: center; }
.vote-photo-wrap {
  position: relative; display: inline-block; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); background: #eee; max-width: 100%;
}
.vote-photo { display: block; max-width: 100%; max-height: 52vh; width: auto; margin: 0 auto; }
.vote-meta { margin: .7rem 0 .4rem; font-size: .95rem; }
.vote-meta .score { font-weight: 800; font-size: 1.25rem; color: var(--accent-dark); }
.vote-count-chip {
  display: inline-block; background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: .25rem .8rem; font-size: .85rem; color: var(--muted); margin-bottom: .6rem;
}
.vote-pad { display: grid; grid-template-columns: repeat(10, 1fr); gap: .35rem; max-width: 560px; margin: .4rem auto 0; }
.vote-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  font-size: 1.05rem; font-weight: 800; padding: .65rem 0; cursor: pointer; color: var(--ink);
  min-width: 0;
  transition: transform .08s ease, background .12s ease;
}
@media (max-width: 480px) {
  .vote-pad { gap: .25rem; }
  .vote-btn { font-size: .95rem; padding: .55rem 0; border-radius: 8px; }
}
.vote-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.vote-btn:active { transform: scale(.93); background: var(--accent); color: #fff; }
.vote-btn.picked { background: var(--accent); border-color: var(--accent); color: #fff; }
.vote-actions { display: flex; gap: .5rem; justify-content: center; margin-top: .8rem; flex-wrap: wrap; }
.vote-flash { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(.96); opacity: .4; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- profile cards / grids ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; display: block; box-shadow: var(--shadow); }
.pcard img { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; background: #eee; }
.pcard-body { padding: .55rem .7rem .7rem; }
.pcard-name { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-sub { font-size: .8rem; color: var(--muted); }
.pcard-score { font-weight: 800; color: var(--accent-dark); }
.pos-num { font-size: .78rem; font-weight: 800; color: #fff; background: var(--ink); border-radius: 999px; padding: .1rem .5rem; margin-right: .35rem; }

.profile-hero img { width: 100%; max-height: 60vh; object-fit: contain; border-radius: var(--radius); background: #111; display: block; }
.stat-line { display: flex; gap: 1.2rem; margin: .6rem 0; flex-wrap: wrap; }
.stat-line .stat b { font-size: 1.3rem; display: block; }
.stat-line .stat span { font-size: .78rem; color: var(--muted); }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; border-radius: 999px; padding: .15rem .6rem; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.thumb-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.thumb { position: relative; width: 84px; }
.thumb img { width: 84px; height: 100px; object-fit: cover; border-radius: 10px; display: block; background: #eee; }
.thumb .badge { position: absolute; top: 4px; left: 4px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .4rem; margin-bottom: 1rem; overflow-x: auto; padding-bottom: .2rem; }
.tab { white-space: nowrap; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .45rem 1rem; font: inherit; font-size: .9rem; cursor: pointer; color: var(--ink); }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700; }

/* ---------- stats dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin-bottom: 1rem; }
@media (min-width: 560px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .8rem; text-align: center; }
.stat-box b { font-size: 1.5rem; display: block; }
.stat-box span { font-size: .75rem; color: var(--muted); }
.sect { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.sect h3 { margin: 0 0 .15rem; font-size: 1.02rem; display: flex; align-items: center; gap: .4rem; }
.sect .about { font-size: .8rem; color: var(--muted); margin: 0 0 .7rem; }
.info-dot { display: inline-grid; place-items: center; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--line); color: var(--muted); font-size: .7rem; font-weight: 800; cursor: help; }
.bar-row { display: grid; grid-template-columns: 5.5rem 1fr 3.2rem; gap: .5rem; align-items: center; font-size: .82rem; margin: .3rem 0; }
.bar-row .seg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.bar-track { background: #f3ede9; border-radius: 6px; height: .7rem; overflow: hidden; }
.bar-fill { background: var(--accent); height: 100%; border-radius: 6px; }
.bar-row .val { text-align: right; color: var(--muted); }
.hist { display: flex; align-items: flex-end; gap: 4px; height: 120px; margin-top: .4rem; }
.hist .hcol { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.hist .hbar { width: 100%; max-width: 34px; background: var(--accent); border-radius: 5px 5px 0 0; min-height: 3px; }
.hist .hlabel { font-size: .68rem; color: var(--muted); margin-top: 3px; }
.heat { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
@media (min-width: 560px) { .heat { grid-template-columns: repeat(24, 1fr); } }
.heat .cell { aspect-ratio: 1; border-radius: 5px; background: #f3ede9; }
.heat .cell[data-on="1"] { background: var(--accent); }
.heat-legend { font-size: .75rem; color: var(--muted); margin-top: .4rem; }
.chart { width: 100%; height: auto; display: block; }
.winner-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.winner { background: #fff8e6; border: 1px solid #f5d98b; border-radius: 12px; padding: .7rem; text-align: center; font-size: .82rem; }
.winner b { display: block; font-size: 1rem; }
.winner .trophy { font-size: 1.3rem; }

/* ---------- comments ---------- */
.comment { border-top: 1px solid var(--line); padding: .7rem 0; }
.comment .who { font-weight: 700; font-size: .88rem; }
.comment .when { font-size: .75rem; color: var(--muted); margin-left: .4rem; }
.comment p { margin: .3rem 0 0; font-size: .93rem; }

/* ---------- house ads ---------- */
.house-ad { border: 1px dashed #d8c9c2; background: #fffdf9; border-radius: var(--radius); padding: .9rem 1rem; margin: 1rem 0; }
.house-ad .ad-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.house-ad h4 { margin: .25rem 0; font-size: 1rem; }
.house-ad p { margin: .25rem 0 .6rem; font-size: .88rem; color: var(--muted); }
.house-ad img { border-radius: 10px; margin: .4rem 0; max-height: 180px; width: 100%; object-fit: cover; }

/* ---------- admin ---------- */
.queue-item { border: 1px solid var(--line); border-radius: 12px; padding: .8rem; margin-bottom: .7rem; background: #fff; }
.queue-item img { width: 72px; height: 88px; object-fit: cover; border-radius: 8px; background: #eee; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.admin-table th, .admin-table td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .7rem 1.2rem; border-radius: 999px;
  font-size: .92rem; box-shadow: var(--shadow); z-index: 100; max-width: 92vw; text-align: center;
}

/* ---------- misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -9999px; }
details.faq { margin-top: 1rem; font-size: .88rem; }
details.faq summary { cursor: pointer; font-weight: 600; color: var(--accent-dark); }
.kbd-hint { font-size: .75rem; color: var(--muted); }
@media (min-width: 560px) { .view { padding-top: 1.4rem; } }
