:root {
  --bg1: #fff1f6;
  --bg2: #ffe7d1;
  --accent: #ff5c8a;
  --text: #332531;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Comfortaa", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% 10%, #ffe4ef, transparent 55%),
              radial-gradient(800px 600px at 90% 20%, #fff0dc, transparent 60%),
              linear-gradient(135deg, var(--bg1), var(--bg2));
  overflow-x: hidden;
}

.games-page {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 18px;
  padding: 18px;
  min-height: 100vh;
  overflow-x: hidden;
}

.games-sidebar {
  background: #fff;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 20px 40px rgba(255, 92, 138, 0.18);
  position: sticky;
  top: 18px;
  height: fit-content;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
}

.sidebar-header {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  align-items: center;
}

.sidebar-emoji {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #ffe7f0;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}

.sidebar-header h1 {
  font-family: "Pacifico", cursive;
  margin: 0;
  color: #ff5c8a;
}

.sidebar-header p {
  margin: 2px 0 0;
  color: #6c5064;
  font-size: 0.9rem;
}

.sidebar-home {
  margin-top: 12px;
  width: 100%;
  display: block;
  text-align: center;
}

.rules {
  margin-top: 12px;
  background: #fff7fb;
  border: 1px solid rgba(255, 92, 138, 0.15);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.coin-balance {
  margin-top: 10px;
  background: #fff7fb;
  border: 1px solid rgba(255, 92, 138, 0.2);
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 600;
  color: #ff5c8a;
  text-align: center;
}

.lives-balance {
  margin-top: 8px;
  background: #fff;
  border: 1px dashed rgba(255, 92, 138, 0.25);
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 600;
  color: #6c5064;
  text-align: center;
  display: grid;
  gap: 4px;
}

.lives-emoji {
  font-size: 1.05rem;
  letter-spacing: 1px;
}

.lives-note {
  font-size: 0.78rem;
  color: #9b8795;
}

.lives-progress-wrap {
  margin-top: 2px;
  display: grid;
  gap: 5px;
}

.lives-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.76rem;
  color: #7f6a79;
}

.lives-progress-head strong {
  color: #ff5c8a;
}

.lives-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #f6e7ef;
  border: 1px solid rgba(255, 92, 138, 0.18);
  overflow: hidden;
}

.lives-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ff8aac, #ff5c8a);
  transition: width 0.25s ease;
}

.pet-bonus {
  margin-top: 8px;
  background: #fff;
  border: 1px dashed rgba(255, 92, 138, 0.28);
  border-radius: 12px;
  padding: 6px 8px;
  display: grid;
  gap: 6px;
  text-align: left;
}

.pet-bonus-toggle {
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  color: #8f7286;
  font-size: 0.86rem;
  font-weight: 700;
  text-align: left;
}

.pet-bonus-toggle:hover {
  background: #fff7fb;
}

.pet-bonus-arrow {
  color: #ff5c8a;
  font-size: 0.82rem;
  transition: transform 0.2s ease;
}

.pet-bonus.is-open .pet-bonus-arrow {
  transform: rotate(180deg);
}

.pet-bonus-content {
  display: grid;
  gap: 4px;
  padding: 0 8px 4px;
}

.pet-bonus-content[hidden] {
  display: none !important;
}

.pet-bonus-value {
  font-size: 1rem;
  font-weight: 700;
  color: #ff5c8a;
}

.pet-bonus-note {
  font-size: 0.76rem;
  color: #7f6a79;
}

.rules h2 {
  margin: 0 0 6px;
  color: #ff5c8a;
  font-size: 1rem;
}

.rules ul {
  margin: 0;
  padding-left: 18px;
  color: #6c5064;
}

.games-main {
  background: #fff;
  border-radius: 24px;
  padding: 16px;
  box-shadow: 0 20px 40px rgba(255, 92, 138, 0.18);
  min-height: calc(100vh - 36px);
  overflow-x: hidden;
}

.games-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.games-section-title {
  margin: 18px 0 10px;
  font-weight: 700;
  color: #ff5c8a;
  font-size: 1.05rem;
}

.game-card {
  border: 1px solid rgba(255, 92, 138, 0.2);
  background: #fff;
  border-radius: 18px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: grid;
  gap: 6px;
}

