:root {
  --bg-1: #fff8fc;
  --bg-2: #f6f4ff;
  --card-bg: rgba(255, 255, 255, 0.92);
  --text: #2f2440;
  --muted: #786d8a;
  --pink: #ff78b2;
  --pink-dark: #e05597;
  --purple: #9f7dff;
  --blue: #7fd6ff;
  --gold: #f7c95c;
  --shadow: 0 18px 46px rgba(86, 53, 116, 0.14);
  --shadow-soft: 0 10px 24px rgba(86, 53, 116, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  direction: rtl;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Tahoma, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(255, 203, 227, 0.55), transparent 28%),
    radial-gradient(circle at bottom left, rgba(215, 223, 255, 0.72), transparent 34%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
}

a {
  color: inherit;
  text-decoration: none;
}

button,
select {
  font-family: inherit;
}

.game-page {
  min-height: 100vh;
  padding: 20px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-shell {
  width: min(100%, 960px);
}

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

.back-link,
.brand-badge {
  min-height: 44px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-soft);
  font-weight: 700;
}

.back-link {
  color: var(--muted);
}

.brand-badge {
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--purple));
}

.game-card {
  background: var(--card-bg);
  border-radius: 32px;
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
}

.game-kicker {
  margin: 0 0 8px;
  color: var(--pink-dark);
  font-size: 14px;
  font-weight: 800;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.1;
}

.game-desc {
  margin: 0 auto 18px;
  color: var(--muted);
  line-height: 1.9;
  font-size: 15px;
  max-width: 700px;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-box,
.level-box {
  background: linear-gradient(180deg, #eef3ff, #dde7ff);
  border-radius: 18px;
  padding: 14px 12px;
  box-shadow: var(--shadow-soft);
}

.stat-label,
.level-box label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.stat-box strong {
  font-size: 28px;
}

#level {
  width: 100%;
  min-height: 42px;
  border: none;
  border-radius: 12px;
  padding: 0 10px;
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.message {
  text-align: center;
  padding: 14px 16px;
  font-size: clamp(18px, 3vw, 26px);
  font-weight: 700;
  color: var(--text);
  background: linear-gradient(180deg, #eef3ff, #dde7ff);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 16px;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.primary-btn,
.secondary-btn {
  border: none;
  min-width: 150px;
  min-height: 48px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.primary-btn {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
}

.secondary-btn {
  background: #fff;
  color: var(--text);
}

.output {
  position: relative;
  width: 100%;
  min-height: 460px;
  border-radius: 24px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(240, 242, 255, 0.92)),
    linear-gradient(135deg, #fdf7ff, #eef4ff);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), var(--shadow-soft);
  border: 1px solid rgba(120, 109, 138, 0.12);
}

.shape {
  position: absolute;
  display: block;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
  border: 2px solid rgba(255, 255, 255, 0.75);
  transition: transform 0.08s ease;
}

.shape:active {
  transform: scale(0.96);
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 5;
}

.overlay-box {
  width: min(100%, 420px);
  background: rgba(255,255,255,0.94);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.overlay-box h2 {
  margin: 0 0 12px;
}

.overlay-box p {
  margin: 0;
  line-height: 1.9;
  color: var(--muted);
}

.hide {
  display: none !important;
}

@media (max-width: 760px) {
  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .game-page {
    padding: 14px 10px;
    align-items: flex-start;
  }

  .game-card {
    padding: 16px;
    border-radius: 24px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .output {
    min-height: 360px;
    border-radius: 18px;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }

  .game-desc {
    font-size: 14px;
  }
}