/**
 * The hub wears the same clothes as the portal.
 *
 * Every page here had its own palette and its own font: the home page was purple on cream, the
 * achievements page was pink on midnight blue, and neither looked like pitisukplus.com. Rather than
 * hunt the colours down through four hand-written stylesheets, this file states the portal's tokens
 * once and maps every name the old pages already use onto them.
 *
 * That means the pages keep working untouched - `var(--panel)` still resolves, it simply resolves to
 * the portal's surface colour now - and there is one place to change a colour rather than four.
 *
 * Loaded AFTER each page's own <style>, so these values win.
 */

/* Use the exact self-hosted Google Sans files served by the portal. Keeping the same four declared
   weights also makes synthetic weights (such as the 750 profile label) resolve identically. */
@font-face {
  font-family: "Google Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/google-sans-thai.woff2") format("woff2");
  unicode-range: U+2D7, U+303, U+331, U+E01-E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Google Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/google-sans-latin.woff2") format("woff2");
  unicode-range: U+??, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304, U+308, U+329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Google Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/google-sans-thai.woff2") format("woff2");
  unicode-range: U+2D7, U+303, U+331, U+E01-E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Google Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/google-sans-latin.woff2") format("woff2");
  unicode-range: U+??, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304, U+308, U+329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Google Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/google-sans-thai.woff2") format("woff2");
  unicode-range: U+2D7, U+303, U+331, U+E01-E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Google Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/google-sans-latin.woff2") format("woff2");
  unicode-range: U+??, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304, U+308, U+329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Google Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/google-sans-thai.woff2") format("woff2");
  unicode-range: U+2D7, U+303, U+331, U+E01-E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Google Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/google-sans-latin.woff2") format("woff2");
  unicode-range: U+??, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304, U+308, U+329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ---- the portal's tokens, verbatim ---- */
  --bg: #fffaf2;
  --surface: #ffffff;
  --surface-2: #f7f3ff;
  --text: #29263b;
  --muted: #736e82;
  --line: #e7e0d8;
  --purple: #6958c9;
  --purple-dark: #4c3fa4;
  --purple-soft: #eee9ff;
  --coral: #ed7667;
  --mint: #8ac8b0;
  --yellow: #f5c45e;
  --cream: #fff4de;

  /* ---- names the hub's existing CSS already asks for ---- */
  --panel: var(--surface);
  --panel2: var(--surface-2);
  --card: var(--surface);
  --pop: var(--surface);
  --chip: var(--surface-2);
  --hover: var(--surface-2);
  --field: var(--surface-2);
  --ink: var(--text);
  --edge: var(--line);
  --pink: var(--coral);
  --pink-lite: var(--coral);
  --blue: var(--purple);
  --blue-lite: var(--purple-dark);
  --yellow-lite: var(--yellow);
  --grad-blue: linear-gradient(180deg, var(--purple), var(--purple-dark));

  /* The hub uses --shadow as a COLOUR (box-shadow: 4px 4px 0 var(--shadow)), not as a whole
     shadow. Keeping it a colour is what stops every card losing its shadow. */
  --shadow: rgba(64, 48, 96, 0.16);

  --page-bg: var(--bg);
}

:root[data-theme="dark"] {
  --bg: #181625;
  --surface: #242132;
  --surface-2: #2d2940;
  --text: #faf7ff;
  --muted: #bcb6c9;
  --line: #3e394e;
  --purple: #9887f0;
  --purple-dark: #b8aaf8;
  --purple-soft: #35304f;
  --cream: #2f2b42;
  --shadow: rgba(0, 0, 0, 0.4);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Google Sans", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
}

/* ---------------------------------------------------------------- brand */

.brand,
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 19px;
  font-weight: 700;
}
.brand strong,
.logo .g {
  color: var(--coral);
  font-weight: 800;
}

/* A wide wordmark, not a square badge: squeezing it into 44x44 would letterbox it down to something
   unreadable, so it keeps its own proportions and stands alone - the art says "Pitisuk Boardgame".
 *
 * NOT image-rendering: pixelated. That is for BLOWING UP pixel art; shrinking a 1774px logo to 42px
 * with nearest-neighbour throws away 97% of the pixels and the letters come out in shreds. The
 * browser's normal filtering is what keeps them legible. */
.brand-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}
.logo-img {
  height: 34px;
  width: auto;
  object-fit: contain;
}

/* ---------------------------------------------------------------- chrome */

.small-button,
.icon-btn,
.member-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: 0.2s;
}
.small-button:hover,
.icon-btn:hover,
.member-button:hover {
  border-color: var(--purple);
  color: var(--purple);
  transform: translateY(-1px);
}

.profile-menu { position: relative; }

.acc-btn,
.profile-menu-trigger {
  display: flex;
  align-items: center;
  height: 38px;
  gap: 7px;
  max-width: 190px;
  padding: 0 10px 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
}
.acc-av,
.profile-avatar {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  font-size: 12px;
}
.profile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chevron { width: 15px; height: 15px; flex: 0 0 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.profile-menu-trigger.has-pending-request { border-color: var(--purple); box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 18%, transparent); }

.dropdown,
.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 178px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(64, 48, 96, 0.14);
}
.dd-item,
.profile-dropdown a,
.profile-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  color: var(--text);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  text-decoration: none;
}
.dd-item:hover,
.profile-dropdown a:hover,
.profile-dropdown button:hover {
  background: var(--surface-2);
  color: var(--purple);
}
.dd-item.danger {
  color: var(--coral);
}
.profile-dropdown .profile-friends-notice { background: color-mix(in srgb, var(--purple) 12%, var(--surface)); color: var(--purple); }
.friend-request-dot { width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 3px color-mix(in srgb, var(--coral) 18%, transparent); }

.primary,
.play-link,
.btn {
  background: var(--purple);
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--purple) 28%, transparent);
}
.primary:hover,
.play-link:hover,
.btn:hover {
  background: var(--purple-dark);
}
.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
}

/* The hub uses the Portal's chrome layout: logo left, navigation centred, controls right. */
.topbar {
  height: 76px;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0;
}
.topbar nav { justify-self: center; }
.topbar nav a { color: var(--muted); font-size: 14px; font-weight: 600; }
.top-actions { justify-self: end; }
.language-button { width: auto; gap: 7px; padding: 0 12px; }
.icon-button { width: 40px; gap: 0; padding: 0; }
.chrome-icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.icon-button .chrome-icon { width: 19px; height: 19px; }
.icon-button .chrome-icon[hidden] { display: none !important; }
.acc-btn { height: 38px; font-size: 11px; font-weight: 750; }
.acc-av { width: 27px; height: 27px; }
footer {
  max-width: 1160px;
  margin: 0 auto;
  padding: 26px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
footer .brand-logo { height: 30px; }
.footer-meta { display: flex; align-items: center; gap: 16px; }
.footer-meta a { color: var(--muted); text-decoration: none; }
.footer-meta a:hover { color: var(--purple); text-decoration: underline; }

@media (max-width: 800px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar nav { display: none; }
  footer { margin: 0 24px; }
}
@media (max-width: 520px) {
  .topbar { padding: 0 18px; }
  .language-button { width: 40px; padding: 0; }
  .language-button span:last-child { display: none; }
  footer { flex-direction: column; gap: 15px; text-align: center; }
  .footer-meta { flex-wrap: wrap; justify-content: center; gap: 10px 14px; }
}