.game-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(255, 92, 138, 0.18);
}

.game-card-emoji {
  width: 100%;
  height: 90px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  background: linear-gradient(135deg, #ffe7f0, #fff1f8);
}

.game-card-title {
  margin-top: 2px;
  font-weight: 600;
  color: #ff5c8a;
}

.game-card-sub {
  font-size: 0.85rem;
  color: #7a5d70;
}

.game-panel {
  display: none;
  background: #fff7fb;
  border: 1px solid rgba(255, 92, 138, 0.2);
  border-radius: 18px;
  padding: 16px 18px;
  min-height: 72vh;
}

.game-panel.active {
  display: block;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.game-desc {
  margin: 6px 0 10px;
  color: #6c5064;
}

.game-tip {
  margin: -2px 0 10px;
  color: #7a5d70;
  font-size: 0.88rem;
  background: #fff;
  border: 1px dashed rgba(255, 92, 138, 0.22);
  border-radius: 10px;
  padding: 8px 10px;
}

.game-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.95rem;
  color: #5c3c50;
  margin-bottom: 12px;
}

.game-stats span {
  background: #fff;
  border: 1px solid rgba(255, 92, 138, 0.15);
  border-radius: 999px;
  padding: 6px 12px;
}


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

.game-top-actions {
  display: flex;
  justify-content: flex-start;
  margin: 6px 0 12px;
}

.game-start {
  min-width: 160px;
}

.btn.is-running {
  background: #ffd166;
  color: #7a4d00;
  box-shadow: 0 0 14px rgba(255, 187, 0, 0.55);
}

.btn.is-running[disabled] {
  opacity: 1;
  cursor: not-allowed;
}

.btn.no-lives {
  background: #f1e7ee;
  color: #9b8795;
  border: 1px solid rgba(155, 135, 149, 0.4);
  cursor: not-allowed;
}

.pet-button {
  position: fixed;
  left: 20px;
  bottom: 20px;
  padding: 16px 26px;
  border-radius: 999px;
  background: #ff5c8a;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 14px 28px rgba(255, 92, 138, 0.35);
  z-index: 999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pet-button:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 18px 32px rgba(255, 92, 138, 0.4);
}

@media (max-width: 680px) {
  .pet-button {
    left: 12px;
    bottom: 12px;
    padding: 14px 20px;
  }
}

.tap-actions {
  justify-content: center;
}

.tap-center {
  margin-top: 10px;
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
}

.shop-balance,
.roulette-balance {
  background: #fff;
  border: 1px dashed rgba(255, 92, 138, 0.3);
  border-radius: 12px;
  padding: 8px 12px;
  text-align: center;
  margin-bottom: 12px;
  font-weight: 600;
  color: #ff5c8a;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.rarity-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.rarity-filter {
  padding: 8px 14px;
  font-size: 0.9rem;
  border-radius: 999px;
}

.rarity-filter.active {
  border-color: rgba(255, 92, 138, 0.6);
  box-shadow: 0 8px 16px rgba(255, 92, 138, 0.2);
  color: #ff5c8a;
}

.rarity-filter.common { border-color: rgba(45, 95, 158, 0.35); color: #2d5f9e; }
.rarity-filter.rare { border-color: rgba(179, 106, 0, 0.35); color: #b36a00; }
.rarity-filter.legendary { border-color: rgba(192, 53, 100, 0.35); color: #c03564; }
.rarity-filter.adult { border-color: rgba(178, 35, 102, 0.45); color: #b22366; }

.shop-item {
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(255, 92, 138, 0.2);
  padding: 12px;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.shop-item h4 {
  margin: 0;
  color: #ff5c8a;
  min-width: 0;
  overflow-wrap: anywhere;
}

.item-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rarity-badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.rarity-badge.common {
  background: #eef6ff;
  color: #2d5f9e;
}

.rarity-badge.rare {
  background: #fff3e2;
  color: #b36a00;
}

.rarity-badge.legendary {
  background: #ffe6ee;
  color: #c03564;
}

.rarity-badge.adult {
  background: #ffe6f2;
  color: #b22366;
}

.shop-item p {
  margin: 0;
  color: #6c5064;
  font-size: 0.9rem;
}

.shop-price {
  font-weight: 700;
  color: #5c3c50;
}

.shop-item button {
  justify-self: start;
}

.roulette-box {
  background: #fff;
  border: 1px solid rgba(255, 92, 138, 0.2);
  border-radius: 18px;
  padding: 16px;
  margin: 10px 0 8px;
  max-width: 100%;
}

.roulette-window {
  --roulette-item-h: 56px;
  height: calc(var(--roulette-item-h) + 16px);
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: #fff7fb;
  border: 1px dashed rgba(255, 92, 138, 0.35);
  display: flex;
  align-items: center;
  padding: 8px 10px;
  position: relative;
}

.roulette-pointer {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(255, 92, 138, 0.55);
  z-index: 3;
  pointer-events: none;
}

/* .roulette-pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 2px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 12px solid #ff5c8a;
  filter: drop-shadow(0 2px 2px rgba(255, 92, 138, 0.35));
} */

.roulette-track {
  display: flex;
  gap: 8px;
  transform: translateX(0);
  will-change: transform;
  z-index: 1;
}

.roulette-item {
  height: var(--roulette-item-h);
  min-width: 220px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(255, 92, 138, 0.2);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #ff5c8a;
  text-align: center;
  padding: 0 8px;
}

.roulette-item.common {
  color: #2d5f9e;
  border-color: rgba(45, 95, 158, 0.28);
  background: linear-gradient(180deg, #ffffff 0%, #f1f7ff 100%);
}

.roulette-item.rare {
  color: #b36a00;
  border-color: rgba(179, 106, 0, 0.3);
  background: linear-gradient(180deg, #fff8ef 0%, #fff2dd 100%);
}

.roulette-item.legendary {
  color: #c03564;
  border-color: rgba(192, 53, 100, 0.36);
  background: linear-gradient(180deg, #fff2f8 0%, #ffe3f0 100%);
}

.roulette-item.adult {
  color: #b22366;
  border-color: rgba(178, 35, 102, 0.4);
  background: linear-gradient(180deg, #fff0f7 0%, #ffd9eb 100%);
}

.coinflip-box {
  display: grid;
  place-items: center;
  margin: 10px 0 12px;
}

.bet-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: #fff7fb;
  border: 1px dashed rgba(255, 92, 138, 0.25);
  border-radius: 12px;
  padding: 8px 10px;
  margin: 8px 0 12px;
  font-size: 0.9rem;
  color: #6c5064;
}

.bet-row input {
  width: 90px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 92, 138, 0.3);
  font-weight: 600;
  color: #ff5c8a;
}

.bet-max {
  margin-left: auto;
  font-weight: 600;
  color: #ff5c8a;
}

.coinflip-coin {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 3px solid #ff5c8a;
  background: radial-gradient(circle at 30% 30%, #fff, #ffe3ef 60%, #ffc3d6);
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #ff5c8a;
  text-transform: uppercase;
}

.coinflip-coin.flip {
  animation: coinflip 1.2s ease-in-out;
}

@keyframes coinflip {
  0% { transform: rotateY(0deg); }
  50% { transform: rotateY(720deg); }
  100% { transform: rotateY(1080deg); }
}

.dice-box {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 10px 0 12px;
}

.dice {
  width: 70px;
  height: 70px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid rgba(255, 92, 138, 0.3);
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #ff5c8a;
}

.dice.roll {
  animation: diceRoll 0.9s ease-in-out;
}

@keyframes diceRoll {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(160deg) scale(0.9); }
  100% { transform: rotate(320deg) scale(1); }
}

.crash-box {
  background: #fff;
  border: 1px solid rgba(255, 92, 138, 0.2);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
}

.crash-multiplier {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  color: #ff5c8a;
}

.crash-track {
  height: 14px;
  border-radius: 999px;
  background: #ffe7f0;
  overflow: hidden;
  border: 1px solid rgba(255, 92, 138, 0.2);
}

.crash-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #ff8bb0, #ff5c8a);
  transition: width 0.08s linear;
}

.mines-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(48px, 1fr));
  gap: 8px;
  max-width: 360px;
  margin: 10px 0 12px;
}

.mines-cell {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 1px solid rgba(255, 92, 138, 0.24);
  background: #fff;
  color: #6c5064;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.mines-cell:not(:disabled):hover {
  transform: translateY(-1px);
  background: #fff7fb;
}

.mines-cell.opened {
  cursor: default;
}

.mines-cell.safe {
  background: #e8f7ef;
  border-color: rgba(47, 138, 78, 0.35);
}

.mines-cell.bomb {
  background: #ffe6ee;
  border-color: rgba(192, 53, 100, 0.45);
}

.roulette-plus-visual {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 10px;
}

.roulette-plus-wheel-wrap {
  display: grid;
  place-items: center;
}

.roulette-plus-wheel {
  position: relative;
  width: min(340px, 82vw);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #fff 0%, #ffe7f0 62%, #f7d4e3 100%);
  border: 8px solid #f7bfd6;
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.72), 0 14px 26px rgba(255, 92, 138, 0.2);
  overflow: hidden;
}

.roulette-plus-wheel-pointer {
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 22px solid #ff5c8a;
  filter: drop-shadow(0 3px 3px rgba(255, 92, 138, 0.35));
  margin-bottom: -8px;
  z-index: 2;
}

.roulette-plus-wheel-track {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  transition: transform 4.2s cubic-bezier(0.08, 0.8, 0.2, 1);
}

.roulette-wheel-pocket {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.5rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.roulette-wheel-pocket.red {
  background: #c03564;
}

.roulette-wheel-pocket.black {
  background: #3f3542;
}

.roulette-wheel-pocket.green {
  background: #2f8a4e;
}

.roulette-wheel-pocket.win {
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.85), 0 0 16px rgba(255, 209, 102, 0.75);
}

.roulette-plus-wheel-center {
  position: absolute;
  width: 64px;
  height: 64px;
  left: 50%;
  top: 50%;
  margin-left: -32px;
  margin-top: -32px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(255, 92, 138, 0.35);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  color: #ff5c8a;
  z-index: 1;
}

.roulette-plus-table-wrap {
  display: grid;
  gap: 8px;
}

.roulette-plus-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #6c5064;
}

.roulette-plus-chip-row input {
  width: 90px;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 92, 138, 0.3);
  font: inherit;
  color: #ff5c8a;
  font-weight: 700;
}

.roulette-plus-table {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 6px;
}

.roulette-zero-cell {
  border: 1px solid rgba(47, 138, 78, 0.5);
  background: #e8f7ef;
  color: #2f8a4e;
  border-radius: 10px;
  font-weight: 700;
  position: relative;
  min-height: 454px;
}

.roulette-zero-cell.win {
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.86);
}

.roulette-number-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(42px, 1fr));
  gap: 4px;
}

