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

*,
*::before,
*::after{
  box-sizing:border-box;
  margin:0;
  padding:0;
}

html{
  direction:rtl;
}

body{
  min-height:100vh;
  font-family:Tahoma, Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at top right, rgba(255,203,227,.55), transparent 28%),
    radial-gradient(circle at bottom left, rgba(215,223,255,.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%, 980px);
}

.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,.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-bg);
  box-shadow:var(--shadow);
  border-radius:32px;
  padding:24px;
}

.game-header{
  display:grid;
  grid-template-columns:minmax(0,1fr) 220px;
  gap:18px;
  align-items:start;
  margin-bottom:18px;
}

.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{
  color:var(--muted);
  line-height:1.9;
  font-size:15px;
  max-width:620px;
}

.status-panel{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.status-box{
  background:linear-gradient(180deg,#eef3ff,#dde7ff);
  padding:16px;
  border-radius:20px;
  box-shadow:var(--shadow-soft);
  text-align:center;
}

.status-label{
  display:block;
  color:var(--muted);
  font-size:13px;
  margin-bottom:8px;
}

.difficulty-select{
  width:100%;
  min-height:44px;
  border:none;
  border-radius:14px;
  padding:0 12px;
  background:#fff;
  color:var(--text);
  font-size:15px;
  font-weight:700;
}

.canvas-wrap{
  display:flex;
  justify-content:center;
  align-items:center;
  margin-bottom:16px;
}

canvas{
  width:100%;
  max-width:700px;
  height:auto;
  border:2px solid #111;
  border-radius:18px;
  background:#000;
  box-shadow:var(--shadow-soft);
}

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

.game-btn{
  background:linear-gradient(135deg,var(--pink),var(--purple));
  border:none;
  color:#fff;
  padding:12px 18px;
  font-size:16px;
  cursor:pointer;
  border-radius:14px;
  box-shadow:var(--shadow-soft);
  font-weight:700;
}

.game-btn:hover{
  opacity:.92;
}

.ghost-btn{
  background:#f1f1f1;
  color:#3d3651;
}

.control{
  text-align:center;
  color:var(--muted);
  line-height:1.9;
  font-size:14px;
  margin-bottom:14px;
}

.touch-controls{
  display:none;
  grid-template-columns:1fr 1fr;
  gap:12px;
  max-width:260px;
  margin:0 auto;
}

.touch-btn{
  min-height:54px;
  border:none;
  border-radius:16px;
  background:#fff;
  color:var(--text);
  font-size:24px;
  font-weight:700;
  box-shadow:var(--shadow-soft);
}

.modal-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.35);
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:50;
}

.modal-overlay.show{
  display:flex;
}

.modal-box{
  width:min(100%, 360px);
  background:#fff;
  border-radius:20px;
  padding:24px;
  text-align:center;
  box-shadow:var(--shadow);
}

.modal-box h3{
  margin-bottom:18px;
  line-height:1.7;
  color:var(--text);
}

@media (max-width: 760px){
  .game-header{
    grid-template-columns:1fr;
  }
}

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

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

  .game-btn{
    width:100%;
  }

  .button-row{
    gap:10px;
  }

  .touch-controls{
    display:grid;
  }
}