:root {
  --bg: #000000;
  --text: #e4f6e8;
  --edge: #e4f6e8;
  --paper: #fffaff;
  --ink: #2b1d4a;
  --ink-soft: #8fb79b;
  --pink: #ff9ccd;
  --mint: #aef0d4;
  --butter: #ffe7a1;
  --sky: #a9d8ff;
  --live: #ff6b8b;
  --green: #6fe08f;
  --display: "Fredoka", "Nunito", ui-rounded, system-ui, sans-serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(111, 224, 143, .13) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  color: var(--text);
  font-family: var(--body);
  font-size: 1.05rem;
  line-height: 1.65;
}
a { color: var(--text); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--pink); }
:focus-visible { outline: 4px solid var(--butter); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .25rem; }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: 100%; max-width: 1040px; margin: 0 auto; padding: 1.25rem 1.5rem;
}
.wordmark { font-family: var(--display); font-weight: 700; font-size: clamp(1.6rem, 5vw, 2.2rem); line-height: 1; margin: 0; }
.wordmark a { color: var(--green); text-decoration: none; }
.wordmark a:hover { color: var(--mint); }

/* Live badge */
.live-badge {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .4rem 1rem; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 999px;
  font-family: var(--display); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.live-badge .dot { width: .75rem; height: .75rem; border-radius: 50%; background: #b9b0cc; border: 2px solid var(--ink); }
.live-badge.is-live { background: var(--live); }
.live-badge.is-live .dot { background: var(--ink); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* Layout */
main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: .5rem 1.5rem 3rem; }
main.prose { max-width: 720px; }
main.prose h1 { font-size: clamp(2rem, 6vw, 3rem); margin-bottom: 1rem; }
main.prose h2 { margin: 2.25rem 0 .5rem; }

/* Player: the sticker */
.player-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: var(--ink); border: 4px solid var(--edge); border-radius: 28px;
  box-shadow: 10px 10px 0 var(--pink); overflow: hidden;
}
body.is-live .player-frame { box-shadow: 10px 10px 0 var(--live); }
#twitch-embed { position: absolute; inset: 0; }
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-fallback { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; }


/* Buttons */
.btn {
  display: inline-block; padding: .65rem 1.5rem; background: var(--pink); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 999px; font-family: var(--display); font-weight: 600; font-size: 1.1rem;
  text-decoration: none; box-shadow: 0 0 0 var(--ink); transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--edge); }
.btn:active { transform: translate(1px, 1px); box-shadow: 0 0 0 var(--ink); }


/* Socials */
.socials { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; padding: 0; margin: 1rem 0 0; }
.socials a {
  display: inline-block; padding: .5rem 1.2rem; color: var(--ink); border: 3px solid var(--ink); border-radius: 999px;
  font-family: var(--display); font-weight: 600; text-decoration: none; transition: transform .12s, box-shadow .12s;
}
.socials li:nth-child(6n+1) a { background: var(--pink); }
.socials li:nth-child(6n+2) a { background: var(--mint); }
.socials li:nth-child(6n+3) a { background: var(--butter); }
.socials li:nth-child(6n+4) a { background: var(--sky); }
.socials li:nth-child(6n+5) a { background: var(--pink); }
.socials li:nth-child(6n+6) a { background: var(--mint); }
.socials a:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--edge); }
.email-btn { font-size: 1.25rem; word-break: break-all; margin: .5rem 0 0; }

/* Footer */
.site-footer { padding: 1.5rem 1.5rem 2.5rem; text-align: center; color: var(--ink-soft); font-size: .95rem; }
.site-footer p { margin: 0; }
.site-footer .footer-links { list-style: none; display: flex; justify-content: center; gap: 1.5rem; padding: 0; margin: .5rem 0 0; }
.site-footer .socials { margin: 0 0 1.25rem; }
.site-footer .socials a { color: var(--ink); }
.site-footer a { color: var(--text); }