.roulette-number-cell {
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  min-height: 34px;
  position: relative;
}

.roulette-number-cell.red {
  background: #c03564;
}

.roulette-number-cell.black {
  background: #3f3542;
}

.roulette-number-cell.win {
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.85), inset 0 0 0 2px rgba(255, 230, 160, 0.6);
}

.roulette-plus-dozens,
.roulette-plus-outside {
  display: grid;
  gap: 6px;
}

.roulette-plus-dozens {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.roulette-plus-outside {
  grid-template-columns: repeat(6, minmax(88px, 1fr));
}

.roulette-outside-bet {
  border: 1px solid rgba(255, 92, 138, 0.28);
  background: #fff;
  color: #6c5064;
  border-radius: 10px;
  min-height: 40px;
  font-size: 0.82rem;
  font-weight: 700;
  position: relative;
}

.roulette-outside-bet.red {
  color: #c03564;
  background: #ffe6ee;
}

.roulette-outside-bet.black {
  color: #3f3542;
  background: #f4edf2;
}

.roulette-outside-bet.win {
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.86);
}

.roulette-bet-chip {
  position: absolute;
  right: 4px;
  top: 4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ffd166;
  color: #7a4d00;
  font-size: 0.68rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.roulette-plus-advanced {
  margin: 8px 0 4px;
}

.roulette-plus-advanced summary {
  cursor: pointer;
  color: #8e6b82;
  font-size: 0.86rem;
}

.roulette-plus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}

