:root {
  --bg: #07080a;
  --ink: #f4f7f2;
  --muted: #9aa394;
  --panel: rgba(16, 20, 18, 0.82);
  --line: rgba(255, 255, 255, 0.08);
  --accent: #7cff6b;
  --accent-2: #b8ff6a;
  font-family: "Segoe UI", "Avenir Next", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  min-height: 100dvh;
}

body:has(.home) {
  display: flex;
  height: 100dvh;
  overflow: hidden;
  background: #07080a;
}

body:has(.home)::before {
  content: "";
  position: fixed;
  inset: -28px;
  z-index: 0;
  background: url("/home-bg.webp") center / cover no-repeat;
  filter: blur(8px);
  pointer-events: none;
}

button,
input {
  font: inherit;
}

.auth-trigger:hover,
.auth-trigger:focus-visible,
.auth-dialog button:hover,
.auth-dialog button:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.auth-bar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 10px 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(16px);
}

.auth-brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.auth-trigger,
.auth-dialog button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--accent);
  color: #10210d;
  font-weight: 700;
  cursor: pointer;
}

.auth-user {
  position: relative;
  min-width: 0;
}

.auth-user-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  cursor: pointer;
}

.auth-user-summary::-webkit-details-marker {
  display: none;
}

.auth-user-summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
}

.auth-user[open] .auth-user-summary::after {
  transform: rotate(225deg) translateY(-1px);
}

.auth-user img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
}

.auth-user span {
  max-width: min(36vw, 280px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #101412;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.auth-menu h2 {
  display: none;
}

.auth-menu button {
  appearance: none;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.auth-menu button:hover,
.auth-menu button:focus-visible {
  background: rgba(255, 255, 255, 0.06);
}

.auth-menu button.danger,
.auth-dialog button.danger {
  color: #fff;
  background: #b4232f;
}

.auth-menu button.danger {
  color: #ff8e98;
  background: transparent;
}

.auth-dialog button.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.auth-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #101412;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.auth-dialog h2 {
  margin: 0 44px 8px 0;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.auth-dialog .auth-close {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.auth-dialog .google-button {
  width: 100%;
  margin-top: 18px;
  background: #fff;
  color: #202124;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form > div {
  display: grid;
  gap: 10px;
}

.auth-form label {
  color: var(--muted);
  font-size: 14px;
}

.auth-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 255, 107, 0.12);
}

.auth-form button:first-of-type {
  margin-top: 8px;
}

.auth-error {
  margin: 16px 0 0;
}

.auth-bar [hidden],
.auth-dialog [hidden] {
  display: none !important;
}

.stage {
  position: relative;
  overflow: hidden;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(124, 255, 107, 0.12), transparent 55%),
    radial-gradient(900px 500px at 90% 110%, rgba(92, 225, 255, 0.1), transparent 50%),
    #07080a;
}

.grid {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background-image:
    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: 72px 72px;
  mask-image: radial-gradient(circle at center, #000 40%, transparent 85%);
}

.topbar,
.qr-card,
.status-pill {
  position: relative;
  z-index: 2;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 28px 32px 0;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand strong {
  font-size: 28px;
  letter-spacing: -0.04em;
}

.brand span,
.hint,
.meta {
  color: var(--muted);
}

.players {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 48vw;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 14px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.qr-card {
  position: absolute;
  right: 28px;
  bottom: 28px;
  width: min(320px, calc(100vw - 40px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(16px);
}

.qr-card img {
  display: block;
  width: 100%;
  border-radius: 6px;
  padding: 6px;
  background: #fff;
}

.qr-card h2 {
  margin: 14px 0 6px;
  font-size: 18px;
}

.qr-card p,
.phone p {
  margin: 0;
  line-height: 1.45;
}

.gate-qr {
  z-index: 12;
}

.fs-btn {
  position: fixed;
  left: 28px;
  bottom: 28px;
  z-index: 12;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(16px);
  transition: opacity 0.18s ease;
}

.fs-btn.is-away {
  opacity: 0;
  pointer-events: none;
}

.fs-btn:hover,
.fs-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.fs-btn[hidden] {
  display: none;
}

.gate-stage {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.gate-logo,
.gate-card {
  position: relative;
  z-index: 5;
}

.qr-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.qr-actions button,
.phone button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--accent);
  color: #10210d;
  font-weight: 700;
  cursor: pointer;
}

.qr-actions button.ghost,
.phone button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.cursor {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  aspect-ratio: 144 / 165;
  /* aim point = visual center */
  margin: -41px 0 0 -36px;
  pointer-events: none;
  z-index: 10;
  will-change: left, top;
  filter:
    drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45))
    drop-shadow(0 0 12px color-mix(in srgb, currentColor 70%, transparent));
}

.cursor.is-finger-gun {
  width: 78px;
  aspect-ratio: 1;
  margin: -39px 0 0 -39px;
}

.cursor-hand {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.cursor-fill {
  display: block;
  width: 100%;
  height: 100%;
}

.cursor-outline {
  position: absolute;
  inset: 0;
  background: currentColor;
  -webkit-mask: url("/cursor-outline.png") center / 100% 100% no-repeat;
  mask: url("/cursor-outline.png") center / 100% 100% no-repeat;
}

.cursor.is-finger-gun .cursor-outline {
  -webkit-mask-image: url("/cursors/finger_gun/cursor-outline.png");
  mask-image: url("/cursors/finger_gun/cursor-outline.png");
}

.cursor-name {
  position: absolute;
  top: 18px;
  left: calc(100% - 4px);
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(7, 8, 10, 0.78);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.cursor-ammo {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  pointer-events: none;
}

.cursor-ammo[hidden] {
  display: none;
}

.cursor-ammo i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 25%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 55%, transparent);
}

.cursor-ammo i.is-on {
  background: currentColor;
  box-shadow: 0 0 8px color-mix(in srgb, currentColor 70%, transparent);
}

.cursor.is-empty .cursor-ammo i {
  background: color-mix(in srgb, #ff5a5a 35%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #ff5a5a 70%, transparent);
}

.cursor.clicking {
  animation: poke 180ms ease-out;
}

.pairing {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(124, 255, 107, 0.12), transparent 55%),
    radial-gradient(900px 500px at 90% 110%, rgba(92, 225, 255, 0.1), transparent 50%),
    #07080a;
}

.pairing-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  text-align: center;
}

.pairing-card h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 40px);
  letter-spacing: -0.04em;
}

