:root {
  --pink: #ff8fc6;
  --pink-strong: #ff5fa8;
  --pink-soft: #ffe1f0;
  --ink: #2b1b25;
  --muted: #8a6a7c;
  --card: #ffffff;
  --bg: #fff5fa;
  --line: #f3c9de;
  --ok: #2f9e62;
  --bad: #c8325a;
  --radius: 16px;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: radial-gradient(circle at 10% 0%, #ffe6f3 0, transparent 40%), var(--bg);
  color: var(--ink);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--pink-strong); }
h1 { font-size: 26px; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 26px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 22px;
  padding: 10px 24px;
  background: linear-gradient(90deg, var(--pink-strong), var(--pink));
  color: #fff;
  box-shadow: 0 2px 14px rgba(255, 95, 168, .35);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 19px; }
.brand img { width: 38px; height: 38px; border-radius: 50%; background: #fff; object-fit: cover; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a { color: #fff; text-decoration: none; padding: 7px 14px; border-radius: 999px; font-weight: 600; }
.tabs a:hover { background: rgba(255,255,255,.18); }
.tabs a.active { background: #fff; color: var(--pink-strong); }
.me { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.headshot { width: 38px; height: 38px; border-radius: 50%; background: var(--pink-soft); border: 2px solid #fff; }
.headshot.big { width: 110px; height: 110px; border: 4px solid var(--pink); }

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 24px; }
footer { text-align: center; padding: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 6px 20px rgba(255, 95, 168, .08); }

button, .button {
  appearance: none; border: 0; cursor: pointer;
  background: var(--pink-strong); color: #fff;
  font: inherit; font-weight: 700;
  padding: 9px 18px; border-radius: 999px; text-decoration: none; display: inline-block;
}
button:hover, .button:hover { filter: brightness(1.06); }
button:disabled { opacity: .6; cursor: progress; }
.button.disabled { opacity: 0.55; cursor: default; filter: none; }
button.ghost, .button.ghost { background: transparent; color: var(--pink-strong); box-shadow: inset 0 0 0 2px var(--pink-strong); }
.top button.ghost { color: #fff; box-shadow: inset 0 0 0 2px #fff; padding: 6px 14px; }
input {
  font: inherit; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); min-width: 0;
}
input:focus { outline: 2px solid var(--pink); border-color: transparent; }

/* sign in */
.auth { display: grid; grid-template-columns: 1fr 380px; gap: 28px; align-items: center; min-height: 70vh; }
.auth-art img { width: 100%; max-height: 460px; object-fit: contain; border-radius: var(--radius); }
.auth-card { display: flex; flex-direction: column; gap: 12px; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.error { color: var(--bad); min-height: 1.2em; margin: 0; font-size: 14px; }
.switch { margin: 0; text-align: center; }

/* home */
.hello { display: flex; align-items: center; gap: 22px; position: relative; overflow: hidden; }
.hello-reggie { margin-left: auto; height: 130px; border-radius: 12px; }

/* grids */
.grid { display: grid; gap: 14px; }
.grid.items { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.games { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.item { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.item img, .item .noimg { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--pink-soft); border-radius: 12px; }
.item .name { font-weight: 600; font-size: 14px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.5em; }
.item .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.item .free { color: var(--ok); font-weight: 700; }
.item button { padding: 6px 10px; font-size: 13px; }
.item.worn { outline: 3px solid var(--pink-strong); }
.game { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.game img { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--pink-soft); }
.game .body { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.game .title { font-weight: 700; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.filters button { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); padding: 6px 12px; font-weight: 600; }
.filters button.on { background: var(--pink-strong); color: #fff; box-shadow: none; }

/* catalog import */
.import { display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; align-items: center; }
.import h2 { margin: 0 0 2px; }
.import #import-status { grid-column: 1 / -1; margin: 0; min-height: 1.2em; }
.import input { width: 260px; }

/* avatar editor */
.editor { display: grid; grid-template-columns: 330px 1fr; gap: 20px; align-items: start; }
.preview { display: flex; flex-direction: column; align-items: center; gap: 12px; position: sticky; top: 80px; }
#avatar-canvas { background: linear-gradient(#ffeaf4, #fff); border-radius: 12px; width: 300px; height: 390px; }
.colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.colors label { display: flex; flex-direction: column; align-items: center; font-size: 12px; gap: 2px; }
.colors input[type=color] { width: 44px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }

@media (max-width: 820px) {
  .auth, .editor { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .tabs { order: 3; width: 100%; }
  main { padding: 16px; }
  .hello-reggie { display: none; }
  .import { grid-template-columns: 1fr; }
  .import input { width: 100%; }
  .preview { position: static; }
}

/* 3D viewer and adjustments */
.viewer { width: 300px; height: 390px; border-radius: 12px; background: radial-gradient(circle at 50% 35%, #fff, #ffe3f1); cursor: grab; overflow: hidden; }
.viewer:active { cursor: grabbing; }
.hint { margin: -6px 0 0; }
.offscreen { position: fixed; left: -10000px; top: 0; width: 256px; height: 256px; }
.adjust { width: 100%; border-top: 1px solid var(--line); padding-top: 10px; }
.adjust summary { font-weight: 700; cursor: pointer; margin-bottom: 8px; }
.adjust select { width: 100%; font: inherit; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; margin-bottom: 8px; }
.sliders { display: grid; grid-template-columns: 70px 1fr 46px; gap: 4px 8px; align-items: center; font-size: 13px; }
.sliders input[type=range] { width: 100%; accent-color: var(--pink-strong); }
.sliders output { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.small-button { padding: 5px 12px; font-size: 13px; margin-top: 8px; }

/* loading spinners (the 3D avatar and its headshot icons) */
.viewer-wrap { position: relative; width: 300px; height: 390px; }
.spinner-cover { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 12px; background: radial-gradient(circle at 50% 35%, #fff, #ffe3f1); transition: opacity .25s; }
.spinner-cover.done { opacity: 0; pointer-events: none; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--pink-soft); border-top-color: var(--pink-strong); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-wrap { position: relative; display: inline-grid; place-items: center; }
.icon-wrap > * { grid-area: 1 / 1; }
.icon-wrap .spinner { width: 18px; height: 18px; border-width: 3px; display: none; }
.icon-wrap.big .spinner { width: 34px; height: 34px; border-width: 4px; }
.icon-wrap.loading .spinner { display: block; }
.icon-wrap.loading canvas { opacity: .35; }
.viewer-error { padding: 20px; text-align: center; color: var(--muted); }

.copy-roblox { width: 100%; display: flex; flex-direction: column; gap: 4px; }
.copy-roblox .row { flex-wrap: nowrap; }
.copy-roblox input { flex: 1; }
.copy-roblox button { padding: 8px 14px; }

/* settings */
.settings { max-width: 560px; display: flex; flex-direction: column; gap: 10px; }
.settings h2 { margin: 0; }
.settings p { margin: 0; }
.settings input { flex: 1; min-width: 180px; }
#settings-status { min-height: 1.2em; }

/* friends */
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: #fff; color: var(--pink-strong); font-size: 12px; line-height: 18px; text-align: center; margin-left: 2px; }
.tabs a.active .badge { background: var(--pink-strong); color: #fff; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.person { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 12px; }
.person img { width: 56px; height: 56px; border-radius: 50%; background: var(--pink-soft); object-fit: cover; flex: none; }
.person .who { flex: 1; min-width: 120px; }
.person .who strong, .person .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .where { font-size: 12px; color: var(--muted); }
.person .where.on { color: var(--ok); font-weight: 600; }
.person .actions { display: flex; gap: 6px; flex: none; }
.person button { padding: 6px 12px; font-size: 13px; }