.roulette-plus-bet {
  background: #fff;
  border: 1px solid rgba(255, 92, 138, 0.2);
  border-radius: 12px;
  padding: 8px 10px;
  display: grid;
  gap: 6px;
}

.roulette-plus-bet label {
  font-size: 0.84rem;
  color: #6c5064;
}

.roulette-plus-bet input {
  width: 100%;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 92, 138, 0.3);
  color: #ff5c8a;
  font-weight: 700;
  font: inherit;
}

.roulette-plus-meta {
  margin: 4px 0 10px;
  color: #6c5064;
  font-weight: 600;
}

.roulette-plus-display {
  width: min(320px, 100%);
  height: 86px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 92, 138, 0.32);
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 2.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.roulette-plus-display.red {
  color: #c03564;
}

.roulette-plus-display.black {
  color: #3f3542;
}

.roulette-plus-display.green {
  color: #2f8a4e;
}

.roulette-plus-history {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.roulette-plus-item {
  min-width: 34px;
  height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 92, 138, 0.22);
  background: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.86rem;
}

.roulette-plus-item.red {
  color: #c03564;
  background: #ffe6ee;
}

.roulette-plus-item.black {
  color: #3f3542;
  background: #f4edf2;
}

.roulette-plus-item.green {
  color: #2f8a4e;
  background: #e8f7ef;
}