.pairing-card img {
  display: block;
  width: min(320px, 100%);
  margin: 22px auto 0;
  border-radius: 6px;
  padding: 6px;
  background: #fff;
}

.pairing-card .qr-actions {
  justify-content: center;
}

@keyframes poke {
  50% { transform: scale(1.35); }
}

.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  pointer-events: none;
}

.empty strong {
  display: block;
  font-size: clamp(32px, 6vw, 72px);
  letter-spacing: -0.05em;
}

html:has(.phone-page) {
  height: 100%;
}

.phone-page {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.phone-page input {
  -webkit-user-select: text;
  user-select: text;
}

.phone {
  min-height: 100dvh;
  height: 100dvh;
  padding: 28px 22px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(124, 255, 107, 0.16), transparent 36%),
    #07080a;
}

.phone header strong {
  display: block;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.status {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.pad {
  flex: 1;
  min-height: 280px;
  border-radius: 28px;
  border: 1px dashed rgba(124, 255, 107, 0.35);
  background: rgba(124, 255, 107, 0.04);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}

.phone .row {
  display: flex;
  gap: 10px;
}

.phone .row button {
  flex: 1;
}

.error {
  color: #ffb4c0;
}

.home-fit {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  overflow: hidden;
}

.home-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1920px;
  height: 1080px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%) scale(min(calc(100vw / 1920px), calc(100dvh / 1080px)));
  transform-origin: center center;
}

.home {
  position: relative;
  display: grid;
  grid-template-columns: minmax(72px, 0.55fr) minmax(0, 2fr) minmax(0, 3fr) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 2fr) minmax(0, 3fr) auto;
  grid-template-areas:
    "head head head head"
    "level board solo qr"
    "level board multi qr"
    "foot foot foot foot";
  width: 80%;
  height: 90%;
  margin: auto;
  gap: 16px;
  padding: 0;
  background: transparent;
}

.home-header { grid-area: head; }
.home-level { grid-area: level; }
.home-board { grid-area: board; }
.home-play[data-mode="solo"] { grid-area: solo; min-height: 120px; }
.home-play[data-mode="local"] { grid-area: multi; min-height: 280px; }
.home-qr {
  grid-area: qr;
  z-index: 12;
}
.home-foot { grid-area: foot; }

.home-brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.home-brand img {
  display: block;
  height: 44px;
  width: auto;
}

.home-header.auth-bar,
.home-panel,
.home-foot,
.home-play.mode-card {
  position: relative;
  z-index: 5;
  border-radius: 22px !important;
  backdrop-filter: blur(12px);
}

.home-panel,
.home-foot {
  padding: 18px;
}

.home-header.auth-bar {
  isolation: isolate;
  overflow: visible;
  min-height: 84px;
  padding: 18px 30px;
  border: 0;
  background: conic-gradient(
    from -45deg at 50% 50%,
    #486889 0deg,
    #5871b7 90deg,
    #323c83 180deg,
    #8379ae 270deg,
    #486889 360deg
  );
  box-shadow: none;
  backdrop-filter: none;
}

