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

body {
  background: #101014;
  color: #f2ead8;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.5;
}

.hidden { display: none !important; }

.page { max-width: 1080px; margin: 0 auto; padding: 20px 16px 40px; }

.hero { text-align: center; margin-bottom: 24px; }

.hero-badge {
  display: inline-block;
  border: 1px solid #c9a227;
  color: #c9a227;
  padding: 2px 12px;
  border-radius: 20px;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hero h1 { font-size: 64px; letter-spacing: 4px; color: #f2ead8; }

.hero h1 a { color: inherit; text-decoration: none; }
.hero h1 a:hover { color: inherit; }

.hero h1 .gold { color: #c9a227; }

.tagline { font-size: 18px; margin-top: 6px; }

.disclaimer { font-size: 13px; color: #9a917c; margin-top: 6px; font-style: italic; }

.card {
  background: #1a1a21;
  border: 1px solid #3a3a45;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}

.card h2, .card h3 { margin-bottom: 10px; color: #e8d9a8; }

.rules { margin-left: 22px; margin-bottom: 14px; }

.rules li { margin-bottom: 6px; }

.menu-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

.join-row { display: flex; gap: 10px; margin-bottom: 12px; }

.join-row input {
  width: 140px;
  padding: 10px;
  font-size: 18px;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  background: #101014;
  border: 1px solid #3a3a45;
  border-radius: 8px;
  color: #f2ead8;
}

.btn {
  background: #26262e;
  color: #f2ead8;
  border: 1px solid #c9a227;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
}

.btn:hover:not(:disabled) { background: #33333d; }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.primary { background: #c9a227; color: #101014; font-weight: bold; }

.btn.primary:hover:not(:disabled) { background: #dcb93e; }

.btn.small { padding: 6px 10px; font-size: 13px; }

.btn.danger { border-color: #a33; color: #f0a0a0; }

.status { min-height: 24px; color: #e8d9a8; margin: 6px 0; }

.price { color: #c9a227; font-weight: bold; }

.muted { color: #9a917c; font-size: 13px; font-weight: normal; }

.shop-rules { margin-top: 10px; }

.shop-rules summary { cursor: pointer; color: #c9a227; }

.shop-rules ul { margin: 10px 0 10px 22px; }

.shop-rules li { margin-bottom: 6px; }

.game-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.room-line { font-size: 17px; }

.game-grid { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }

.board-wrap { flex: 1 1 420px; min-width: 300px; }

.board {
  display: grid;
  position: relative;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  max-width: 560px;
  aspect-ratio: 1;
  border: 3px solid #c9a227;
  border-radius: 6px;
  overflow: hidden;
  user-select: none;
}

.sq {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(24px, 5vw, 44px);
  cursor: default;
  position: relative;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  overflow: hidden;
}

.sq span { line-height: 1; display: block; }

.sq.light { background: #e8d0a9; }
.sq.dark { background: #9c6b4f; }

.sq.own { cursor: pointer; }

.sq.selected { outline: 3px solid #c9a227; outline-offset: -3px; }

.sq.target { cursor: pointer; }
.sq.target::after {
  content: "";
  position: absolute;
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: rgba(20, 120, 40, 0.65);
}

.sq.target.capture::after {
  width: 88%;
  height: 88%;
  background: transparent;
  border: 4px solid rgba(180, 30, 30, 0.75);
}

.sq.last { outline: 3px solid #4d7dd1; outline-offset: -3px; }

.sq .w { color: #faf6ea; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.sq .b { color: #161616; text-shadow: 0 0 3px #e8d0a9; }

.sq.hide-piece span { visibility: hidden; }

.fly {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: transform 0.28s ease-in-out;
}

.fly span { line-height: 1; display: block; }
.fly .w { color: #faf6ea; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.fly .b { color: #161616; text-shadow: 0 0 3px #e8d0a9; }
.fly.fade { transition: opacity 0.22s ease; }

.hint { margin-top: 8px; color: #e8d9a8; font-size: 14px; }

.side { flex: 1 1 300px; min-width: 280px; }

.wallets { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 15px; }

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

.topups .btn { text-align: left; }

.shop-btn { display: block; width: 100%; margin-bottom: 8px; text-align: left; }

.log { max-height: 220px; overflow-y: auto; margin-left: 22px; font-size: 14px; }

.log li { margin-bottom: 4px; }

.game-actions { display: flex; gap: 10px; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.overlay-card {
  background: #1a1a21;
  border: 2px solid #c9a227;
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  max-width: 420px;
}

.overlay-card h2 { color: #c9a227; margin-bottom: 10px; }
.overlay-card p { margin-bottom: 16px; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #a33;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  z-index: 60;
  max-width: 90vw;
}

.foot { text-align: center; color: #9a917c; font-size: 13px; margin-top: 24px; }

@media (max-width: 760px) {
  .hero h1 { font-size: 44px; }
  .game-grid { flex-direction: column; }
}