/* Reggie's Client portal: one layout for every page (CHECKLIST 5.2). A top
   bar on wide screens, a bottom tab bar on phones; neutral greys with pink
   as the accent; light and dark by the system setting; motion off when the
   system asks for reduced motion (5.7). */
:root {
  --bg: #f2f4f5; --panel: #ffffff; --panel-2: #f7f8f9; --line: #e3e5e8; --text: #1b1d21; --muted: #666b73;
  --accent: #e85d9c; --accent-ink: #ffffff; --accent-soft: #fde8f2; --ok: #1a9f53; --bad: #d63c4a; --verified: #3b8eea;
  --shadow: 0 1px 2px rgba(20, 22, 26, .06), 0 4px 14px rgba(20, 22, 26, .06);
  --radius: 12px; --bar: 56px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111317; --panel: #1b1e23; --panel-2: #22262c; --line: #2d3138; --text: #f1f2f4; --muted: #9aa0a9;
    --accent-soft: #3a2230; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; min-height: 100dvh; }
h1 { font-size: 24px; margin: 0 0 14px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.status { min-height: 18px; margin: 8px 0 0; }
.status.ok { color: var(--ok); } .status.bad, .error { color: var(--bad); }
.error { min-height: 18px; margin: 4px 0; font-size: 13px; }

/* ---- controls ---------------------------------------------------------------- */
button, .button { appearance: none; border: 0; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600;
  padding: 0 16px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  transition: transform .12s ease, filter .12s ease, background .12s ease; -webkit-tap-highlight-color: transparent; }
button:hover, .button:hover { filter: brightness(1.06); }
button:active, .button:active { transform: scale(.96); }
button:disabled { opacity: .55; cursor: default; transform: none; }
button.ghost, .button.ghost { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
button.danger { background: var(--bad); }
.button.disabled { opacity: .5; pointer-events: none; }
.small-button { min-height: 32px; padding: 0 12px; font-size: 13px; }
input, select { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; min-height: 40px; padding: 0 12px; min-width: 0; width: 100%; }
textarea { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; width: 100%; resize: vertical; min-height: 96px; }
input[type=checkbox] { width: 20px; min-height: 20px; height: 20px; padding: 0; flex: none; accent-color: var(--accent); }
label.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 14px; min-height: 40px; cursor: pointer; }
label.short { max-width: 140px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=color] { padding: 2px; width: 44px; flex: none; }
input[type=file] { padding: 8px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form button { flex: none; }

/* ---- bars ------------------------------------------------------------------------- */
.top { position: sticky; top: 0; z-index: 20; height: var(--bar); display: flex; align-items: center; gap: 18px; padding: 0 max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand img { border-radius: 50%; }
.tabs { display: flex; gap: 2px; height: 100%; flex: 1; }
.tabs a { position: relative; display: flex; align-items: center; padding: 0 13px; color: var(--muted); font-weight: 600; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); }
.tabs a.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); animation: grow .2s ease; }
.count { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 6px; margin-left: 6px; }
.top-search { flex: 0 1 240px; }
.top-search input { min-height: 36px; border-radius: 18px; padding: 0 14px; }
.top-icon { display: none; width: 40px; height: 40px; border-radius: 50%; place-items: center; color: var(--text); }
.top-icon svg { width: 22px; height: 22px; }
.me { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; padding: 4px 8px; border-radius: 22px; }
.me:hover { background: var(--panel-2); }
.headshot { width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); object-fit: cover; box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.headshot.xl { width: 96px; height: 96px; }
.headshot.lg { width: 60px; height: 60px; }
.bottom { display: none; }

main { max-width: 1120px; margin: 0 auto; padding: 22px 16px 60px; }
.page { animation: page-in .22s ease both; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.page-head h1 { margin: 0; }
.page-head .inline-form { flex: 1; max-width: 380px; min-width: 220px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 10px; }
.section-head h2 { margin: 0; }
.more { font-weight: 600; font-size: 14px; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.empty { padding: 20px 0; }

/* ---- names and badges ------------------------------------------------------------ */
.name { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.verified { width: 16px; height: 16px; flex: none; color: var(--verified); }
.chip { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 9px; font-size: 11px; line-height: 1; color: #fff; padding: 0 3px; flex: none; }
.chip.adult { background: #c2410c; padding: 0 6px; font-weight: 800; vertical-align: middle; margin-left: 6px; }
.stack-form { display: grid; gap: 8px; }
.place .tools button { white-space: nowrap; }
.place.fixed .tools { grid-column: 4 / -1; }

/* ---- sign in --------------------------------------------------------------------- */
.auth { min-height: calc(100dvh - 44px); display: flex; align-items: center; justify-content: center; gap: 44px; flex-wrap: wrap; animation: page-in .3s ease both; }
.auth-art { width: min(340px, 70vw); border-radius: 20px; box-shadow: var(--shadow); }
.auth-card { width: min(360px, 100%); display: grid; gap: 12px; padding: 26px; }
.auth-logo { border-radius: 50%; justify-self: center; }
.auth-card h1 { text-align: center; margin: 0 0 4px; }
.auth-card button { width: 100%; min-height: 44px; }
.switch { text-align: center; margin: 0; font-weight: 600; }
.captcha:empty { display: none; }
.captcha { min-height: 65px; display: grid; place-items: center; }

/* ---- home ------------------------------------------------------------------------ */
.hello { display: flex; align-items: center; gap: 18px; }
.hello h1 { margin: 0 0 10px; font-size: 28px; }
.friend-row { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; }
.friend { width: 84px; flex: none; display: grid; justify-items: center; gap: 4px; color: var(--text); text-align: center; font-size: 13px; font-weight: 600; transition: transform .15s ease; }
.friend:hover { transform: translateY(-3px); }
.friend .pic { position: relative; }
.friend .dot { position: absolute; right: 2px; bottom: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--bg); }
.friend .join { color: var(--ok); font-size: 12px; }
.friend .name { max-width: 84px; }
.friend.add .pic { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); box-shadow: var(--shadow); color: var(--accent); font-size: 26px; }

/* ---- grids ----------------------------------------------------------------------- */
.grid { display: grid; gap: 14px; }
.grid.games { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.grid.items { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.game { padding: 0; overflow: hidden; transition: transform .16s ease, box-shadow .16s ease; }
.game:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(20, 22, 26, .16); }
.game .thumb { aspect-ratio: 16 / 10; width: 100%; object-fit: cover; display: block; background: var(--accent-soft); }
.game .thumb.logo { object-fit: contain; padding: 12px; }
.game .body { padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.game .title { font-weight: 700; }
.game .players { color: var(--ok); font-weight: 600; }
.item { padding: 10px; display: grid; gap: 6px; transition: transform .16s ease, box-shadow .16s ease; }
.item:hover { transform: translateY(-3px); }
.item img, .item .noimg { width: 100%; aspect-ratio: 1; border-radius: 8px; background: var(--panel-2); object-fit: contain; }
.item .label { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: 12px; color: var(--muted); }
.item button { min-height: 34px; font-size: 13px; }
.item.worn { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.item.pop { animation: pop .3s ease; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 12px; scrollbar-width: none; }
.filters button { flex: none; min-height: 32px; padding: 0 13px; border-radius: 16px; font-size: 13px; background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.filters button.on { background: var(--text); color: var(--bg); box-shadow: none; }

/* ---- avatar ---------------------------------------------------------------------- */
.editor { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 18px; align-items: start; }
.editor > * { min-width: 0; }
.preview { position: sticky; top: calc(var(--bar) + 14px); display: grid; gap: 12px; }
.viewer { position: relative; border-radius: 10px; background: radial-gradient(120% 90% at 50% 20%, var(--panel-2), var(--accent-soft)); overflow: hidden; touch-action: pan-y; cursor: grab; }
.viewer canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.turn { position: absolute; top: 50%; translate: 0 -50%; width: 36px; min-height: 36px; padding: 0; border-radius: 50%; background: color-mix(in srgb, var(--panel) 80%, transparent); color: var(--text); font-size: 22px; box-shadow: var(--shadow); }
.turn.left { left: 8px; } .turn.right { right: 8px; }
.saved { position: absolute; left: 10px; top: 10px; font-size: 12px; font-weight: 700; color: var(--ok); background: color-mix(in srgb, var(--panel) 85%, transparent); border-radius: 12px; padding: 3px 9px; opacity: 0; transition: opacity .25s ease; }
.saved.show { opacity: 1; }
.spinner-cover { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 1; transition: opacity .2s ease; }
.spinner-cover.done { opacity: 0; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.colors { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.colors label { justify-items: center; font-size: 11px; text-align: center; }
.colors input { width: 100%; min-height: 34px; }
.adjust summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.sliders { display: grid; grid-template-columns: auto 1fr 44px; gap: 6px 10px; align-items: center; margin: 10px 0; font-size: 13px; }
.sliders input { min-height: 28px; padding: 0; background: none; border: 0; accent-color: var(--accent); }
.sliders label { color: var(--muted); }

/* ---- friends, settings ----------------------------------------------------------- */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin: 10px 0 18px; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 12px; animation: page-in .2s ease both; }
.person .who { flex: 1; min-width: 0; display: grid; }
.person .where.on { color: var(--ok); font-weight: 600; }
.person .where { font-size: 12px; color: var(--muted); }
.person .actions { display: flex; gap: 6px; }
.person .actions button, .person .actions .button { min-height: 34px; padding: 0 12px; font-size: 13px; }
.person .name-link { color: var(--text); min-width: 0; }
.person .name-link:hover strong { text-decoration: underline; }
.person .pic-link { display: flex; flex: none; }
/* ---- search and profiles --------------------------------------------------------- */
.search-box { max-width: 560px; margin-bottom: 6px; }
.search-box input { min-height: 46px; border-radius: 23px; padding: 0 18px; font-size: 16px; }
.profile-head { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 22px; align-items: start; margin-bottom: 8px; }
.profile-info { display: grid; gap: 8px; min-width: 0; align-content: start; }
.profile-info h1 { margin: 4px 0 0; }
.profile-info h1 .name { font-size: inherit; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; }
.fact { font-size: 13px; font-weight: 600; background: var(--panel-2); border-radius: 14px; padding: 4px 11px; color: var(--muted); }
.fact.on { color: var(--ok); }
.bio { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0; max-width: 60ch; }
.profile { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.big-name { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.settings { display: grid; gap: 10px; max-width: 520px; margin-bottom: 14px; }
.notice { background: var(--accent-soft); border-radius: 8px; padding: 9px 12px; margin: 0; font-weight: 600; }
.credits { margin: 6px 0 0; }

/* ---- admin ----------------------------------------------------------------------- */
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.admin-grid .wide { grid-column: 1 / -1; }
.badge-list { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.badge-def { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border-radius: 16px; padding: 3px 4px 3px 8px; font-size: 13px; font-weight: 600; }
.badge-def button { min-height: 24px; width: 24px; padding: 0; border-radius: 50%; background: none; color: var(--muted); }
.accounts, .places, .audit { display: grid; gap: 2px; margin-top: 10px; max-height: 460px; overflow: auto; }
.account { display: grid; grid-template-columns: 36px minmax(120px, 1.4fr) minmax(0, 2fr); gap: 10px; align-items: center; padding: 8px 6px; border-radius: 8px; }
.account:hover, .place:hover { background: var(--panel-2); }
.account .who { display: grid; min-width: 0; }
.account .tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.account .tools button { min-height: 30px; padding: 0 10px; font-size: 12px; }
.account .banned { color: var(--bad); font-size: 12px; font-weight: 600; }
.place { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 70px 60px auto; gap: 8px; align-items: center; padding: 8px 6px; border-radius: 8px; }
.place input { min-height: 34px; }
.place .tools { display: flex; gap: 6px; }
.place .tools button { min-height: 32px; padding: 0 10px; font-size: 12px; }
.place.fixed span { padding: 0 6px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place .tools { justify-content: flex-end; }
.place-form { display: grid; grid-template-columns: 1.4fr 1fr 1fr 84px auto; gap: 8px; margin-top: 12px; }
.audit .entry { display: grid; grid-template-columns: 150px 110px 1fr; gap: 10px; font-size: 13px; padding: 5px 6px; border-radius: 6px; }
.audit .entry:nth-child(odd) { background: var(--panel-2); }

.toast { position: fixed; left: 50%; bottom: 84px; translate: -50% 0; background: var(--text); color: var(--bg); font-weight: 600; padding: 10px 16px; border-radius: 22px; box-shadow: var(--shadow); z-index: 40; animation: toast-in .25s ease both; max-width: calc(100vw - 32px); }
.skeleton { border-radius: var(--radius); min-height: 150px; background: linear-gradient(100deg, var(--panel) 30%, var(--panel-2) 50%, var(--panel) 70%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }

@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { 40% { transform: scale(1.07); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes grow { from { transform: scaleX(.3); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---- phones ---------------------------------------------------------------------- */
@media (max-width: 760px) {
  .top .tabs, .top .me .name, .top-search { display: none; }
  .top { justify-content: space-between; gap: 6px; }
  .top-icon { display: grid; margin-left: auto; }
  .profile-head { grid-template-columns: 1fr; gap: 12px; }
  .profile-head .viewer { width: min(100%, 260px); margin: 0 auto; }
  .bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottom a { position: relative; display: grid; justify-items: center; gap: 2px; padding: 7px 0 6px; min-height: 52px; color: var(--muted); font-size: 11px; font-weight: 600; }
  .bottom a.active { color: var(--accent); }
  .bottom svg { width: 22px; height: 22px; fill: currentColor; }
  .bottom .count { position: absolute; top: 4px; left: 54%; margin: 0; }
  main { padding: 16px 12px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 21px; }
  .editor { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; }
  .viewer { width: min(100%, 300px); margin: 0 auto; }
  .grid.games { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .grid.items { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .people { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .account { grid-template-columns: 36px 1fr; }
  .account .tools { grid-column: 1 / -1; justify-content: flex-start; }
  .place, .place-form { grid-template-columns: 1fr 1fr; }
  .audit .entry { grid-template-columns: 1fr; gap: 0; }
  .auth-art { display: none; }
  button, .button, input, select { min-height: 44px; }
  .item button, .person .actions button, .person .actions .button, .account .tools button, .place .tools button { min-height: 40px; }
  .filters button { min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