@media (max-width: 920px) {
  .roulette-plus-visual {
    grid-template-columns: 1fr;
  }

  .roulette-plus-dozens {
    grid-template-columns: 1fr;
  }

  .roulette-plus-outside {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .roulette-zero-cell {
    min-height: 360px;
  }
}

.stopline-window {
  --stopline-item-h: 52px;
  height: calc(var(--stopline-item-h) + 16px);
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: #fff7fb;
  border: 1px dashed rgba(255, 92, 138, 0.35);
  display: flex;
  align-items: center;
  padding: 8px 10px;
  position: relative;
}

.stopline-pointer {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(255, 92, 138, 0.55);
  z-index: 3;
  pointer-events: none;
}

.stopline-pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 2px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 12px solid #ff5c8a;
  filter: drop-shadow(0 2px 2px rgba(255, 92, 138, 0.35));
}

.stopline-track {
  display: flex;
  gap: 8px;
  transform: translateX(0);
  will-change: transform;
  z-index: 1;
}

.stopline-item {
  height: var(--stopline-item-h);
  min-width: 210px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(255, 92, 138, 0.2);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #ff5c8a;
  text-align: center;
  padding: 0 8px;
}

.stopline-item.common { color: #2d5f9e; }
.stopline-item.rare { color: #b36a00; }
.stopline-item.legendary { color: #c03564; }
.stopline-item.adult { color: #b22366; }

.prizes-list {
  display: grid;
  gap: 10px;
}

.tasks-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.prize-item {
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(255, 92, 138, 0.2);
  padding: 12px;
  display: grid;
  gap: 6px;
}

.task-item {
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(255, 92, 138, 0.2);
  padding: 12px;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.prize-item h4 {
  margin: 0;
  color: #ff5c8a;
}

.task-item h4 {
  margin: 0;
  color: #ff5c8a;
  min-width: 0;
  overflow-wrap: anywhere;
}

.prize-item p {
  margin: 0;
  color: #6c5064;
  font-size: 0.9rem;
}

.task-item p {
  margin: 0;
  color: #6c5064;
  font-size: 0.9rem;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.task-reward {
  font-weight: 700;
  color: #ff5c8a;
}

.prize-item.done {
  opacity: 0.6;
  filter: grayscale(0.2);
}

.task-item.done {
  opacity: 0.6;
  filter: grayscale(0.2);
}

.prize-item .btn {
  justify-self: start;
}

.task-item .btn {
  justify-self: start;
}

.custom-tools {
  background: #fff7fb;
  border-radius: 16px;
  border: 1px dashed rgba(255, 92, 138, 0.28);
  padding: 12px;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.sidebar-custom-tools {
  margin-top: 12px;
}

.sidebar-custom-tools.is-hidden {
  display: none !important;
}

.sidebar-custom-tools h2 {
  margin: 0 0 4px;
  color: #ff5c8a;
  font-size: 1rem;
}

.sidebar-custom-tools .custom-list {
  max-height: 150px;
}

.custom-tools .btn {
  justify-self: start;
  width: auto;
  padding: 10px 18px;
}

.game-desc.compact {
  margin: 0;
  font-size: 0.86rem;
}

.custom-form {
  display: grid;
  gap: 8px;
}

.custom-form .btn {
  justify-self: start;
  width: auto;
  padding: 10px 18px;
}

.custom-form input,
.custom-form select,
.custom-form textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 92, 138, 0.28);
  padding: 8px 10px;
  font: inherit;
  color: #6c5064;
  background: #fff;
}

.custom-form textarea {
  resize: vertical;
  min-height: 60px;
}

.custom-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 280px));
  justify-content: start;
  gap: 10px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.custom-item {
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(255, 92, 138, 0.2);
  padding: 10px;
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 132px;
}

.custom-item.active {
  border-color: rgba(47, 138, 78, 0.32);
}

.custom-item h4 {
  margin: 0;
  color: #ff5c8a;
  font-size: 0.95rem;
}

.custom-item p {
  margin: 0;
  color: #6c5064;
  font-size: 0.86rem;
}

.custom-meta {
  color: #8e6b82;
  font-size: 0.8rem;
}

.custom-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.custom-actions .btn {
  padding: 8px 14px;
}

.custom-reject-btn {
  border-color: rgba(192, 53, 100, 0.35);
  color: #c03564;
}

.custom-modal[hidden] {
  display: none;
}

.custom-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
}

.custom-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 17, 28, 0.45);
  backdrop-filter: blur(3px);
}

