.game-main {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem 1.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.hud-item span {
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 700;
}

.stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  display: flex;
  justify-content: center;
}

.board {
  position: relative;
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--panel);
  padding: 0.9rem 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.progress-line {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem 0.6rem;
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
}

.progress-line .p-me {
  color: #6fb5ff;
}
.progress-line .p-ai1 {
  color: #ff8080;
}
.progress-line .p-ai2 {
  color: #ffd166;
}

/* --- Track: Slay the Spire-style branching node map --- */
.lane-legend {
  margin: 0;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}

.track-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 820 / 260;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}

.track-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-path-a,
.map-path-b {
  fill: none;
  stroke-width: 3;
}
.map-path-a {
  stroke: rgba(239, 71, 111, 0.45);
}
.map-path-b {
  stroke: rgba(79, 209, 217, 0.4);
}

.track-nodes {
  position: absolute;
  inset: 0;
}

.map-node,
.token {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.token {
  transition: left 0.35s ease, top 0.35s ease;
}

.map-node {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.7rem;
}

.map-node.start {
  background: rgba(160, 140, 255, 0.28);
}
.map-node.gold {
  background: rgba(255, 214, 10, 0.2);
}
.map-node.boost {
  background: rgba(79, 209, 217, 0.2);
}
.map-node.event {
  background: rgba(160, 140, 255, 0.24);
}
.map-node.eliteEvent {
  width: 25px;
  height: 25px;
  font-size: 0.85rem;
  background: rgba(239, 71, 111, 0.3);
  border-color: rgba(239, 71, 111, 0.65);
}
.map-node.junction {
  width: 18px;
  height: 18px;
  font-size: 0.58rem;
  background: rgba(255, 255, 255, 0.16);
}
.map-node.finish {
  width: 27px;
  height: 27px;
  font-size: 0.85rem;
  background: rgba(255, 183, 3, 0.32);
  border-color: rgba(255, 183, 3, 0.6);
}

.map-node.tick {
  width: 9px;
  height: 9px;
  background: rgba(255, 255, 255, 0.2);
  border-color: transparent;
}

.map-node.occupied {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.55);
}

.map-node.start.occupied,
.map-node.tick.occupied {
  background: rgba(255, 255, 255, 0.35);
}

.token {
  font-size: 1.05rem;
  z-index: 2;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

/* --- Market --- */
.market-section-title {
  margin: 0.6rem 0 0.35rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}

.market-section:first-child .market-section-title {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.market-section-sub {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.7rem;
}

.buys-left {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  min-height: 1em;
}

.market {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.35rem;
}

.market-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.35rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.market-card.tier-start {
  border-color: rgba(154, 160, 166, 0.4);
}
.market-card.tier-basic {
  border-color: rgba(79, 209, 217, 0.4);
}
.market-card.tier-kingdom {
  border-color: rgba(160, 140, 255, 0.4);
}

.market-card-title {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.2;
}

.market-card-cost {
  color: #ffd166;
  font-size: 0.64rem;
  white-space: nowrap;
}

.market-card-desc {
  color: var(--muted);
  font-size: 0.56rem;
  line-height: 1.3;
  flex: 1;
}

.market-card-foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
}

.market-card-supply {
  color: var(--muted);
  font-size: 0.56rem;
}

.market-card button {
  background: var(--accent);
  color: #1a1200;
  border: none;
  padding: 0.22rem 0.4rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  cursor: pointer;
}

.market-card button:disabled {
  background: rgba(255, 255, 255, 0.12);
  color: var(--muted);
  cursor: not-allowed;
}

/* --- Hand / played zones --- */
.zone-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  color: var(--text);
  font-weight: 700;
  margin-top: 0.2rem;
}

.zone-sub {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.72rem;
}

.hand-row,
.played-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0.4rem;
  min-height: 5.2rem;
  padding-bottom: 0.3rem;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.played-row {
  min-height: 4.2rem;
  opacity: 0.85;
}

.pcard {
  width: 5.6rem;
  flex: 0 0 5.6rem;
  scroll-snap-align: start;
  border-radius: 8px;
  padding: 0.35rem 0.4rem;
  background: linear-gradient(160deg, #35364a, #26273a);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 3px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  cursor: pointer;
  transition: transform 0.12s ease;
  user-select: none;
}

.pcard.tier-start {
  background: linear-gradient(160deg, #3c3f47, #2a2c32);
  border-top-color: #9aa0a6;
}
.pcard.tier-basic {
  background: linear-gradient(160deg, #1f3f45, #172c31);
  border-top-color: var(--accent-2);
}
.pcard.tier-kingdom {
  background: linear-gradient(160deg, #392f52, #282140);
  border-top-color: var(--accent);
}

.pcard:hover {
  transform: translateY(-3px);
}

.pcard.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.pcard-icon {
  font-size: 1.1rem;
  text-align: center;
}

.pcard-name {
  font-size: 0.62rem;
  text-align: center;
  color: var(--text);
  font-weight: 700;
  line-height: 1.15;
}

.pcard-desc {
  font-size: 0.52rem;
  line-height: 1.25;
  text-align: center;
  color: var(--muted);
}

.played-row .pcard {
  width: 4.4rem;
  flex: 0 0 4.4rem;
  cursor: default;
}

.played-row .pcard-desc {
  font-size: 0.48rem;
}

.played-row .pcard:hover {
  transform: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 24, 0.94);
  backdrop-filter: blur(2px);
  border-radius: 14px;
  z-index: 5;
}

.overlay.hidden {
  display: none;
}

.overlay-panel {
  text-align: center;
  padding: 1.25rem;
  max-width: 340px;
}

.overlay-panel h2 {
  margin: 0 0 0.75rem;
}

.overlay-panel p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 1.25rem;
  font-size: 0.82rem;
}

.overlay-panel button {
  background: var(--accent);
  color: #1a1200;
  border: none;
  padding: 0.7rem 1.75rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.overlay-panel button:active {
  transform: scale(0.97);
}

/* --- Choice modal (junction / event) --- */
#choice-overlay {
  z-index: 6;
}

.choice-panel {
  max-width: 380px;
}

.choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.choice-buttons button {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.choice-buttons button .choice-sub {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.74rem;
}

.choice-buttons button:not(:disabled):hover {
  border-color: var(--accent);
}

.choice-buttons button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hand-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.hand-actions button {
  flex: 1;
  background: var(--panel);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 0.55rem 0.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.hand-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hand-actions button:active {
  transform: scale(0.96);
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0.75rem 0 0;
  text-align: center;
}

.how-to-play {
  max-width: 560px;
  width: 100%;
  margin-top: 1rem;
}

.how-to-play h2 {
  font-size: 1.1rem;
}

.how-to-play ul {
  color: var(--muted);
  line-height: 1.7;
  padding-left: 1.25rem;
  font-size: 0.9rem;
}
