/* ============================================================
   Game space · HowToTrade
   ============================================================ */

.gm-hero {
  position: relative;
  overflow: hidden;
  padding: 58px 0 30px;
}

.gm-hero::before,
.gm-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(10px);
}

.gm-hero::before {
  width: 640px;
  height: 640px;
  right: -200px;
  top: -300px;
  background: radial-gradient(circle, rgba(255, 122, 69, 0.2), transparent 62%);
}

.gm-hero::after {
  width: 520px;
  height: 520px;
  left: -240px;
  bottom: -340px;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.11), transparent 62%);
}

.gm-hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  gap: 36px;
  align-items: center;
}

.gm-hero h1 {
  margin: 8px 0 12px;
  font-size: clamp(44px, 6vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.055em;
  font-weight: 760;
}

.gm-tagline {
  margin: 0 0 16px;
  font-size: clamp(19px, 2.4vw, 26px);
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, #ff7a45 0%, #ffd166 62%, #ff9b63 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.gm-lead {
  margin: 0;
  max-width: 56ch;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.78;
}

.gm-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.gm-badges span {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  font-size: 12px;
}

.gm-hero-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.gm-hero-art::before {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 122, 69, 0.2), transparent 68%);
  filter: blur(18px);
}

.gm-hero-art svg {
  position: relative;
  width: min(100%, 460px);
  height: auto;
}

.gm-sweep {
  transform-box: view-box;
  transform-origin: 230px 160px;
  animation: gm-sweep 7s linear infinite;
}

.gm-blip circle:first-child {
  animation: gm-blip 2.8s ease-in-out infinite;
}

.gm-blip.b circle:first-child { animation-delay: 0.9s; }
.gm-blip.c circle:first-child { animation-delay: 1.7s; }

.gm-blip circle:last-child {
  animation: gm-ring 2.8s ease-out infinite;
}

.gm-blip.b circle:last-child { animation-delay: 0.9s; }
.gm-blip.c circle:last-child { animation-delay: 1.7s; }

@keyframes gm-sweep {
  to { transform: rotate(360deg); }
}

@keyframes gm-blip {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes gm-ring {
  0% { opacity: 0.7; transform: scale(0.7); }
  80%, 100% { opacity: 0; transform: scale(1.6); }
}

/* ------------------------------------------------------------ games grid */

.gm-section {
  padding-top: 26px;
}

.gm-games {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.gm-game {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 122, 69, 0.28);
  border-radius: var(--radius);
  background: var(--panel);
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.gm-game:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 122, 69, 0.52);
  box-shadow: var(--shadow);
}

.gm-preview {
  position: relative;
  height: 218px;
  overflow: hidden;
  background: #080d12;
  border-bottom: 1px solid var(--line);
}

.gm-preview svg {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform 0.35s ease;
}

.gm-game:hover .gm-preview svg {
  transform: scale(1.035);
}

.gm-preview-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 209, 102, 0.35);
  border-radius: 999px;
  background: rgba(5, 8, 11, 0.6);
  color: #ffd166;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
}

.gm-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px 20px 18px;
}

.gm-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.gm-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--muted-2);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.gm-body h3 {
  margin: 0 0 8px;
  font-size: 23px;
  letter-spacing: -0.03em;
}

.gm-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13.6px;
  line-height: 1.7;
}

.gm-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
}

.gm-best {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.gm-more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-top: 18px;
  padding: 22px 24px;
  border: 1px dashed rgba(255, 209, 102, 0.3);
  border-radius: var(--radius);
  background: rgba(255, 209, 102, 0.035);
}

.gm-more h3 {
  margin: 4px 0 6px;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.gm-more p {
  margin: 0;
  max-width: 78ch;
  color: var(--muted);
  font-size: 13.4px;
  line-height: 1.7;
}

/* ---------------------------------------------------------- game player */

body.gm-locked {
  overflow: hidden;
}

.game-player {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  background: #05080b;
}

.game-player[hidden] {
  display: none;
}

.gp-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-height: 54px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 122, 69, 0.22);
  background: linear-gradient(180deg, #0b1116, #080c10);
}

.gp-title {
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.gp-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  min-height: 22px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}

.gp-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.gp-stats span i {
  color: var(--muted-2);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gp-stats .hot {
  color: #ffd166;
}

.gp-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.gp-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 6px 11px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.gp-btn:hover {
  border-color: rgba(255, 122, 69, 0.55);
  background: rgba(255, 122, 69, 0.12);
}

.gp-btn.gp-exit {
  border-color: rgba(255, 122, 69, 0.36);
  color: #ffb38f;
}

.gp-towers {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.gp-towers[hidden] {
  display: none;
}

.td-tower {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  padding: 5px 9px;
  font-size: 11.5px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.td-tower b {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--c, #ffd166);
  box-shadow: 0 0 8px var(--c, #ffd166);
}

.td-tower span {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
}

.td-tower:hover {
  border-color: rgba(255, 209, 102, 0.5);
}

.td-tower.active {
  border-color: rgba(255, 209, 102, 0.75);
  background: rgba(255, 209, 102, 0.13);
}

.td-tower.is-poor {
  opacity: 0.42;
}

.td-tower.is-locked {
  opacity: 0.35;
  border-style: dashed;
}

.gp-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #060a0e;
}

.gp-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  touch-action: none;
}

.gp-stage canvas.active {
  display: block;
}

.gp-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 40%, rgba(255, 122, 69, 0.14), transparent 62%),
    rgba(3, 5, 8, 0.78);
  backdrop-filter: blur(7px);
}