.custom-modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 92vw);
  max-height: min(86vh, 760px);
  overflow: auto;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(255, 92, 138, 0.24);
  box-shadow: 0 20px 50px rgba(255, 92, 138, 0.28);
  padding: 16px;
  display: grid;
  gap: 10px;
}

.custom-modal-card h3 {
  margin: 0;
  color: #ff5c8a;
}

.custom-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid rgba(255, 92, 138, 0.28);
  background: #fff7fb;
  color: #ff5c8a;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
}

.custom-modal-panel {
  display: none;
  gap: 8px;
}

.custom-modal-panel.active {
  display: grid;
}

.custom-modal-open {
  overflow: hidden;
}

.tap-big-score {
  font-size: 1.6rem;
  font-weight: 700;
  color: #ff5c8a;
}

.game-tap.game-tap-big {
  padding: 22px 60px;
  font-size: 1.3rem;
  border-width: 3px;
  min-width: 240px;
}

.game-prize {
  margin: 10px 0 6px;
  color: #8e6b82;
  font-size: 0.9rem;
}

.game-result {
  margin: 0;
  font-weight: 600;
  color: #ff5c8a;
  min-height: 1.2em;
}

.game-canvas {
  width: 100%;
  max-width: 1080px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(255, 92, 138, 0.2);
  margin: 10px 0 12px;
}

.flappy-canvas {
  max-width: 680px;
  background: linear-gradient(180deg, #ffe6f0 0%, #fff4cf 78%, #ffd9b8 78%, #ffd9b8 100%);
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin: 10px 0 12px;
}

.memory-card {
  position: relative;
  width: 100%;
  padding-top: 100%;
  border-radius: 12px;
  perspective: 800px;
  cursor: pointer;
}

.memory-inner {
  position: absolute;
  inset: 0;
  transition: transform 0.5s ease;
  transform-style: preserve-3d;
}

.memory-card.flipped .memory-inner {
  transform: rotateY(180deg);
}

.memory-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #ff5c8a;
}

.memory-front {
  background: #ffe7f0;
}

.memory-back {
  transform: rotateY(180deg);
  background-size: cover;
  background-position: center;
  border: 2px solid rgba(255, 92, 138, 0.25);
}

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-width: 420px;
  margin: 10px 0 12px;
}

.puzzle-tile {
  position: relative;
  width: 100%;
  padding-top: 100%;
  border-radius: 10px;
  background-size: 400% 400%;
  background-position: 0 0;
  border: 2px solid rgba(255, 92, 138, 0.2);
  cursor: pointer;
}

.puzzle-tile.selected {
  outline: 3px solid rgba(255, 92, 138, 0.5);
}

.catch-area {
  position: relative;
  height: 320px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(255, 92, 138, 0.2);
  overflow: hidden;
  margin: 10px 0 12px;
  touch-action: manipulation;
}