/* Cookie notice */
.cookie {
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; max-width: 460px; margin: 0 auto; z-index: 10;
  background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 22px; padding: 1rem 1.25rem; box-shadow: 6px 6px 0 var(--pink);
}
.cookie h2 { font-size: 1.1rem; margin: 0 0 .25rem; }
.cookie p { margin: 0 0 .75rem; font-size: .9rem; line-height: 1.5; }
.cookie button { font: inherit; font-family: var(--display); font-weight: 600; background: var(--mint); color: var(--ink); border: 3px solid var(--ink); border-radius: 999px; padding: .35rem 1.4rem; cursor: pointer; }
.cookie button:hover { background: var(--butter); }

@media (max-width: 520px) {
  .player-frame { box-shadow: 6px 6px 0 var(--pink); border-radius: 22px; }
  body.is-live .player-frame { box-shadow: 6px 6px 0 var(--live); }
}
@media (prefers-reduced-motion: reduce) {
  .live-badge.is-live .dot { animation: none; }
  .btn, .socials a { transition: none; }
}

/* Hidden Twitch player used only to read the live status of the badge's channel */
.status-probe { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

/* Accounts */
.header-right { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .75rem; }
.auth { display: flex; align-items: center; gap: .6rem; }
.auth-user { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--display); font-weight: 600; text-decoration: none; }
.avatar { width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 3px solid var(--pink); object-fit: cover; background: var(--paper); }
button.btn { cursor: pointer; }
.btn-sm { padding: .3rem 1rem; font-size: 1rem; }
.btn-mint { background: var(--mint); }

.account-form { display: grid; gap: .5rem; max-width: 420px; margin-top: 1.25rem; }
.account-form label { font-family: var(--display); font-weight: 600; }
.account-form input {
  font: inherit; padding: .6rem 1rem; background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 14px;
}
.account-form .btn { justify-self: start; margin-top: .5rem; }
.hint { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.status { min-height: 1.5em; margin: 0; }

.board { list-style: none; display: grid; gap: .6rem; padding: 0; margin: 1.5rem 0 0; }
.board li {
  display: grid; grid-template-columns: 2.25rem 2.25rem 1fr auto; align-items: center; gap: .75rem;
  padding: .5rem 1rem; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 18px;
}
.board li:nth-child(1) { background: var(--butter); }
.board li:nth-child(2) { background: var(--mint); }
.board li:nth-child(3) { background: var(--sky); }
.board .rank, .board .points { font-family: var(--display); font-weight: 700; font-size: 1.2rem; }
.board .player { overflow-wrap: anywhere; font-weight: 500; }
.board .avatar { border-color: var(--ink); }

@media (max-width: 520px) { .auth-name { display: none; } }

/* Front page: stream + leaderboard (left), High Chess (right) */
.home .site-header, .home main { max-width: 1280px; }
.front { display: flex; flex-direction: column; gap: 2.5rem; }
.front .col { display: contents; }
.front .stream { order: 1; }
.front .game { order: 2; }
.front .lb { order: 3; }
.front h2 { margin: 0 0 1rem; }
.lb .board { margin-top: 0; }
.lb-more { margin: 1rem 0 0; }
.gc-wrap { container-type: inline-size; }
@media (min-width: 1000px) {
  .front { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem; align-items: start; }
  .front .col { display: flex; flex-direction: column; gap: 2.5rem; min-width: 0; }
  .front .stream, .front .game, .front .lb { order: 0; }
}

/* One block per game in the leaderboards */
.lb-game + .lb-game { margin-top: 2.5rem; }
.lb-game > h2, .lb-game > h3 { margin: 0 0 .75rem; }
.lb-game .board { margin-top: 0; }
.lb-game p { margin: 0; }

/* Header: live badge beside the name; on the front page the sign-in button lines up with the board */
.site-header { flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; min-width: 0; }
@media (min-width: 1000px) {
  .home .site-header { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2.5rem; }
  .home .header-right { width: 100%; max-width: 560px; justify-content: flex-end; }
}
