* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(140, 199, 72, 0.28), transparent 34%),
    linear-gradient(180deg, #0a210a 0%, #061405 100%);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: #f7f7f2;
}

.page-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.game-card {
  width: 100%;
  max-width: 1200px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  background: rgba(8, 24, 8, 0.78);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

.game-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.eyebrow {
  color: #9fd742;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.game-copy h1 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1;
}

.subtitle {
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
}

#game-container {
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.game-stage {
  position: relative;
}

#game-container canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: none;
}

.intro-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(6, 18, 6, 0.3), rgba(4, 12, 4, 0.86)),
    radial-gradient(circle at 50% 25%, rgba(177, 224, 92, 0.24), transparent 30%);
  border-radius: 20px;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

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

.intro-panel {
  width: min(100%, 520px);
  padding: 28px 26px;
  border-radius: 26px;
  background: rgba(8, 26, 8, 0.88);
  border: 1px solid rgba(190, 233, 115, 0.22);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.intro-kicker {
  color: #9fd742;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.intro-panel h2 {
  margin-top: 10px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.96;
}

.intro-loader {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 16px;
}

.intro-loader span {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #9fd742;
  box-shadow: 0 0 18px rgba(159, 215, 66, 0.35);
  animation: pulse-dot 1s infinite ease-in-out;
}

.intro-loader span:nth-child(2) {
  animation-delay: 0.15s;
}

.intro-loader span:nth-child(3) {
  animation-delay: 0.3s;
}

.intro-text {
  color: rgba(255, 255, 255, 0.84);
  font-size: 1rem;
  line-height: 1.5;
}

.player-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
  text-align: left;
}

.field-wide {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.88rem;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: #f7f7f2;
  font: inherit;
  font-size: 0.98rem;
  outline: none;
}

.field input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.field input:focus {
  border-color: rgba(183, 228, 93, 0.72);
  box-shadow: 0 0 0 3px rgba(159, 215, 66, 0.14);
}

.difficulty-picker {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.difficulty-button {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #f7f7f2;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.difficulty-button:hover {
  transform: translateY(-1px);
}

.difficulty-button.is-active {
  background: rgba(159, 215, 66, 0.18);
  border-color: rgba(183, 228, 93, 0.65);
  color: #d8f29d;
}

.start-button {
  margin-top: 22px;
  padding: 14px 28px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #b7e45d, #76b520);
  color: #10240f;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 12px 30px rgba(118, 181, 32, 0.32);
}

.start-button:hover {
  transform: translateY(-2px);
}

.start-button:active {
  transform: translateY(0);
}

.ranking-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(5, 14, 5, 0.4), rgba(3, 10, 3, 0.92)),
    radial-gradient(circle at 50% 20%, rgba(177, 224, 92, 0.18), transparent 28%);
  border-radius: 20px;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

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

.ranking-panel {
  width: min(100%, 900px);
  padding: 26px 24px 22px;
  border-radius: 22px;
  background: rgba(8, 26, 8, 0.92);
  border: 1px solid rgba(190, 233, 115, 0.22);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
}

.ranking-kicker {
  color: #9fd742;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.ranking-panel h2 {
  margin-top: 10px;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1;
}

.ranking-summary {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.45;
}

.ranking-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.ranking-table th,
.ranking-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ranking-table th {
  color: #cde98d;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ranking-table td {
  color: rgba(255, 255, 255, 0.92);
}

.ranking-table tr.is-current {
  background: rgba(159, 215, 66, 0.1);
}

.challenge-overlay {
  position: absolute;
  inset: 0;
  z-index: 26;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(4, 14, 4, 0.5), rgba(2, 7, 2, 0.94)),
    radial-gradient(circle at 50% 20%, rgba(255, 217, 74, 0.14), transparent 30%);
  border-radius: 20px;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

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

.challenge-panel {
  width: min(100%, 760px);
  padding: 26px 24px 22px;
  border-radius: 22px;
  background: rgba(8, 26, 8, 0.94);
  border: 1px solid rgba(255, 217, 74, 0.24);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
}

.challenge-kicker {
  color: #ffd94a;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.challenge-panel h2 {
  margin-top: 10px;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1;
}

.challenge-text {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.45;
}

.challenge-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.social-button {
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #f7f7f2;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.social-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
}

.challenge-status {
  margin-top: 14px;
  color: #cde98d;
  line-height: 1.45;
}

.challenge-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.start-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.secondary-button {
  margin-top: 12px;
  padding: 13px 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f7f7f2;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.secondary-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
}

@keyframes pulse-dot {
  0%, 80%, 100% {
    opacity: 0.38;
    transform: scale(0.9);
  }

  40% {
    opacity: 1;
    transform: scale(1.18);
  }
}

@media (max-width: 768px) {
  .page-shell {
    padding: 14px;
  }

  .game-card {
    padding: 14px;
    border-radius: 20px;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .intro-overlay {
    padding: 14px;
  }

  .intro-panel {
    padding: 22px 18px;
    border-radius: 22px;
  }

  .player-form {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }

  .difficulty-picker {
    gap: 8px;
  }

  .ranking-overlay {
    padding: 14px;
  }

  .ranking-panel {
    padding: 20px 16px 18px;
  }

  .challenge-overlay {
    padding: 14px;
  }

  .challenge-panel {
    padding: 20px 16px 18px;
  }
}
