:root {
  --bg: #050505;
  --text: #f5f5f5;
  --muted: rgba(255, 255, 255, 0.7);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.32);
  --panel: rgba(255, 255, 255, 0.02);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.24;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0.15));
  animation: drift 18s linear infinite;
}

body::after {
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.07), transparent 34%),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.04), transparent 28%);
  animation: breathe 7s ease-in-out infinite;
}

.layout {
  width: min(1360px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition:
    opacity 700ms ease,
    transform 700ms ease;
}

body.is-ready .layout {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.arcade,
.brand__content {
  opacity: 0;
  transition:
    opacity 700ms ease,
    transform 700ms ease;
}

.arcade {
  min-width: 0;
  display: grid;
  gap: 1rem;
  align-content: center;
  transform: translateX(-24px);
}

.brand {
  display: grid;
  justify-items: end;
}

.brand__content {
  width: min(100%, 520px);
  display: grid;
  justify-items: end;
  gap: 0.55rem;
  text-align: right;
  position: relative;
  transform: translateX(24px);
}

body.is-ready .arcade,
body.is-ready .brand__content {
  opacity: 1;
  transform: translateX(0);
}

.brand__content::before,
.brand__content::after {
  content: "";
  width: min(100%, 520px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  opacity: 0.9;
}

.arcade__top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.switch {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  min-width: 210px;
  box-shadow: var(--shadow);
}

.switch__indicator {
  position: absolute;
  inset: 0.25rem auto 0.25rem 0.25rem;
  width: calc(50% - 0.25rem);
  border-radius: 999px;
  background: var(--text);
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.switch[data-active="tetris"] .switch__indicator {
  transform: translateX(100%);
}

.switch__button {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0.8rem 1rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 220ms ease;
}

.switch__button.is-active {
  color: #050505;
}

.switch__button:focus-visible {
  outline: none;
}

.game-frame {
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  box-shadow: var(--shadow);
}

.game-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
  transform: translateX(0);
}

.game-track[data-active="tetris"] {
  transform: translateX(-100%);
}

.game-panel {
  min-width: 0;
  padding: clamp(1rem, 2vw, 1.35rem);
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.hud {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hud strong {
  color: var(--text);
}

.canvas-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 520px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.canvas-shell--tetris {
  min-height: 560px;
}

.canvas-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.22;
  pointer-events: none;
}

.game-canvas {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  height: auto;
  display: block;
  image-rendering: crisp-edges;
}

.game-canvas--tetris {
  width: min(100%, 360px);
}

.panel-note,
.status-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.status-line {
  padding-inline: 0.15rem;
}

.logo {
  margin: 0;
  font-size: clamp(4.5rem, 10vw, 8rem);
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.06em;
  line-height: 0.88;
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.1);
}

.intro {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.92rem, 1.5vw, 1rem);
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.flags {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  width: 100%;
  padding-top: 0.35rem;
}

.flag {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.02);
  width: clamp(58px, 5vw, 72px);
  padding: 0.2rem;
  border-radius: 14px;
  cursor: pointer;
  transition:
    transform 220ms ease,
    border-color 220ms ease,
    background 220ms ease,
    box-shadow 220ms ease;
}

.flag:hover,
.flag:focus-visible,
.flag.is-active {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.05);
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.12);
}

.flag:focus-visible {
  outline: none;
}

.flag__art {
  display: block;
  width: 100%;
  aspect-ratio: 8 / 5;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  overflow: hidden;
  position: relative;
}

.flag__art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 38%, transparent 68%, rgba(0, 0, 0, 0.08));
}

.flag--lesbian .flag__art {
  background: linear-gradient(
    180deg,
    #d52d00 0%,
    #d52d00 20%,
    #ff9a56 20%,
    #ff9a56 40%,
    #ffffff 40%,
    #ffffff 60%,
    #d362a4 60%,
    #d362a4 80%,
    #a30262 80%,
    #a30262 100%
  );
}

.flag--trans .flag__art {
  background: linear-gradient(
    180deg,
    #5bcffa 0%,
    #5bcffa 20%,
    #f5abb9 20%,
    #f5abb9 40%,
    #ffffff 40%,
    #ffffff 60%,
    #f5abb9 60%,
    #f5abb9 80%,
    #5bcffa 80%,
    #5bcffa 100%
  );
}

.flag-detail {
  min-height: 1rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.flag-detail:empty {
  opacity: 0;
}

.flag-detail.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.enter {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.08), transparent 30%),
    rgba(5, 5, 5, 0.94);
  backdrop-filter: blur(12px);
  transition:
    opacity 320ms ease,
    visibility 320ms ease;
}

.enter.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.enter__button {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: clamp(1rem, 2vw, 1.15rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.45rem 0 0.6rem;
  position: relative;
}

.enter__button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
  transition: transform 220ms ease;
}

.enter__button:hover::after,
.enter__button:focus-visible::after {
  transform: scaleX(1.08);
}

.enter__button:focus-visible {
  outline: none;
}

@keyframes drift {
  0% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(10px, -10px, 0);
  }

  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.75;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .layout {
    min-height: auto;
    grid-template-columns: 1fr;
    padding-block: 1.25rem 2rem;
  }

  .brand {
    order: -1;
    justify-items: center;
  }

  .brand__content {
    justify-items: center;
    text-align: center;
  }

  .flags {
    justify-content: center;
  }

  .canvas-shell {
    min-height: 420px;
  }

  .canvas-shell--tetris {
    min-height: 500px;
  }
}

@media (max-width: 640px) {
  .layout {
    padding: 1rem;
    gap: 1.5rem;
  }

  .logo {
    font-size: clamp(3.6rem, 16vw, 5.5rem);
  }

  .intro,
  .panel-note,
  .status-line,
  .flag-detail {
    letter-spacing: 0.04em;
  }

  .switch {
    min-width: 100%;
  }

  .canvas-shell {
    min-height: 320px;
  }

  .canvas-shell--tetris {
    min-height: 430px;
  }

  .game-canvas {
    width: min(100%, 420px);
  }

  .game-canvas--tetris {
    width: min(100%, 320px);
  }
}