.catch-heart {
  position: absolute;
  width: 28px;
  height: 28px;
  background: #ff7aa2;
  transform: rotate(-45deg);
  cursor: pointer;
  touch-action: manipulation;
}

.catch-heart::before,
.catch-heart::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: inherit;
}

.catch-heart::before { top: -14px; left: 0; }
.catch-heart::after { top: 0; left: 14px; }

.match-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  max-width: 420px;
  margin: 10px 0 12px;
}

.match-cell {
  position: relative;
  width: 100%;
  padding-top: 100%;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid rgba(255, 92, 138, 0.2);
  transition: transform 0.18s ease, opacity 0.22s ease;
  background-size: cover;
  background-position: center;
}

.match-cell.selected {
  transform: scale(0.92);
  outline: 3px solid rgba(255, 92, 138, 0.5);
}

.match-0 { background-image: url("img/3inrow/1.png"); }
.match-1 { background-image: url("img/3inrow/2.png"); }
.match-2 { background-image: url("img/3inrow/3.png"); }
.match-3 { background-image: url("img/3inrow/4.png"); }
.match-4 { background-image: url("img/3inrow/5.png"); }
.match-5 { background-image: url("img/3inrow/6.png"); }

.match-cell.matched {
  animation: matchPop 0.34s ease forwards;
  opacity: 0;
  transform: scale(0.4);
}

.match-cell.drop {
  animation: matchDrop 0.26s ease;
}

.reaction-box {
  height: 220px;
  border-radius: 16px;
  border: 2px dashed rgba(255, 92, 138, 0.35);
  background: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #6c5064;
  text-align: center;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  margin: 10px 0 12px;
  user-select: none;
  touch-action: manipulation;
}

.reaction-box.is-ready {
  background: #fff7fb;
}

.reaction-box.is-wait {
  background: #fff3e2;
  border-color: rgba(255, 173, 77, 0.5);
  color: #b36a00;
}

.reaction-box.is-go {
  background: #e8f7ef;
  border-color: rgba(47, 138, 78, 0.6);
  color: #2f8a4e;
}

.reaction-box.is-fail {
  background: #ffe6ee;
  border-color: rgba(192, 53, 100, 0.6);
  color: #c03564;
}

.reaction-label {
  font-size: 1.3rem;
  padding: 0 10px;
}

.safe-box {
  background: #fff;
  border: 1px solid rgba(255, 92, 138, 0.2);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
}

.safe-prompt {
  font-weight: 700;
  color: #ff5c8a;
}

.safe-display {
  height: 54px;
  border-radius: 14px;
  background: #fff7fb;
  border: 1px dashed rgba(255, 92, 138, 0.35);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  letter-spacing: 2px;
  color: #6c5064;
}

.safe-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.safe-input-row input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 92, 138, 0.35);
  font-weight: 600;
  font-size: 1rem;
  color: #6c5064;
}

.safe-input-row input.is-error {
  animation: safeShake 0.35s ease;
  border-color: rgba(192, 53, 100, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 92, 138, 0.15);
}

.safe-hint {
  min-height: 1.1em;
  color: #8e6b82;
  font-size: 0.9rem;
}

@keyframes safeShake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

.merge-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 360px;
  margin: 10px 0 12px;
}

.merge-cell {
  width: 100%;
  padding-top: 100%;
  border-radius: 12px;
  position: relative;
  background: #fff;
  border: 2px solid rgba(255, 92, 138, 0.2);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #6c5064;
  font-size: 1.1rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.merge-cell span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.merge-cell.spawn {
  animation: mergeSpawn 0.24s ease-out;
}

.merge-cell.merge {
  animation: mergePulse 0.28s ease-out;
}

@keyframes mergeSpawn {
  0% { transform: scale(0.6); opacity: 0.3; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes mergePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); box-shadow: 0 12px 22px rgba(255, 92, 138, 0.2); }
  100% { transform: scale(1); }
}

