/* xxxflash — "velvet stage": aubergine room, rose actions, brass rankings. */

:root {
  --night: #1d1321;
  --velvet: #2b1b31;
  --velvet-2: #372440;
  --rose: #f2a7b8;
  --rose-deep: #d97a93;
  --brass: #d9b26a;
  --mist: #eadce6;
  --dusk: #9c8aa3;
  --line: #45304e;

  --display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 1.953rem;

  --radius-s: 6px;
  --radius-m: 12px;
  --gutter: clamp(16px, 3vw, 32px);
  --rail: 220px;
  --max: 1320px;
}

*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--night);
  color: var(--mist);
  font: 400 var(--step-0) / 1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

a { color: var(--rose); text-decoration: none; }
a:hover { color: var(--mist); }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
}
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- header -------------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--line);
  background: var(--night);
}
.masthead-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px var(--gutter) 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px 24px;
  align-items: center;
}
.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: -0.03em;
  color: var(--mist);
}
.wordmark span { color: var(--rose); }
.wordmark:hover { color: var(--mist); }

.search { display: flex; max-width: 520px; width: 100%; justify-self: center; }
.search input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--mist);
  background: var(--velvet);
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: var(--radius-s) 0 0 var(--radius-s);
  padding: 9px 14px;
}
.search input::placeholder { color: var(--dusk); }
.search button {
  font: 500 var(--step--1) var(--body);
  color: var(--night);
  background: var(--rose);
  border: 0;
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  padding: 0 16px;
  cursor: pointer;
}

.account { display: flex; gap: 14px; align-items: center; font-size: var(--step--1); white-space: nowrap; }
.account .score { color: var(--brass); font-weight: 600; }
.btn-upload {
  color: var(--night);
  background: var(--brass);
  padding: 8px 14px;
  border-radius: var(--radius-s);
  font-weight: 600;
}
.btn-upload:hover { color: var(--night); background: var(--mist); }

.sections {
  grid-column: 1 / -1;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.sections a {
  color: var(--dusk);
  padding: 10px 12px 12px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.sections a:hover { color: var(--mist); }
.sections a[aria-current="page"] { color: var(--mist); border-bottom-color: var(--rose); }

/* ---- page frame ---------------------------------------------------------- */

.frame {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--gutter) 48px;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 32px;
}
.frame--wide { grid-template-columns: minmax(0, 1fr); }

.genres { position: sticky; top: 16px; align-self: start; }
.genres h2 { font-size: var(--step-0); color: var(--dusk); font-family: var(--body); font-weight: 500; }
.genres ul { list-style: none; margin: 0; padding: 0; }
.genres a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 5px 10px;
  margin: 0 -10px;
  border-radius: var(--radius-s);
  color: var(--mist);
}
.genres a:hover { background: var(--velvet); }
.genres a[aria-current="page"] { background: var(--velvet-2); color: var(--rose); }
.genres .count { color: var(--dusk); font-size: var(--step--1); font-variant-numeric: tabular-nums; }

.page-head { margin-bottom: 20px; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { margin: 0; color: var(--dusk); }

/* ---- top-5 strip: the one loud element ----------------------------------- */

.top5 { margin-bottom: 40px; }
.top5 ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}
.top5 li { position: relative; padding-left: 28px; }
.top5 .rank {
  position: absolute;
  left: 0;
  bottom: 42px;
  z-index: 1;
  font: 700 clamp(3rem, 6vw, 5.25rem) / 0.8 var(--display);
  color: var(--brass);
  -webkit-text-stroke: 3px var(--night);
  paint-order: stroke fill;
  pointer-events: none;
}
.top5 img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-m);
  background: var(--velvet);
}
.top5 .name {
  display: block;
  margin-top: 8px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--mist);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---- game grid ----------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 28px 20px;
}
.tile img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-m);
  background: var(--velvet);
}
.tile .title {
  display: block;
  margin: 10px 0 4px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--mist);
}
.tile .title:hover { color: var(--rose); }
.tile p {
  margin: 0 0 8px;
  color: var(--dusk);
  font-size: var(--step--1);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.empty { color: var(--dusk); padding: 40px 0; }

/* rating + views row, used in tiles and on the game page */
.meta { display: flex; align-items: center; gap: 14px; font-size: var(--step--1); color: var(--dusk); }
.rating { display: inline-flex; align-items: center; gap: 2px; }
.rating .value { color: var(--brass); font-weight: 600; min-width: 2ch; font-variant-numeric: tabular-nums; }
.vote {
  font: 600 var(--step-0) / 1 var(--body);
  color: var(--mist);
  background: var(--velvet);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  width: 28px;
  height: 26px;
  cursor: pointer;
}
.vote:hover { border-color: var(--rose); color: var(--rose); }
.vote:active { background: var(--velvet-2); }

/* ---- pagination ---------------------------------------------------------- */

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 36px; }
.pager .pages-info { color: var(--dusk); font-size: var(--step--1); margin-right: 10px; }
.pager a, .pager .current {
  min-width: 38px;
  padding: 7px 10px;
  text-align: center;
  border-radius: var(--radius-s);
  font-variant-numeric: tabular-nums;
}
.pager a { background: var(--velvet); color: var(--mist); }
.pager a:hover { background: var(--velvet-2); }
.pager .current { background: var(--rose); color: var(--night); font-weight: 600; }

