@font-face { font-family: "Lilita"; src: url("fonts/LilitaOne-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("fonts/Fredoka.ttf") format("truetype"); font-weight: 300 700; font-display: swap; }

:root {
  --ink: #2b1b3d;
  --paper: #fff8ec;
  --yellow: #ffc93c;
  --pink: #ff5c8a;
  --blue: #3fa2ff;
  --green: #3ddc84;
  --red: #ff4d4d;
  --purple: #8c5cff;
  --cloud: #eee6ff;
  --bg1: #2a1145;
  --bg2: #4b1d7a;
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Fredoka", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 201, 60, .18) 0 18%, transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(255, 92, 138, .22) 0 15%, transparent 45%),
    linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body::before { /* confetti dots */
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .18;
  background-image: radial-gradient(#fff 1.5px, transparent 1.6px);
  background-size: 34px 34px;
}

a { color: inherit; }
.hidden { display: none !important; }

/* ------------------------------------------------ top bar */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1200px; margin: 0 auto; padding: 22px 24px;
}
.logo {
  font-family: "Lilita", sans-serif; font-size: clamp(30px, 4vw, 44px); letter-spacing: 1px; color: var(--yellow);
  text-shadow: 3px 3px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 0 6px 0 var(--ink);
  transform: rotate(-3deg); text-decoration: none; display: inline-block;
}
.logo small { display: block; font-size: .42em; color: #fff; letter-spacing: 2px; margin-top: -4px; }
.user-pill {
  display: flex; align-items: center; gap: 10px; background: var(--paper); border: 4px solid var(--ink);
  border-radius: 999px; padding: 6px 6px 6px 16px; box-shadow: 0 5px 0 var(--ink); font-weight: 700;
}

/* ------------------------------------------------ buttons */
.btn {
  --c: var(--yellow);
  font-family: "Lilita", sans-serif; font-size: 20px; letter-spacing: .5px; color: #fff;
  text-shadow: 2px 2px 0 var(--ink), -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink);
  background: var(--c); border: 4px solid var(--ink); border-radius: 999px; padding: 12px 24px;
  box-shadow: 0 6px 0 var(--ink), inset 0 6px 0 rgba(255, 255, 255, .35);
  cursor: pointer; transition: transform .12s cubic-bezier(.3, 1.8, .6, 1), box-shadow .12s, filter .12s;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { transform: translateY(-2px) scale(1.04); filter: brightness(1.06); }
.btn:active { transform: translateY(4px) scale(.98); box-shadow: 0 2px 0 var(--ink), inset 0 4px 0 rgba(255, 255, 255, .25); }
.btn:disabled { filter: grayscale(.8) brightness(.95); cursor: not-allowed; transform: none; }
.btn.small { font-size: 15px; padding: 7px 14px; border-width: 3px; box-shadow: 0 4px 0 var(--ink), inset 0 4px 0 rgba(255,255,255,.3); }
.btn.white { --c: #fff; color: var(--ink); text-shadow: none; }
.btn.green { --c: var(--green); }
.btn.pink { --c: var(--pink); }
.btn.blue { --c: var(--blue); }
.btn.red { --c: var(--red); }
.btn.purple { --c: var(--purple); }
.btn.big { font-size: 26px; padding: 16px 34px; }
.link { background: none; border: 0; color: var(--purple); font: 600 16px "Fredoka"; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------ cards */
.card {
  position: relative; background: var(--paper); border: 5px solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 10px 0 rgba(20, 8, 35, .55);
}
.ribbon {
  position: absolute; top: -28px; left: 50%; transform: translateX(-50%) rotate(-2deg);
  font-family: "Lilita", sans-serif; font-size: 28px; color: #fff; white-space: nowrap;
  text-shadow: 2px 2px 0 var(--ink), -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink);
  background: var(--c, var(--yellow)); border: 4px solid var(--ink); border-radius: 999px; padding: 6px 28px; box-shadow: 0 5px 0 var(--ink);
}

/* ------------------------------------------------ auth */
.auth-wrap { min-height: calc(100vh - 110px); display: grid; place-items: center; padding: 40px 16px 60px; position: relative; z-index: 1; }
.auth { width: min(460px, 100%); padding: 48px 34px 30px; animation: pop .35s cubic-bezier(.3, 1.6, .6, 1); }
.auth h1 { font-family: "Lilita"; font-weight: 400; text-align: center; margin: 4px 0 6px; font-size: 34px; color: var(--purple); }
.auth p.sub { text-align: center; margin: 0 0 22px; color: #6b5a80; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-weight: 600; color: var(--purple); margin: 0 0 6px 8px; font-size: 15px; }
.field input {
  width: 100%; font: 500 18px "Fredoka"; color: var(--ink); background: #fff; border: 4px solid var(--ink); border-radius: 999px;
  padding: 12px 18px; outline: none; transition: box-shadow .15s, transform .15s;
}
.field input:focus { box-shadow: 0 0 0 5px rgba(140, 92, 255, .3); transform: scale(1.01); }
.auth .btn { width: 100%; margin-top: 8px; }
.switch { text-align: center; margin-top: 16px; }
.msg { min-height: 24px; text-align: center; font-weight: 600; margin: 8px 0 2px; }
.msg.err { color: var(--red); }
.msg.ok { color: #1d9a57; }
.notice {
  background: var(--cloud); border: 3px dashed var(--purple); border-radius: 16px; padding: 14px 16px; text-align: center; font-weight: 500;
}

/* ------------------------------------------------ games */
main { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 10px 24px 80px; }
.hero { color: #fff; text-align: center; margin: 10px 0 50px; }
.hero h2 {
  font-family: "Lilita"; font-weight: 400; font-size: clamp(32px, 5vw, 56px); margin: 0;
  text-shadow: 3px 3px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 0 7px 0 var(--ink);
}
.hero p { font-size: 19px; opacity: .92; margin: 10px 0 0; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 40px 30px; }
.game { overflow: hidden; display: flex; flex-direction: column; transition: transform .2s cubic-bezier(.3, 1.6, .6, 1); animation: pop .4s backwards cubic-bezier(.3, 1.6, .6, 1); }
.game:hover { transform: translateY(-6px) rotate(-.6deg); }
.game .cover { aspect-ratio: 16 / 9; background: var(--c, var(--purple)) center / cover no-repeat; border-bottom: 5px solid var(--ink); position: relative; }
.game .cover .tag {
  position: absolute; top: 14px; right: -6px; transform: rotate(6deg); background: var(--pink); color: #fff; font-family: "Lilita"; font-size: 17px;
  padding: 4px 16px; border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 4px 0 var(--ink);
  text-shadow: 1px 1px 0 var(--ink);
}
.game .cover .placeholder { position: absolute; inset: 0; display: grid; place-items: center; font-family: "Lilita"; font-size: 40px; color: #fff; text-align: center; padding: 20px;
  text-shadow: 3px 3px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink); }
.game .body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.game h3 { font-family: "Lilita"; font-weight: 400; font-size: 30px; margin: 0; }
.game .tagline { color: var(--purple); font-weight: 600; margin: -6px 0 0; }
.game .desc { color: #4f405f; margin: 0; flex: 1; line-height: 1.45; }
.game .meta { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--cloud); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px; font-size: 14px; font-weight: 600; }
.game .btn { margin-top: 6px; }
.empty { color: #fff; text-align: center; font-size: 20px; opacity: .85; }

/* ------------------------------------------------ admin */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 20px; margin-bottom: 50px; }
.stat { padding: 18px; text-align: center; }
.stat b { display: block; font-family: "Lilita"; font-weight: 400; font-size: 46px; line-height: 1; }
.stat span { color: #6b5a80; font-weight: 600; }
.panel { padding: 44px 22px 22px; margin-bottom: 50px; }
.tabs { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 18px; }
.tabs .btn.active { --c: var(--yellow); color: #fff; text-shadow: 2px 2px 0 var(--ink); }
table { width: 100%; border-collapse: separate; border-spacing: 0 10px; }
th { text-align: left; color: var(--purple); font-weight: 700; padding: 0 12px; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
td { background: #fff; border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); padding: 10px 12px; vertical-align: middle; }
td:first-child { border-left: 3px solid var(--ink); border-radius: 16px 0 0 16px; }
td:last-child { border-right: 3px solid var(--ink); border-radius: 0 16px 16px 0; white-space: nowrap; }
td .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.status { font-weight: 700; border-radius: 999px; padding: 3px 10px; border: 2px solid var(--ink); font-size: 13px; }
.status.pending { background: var(--yellow); }
.status.approved { background: var(--green); }
.status.rejected, .status.banned { background: var(--red); color: #fff; }
.muted { color: #8b7d99; font-size: 14px; }

@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (max-width: 720px) {
  .topbar { flex-direction: column; }
  table, thead, tbody, tr, td, th { display: block; }
  thead { display: none; }
  td { border: 3px solid var(--ink) !important; border-radius: 16px !important; margin-bottom: 6px; }
  td .actions { justify-content: flex-start; }
}
.c-blue { --c: var(--blue); }
#backToLogin { margin-top: 20px; width: 100%; }
.c-pink { --c: var(--pink); }