.merge-0 { background: #fff; color: #c0a8b6; }
.merge-2 { background: #ffe7f0; color: #c03564; }
.merge-4 { background: #ffdfe8; color: #b0305d; }
.merge-8 { background: #ffe3b5; color: #9b5800; }
.merge-16 { background: #ffd29a; color: #8d4300; }
.merge-32 { background: #ffc3d6; color: #8f1f4c; }
.merge-64 { background: #ffb6c7; color: #7a1440; }
.merge-128 { background: #cfe8ff; color: #2d5f9e; }
.merge-256 { background: #b8dcff; color: #244f86; }
.merge-512 { background: #b8f0d5; color: #1f7d47; }
.merge-1024 { background: #a6e6c9; color: #186c3a; }
.merge-2048 { background: #f2e9ff; color: #6c3bb3; }
.merge-4096 { background: #ffe6ee; color: #c03564; }

.merge-controls {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin-bottom: 8px;
}

.merge-controls-row {
  display: flex;
  gap: 8px;
}

.merge-btn {
  min-width: 56px;
  padding: 10px 0;
}

.drop-canvas {
  max-width: 380px;
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(255, 92, 138, 0.2);
}

.drop-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(50px, 1fr));
  gap: 8px;
  max-width: 360px;
  margin-bottom: 8px;
}

.drop-btn {
  padding: 12px 0;
  font-size: 1.1rem;
}

.stack-area {
  position: relative;
  width: 100%;
  max-width: 680px;
  height: 430px;
  margin: 10px 0 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 92, 138, 0.24);
  overflow: hidden;
  touch-action: manipulation;
  background:
    linear-gradient(180deg, #ffe8f2 0%, #fff2d9 70%, #ffd4e4 70%, #ffd4e4 100%);
}

.stack-block {
  position: absolute;
  left: 0;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(255, 92, 138, 0.24);
  transition: left 0.04s linear, width 0.12s ease;
}

.stack-block.moving {
  box-shadow: 0 8px 22px rgba(255, 92, 138, 0.34);
}

@keyframes matchPop {
  0% { transform: scale(1); opacity: 1; }
  70% { transform: scale(0.5); opacity: 0.2; }
  100% { transform: scale(0.3); opacity: 0; }
}

@keyframes matchDrop {
  0% { transform: translateY(-14px); }
  100% { transform: translateY(0); }
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 26px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-ok {
  background: #ff5c8a;
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: #6c5064;
  border: 1px solid rgba(108, 80, 100, 0.3);
}

.game-tap {
  background: #fff;
  border: 2px dashed rgba(255, 92, 138, 0.4);
  color: #ff5c8a;
}

@keyframes catchFall {
  0% { transform: translateY(-30px) rotate(-45deg); opacity: 0; }
  10% { opacity: 0.9; }
  100% { transform: translateY(360px) rotate(-45deg); opacity: 0; }
}

@media (max-width: 980px) {
  .games-page {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  .games-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    height: auto;
  }

  .games-main {
    min-height: 0;
  }

  .memory-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 760px) {
  body {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .games-page {
    padding: 10px;
    gap: 10px;
  }

  .games-sidebar,
  .games-main {
    padding: 12px;
    border-radius: 16px;
  }

  .sidebar-header {
    grid-template-columns: 40px 1fr;
  }

  .sidebar-emoji {
    width: 40px;
    height: 40px;
  }

  .sidebar-header h1 {
    font-size: 2rem;
  }

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

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

  .game-card-emoji {
    height: 72px;
    font-size: 1.9rem;
  }

  .game-panel,
  .game {
    padding: 12px;
  }

  .game-stats {
    gap: 8px;
    font-size: 0.86rem;
  }

  .game-stats span {
    padding: 5px 9px;
  }

  .dino-canvas {
    height: 320px;
  }

  .stack-area {
    height: 280px;
  }

  .catch-area {
    height: 220px;
  }

  .match-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .custom-list {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    max-height: 180px;
  }

  .custom-modal-card {
    width: min(560px, 94vw);
    max-height: calc(100vh - 18px);
  }
}

@media (max-width: 520px) {
  .btn {
    font-size: 0.92rem;
    padding: 10px 16px;
  }

  .games-list { grid-template-columns: repeat(2, 1fr); }
  .memory-grid { grid-template-columns: repeat(3, 1fr); }
  .catch-area { height: 200px; }
  .match-grid { grid-template-columns: repeat(4, 1fr); }
  .stack-area { height: 240px; }
  .dino-canvas { height: 280px; }
}
