:root {
  --bg-1: #7f00ff;
  --bg-2: #e100ff;
  --text-main: #ffffff;
  --text-muted: #f3eaff;
  --glass: rgba(255, 255, 255, 0.18);
  --glass-border: rgba(255, 255, 255, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "arial","Vazirmatn", sans-serif;
  color: var(--text-main);
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(10px);
}

body::before {
  width: 320px;
  height: 320px;
  background: #00e5ff;
  top: -90px;
  left: -90px;
  opacity: 0.45;
}

body::after {
  width: 260px;
  height: 260px;
  background: #ffd600;
  bottom: -80px;
  right: -50px;
  opacity: 0.35;
}

.home {
  width: min(1100px, 92%);
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.hidden {
  display: none;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.hero-badge {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 0.95rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.3rem);
  font-weight: 900;
  letter-spacing: 0.2px;
  text-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

.hero-subtitle {
  max-width: 650px;
  margin: 1rem auto 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.9;
}

.categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.category-card {
  position: relative;
  padding: 1rem 1rem 1.2rem;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 25px rgba(0, 0, 0, 0.16);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  cursor: pointer;
}

.category-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0.25;
  z-index: -1;
}

.category-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.22);
}

.emoji {
  font-size: 1.8rem;
}

.category-card h2 {
  margin: 0.55rem 0 0.45rem;
  font-size: 1.15rem;
  font-weight: 800;
}

.category-card p {
  margin: 0;
  color: #fff8ff;
  line-height: 1.75;
  font-size: 0.92rem;
}

.games::before {
  background: linear-gradient(135deg, #00c6ff, #0072ff);
}

.animals::before {
  background: linear-gradient(135deg, #f857a6, #ff5858);
}

.celebrities::before {
  background: linear-gradient(135deg, #ffd200, #ff8c00);
}

.foods::before {
  background: linear-gradient(135deg, #43e97b, #38f9d7);
}

.movies::before {
  background: linear-gradient(135deg, #8e2de2, #4a00e0);
}

.category-page {
  width: min(900px, 92%);
  margin: 0 auto;
  padding: 2.4rem 0 3.2rem;
}

.settings-page,
.pregame-page,
.mask-page,
.phase-one-page,
.phase-one-summary-page {
  width: min(900px, 92%);
  margin: 0 auto;
  padding: 2.4rem 0 3.2rem;
}

.category-hero {
  text-align: center;
  margin-bottom: 1.2rem;
}

.category-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 2.8rem);
  font-weight: 900;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.rules-card {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 14px 25px rgba(0, 0, 0, 0.15);
  padding: 1rem 1.2rem;
}

.rules-card h2 {
  margin: 0.1rem 0 0.8rem;
  font-size: 1.5rem;
}

.rules-card ol {
  margin: 0;
  padding-right: 1.1rem;
  line-height: 2;
}

.category-actions {
  display: flex;
  justify-content: center;
  gap: 0.9rem;
  margin-top: 1.3rem;
  flex-wrap: wrap;
}

.action-btn {
  border: 0;
  border-radius: 12px;
  padding: 0.72rem 1.3rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-btn:hover {
  transform: translateY(-2px);
}

.start-btn {
  color: #23004a;
  background: linear-gradient(120deg, #ffe259, #ffa751);
  box-shadow: 0 8px 16px rgba(255, 203, 86, 0.35);
}

.back-btn {
  color: white;
  background: linear-gradient(120deg, #00c6ff, #0072ff);
  box-shadow: 0 8px 16px rgba(37, 157, 255, 0.35);
}

.action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.settings-card {
  display: grid;
  gap: 0.9rem;
}

.setting-row {
  display: grid;
  gap: 0.4rem;
}

.setting-row label {
  font-weight: 700;
}

.setting-row input {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.9);
  color: #2b1d3d;
  border-radius: 4px;
  padding: 0.95rem 0.9rem;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  min-height: 64px;
  width: 100%;
}

.selection-status {
  margin: 0 0 0.9rem;
  font-weight: 700;
}

.words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.7rem;
}

.word-chip {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border-radius: 12px;
  padding: 0.7rem 0.6rem;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.word-chip:hover {
  transform: translateY(-1px);
}

.word-chip.selected {
  font-weight: 900;
  background: rgba(255, 255, 255, 0.95);
  color: #2f1751;
}

.mask-card {
  text-align: center;
  padding: 1.3rem 1rem;
}

.mask-card h2 {
  margin-top: 0;
}

.phase-card-wrap {
  text-align: center;
}

.phase-card {
  margin: 0 auto;
  width: min(380px, 90%);
  min-height: 210px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: linear-gradient(135deg, #4a00e0, #8e2de2);
  display: grid;
  place-items: center;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.2);
  padding: 1rem;
}

.phase-card.front {
  background: linear-gradient(135deg, #00c6ff, #0072ff);
}

.phase-card-text {
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 900;
  text-align: center;
  word-break: break-word;
}

.phase-message {
  margin: 1rem 0 0;
  font-size: 1rem;
}

.said-btn {
  color: #fff;
  background: linear-gradient(120deg, #1ecb7f, #0f9b5f);
  box-shadow: 0 8px 16px rgba(19, 171, 108, 0.35);
}

.danger-btn {
  color: #fff;
  background: linear-gradient(120deg, #ff4b4b, #c9184a);
  box-shadow: 0 8px 16px rgba(220, 40, 75, 0.35);
}

.scores-list {
  display: grid;
  gap: 0.6rem;
}

.phase-live-panel {
  margin-bottom: 1rem;
}

.phase-timer-panel {
  margin-bottom: 1rem;
  text-align: center;
}

.phase-timer-label {
  margin: 0 0 0.65rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-muted);
}

.phase-timer-bar-track {
  height: 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.phase-timer-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00e5ff, #ffe259);
  box-shadow: 0 0 12px rgba(255, 226, 89, 0.45);
  transition: width 0.35s linear;
  transform-origin: right center;
}

.time-up-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(
      circle at 50% 40%,
      rgba(80, 0, 120, 0.92),
      rgba(20, 0, 40, 0.97)
    );
  backdrop-filter: blur(6px);
}

.time-up-overlay.hidden {
  display: none;
}

.time-up-overlay-title {
  margin: 0;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  line-height: 1.5;
}

#remainingWordsInfo {
  margin: 0 0 0.75rem;
  font-weight: 800;
}

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  font-weight: 700;
}

.all-words-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
}

.all-word-item {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 0.55rem 0.5rem;
  text-align: center;
  font-size: 0.93rem;
}

#allWordsPanel {
  margin-top: 1rem;
}

@media (max-width: 620px) {
  .home {
    padding-top: 2.4rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .rules-card {
    padding: 1rem;
  }
}
