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

  --primary-color: #1f2f61;
  --secondary-color: #224ca4;
  --light-color: #a7c2da;
}

* {
  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 {
  font-family: inherit;
}

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

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

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

.back-link,
.brand-badge {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: 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 {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
}

.game-card {
  background: var(--card);
  box-shadow: var(--shadow);
  border-radius: 32px;
  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 16px;
  color: var(--muted);
  line-height: 1.9;
  font-size: 15px;
  max-width: 640px;
}

.hint-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffe9f5, #efe6ff);
  box-shadow: var(--shadow-soft);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.hint-label {
  font-weight: 800;
  color: var(--pink-dark);
}

#hint-text {
  color: var(--text);
  font-weight: 700;
}

.keyboard-note {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 14px;
}

.game-container {
  padding: 20px 30px;
  position: relative;
  margin: 0 auto 18px;
  min-height: 350px;
  width: min(100%, 560px);
  background: linear-gradient(180deg, #20315f, #18254b);
  border-radius: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.figure-container {
  fill: transparent;
  stroke: var(--light-color);
  stroke-width: 4px;
  stroke-linecap: round;
}

.figure-part {
  display: none;
}

.wrong-letters-container {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  text-align: right;
  color: var(--light-color);
  max-width: 150px;
}

.wrong-letters-container p {
  margin: 0 0 8px;
  font-weight: 700;
}

.wrong-letters-container span {
  font-size: 22px;
  margin-inline-start: 6px;
}

.word {
  display: flex;
  flex-direction: row;
  gap: 4px;
  justify-content: center;
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  flex-wrap: wrap;
  max-width: 90%;
}

.letter {
  border-bottom: 3px solid var(--secondary-color);
  display: inline-flex;
  font-size: 30px;
  align-items: center;
  justify-content: center;
  height: 50px;
  min-width: 28px;
  padding: 0 2px;
  color: #fff;
}

.keyboard {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 620px);
  margin: 0 auto;
}

.key-btn {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.key-btn:hover {
  transform: translateY(-1px);
}

.key-btn.used {
  opacity: 0.45;
  cursor: default;
}

.popup-container {
  background-color: rgba(0, 0, 0, 0.35);
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 16px;
}

.popup {
  background: linear-gradient(180deg, var(--purple), #7d62e5);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
  color: #fff;
  width: min(100%, 380px);
}

.popup h2,
.popup h3 {
  margin: 0 0 10px;
}

.popup button {
  cursor: pointer;
  background-color: #fff;
  color: var(--purple);
  border: 0;
  margin-top: 20px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 800;
  border-radius: 12px;
}

.popup button:active {
  transform: scale(0.98);
}

.popup button:focus {
  outline: none;
}

.notification-container {
  background: rgba(47, 36, 64, 0.9);
  color: #fff;
  border-radius: 14px 14px 0 0;
  padding: 15px 20px;
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  transition: bottom 0.3s ease-in-out;
  z-index: 30;
}

.notification-container.show {
  bottom: 0;
}

.notification-container p {
  margin: 0;
}

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

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

  .game-container {
    padding: 16px;
    min-height: 330px;
  }

  .letter {
    font-size: 24px;
    min-width: 22px;
  }

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

  .keyboard {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .key-btn {
    min-height: 42px;
    font-size: 17px;
  }
}