.home-header.auth-bar::before {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 0;
  border-radius: 20px;
  background: linear-gradient(90deg, #030410 0%, #030614 50%, #020818 100%);
  pointer-events: none;
}

.home-header.auth-bar > * {
  position: relative;
  z-index: 1;
}

.home-header.auth-bar > .auth-user {
  position: static;
}

.home .auth-user-summary::after {
  transform: rotate(-45deg) translateY(0);
}

.home .auth-user[open] .auth-user-summary::after {
  transform: rotate(135deg);
}

.home .auth-menu {
  top: 0;
  right: auto;
  left: calc(100% + 16px);
  display: grid;
  align-content: start;
  gap: 4px;
  width: calc((1920px - 100%) / 2 - 16px);
  height: calc(1080px * 0.9);
  min-width: 0;
  isolation: isolate;
  padding: 18px;
  border: 0;
  border-radius: 22px;
  background: conic-gradient(
    from -45deg at 50% 50%,
    #486889 0deg,
    #5871b7 90deg,
    #323c83 180deg,
    #8379ae 270deg,
    #486889 360deg
  );
  box-shadow: none;
}

.home .auth-menu::before {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 0;
  border-radius: 20px;
  background: linear-gradient(90deg, #030410 0%, #030614 50%, #020818 100%);
  pointer-events: none;
}

.home .auth-menu h2 {
  display: block;
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  font-size: 18px;
}

.home .auth-menu button {
  position: relative;
  z-index: 1;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.home-board {
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 0;
  background: #070a13;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
}

.home-board::before {
  display: none;
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 16px;
}

.board-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.board-trophy-icon {
  color: #4dfc5e;
}

.board-title h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #fff;
}

.board-season {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #4a84e0;
}

.board-tabs {
  display: flex;
  gap: 8px;
  padding: 0 24px 16px;
}

.board-tabs button {
  flex: 1;
  appearance: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #8892b0;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 0;
  cursor: pointer;
  transition: all 0.2s;
}

.board-tabs button.active {
  background: rgba(77, 252, 94, 0.1);
  border-color: #4dfc5e;
  color: #fff;
}

.board-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px;
}

.board-game {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8892b0;
}

.board-game + .board-list-ol + .board-game {
  margin-top: 16px;
}

.board-friends {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 140px;
  padding: 24px 0;
}

.board-add-friend {
  appearance: none;
  background: rgba(77, 252, 94, 0.1);
  border: 1px solid #4dfc5e;
  border-radius: 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 18px;
  cursor: default;
}

.board-list-ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.board-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.board-row.is-top3 {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.board-row.rank-1 {
  border-color: rgba(255, 215, 0, 0.3);
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.1) 0%, transparent 100%);
}
.board-row.rank-2 {
  border-color: rgba(192, 192, 192, 0.3);
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.1) 0%, transparent 100%);
}
.board-row.rank-3 {
  border-color: rgba(205, 127, 50, 0.3);
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.1) 0%, transparent 100%);
}

.board-rank-num,
.board-rank-trophy {
  width: 24px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-right: 16px;
  position: relative;
}

.board-row.is-top3 .board-rank-trophy::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.2);
}

