@font-face {
  font-family: "Source Sans 3";
  src: url("source-sans-3-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --portal-ink: #f3f0f7;
  --portal-footer: #0b0611;
  --portal-accent: #b58aff;
  --portal-focus: #dfcaff;
}

body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: #fff;
  color: var(--portal-ink);
}

body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 332px;
  background: linear-gradient(90deg, #1c0d28e8, #1a102ad4 50%, #191027b8),
              #21112e url("obsidian-banner.webp") center 30% / cover no-repeat;
}

.site-header, .site-footer { font: 16px/1.6 "Source Sans 3", system-ui, sans-serif; }
.site-header { position: relative; background: #140a201a; }
.site-width { width: min(100% - 5rem, 1200px); margin-inline: auto; }
.header-layout {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 87px;
  gap: 1.5rem;
}
.site-header a, .site-footer a { color: inherit; text-decoration: none; }
.site-header a:hover, .site-footer a:hover { color: var(--portal-focus); }
.site-header a:focus-visible, .site-footer a:focus-visible, .site-skip:focus-visible {
  outline: 2px solid var(--portal-focus);
  outline-offset: 3px;
}
.site-skip { position: fixed; inset: .75rem auto auto 1rem; z-index: 12; padding: .6rem 1rem; background: var(--portal-footer); color: #fff; }
.site-skip:not(:focus) { clip-path: inset(50%); }
.site-brand { position: absolute; top: 12px; inset-inline-start: 0; border-radius: 20px; }
.app-logo { display: block; border-radius: inherit; box-shadow: 0 8px 20px #0005; }
.site-nav { grid-column: 2; display: flex; align-self: stretch; gap: clamp(1rem, 2.2vw, 2.125rem); }
.site-nav a {
  display: flex;
  align-items: center;
  padding-inline: .1rem;
  border-bottom: 2px solid transparent;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
}
.site-nav [aria-current] { color: var(--portal-accent); border-color: var(--portal-accent); }
.site-header .site-account {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem 1.4rem;
  border-radius: 6px;
  background: #fff;
  color: #261138;
  font-weight: 600;
}
.site-header .site-account:hover { background: #e4d9f1; color: #261138; }

.game-shell {
  z-index: 1;
  box-sizing: border-box;
  display: grid;
  grid-template: "stage" auto "toolbar" auto / minmax(0, 1fr);
  width: min(100% - 2.5rem, 1000px);
  margin: 40px auto 0;
  padding: 2px;
  background: #13091c;
  border: 1px solid #70637e;
  border-radius: 4px;
  box-shadow: 0 12px 24px #180b2b35;
}
.game-shell canvas { grid-area: stage; align-self: stretch; }
.game-shell .toolbar { grid-area: toolbar; min-width: 0; gap: .5rem; padding: .38rem 1.05rem .43rem; }
.game-shell #game-language { min-width: 8rem; }
.play-tip {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .55rem;
  padding-inline: .58rem;
  color: #e3dcf2;
  background: #21112e;
  border-radius: 999px;
  font-size: .83rem;
  white-space: nowrap;
}
.play-tip span { overflow: hidden; text-overflow: ellipsis; }
.play-tip img { flex: none; object-fit: contain; filter: grayscale(1) brightness(1.5) sepia(.3) hue-rotate(225deg); }
.game-shell .view-modes button { white-space: nowrap; }
.game-shell .toolbar :is(select, button) { background: #21112e; border-color: #9487aa80; }
.game-shell .toolbar :is(select, button):focus-visible { outline-color: var(--portal-focus); }
.game-shell:focus { outline: none; }
.play-cover {
  position: absolute;
  grid-area: stage;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 45%, #2a163b, #13091c 72%);
}
.play-cover[hidden] { display: none; }
#reveal-game {
  display: grid;
  justify-items: center;
  gap: 1.05rem;
  padding: 1.3rem 1.5rem;
  color: var(--portal-focus);
  font-size: 1.12rem;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.play-mark {
  display: grid;
  place-items: center;
  width: 72px;
  aspect-ratio: 1;
  border: 1px solid #b58aff80;
  border-radius: 50%;
  background: #301b41;
}
.play-mark::after {
  content: "";
  width: 22px;
  height: 26px;
  margin-inline-start: 4px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
#reveal-game:hover { color: #fff; }
#reveal-game:hover .play-mark { background: #392447; }
#reveal-game:focus-visible { outline-color: var(--portal-focus); }
.site-footer { flex: 1; padding: 46px 0 28px; margin-top: -34px; background: var(--portal-footer); }
.footer-layout { display: flex; align-items: center; gap: 1.6rem; min-height: 88px; }
.footer-layout img { display: block; object-fit: contain; }
.footer-links { display: flex; gap: 1.5rem; margin-inline-start: auto; }

body.play-expanded, body.play-mobile { background: #13091c; }
.play-expanded .site-header, .play-expanded .site-footer,
.play-mobile .site-header, .play-mobile .site-footer,
.play-expanded::before, .play-mobile::before,
.play-expanded .site-skip, .play-mobile .site-skip { display: none; }
main.game-shell.full-page {
  grid-template: "stage" minmax(0, 1fr) "toolbar" auto / minmax(0, 1fr);
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
main.game-shell.mobile.full-page {
  grid-template: "stage rail" minmax(0, 1fr) / minmax(0, 1fr) auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.game-shell .mobile-controls { grid-area: rail; }
main.game-shell:fullscreen {
  display: grid;
  grid-template: "stage" minmax(0, 1fr) / minmax(0, 1fr);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}
main.game-shell.mobile:fullscreen { grid-template: "stage rail" minmax(0, 1fr) / minmax(0, 1fr) auto; }

@media (max-width: 900px) {
  .site-width { width: calc(100% - 3rem); }
  .header-layout { min-height: 74px; gap: 1rem; }
  .app-logo { width: 66px; height: 66px; }
  .site-brand { border-radius: 13px; }
  .site-nav a { font-size: 15px; }
  .game-shell { margin-top: 24px; }
}
@media (max-width: 660px) {
  .header-layout { grid-template-columns: 1fr auto; grid-template-rows: minmax(76px, auto) auto; }
  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-wrap: wrap;
    justify-content: center;
    gap: .15rem .8rem;
    padding-bottom: .35rem;
  }
  .site-nav a { min-height: 44px; }
  .site-account { grid-column: 2; grid-row: 1; margin-top: 12px; }
  .game-shell .toolbar { padding-inline: .55rem; }
  .play-tip, #desktop-language-flag { display: none; }
  .site-footer { margin-top: 18px; padding: 24px 0; }
  .footer-layout { gap: .8rem; flex-wrap: wrap; }
  .footer-layout img { width: 84px; height: 52px; }
  .footer-links { margin-inline-start: 0; }
}