.gp-overlay[hidden] {
  display: none;
}

.gp-card {
  width: min(520px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 28px 28px 24px;
  border: 1px solid rgba(255, 122, 69, 0.34);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(17, 23, 29, 0.96), rgba(8, 12, 16, 0.98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.gp-kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.gp-card h2 {
  margin: 0 0 10px;
  font-size: clamp(26px, 4vw, 36px);
  letter-spacing: -0.04em;
}

.gp-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.gp-keys {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 20px;
}

.gp-setup {
  margin: 16px 0 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.gp-setup[hidden] {
  display: none;
}

.gp-setup-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gp-size-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gp-size-opts button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  padding: 7px 13px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.gp-size-opts button:hover {
  border-color: rgba(255, 209, 102, 0.5);
}

.gp-size-opts button.active {
  border-color: rgba(255, 209, 102, 0.8);
  background: rgba(255, 209, 102, 0.14);
  color: #ffd166;
}

.gp-btn.active {
  border-color: rgba(255, 209, 102, 0.75);
  background: rgba(255, 209, 102, 0.14);
  color: #ffd166;
}

.gp-settings-panel {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 5, 8, 0.62);
  backdrop-filter: blur(5px);
}

.gp-settings-panel[hidden] {
  display: none;
}

.gp-settings-card {
  width: min(500px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 26px 26px 22px;
  border: 1px solid rgba(255, 209, 102, 0.34);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(17, 23, 29, 0.98), rgba(8, 12, 16, 0.99));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

.gp-settings-card h2 {
  margin: 0 0 16px;
  font-size: clamp(24px, 3.4vw, 32px);
  letter-spacing: -0.04em;
}

.gp-check {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
}

.gp-check input {
  width: 16px;
  height: 16px;
  accent-color: #ff7a45;
}

.gp-settings-hint {
  margin: 9px 0 16px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.65;
}

.gp-settings-card .gp-setup-label {
  margin-top: 4px;
}

#gp-td-settings[hidden] {
  display: none;
}

.gp-wave-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 9px 12px;
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
}

.gp-wave-input:focus {
  border-color: rgba(255, 209, 102, 0.7);
}

.gp-keys span {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.gp-keys[hidden] {
  display: none;
}

.gp-keys b {
  flex: none;
  min-width: 26px;
  border: 1px solid rgba(255, 209, 102, 0.4);
  border-radius: 5px;
  background: rgba(255, 209, 102, 0.1);
  color: #ffd166;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
  padding: 3px 4px;
}

.gp-overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gp-beach-tools {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 5;
  display: flex;
  gap: 7px;
}

.gp-beach-tools[hidden] {
  display: none;
}

.gp-weapon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 209, 102, 0.3);
  border-radius: 9px;
  background: rgba(6, 10, 14, 0.72);
  color: #ffdfa6;
  padding: 7px 11px;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.gp-weapon b {
  border: 1px solid rgba(255, 209, 102, 0.4);
  border-radius: 4px;
  padding: 1px 4px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
}

.gp-weapon.active {
  border-color: rgba(255, 209, 102, 0.8);
  background: rgba(255, 209, 102, 0.16);
}

.gp-tip {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  color: rgba(230, 236, 242, 0.5);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  pointer-events: none;
}

.gp-tip[hidden] {
  display: none;
}

.gp-damage {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  box-shadow: inset 0 0 140px rgba(255, 58, 38, 0.9);
}

.gp-damage.on {
  animation: gp-damage 0.5s ease-out;
}

@keyframes gp-damage {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

.gp-wave {
  border-color: rgba(255, 209, 102, 0.45);
  background: rgba(255, 209, 102, 0.1);
  color: #ffd166;
}

.gp-wave[hidden] {
  display: none;
}

/* TD side status hint */
.gp-td-hint {
  position: absolute;
  right: 14px;
  bottom: 46px;
  z-index: 4;
  max-width: 340px;
  padding: 7px 11px;
  border: 1px solid rgba(102, 224, 255, 0.2);
  border-radius: 8px;
  background: rgba(6, 10, 14, 0.68);
  color: rgba(200, 236, 255, 0.8);
  font-size: 11.5px;
  line-height: 1.5;
  pointer-events: none;
}

.gp-td-hint[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .gm-hero-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .gm-hero-art {
    display: none;
  }

  .gm-games {
    grid-template-columns: 1fr;
  }

  .gm-more {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 700px) {
  .gp-bar {
    gap: 8px;
    padding: 7px 10px;
  }

  .gp-title {
    font-size: 13px;
  }

  .gp-stats {
    gap: 10px;
    font-size: 11px;
    order: 4;
    width: 100%;
  }

  .gp-actions {
    gap: 5px;
  }

  .gp-btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  .gp-towers {
    order: 5;
    width: 100%;
  }

  .gp-keys {
    grid-template-columns: 1fr;
  }

  .gp-card {
    padding: 22px 20px 20px;
  }

  .gp-tip {
    display: none;
  }

  .gp-beach-tools {
    left: 10px;
    bottom: 10px;
  }

  .gm-preview {
    height: 174px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gm-sweep,
  .gm-blip circle,
  .gm-game,
  .gm-preview svg {
    animation: none !important;
    transition: none !important;
  }
}
