:root{
  --bg: #0b1020;
  --bg2: #0b1b2d;
  --card: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 255, 255, 0.10);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --muted2: rgba(255, 255, 255, 0.55);
  --accent: #7c3aed;
  --accent2: #22c55e;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: light){
  :root{
    --bg: #f6f7fb;
    --bg2: #eef1f8;
    --card: rgba(255, 255, 255, 0.75);
    --stroke: rgba(15, 23, 42, 0.10);
    --text: rgba(15, 23, 42, 0.92);
    --muted: rgba(15, 23, 42, 0.66);
    --muted2: rgba(15, 23, 42, 0.52);
    --shadow: 0 22px 70px rgba(2, 6, 23, 0.12);
  }
}

*{ box-sizing: border-box; }

html, body{
  height: 100%;
}

body{
  margin: 0;
  font-family: "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background:
    radial-gradient(1200px 900px at 20% 10%, rgba(124, 58, 237, 0.22), transparent 55%),
    radial-gradient(1000px 800px at 90% 30%, rgba(34, 197, 94, 0.18), transparent 55%),
    linear-gradient(160deg, var(--bg), var(--bg2));
}

.wrap{
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: calc(28px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}

.card{
  width: min(640px, 100%);
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 28px 22px 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.badge{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  color: var(--muted);
  letter-spacing: 0.2px;
  font-weight: 600;
  font-size: 13px;
}

.title{
  margin: 16px 0 8px;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.35;
  font-weight: 700;
}

.subtitle{
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.9;
}

.hint{
  margin: 14px 0 0;
  color: var(--muted2);
  font-size: 13.5px;
  line-height: 1.8;
}

.game{
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--stroke);
}

.game__top{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.game__label{
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.game__stats{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted2);
  white-space: nowrap;
}

.game__stats strong{
  font-weight: 700;
  color: var(--text);
}

.game__sep{
  opacity: 0.6;
}

.game__frame{
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.game__canvas{
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.game__bottom{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.game__help{
  margin: 0;
  font-size: 12.5px;
  color: var(--muted2);
  line-height: 1.8;
}

.game__btn{
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  min-height: 44px;
  font-family: inherit;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.game__btn:hover{
  background: rgba(255, 255, 255, 0.10);
}

.game__btn:active{
  transform: translateY(1px);
}

.game__btn:focus-visible{
  outline: 3px solid rgba(124, 58, 237, 0.35);
  outline-offset: 2px;
}

.footer{
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--stroke);
  color: var(--muted2);
  font-size: 12.5px;
}

@media (prefers-reduced-motion: reduce){
  .game__btn{ transition: none; }
}

@media (max-width: 480px){
  .wrap{ padding: calc(18px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); }

  .card{
    border-radius: 16px;
    padding: 20px 16px 14px;
  }

  .badge{ font-size: 12px; }

  .subtitle{
    font-size: 14.5px;
    line-height: 1.85;
  }

  .game__top{
    flex-direction: column;
    align-items: flex-start;
  }

  .game__stats{
    white-space: normal;
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  .game__bottom{
    flex-direction: column;
    align-items: stretch;
  }

  .game__help{ font-size: 12px; }

  .game__btn{ width: 100%; }
}