/* ---- lower blocks: random strip, discussion, top players ----------------- */

.shelf { margin-top: 48px; }
.shelf-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.shelf-row img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-s);
  background: var(--velvet);
}

.lower {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 32px;
  margin-top: 48px;
}
.players ol { margin: 0; padding-left: 1.4em; }
.players li { padding: 4px 0; }
.players li::marker { color: var(--dusk); font-variant-numeric: tabular-nums; }
.players .score { color: var(--brass); font-weight: 600; margin-left: 6px; }

/* ---- comments ------------------------------------------------------------ */

.comment { padding: 14px 0; border-top: 1px solid var(--line); }
.comment-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  font-size: var(--step--1);
  color: var(--dusk);
  margin-bottom: 4px;
}
.comment-head .author { color: var(--mist); font-weight: 600; }
.comment-head .author-score { color: var(--brass); }
.comment-head .on-game { color: var(--rose); }
.comment-body { display: flex; gap: 12px; max-width: 72ch; overflow-wrap: anywhere; }
.comment-body img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.comment .staff { margin-left: auto; }
.linklike { color: var(--dusk); }
.more-comments {
  margin-top: 12px;
  font: inherit;
  color: var(--rose);
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 8px 14px;
  cursor: pointer;
}
.more-comments:hover { border-color: var(--rose); }

/* ---- game page: the stage ------------------------------------------------ */

.crumbs { font-size: var(--step--1); color: var(--dusk); margin-bottom: 10px; }
.crumbs a { color: var(--dusk); }
.crumbs a:hover { color: var(--rose); }

.stage {
  background:
    radial-gradient(ellipse at 50% 0%, #4a2a4f 0%, transparent 65%),
    linear-gradient(180deg, #25162a, #150d18);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: clamp(12px, 3vw, 32px);
}
.stage .game-player ruffle-player { border-radius: var(--radius-s); overflow: hidden; }
.stage .player-fallback { color: var(--mist); }
.stage .player-note { color: var(--brass); }

.game-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 32px;
  margin-top: 20px;
  align-items: start;
}
.game-info h1 { margin-bottom: 8px; }
.game-info .description { max-width: 72ch; margin: 0; color: var(--mist); }
.game-info .meta { flex-wrap: wrap; margin-top: 12px; }
.game-info .rating .value { font-size: var(--step-1); }
.edit-link { font-size: var(--step--1); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chips a {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--mist);
  font-size: var(--step--1);
}
.chips a:hover { border-color: var(--rose); color: var(--rose); }

.discussion { margin-top: 40px; max-width: 820px; }
.comment-form textarea {
  width: 100%;
  min-height: 110px;
  font: inherit;
  color: var(--mist);
  background: var(--velvet);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  resize: vertical;
}
.comment-form textarea:focus { border-color: var(--rose); outline: none; }

.btn {
  display: inline-block;
  font: 600 var(--step-0) var(--body);
  color: var(--night);
  background: var(--rose);
  border: 0;
  border-radius: var(--radius-s);
  padding: 10px 18px;
  cursor: pointer;
  margin-top: 10px;
}
.btn:hover { background: var(--mist); color: var(--night); }

/* ---- forms: login, upload ------------------------------------------------ */

.panel { max-width: 560px; }
.panel p { color: var(--dusk); max-width: 60ch; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; }
.field input[type="text"], .field input[type="email"], .field textarea, .field select {
  width: 100%;
  font: inherit;
  color: var(--mist);
  background: var(--velvet);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 9px 12px;
}
.field select[multiple] { min-height: 180px; }
.field input[type="file"] { color: var(--dusk); }
.field .hint { color: var(--dusk); font-size: var(--step--1); margin-top: 4px; }
.form-error { color: var(--rose-deep); font-size: var(--step--1); }
.notice {
  border-left: 3px solid var(--brass);
  background: var(--velvet);
  padding: 12px 16px;
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  margin-bottom: 20px;
}

/* ---- footer -------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--line);
  color: var(--dusk);
  font-size: var(--step--1);
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--gutter) 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}
.footer p { margin: 0; max-width: 70ch; }

/* ---- small screens ------------------------------------------------------- */

@media (max-width: 960px) {
  .frame { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .genres { position: static; }
  .genres h2 { display: none; }
  .genres ul { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
  .genres a { margin: 0; white-space: nowrap; background: var(--velvet); }
  .genres .count { display: none; }
  .top5 ol { grid-template-columns: repeat(5, minmax(140px, 1fr)); overflow-x: auto; padding-bottom: 6px; }
  .lower, .game-info { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .masthead-inner { grid-template-columns: 1fr auto; }
  .search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .account { gap: 10px; }
  .account .btn-upload { padding: 6px 10px; font-size: var(--step--1); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 12px; }
  .tile p { display: none; }
}
