:root {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #111111;
  --line: rgba(17, 17, 17, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Avenir Next", "Helvetica Neue", Arial, sans-serif;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(17, 17, 17, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 17, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 50% 46%, rgba(17, 17, 17, 0.055), transparent 34%);
  background-size: 36px 36px, 36px 36px, auto;
  mask-image: radial-gradient(circle at 50% 52%, transparent 0%, black 42%, black 100%);
  opacity: 0.94;
}

.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(3px);
  z-index: 40;
  transition: opacity 180ms ease, visibility 180ms ease;
}

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

.loading-mark {
  width: 42px;
  height: 42px;
  border: 2px solid rgba(17, 17, 17, 0.14);
  border-top-color: #111111;
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.app {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 10px 8px;
  position: relative;
  z-index: 1;
}

.hero-logo {
  width: min(240px, 34vw);
  height: auto;
  display: block;
  flex: 0 0 auto;
  margin-top: 6px;
}

.x-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1.5px solid #111111;
  color: #111111;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}

.x-link:hover {
  background: #111111;
  color: #ffffff;
  transform: scale(1.03);
}

.asset-preload {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.hud {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 0;
  padding-bottom: 6px;
  flex: 0 0 auto;
}

.help-button {
  appearance: none;
  border: 1.5px solid #111111;
  background: #111111;
  color: #ffffff;
  padding: 10px 16px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.secondary-button {
  appearance: none;
  border: 1.5px solid #111111;
  background: #ffffff;
  color: #111111;
  padding: 10px 16px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.help-button:disabled {
  background: #ffffff;
  color: #111111;
  opacity: 0.45;
  cursor: default;
}

.status {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

.game-wrap {
  width: min(calc(100vw - 24px), calc((100vh - 210px) * 16 / 9), 1600px);
  aspect-ratio: 16 / 9;
  flex: 0 1 auto;
  min-height: 420px;
  position: relative;
}

#gameRoot {
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
}

#gameRoot.is-hidden {
  visibility: hidden;
}

#gameRoot canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
}

.hidden {
  display: none !important;
}

.game-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.game-state-card {
  width: min(480px, 100%);
  padding: 28px 26px;
  border: 1.5px solid #111111;
  background: rgba(255, 255, 255, 0.92);
  text-align: center;
}

.game-state-kicker,
.game-state-title,
.game-state-copy {
  margin: 0;
}

.game-state-kicker {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.6;
}

.game-state-title {
  margin-top: 10px;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-state-copy {
  margin-top: 10px;
  font-size: 0.92rem;
  line-height: 1.6;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
}

.wallet-modal {
  width: min(460px, 100%);
  border: 1.5px solid #111111;
  background: #ffffff;
  padding: 24px 22px;
  box-shadow: 0 18px 40px rgba(17, 17, 17, 0.08);
}

.wallet-modal h2,
.wallet-copy,
.wallet-feedback,
.wallet-label {
  margin: 0;
}

.wallet-modal h2 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wallet-copy {
  margin-top: 8px;
  font-size: 0.9rem;
}

.wallet-form {
  margin-top: 18px;
}

.wallet-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.social-tasks {
  border: 1.5px solid rgba(17, 17, 17, 0.12);
  padding: 14px;
  margin-bottom: 16px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid #111111;
  color: #111111;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 10px;
}

.social-link:hover {
  background: #111111;
  color: #ffffff;
}

.social-link.is-disabled {
  opacity: 0.38;
  pointer-events: none;
}

.social-note {
  margin: 10px 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
}

.social-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  font-size: 0.84rem;
  font-weight: 600;
}

.social-check input {
  margin: 2px 0 0;
}

.wallet-input {
  width: 100%;
  margin-top: 8px;
  border: 1.5px solid #111111;
  background: #ffffff;
  color: #111111;
  padding: 13px 14px;
  font: inherit;
  font-size: 0.95rem;
}

.wallet-feedback {
  margin-top: 10px;
  min-height: 1.25rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.wallet-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

@media (max-width: 720px) {
  .app {
    gap: 10px;
    padding: 18px 6px 8px;
  }

  .hero-logo {
    width: min(180px, 46vw);
    margin-top: 4px;
  }

  .x-link {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.7rem;
  }

  .hud {
    gap: 10px;
    padding-bottom: 4px;
  }

  .status {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
  }

  .help-button {
    font-size: 0.72rem;
    padding: 9px 12px;
  }

  .secondary-button {
    font-size: 0.72rem;
    padding: 9px 12px;
  }

  .wallet-modal {
    padding: 20px 16px;
  }

  .social-link {
    width: 100%;
  }
}