.board-rank-trophy.rank-1 { color: #ffd700; }
.board-row.rank-1 .board-rank-trophy::after { background: rgba(255, 215, 0, 0.5); }

.board-rank-trophy.rank-2 { color: #c0c0c0; }
.board-row.rank-2 .board-rank-trophy::after { background: rgba(192, 192, 192, 0.5); }

.board-rank-trophy.rank-3 { color: #cd7f32; }
.board-row.rank-3 .board-rank-trophy::after { background: rgba(205, 127, 50, 0.5); }

.board-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: hsl(var(--hue, 0), 70%, 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  color: rgba(0,0,0,0.3);
}

.board-avatar svg {
  width: 24px;
  height: 24px;
}

.board-name {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-score {
  font-size: 14px;
  font-weight: 700;
  color: #4dfc5e;
}

.board-score small {
  color: #8892b0;
  font-size: 10px;
  margin-left: 4px;
}

.board-footer-btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 16px;
  margin: 16px 24px 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}

.board-footer-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.home-board > * {
  position: relative;
  z-index: 1;
}

.home-level {
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  padding: 14px;
  border: 0;
  background: conic-gradient(
    from -45deg at 50% 50%,
    #486889 0deg,
    #5871b7 90deg,
    #323c83 180deg,
    #8379ae 270deg,
    #486889 360deg
  );
  box-shadow: none;
  backdrop-filter: none;
}

.home-level::before {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 0;
  border-radius: 20px;
  background: linear-gradient(180deg, #030410 0%, #030b15 100%);
  pointer-events: none;
}

.home-level > * {
  position: relative;
  z-index: 1;
}

.home-level-head {
  display: flex;
  flex-direction: row;
  flex: none;
  align-items: center;
  align-self: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.home-level.home-panel h2,
.home-level-num {
  margin: 0;
  font-family: "Pixelify Sans", sans-serif;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-shadow: none;
}

.home-level.home-panel h2 span,
.home-level-num {
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home-level.home-panel h2 {
  font-size: 24px;
  text-align: center;
  filter:
    drop-shadow(0 1px 0 #0a1c28)
    drop-shadow(0 0 10px rgba(135, 219, 243, 0.75))
    drop-shadow(0 0 22px rgba(135, 219, 243, 0.45))
    drop-shadow(0 2px 10px rgba(4, 11, 21, 0.55));
}

.home-level.home-panel h2 span {
  background-image: linear-gradient(
    180deg,
    #2a7a96 0%,
    #4eb8d4 20%,
    #6dcee8 38%,
    #87dbf3 46%,
    #e4f9ff 50%,
    #87dbf3 54%,
    #6dcee8 62%,
    #4eb8d4 82%,
    #2a7a96 100%
  );
}

.home-level-num-wrap {
  filter:
    drop-shadow(0 1px 0 #0c2414)
    drop-shadow(0 0 10px rgba(112, 247, 143, 0.75))
    drop-shadow(0 0 22px rgba(112, 247, 143, 0.45))
    drop-shadow(0 2px 10px rgba(4, 11, 21, 0.55));
}

.home-level-num {
  flex: none;
  font-size: 24px;
  background-image:
    radial-gradient(circle at 50% 50%, #11fc5b 0%, transparent 60%),
    radial-gradient(circle at 50% 50%, #bcfbb0 0%, transparent 60%),
    radial-gradient(circle at 50% 50%, #4dfc5e 0%, transparent 60%),
    radial-gradient(circle at 50% 50%, #9dfa97 0%, transparent 60%),
    linear-gradient(#05b735, #05b735);
  background-size: 200% 200%, 250% 250%, 150% 150%, 300% 300%, 100% 100%;
  animation: level-mesh 8s ease-in-out infinite alternate;
}

@keyframes level-mesh {
  0% {
    background-position: 0% 0%, 100% 0%, 0% 100%, 100% 100%, 0% 0%;
  }
  33% {
    background-position: 100% 100%, 0% 100%, 100% 0%, 0% 0%, 0% 0%;
  }
  66% {
    background-position: 0% 100%, 100% 100%, 0% 0%, 100% 0%, 0% 0%;
  }
  100% {
    background-position: 100% 0%, 0% 0%, 100% 100%, 0% 100%, 0% 0%;
  }
}

@property --m1x { syntax: "<percentage>"; inherits: true; initial-value: 0%; }
@property --m1y { syntax: "<percentage>"; inherits: true; initial-value: 0%; }
@property --m2x { syntax: "<percentage>"; inherits: true; initial-value: 100%; }
@property --m2y { syntax: "<percentage>"; inherits: true; initial-value: 0%; }
@property --m3x { syntax: "<percentage>"; inherits: true; initial-value: 0%; }
@property --m3y { syntax: "<percentage>"; inherits: true; initial-value: 100%; }
@property --m4x { syntax: "<percentage>"; inherits: true; initial-value: 100%; }
@property --m4y { syntax: "<percentage>"; inherits: true; initial-value: 100%; }

.home-level-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 48px;
  margin: 8px 0 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  mask-image: radial-gradient(white, black);
  transform: translateZ(0);
}

.home-level-bar i {
  display: block;
  position: relative;
  width: 100%;
  height: var(--xp, 0%);
  --m1x: 0%;
  --m1y: 0%;
  --m2x: 100%;
  --m2y: 0%;
  --m3x: 0%;
  --m3y: 100%;
  --m4x: 100%;
  --m4y: 100%;
  --level-fill:
    radial-gradient(circle at 50% 50%, #11fc5b 0%, transparent 60%),
    radial-gradient(circle at 50% 50%, #bcfbb0 0%, transparent 60%),
    radial-gradient(circle at 50% 50%, #4dfc5e 0%, transparent 60%),
    radial-gradient(circle at 50% 50%, #9dfa97 0%, transparent 60%),
    linear-gradient(#05b735, #05b735);
  background-image: var(--level-fill);
  background-size: 180px 180px, 220px 220px, 140px 140px, 260px 260px, auto;
  background-position:
    var(--m1x) var(--m1y),
    var(--m2x) var(--m2y),
    var(--m3x) var(--m3y),
    var(--m4x) var(--m4y),
    0 0;
  animation: level-fill-mesh 8s ease-in-out infinite alternate;
  transition: height 800ms cubic-bezier(0.22, 1, 0.36, 1);
}

.home-level-bar i::before,
.home-level-bar i::after {
  content: "";
  position: absolute;
  left: -20%;
  top: -16px;
  width: 140%;
  height: 32px;
  border-radius: 48% 42% 46% 44%;
  pointer-events: none;
  background-image: var(--level-fill);
  background-size: 180px 180px, 220px 220px, 140px 140px, 260px 260px, auto;
  background-position:
    var(--m1x) var(--m1y),
    var(--m2x) var(--m2y),
    var(--m3x) var(--m3y),
    var(--m4x) var(--m4y),
    0 0;
  animation: level-wave 4.2s ease-in-out infinite;
}

.home-level-bar i::after {
  top: -20px;
  opacity: 0.65;
  animation-duration: 6.4s;
  animation-direction: reverse;
}

@keyframes level-fill-mesh {
  0% {
    --m1x: 0%;
    --m1y: 0%;
    --m2x: 100%;
    --m2y: 0%;
    --m3x: 0%;
    --m3y: 100%;
    --m4x: 100%;
    --m4y: 100%;
  }
  33% {
    --m1x: 100%;
    --m1y: 100%;
    --m2x: 0%;
    --m2y: 100%;
    --m3x: 100%;
    --m3y: 0%;
    --m4x: 0%;
    --m4y: 0%;
  }
  66% {
    --m1x: 0%;
    --m1y: 100%;
    --m2x: 100%;
    --m2y: 100%;
    --m3x: 0%;
    --m3y: 0%;
    --m4x: 100%;
    --m4y: 0%;
  }
  100% {
    --m1x: 100%;
    --m1y: 0%;
    --m2x: 0%;
    --m2y: 0%;
    --m3x: 100%;
    --m3y: 100%;
    --m4x: 0%;
    --m4y: 100%;
  }
}

@keyframes level-wave {
  0%,
  100% {
    transform: translateX(-10%) translateY(0);
  }
  50% {
    transform: translateX(10%) translateY(3px);
  }
}

.cursor.is-name-pink .cursor-name {
  color: #ff4fd0;
}

.cursor.is-prestige .cursor-name::after {
  content: " ★";
  color: #ffb347;
}

.cursor.has-trail .cursor-hand {
  filter: drop-shadow(0 14px 10px color-mix(in srgb, currentColor 55%, transparent));
}

.cursor.is-arrow:not(.is-finger-gun) .cursor-hand {
  clip-path: polygon(50% 4%, 96% 96%, 4% 96%);
}

.board-row.has-frame,
#leaderboard li.has-frame {
  box-shadow: inset 0 0 0 1px #b8ff6a, 0 0 10px rgba(184, 255, 106, 0.25);
  border-radius: 8px;
  padding-inline: 8px;
}

.xp-line {
  margin: 12px 0 0;
  color: var(--accent);
  font-weight: 800;
}

.xp-line.is-up {
  animation: poke 420ms ease-out;
}

.home-play[data-mode="solo"] {
  isolation: isolate;
  border: 0 !important;
  background: linear-gradient(90deg, #a75dbd 0%, #4f67a4 40%, #326a9c 100%) !important;
  box-shadow: none !important;
  color: var(--ink) !important;
  backdrop-filter: none;
}

.home-play[data-mode="solo"]::before {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 0;
  border-radius: 20px;
  background: #071a35 url("/singleplayer.webp") center / 100% auto no-repeat;
  pointer-events: none;
}

.home-play[data-mode="solo"] > * {
  position: relative;
  z-index: 2;
}

.home-play[data-mode="local"] {
  isolation: isolate;
  justify-content: flex-start;
  align-items: stretch;
  cursor: default;
  border: 0 !important;
  background: conic-gradient(
    from -45deg at 50% 50%,
    #7a55c2 0deg,
    #256abc 90deg,
    #2a7fd2 180deg,
    #417bc3 270deg,
    #7a55c2 360deg
  ) !important;
  box-shadow: none !important;
  color: var(--ink) !important;
  backdrop-filter: none;
}

.home-play[data-mode="local"]::before {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 0;
  border-radius: 20px;
  background: #150e2b url("/multiplayer.webp") center / cover no-repeat;
  pointer-events: none;
}

.home-play[data-mode="local"] > * {
  position: relative;
  z-index: 2;
}

.home-qr {
  isolation: isolate;
  border: 0;
  background: conic-gradient(
    from -45deg at 50% 50%,
    #4685b5 0deg,
    #455396 90deg,
    #4f4fa5 180deg,
    #4072d0 270deg,
    #4685b5 360deg
  );
  box-shadow: none;
  backdrop-filter: none;
}

.home-qr::before {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 0;
  border-radius: 20px;
  background: linear-gradient(135deg, #020b17 0%, #030b1a 100%);
  pointer-events: none;
}

.home-qr > * {
  position: relative;
  z-index: 1;
}

.home-foot {
  isolation: isolate;
  border: 0;
  background: conic-gradient(
    from -45deg at 50% 50%,
    #635bbd 0deg,
    #3a74c4 90deg,
    #2566ab 180deg,
    #704ac1 270deg,
    #635bbd 360deg
  );
  box-shadow: none;
  backdrop-filter: none;
}

.home-foot::before {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 0;
  border-radius: 20px;
  background: linear-gradient(180deg, #040b15 0%, #030513 100%);
  pointer-events: none;
}

.home-foot > * {
  position: relative;
  z-index: 1;
}

.home-panel h2,
.home-panel h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.home-panel h3 {
  margin-top: 16px;
  font-size: 14px;
  color: var(--accent);
}


.home-play {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100%;
  min-height: 140px;
  justify-content: center;
  cursor: pointer;
}

.home-qr img {
  display: block;
  width: min(240px, 100%);
  margin: 12px 0;
  border-radius: 6px;
  padding: 6px;
  background: #fff;
}

.home-steps {
  margin: 0 0 12px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.home-qr .join-form {
  margin-top: 14px;
}

.home-qr .join-form button {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.home-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 84px;
  padding: 22px 28px;
}

.home-foot nav {
  display: flex;
  gap: 16px;
}

.home-foot a,
.legal a {
  color: var(--accent);
}

.legal {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 24px;
  line-height: 1.5;
}

@media (max-width: 800px) {
  .home-header.auth-bar > .auth-user {
    position: relative;
  }

  .home .auth-menu {
    top: calc(100% + 16px);
    left: auto;
    right: 0;
    width: min(280px, 100%);
    height: auto;
  }

  .home .auth-user-summary::after {
    transform: rotate(45deg) translateY(-2px);
  }

  .home .auth-user[open] .auth-user-summary::after {
    transform: rotate(225deg) translateY(-1px);
  }

  body:has(.home) {
    height: auto;
    overflow: auto;
  }

  .home-fit {
    height: auto;
    overflow: visible;
  }

  .home-frame {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    height: auto;
    transform: none !important;
  }

  .home {
    width: 80%;
    height: 90dvh;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "head"
      "solo"
      "multi"
      "qr"
      "level"
      "board"
      "foot";
  }

  .home-play[data-mode="local"] {
    min-height: 340px;
  }

  .home-level {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-height: 72px;
    padding: 14px 18px;
  }

  .home-level.home-panel h2 {
    font-size: 28px;
  }

  .home-level-num {
    flex: none;
    font-size: 28px;
  }

  .home-level-bar {
    flex-direction: row;
    justify-content: flex-start;
    width: auto;
    height: auto;
    min-height: 0;
    margin: 0;
    align-self: stretch;
  }

  .home-level-bar i {
    height: 100%;
    width: var(--xp, 0%);
    margin-top: 0;
    transition: width 800ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .home-level-bar i::before,
  .home-level-bar i::after {
    left: auto;
    right: -16px;
    top: -20%;
    width: 32px;
    height: 140%;
    animation-name: level-wave-x;
  }

  .home-level-bar i::after {
    right: -20px;
  }

  @keyframes level-wave-x {
    0%,
    100% {
      transform: translateY(-10%) translateX(0);
    }
    50% {
      transform: translateY(10%) translateX(3px);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-level-bar i {
    transition: none;
    animation: none;
  }

  .home-level-bar i::before,
  .home-level-bar i::after {
    animation: none;
  }
}

@media (max-width: 560px) {
  .mp-actions {
    grid-template-columns: 1fr;
  }
}

.gate {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 88px 24px 24px;
  background:
    radial-gradient(900px 500px at 90% 110%, rgba(92, 225, 255, 0.08), transparent 50%),
    #07080a;
}

.gate-logo {
  display: block;
  width: 480px;
  max-width: 88vw;
  height: auto;
}

.gate-card {
  width: min(560px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
}

.gate-card h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 6vw, 40px);
  letter-spacing: -0.04em;
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.gate-card button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--accent);
  color: #10210d;
  font-weight: 700;
  cursor: pointer;
}

.gate-card button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.gate-card button:hover:not(:disabled),
.gate-card button:focus-visible:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.gate-card button.ghost:hover:not(:disabled),
.gate-card button.ghost:focus-visible:not(:disabled) {
  border-color: rgba(124, 255, 107, 0.55);
  background: rgba(124, 255, 107, 0.1);
}

.gate-card button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.gate-card .join-form {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.join-form label {
  color: var(--muted);
  font-size: 14px;
}

.join-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.join-form input:focus {
  outline: 2px solid rgba(124, 255, 107, 0.35);
}

.gate-card button.ghost span {
  color: var(--muted);
}

.mode-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.mode-card {
  text-align: left;
  border-radius: 20px !important;
  padding: 16px 18px !important;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
}

.mode-card:hover:not(.home-play),
.mode-card:focus-visible:not(.home-play),
.mode-card.is-hot:not(.home-play) {
  border-color: rgba(124, 255, 107, 0.7) !important;
  background: rgba(124, 255, 107, 0.16) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  transform: translateY(-2px);
}

.mode-card em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.mode-card strong {
  font-size: 18px;
  letter-spacing: -0.03em;
}

.mode-card span {
  font-weight: 500;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  opacity: 1;
}

.home-play.mode-card {
  text-align: center;
  align-items: center;
}

.home-play[data-mode="local"].mode-card {
  align-items: stretch;
}

.home-play-lead {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 0;
}

.mp-actions {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  margin-top: auto;
}

.mp-block {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(6, 10, 22, 0.72);
  backdrop-filter: blur(10px);
  text-align: left;
}

.mp-block[data-mp="create"] {
  cursor: pointer;
  border: 2px solid transparent;
  background-image:
    linear-gradient(rgba(6, 10, 22, 0.72), rgba(6, 10, 22, 0.72)),
    conic-gradient(
      from -45deg at 50% 50%,
      #286899 0deg,
      #12224e 45deg,
      #17515c 90deg,
      #062446 180deg,
      #1d1243 225deg,
      #082044 270deg,
      #286899 360deg
    );
  background-origin: padding-box, border-box;
  background-clip: padding-box, border-box;
}

.mp-block.is-hot {
  box-shadow: 0 0 16px rgba(124, 255, 107, 0.14);
}

.mp-block-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.mp-block-icon {
  flex: none;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  color: #7cff6b;
}

.mp-block[data-mp="create"] .mp-block-icon {
  color: #3ed0f9;
}

.mp-block[data-mp="join"] .mp-block-icon {
  color: #ff4fd0;
}

.home-play[data-mode="local"] .mp-block strong {
  display: block;
  font-family: "Segoe UI", "Avenir Next", sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: none;
  filter: none;
  text-shadow: 0 2px 12px rgba(4, 11, 21, 0.9);
  -webkit-text-fill-color: #fff;
}

.mp-block p {
  margin: 3px 0 0;
  color: #b3d7e5;
  font-family: "Segoe UI", "Avenir Next", sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-transform: none;
  text-shadow: 0 2px 12px rgba(4, 11, 21, 0.9);
}

.mp-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 34px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  font-family: "Bahnschrift Bold", Bahnschrift, sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #000;
  cursor: pointer;
}

.mp-cta-create {
  border: 0;
  background: linear-gradient(180deg, #b0f2ff 0%, #7ee4fc 22%, #3ed0f9 58%, #2bb4e0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.mp-cta-join {
  width: auto;
  flex: none;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #ff9ae8 0%, #ff4fd0 40%, #e12bb8 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.mp-block[data-mp="join"] {
  container-type: inline-size;
  border: 2px solid transparent;
  background-image:
    linear-gradient(rgba(6, 10, 22, 0.72), rgba(6, 10, 22, 0.72)),
    linear-gradient(135deg, #622351 0%, #533273 100%);
  background-origin: padding-box, border-box;
  background-clip: padding-box, border-box;
}

.mp-join-row {
  display: flex;
  gap: 8px;
  min-width: 0;
}

@container (max-width: 220px) {
  .mp-join-row {
    flex-direction: column;
  }

  .mp-cta-join {
    width: 100%;
  }
}

.mp-join-row input {
  flex: 1;
  min-width: 0;
  height: 34px;
  border: 1px solid rgba(232, 120, 255, 0.55);
  border-radius: 10px;
  padding: 0 10px 1px;
  background: rgba(20, 10, 28, 0.65);
  color: var(--ink);
  font-family: "Segoe UI", "Avenir Next", sans-serif;
  font-size: 11px;
  font-weight: 500;
  line-height: 31px;
  letter-spacing: 0.04em;
  box-shadow: none;
}

.mp-join-row input::placeholder {
  color: rgba(255, 158, 232, 0.72);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  line-height: 31px;
  letter-spacing: 0.04em;
}

.mp-join-row input:focus {
  outline: none;
  box-shadow: none;
  border-color: rgba(232, 120, 255, 0.75);
}

.home-toast {
  position: fixed;
  top: 16%;
  left: 50%;
  z-index: 40;
  min-width: 280px;
  max-width: min(440px, 90vw);
  padding: 16px 22px;
  border: 2px solid transparent;
  border-radius: 16px;
  background-image:
    linear-gradient(rgba(22, 6, 12, 0.88), rgba(22, 6, 12, 0.88)),
    linear-gradient(135deg, #9a2440 0%, #6a1d48 100%);
  background-origin: padding-box, border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  color: #ffb4c0;
  text-align: center;
  font-weight: 700;
  line-height: 1.35;
  transform: translate(-50%, 8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.home-toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.home-play-icon {
  display: block;
  flex: none;
  width: 48px;
  height: 48px;
  margin-bottom: 0;
  filter: drop-shadow(0 2px 10px rgba(4, 11, 21, 0.9));
}

.home-play[data-mode="solo"] .home-play-icon {
  color: #7cf67e;
  filter:
    drop-shadow(0 0 8px rgba(90, 230, 130, 0.7))
    drop-shadow(0 0 18px rgba(56, 232, 109, 0.42))
    drop-shadow(0 2px 10px rgba(4, 11, 21, 0.6));
}

.home-play[data-mode="local"] .home-play-icon {
  color: #3ed0f9;
  filter:
    drop-shadow(0 0 8px rgba(62, 208, 249, 0.7))
    drop-shadow(0 0 18px rgba(62, 180, 230, 0.42))
    drop-shadow(0 2px 10px rgba(4, 11, 21, 0.6));
}

.home-play.mode-card strong {
  font-family: "Pixelify Sans", sans-serif;
  font-weight: 700;
  font-size: 34px;
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-shadow: 0 2px 14px rgba(4, 11, 21, 0.9);
}

.home-play[data-mode="solo"] strong {
  color: transparent;
  background: linear-gradient(
    180deg,
    #24963c 0%,
    #3ecf5a 20%,
    #62e46a 38%,
    #8ef08a 46%,
    #b8ffb4 50%,
    #8ef08a 54%,
    #62e46a 62%,
    #3ecf5a 82%,
    #24963c 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter:
    drop-shadow(0 1px 0 #0c2414)
    drop-shadow(0 0 10px rgba(90, 230, 130, 0.75))
    drop-shadow(0 0 22px rgba(56, 232, 109, 0.45))
    drop-shadow(0 2px 10px rgba(4, 11, 21, 0.55));
}

.home-play[data-mode="local"] .home-play-lead strong {
  color: transparent;
  background: linear-gradient(
    180deg,
    #1a7ea8 0%,
    #2bb4e0 20%,
    #3ed0f9 38%,
    #7ee4fc 46%,
    #b0f2ff 50%,
    #7ee4fc 54%,
    #3ed0f9 62%,
    #2bb4e0 82%,
    #1a7ea8 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter:
    drop-shadow(0 1px 0 #0a1c28)
    drop-shadow(0 0 10px rgba(62, 208, 249, 0.75))
    drop-shadow(0 0 22px rgba(62, 180, 230, 0.45))
    drop-shadow(0 2px 10px rgba(4, 11, 21, 0.55));
}

.home-play.mode-card > span:not(.home-play-cta),
.home-play-lead > span {
  color: #b3d7e5;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 12px rgba(4, 11, 21, 0.9);
}

.home-play.mode-card .home-play-cta {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  margin-top: 14px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background:
    linear-gradient(180deg, #b6ffbc 0%, #6ef08a 22%, #38e86d 58%, #2ec85c 100%);
  color: #000;
  font-family: "Bahnschrift Bold", Bahnschrift, sans-serif;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 0 14px 2px rgba(56, 232, 109, 0.5),
    0 0 26px rgba(154, 250, 161, 0.22);
}

.home-play[data-mode="local"] .home-play-cta {
  background: linear-gradient(180deg, #b0f2ff 0%, #7ee4fc 22%, #3ed0f9 58%, #2bb4e0 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 0 14px 2px rgba(62, 208, 249, 0.45),
    0 0 26px rgba(62, 180, 230, 0.22);
}

.home-play-cta-icon {
  display: block;
  flex: none;
  width: 15px;
  height: 15px;
}

.mode-card.ghost span {
  color: var(--muted);
  opacity: 1;
}

.hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 120px;
}

.hud span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hud strong {
  font-size: 36px;
  letter-spacing: -0.04em;
  line-height: 1;
}

.field {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.tgt {
  position: absolute;
  width: calc(var(--r) * 200%);
  aspect-ratio: 1;
  margin: calc(var(--r) * -100%);
  left: calc(var(--x) * 100%);
  top: calc(var(--y) * 100%);
  background: var(--accent);
  box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 70%, transparent);
}

.tgt.orb {
  border-radius: 50%;
}

.tgt.diamond {
  border-radius: 8px;
  rotate: 45deg;
  background: #5ce1ff;
  box-shadow: 0 0 22px rgba(92, 225, 255, 0.7);
}

.tgt.plus {
  border-radius: 4px;
  background: #ffb347;
  box-shadow: 0 0 22px rgba(255, 179, 71, 0.7);
}

.tgt.ship {
  background-color: transparent;
  box-shadow: none;
  background-image: url("/games/space-shooter/ships.png");
  background-repeat: no-repeat;
  background-size: 500% 300%;
  background-position: calc(var(--col, 0) * 25%) calc(var(--row, 0) * 50%);
  image-rendering: pixelated;
  rotate: var(--rot, 0deg);
}

.tgt.ship.is-exploding {
  background-image: url("/games/space-shooter/explosion.png");
  background-size: 800% 100%;
  background-position: calc(var(--frame, 0) * 100% / 7) 0;
  rotate: 0deg;
}

.stage.is-ships .field {
  background-color: #000;
  background-image: url("/games/space-shooter/stars.png");
  background-repeat: repeat;
  background-size: 256px 224px;
  image-rendering: pixelated;
  animation: stars-drift 90s linear infinite;
}

@keyframes stars-drift {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 256px 224px;
  }
}

.start-game {
  appearance: none;
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  z-index: 4;
  border: 0;
  border-radius: 999px;
  padding: 20px 42px;
  background: var(--accent);
  color: #10210d;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  pointer-events: none;
}

.start-wait {
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  z-index: 4;
  margin: 0;
  color: var(--muted);
  font-size: 20px;
}

.banner {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 4;
  padding: 16px 28px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 28px;
  font-weight: 800;
}

.results {
  position: absolute;
  inset: 18% 16% auto;
  z-index: 5;
  padding: 28px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px);
}

.results h2 {
  margin: 0 0 16px;
  font-size: 36px;
  letter-spacing: -0.04em;
}

.results h3 {
  margin: 20px 0 8px;
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.results ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.results li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.results .start-game {
  position: static;
  transform: none;
  display: block;
  width: 100%;
  margin-top: 18px;
  font-size: 20px;
}

.catalog {
  position: absolute;
  inset: 108px 28px 28px;
  z-index: 2;
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  grid-template-rows: 1fr auto;
  align-items: center;
  column-gap: 16px;
  pointer-events: none;
}

.catalog-grid {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 14px;
  height: min(70vh, 620px);
  overflow: visible;
}

.game-tile {
  appearance: none;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #101214;
  transform: scale(1);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.game-tile.is-hot {
  z-index: 2;
  transform: scale(1.035);
  box-shadow:
    0 0 0 3px #fff,
    0 8px 18px rgba(0, 0, 0, 0.4);
}

.game-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.game-tile.is-empty {
  visibility: hidden;
}

.catalog-nav {
  appearance: none;
  grid-row: 1;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #10210d;
  font-size: 42px;
  line-height: 1;
  font-weight: 800;
}

.catalog-nav[data-dir="-1"] {
  grid-column: 1;
}

.catalog-nav[data-dir="1"] {
  grid-column: 3;
}

.catalog-dots {
  grid-column: 1 / -1;
  grid-row: 2;
  margin: 10px 0 0;
  text-align: center;
  letter-spacing: 0.35em;
  color: var(--muted);
  font-size: 18px;
}

.stage.is-playing .empty,
.stage.is-playing .qr-card,
.stage.is-playing .catalog,
.stage.is-playing .start-game,
.stage.is-playing .start-wait,
.stage.is-finished .empty,
.stage.is-finished .qr-card,
.stage.is-finished .catalog,
.stage.is-finished .start-wait {
  display: none !important;
}

.qr-actions[hidden],
.qr-card[hidden],
.pairing[hidden],
.stage[hidden],
.empty[hidden],
.pad[hidden],
.row[hidden],
.join-form[hidden],
.field[hidden],
.hud[hidden],
.start-game[hidden],
.start-wait[hidden],
.catalog[hidden],
.catalog-nav[hidden],
.banner[hidden],
.results[hidden] {
  display: none !important;
}

.phone #joinGate {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.phone #joinGate[hidden] {
  display: none;
}

.phone #authTrigger,
.phone #joinGate .auth-user {
  width: 100%;
}

.phone .join-form {
  margin-top: 0;
}

@media (max-width: 720px) {
  .auth-bar {
    padding-inline: 16px;
  }

  .auth-user span {
    max-width: 34vw;
  }

  .topbar {
    flex-direction: column;
  }

  .players {
    max-width: none;
    justify-content: flex-start;
  }

  .qr-card {
    position: static;
    margin: 24px 16px 20px;
  }
}

.ga-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: #0c1220;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.ga-bar p {
  flex: 1;
  min-width: 180px;
  margin: 0;
  color: #c5d0e0;
  font-size: 13px;
  line-height: 1.4;
}

.ga-bar a {
  color: #4dfc5e;
}

.ga-bar button {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 8px 14px;
  background: #4dfc5e;
  color: #04120a;
  font-weight: 800;
  cursor: pointer;
}

.ga-bar button.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e8eef6;
}
